ompchamber 2.0.0 → 2.0.2
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/README.md +12 -0
- package/dist/client/index.html +1 -1
- package/dist/client/static/js/async/{g.74ff36419f.js → g.cb81980498.js} +2 -2
- package/dist/client/static/js/async/{q.33d6779f98.js → q.22588845a9.js} +2 -2
- package/dist/client/static/js/async/{yx.af2936c368.js → xn1.83a7784fe1.js} +3 -3
- package/dist/client/static/js/{index.c05535dbde.js → index.e6a257402a.js} +2 -2
- package/package.json +1 -1
- package/src/client/components/workspace/diff-panel/SplitView.tsx +4 -1
- package/src/client/components/workspace/diff-panel/UnifiedView.tsx +70 -65
- package/src/client/components/workspace/diff-panel/index.tsx +8 -1
- package/src/client/components/workspace/editor/index.tsx +7 -0
- package/src/client/hooks/editor/save-file.ts +62 -0
- package/src/client/hooks/editor/use-file-editor.test.ts +61 -5
- package/src/client/hooks/editor/use-file-editor.ts +38 -29
- package/src/client/hooks/editor/use-file-transfer.ts +5 -2
- package/src/server/routes/fs/action.test.ts +64 -0
- package/src/server/routes/fs/action.ts +10 -1
- package/src/shared/lib/code/line-endings.test.ts +38 -0
- package/src/shared/lib/code/line-endings.ts +56 -0
- /package/dist/client/static/js/async/{g.74ff36419f.js.LICENSE.txt → g.cb81980498.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{q.33d6779f98.js.LICENSE.txt → q.22588845a9.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{yx.af2936c368.js.LICENSE.txt → xn1.83a7784fe1.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/{index.c05535dbde.js.LICENSE.txt → index.e6a257402a.js.LICENSE.txt} +0 -0
package/README.md
CHANGED
|
@@ -297,6 +297,18 @@ Two things to set up once and one to never do:
|
|
|
297
297
|
`main` — it scans the whole message and silently skips the release run. Only the bot's release
|
|
298
298
|
commit carries one, so that it does not re-trigger the workflow.
|
|
299
299
|
|
|
300
|
+
## Contributing
|
|
301
|
+
|
|
302
|
+
Issues and pull requests both get an automated first pass: a GitHub App runs the `omp` agent headlessly
|
|
303
|
+
to triage a new issue and to review a pull request, and its verdict is published as a `review:*` label.
|
|
304
|
+
|
|
305
|
+
- [`CONTRIBUTING.md`](CONTRIBUTING.md) is the policy — the four mandatory gates, the pull request
|
|
306
|
+
sections the reviewer checks, what counts as evidence, and the label a review moves through.
|
|
307
|
+
- The command surface is `@<bot> help | review | summarize | triage | reproduce` as the first line of a
|
|
308
|
+
comment. Run the **bot config check** workflow to print the name this repository answers to.
|
|
309
|
+
- Bugs go through the issue form; requests through the feature form. Design and scope stay the
|
|
310
|
+
maintainer's call, and `AGENTS.md` is the normative reference for the code rules.
|
|
311
|
+
|
|
300
312
|
## License
|
|
301
313
|
|
|
302
314
|
No license file is included. The source is public on GitHub and published to npm, but all rights are
|
package/dist/client/index.html
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
|
|
27
27
|
/>
|
|
28
28
|
<!--app-head-->
|
|
29
|
-
<script defer src="/static/js/markdown-vendor.71e43278b3.js"></script><script defer src="/static/js/shiki-vendor.cb8452ddcd.js"></script><script defer src="/static/js/77.0d81c74cf0.js"></script><script defer src="/static/js/index.
|
|
29
|
+
<script defer src="/static/js/markdown-vendor.71e43278b3.js"></script><script defer src="/static/js/shiki-vendor.cb8452ddcd.js"></script><script defer src="/static/js/77.0d81c74cf0.js"></script><script defer src="/static/js/index.e6a257402a.js"></script><link href="/static/css/index.5f630421b7.css" rel="stylesheet"></head>
|
|
30
30
|
<body>
|
|
31
31
|
<div id="app"></div>
|
|
32
32
|
<!--app-bootstrap-->
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! LICENSE: g.
|
|
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,F]=(0,s.J0)(!1),[S,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,()=>F(!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:()=>F(!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"}),S&&S.messagesCount>0&&(0,i.Y)("span",{className:"w-1.5 h-1.5 rounded-full bg-success"})]}),S&&0!==S.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:S.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)(S.contextUsed)??"0"," / ",(0,g.Rk)(S.contextLimit)??"0"," (",S.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:S.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:S.costFormatted})]}),"number"==typeof S.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:[S.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("L");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"),F=n("O");let S=(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)(F.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)(S,{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 I(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 J=n("C4"),M=n("NR"),U=n("U"),L=n("A");function K(e){let{folder:t,activeSessionId:n,onSelectSession:a,isExpanded:l,onToggleExpand:r,showArchived:o=!1,sessionStatus:d={}}=e,{visibleCount:p,showMore:h}=(0,M.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:F}=(0,U.C)(t,x);(0,m.W)(g,()=>{b(!1),N()});let S=(t.sessions||[]).filter(e=>o?1===e.is_archived:1!==e.is_archived),D=S.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:S.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)(J.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)(I,{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 F(e,t)},e.id)),S.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 (",S.length-p,")"]})]})]})]})}var H=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,H.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)(K,{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}),[F,S]=(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:I,handleScroll:J}=(0,H.K)();return(0,s.vJ)(()=>{S(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:F,showArchived:f,sessionStatus:Y,isScrolling:I,onScroll:J,onSelectSession:y,onToggleFolder:e=>{S(t=>({...t,[e]:!t[e]}));let t=d.find(t=>t.id===e),n=!(F[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("rz"),ev=n("uf"),eN=n("hR"),eY=n("Kv"),ew=n("Soe"),ey=n("bH"),eF=n("yh"),eS=n("hj"),eD=n("na"),eC=n("b0"),eA=n("tC"),ez=n("pX");function ej(e){let{fileName:t,isMarkdown:n,isPreview:s,wordWrap:a,copied:l,isImage:r=!1,onClose:o,onTogglePreview:c,onToggleWrap:d,onZoomOut:h,onZoomIn:m,onCopy:x,onDownload:f}=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:o,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)(eY.A,{size:18,strokeWidth:2})}),(0,i.FD)("div",{className:"flex items-center space-x-1.5 truncate",children:[(0,i.Y)(ez.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:c,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)(ew.A,{size:15}):(0,i.Y)(ey.A,{size:15})}),!r&&(0,i.FD)(i.FK,{children:[(0,i.Y)("button",{type:"button",onClick:d,className:`p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer ${a?"text-ink":""}`,title:"Toggle word wrap",children:(0,i.Y)(eF.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:"Decrease font size",children:(0,i.Y)(eS.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:"Increase font size",children:(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:"Copy content",children:l?(0,i.Y)(p.A,{size:15,className:"text-success"}):(0,i.Y)(eC.A,{size:15})}),(0,i.Y)("button",{type:"button",onClick:f,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Download file",children:(0,i.Y)(eA.A,{size:15})})]})]})}var eT=n("FW");function eO(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,H.K)(),x=t.name.endsWith(".md"),f=(0,eT.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)(ej,{fileName:t.name,isMarkdown:x,isPreview:l,wordWrap:d,copied:f.copied,isImage:f.isImage,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}),f.isImage&&f.imageUrl?(0,i.Y)(eN.a,{src:f.imageUrl,name:t.name,className:"flex-1 min-h-0"}):(0,i.Y)("div",{onScroll:m,className:`flex-1 min-h-0 overflow-auto relative bg-paper text-ink select-text ${(0,H.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",children:(0,i.Y)(ek.T,{content:u,document:!0,scope:{path:t.path??t.name,root:t.root,repo:t.repo}})}):(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.Y)("div",{className:"flex items-center space-x-3",children:f.isImage?(0,i.Y)("span",{className:"uppercase",children:"Image"}):(0,i.FD)(i.FK,{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 eW=n("Xg"),eP=n("LQ");function eR(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,eP.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)(eY.A,{size:18,strokeWidth:1.9})}),(0,i.Y)(ez.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)(eW.M,{className:"h-full",filePath:t.path,status:r,isStaged:l,root:t.root,repo:t.repo||".",onFileSaved:s})})]})}var e$=n("u"),eE=n("Gb"),eI=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,F]=(0,s.J0)(!1),[S,D]=(0,s.J0)("appearance"),[C,A]=(0,s.J0)(!1),z=(0,s.hb)(()=>w(e=>e+1),[]),{folder:j}=(0,eE.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),F(!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,eI.l)(r,d,m??void 0);e&&(0,eI.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)(eO,{file:b,onClose:()=>g(null),onFileSaved:z}),k&&(0,i.Y)(eR,{diff:k,onClose:()=>v(null),onFileSaved:z}),(0,i.Y)(e$.b,{isOpen:y,onClose:()=>{F(!1),A(!1)},initialCategory:S,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
|
+
/*! LICENSE: g.cb81980498.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,F]=(0,s.J0)(!1),[S,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,()=>F(!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:()=>F(!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"}),S&&S.messagesCount>0&&(0,i.Y)("span",{className:"w-1.5 h-1.5 rounded-full bg-success"})]}),S&&0!==S.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:S.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)(S.contextUsed)??"0"," / ",(0,g.Rk)(S.contextLimit)??"0"," (",S.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:S.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:S.costFormatted})]}),"number"==typeof S.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:[S.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("L");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"),F=n("O");let S=(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)(F.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)(S,{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 I(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 J=n("C4"),M=n("NR"),U=n("U"),L=n("A");function K(e){let{folder:t,activeSessionId:n,onSelectSession:a,isExpanded:l,onToggleExpand:r,showArchived:o=!1,sessionStatus:d={}}=e,{visibleCount:p,showMore:h}=(0,M.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:F}=(0,U.C)(t,x);(0,m.W)(g,()=>{b(!1),N()});let S=(t.sessions||[]).filter(e=>o?1===e.is_archived:1!==e.is_archived),D=S.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:S.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)(J.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)(I,{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 F(e,t)},e.id)),S.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 (",S.length-p,")"]})]})]})]})}var H=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,H.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)(K,{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}),[F,S]=(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:I,handleScroll:J}=(0,H.K)();return(0,s.vJ)(()=>{S(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:F,showArchived:f,sessionStatus:Y,isScrolling:I,onScroll:J,onSelectSession:y,onToggleFolder:e=>{S(t=>({...t,[e]:!t[e]}));let t=d.find(t=>t.id===e),n=!(F[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("rz"),ev=n("uf"),eN=n("hR"),eY=n("Kv"),ew=n("Soe"),ey=n("bH"),eF=n("yh"),eS=n("hj"),eD=n("na"),eC=n("b0"),eA=n("tC"),ez=n("pX");function ej(e){let{fileName:t,isMarkdown:n,isPreview:s,wordWrap:a,copied:l,isImage:r=!1,onClose:o,onTogglePreview:c,onToggleWrap:d,onZoomOut:h,onZoomIn:m,onCopy:x,onDownload:f}=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:o,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)(eY.A,{size:18,strokeWidth:2})}),(0,i.FD)("div",{className:"flex items-center space-x-1.5 truncate",children:[(0,i.Y)(ez.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:c,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)(ew.A,{size:15}):(0,i.Y)(ey.A,{size:15})}),!r&&(0,i.FD)(i.FK,{children:[(0,i.Y)("button",{type:"button",onClick:d,className:`p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer ${a?"text-ink":""}`,title:"Toggle word wrap",children:(0,i.Y)(eF.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:"Decrease font size",children:(0,i.Y)(eS.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:"Increase font size",children:(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:"Copy content",children:l?(0,i.Y)(p.A,{size:15,className:"text-success"}):(0,i.Y)(eC.A,{size:15})}),(0,i.Y)("button",{type:"button",onClick:f,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Download file",children:(0,i.Y)(eA.A,{size:15})})]})]})}var eT=n("HQ");function eO(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,H.K)(),x=t.name.endsWith(".md"),f=(0,eT.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)(ej,{fileName:t.name,isMarkdown:x,isPreview:l,wordWrap:d,copied:f.copied,isImage:f.isImage,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}),f.isImage&&f.imageUrl?(0,i.Y)(eN.a,{src:f.imageUrl,name:t.name,className:"flex-1 min-h-0"}):(0,i.Y)("div",{onScroll:m,className:`flex-1 min-h-0 overflow-auto relative bg-paper text-ink select-text ${(0,H.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",children:(0,i.Y)(ek.T,{content:u,document:!0,scope:{path:t.path??t.name,root:t.root,repo:t.repo}})}):(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.Y)("div",{className:"flex items-center space-x-3",children:f.isImage?(0,i.Y)("span",{className:"uppercase",children:"Image"}):(0,i.FD)(i.FK,{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 eW=n("Xg"),eP=n("LQ");function eR(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,eP.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)(eY.A,{size:18,strokeWidth:1.9})}),(0,i.Y)(ez.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)(eW.M,{className:"h-full",filePath:t.path,status:r,isStaged:l,root:t.root,repo:t.repo||".",onFileSaved:s})})]})}var e$=n("u"),eE=n("Gb"),eI=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,F]=(0,s.J0)(!1),[S,D]=(0,s.J0)("appearance"),[C,A]=(0,s.J0)(!1),z=(0,s.hb)(()=>w(e=>e+1),[]),{folder:j}=(0,eE.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),F(!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,eI.l)(r,d,m??void 0);e&&(0,eI.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)(eO,{file:b,onClose:()=>g(null),onFileSaved:z}),k&&(0,i.Y)(eR,{diff:k,onClose:()=>v(null),onFileSaved:z}),(0,i.Y)(e$.b,{isOpen:y,onClose:()=>{F(!1),A(!1)},initialCategory:S,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: q.
|
|
1
|
+
/*! LICENSE: q.22588845a9.js.LICENSE.txt */
|
|
2
2
|
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["q"],{o3(e,t,i){i.d(t,{Editor:()=>$});var n=i("j"),r=i("H"),a=i("pX"),o=i("uf"),s=i("rz"),l=i("jo"),c=i("YOg"),d=i("S"),m=i("Go"),p=i("oj"),f=i("LQ");function h(e){let{openedFiles:t,activeFileId:i,onSelectFile:o,onCloseFile:s}=e,l=(0,r.li)(null),h=(0,r.li)(null),[x,u]=(0,r.J0)(5),[v,k]=(0,r.J0)(!1);(0,p.W)(h,()=>k(!1)),(0,r.vJ)(()=>{let e=new ResizeObserver(e=>{for(let t of e)u(Math.max(1,Math.floor((t.contentRect.width-60)/150)))});return l.current&&e.observe(l.current),()=>e.disconnect()},[]);let b=[],g=[];if(t.length<=x)b=t;else{let e=t.findIndex(e=>e.id===i),n=new Set;-1!==e&&null!==i&&n.add(i);for(let e=t.length-1;e>=0&&!(n.size>=x);e--)n.add(t[e].id);b=t.filter(e=>n.has(e.id)),g=t.filter(e=>!n.has(e.id))}return(0,n.FD)("div",{className:"flex bg-ink/10 w-full relative border-b border-ink/10",ref:l,children:[(0,n.Y)("div",{className:"flex overflow-hidden",children:b.map(e=>{let t=e.id===i,r=!!e.isDiff,l=r?(0,f.R)(e.diffStatus||"M",e.diffStaged):null;return(0,n.FD)("div",{onClick:()=>o(e.id),className:`flex items-center space-x-1.5 px-3 py-1.5 cursor-pointer border-r border-ink/10 min-w-[120px] max-w-[210px] group ${t?"bg-paper border-t-2 border-t-ink text-ink":"bg-transparent border-t-2 border-t-transparent text-ink/60 hover:bg-paper/50"}`,title:e.path,children:[r?(0,n.Y)(c.A,{size:14,className:t?"text-blue-600 dark:text-blue-400 flex-shrink-0":"opacity-60 flex-shrink-0"}):(0,n.Y)(a.o,{name:e.name,size:14,className:t?"flex-shrink-0":"opacity-60 flex-shrink-0"}),(0,n.Y)("span",{className:"text-xs font-mono truncate flex-1",children:e.name}),l&&(0,n.Y)("span",{className:`px-1 text-[9px] font-mono font-bold rounded ${l.badgeBgClass}`,children:l.charStatus}),(0,n.Y)("div",{className:`p-0.5 rounded hover:bg-ink/10 ${t?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:t=>{t.stopPropagation(),s(e.id)},children:(0,n.Y)(d.A,{size:12})})]},e.id)})}),g.length>0&&(0,n.FD)("div",{className:"relative flex items-center ml-auto bg-ink/10",ref:h,children:[(0,n.Y)("button",{className:`p-1.5 mx-1 rounded hover:bg-ink/10 text-ink/60 ${v?"bg-ink/10 text-ink":""}`,onClick:()=>k(!v),title:"More open files",children:(0,n.Y)(m.A,{size:14})}),v&&(0,n.FD)("div",{className:"absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1",children:[(0,n.Y)("div",{className:"px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1",children:"Older Tabs"}),g.map(e=>(0,n.FD)("div",{onClick:()=>{o(e.id),k(!1)},className:"flex items-center space-x-2 px-3 py-1.5 hover:bg-ink/5 cursor-pointer group",children:[e.isDiff?(0,n.Y)(c.A,{size:14,className:"text-blue-600 opacity-70"}):(0,n.Y)(a.o,{name:e.name,size:14,className:"opacity-60"}),(0,n.Y)("span",{className:"text-xs font-mono truncate flex-1 text-ink/80",children:e.name}),(0,n.Y)("div",{className:"p-0.5 rounded hover:bg-ink/10 opacity-0 group-hover:opacity-100",onClick:t=>{t.stopPropagation(),s(e.id),1===g.length&&k(!1)},children:(0,n.Y)(d.A,{size:12,className:"text-ink/60"})})]},e.id))]})]})]})}var x=i("ES"),u=i("z"),v=i("Soe"),k=i("bH"),b=i("yh"),g=i("hj"),N=i("na"),y=i("b0"),Y=i("tC");let w=(0,i("y").A)({name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]});function z(e){let{path:t,saveStatus:i,wordWrap:r,isMd:a,isPreview:o,isImage:s=!1,onSave:l,onTogglePreview:c,onToggleWordWrap:d,onZoomIn:m,onZoomOut:p,onCopy:f,onDownload:h,onToggleMaximize:z}=e;return(0,n.FD)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-ink/10 bg-paper",children:[(0,n.Y)("div",{className:"flex items-center space-x-2 text-xs font-mono text-ink/40",children:(0,n.Y)("span",{className:"truncate max-w-[300px]",title:t,children:t})}),(0,n.FD)("div",{className:"flex items-center space-x-3 text-ink/40",children:[!s&&(0,n.Y)("div",{className:"flex items-center pr-3 border-r border-ink/10",children:(0,n.Y)("button",{type:"button",onClick:l,className:"flex items-center justify-center rounded hover:bg-ink/5 transition-colors",title:"Save file (Ctrl+S)",children:"saving"===i?(0,n.Y)(x.A,{size:14,className:"text-amber-500 animate-pulse"}):"saved"===i?(0,n.Y)(u.A,{size:14,className:"text-success"}):(0,n.Y)(x.A,{size:14,className:"hover:text-ink cursor-pointer"})})}),a&&(0,n.Y)("div",{onClick:c,className:"flex items-center pr-3 border-r border-ink/10",children:o?(0,n.Y)(v.A,{size:14,className:"hover:text-ink cursor-pointer"}):(0,n.Y)(k.A,{size:14,className:"hover:text-ink cursor-pointer"})}),!s&&(0,n.FD)(n.FK,{children:[(0,n.Y)("div",{className:"flex items-center space-x-2 pr-3 border-r border-ink/10",children:(0,n.Y)(b.A,{size:14,className:`cursor-pointer ${r?"text-ink":"hover:text-ink"}`,onClick:d})}),(0,n.FD)("div",{className:"flex items-center space-x-2 pr-3 border-r border-ink/10",children:[(0,n.Y)(g.A,{size:14,className:"hover:text-ink cursor-pointer",onClick:p}),(0,n.Y)(N.A,{size:14,className:"hover:text-ink cursor-pointer",onClick:m})]})]}),(0,n.FD)("div",{className:"flex items-center space-x-2 pr-3 border-r border-ink/10",children:[(0,n.Y)(y.A,{size:14,className:"hover:text-ink cursor-pointer",onClick:f}),(0,n.Y)(Y.A,{size:14,className:"hover:text-ink cursor-pointer",onClick:h})]}),(0,n.Y)("div",{className:"flex items-center pl-1",children:(0,n.Y)(w,{size:14,className:"hover:text-ink cursor-pointer",onClick:z})})]})]})}var C=i("hR");function S(e){if(e.endsWith(".md"))return`# ${e.replace(".md","")}
|
|
3
3
|
|
|
4
4
|
This is a mock markdown file.
|
|
@@ -18,4 +18,4 @@ export default function ${t||"Component"}() {
|
|
|
18
18
|
}`:e.endsWith(".css")?`.container {
|
|
19
19
|
display: flex;
|
|
20
20
|
flex-direction: column;
|
|
21
|
-
}`:`Content for ${e}`}var F=i("Xg"),M=i("FL"),A=i("As"),D=i("SS"),W=i("
|
|
21
|
+
}`:`Content for ${e}`}var F=i("Xg"),M=i("FL"),A=i("As"),D=i("SS"),W=i("HQ");function $(e){let{className:t="",openedFiles:i,activeFileId:c,onSelectFile:d,onCloseFile:m,refreshKey:p=0,onFileSaved:f}=e,x=i.find(e=>e.id===c),[u,v,k]=(0,M.bL)("editor.previewMode",{}),[b,g]=(0,M.bL)("editor.zoomLevel",12),[N,y]=(0,r.J0)(!1),[Y,w]=(0,M.bL)("editor.wordWrap",!0),{sessionId:$}=(0,A.O)(),{isScrolling:H,handleScroll:j}=(0,l.K)(),J=(0,W.n)(x??null,{fallback:S,onFileSaved:f});if((0,r.vJ)(()=>{p>0&&J.reset()},[p]),(0,r.vJ)(()=>{J.retain(i.map(e=>e.id))},[i]),(0,r.vJ)(()=>{if(!k)return;let e=x?.id;if(null==e||!x.name.endsWith(".md"))return;let t=(0,D.WV)($,"editor.previewMode");t&&void 0!==t[e]||v(t=>void 0===t[e]?{...t,[e]:!0}:t)},[k,x]),(0,r.vJ)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key&&(e.preventDefault(),J.saveNow())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[J.saveNow]),0===i.length)return(0,n.FD)("div",{className:`flex flex-col h-full bg-canvas items-center justify-center text-ink/40 ${t}`,children:[(0,n.Y)(a.o,{name:"placeholder.txt",size:48,className:"mb-4 opacity-20"}),(0,n.Y)("p",{className:"font-mono text-sm",children:"Select a file to open"})]});let L=J.content,I=x?.name.endsWith(".md"),O=!!x&&u[x.id],P="error"===J.saveStatus?"idle":J.saveStatus,T=N?"fixed inset-0 z-50 flex flex-col bg-canvas":`flex flex-col h-full bg-canvas ${t}`;return(0,n.FD)("div",{className:T,children:[(0,n.Y)(h,{openedFiles:i,activeFileId:c,onSelectFile:d,onCloseFile:m}),x?x.isDiff?(0,n.Y)(F.M,{filePath:x.path,status:x.diffStatus||"M",isStaged:!!x.diffStaged,root:x.root,repo:x.repo||".",onOpenInEditor:()=>{x.isDiff=!1,d(x.id)},onFileSaved:f,className:"flex-1"}):(0,n.FD)(n.FK,{children:[(0,n.Y)(z,{path:x.path,saveStatus:P,wordWrap:Y,isMd:I,isPreview:O,isImage:J.isImage,onSave:J.saveNow,onTogglePreview:()=>{x&&v(e=>({...e,[x.id]:!e[x.id]}))},onToggleWordWrap:()=>w(!Y),onZoomIn:()=>g(e=>Math.min(24,e+1)),onZoomOut:()=>g(e=>Math.max(8,e-1)),onCopy:J.copy,onDownload:J.download,onToggleMaximize:()=>y(!N)}),J.isImage&&J.imageUrl?(0,n.Y)(C.a,{src:J.imageUrl,name:x.name,className:"flex-1 min-h-0"}):(0,n.Y)("div",{onScroll:j,className:`flex-1 overflow-auto bg-paper flex ${(0,l.p)(H)}`,children:I&&O?(0,n.Y)("div",{className:"p-6 max-w-4xl mx-auto font-sans flex-1",style:{fontSize:`${b}px`},children:(0,n.Y)(s.T,{content:L,document:!0,scope:{path:x.path,root:x.root,repo:x.repo}})}):(0,n.Y)(o.P,{value:L,onValueChange:J.onChange,language:J.language,wordWrap:Y,rootClassName:"flex",gutterClassName:"flex flex-col text-right pl-4 pr-3 select-none text-ink/30 font-mono border-r border-ink/10 bg-canvas sticky left-0 z-10",gutterStyle:{fontSize:b,paddingTop:16,paddingBottom:16,lineHeight:1.5,fontFamily:'"Fira Code", "JetBrains Mono", "SF Mono", Consolas, monospace'},gutterLineClassName:"min-w-[1.5rem]",editorWrapperClassName:`flex-1 code-surface ${Y?"min-w-0":"min-w-max"}`,editorPadding:16,editorClassName:"font-mono focus:outline-none",editorStyle:{fontFamily:'"Fira Code", "JetBrains Mono", "SF Mono", Consolas, monospace',fontSize:b,lineHeight:1.5,minHeight:"100%",paddingBottom:16}})})]}):(0,n.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40",children:(0,n.Y)("p",{className:"font-mono text-sm",children:"Select a tab to view content"})})]})}},YOg(e,t,i){let n=(0,i("y").A)({name:"git-compare",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]});i.d(t,{},{A:n})},ES(e,t,i){let n=(0,i("y").A)({name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]});i.d(t,{},{A:n})}}]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! LICENSE:
|
|
2
|
-
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["
|
|
1
|
+
/*! LICENSE: xn1.83a7784fe1.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["xn1"],{uf(e,t,n){n.d(t,{P:()=>Y});var r=n("j"),i=n("H");let l=/[^a-z0-9]([a-z0-9]+)$/i;function a(e,t){e.stack.length&&e.offset>-1&&(e.stack=e.stack.slice(0,e.offset+1)),e.stack.push(t),e.offset=e.stack.length-1}function o(e,t){return e.substring(0,t).split("\n").pop()?.match(l)?.[1]}function s(e,t){let n="undo"===t?e.offset-1:e.offset+1,r=e.stack[n];return r?(e.offset="undo"===t?Math.max(n,0):Math.min(n,e.stack.length-1),r):null}let c=`
|
|
3
3
|
.code-editor-native-textarea {
|
|
4
4
|
-webkit-text-fill-color: transparent;
|
|
5
5
|
}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
-webkit-text-fill-color: var(--theme-ink);
|
|
8
8
|
opacity: 0.45;
|
|
9
9
|
}
|
|
10
|
-
`;function d(){return(0,r.Y)("style",{dangerouslySetInnerHTML:{__html:c}})}function u(e,t){return e.substring(0,t).split("\n")}function h(e){let{value:t,onValueChange:n,highlight:l,padding:c=0,preClassName:h,textareaClassName:f,style:p,preRef:m,className:x,placeholder:b,readOnly:g,autoFocus:y,virtual:v}=e,k=(0,i.li)(null),w=(0,i.li)({stack:[],offset:-1}),[N,Y]=(0,i.J0)(!0);(0,i.vJ)(()=>{let e=k.current;e&&a(w.current,{value:e.value,selectionStart:e.selectionStart,selectionEnd:e.selectionEnd,timestamp:Date.now()})},[t]);let D=e=>{let t=k.current,r=w.current.stack[w.current.offset];r&&t&&(w.current.stack[w.current.offset]={...r,selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}),function(e,t){if(a(e,t),e.stack.length<=100)return;let n=e.stack.length-100;e.stack=e.stack.slice(n),e.offset=Math.max(e.offset-n,0)}(w.current,{...e,timestamp:Date.now()}),n(e.value),t&&(t.value=e.value,t.selectionStart=e.selectionStart,t.selectionEnd=e.selectionEnd)},F={margin:0,border:0,background:"none",boxSizing:"inherit",display:"inherit",fontFamily:"inherit",fontSize:"inherit",fontStyle:"inherit",fontVariantLigatures:"inherit",fontWeight:"inherit",letterSpacing:"inherit",lineHeight:"inherit",tabSize:"inherit",textIndent:"inherit",textRendering:"inherit",textTransform:"inherit",whiteSpace:"pre-wrap",wordBreak:"keep-all",overflowWrap:"break-word"},C={paddingTop:c,paddingRight:c,paddingBottom:c,paddingLeft:c},S={...C,paddingTop:c+(v?.top??0),paddingBottom:c+(v?.bottom??0)},M=l(t,v??null);return(0,r.FD)("div",{className:x,style:{position:"relative",textAlign:"left",boxSizing:"border-box",padding:0,overflow:"hidden",...p},children:[(0,r.Y)("pre",{ref:m,className:h,"aria-hidden":"true",style:{...F,...S,position:"relative",pointerEvents:"none"},dangerouslySetInnerHTML:{__html:M+(v&&!v.breakAtEnd?"":"<br />")}}),(0,r.Y)("textarea",{ref:k,className:`code-editor-native-textarea${f?` ${f}`:""}`,style:{...F,...C,position:"absolute",top:0,left:0,height:"100%",width:"100%",resize:"none",color:"inherit",overflow:"hidden",WebkitTextFillColor:"transparent"},value:t,onChange:e=>{let{value:t,selectionStart:r,selectionEnd:i}=e.target,l=w.current,s=Date.now();if(function(e,t,n,r){if(!e||r-e.timestamp>=3e3)return!1;let i=o(e.value,e.selectionStart),l=o(t,n);return!!(i&&l?.startsWith(i))}(l.stack[l.offset],t,r,s)){l.stack=l.stack.slice(0,l.offset+1),l.stack[l.offset]={value:t,selectionStart:r,selectionEnd:i,timestamp:s},n(t);return}a(l,{value:t,selectionStart:r,selectionEnd:i,timestamp:s}),n(t)},onKeyDown:e=>{if("Escape"===e.key)return void e.currentTarget.blur();let{value:t,selectionStart:r,selectionEnd:i}=e.currentTarget,l=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),a=/Win/i.test(navigator.platform);if("Tab"===e.key&&N){if(e.preventDefault(),e.shiftKey){let e=u(t,r),n=e.length-1,l=u(t,i).length-1,a=t.split("\n").map((e,t)=>t>=n&&t<=l&&e.startsWith(" ")?e.substring(2):e).join("\n");if(a!==t){let l=e[n];D({value:a,selectionStart:l?.startsWith(" ")?r-2:r,selectionEnd:i-(t.length-a.length)})}}else if(r!==i){let e=u(t,r),n=e.length-1,l=u(t,i).length-1,a=e[n];D({value:t.split("\n").map((e,t)=>t>=n&&t<=l?" "+e:e).join("\n"),selectionStart:a&&/\S/.test(a)?r+2:r,selectionEnd:i+2*(l-n+1)})}else{let e=r+2;D({value:t.substring(0,r)+" "+t.substring(i),selectionStart:e,selectionEnd:e})}return}if("Backspace"===e.key&&r===i){if(t.substring(0,r).endsWith(" ")){e.preventDefault();let n=r-2;D({value:t.substring(0,r-2)+t.substring(i),selectionStart:n,selectionEnd:n})}return}if("Enter"===e.key&&r===i){let n=u(t,r).pop(),l=n?.match(/^\s+/);if(l?.[0]){e.preventDefault();let n="\n"+l[0],a=r+n.length;D({value:t.substring(0,r)+n+t.substring(i),selectionStart:a,selectionEnd:a})}return}if((l?e.metaKey&&"z"===e.key.toLowerCase():e.ctrlKey&&"z"===e.key.toLowerCase())&&!e.shiftKey&&!e.altKey){e.preventDefault();let t=s(w.current,"undo");t&&k.current&&(k.current.value=t.value,k.current.selectionStart=t.selectionStart,k.current.selectionEnd=t.selectionEnd,n(t.value));return}if((l?e.metaKey&&e.shiftKey&&"z"===e.key.toLowerCase():a?e.ctrlKey&&"y"===e.key.toLowerCase():e.ctrlKey&&e.shiftKey&&"z"===e.key.toLowerCase())&&!e.altKey){e.preventDefault();let t=s(w.current,"redo");t&&k.current&&(k.current.value=t.value,k.current.selectionStart=t.selectionStart,k.current.selectionEnd=t.selectionEnd,n(t.value));return}e.ctrlKey&&"m"===e.key.toLowerCase()&&(!l||e.shiftKey)&&(e.preventDefault(),Y(e=>!e))},placeholder:b,readOnly:g,autoFocus:y,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellcheck:!1,"data-gramm":!1}),(0,r.Y)(d,{})]})}let f=["direction","fontFamily","fontFeatureSettings","fontKerning","fontSize","fontStyle","fontVariantLigatures","fontWeight","letterSpacing","overflowWrap","tabSize","textRendering","textTransform","whiteSpace","wordBreak","wordSpacing"],p=null,m=[],x="",b=new Map,g=[];function y(e){if("u"<typeof document||!e.isConnected)return null;let t=Number.parseFloat(getComputedStyle(e).lineHeight);return Number.isFinite(t)&&t>0?t:null}function v(e,t,n){return e<t?t:e>n?n:e}function k(e){return{start:0,end:v(200,1,Math.max(e,1))}}var w=n("Po"),N=n("DU");function Y(e){var t;let{value:n,onValueChange:l,language:a,wordWrap:o,rootClassName:s,gutterClassName:c,gutterStyle:d,gutterLineClassName:u,editorWrapperClassName:Y,editorClassName:D,editorPadding:F=0,editorStyle:C}=e,S=o?"!whitespace-pre-wrap !break-words":"!whitespace-pre !break-normal",M=(0,i.li)(null),z=(0,i.li)(null),[T,E]=(0,i.J0)(null),[A,L]=(0,i.J0)(null),[$,j]=(0,i.J0)(-1);(0,w.w)();let J=(0,i.Kr)(()=>(function(e){let t=1;for(let n=e.indexOf("\n");-1!==n;n=e.indexOf("\n",n+1))t++;return t})(n),[n]),W=(0,i.hb)(()=>{let e=M.current;if(!e)return;let t=o?function(e,t){let n=y(e);if(null===n)return null;let r=getComputedStyle(e),i=e.clientWidth-Number.parseFloat(r.paddingLeft||"0")-Number.parseFloat(r.paddingRight||"0");if(i<=0)return null;let l=(p&&p.isConnected||((p=document.createElement("div")).setAttribute("aria-hidden","true"),p.style.cssText="position:fixed;top:0;left:-100000px;visibility:hidden;pointer-events:none;margin:0;border:0;padding:0;box-sizing:border-box;",document.body.appendChild(p),m=[]),p);for(let e of f)l.style[e]=r[e];l.style.lineHeight=`${n}px`,l.style.width=`${i}px`;let a=`${i}|${n}|${f.map(e=>r[e]).join("|")}`;a!==x&&(x=a,b.clear());let o=t.split("\n"),s=Array(o.length),c=0;for(let e=0;e<o.length;e++){let t=b.get(o[e]);void 0===t?g[c++]=e:s[e]=t}if(c>0){for(;m.length<c;){let e=document.createElement("div");l.appendChild(e),m.push(e)}for(let e=0;e<c;e++)m[e].textContent=o[g[e]];for(let e=0;e<c;e++){let t=g[e],r=m[e].getBoundingClientRect().height,i=r>n?Math.round(r/n)*n:n;s[t]=i,b.set(o[t],i)}if(b.size>1e5){let e=b.size-5e4;for(let t of b.keys()){if(e--<=0)break;b.delete(t)}}}return{rowHeight:n,heights:s}}(e,n):null;E(e=>e===t||e&&t&&e.rowHeight===t.rowHeight&&e.heights.length===t.heights.length&&e.heights.every((e,n)=>e===t.heights[n])?e:t);let r=t?.rowHeight??y(e);L(e=>e===r?e:r),j(J)},[n,J,o,F,C?.fontSize]);(0,i.Nf)(()=>{W()},[W]);let H=(0,i.li)(W);H.current=W,(0,i.vJ)(()=>{let e=M.current;if(!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>H.current());return t.observe(e),()=>t.disconnect()},[]);let O=(0,i.Kr)(()=>null===A?null:T?function(e,t,n){if(0===n||e.length!==n)return null;let r=new Float64Array(n+1);for(let t=0;t<n;t++)r[t+1]=r[t]+e[t];let i=r[n];return{lineCount:n,rowHeight:t,totalHeight:i,offsetOf:e=>r[v(e,0,n)],lineAt:e=>{if(e<0)return 0;if(i<=0||e>=i)return n-1;let t=0,l=n-1;for(;t<l;){let n=t+l+1>>1;r[n]<=e?t=n:l=n-1}return t}}}(T.heights,T.rowHeight,J):{lineCount:J,rowHeight:A,totalHeight:A*J,offsetOf:e=>A*v(e,0,J),lineAt:e=>v(Math.floor(e/A),0,Math.max(J-1,0))},[A,T,J]),R=(t=n.length,J>300||t>2e4),K=function(e){var t,n;let r,l,{rootRef:a,lineCount:o,geometry:s,enabled:c}=e,[d,u]=(0,i.J0)(null),h=(0,i.hb)(()=>{let e,t,n,r,i=a.current;if(!c||!i)return;let l=s?(e=i.getBoundingClientRect().top,n=(t=function(e){for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowY;if(("auto"===e||"scroll"===e||"overlay"===e)&&t.scrollHeight>t.clientHeight)return t}return null}(i))?t.getBoundingClientRect().top:0,r=t?t.getBoundingClientRect().bottom:globalThis.innerHeight||s.rowHeight,function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:24,i=e.lineAt(t),l=e.lineAt(t+Math.max(n,0));return{start:Math.max(0,i-r),end:Math.min(e.lineCount,Math.max(l+1,i+1)+r)}}(s,n-e,r-n)):k(o);u(e=>e===l||null!==e&&null!==l&&e.start===l.start&&e.end===l.end?e:l)},[c,s,o,a]);(0,i.Nf)(()=>{h()},[h]);let f=(0,i.li)(h);if(f.current=h,(0,i.vJ)(()=>{if(!c)return;let e=0,t=()=>{e||(e=requestAnimationFrame(()=>{e=0,f.current()}))};window.addEventListener("scroll",t,{passive:!0,capture:!0}),window.addEventListener("resize",t);let n="u"<typeof ResizeObserver?null:new ResizeObserver(t),r=a.current;return r&&n?.observe(r),()=>{e&&cancelAnimationFrame(e),window.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("resize",t),n?.disconnect()}},[c,a]),!c)return null;if(!s){let e=k(o);return{...e,top:0,bottom:0,breakAtEnd:e.end>=o}}return t=d??k(s.lineCount),n=s.lineCount,{...l={start:r=v(t.start,0,Math.max(n-1,0)),end:v(t.end,r+1,Math.max(n,1))},...{top:s.offsetOf(l.start),bottom:Math.max(0,s.totalHeight-s.offsetOf(l.end)),breakAtEnd:l.end>=s.lineCount}}}({rootRef:z,lineCount:J,geometry:O,enabled:R&&($!==J||null!==O)}),I=(0,i.hb)((e,t)=>t?function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{contextLines:i=40,maxLineLength:l=12e3}=r,a=e.split("\n"),o=Math.min(Math.max(n.start,0),a.length),s=Math.min(Math.max(n.end,o),a.length);if(o===s)return"";let c=Math.max(0,o-i),d=(0,N.O9)(a.slice(c,s).join("\n"),t,{maxLineLength:l}),u=o-c;return`<span class="shiki">${d.slice(u,u+(s-o)).join("\n")}</span>`}(e,a,t):(0,N.wY)(e,a),[a]),P=K?K.start:0,U=K?Math.min(K.end,J):J,B=[];for(let e=P;e<U;e++)B.push(e);let _=T&&T.heights.length===J?T.heights:null;return(0,r.FD)("div",{className:s,ref:z,children:[(0,r.FD)("div",{className:c,style:d,children:[K&&K.top>0?(0,r.Y)("div",{style:{height:K.top,flexShrink:0},"aria-hidden":"true"}):null,B.map(e=>(0,r.Y)("div",{className:u,style:_?{height:_[e],flexShrink:0}:void 0,children:e+1},e+1))]}),(0,r.Y)("div",{className:Y,children:(0,r.Y)(h,{value:n,onValueChange:l,highlight:I,padding:F,preRef:M,textareaClassName:`focus:outline-none ${S}`,preClassName:S,style:C,className:D,virtual:K})})]})}},hR(e,t,n){var r=n("j"),i=n("H"),l=n("E6"),a=n("t");function o(e){let{src:t,name:n,className:o=""}=e,s=(0,i.li)(null),c=(0,i.li)(null),d=(0,i.li)(null),[u,h]=(0,i.J0)(null),[f,p]=(0,i.J0)(1),[m,x]=(0,i.J0)({x:0,y:0}),[b,g]=(0,i.J0)(!1),[y,v]=(0,i.J0)(null),k=(0,i.hb)(()=>{let e=c.current;return!!e&&!!e.complete&&0!==e.naturalWidth&&(h({width:e.naturalWidth,height:e.naturalHeight}),!0)},[]);(0,i.vJ)(()=>{k()},[k]);let w=(0,i.hb)(()=>{let e=c.current,t=s.current?.getBoundingClientRect(),n=e?.naturalWidth??0,r=e?.naturalHeight??0;t&&n&&r&&(p(Math.min(1,Math.max(.1,(t.width-48)/n,(t.height-48)/r))),x({x:0,y:0}))},[]);(0,i.vJ)(()=>{u&&w()},[u,w]);let N=(0,i.hb)(e=>{p(t=>Math.min(16,Math.max(.1,t*e)))},[]),Y=(0,i.hb)(e=>{e.preventDefault(),N(Math.exp(-(.0015*e.deltaY)))},[N]),D=(0,i.hb)(e=>{0===e.button&&u&&(d.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY},e.currentTarget.setPointerCapture(e.pointerId),g(!0))},[u]),F=(0,i.hb)(e=>{let t=d.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.x,r=e.clientY-t.y;t.x=e.clientX,t.y=e.clientY,x(e=>({x:e.x+n,y:e.y+r}))},[]),C=(0,i.hb)(e=>{d.current?.pointerId===e.pointerId&&(d.current=null,g(!1))},[]),S=(0,i.hb)(()=>{.01>Math.abs(f-1)?w():(p(1),x({x:0,y:0}))},[f,w]);(0,i.vJ)(()=>{let e=e=>{if("+"!==e.key&&"="!==e.key&&"-"!==e.key&&"_"!==e.key&&"0"!==e.key)return;let t=e.target;t&&s.current?.contains(t)&&(e.preventDefault(),"0"===e.key?w():"+"===e.key||"="===e.key?N(1.4):N(1/1.4))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[N,w]);let M=Math.round(100*f),z=u?`${u.width} \xd7 ${u.height} px`:"";return(0,r.FD)("div",{className:`relative flex h-full w-full flex-col bg-paper ${o}`,children:[(0,r.Y)("div",{ref:s,tabIndex:-1,onWheel:Y,onPointerDown:D,onPointerMove:F,onPointerUp:C,onPointerCancel:C,onDblClick:S,className:`image-stage relative flex-1 overflow-hidden outline-none ${b?"cursor-grabbing":"cursor-grab"}`,children:y?(0,r.FD)("div",{className:"flex h-full flex-col items-center justify-center gap-2 px-6 text-center",children:[(0,r.Y)(l.A,{size:20,className:"text-error"}),(0,r.FD)("span",{className:"font-sans text-xs text-error",children:["Could not read ",n]}),(0,r.Y)("span",{className:"break-all font-mono text-[11px] text-ink/50",children:y})]}):(0,r.FD)(r.FK,{children:[!u&&(0,r.FD)("div",{className:"absolute inset-0 flex items-center justify-center gap-2 text-xs text-ink/40",children:[(0,r.Y)(a.A,{size:14,className:"animate-spin"}),(0,r.Y)("span",{children:"Loading image…"})]}),(0,r.Y)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,r.Y)("img",{ref:c,src:t,alt:n,draggable:!1,onLoad:k,onError:()=>v("The file could not be decoded as an image."),className:"image-canvas max-h-none max-w-none select-none",style:{transform:`translate3d(${m.x}px, ${m.y}px, 0) scale(${f})`,visibility:u?"visible":"hidden"}})})]})}),(0,r.FD)("div",{className:"flex flex-shrink-0 items-center justify-between border-t border-ink/10 bg-canvas px-3 py-1.5 font-mono text-[10px] text-ink/50",children:[(0,r.Y)("span",{children:z}),(0,r.FD)("div",{className:"flex items-center gap-3",children:[(0,r.Y)("button",{type:"button",onClick:()=>N(1/1.4),className:"hover:text-ink",title:"Zoom out (-)",children:"−"}),(0,r.FD)("span",{className:"w-10 text-center tabular-nums",children:[M,"%"]}),(0,r.Y)("button",{type:"button",onClick:()=>N(1.4),className:"hover:text-ink",title:"Zoom in (+)",children:"+"}),(0,r.Y)("button",{type:"button",onClick:w,className:"hover:text-ink",title:"Fit to view (0)",children:"Fit"})]})]})]})}function s(e){return(0,r.Y)(o,{...e},e.src)}n.d(t,{a:()=>s})},Xg(e,t,n){n.d(t,{M:()=>F});var r=n("j"),i=n("H"),l=n("X"),a=n("FL"),o=n("DU"),s=n("lP"),c=n("y");let d=(0,c.A)({name:"text-align-justify",size:24,node:[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],aliases:["align-justify"]}),u=(0,c.A)({name:"space",size:24,node:[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]});var h=n("n"),f=n("z"),p=n("b0"),m=n("I"),x=n("DV"),b=n("r"),g=n("AB"),y=n("pX"),v=n("LQ");function k(e){let{filePath:t,status:n,isStaged:i,viewMode:l,ignoreWhitespace:a,additions:o,deletions:c,isLoading:k,isCopied:w,onToggleViewMode:N,onToggleWhitespace:Y,onStageUnstage:D,onDiscard:F,onOpenInEditor:C,onRefresh:S,onCopyDiff:M}=e,z=t.split("/").pop()||t,T=(0,v.R)(n,i);return(0,r.FD)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-paper border-b border-ink/10 text-xs font-sans select-none flex-shrink-0 overflow-x-auto no-scrollbar",children:[(0,r.FD)("div",{className:"hidden md:flex items-center space-x-2 min-w-0 pr-2",children:[(0,r.Y)(y.o,{name:z,size:14,className:"flex-shrink-0"}),(0,r.Y)("span",{className:"font-mono text-ink font-medium truncate",title:t,children:z}),(0,r.FD)("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border ${T.badgeBgClass} flex-shrink-0`,children:[T.charStatus," ",T.label]}),(o>0||c>0)&&(0,r.FD)("div",{className:"flex items-center space-x-1.5 text-[11px] font-mono flex-shrink-0 ml-1",children:[o>0&&(0,r.FD)("span",{className:"text-success font-semibold",children:["+",o]}),c>0&&(0,r.FD)("span",{className:"text-error font-semibold",children:["-",c]})]})]}),(0,r.FD)("div",{className:"flex items-center space-x-1 text-ink/70 flex-shrink-0 ml-auto",children:[(0,r.FD)("div",{className:"flex items-center bg-canvas rounded border border-ink/15 p-0.5 mr-1",children:[(0,r.FD)("button",{type:"button",onClick:N,className:`px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors ${"split"===l?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Split (side-by-side) Diff",children:[(0,r.Y)(s.A,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Split"})]}),(0,r.FD)("button",{type:"button",onClick:N,className:`px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors ${"unified"===l?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Unified Diff",children:[(0,r.Y)(d,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Unified"})]})]}),(0,r.Y)("button",{type:"button",onClick:Y,className:`p-1.5 rounded transition-colors ${a?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:a?"Whitespace ignored":"Ignore whitespace",children:(0,r.Y)(u,{size:13})}),(0,r.Y)("button",{type:"button",onClick:S,className:"p-1.5 text-ink/50 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Refresh Diff",disabled:k,children:(0,r.Y)(h.A,{size:13,className:k?"animate-spin":""})}),(0,r.Y)("button",{type:"button",onClick:M,className:"p-1.5 text-ink/50 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Copy Diff Text",children:w?(0,r.Y)(f.A,{size:13,className:"text-success"}):(0,r.Y)(p.A,{size:13})}),!i&&(0,r.Y)("button",{type:"button",onClick:F,className:"p-1.5 text-ink/50 hover:text-error hover:bg-error/10 rounded transition-colors",title:"Discard changes in this file",children:(0,r.Y)(m.A,{size:13})}),(0,r.Y)("button",{type:"button",onClick:D,className:"px-2 py-1 text-[11px] font-medium rounded border border-ink/15 hover:bg-ink/5 flex items-center space-x-1 transition-colors text-ink",title:i?"Unstage file":"Stage file",children:i?(0,r.FD)(r.FK,{children:[(0,r.Y)(x.A,{size:12}),(0,r.Y)("span",{children:"Unstage"})]}):(0,r.FD)(r.FK,{children:[(0,r.Y)(b.A,{size:12}),(0,r.Y)("span",{children:"Stage"})]})}),C&&(0,r.FD)("button",{type:"button",onClick:C,className:"px-2 py-1 text-[11px] font-medium rounded bg-ink text-canvas hover:bg-ink/90 flex items-center space-x-1 transition-colors shadow-xs ml-1",title:"Open in Code Editor",children:[(0,r.Y)(g.A,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Edit File"})]})]})]})}var w=n("Po");function N(e){let{lines:t,language:n}=e,l=(0,w.w)(),a=(0,i.Kr)(()=>{let e=Array(t.length).fill(""),r=-1,i=i=>{if(r<0)return;let l=(0,o.O9)(t.slice(r,i).map(e=>e.text).join("\n"),n);for(let t=r;t<i;t++)e[t]=l[t-r]??"";r=-1};return t.forEach((e,t)=>{"meta"===e.type?i(t):r<0&&(r=t)}),i(t.length),e},[t,n,l]);return 0===t.length?(0,r.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40 font-mono text-xs p-8",children:"No differences between working file and target."}):(0,r.Y)("div",{className:"w-full h-full overflow-auto font-mono text-xs select-text bg-paper text-ink code-surface",children:(0,r.Y)("table",{className:"w-max min-w-full border-collapse",children:(0,r.Y)("tbody",{children:t.map((e,t)=>{if("meta"===e.type)return(0,r.FD)("tr",{className:"bg-canvas border-y border-ink/10 text-meta select-none",children:[(0,r.Y)("td",{className:"w-12 text-center py-1 px-2 text-[10px] opacity-60 border-r border-ink/10 font-mono",children:"..."}),(0,r.Y)("td",{className:"w-12 text-center py-1 px-2 text-[10px] opacity-60 border-r border-ink/10 font-mono",children:"..."}),(0,r.Y)("td",{className:"py-1 px-3 text-[11px] font-semibold text-meta font-mono tracking-tight",children:e.text})]},t);let n="add"===e.type,i="del"===e.type;return(0,r.FD)("tr",{className:`transition-colors group ${n?"bg-success/10 hover:bg-success/15":i?"bg-error/10 hover:bg-error/15":"hover:bg-ink/[0.03]"}`,children:[(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${i?"bg-error/15 text-error font-semibold":n?"bg-success/15 text-success/70":"bg-canvas/50 text-ink/40"}`,children:e.oldLineNumber||""}),(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${n?"bg-success/15 text-success font-semibold":i?"bg-error/15 text-error/70":"bg-canvas/50 text-ink/40"}`,children:e.newLineNumber||""}),(0,r.FD)("td",{className:"py-0.5 px-3 whitespace-pre text-ink pr-6",children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${n?"text-success":i?"text-error":"opacity-0"}`,children:n?"+":i?"-":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:e.text&&a[t]||" "}})]})]},t)})})})})}function Y(e){let{rows:t,language:n}=e,l=(0,w.w)(),a=(0,i.Kr)(()=>{let e=Array(t.length).fill(""),r=Array(t.length).fill(""),i=-1,l=l=>{if(i<0)return;let a=t.slice(i,l),s=(0,o.O9)(a.map(e=>e.left?.text??"").join("\n"),n),c=(0,o.O9)(a.map(e=>e.right?.text??"").join("\n"),n);for(let t=i;t<l;t++)e[t]=s[t-i]??"",r[t]=c[t-i]??"";i=-1};return t.forEach((e,t)=>{e.isMeta?l(t):i<0&&(i=t)}),l(t.length),{left:e,right:r}},[t,n,l]);return 0===t.length?(0,r.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40 font-mono text-xs p-8",children:"No differences between working file and target."}):(0,r.Y)("div",{className:"w-full h-full overflow-auto font-mono text-xs select-text bg-paper text-ink code-surface",children:(0,r.FD)("div",{className:"w-max min-w-full min-w-[700px]",children:[(0,r.FD)("div",{className:"grid grid-cols-2 sticky top-0 z-10 bg-canvas border-b border-ink/10 text-[11px] text-ink/70 font-sans select-none shadow-xs",children:[(0,r.Y)("div",{className:"px-3 py-1 font-medium border-r border-ink/10 flex items-center justify-between",children:(0,r.Y)("span",{children:"Original (HEAD / Base)"})}),(0,r.Y)("div",{className:"px-3 py-1 font-medium flex items-center justify-between",children:(0,r.Y)("span",{children:"Modified (Working Tree)"})})]}),(0,r.Y)("table",{className:"w-full border-collapse",children:(0,r.Y)("tbody",{children:t.map((e,t)=>{if(e.isMeta)return(0,r.Y)("tr",{className:"bg-canvas border-y border-ink/10 text-meta select-none",children:(0,r.Y)("td",{colSpan:4,className:"py-1 px-3 text-[11px] font-semibold text-meta text-center font-mono",children:e.metaText})},t);let n=e.left,i=e.right,l=n?.type==="del",o=i?.type==="add";return(0,r.FD)("tr",{className:"border-b border-ink/[0.04]",children:[(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${l?"bg-error/15 text-error font-semibold":n?"bg-canvas/50 text-ink/40":"bg-canvas/80 text-transparent"}`,children:n?.lineNumber||""}),(0,r.Y)("td",{className:`min-w-[320px] py-0.5 px-2 whitespace-pre border-r border-ink/10 text-ink ${l?"bg-error/10":n?"hover:bg-ink/[0.02]":"bg-canvas/40 select-none"}`,children:n?(0,r.FD)(r.FK,{children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${l?"text-error":"opacity-0"}`,children:l?"-":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:n.text&&a.left[t]||" "}})]}):(0,r.Y)("span",{className:"opacity-0",children:" "})}),(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${o?"bg-success/15 text-success font-semibold":i?"bg-canvas/50 text-ink/40":"bg-canvas/80 text-transparent"}`,children:i?.lineNumber||""}),(0,r.Y)("td",{className:`min-w-[320px] py-0.5 px-2 whitespace-pre text-ink ${o?"bg-success/10":i?"hover:bg-ink/[0.02]":"bg-canvas/40 select-none"}`,children:i?(0,r.FD)(r.FK,{children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${o?"text-success":"opacity-0"}`,children:o?"+":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:i.text&&a.right[t]||" "}})]}):(0,r.Y)("span",{className:"opacity-0",children:" "})})]},t)})})})]})})}var D=n("p");function F(e){let{filePath:t,status:n="M",isStaged:s=!1,root:c,repo:d=".",onOpenInEditor:u,onFileSaved:f,className:p=""}=e,[m,x]=(0,a.LO)("diff.viewMode","unified"),[b,g]=(0,a.LO)("diff.ignoreWhitespace",!1),[y,v]=(0,i.J0)(""),[w,F]=(0,i.J0)(n),[C,S]=(0,i.J0)(s),[M,z]=(0,i.J0)(!0),[T,E]=(0,i.J0)(null),[A,L]=(0,i.J0)(!1),[$,j]=(0,i.J0)(!1),J=(0,l.L)(),W=(0,i.hb)(async()=>{if(t){z(!0),E(null);try{let e=new URLSearchParams({fileDiff:"1",file:t,staged:C?"1":"0",repo:d||"."});(n||w)&&e.set("status",n||w),c&&e.set("root",c);let r=await fetch(`/api/fs/git?${e.toString()}`),i=await r.json();i.success?(v(i.diff||""),i.status&&F(i.status)):E(i.error||"Failed to load file diff")}catch(e){E(e.message||"Error fetching diff")}finally{z(!1)}}},[t,C,d,c]);(0,i.vJ)(()=>{F(n),S(s)},[n,s,t]),(0,i.vJ)(()=>{W()},[W]);let H=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=[],i=0,l=0;if(!e||!e.trim())return{lines:n,splitRows:r,additions:i,deletions:l};let a=e.split(/\r?\n/),o=a.some(e=>e.startsWith("@@"))?a:[`@@ -1,${a.length} +1,${a.length} @@`,...a],s=1,c=1,d=[],u=[],h=()=>{let e=Math.max(d.length,u.length);for(let t=0;t<e;t++)r.push({left:d[t]?{type:"del",text:d[t].text,lineNumber:d[t].lineNumber}:void 0,right:u[t]?{type:"add",text:u[t].text,lineNumber:u[t].lineNumber}:void 0});d=[],u=[]};for(let e of o)if(!(e.startsWith("diff --git")||e.startsWith("index ")||e.startsWith("---")||e.startsWith("+++")||e.startsWith("new file mode")||e.startsWith("deleted file mode")||e.startsWith("similarity index")||e.startsWith("old mode")||e.startsWith("new mode")||e.startsWith("\\ No newline"))){if(e.startsWith("@@")){h();let t=e.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);t&&(s=parseInt(t[1],10),c=parseInt(t[2],10)),n.push({type:"meta",text:e}),r.push({isMeta:!0,metaText:e});continue}if(e.startsWith("+")){let r=e.slice(1),l=t?r.trim():r;i++,n.push({type:"add",text:l,newLineNumber:c}),u.push({text:l,lineNumber:c}),c++}else if(e.startsWith("-")){let r=e.slice(1),i=t?r.trim():r;l++,n.push({type:"del",text:i,oldLineNumber:s}),d.push({text:i,lineNumber:s}),s++}else{h();let i=e.startsWith(" ")?e.slice(1):e,l=t?i.trim():i;n.push({type:"context",text:l,oldLineNumber:s,newLineNumber:c}),r.push({left:{type:"context",text:l,lineNumber:s},right:{type:"context",text:l,lineNumber:c}}),s++,c++}}return h(),{lines:n,splitRows:r,additions:i,deletions:l}}(y,b),O=(0,o.sQ)(t);return(0,r.FD)("div",{className:`flex flex-col h-full bg-paper select-text relative font-sans ${p}`,children:[(0,r.Y)(k,{filePath:t,status:w,isStaged:C,viewMode:m,ignoreWhitespace:b,additions:H.additions,deletions:H.deletions,isLoading:M,isCopied:A,onToggleViewMode:()=>{x("unified"===m?"split":"unified")},onToggleWhitespace:()=>{g(!b)},onStageUnstage:()=>{let e=C?"unstage":"stage",n=new FormData;n.set("actionType",e),n.set("file",t),n.set("repo",d||"."),c&&n.set("root",c),J.submit(n,{method:"POST",action:"/api/fs/git"}),S(!C),setTimeout(()=>{W(),f?.()},300)},onDiscard:()=>{j(!0)},onOpenInEditor:u,onRefresh:W,onCopyDiff:()=>{y&&(navigator.clipboard.writeText(y),L(!0),setTimeout(()=>L(!1),2e3))}}),(0,r.Y)("div",{className:"flex-1 overflow-hidden relative flex flex-col bg-paper",children:M?(0,r.FD)("div",{className:"flex-1 flex items-center justify-center space-x-2 text-ink/50 text-xs font-mono",children:[(0,r.Y)(h.A,{size:14,className:"animate-spin"}),(0,r.Y)("span",{children:"Loading file diff..."})]}):T?(0,r.FD)("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center space-y-2",children:[(0,r.Y)(D.A,{size:20,className:"text-error"}),(0,r.Y)("p",{className:"text-xs text-error font-medium",children:T}),(0,r.Y)("button",{onClick:W,className:"px-3 py-1 text-xs bg-ink/10 hover:bg-ink/15 text-ink rounded font-sans transition-colors",children:"Retry"})]}):"split"===m?(0,r.Y)(Y,{rows:H.splitRows,language:O}):(0,r.Y)(N,{lines:H.lines,language:O})}),$&&(0,r.Y)("div",{className:"fixed inset-0 bg-ink/20 z-50 flex items-center justify-center p-4 backdrop-blur-xs",children:(0,r.FD)("div",{className:"bg-paper rounded-lg shadow-xl p-4 w-full max-w-sm border border-ink/15",children:[(0,r.Y)("h3",{className:"font-semibold text-ink mb-1.5 text-sm",children:"Discard Changes?"}),(0,r.FD)("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to discard all unstaged changes in ",(0,r.Y)("span",{className:"font-mono font-medium text-ink",children:t}),"? This cannot be undone."]}),(0,r.FD)("div",{className:"flex justify-end space-x-2",children:[(0,r.Y)("button",{type:"button",onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",children:"Cancel"}),(0,r.Y)("button",{type:"button",onClick:()=>{j(!1);let e=new FormData;e.set("actionType","discard"),e.set("file",t),e.set("repo",d||"."),c&&e.set("root",c),J.submit(e,{method:"POST",action:"/api/fs/git"}),setTimeout(()=>{W(),f?.()},300)},className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 font-medium transition-colors",children:"Discard Changes"})]})]})})]})}},FW(e,t,n){n.d(t,{n:()=>u});var r=n("H"),i=n("DU"),l=n("JK"),a=n("tZ");function o(e,t){let n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}async function s(e,t){let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);o(await n.blob(),t)}async function c(e){let t=await fetch(e);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.blob();if("u"<typeof ClipboardItem||!navigator.clipboard?.write)throw Error("Image clipboard unavailable");await navigator.clipboard.write([new ClipboardItem({[n.type]:n})])}function d(e){return String(e.id??e.path??e.name)}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{fallback:n,reportLoadError:u=!1,flushOnUnmount:h=!1,reportSaveError:f=!1,downloadMimeType:p="text/plain",onFileSaved:m}=t,[x,b]=(0,r.J0)({}),[g,y]=(0,r.J0)({}),[v,k]=(0,r.J0)(!1),[w,N]=(0,r.J0)(null),[Y,D]=(0,r.J0)("idle"),[F,C]=(0,r.J0)(0),S=e?d(e):"",M=e?x[S]??e.content??"":"",z=M!==(g[S]??M),T=e?.path&&void 0===e.content&&(0,l.CC)(e.path)?e.path:null,E=null!==T,A=T?`${(0,a.l)({...e,path:T})}&v=${F}`:null,L=(0,r.li)(new Set),$=(0,r.li)(null),j=(0,r.li)(x);j.current=x;let J=(0,r.li)(g);J.current=g;let W=(0,r.hb)((e,t)=>{b(n=>({...n,[e]:t})),y(n=>({...n,[e]:t}))},[]),H=(0,r.hb)(async(e,t)=>{if(!e.path)return;D("saving");let n=new FormData;n.append("actionType","save"),n.append("path",e.path),n.append("content",t),e.root&&n.append("root",e.root),e.repo&&"."!==e.repo&&n.append("repo",e.repo);try{let r=await fetch("/api/fs/action",{method:"POST",body:n}),i=await r.json().catch(()=>null);r.ok&&i?.success?(D("saved"),y(n=>({...n,[d(e)]:t})),m?.()):D(f?"error":"idle")}catch{D(f?"error":"idle")}},[m,f]),O=(0,r.li)(H);O.current=H,(0,r.vJ)(()=>{if(!e)return;let t=d(e);if(L.current.has(t))return;if(L.current.add(t),E){N(null),k(!1);return}if(void 0!==e.content){W(t,e.content),N(null);return}if(!e.path)return u?void N("No file path supplied for this attachment."):void W(t,n?n(e.name):"");let r=void 0===j.current[t],i=!1;r&&k(!0),N(null);let l=new URLSearchParams({path:e.path});return e.root&&l.set("root",e.root),e.repo&&"."!==e.repo&&l.set("repo",e.repo),fetch(`/api/fs/read?${l.toString()}`).then(async e=>{let t=await e.json().catch(()=>null);if(u){if(!e.ok||!t||"string"!=typeof t.content)throw Error(t?.error||`HTTP ${e.status}`);return t.content}return"string"==typeof t?.content?t.content:null}).then(r=>{if(i)return;let l=j.current[t];if(void 0!==l&&l!==J.current[t])return;let a=$.current;a&&d(a.file)===t||W(t,r??(n?n(e.name):""))}).catch(l=>{i||r&&(u?(W(t,""),N(l instanceof Error?l.message:"Failed to read file")):W(t,n?n(e.name):""))}).finally(()=>{i||k(!1)}),()=>{i=!0}},[S,e,n,u,W,F,E]),(0,r.vJ)(()=>{if("saved"!==Y)return;let e=window.setTimeout(()=>D("idle"),1500);return()=>window.clearTimeout(e)},[Y]);let R=(0,r.hb)(t=>{if(!e||E)return;let n=d(e);if(b(e=>({...e,[n]:t})),!e.path)return;$.current&&window.clearTimeout($.current.timer);let r=window.setTimeout(()=>{$.current=null,O.current(e,t)},800);$.current={timer:r,file:e,content:t}},[e,E]),K=(0,r.hb)(()=>{if(!e||E)return;let t=x[d(e)];void 0!==t&&($.current&&(window.clearTimeout($.current.timer),$.current=null),O.current(e,t))},[e,x,E]),{copied:I,copy:P,download:U}=function(e){let{target:t,content:n,imageUrl:i,downloadMimeType:l}=e,[a,d]=(0,r.J0)(!1),u=(0,r.hb)(()=>{d(!0),window.setTimeout(()=>d(!1),1500)},[]);return{copied:a,copy:(0,r.hb)(()=>{!t||(i?c(i).then(u).catch(()=>{}):navigator.clipboard&&navigator.clipboard.writeText(n).then(u).catch(()=>{}))},[t,n,i,u]),download:(0,r.hb)(()=>{if(t){if(i)return void s(i,t.name).catch(()=>{});o(new Blob([n],{type:l}),t.name)}},[t,n,l,i])}}({target:e,content:M,imageUrl:A,downloadMimeType:p}),B=(0,r.hb)(()=>{L.current.clear(),C(e=>e+1)},[]),_=(0,r.hb)(e=>{let t=new Set(e.map(String));for(let e of Array.from(L.current))t.has(e)||L.current.delete(e);b(e=>{let n=Object.keys(e);if(n.every(e=>t.has(e)))return e;let r={};for(let i of n)t.has(i)&&(r[i]=e[i]);return r})},[]);return(0,r.vJ)(()=>{if(h)return()=>{let e=$.current;e&&(window.clearTimeout(e.timer),$.current=null,O.current(e.file,e.content))}},[h]),{content:M,onChange:R,isLoading:v,loadError:w,saveStatus:Y,copied:I,isDirty:z,language:e?(0,i.sQ)(e.name):"javascript",isImage:E,imageUrl:A,saveNow:K,copy:P,download:U,reset:B,retain:_}}},Soe(e,t,n){let r=(0,n("y").A)({name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]});n.d(t,{},{A:r})},yh(e,t,n){let r=(0,n("y").A)({name:"text-wrap",size:24,node:[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],aliases:["wrap-text"]});n.d(t,{},{A:r})},na(e,t,n){let r=(0,n("y").A)({name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]});n.d(t,{},{A:r})},hj(e,t,n){let r=(0,n("y").A)({name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]});n.d(t,{},{A:r})}}]);
|
|
10
|
+
`;function d(){return(0,r.Y)("style",{dangerouslySetInnerHTML:{__html:c}})}function u(e,t){return e.substring(0,t).split("\n")}function h(e){let{value:t,onValueChange:n,highlight:l,padding:c=0,preClassName:h,textareaClassName:f,style:p,preRef:m,className:x,placeholder:b,readOnly:g,autoFocus:y,virtual:v}=e,k=(0,i.li)(null),w=(0,i.li)({stack:[],offset:-1}),[N,Y]=(0,i.J0)(!0);(0,i.vJ)(()=>{let e=k.current;e&&a(w.current,{value:e.value,selectionStart:e.selectionStart,selectionEnd:e.selectionEnd,timestamp:Date.now()})},[t]);let D=e=>{let t=k.current,r=w.current.stack[w.current.offset];r&&t&&(w.current.stack[w.current.offset]={...r,selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}),function(e,t){if(a(e,t),e.stack.length<=100)return;let n=e.stack.length-100;e.stack=e.stack.slice(n),e.offset=Math.max(e.offset-n,0)}(w.current,{...e,timestamp:Date.now()}),n(e.value),t&&(t.value=e.value,t.selectionStart=e.selectionStart,t.selectionEnd=e.selectionEnd)},C={margin:0,border:0,background:"none",boxSizing:"inherit",display:"inherit",fontFamily:"inherit",fontSize:"inherit",fontStyle:"inherit",fontVariantLigatures:"inherit",fontWeight:"inherit",letterSpacing:"inherit",lineHeight:"inherit",tabSize:"inherit",textIndent:"inherit",textRendering:"inherit",textTransform:"inherit",whiteSpace:"pre-wrap",wordBreak:"keep-all",overflowWrap:"break-word"},F={paddingTop:c,paddingRight:c,paddingBottom:c,paddingLeft:c},S={...F,paddingTop:c+(v?.top??0),paddingBottom:c+(v?.bottom??0)},M=l(t,v??null);return(0,r.FD)("div",{className:x,style:{position:"relative",textAlign:"left",boxSizing:"border-box",padding:0,overflow:"hidden",...p},children:[(0,r.Y)("pre",{ref:m,className:h,"aria-hidden":"true",style:{...C,...S,position:"relative",pointerEvents:"none"},dangerouslySetInnerHTML:{__html:M+(v&&!v.breakAtEnd?"":"<br />")}}),(0,r.Y)("textarea",{ref:k,className:`code-editor-native-textarea${f?` ${f}`:""}`,style:{...C,...F,position:"absolute",top:0,left:0,height:"100%",width:"100%",resize:"none",color:"inherit",overflow:"hidden",WebkitTextFillColor:"transparent"},value:t,onChange:e=>{let{value:t,selectionStart:r,selectionEnd:i}=e.target,l=w.current,s=Date.now();if(function(e,t,n,r){if(!e||r-e.timestamp>=3e3)return!1;let i=o(e.value,e.selectionStart),l=o(t,n);return!!(i&&l?.startsWith(i))}(l.stack[l.offset],t,r,s)){l.stack=l.stack.slice(0,l.offset+1),l.stack[l.offset]={value:t,selectionStart:r,selectionEnd:i,timestamp:s},n(t);return}a(l,{value:t,selectionStart:r,selectionEnd:i,timestamp:s}),n(t)},onKeyDown:e=>{if("Escape"===e.key)return void e.currentTarget.blur();let{value:t,selectionStart:r,selectionEnd:i}=e.currentTarget,l=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),a=/Win/i.test(navigator.platform);if("Tab"===e.key&&N){if(e.preventDefault(),e.shiftKey){let e=u(t,r),n=e.length-1,l=u(t,i).length-1,a=t.split("\n").map((e,t)=>t>=n&&t<=l&&e.startsWith(" ")?e.substring(2):e).join("\n");if(a!==t){let l=e[n];D({value:a,selectionStart:l?.startsWith(" ")?r-2:r,selectionEnd:i-(t.length-a.length)})}}else if(r!==i){let e=u(t,r),n=e.length-1,l=u(t,i).length-1,a=e[n];D({value:t.split("\n").map((e,t)=>t>=n&&t<=l?" "+e:e).join("\n"),selectionStart:a&&/\S/.test(a)?r+2:r,selectionEnd:i+2*(l-n+1)})}else{let e=r+2;D({value:t.substring(0,r)+" "+t.substring(i),selectionStart:e,selectionEnd:e})}return}if("Backspace"===e.key&&r===i){if(t.substring(0,r).endsWith(" ")){e.preventDefault();let n=r-2;D({value:t.substring(0,r-2)+t.substring(i),selectionStart:n,selectionEnd:n})}return}if("Enter"===e.key&&r===i){let n=u(t,r).pop(),l=n?.match(/^\s+/);if(l?.[0]){e.preventDefault();let n="\n"+l[0],a=r+n.length;D({value:t.substring(0,r)+n+t.substring(i),selectionStart:a,selectionEnd:a})}return}if((l?e.metaKey&&"z"===e.key.toLowerCase():e.ctrlKey&&"z"===e.key.toLowerCase())&&!e.shiftKey&&!e.altKey){e.preventDefault();let t=s(w.current,"undo");t&&k.current&&(k.current.value=t.value,k.current.selectionStart=t.selectionStart,k.current.selectionEnd=t.selectionEnd,n(t.value));return}if((l?e.metaKey&&e.shiftKey&&"z"===e.key.toLowerCase():a?e.ctrlKey&&"y"===e.key.toLowerCase():e.ctrlKey&&e.shiftKey&&"z"===e.key.toLowerCase())&&!e.altKey){e.preventDefault();let t=s(w.current,"redo");t&&k.current&&(k.current.value=t.value,k.current.selectionStart=t.selectionStart,k.current.selectionEnd=t.selectionEnd,n(t.value));return}e.ctrlKey&&"m"===e.key.toLowerCase()&&(!l||e.shiftKey)&&(e.preventDefault(),Y(e=>!e))},placeholder:b,readOnly:g,autoFocus:y,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellcheck:!1,"data-gramm":!1}),(0,r.Y)(d,{})]})}let f=["direction","fontFamily","fontFeatureSettings","fontKerning","fontSize","fontStyle","fontVariantLigatures","fontWeight","letterSpacing","overflowWrap","tabSize","textRendering","textTransform","whiteSpace","wordBreak","wordSpacing"],p=null,m=[],x="",b=new Map,g=[];function y(e){if("u"<typeof document||!e.isConnected)return null;let t=Number.parseFloat(getComputedStyle(e).lineHeight);return Number.isFinite(t)&&t>0?t:null}function v(e,t,n){return e<t?t:e>n?n:e}function k(e){return{start:0,end:v(200,1,Math.max(e,1))}}var w=n("Po"),N=n("DU");function Y(e){var t;let{value:n,onValueChange:l,language:a,wordWrap:o,rootClassName:s,gutterClassName:c,gutterStyle:d,gutterLineClassName:u,editorWrapperClassName:Y,editorClassName:D,editorPadding:C=0,editorStyle:F}=e,S=o?"!whitespace-pre-wrap !break-words":"!whitespace-pre !break-normal",M=(0,i.li)(null),z=(0,i.li)(null),[T,E]=(0,i.J0)(null),[A,L]=(0,i.J0)(null),[$,j]=(0,i.J0)(-1);(0,w.w)();let J=(0,i.Kr)(()=>(function(e){let t=1;for(let n=e.indexOf("\n");-1!==n;n=e.indexOf("\n",n+1))t++;return t})(n),[n]),W=(0,i.hb)(()=>{let e=M.current;if(!e)return;let t=o?function(e,t){let n=y(e);if(null===n)return null;let r=getComputedStyle(e),i=e.clientWidth-Number.parseFloat(r.paddingLeft||"0")-Number.parseFloat(r.paddingRight||"0");if(i<=0)return null;let l=(p&&p.isConnected||((p=document.createElement("div")).setAttribute("aria-hidden","true"),p.style.cssText="position:fixed;top:0;left:-100000px;visibility:hidden;pointer-events:none;margin:0;border:0;padding:0;box-sizing:border-box;",document.body.appendChild(p),m=[]),p);for(let e of f)l.style[e]=r[e];l.style.lineHeight=`${n}px`,l.style.width=`${i}px`;let a=`${i}|${n}|${f.map(e=>r[e]).join("|")}`;a!==x&&(x=a,b.clear());let o=t.split("\n"),s=Array(o.length),c=0;for(let e=0;e<o.length;e++){let t=b.get(o[e]);void 0===t?g[c++]=e:s[e]=t}if(c>0){for(;m.length<c;){let e=document.createElement("div");l.appendChild(e),m.push(e)}for(let e=0;e<c;e++)m[e].textContent=o[g[e]];for(let e=0;e<c;e++){let t=g[e],r=m[e].getBoundingClientRect().height,i=r>n?Math.round(r/n)*n:n;s[t]=i,b.set(o[t],i)}if(b.size>1e5){let e=b.size-5e4;for(let t of b.keys()){if(e--<=0)break;b.delete(t)}}}return{rowHeight:n,heights:s}}(e,n):null;E(e=>e===t||e&&t&&e.rowHeight===t.rowHeight&&e.heights.length===t.heights.length&&e.heights.every((e,n)=>e===t.heights[n])?e:t);let r=t?.rowHeight??y(e);L(e=>e===r?e:r),j(J)},[n,J,o,C,F?.fontSize]);(0,i.Nf)(()=>{W()},[W]);let H=(0,i.li)(W);H.current=W,(0,i.vJ)(()=>{let e=M.current;if(!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>H.current());return t.observe(e),()=>t.disconnect()},[]);let O=(0,i.Kr)(()=>null===A?null:T?function(e,t,n){if(0===n||e.length!==n)return null;let r=new Float64Array(n+1);for(let t=0;t<n;t++)r[t+1]=r[t]+e[t];let i=r[n];return{lineCount:n,rowHeight:t,totalHeight:i,offsetOf:e=>r[v(e,0,n)],lineAt:e=>{if(e<0)return 0;if(i<=0||e>=i)return n-1;let t=0,l=n-1;for(;t<l;){let n=t+l+1>>1;r[n]<=e?t=n:l=n-1}return t}}}(T.heights,T.rowHeight,J):{lineCount:J,rowHeight:A,totalHeight:A*J,offsetOf:e=>A*v(e,0,J),lineAt:e=>v(Math.floor(e/A),0,Math.max(J-1,0))},[A,T,J]),R=(t=n.length,J>300||t>2e4),K=function(e){var t,n;let r,l,{rootRef:a,lineCount:o,geometry:s,enabled:c}=e,[d,u]=(0,i.J0)(null),h=(0,i.hb)(()=>{let e,t,n,r,i=a.current;if(!c||!i)return;let l=s?(e=i.getBoundingClientRect().top,n=(t=function(e){for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowY;if(("auto"===e||"scroll"===e||"overlay"===e)&&t.scrollHeight>t.clientHeight)return t}return null}(i))?t.getBoundingClientRect().top:0,r=t?t.getBoundingClientRect().bottom:globalThis.innerHeight||s.rowHeight,function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:24,i=e.lineAt(t),l=e.lineAt(t+Math.max(n,0));return{start:Math.max(0,i-r),end:Math.min(e.lineCount,Math.max(l+1,i+1)+r)}}(s,n-e,r-n)):k(o);u(e=>e===l||null!==e&&null!==l&&e.start===l.start&&e.end===l.end?e:l)},[c,s,o,a]);(0,i.Nf)(()=>{h()},[h]);let f=(0,i.li)(h);if(f.current=h,(0,i.vJ)(()=>{if(!c)return;let e=0,t=()=>{e||(e=requestAnimationFrame(()=>{e=0,f.current()}))};window.addEventListener("scroll",t,{passive:!0,capture:!0}),window.addEventListener("resize",t);let n="u"<typeof ResizeObserver?null:new ResizeObserver(t),r=a.current;return r&&n?.observe(r),()=>{e&&cancelAnimationFrame(e),window.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("resize",t),n?.disconnect()}},[c,a]),!c)return null;if(!s){let e=k(o);return{...e,top:0,bottom:0,breakAtEnd:e.end>=o}}return t=d??k(s.lineCount),n=s.lineCount,{...l={start:r=v(t.start,0,Math.max(n-1,0)),end:v(t.end,r+1,Math.max(n,1))},...{top:s.offsetOf(l.start),bottom:Math.max(0,s.totalHeight-s.offsetOf(l.end)),breakAtEnd:l.end>=s.lineCount}}}({rootRef:z,lineCount:J,geometry:O,enabled:R&&($!==J||null!==O)}),I=(0,i.hb)((e,t)=>t?function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{contextLines:i=40,maxLineLength:l=12e3}=r,a=e.split("\n"),o=Math.min(Math.max(n.start,0),a.length),s=Math.min(Math.max(n.end,o),a.length);if(o===s)return"";let c=Math.max(0,o-i),d=(0,N.O9)(a.slice(c,s).join("\n"),t,{maxLineLength:l}),u=o-c;return`<span class="shiki">${d.slice(u,u+(s-o)).join("\n")}</span>`}(e,a,t):(0,N.wY)(e,a),[a]),P=K?K.start:0,U=K?Math.min(K.end,J):J,B=[];for(let e=P;e<U;e++)B.push(e);let _=T&&T.heights.length===J?T.heights:null;return(0,r.FD)("div",{className:s,ref:z,children:[(0,r.FD)("div",{className:c,style:d,children:[K&&K.top>0?(0,r.Y)("div",{style:{height:K.top,flexShrink:0},"aria-hidden":"true"}):null,B.map(e=>(0,r.Y)("div",{className:u,style:_?{height:_[e],flexShrink:0}:void 0,children:e+1},e+1))]}),(0,r.Y)("div",{className:Y,children:(0,r.Y)(h,{value:n,onValueChange:l,highlight:I,padding:C,preRef:M,textareaClassName:`focus:outline-none ${S}`,preClassName:S,style:F,className:D,virtual:K})})]})}},hR(e,t,n){var r=n("j"),i=n("H"),l=n("E6"),a=n("t");function o(e){let{src:t,name:n,className:o=""}=e,s=(0,i.li)(null),c=(0,i.li)(null),d=(0,i.li)(null),[u,h]=(0,i.J0)(null),[f,p]=(0,i.J0)(1),[m,x]=(0,i.J0)({x:0,y:0}),[b,g]=(0,i.J0)(!1),[y,v]=(0,i.J0)(null),k=(0,i.hb)(()=>{let e=c.current;return!!e&&!!e.complete&&0!==e.naturalWidth&&(h({width:e.naturalWidth,height:e.naturalHeight}),!0)},[]);(0,i.vJ)(()=>{k()},[k]);let w=(0,i.hb)(()=>{let e=c.current,t=s.current?.getBoundingClientRect(),n=e?.naturalWidth??0,r=e?.naturalHeight??0;t&&n&&r&&(p(Math.min(1,Math.max(.1,(t.width-48)/n,(t.height-48)/r))),x({x:0,y:0}))},[]);(0,i.vJ)(()=>{u&&w()},[u,w]);let N=(0,i.hb)(e=>{p(t=>Math.min(16,Math.max(.1,t*e)))},[]),Y=(0,i.hb)(e=>{e.preventDefault(),N(Math.exp(-(.0015*e.deltaY)))},[N]),D=(0,i.hb)(e=>{0===e.button&&u&&(d.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY},e.currentTarget.setPointerCapture(e.pointerId),g(!0))},[u]),C=(0,i.hb)(e=>{let t=d.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.x,r=e.clientY-t.y;t.x=e.clientX,t.y=e.clientY,x(e=>({x:e.x+n,y:e.y+r}))},[]),F=(0,i.hb)(e=>{d.current?.pointerId===e.pointerId&&(d.current=null,g(!1))},[]),S=(0,i.hb)(()=>{.01>Math.abs(f-1)?w():(p(1),x({x:0,y:0}))},[f,w]);(0,i.vJ)(()=>{let e=e=>{if("+"!==e.key&&"="!==e.key&&"-"!==e.key&&"_"!==e.key&&"0"!==e.key)return;let t=e.target;t&&s.current?.contains(t)&&(e.preventDefault(),"0"===e.key?w():"+"===e.key||"="===e.key?N(1.4):N(1/1.4))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[N,w]);let M=Math.round(100*f),z=u?`${u.width} \xd7 ${u.height} px`:"";return(0,r.FD)("div",{className:`relative flex h-full w-full flex-col bg-paper ${o}`,children:[(0,r.Y)("div",{ref:s,tabIndex:-1,onWheel:Y,onPointerDown:D,onPointerMove:C,onPointerUp:F,onPointerCancel:F,onDblClick:S,className:`image-stage relative flex-1 overflow-hidden outline-none ${b?"cursor-grabbing":"cursor-grab"}`,children:y?(0,r.FD)("div",{className:"flex h-full flex-col items-center justify-center gap-2 px-6 text-center",children:[(0,r.Y)(l.A,{size:20,className:"text-error"}),(0,r.FD)("span",{className:"font-sans text-xs text-error",children:["Could not read ",n]}),(0,r.Y)("span",{className:"break-all font-mono text-[11px] text-ink/50",children:y})]}):(0,r.FD)(r.FK,{children:[!u&&(0,r.FD)("div",{className:"absolute inset-0 flex items-center justify-center gap-2 text-xs text-ink/40",children:[(0,r.Y)(a.A,{size:14,className:"animate-spin"}),(0,r.Y)("span",{children:"Loading image…"})]}),(0,r.Y)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,r.Y)("img",{ref:c,src:t,alt:n,draggable:!1,onLoad:k,onError:()=>v("The file could not be decoded as an image."),className:"image-canvas max-h-none max-w-none select-none",style:{transform:`translate3d(${m.x}px, ${m.y}px, 0) scale(${f})`,visibility:u?"visible":"hidden"}})})]})}),(0,r.FD)("div",{className:"flex flex-shrink-0 items-center justify-between border-t border-ink/10 bg-canvas px-3 py-1.5 font-mono text-[10px] text-ink/50",children:[(0,r.Y)("span",{children:z}),(0,r.FD)("div",{className:"flex items-center gap-3",children:[(0,r.Y)("button",{type:"button",onClick:()=>N(1/1.4),className:"hover:text-ink",title:"Zoom out (-)",children:"−"}),(0,r.FD)("span",{className:"w-10 text-center tabular-nums",children:[M,"%"]}),(0,r.Y)("button",{type:"button",onClick:()=>N(1.4),className:"hover:text-ink",title:"Zoom in (+)",children:"+"}),(0,r.Y)("button",{type:"button",onClick:w,className:"hover:text-ink",title:"Fit to view (0)",children:"Fit"})]})]})]})}function s(e){return(0,r.Y)(o,{...e},e.src)}n.d(t,{a:()=>s})},Xg(e,t,n){n.d(t,{M:()=>C});var r=n("j"),i=n("H"),l=n("X"),a=n("FL"),o=n("DU"),s=n("lP"),c=n("y");let d=(0,c.A)({name:"text-align-justify",size:24,node:[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],aliases:["align-justify"]}),u=(0,c.A)({name:"space",size:24,node:[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]});var h=n("n"),f=n("z"),p=n("b0"),m=n("I"),x=n("DV"),b=n("r"),g=n("AB"),y=n("pX"),v=n("LQ");function k(e){let{filePath:t,status:n,isStaged:i,viewMode:l,ignoreWhitespace:a,additions:o,deletions:c,isLoading:k,isCopied:w,onToggleViewMode:N,onToggleWhitespace:Y,onStageUnstage:D,onDiscard:C,onOpenInEditor:F,onRefresh:S,onCopyDiff:M}=e,z=t.split("/").pop()||t,T=(0,v.R)(n,i);return(0,r.FD)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-paper border-b border-ink/10 text-xs font-sans select-none flex-shrink-0 overflow-x-auto no-scrollbar",children:[(0,r.FD)("div",{className:"hidden md:flex items-center space-x-2 min-w-0 pr-2",children:[(0,r.Y)(y.o,{name:z,size:14,className:"flex-shrink-0"}),(0,r.Y)("span",{className:"font-mono text-ink font-medium truncate",title:t,children:z}),(0,r.FD)("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border ${T.badgeBgClass} flex-shrink-0`,children:[T.charStatus," ",T.label]}),(o>0||c>0)&&(0,r.FD)("div",{className:"flex items-center space-x-1.5 text-[11px] font-mono flex-shrink-0 ml-1",children:[o>0&&(0,r.FD)("span",{className:"text-success font-semibold",children:["+",o]}),c>0&&(0,r.FD)("span",{className:"text-error font-semibold",children:["-",c]})]})]}),(0,r.FD)("div",{className:"flex items-center space-x-1 text-ink/70 flex-shrink-0 ml-auto",children:[(0,r.FD)("div",{className:"flex items-center bg-canvas rounded border border-ink/15 p-0.5 mr-1",children:[(0,r.FD)("button",{type:"button",onClick:N,className:`px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors ${"split"===l?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Split (side-by-side) Diff",children:[(0,r.Y)(s.A,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Split"})]}),(0,r.FD)("button",{type:"button",onClick:N,className:`px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors ${"unified"===l?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Unified Diff",children:[(0,r.Y)(d,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Unified"})]})]}),(0,r.Y)("button",{type:"button",onClick:Y,className:`p-1.5 rounded transition-colors ${a?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:a?"Whitespace ignored":"Ignore whitespace",children:(0,r.Y)(u,{size:13})}),(0,r.Y)("button",{type:"button",onClick:S,className:"p-1.5 text-ink/50 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Refresh Diff",disabled:k,children:(0,r.Y)(h.A,{size:13,className:k?"animate-spin":""})}),(0,r.Y)("button",{type:"button",onClick:M,className:"p-1.5 text-ink/50 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Copy Diff Text",children:w?(0,r.Y)(f.A,{size:13,className:"text-success"}):(0,r.Y)(p.A,{size:13})}),!i&&(0,r.Y)("button",{type:"button",onClick:C,className:"p-1.5 text-ink/50 hover:text-error hover:bg-error/10 rounded transition-colors",title:"Discard changes in this file",children:(0,r.Y)(m.A,{size:13})}),(0,r.Y)("button",{type:"button",onClick:D,className:"px-2 py-1 text-[11px] font-medium rounded border border-ink/15 hover:bg-ink/5 flex items-center space-x-1 transition-colors text-ink",title:i?"Unstage file":"Stage file",children:i?(0,r.FD)(r.FK,{children:[(0,r.Y)(x.A,{size:12}),(0,r.Y)("span",{children:"Unstage"})]}):(0,r.FD)(r.FK,{children:[(0,r.Y)(b.A,{size:12}),(0,r.Y)("span",{children:"Stage"})]})}),F&&(0,r.FD)("button",{type:"button",onClick:F,className:"px-2 py-1 text-[11px] font-medium rounded bg-ink text-canvas hover:bg-ink/90 flex items-center space-x-1 transition-colors shadow-xs ml-1",title:"Open in Code Editor",children:[(0,r.Y)(g.A,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Edit File"})]})]})]})}var w=n("Po");function N(e){let{lines:t,language:n}=e,l=(0,w.w)(),a=(0,i.Kr)(()=>{let e=Array(t.length).fill(""),r=-1,i=i=>{if(r<0)return;let l=(0,o.O9)(t.slice(r,i).map(e=>e.text).join("\n"),n);for(let t=r;t<i;t++)e[t]=l[t-r]??"";r=-1};return t.forEach((e,t)=>{"meta"===e.type?i(t):r<0&&(r=t)}),i(t.length),e},[t,n,l]);return 0===t.length?(0,r.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40 font-mono text-xs p-8",children:"No differences between working file and target."}):(0,r.Y)("div",{className:"w-full h-full overflow-auto font-mono text-xs select-text bg-paper text-ink code-surface",children:(0,r.Y)("div",{className:"pb-4",children:(0,r.Y)("table",{className:"w-max min-w-full border-collapse",children:(0,r.Y)("tbody",{children:t.map((e,t)=>{if("meta"===e.type)return(0,r.FD)("tr",{className:"bg-canvas border-y border-ink/10 text-meta select-none",children:[(0,r.Y)("td",{className:"w-12 text-center py-1 px-2 text-[10px] opacity-60 border-r border-ink/10 font-mono",children:"..."}),(0,r.Y)("td",{className:"w-12 text-center py-1 px-2 text-[10px] opacity-60 border-r border-ink/10 font-mono",children:"..."}),(0,r.Y)("td",{className:"py-1 px-3 text-[11px] font-semibold text-meta font-mono tracking-tight",children:e.text})]},t);let n="add"===e.type,i="del"===e.type;return(0,r.FD)("tr",{className:`transition-colors group ${n?"bg-success/10 hover:bg-success/15":i?"bg-error/10 hover:bg-error/15":"hover:bg-ink/[0.03]"}`,children:[(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${i?"bg-error/15 text-error font-semibold":n?"bg-success/15 text-success/70":"bg-canvas/50 text-ink/40"}`,children:e.oldLineNumber||""}),(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${n?"bg-success/15 text-success font-semibold":i?"bg-error/15 text-error/70":"bg-canvas/50 text-ink/40"}`,children:e.newLineNumber||""}),(0,r.FD)("td",{className:"py-0.5 px-3 whitespace-pre text-ink pr-6",children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${n?"text-success":i?"text-error":"opacity-0"}`,children:n?"+":i?"-":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:e.text&&a[t]||" "}})]})]},t)})})})})})}function Y(e){let{rows:t,language:n}=e,l=(0,w.w)(),a=(0,i.Kr)(()=>{let e=Array(t.length).fill(""),r=Array(t.length).fill(""),i=-1,l=l=>{if(i<0)return;let a=t.slice(i,l),s=(0,o.O9)(a.map(e=>e.left?.text??"").join("\n"),n),c=(0,o.O9)(a.map(e=>e.right?.text??"").join("\n"),n);for(let t=i;t<l;t++)e[t]=s[t-i]??"",r[t]=c[t-i]??"";i=-1};return t.forEach((e,t)=>{e.isMeta?l(t):i<0&&(i=t)}),l(t.length),{left:e,right:r}},[t,n,l]);return 0===t.length?(0,r.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40 font-mono text-xs p-8",children:"No differences between working file and target."}):(0,r.Y)("div",{className:"w-full h-full overflow-auto font-mono text-xs select-text bg-paper text-ink code-surface",children:(0,r.FD)("div",{className:"w-max min-w-full min-w-[700px] pb-4",children:[(0,r.FD)("div",{className:"grid grid-cols-2 sticky top-0 z-10 bg-canvas border-b border-ink/10 text-[11px] text-ink/70 font-sans select-none shadow-xs",children:[(0,r.Y)("div",{className:"px-3 py-1 font-medium border-r border-ink/10 flex items-center justify-between",children:(0,r.Y)("span",{children:"Original (HEAD / Base)"})}),(0,r.Y)("div",{className:"px-3 py-1 font-medium flex items-center justify-between",children:(0,r.Y)("span",{children:"Modified (Working Tree)"})})]}),(0,r.Y)("table",{className:"w-full border-collapse",children:(0,r.Y)("tbody",{children:t.map((e,t)=>{if(e.isMeta)return(0,r.Y)("tr",{className:"bg-canvas border-y border-ink/10 text-meta select-none",children:(0,r.Y)("td",{colSpan:4,className:"py-1 px-3 text-[11px] font-semibold text-meta text-center font-mono",children:e.metaText})},t);let n=e.left,i=e.right,l=n?.type==="del",o=i?.type==="add";return(0,r.FD)("tr",{className:"border-b border-ink/[0.04]",children:[(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${l?"bg-error/15 text-error font-semibold":n?"bg-canvas/50 text-ink/40":"bg-canvas/80 text-transparent"}`,children:n?.lineNumber||""}),(0,r.Y)("td",{className:`min-w-[320px] py-0.5 px-2 whitespace-pre border-r border-ink/10 text-ink ${l?"bg-error/10":n?"hover:bg-ink/[0.02]":"bg-canvas/40 select-none"}`,children:n?(0,r.FD)(r.FK,{children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${l?"text-error":"opacity-0"}`,children:l?"-":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:n.text&&a.left[t]||" "}})]}):(0,r.Y)("span",{className:"opacity-0",children:" "})}),(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${o?"bg-success/15 text-success font-semibold":i?"bg-canvas/50 text-ink/40":"bg-canvas/80 text-transparent"}`,children:i?.lineNumber||""}),(0,r.Y)("td",{className:`min-w-[320px] py-0.5 px-2 whitespace-pre text-ink ${o?"bg-success/10":i?"hover:bg-ink/[0.02]":"bg-canvas/40 select-none"}`,children:i?(0,r.FD)(r.FK,{children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${o?"text-success":"opacity-0"}`,children:o?"+":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:i.text&&a.right[t]||" "}})]}):(0,r.Y)("span",{className:"opacity-0",children:" "})})]},t)})})})]})})}var D=n("p");function C(e){let{filePath:t,status:n="M",isStaged:s=!1,root:c,repo:d=".",onOpenInEditor:u,onFileSaved:f,className:p=""}=e,[m,x]=(0,a.LO)("diff.viewMode","unified"),[b,g]=(0,a.LO)("diff.ignoreWhitespace",!1),[y,v]=(0,i.J0)(""),[w,C]=(0,i.J0)(n),[F,S]=(0,i.J0)(s),[M,z]=(0,i.J0)(!0),[T,E]=(0,i.J0)(null),[A,L]=(0,i.J0)(!1),[$,j]=(0,i.J0)(!1),J=(0,l.L)(),W=(0,i.hb)(async()=>{if(t){z(!0),E(null);try{let e=new URLSearchParams({fileDiff:"1",file:t,staged:F?"1":"0",repo:d||"."});(n||w)&&e.set("status",n||w),c&&e.set("root",c);let r=await fetch(`/api/fs/git?${e.toString()}`),i=await r.json();i.success?(v(i.diff||""),i.status&&C(i.status)):E(i.error||"Failed to load file diff")}catch(e){E(e.message||"Error fetching diff")}finally{z(!1)}}},[t,F,d,c]);(0,i.vJ)(()=>{C(n),S(s)},[n,s,t]),(0,i.vJ)(()=>{W()},[W]);let H=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=[],i=0,l=0;if(!e||!e.trim())return{lines:n,splitRows:r,additions:i,deletions:l};let a=e.split(/\r?\n/),o=a.some(e=>e.startsWith("@@"))?a:[`@@ -1,${a.length} +1,${a.length} @@`,...a],s=1,c=1,d=[],u=[],h=()=>{let e=Math.max(d.length,u.length);for(let t=0;t<e;t++)r.push({left:d[t]?{type:"del",text:d[t].text,lineNumber:d[t].lineNumber}:void 0,right:u[t]?{type:"add",text:u[t].text,lineNumber:u[t].lineNumber}:void 0});d=[],u=[]};for(let e of o)if(!(e.startsWith("diff --git")||e.startsWith("index ")||e.startsWith("---")||e.startsWith("+++")||e.startsWith("new file mode")||e.startsWith("deleted file mode")||e.startsWith("similarity index")||e.startsWith("old mode")||e.startsWith("new mode")||e.startsWith("\\ No newline"))){if(e.startsWith("@@")){h();let t=e.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);t&&(s=parseInt(t[1],10),c=parseInt(t[2],10)),n.push({type:"meta",text:e}),r.push({isMeta:!0,metaText:e});continue}if(e.startsWith("+")){let r=e.slice(1),l=t?r.trim():r;i++,n.push({type:"add",text:l,newLineNumber:c}),u.push({text:l,lineNumber:c}),c++}else if(e.startsWith("-")){let r=e.slice(1),i=t?r.trim():r;l++,n.push({type:"del",text:i,oldLineNumber:s}),d.push({text:i,lineNumber:s}),s++}else{h();let i=e.startsWith(" ")?e.slice(1):e,l=t?i.trim():i;n.push({type:"context",text:l,oldLineNumber:s,newLineNumber:c}),r.push({left:{type:"context",text:l,lineNumber:s},right:{type:"context",text:l,lineNumber:c}}),s++,c++}}return h(),{lines:n,splitRows:r,additions:i,deletions:l}}(y,b),O=(0,o.sQ)(t);return(0,r.FD)("div",{className:`flex flex-col min-h-0 bg-paper select-text relative font-sans ${p}`,children:[(0,r.Y)(k,{filePath:t,status:w,isStaged:F,viewMode:m,ignoreWhitespace:b,additions:H.additions,deletions:H.deletions,isLoading:M,isCopied:A,onToggleViewMode:()=>{x("unified"===m?"split":"unified")},onToggleWhitespace:()=>{g(!b)},onStageUnstage:()=>{let e=F?"unstage":"stage",n=new FormData;n.set("actionType",e),n.set("file",t),n.set("repo",d||"."),c&&n.set("root",c),J.submit(n,{method:"POST",action:"/api/fs/git"}),S(!F),setTimeout(()=>{W(),f?.()},300)},onDiscard:()=>{j(!0)},onOpenInEditor:u,onRefresh:W,onCopyDiff:()=>{y&&(navigator.clipboard.writeText(y),L(!0),setTimeout(()=>L(!1),2e3))}}),(0,r.Y)("div",{className:"flex-1 overflow-hidden relative flex flex-col bg-paper",children:M?(0,r.FD)("div",{className:"flex-1 flex items-center justify-center space-x-2 text-ink/50 text-xs font-mono",children:[(0,r.Y)(h.A,{size:14,className:"animate-spin"}),(0,r.Y)("span",{children:"Loading file diff..."})]}):T?(0,r.FD)("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center space-y-2",children:[(0,r.Y)(D.A,{size:20,className:"text-error"}),(0,r.Y)("p",{className:"text-xs text-error font-medium",children:T}),(0,r.Y)("button",{onClick:W,className:"px-3 py-1 text-xs bg-ink/10 hover:bg-ink/15 text-ink rounded font-sans transition-colors",children:"Retry"})]}):"split"===m?(0,r.Y)(Y,{rows:H.splitRows,language:O}):(0,r.Y)(N,{lines:H.lines,language:O})}),$&&(0,r.Y)("div",{className:"fixed inset-0 bg-ink/20 z-50 flex items-center justify-center p-4 backdrop-blur-xs",children:(0,r.FD)("div",{className:"bg-paper rounded-lg shadow-xl p-4 w-full max-w-sm border border-ink/15",children:[(0,r.Y)("h3",{className:"font-semibold text-ink mb-1.5 text-sm",children:"Discard Changes?"}),(0,r.FD)("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to discard all unstaged changes in ",(0,r.Y)("span",{className:"font-mono font-medium text-ink",children:t}),"? This cannot be undone."]}),(0,r.FD)("div",{className:"flex justify-end space-x-2",children:[(0,r.Y)("button",{type:"button",onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",children:"Cancel"}),(0,r.Y)("button",{type:"button",onClick:()=>{j(!1);let e=new FormData;e.set("actionType","discard"),e.set("file",t),e.set("repo",d||"."),c&&e.set("root",c),J.submit(e,{method:"POST",action:"/api/fs/git"}),setTimeout(()=>{W(),f?.()},300)},className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 font-medium transition-colors",children:"Discard Changes"})]})]})})]})}},HQ(e,t,n){n.d(t,{n:()=>p});var r=n("H"),i=n("DU"),l=n("JK"),a=n("tZ");function o(e){return e.includes("\r")?e.replace(/\r\n?/g,"\n"):e}async function s(e,t,n){if(!e.path)return!1;let r=new FormData;r.append("actionType","save"),r.append("path",e.path),r.append("content",t),r.append("eol",n),e.root&&r.append("root",e.root),e.repo&&"."!==e.repo&&r.append("repo",e.repo);try{let e=await fetch("/api/fs/action",{method:"POST",body:r}),t=await e.json().catch(()=>null);return!!(e.ok&&t?.success)}catch{return!1}}function c(e,t){let n=Object.keys(e);if(n.every(e=>t.has(e)))return e;let r={};for(let i of n)t.has(i)&&(r[i]=e[i]);return r}function d(e,t){let n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}async function u(e,t){let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);d(await n.blob(),t)}async function h(e){let t=await fetch(e);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.blob();if("u"<typeof ClipboardItem||!navigator.clipboard?.write)throw Error("Image clipboard unavailable");await navigator.clipboard.write([new ClipboardItem({[n.type]:n})])}function f(e){return String(e.id??e.path??e.name)}function p(e){var t;let n,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{fallback:m,reportLoadError:x=!1,flushOnUnmount:b=!1,reportSaveError:g=!1,downloadMimeType:y="text/plain",onFileSaved:v}=p,[k,w]=(0,r.J0)({}),[N,Y]=(0,r.J0)({}),[D,C]=(0,r.J0)({}),[F,S]=(0,r.J0)(!1),[M,z]=(0,r.J0)(null),[T,E]=(0,r.J0)("idle"),[A,L]=(0,r.J0)(0),$=e?f(e):"",j=e?k[$]??(void 0!==e.content?o(e.content):""):"",J=j!==(N[$]??j),W=e?.path&&void 0===e.content&&(0,l.CC)(e.path)?e.path:null,H=null!==W,O=W?`${(0,a.l)({...e,path:W})}&v=${A}`:null,R=(0,r.li)(new Set),K=(0,r.li)(null),I=(0,r.li)(k);I.current=k;let P=(0,r.li)(N);P.current=N;let U=(0,r.li)(D);U.current=D;let B=(0,r.hb)((e,t)=>{let n,r=(n=t.indexOf("\n"))>0&&"\r"===t[n-1]?"crlf":"lf",i=o(t);w(t=>({...t,[e]:i})),Y(t=>({...t,[e]:i})),C(t=>({...t,[e]:r}))},[]),_=(0,r.hb)(async(e,t)=>{if(!e.path)return;E("saving");let n=f(e);await s(e,t,U.current[n]??"lf")?(E("saved"),Y(e=>({...e,[n]:t})),v?.()):E(g?"error":"idle")},[v,g]),X=(0,r.li)(_);X.current=_,(0,r.vJ)(()=>{if(!e)return;let t=f(e);if(R.current.has(t))return;if(R.current.add(t),H){z(null),S(!1);return}if(void 0!==e.content){B(t,e.content),z(null);return}if(!e.path)return x?void z("No file path supplied for this attachment."):void B(t,m?m(e.name):"");let n=void 0===I.current[t],r=!1;n&&S(!0),z(null);let i=new URLSearchParams({path:e.path});return e.root&&i.set("root",e.root),e.repo&&"."!==e.repo&&i.set("repo",e.repo),fetch(`/api/fs/read?${i.toString()}`).then(async e=>{let t=await e.json().catch(()=>null);if(x){if(!e.ok||!t||"string"!=typeof t.content)throw Error(t?.error||`HTTP ${e.status}`);return t.content}return"string"==typeof t?.content?t.content:null}).then(n=>{if(r)return;let i=I.current[t];if(void 0!==i&&i!==P.current[t])return;let l=K.current;l&&f(l.file)===t||B(t,n??(m?m(e.name):""))}).catch(i=>{r||n&&(x?(B(t,""),z(i instanceof Error?i.message:"Failed to read file")):B(t,m?m(e.name):""))}).finally(()=>{r||S(!1)}),()=>{r=!0}},[$,e,m,x,B,A,H]),(0,r.vJ)(()=>{if("saved"!==T)return;let e=window.setTimeout(()=>E("idle"),1500);return()=>window.clearTimeout(e)},[T]);let V=(0,r.hb)(t=>{if(!e||H)return;let n=f(e);if(w(e=>({...e,[n]:t})),!e.path)return;K.current&&window.clearTimeout(K.current.timer);let r=window.setTimeout(()=>{K.current=null,X.current(e,t)},800);K.current={timer:r,file:e,content:t}},[e,H]),Q=(0,r.hb)(()=>{if(!e||H)return;let t=k[f(e)];void 0!==t&&(K.current&&(window.clearTimeout(K.current.timer),K.current=null),X.current(e,t))},[e,k,H]),{copied:Z,copy:q,download:G}=function(e){let{target:t,content:n,downloadContent:i,imageUrl:l,downloadMimeType:a}=e,[o,s]=(0,r.J0)(!1),c=(0,r.hb)(()=>{s(!0),window.setTimeout(()=>s(!1),1500)},[]);return{copied:o,copy:(0,r.hb)(()=>{!t||(l?h(l).then(c).catch(()=>{}):navigator.clipboard&&navigator.clipboard.writeText(n).then(c).catch(()=>{}))},[t,n,l,c]),download:(0,r.hb)(()=>{if(t){if(l)return void u(l,t.name).catch(()=>{});d(new Blob([i],{type:a}),t.name)}},[t,i,a,l])}}({target:e,content:j,downloadContent:e?(t=D[$]??"lf",n=o(j),"crlf"===t?n.replace(/\n/g,"\r\n"):n):j,imageUrl:O,downloadMimeType:y}),ee=(0,r.hb)(()=>{R.current.clear(),L(e=>e+1)},[]),et=(0,r.hb)(e=>{let t=new Set(e.map(String));for(let e of Array.from(R.current))t.has(e)||R.current.delete(e);w(e=>c(e,t)),C(e=>c(e,t))},[]);return(0,r.vJ)(()=>{if(b)return()=>{let e=K.current;e&&(window.clearTimeout(e.timer),K.current=null,X.current(e.file,e.content))}},[b]),{content:j,onChange:V,isLoading:F,loadError:M,saveStatus:T,copied:Z,isDirty:J,language:e?(0,i.sQ)(e.name):"javascript",isImage:H,imageUrl:O,saveNow:Q,copy:q,download:G,reset:ee,retain:et}}},Soe(e,t,n){let r=(0,n("y").A)({name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]});n.d(t,{},{A:r})},yh(e,t,n){let r=(0,n("y").A)({name:"text-wrap",size:24,node:[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],aliases:["wrap-text"]});n.d(t,{},{A:r})},na(e,t,n){let r=(0,n("y").A)({name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]});n.d(t,{},{A:r})},hj(e,t,n){let r=(0,n("y").A)({name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]});n.d(t,{},{A:r})}}]);
|