spec-cat 0.1.13 → 0.1.15
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{CPqjerP3.js → C9YFwlVG.js} +1 -1
- package/.output/public/_nuxt/CkZELJoz.js +122 -0
- package/.output/public/_nuxt/CpSdCo6F.js +1 -0
- package/.output/public/_nuxt/{Djrn6aq0.js → CwGiOvuj.js} +2 -2
- package/.output/public/_nuxt/{dYG8t45S.js → Cy9osphj.js} +1 -1
- package/.output/public/_nuxt/D14Nt8oq.js +1 -0
- package/.output/public/_nuxt/DQ8x7AHg.js +1 -0
- package/.output/public/_nuxt/{ASOk6VwA.js → Do9K5d62.js} +1 -1
- package/.output/public/_nuxt/DqVSe5UI.js +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/4418538f-4ad6-4feb-9ad6-0974869ac9bd.json +1 -0
- package/.output/public/_nuxt/entry.CJqUIF8E.css +1 -0
- package/.output/public/_nuxt/{DqCsQSnP.js → vkftdPXk.js} +1 -1
- package/.output/server/chunks/_/aiProviderRegistry.mjs +36 -0
- package/.output/server/chunks/_/aiProviderRegistry.mjs.map +1 -0
- package/.output/server/chunks/_/aiProviderSelection.mjs +76 -0
- package/.output/server/chunks/_/aiProviderSelection.mjs.map +1 -0
- package/.output/server/chunks/_/chat.mjs.map +1 -1
- package/.output/server/chunks/_/claude.mjs +163 -0
- package/.output/server/chunks/_/claude.mjs.map +1 -0
- package/.output/server/chunks/_/claudeProvider.mjs +6 -6
- package/.output/server/chunks/_/claudeService.mjs +85 -0
- package/.output/server/chunks/_/claudeService.mjs.map +1 -0
- package/.output/server/chunks/_/codexProvider.mjs +1 -21
- package/.output/server/chunks/_/codexProvider.mjs.map +1 -1
- package/.output/server/chunks/_/git.mjs +1 -1
- package/.output/server/chunks/_/providerProcessError.mjs +1 -1
- package/.output/server/chunks/_/skillRegistry.mjs +249 -0
- package/.output/server/chunks/_/skillRegistry.mjs.map +1 -0
- package/.output/server/chunks/_/validateWorktree.mjs +27 -3
- package/.output/server/chunks/_/validateWorktree.mjs.map +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs.map +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +657 -1829
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/_ws.mjs +4 -3
- package/.output/server/chunks/routes/_ws.mjs.map +1 -1
- package/.output/server/chunks/routes/api/ai/providers.get.mjs +3 -5
- package/.output/server/chunks/routes/api/ai/providers.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/compare.get.mjs +2 -5
- package/.output/server/chunks/routes/api/chat/compare.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/context.get.mjs +2 -5
- package/.output/server/chunks/routes/api/chat/context.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/finalize.post.mjs +3 -2
- package/.output/server/chunks/routes/api/chat/finalize.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/generate-commit-message.post.mjs +6 -3
- package/.output/server/chunks/routes/api/chat/generate-commit-message.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/preview-sync.post.mjs +2 -3
- package/.output/server/chunks/routes/api/chat/preview-sync.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/preview.delete.mjs +2 -3
- package/.output/server/chunks/routes/api/chat/preview.delete.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/preview.post.mjs +2 -3
- package/.output/server/chunks/routes/api/chat/preview.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/rebase.post.mjs +2 -3
- package/.output/server/chunks/routes/api/chat/rebase.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/worktree-commit.post.mjs +4 -3
- package/.output/server/chunks/routes/api/chat/worktree-commit.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/worktree.delete.mjs +1 -2
- package/.output/server/chunks/routes/api/chat/worktree.delete.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/worktree.post.mjs +4 -8
- package/.output/server/chunks/routes/api/chat/worktree.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat.post.mjs +4 -5
- package/.output/server/chunks/routes/api/chat.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/conversations/_conversationId/archive.post.mjs +1 -2
- package/.output/server/chunks/routes/api/conversations/_conversationId/archive.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/conversations/archives/_archiveId/restore.post.mjs +2 -3
- package/.output/server/chunks/routes/api/conversations/archives/_archiveId/restore.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/conversations/archives/_archiveId_.delete.mjs +2 -5
- package/.output/server/chunks/routes/api/conversations/archives/_archiveId_.delete.mjs.map +1 -1
- package/.output/server/chunks/routes/api/conversations/archives.get.mjs +2 -5
- package/.output/server/chunks/routes/api/conversations/archives.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/conversations/update.post.mjs +2 -5
- package/.output/server/chunks/routes/api/conversations/update.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/conversations.get.mjs +2 -5
- package/.output/server/chunks/routes/api/conversations.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/conversations.post.mjs +2 -5
- package/.output/server/chunks/routes/api/conversations.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/cwd.get.mjs +2 -5
- package/.output/server/chunks/routes/api/cwd.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/branch-rename.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/branch-rename.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/branch.delete.mjs +2 -5
- package/.output/server/chunks/routes/api/git/branch.delete.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/branches.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/branches.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/checkout.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/checkout.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/cherry-pick.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/cherry-pick.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/clean.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/clean.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/commit/_id_.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/commit/_id_.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/commit.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/commit.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/diff.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/diff.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/fetch.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/fetch.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/file-diff.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/file-diff.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/graph.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/graph.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/log.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/log.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/merge-base.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/merge-base.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/merge.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/merge.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/pull.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/pull.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/push.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/push.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/rebase.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/rebase.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/remote.delete.mjs +2 -5
- package/.output/server/chunks/routes/api/git/remote.delete.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/remote.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/remote.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/remote.put.mjs +2 -5
- package/.output/server/chunks/routes/api/git/remote.put.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/remotes.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/remotes.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/reset.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/reset.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/revert.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/revert.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/show.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/show.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/stage.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/stage.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/stash-apply.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/stash-apply.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/stash-branch.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/stash-branch.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/stash-drop.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/stash-drop.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/stash-pop.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/stash-pop.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/stash.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/stash.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/stash.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/stash.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/state.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/state.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/status.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/status.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/tag/_name_.get.mjs +2 -5
- package/.output/server/chunks/routes/api/git/tag/_name_.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/tag-push.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/tag-push.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/tag.delete.mjs +2 -5
- package/.output/server/chunks/routes/api/git/tag.delete.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/tag.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/tag.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/git/unstage.post.mjs +2 -5
- package/.output/server/chunks/routes/api/git/unstage.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/index.get.mjs +4 -5
- package/.output/server/chunks/routes/api/index.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/index.get2.mjs +2 -3
- package/.output/server/chunks/routes/api/index.get2.mjs.map +1 -1
- package/.output/server/chunks/routes/api/index.post.mjs +2 -3
- package/.output/server/chunks/routes/api/index.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/rebase/abort.post.mjs +2 -3
- package/.output/server/chunks/routes/api/rebase/abort.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/rebase/ai-resolve.post.mjs +7 -5
- package/.output/server/chunks/routes/api/rebase/ai-resolve.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/rebase/conflicts.get.mjs +1 -2
- package/.output/server/chunks/routes/api/rebase/conflicts.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/rebase/continue-sync.post.mjs +2 -3
- package/.output/server/chunks/routes/api/rebase/continue-sync.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/rebase/continue.post.mjs +1 -2
- package/.output/server/chunks/routes/api/rebase/continue.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/rebase/resolve.put.mjs +1 -2
- package/.output/server/chunks/routes/api/rebase/resolve.put.mjs.map +1 -1
- package/.output/server/chunks/routes/api/repository/status.get.mjs +2 -5
- package/.output/server/chunks/routes/api/repository/status.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/settings.get.mjs +4 -7
- package/.output/server/chunks/routes/api/settings.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/settings.post.mjs +4 -5
- package/.output/server/chunks/routes/api/settings.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/skills/_skillId/prompt.post.mjs +8 -6
- package/.output/server/chunks/routes/api/skills/_skillId/prompt.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/specs/_featureId/_...filename_.get.mjs +1 -4
- package/.output/server/chunks/routes/api/specs/_featureId/_...filename_.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/specs/_featureId/_...filename_.put.mjs +1 -4
- package/.output/server/chunks/routes/api/specs/_featureId/_...filename_.put.mjs.map +1 -1
- package/.output/server/chunks/routes/api/specs/features.get.mjs +1 -4
- package/.output/server/chunks/routes/api/specs/features.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/specs/reindex.post.mjs +2 -5
- package/.output/server/chunks/routes/api/specs/reindex.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/specs/search.get.mjs +2 -5
- package/.output/server/chunks/routes/api/specs/search.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/specs/status.get.mjs +2 -5
- package/.output/server/chunks/routes/api/specs/status.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/worktrees/_name/switch.post.mjs +2 -3
- package/.output/server/chunks/routes/api/worktrees/_name/switch.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/worktrees/_name_.delete.mjs +1 -2
- package/.output/server/chunks/routes/api/worktrees/_name_.delete.mjs.map +1 -1
- package/.output/server/chunks/routes/git-watcher-ws.mjs +2 -5
- package/.output/server/chunks/routes/git-watcher-ws.mjs.map +1 -1
- package/.output/server/chunks/routes/renderer.mjs +2 -5
- package/.output/server/index.mjs +2 -5
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/package.json +1 -1
- package/package.json +1 -1
- package/.output/public/_nuxt/B24bRLVA.js +0 -1
- package/.output/public/_nuxt/B3SzeM5g.js +0 -1
- package/.output/public/_nuxt/D3Ay6Tay.js +0 -126
- package/.output/public/_nuxt/DN_vgzh9.js +0 -1
- package/.output/public/_nuxt/afuUTAOf.js +0 -1
- package/.output/public/_nuxt/builds/meta/a94a9679-4171-4043-b507-a48b9a35f087.json +0 -1
- package/.output/public/_nuxt/entry.qjEvbHpP.css +0 -1
- package/.output/server/chunks/routes/api/auto-mode/status.get.mjs +0 -35
- package/.output/server/chunks/routes/api/auto-mode/status.get.mjs.map +0 -1
- package/.output/server/chunks/routes/api/auto-mode/toggle.post.mjs +0 -45
- package/.output/server/chunks/routes/api/auto-mode/toggle.post.mjs.map +0 -1
- package/.output/server/chunks/routes/auto-mode-ws.mjs +0 -65
- package/.output/server/chunks/routes/auto-mode-ws.mjs.map +0 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DqVSe5UI.js","./CwGiOvuj.js","./entry.CJqUIF8E.css","./vkftdPXk.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{y as i,z as u,A as r,d as Ae,C as q,G as o,P as Ne,R as Ct,Q as Ge,S as ge,E as Re,B as C,O as P,g as $,U as Ie,V as mn,k as D,W as Bt,H as we,L as de,o as xt,X as kt,Y as zo,K as Pe,Z as Kt,T as Zt,_ as In,M as hn,D as nt,N as wt,$ as Es,I as qr,a0 as $e,a1 as _n,a2 as Ut,a3 as Bn,a4 as Dr,a5 as Rs,f as Ps,a6 as po,a7 as Vo,a8 as Ds,q as Is,a9 as Ls,x as Ns,aa as vo}from"./CwGiOvuj.js";import{r as $t,c as pn,b as vr,a as Mn}from"./Cy9osphj.js";import{_ as gr}from"./DlAUqK2U.js";import{S as fr,i as Fs,c as Hs,P as Os,W as go,M as xo,d as bo,e as yo,g as wo,f as Us,D as Wo,h as Go,j as js,b as Hn,u as Qn,k as Pn,l as zs,a as Ir,m as Dn,n as rr,_ as Vs}from"./DqVSe5UI.js";function Ws(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"})])}function Gs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m8.25 3v6.75m0 0-3-3m3 3 3-3M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})])}function Lr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})])}function qs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 8.25H7.5a2.25 2.25 0 0 0-2.25 2.25v9a2.25 2.25 0 0 0 2.25 2.25h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25H15M9 12l3 3m0 0 3-3m-3 3V2.25"})])}function Ks(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"})])}function Zs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function qo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3"})])}function Ko(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})])}function Zo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function Yo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"})])}function Xo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})])}function Qo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})])}function Ys(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0 1 12 15a9.065 9.065 0 0 0-6.23-.693L5 14.5m14.8.8 1.402 1.402c1.232 1.232.65 3.318-1.067 3.611A48.309 48.309 0 0 1 12 21c-2.773 0-5.491-.235-8.135-.687-1.718-.293-2.3-2.379-1.067-3.61L5 14.5"})])}function Jo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z"})])}function Xs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"})])}function Qs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"})])}function es(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.25 12.76c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.076-4.076a1.526 1.526 0 0 1 1.037-.443 48.282 48.282 0 0 0 5.68-.494c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z"})])}function xr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})])}function Kr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function Js(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}function Zr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"})])}function Yr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9"})])}function ea(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"})])}function Xr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"})])}function Ln(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 7.5V6.108c0-1.135.845-2.098 1.976-2.192.373-.03.748-.057 1.123-.08M15.75 18H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08M15.75 18.75v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5A3.375 3.375 0 0 0 6.375 7.5H5.25m11.9-3.664A2.251 2.251 0 0 0 15 2.25h-1.5a2.251 2.251 0 0 0-2.15 1.586m5.8 0c.065.21.1.433.1.664v.75h-6V4.5c0-.231.035-.454.1-.664M6.75 7.5H4.875c-.621 0-1.125.504-1.125 1.125v12c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V16.5a9 9 0 0 0-9-9Z"})])}function ts(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})])}function ns(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9.75v6.75m0 0-3-3m3 3 3-3m-8.25 6a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"})])}function Nr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5"})])}function rs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function ta(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})])}function os(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 0 0 2.25-2.25V6.75a2.25 2.25 0 0 0-2.25-2.25H6.75A2.25 2.25 0 0 0 4.5 6.75v10.5a2.25 2.25 0 0 0 2.25 2.25Zm.75-12h9v9h-9v-9Z"})])}function na(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12"})])}function ra(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"})])}function oa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Zm3.75 11.625a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"})])}function Nn(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})])}function On(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"})])}function wn(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})])}function sa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"})])}function ss(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function aa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776"})])}function Fr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z"})])}function ia(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"})])}function la(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"})])}function ca(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})])}function ua(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18"})])}function as(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})])}function Tn(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])}function da(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"})])}function fa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"})])}function ma(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13"})])}function Qr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"})])}function is(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"})])}function ha(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})])}function ko(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z"})])}function Jr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z"})])}function ls(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})])}function eo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m0-10.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.75c0 5.592 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.57-.598-3.75h-.152c-3.196 0-6.1-1.25-8.25-3.286Zm0 13.036h.008v.008H12v-.008Z"})])}function br(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"})])}function pa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"})])}function to(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 6h.008v.008H6V6Z"})])}function Hr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"})])}function va(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"})])}const ga={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},xa={class:"relative flex-1 min-w-0"},ba={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},ya=["disabled"],wa=["disabled"],ka=Ae({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(e,{expose:n,emit:t}){const a=t,s=$(""),l=$(null);let c=null;function d(){c&&clearTimeout(c),c=setTimeout(()=>{a("search",s.value)},200)}function p(_){_.key==="Escape"?(_.preventDefault(),a("close")):_.key==="Enter"&&(_.preventDefault(),_.shiftKey?a("prev"):a("next"))}function f(){l.value?.focus(),l.value?.select()}return n({focus:f}),(_,S)=>(i(),u("div",ga,[q(o(Tn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("div",xa,[Ne(r("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":S[0]||(S[0]=g=>Ge(s)?s.value=g:null),type:"text",placeholder:"Find in commits...","aria-label":"Search commits",class:"w-full px-2 py-1 text-sm bg-retro-dark border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",onInput:d,onKeydown:p},null,544),[[Ct,o(s)]])]),o(s)?(i(),u("span",ba,[e.resultCount>0?(i(),u(ge,{key:0},[Re(C(e.currentIndex+1)+" of "+C(e.resultCount),1)],64)):(i(),u(ge,{key:1},[Re(" No results ")],64))])):P("",!0),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:e.resultCount===0,"aria-label":"Previous result",title:"Previous (Shift+Enter)",onClick:S[1]||(S[1]=g=>a("prev"))},[q(o(ea),{class:"w-4 h-4"})],8,ya),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:e.resultCount===0,"aria-label":"Next result",title:"Next (Enter)",onClick:S[2]||(S[2]=g=>a("next"))},[q(o(Js),{class:"w-4 h-4"})],8,wa),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors","aria-label":"Close find widget",title:"Close (Escape)",onClick:S[3]||(S[3]=g=>a("close"))},[q(o($t),{class:"w-4 h-4"})])]))}}),Ca={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},$a={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},Sa={class:"flex-1 overflow-auto max-h-[300px]"},_a={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},Ta=["onKeyup"],Ma=["onClick"],Aa={class:"text-retro-muted truncate flex-1 font-mono"},Ba=["onClick"],Ea=["onClick"],Ra={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},Pa={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},Da={class:"flex gap-2 justify-end"},Ia=["disabled"],La={key:1,class:"px-3 py-2 border-t border-retro-border"},Na=Ae({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(e,{emit:n}){const t=n,a=$(!1),s=$(""),l=$(""),c=$(null),d=$("");function p(){a.value=!0,s.value="",l.value=""}function f(){!s.value.trim()||!l.value.trim()||(t("add",{name:s.value.trim(),url:l.value.trim()}),a.value=!1)}function _(b){c.value=b.name,d.value=b.fetchUrl}function S(b){d.value.trim()&&(t("edit",{name:b,newUrl:d.value.trim()}),c.value=null)}function g(){c.value=null}return(b,w)=>(i(),u("div",Ca,[r("div",$a,[w[5]||(w[5]=r("h3",{class:"text-sm font-semibold text-retro-text"},"Remote Repositories",-1)),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",onClick:w[0]||(w[0]=M=>t("close"))},[q(o($t),{class:"w-4 h-4"})])]),r("div",Sa,[(i(!0),u(ge,null,Ie(e.remotes,M=>(i(),u("div",{key:M.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[r("span",_a,C(M.name),1),o(c)===M.name?(i(),u(ge,{key:0},[Ne(r("input",{"onUpdate:modelValue":w[1]||(w[1]=j=>Ge(d)?d.value=j:null),type:"text",class:"flex-1 px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan",onKeyup:[mn(j=>S(M.name),["enter"]),mn(g,["escape"])]},null,40,Ta),[[Ct,o(d)]]),r("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:j=>S(M.name)},[q(o(Kr),{class:"w-3.5 h-3.5"})],8,Ma),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:g},[q(o($t),{class:"w-3.5 h-3.5"})])],64)):(i(),u(ge,{key:1},[r("span",Aa,C(M.fetchUrl),1),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:j=>_(M)},[q(o(Qr),{class:"w-3.5 h-3.5"})],8,Ba),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:j=>t("delete",M.name)},[q(o(pn),{class:"w-3.5 h-3.5"})],8,Ea)],64))]))),128)),e.remotes.length===0?(i(),u("div",Ra," No remotes configured ")):P("",!0)]),o(a)?(i(),u("div",Pa,[Ne(r("input",{"onUpdate:modelValue":w[2]||(w[2]=M=>Ge(s)?s.value=M:null),type:"text",placeholder:"Remote name (e.g., origin)",class:"w-full px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[Ct,o(s)]]),Ne(r("input",{"onUpdate:modelValue":w[3]||(w[3]=M=>Ge(l)?l.value=M:null),type:"text",placeholder:"Remote URL",class:"w-full px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",onKeyup:mn(f,["enter"])},null,544),[[Ct,o(l)]]),r("div",Da,[r("button",{class:"px-2 py-1 text-xs text-retro-muted hover:text-retro-text transition-colors",onClick:w[4]||(w[4]=M=>a.value=!1)}," Cancel "),r("button",{class:"px-2 py-1 text-xs bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40 rounded hover:bg-retro-cyan/30 transition-colors",disabled:!o(s).trim()||!o(l).trim(),onClick:f}," Add Remote ",8,Ia)])])):P("",!0),o(a)?P("",!0):(i(),u("div",La,[r("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:p},[q(o(vr),{class:"w-3.5 h-3.5"}),w[6]||(w[6]=Re(" Add Remote ",-1))])]))]))}}),yr={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},or=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Fn={A:{label:"Added",colorClass:"text-retro-green"},M:{label:"Modified",colorClass:"text-retro-yellow"},D:{label:"Deleted",colorClass:"text-retro-red"},R:{label:"Renamed",colorClass:"text-retro-blue"},C:{label:"Copied",colorClass:"text-retro-purple"},U:{label:"Unmerged",colorClass:"text-retro-cyan"}},Fa=["width","height"],Ha=["d","stroke","stroke-dasharray"],Oa={key:0},Ua=["cx","r"],ja=["cx","r","fill"],za=["cx","r","stroke"],Va=["cx","r","fill"],Wa=["cx","r","stroke"],Ga=["cx","r","fill"],qa=["cx","r"],Ka=["cx","r","fill"],cs=Ae({__name:"GitGraphSvg",props:{rowData:{},maxLane:{default:4},highlightBranches:{},tooltipText:{}},setup(e){const n=e,{COLUMN_WIDTH:t,ROW_HEIGHT:a,NODE_RADIUS:s,PADDING:l}=yr,c=D(()=>l*2+(n.maxLane+1)*t),d=a,p=a/2;function f(g){return l+g*t}function _(g){const b=f(g.fromLane),w=f(g.toLane);if(g.type==="vertical")return`M ${b} 0 L ${w} ${d}`;if(g.type==="vertical-top")return`M ${b} 0 L ${b} ${p}`;if(g.type==="vertical-bottom")return`M ${b} ${p} L ${b} ${d}`;if(g.style==="rounded")return`M ${b} ${p} C ${b} ${d}, ${w} ${d}, ${w} ${d}`;{const M=d*.75;return`M ${b} ${p} L ${b} ${M} L ${w} ${d}`}}const S=D(()=>n.rowData?f(n.rowData.lane):l);return(g,b)=>(i(),u("svg",{width:o(c),height:o(d),class:"block flex-shrink-0","aria-hidden":"true"},[e.rowData?(i(),u(ge,{key:0},[(i(!0),u(ge,null,Ie(e.rowData.connections,(w,M)=>(i(),u("path",{key:M,d:_(w),stroke:w.color,"stroke-width":"2",fill:"none","stroke-dasharray":w.type.startsWith("merge")?"4 3":"none"},null,8,Ha))),128)),r("g",null,[e.tooltipText?(i(),u("title",Oa,C(e.tooltipText),1)):P("",!0),e.rowData.nodeType==="head"?(i(),u(ge,{key:1},[r("circle",{cx:o(S),cy:p,r:o(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,Ua),r("circle",{cx:o(S),cy:p,r:o(s),fill:e.rowData.color},null,8,ja)],64)):e.rowData.nodeType==="merge"?(i(),u(ge,{key:2},[r("circle",{cx:o(S),cy:p,r:o(s)+1,fill:"none",stroke:e.rowData.color,"stroke-width":"1.5"},null,8,za),r("circle",{cx:o(S),cy:p,r:o(s)-1,fill:e.rowData.color},null,8,Va)],64)):e.rowData.nodeType==="stash"?(i(),u(ge,{key:3},[r("circle",{cx:o(S),cy:p,r:o(s),fill:"none",stroke:e.rowData.color,"stroke-width":"2"},null,8,Wa),r("circle",{cx:o(S),cy:p,r:o(s)-2,fill:e.rowData.color},null,8,Ga)],64)):e.rowData.nodeType==="uncommitted"?(i(),u("circle",{key:4,cx:o(S),cy:p,r:o(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,qa)):(i(),u("circle",{key:5,cx:o(S),cy:p,r:o(s),fill:e.rowData.color},null,8,Ka))])],64)):P("",!0)],8,Fa))}}),Za=["aria-selected","aria-label"],Ya={key:1,class:"flex gap-1 flex-shrink-0"},Xa=["title","onContextmenu"],Qa={key:2,class:"flex gap-1 flex-shrink-0"},Ja=["onContextmenu"],ei={class:"text-retro-text text-xs truncate flex-1"},ti={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},ni={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},ri=Ae({__name:"GitCommitRow",props:{commit:{},index:{},isSelected:{type:Boolean},isHighlighted:{type:Boolean},isBranchHighlighted:{type:Boolean},isFeatureHighlighted:{type:Boolean},isPreviewHighlighted:{type:Boolean},isMuted:{type:Boolean},currentBranchName:{},localBranchNames:{},graphRowData:{},maxLane:{},columnVisibility:{}},emits:["click","keydown","branchContextMenu","commitContextMenu","tagContextMenu"],setup(e,{emit:n}){const t=e,a=n,s=D(()=>{const g=t.commit.branches;if(g.length===0)return[];const b=t.localBranchNames,w=[],M=[];for(const E of g)b.has(E)?w.push(E):M.push(E);const j=new Set(w),B=new Map,H=[];for(const E of M){const re=E.indexOf("/");if(re>0){const me=E.substring(re+1),fe=E.substring(0,re);j.has(me)?(B.has(me)||B.set(me,[]),B.get(me).push(fe)):H.push(E)}else H.push(E)}const O=[];for(const E of w){const re=B.get(E)||[];re.length>0?O.push({displayName:`${E}/${re.join(",")}`,originalBranches:[E,...re.map(me=>`${me}/${E}`)],isLocal:!0}):O.push({displayName:E,originalBranches:[E],isLocal:!0})}for(const E of H)O.push({displayName:E,originalBranches:[E],isLocal:!1});return O});function l(g,b){g.preventDefault(),g.stopPropagation();const w=b.originalBranches[0];a("branchContextMenu",{branch:w,x:g.clientX,y:g.clientY,isCurrentBranch:b.isLocal&&b.originalBranches.includes(t.currentBranchName??""),isLocal:b.isLocal})}function c(g,b){g.preventDefault(),g.stopPropagation(),a("tagContextMenu",{tag:b,x:g.clientX,y:g.clientY})}function d(g){g.preventDefault(),g.stopPropagation(),a("commitContextMenu",{x:g.clientX,y:g.clientY})}const{ROW_HEIGHT:p}=yr,f=D(()=>{const g=[t.commit.shortHash];return t.commit.branches.length>0&&g.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&g.push(t.commit.tags.map(b=>`tag: ${b}`).join(", ")),g.join(" — ")});function _(g){const w=Date.now()/1e3-g;return w<60?"just now":w<3600?`${Math.floor(w/60)}m ago`:w<86400?`${Math.floor(w/3600)}h ago`:w<604800?`${Math.floor(w/86400)}d ago`:w<2592e3?`${Math.floor(w/604800)}w ago`:new Date(g*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function S(g){const b=g.split(`
|
|
3
|
+
`)[0];return b.length>72?b.substring(0,69)+"...":b}return(g,b)=>{const w=cs;return i(),u("div",{class:we(["flex items-center cursor-pointer group focus:outline-none focus:ring-1 focus:ring-retro-cyan/50 focus:ring-inset",{"opacity-40":e.isMuted,"bg-retro-red/10":e.isPreviewHighlighted,"bg-retro-yellow/20":e.isFeatureHighlighted&&!e.isPreviewHighlighted}]),style:Bt({height:`${o(p)}px`}),role:"row",tabindex:"0","aria-selected":e.isSelected,"aria-label":`Commit ${e.commit.shortHash} by ${e.commit.author}: ${e.commit.message.split(`
|
|
4
|
+
`)[0]}`,onClick:b[0]||(b[0]=M=>a("click",M)),onKeydown:b[1]||(b[1]=M=>a("keydown",M)),onContextmenu:d},[q(w,{rowData:e.graphRowData,maxLane:e.maxLane,tooltipText:o(f)},null,8,["rowData","maxLane","tooltipText"]),r("div",{class:we(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-red/10 border-l-2 border-retro-red/40":e.isPreviewHighlighted,"bg-retro-yellow/30 border-l-2 border-retro-yellow":e.isFeatureHighlighted&&!e.isPreviewHighlighted,"bg-retro-cyan/15":e.isSelected&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted,"bg-retro-yellow/10":e.isHighlighted&&!e.isSelected&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted,"bg-retro-cyan/5":e.isBranchHighlighted&&!e.isSelected&&!e.isHighlighted&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted,"group-hover:bg-retro-panel/50":!e.isSelected&&!e.isHighlighted&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted&&!e.isBranchHighlighted}]),style:Bt({height:`${o(p)-4}px`})},[!e.columnVisibility||e.columnVisibility.commit!==!1?(i(),u("span",{key:0,class:we(["flex-shrink-0 font-mono text-[11px]",e.commit.isHead?"text-retro-cyan font-semibold":"text-retro-muted"])},C(e.commit.shortHash),3)):P("",!0),o(s).length>0?(i(),u("div",Ya,[(i(!0),u(ge,null,Ie(o(s),M=>(i(),u("span",{key:M.displayName,class:we(["px-1.5 py-0.5 text-[10px] rounded font-semibold leading-none cursor-context-menu hover:ring-1 hover:ring-retro-cyan/50",e.commit.isHead&&M.isLocal?"bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40":e.isPreviewHighlighted?"bg-retro-red/10 text-retro-red border border-retro-red/40":e.isFeatureHighlighted?"bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/30":e.isBranchHighlighted?"bg-retro-cyan/15 text-retro-cyan/80 border border-retro-cyan/30":M.isLocal?"bg-retro-green/15 text-retro-green border border-retro-green/30":"bg-retro-orange/15 text-retro-orange border border-retro-orange/30"]),title:M.originalBranches.join(", "),onContextmenu:j=>l(j,M)},C(M.displayName),43,Xa))),128))])):P("",!0),e.commit.tags.length>0?(i(),u("div",Qa,[(i(!0),u(ge,null,Ie(e.commit.tags,M=>(i(),u("span",{key:M,class:"px-1 py-0.5 text-[10px] rounded-sm bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/25 flex items-center gap-0.5 leading-none cursor-context-menu hover:ring-1 hover:ring-retro-yellow/50",onContextmenu:j=>c(j,M)},[q(o(to),{class:"w-2.5 h-2.5"}),Re(" "+C(M),1)],40,Ja))),128))])):P("",!0),r("span",ei,C(S(e.commit.message)),1),e.commit.signatureStatus==="good"?(i(),de(o(ls),{key:3,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-green",title:"Verified signature"})):e.commit.signatureStatus==="bad"?(i(),de(o(eo),{key:4,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-red",title:"Bad signature"})):P("",!0),!e.columnVisibility||e.columnVisibility.author!==!1?(i(),u("span",ti,C(e.commit.author),1)):P("",!0),!e.columnVisibility||e.columnVisibility.date!==!1?(i(),u("span",ni,C(_(e.commit.timestamp)),1)):P("",!0)],6)],46,Za)}}});function oi(){const{COLUMN_WIDTH:e,ROW_HEIGHT:n,NODE_RADIUS:t,PADDING:a}=yr;function s(p){let f=0;for(let _=0;_<p.length;_++){const S=p.charCodeAt(_);f=(f<<5)-f+S,f=f&f}return Math.abs(f)}function l(p){const f=s(p)%or.length;return or[f]}function c(p,f="rounded"){const _=new Map;if(p.length===0)return _;const S=new Set,g=new Map;for(const O of p)g.set(O.hash,O);const b=p.find(O=>O.isHead)||p[0];if(b){let O=b;for(;O;){S.add(O.hash);const E=O.parents?.[0];O=E?g.get(E):void 0}}const w=new Map,M=new Map,j=new Map,B=new Map,H=new Map;for(let O=0;O<p.length;O++){const E=p[O];H.set(E.hash,O);const re=S.has(E.hash);let me,fe;if(B.has(E.hash)){const G=B.get(E.hash);me=G.lane,fe=G.color,B.delete(E.hash)}else if(re)me=0,fe=or[0];else{for(me=1;j.has(me);)me++;fe=l(E.hash.substring(0,7))}w.set(E.hash,me),M.set(E.hash,fe),j.set(me,E.hash);const xe=E.isMerge||E.parents&&E.parents.length>1;let ke="regular";E.isHead?ke="head":xe&&(ke="merge"),_.set(E.hash,{commitHash:E.hash,lane:me,color:fe,nodeType:ke,isMainline:S.has(E.hash),connections:[]});const te=E.parents||[];for(let G=0;G<te.length;G++){const I=te[G];if(w.has(I)||B.has(I))continue;const W=S.has(I);let V,h;if(G===0)V=me,h=fe;else if(W)V=0,h=or[0];else{for(V=1;j.has(V)||V===me;)V++;h=l(I.substring(0,7))}B.set(I,{lane:V,color:h,childHash:E.hash})}const z=te[0];if(!z)j.delete(me);else{const G=w.get(z),I=B.get(z),W=G??I?.lane;W!==void 0&&W!==me&&j.delete(me)}}for(let O=0;O<p.length;O++){const E=p[O],re=_.get(E.hash);if(!re)continue;const me=E.parents||[];for(let fe=0;fe<me.length;fe++){const xe=me[fe],ke=w.get(xe),te=H.get(xe);if(ke===void 0)continue;const z=re.lane,G=ke,I=fe===0?re.color:M.get(xe)||l(xe.substring(0,7));if(z===G?re.connections.push({type:"vertical-bottom",fromLane:z,toLane:G,color:I,style:f}):fe>0?re.connections.push({type:z<G?"merge-out":"merge-in",fromLane:z,toLane:G,color:I,style:f}):re.connections.push({type:z<G?"branch-out":"branch-in",fromLane:z,toLane:G,color:I,style:f}),te!==void 0&&te>O+1)for(let W=O+1;W<te;W++){const V=p[W],h=_.get(V.hash);h&&h.connections.push({type:"vertical",fromLane:G,toLane:G,color:I,style:f})}if(te!==void 0){const W=_.get(xe);W&&W.connections.push({type:"vertical-top",fromLane:G,toLane:G,color:I,style:f})}}}return _}function d(p){let f=0;for(const _ of p.values()){_.lane>f&&(f=_.lane);for(const S of _.connections)S.fromLane>f&&(f=S.fromLane),S.toLane>f&&(f=S.toLane)}return f}return{computeGraphRows:c,computeMaxLane:d,getBranchColor:l,COLUMN_WIDTH:e,ROW_HEIGHT:n,NODE_RADIUS:t,PADDING:a}}const si=["aria-selected"],ai={class:"text-retro-yellow text-xs font-medium"},ii={key:1,class:"flex items-center justify-center gap-2 p-2 text-retro-muted text-sm"},li={key:2,class:"p-2 text-center text-retro-muted/50 text-xs"},ci=Ae({__name:"GitCommitList",props:{commits:{},stashes:{},selectedCommit:{},hasMore:{type:Boolean},loading:{type:Boolean},loadingMore:{type:Boolean},searchQuery:{},uncommittedChangesCount:{},isUncommittedChangesSelected:{type:Boolean},highlightBranches:{},featureHighlightBranches:{},featureMergeBases:{},previewHighlightBranches:{},previewMergeBases:{},currentBranchName:{},localBranchNames:{},graphStyle:{default:"rounded"},muteNonAncestral:{type:Boolean},columnVisibility:{}},emits:["select","compareSelect","loadMore","branchContextMenu","commitContextMenu","tagContextMenu","stashContextMenu","selectUncommittedChanges","scrollStart","scrollEnd"],setup(e,{expose:n,emit:t}){const a=e,s=t;function l(){s("selectUncommittedChanges")}function c(se){(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),s("selectUncommittedChanges"))}const d=D(()=>a.searchQuery?.toLowerCase()??""),p=D(()=>new Set(a.highlightBranches??[])),f=D(()=>p.value.size>0),_=D(()=>{const se=d.value;if(!se)return new Set;const Z=new Set;for(const Y of a.commits)(Y.message.toLowerCase().includes(se)||Y.author.toLowerCase().includes(se)||Y.shortHash.toLowerCase().includes(se)||Y.hash.toLowerCase().includes(se)||Y.branches.some(oe=>oe.toLowerCase().includes(se))||Y.tags.some(oe=>oe.toLowerCase().includes(se)))&&Z.add(Y.hash);return Z}),S=D(()=>{if(!f.value)return new Set;const se=new Set;for(const Z of a.commits)Z.branches.some(Y=>p.value.has(Y))&&se.add(Z.hash);return se}),g=D(()=>{if(!a.featureHighlightBranches||a.featureHighlightBranches.length===0)return new Set;const se=a.featureMergeBases??{},Z=new Map;for(const oe of a.commits)Z.set(oe.hash,oe);const Y=new Set;for(const oe of a.featureHighlightBranches){const ee=a.commits.find(Me=>Me.branches.includes(oe));if(!ee)continue;const ae=se[oe]??null;if(!ae)continue;let le=ee;for(;le&&le.hash!==ae;)Y.add(le.hash),le=le.parents?.[0]?Z.get(le.parents[0]):void 0}return Y}),b=D(()=>{if(!a.previewHighlightBranches||a.previewHighlightBranches.length===0)return new Set;const se=a.previewMergeBases??{},Z=new Map;for(const oe of a.commits)Z.set(oe.hash,oe);const Y=new Set;for(const oe of a.previewHighlightBranches){const ee=a.commits.find(Me=>Me.branches.includes(oe));if(!ee)continue;const ae=se[oe]??null;if(!ae)continue;let le=ee;for(;le&&le.hash!==ae;)Y.add(le.hash),le=le.parents?.[0]?Z.get(le.parents[0]):void 0}return Y});function w(se,Z){s("branchContextMenu",{...Z,commitHash:se.hash})}function M(se,Z){s("commitContextMenu",{commit:se,...Z})}function j(se,Z){s("tagContextMenu",{...Z,commitHash:se.hash})}const{ROW_HEIGHT:B,VISIBLE_BUFFER:H}=yr,{computeGraphRows:O,computeMaxLane:E}=oi(),re=D(()=>O([...a.commits],a.graphStyle)),me=D(()=>E(re.value)),fe=D(()=>{const se=a.stashes||[];if(se.length===0)return a.commits.map((ee,ae)=>({type:"commit",commit:ee,commitIndex:ae}));const Z=[],Y=[...se].sort((ee,ae)=>new Date(ae.date).getTime()-new Date(ee.date).getTime());let oe=0;for(let ee=0;ee<a.commits.length;ee++){const ae=a.commits[ee],le=ae.timestamp*1e3;for(;oe<Y.length&&new Date(Y[oe].date).getTime()>=le;)Z.push({type:"stash",stash:Y[oe]}),oe++;Z.push({type:"commit",commit:ae,commitIndex:ee})}for(;oe<Y.length;)Z.push({type:"stash",stash:Y[oe]}),oe++;return Z}),xe=$(null),ke=$(0),te=$(400);let z=null;const G=D(()=>{const se=H,Z=fe.value.length,Y=Math.max(0,Math.floor(ke.value/B)-se),oe=Math.min(Z,Math.ceil((ke.value+te.value)/B)+se);return{startIndex:Y,endIndex:oe}}),I=D(()=>{const{startIndex:se,endIndex:Z}=G.value;return fe.value.slice(se,Z).map((Y,oe)=>({row:Y,index:se+oe,graphRow:Y.type==="commit"&&re.value.get(Y.commit.hash)||null,isHighlighted:Y.type==="commit"?_.value.has(Y.commit.hash):!1,isBranchHighlighted:Y.type==="commit"?S.value.has(Y.commit.hash):!1,isFeatureHighlighted:Y.type==="commit"?g.value.has(Y.commit.hash):!1,isPreviewHighlighted:Y.type==="commit"?b.value.has(Y.commit.hash):!1,isMuted:Y.type==="commit"&&a.muteNonAncestral?!(re.value.get(Y.commit.hash)?.isMainline??!1):!1}))}),W=D(()=>fe.value.length*B),V=D(()=>G.value.startIndex*B);function h(se){const Z=se.target;ke.value=Z.scrollTop,z||s("scrollStart"),z&&clearTimeout(z),z=setTimeout(()=>{z=null,s("scrollEnd")},150),a.hasMore&&!a.loading&&!a.loadingMore&&Z.scrollTop+Z.clientHeight>=Z.scrollHeight-200&&s("loadMore")}function m(se,Z){Z.ctrlKey||Z.metaKey?s("compareSelect",se):s("select",se)}function y(se,Z,Y){if(se.key==="Enter"||se.key===" ")se.preventDefault(),s("select",Z);else if(se.key==="ArrowDown"){se.preventDefault();for(let oe=Y+1;oe<fe.value.length;oe++){const ee=fe.value[oe];if(ee.type==="commit"){s("select",ee.commit),F(oe);break}}}else if(se.key==="ArrowUp"){se.preventDefault();for(let oe=Y-1;oe>=0;oe--){const ee=fe.value[oe];if(ee.type==="commit"){s("select",ee.commit),F(oe);break}}}}function F(se){if(!xe.value)return;const Z=se*B,Y=xe.value.scrollTop,oe=Y+xe.value.clientHeight;Z<Y?xe.value.scrollTop=Z:Z+B>oe&&(xe.value.scrollTop=Z+B-xe.value.clientHeight)}xt(()=>{if(xe.value){te.value=xe.value.clientHeight;const se=new ResizeObserver(Z=>{for(const Y of Z)te.value=Y.contentRect.height});se.observe(xe.value),kt(()=>se.disconnect())}});function J(){return xe.value?.scrollTop??0}function X(se){xe.value&&(xe.value.scrollTop=se)}return n({getScrollPosition:J,setScrollPosition:X,scrollToIndex:F}),(se,Z)=>{const Y=cs,oe=ri;return i(),u("div",{ref_key:"containerRef",ref:xe,class:"h-full overflow-auto",role:"list","aria-label":"Commit history",onScroll:h},[e.uncommittedChangesCount&&e.uncommittedChangesCount>0?(i(),u("div",{key:0,class:"flex items-center cursor-pointer group sticky top-0 z-10 bg-retro-dark border-b border-retro-border",style:Bt({height:`${o(B)}px`}),role:"button",tabindex:"0","aria-selected":e.isUncommittedChangesSelected,onClick:l,onKeydown:c},[q(Y,{rowData:{commitHash:"uncommitted",lane:0,color:"#F59E0B",nodeType:"uncommitted",isMainline:!1,connections:[]},maxLane:o(me)},null,8,["maxLane"]),r("div",{class:we(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-yellow/15":e.isUncommittedChangesSelected,"group-hover:bg-retro-panel/50":!e.isUncommittedChangesSelected}]),style:Bt({height:`${o(B)-4}px`})},[q(o(On),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("span",ai," Uncommitted Changes ("+C(e.uncommittedChangesCount)+") ",1),Z[1]||(Z[1]=r("span",{class:"flex-1"},null,-1)),Z[2]||(Z[2]=r("span",{class:"text-retro-muted text-[10px]"},"Working tree",-1))],6)],44,si)):P("",!0),r("div",{class:"relative",style:Bt({height:`${o(W)}px`})},[r("div",{class:"absolute left-0 right-0",style:Bt({transform:`translateY(${o(V)}px)`})},[(i(!0),u(ge,null,Ie(o(I),({row:ee,index:ae,graphRow:le,isHighlighted:Me,isBranchHighlighted:ze,isFeatureHighlighted:Je,isPreviewHighlighted:he,isMuted:ne})=>(i(),u(ge,{key:ee.type==="commit"?ee.commit.hash:`stash-${ee.stash.index}`},[ee.type==="commit"?zo([ee.commit.hash,ee.commit.message,ee.commit.timestamp,ee.commit.branches.join("|"),ee.commit.tags.join("|"),e.selectedCommit?.hash===ee.commit.hash,Me,ze,Je,he,ne,a.currentBranchName||"",a.columnVisibility?.date!==!1,a.columnVisibility?.author!==!1,a.columnVisibility?.commit!==!1],()=>(i(),de(oe,{key:0,commit:ee.commit,index:ee.commitIndex,isSelected:e.selectedCommit?.hash===ee.commit.hash,isHighlighted:Me,isBranchHighlighted:ze,isFeatureHighlighted:Je,isPreviewHighlighted:he,isMuted:ne,currentBranchName:a.currentBranchName,localBranchNames:a.localBranchNames,graphRowData:le,maxLane:o(me),columnVisibility:a.columnVisibility,onClick:Ce=>m(ee.commit,Ce),onKeydown:Ce=>y(Ce,ee.commit,ae),onBranchContextMenu:Ce=>w(ee.commit,Ce),onCommitContextMenu:Ce=>M(ee.commit,Ce),onTagContextMenu:Ce=>j(ee.commit,Ce)},null,8,["commit","index","isSelected","isHighlighted","isBranchHighlighted","isFeatureHighlighted","isPreviewHighlighted","isMuted","currentBranchName","localBranchNames","graphRowData","maxLane","columnVisibility","onClick","onKeydown","onBranchContextMenu","onCommitContextMenu","onTagContextMenu"])),Z,0):P("",!0)],64))),128))],4)],4),(e.loading||e.loadingMore)&&e.commits.length>0?(i(),u("div",ii,[...Z[3]||(Z[3]=[r("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Re(" Loading more commits... ",-1)])])):P("",!0),!e.hasMore&&e.commits.length>0&&!e.loading?(i(),u("div",li,C(e.commits.length)+" commits loaded ",1)):P("",!0)],544)}}});function ui(e){const n=e.charAt(0).toUpperCase();return n in Fn?n:"M"}function sr(e,n){if(e&&typeof e=="object"){const t=e;if(typeof t.data?.message=="string"&&t.data.message.trim())return t.data.message;if(typeof t.statusMessage=="string"&&t.statusMessage.trim())return t.statusMessage;if(typeof t.message=="string"&&t.message.trim())return t.message}return e instanceof Error&&e.message?e.message:n}function Co(e,n){const t=n.trim().toLowerCase();return t?e.filter(a=>a.message.toLowerCase().includes(t)||a.author.toLowerCase().includes(t)||a.shortHash.includes(t)||a.hash.includes(t)||a.branches.some(s=>s.toLowerCase().includes(t))||a.tags.some(s=>s.toLowerCase().includes(t))):[...e]}function di(e,n){return n.size===0?[...e]:e.filter(t=>t.branches.some(a=>n.has(a)))}const fi={class:"flex flex-col h-full border-t border-retro-border bg-retro-dark"},mi={class:"flex items-center justify-between p-2 border-b border-retro-border flex-shrink-0"},hi={class:"flex items-center gap-2 text-xs min-w-0"},pi={class:"font-mono text-retro-cyan"},vi={class:"font-mono text-retro-cyan"},gi={key:0,class:"px-3 py-1.5 text-xs text-retro-muted border-b border-retro-border flex-shrink-0"},xi={class:"text-retro-green"},bi={class:"text-retro-red"},yi={key:1,class:"flex-1 flex items-center justify-center"},wi={key:2,class:"flex-1 overflow-auto"},ki={class:"text-retro-text truncate flex-1"},Ci={class:"text-retro-muted"},$i={key:0,class:"flex-shrink-0 text-[10px] font-mono"},Si={key:0,class:"text-retro-green"},_i={key:1,class:"text-retro-red ml-1"},Ti={key:1,class:"flex-shrink-0 text-[10px] text-retro-muted italic"},Mi={key:3,class:"flex-1 flex items-center justify-center text-retro-muted text-sm"},Ai=Ae({__name:"GitComparisonView",props:{fromCommit:{},toCommit:{},files:{},stats:{},loading:{type:Boolean}},emits:["close"],setup(e,{emit:n}){const t=n;function a(s){const l=ui(s);return Fn[l]||Fn.M}return(s,l)=>(i(),u("div",fi,[r("div",mi,[r("div",hi,[l[1]||(l[1]=r("span",{class:"text-retro-muted"},"Comparing",-1)),r("span",pi,C(e.fromCommit.shortHash),1),l[2]||(l[2]=r("span",{class:"text-retro-muted"},"→",-1)),r("span",vi,C(e.toCommit.shortHash),1)]),r("button",{class:"p-1 text-retro-muted hover:text-retro-text transition-colors flex-shrink-0","aria-label":"Close comparison",onClick:l[0]||(l[0]=c=>t("close"))},[q(o($t),{class:"w-4 h-4"})])]),e.stats?(i(),u("div",gi,[Re(C(e.stats.filesChanged)+" file"+C(e.stats.filesChanged!==1?"s":"")+" changed, ",1),r("span",xi,"+"+C(e.stats.additions),1),r("span",bi," -"+C(e.stats.deletions),1)])):P("",!0),e.loading?(i(),u("div",yi,[...l[3]||(l[3]=[r("div",{class:"flex items-center gap-2 text-retro-muted text-sm"},[r("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"}),Re(" Loading comparison... ")],-1)])])):e.files&&e.files.length>0?(i(),u("div",wi,[(i(!0),u(ge,null,Ie(e.files,c=>(i(),u("div",{key:c.path,class:"flex items-center gap-2 px-3 py-1.5 hover:bg-retro-panel/50 text-xs border-b border-retro-border/50"},[r("span",{class:we(["flex-shrink-0 w-4 text-center font-semibold text-[10px]",a(c.status).colorClass])},C(c.status.charAt(0)),3),r("span",ki,[c.oldPath&&c.status.startsWith("R")?(i(),u(ge,{key:0},[r("span",Ci,C(c.oldPath),1),l[4]||(l[4]=r("span",{class:"text-retro-muted mx-1"},"→",-1))],64)):P("",!0),Re(" "+C(c.path),1)]),c.binary?(i(),u("span",Ti,"binary")):(i(),u("span",$i,[c.additions>0?(i(),u("span",Si,"+"+C(c.additions),1)):P("",!0),c.deletions>0?(i(),u("span",_i,"-"+C(c.deletions),1)):P("",!0)]))]))),128))])):e.files&&e.files.length===0?(i(),u("div",Mi," No differences between these commits ")):P("",!0)]))}});function no(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var En=no();function us(e){En=e}var Xn={exec:()=>null};function Xe(e,n=""){let t=typeof e=="string"?e:e.source;const a={replace:(s,l)=>{let c=typeof l=="string"?l:l.source;return c=c.replace(Et.caret,"$1"),t=t.replace(s,c),a},getRegex:()=>new RegExp(t,n)};return a}var Et={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Bi=/^(?:[ \t]*(?:\n|$))+/,Ei=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ri=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Jn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Pi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ro=/(?:[*+-]|\d{1,9}[.)])/,ds=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,fs=Xe(ds).replace(/bull/g,ro).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Di=Xe(ds).replace(/bull/g,ro).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),oo=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ii=/^[^\n]+/,so=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Li=Xe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",so).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ni=Xe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ro).getRegex(),wr="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ao=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Fi=Xe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ao).replace("tag",wr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ms=Xe(oo).replace("hr",Jn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",wr).getRegex(),Hi=Xe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ms).getRegex(),io={blockquote:Hi,code:Ei,def:Li,fences:Ri,heading:Pi,hr:Jn,html:Fi,lheading:fs,list:Ni,newline:Bi,paragraph:ms,table:Xn,text:Ii},$o=Xe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Jn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",wr).getRegex(),Oi={...io,lheading:Di,table:$o,paragraph:Xe(oo).replace("hr",Jn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",$o).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",wr).getRegex()},Ui={...io,html:Xe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ao).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Xn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Xe(oo).replace("hr",Jn).replace("heading",` *#{1,6} *[^
|
|
5
|
+
]`).replace("lheading",fs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ji=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,zi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,hs=/^( {2,}|\\)\n(?!\s*$)/,Vi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,kr=/[\p{P}\p{S}]/u,lo=/[\s\p{P}\p{S}]/u,ps=/[^\s\p{P}\p{S}]/u,Wi=Xe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,lo).getRegex(),vs=/(?!~)[\p{P}\p{S}]/u,Gi=/(?!~)[\s\p{P}\p{S}]/u,qi=/(?:[^\s\p{P}\p{S}]|~)/u,Ki=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,gs=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Zi=Xe(gs,"u").replace(/punct/g,kr).getRegex(),Yi=Xe(gs,"u").replace(/punct/g,vs).getRegex(),xs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Xi=Xe(xs,"gu").replace(/notPunctSpace/g,ps).replace(/punctSpace/g,lo).replace(/punct/g,kr).getRegex(),Qi=Xe(xs,"gu").replace(/notPunctSpace/g,qi).replace(/punctSpace/g,Gi).replace(/punct/g,vs).getRegex(),Ji=Xe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ps).replace(/punctSpace/g,lo).replace(/punct/g,kr).getRegex(),el=Xe(/\\(punct)/,"gu").replace(/punct/g,kr).getRegex(),tl=Xe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),nl=Xe(ao).replace("(?:-->|$)","-->").getRegex(),rl=Xe("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",nl).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),mr=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ol=Xe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",mr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bs=Xe(/^!?\[(label)\]\[(ref)\]/).replace("label",mr).replace("ref",so).getRegex(),ys=Xe(/^!?\[(ref)\](?:\[\])?/).replace("ref",so).getRegex(),sl=Xe("reflink|nolink(?!\\()","g").replace("reflink",bs).replace("nolink",ys).getRegex(),co={_backpedal:Xn,anyPunctuation:el,autolink:tl,blockSkip:Ki,br:hs,code:zi,del:Xn,emStrongLDelim:Zi,emStrongRDelimAst:Xi,emStrongRDelimUnd:Ji,escape:ji,link:ol,nolink:ys,punctuation:Wi,reflink:bs,reflinkSearch:sl,tag:rl,text:Vi,url:Xn},al={...co,link:Xe(/^!?\[(label)\]\((.*?)\)/).replace("label",mr).getRegex(),reflink:Xe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",mr).getRegex()},Or={...co,emStrongRDelimAst:Qi,emStrongLDelim:Yi,url:Xe(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},il={...Or,br:Xe(hs).replace("{2,}","*").getRegex(),text:Xe(Or.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ar={normal:io,gfm:Oi,pedantic:Ui},Vn={normal:co,gfm:Or,breaks:il,pedantic:al},ll={"&":"&","<":"<",">":">",'"':""","'":"'"},So=e=>ll[e];function on(e,n){if(n){if(Et.escapeTest.test(e))return e.replace(Et.escapeReplace,So)}else if(Et.escapeTestNoEncode.test(e))return e.replace(Et.escapeReplaceNoEncode,So);return e}function _o(e){try{e=encodeURI(e).replace(Et.percentDecode,"%")}catch{return null}return e}function To(e,n){const t=e.replace(Et.findPipe,(l,c,d)=>{let p=!1,f=c;for(;--f>=0&&d[f]==="\\";)p=!p;return p?"|":" |"}),a=t.split(Et.splitPipe);let s=0;if(a[0].trim()||a.shift(),a.length>0&&!a.at(-1)?.trim()&&a.pop(),n)if(a.length>n)a.splice(n);else for(;a.length<n;)a.push("");for(;s<a.length;s++)a[s]=a[s].trim().replace(Et.slashPipe,"|");return a}function Wn(e,n,t){const a=e.length;if(a===0)return"";let s=0;for(;s<a&&e.charAt(a-s-1)===n;)s++;return e.slice(0,a-s)}function cl(e,n){if(e.indexOf(n[1])===-1)return-1;let t=0;for(let a=0;a<e.length;a++)if(e[a]==="\\")a++;else if(e[a]===n[0])t++;else if(e[a]===n[1]&&(t--,t<0))return a;return t>0?-2:-1}function Mo(e,n,t,a,s){const l=n.href,c=n.title||null,d=e[1].replace(s.other.outputLinkReplace,"$1");a.state.inLink=!0;const p={type:e[0].charAt(0)==="!"?"image":"link",raw:t,href:l,title:c,text:d,tokens:a.inlineTokens(d)};return a.state.inLink=!1,p}function ul(e,n,t){const a=e.match(t.other.indentCodeCompensation);if(a===null)return n;const s=a[1];return n.split(`
|
|
6
|
+
`).map(l=>{const c=l.match(t.other.beginningSpace);if(c===null)return l;const[d]=c;return d.length>=s.length?l.slice(s.length):l}).join(`
|
|
7
|
+
`)}var hr=class{options;rules;lexer;constructor(e){this.options=e||En}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const t=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Wn(t,`
|
|
8
|
+
`)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const t=n[0],a=ul(t,n[3]||"",this.rules);return{type:"code",raw:t,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:a}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let t=n[2].trim();if(this.rules.other.endingHash.test(t)){const a=Wn(t,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(t=a.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:Wn(n[0],`
|
|
9
|
+
`)}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let t=Wn(n[0],`
|
|
10
|
+
`).split(`
|
|
11
|
+
`),a="",s="";const l=[];for(;t.length>0;){let c=!1;const d=[];let p;for(p=0;p<t.length;p++)if(this.rules.other.blockquoteStart.test(t[p]))d.push(t[p]),c=!0;else if(!c)d.push(t[p]);else break;t=t.slice(p);const f=d.join(`
|
|
12
|
+
`),_=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
13
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
|
|
14
|
+
${f}`:f,s=s?`${s}
|
|
15
|
+
${_}`:_;const S=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(_,l,!0),this.lexer.state.top=S,t.length===0)break;const g=l.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){const b=g,w=b.raw+`
|
|
16
|
+
`+t.join(`
|
|
17
|
+
`),M=this.blockquote(w);l[l.length-1]=M,a=a.substring(0,a.length-b.raw.length)+M.raw,s=s.substring(0,s.length-b.text.length)+M.text;break}else if(g?.type==="list"){const b=g,w=b.raw+`
|
|
18
|
+
`+t.join(`
|
|
19
|
+
`),M=this.list(w);l[l.length-1]=M,a=a.substring(0,a.length-g.raw.length)+M.raw,s=s.substring(0,s.length-b.raw.length)+M.raw,t=w.substring(l.at(-1).raw.length).split(`
|
|
20
|
+
`);continue}}return{type:"blockquote",raw:a,tokens:l,text:s}}}list(e){let n=this.rules.block.list.exec(e);if(n){let t=n[1].trim();const a=t.length>1,s={type:"list",raw:"",ordered:a,start:a?+t.slice(0,-1):"",loose:!1,items:[]};t=a?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=a?t:"[*+-]");const l=this.rules.other.listItemRegex(t);let c=!1;for(;e;){let p=!1,f="",_="";if(!(n=l.exec(e))||this.rules.block.hr.test(e))break;f=n[0],e=e.substring(f.length);let S=n[2].split(`
|
|
21
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,B=>" ".repeat(3*B.length)),g=e.split(`
|
|
22
|
+
`,1)[0],b=!S.trim(),w=0;if(this.options.pedantic?(w=2,_=S.trimStart()):b?w=n[1].length+1:(w=n[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,_=S.slice(w),w+=n[1].length),b&&this.rules.other.blankLine.test(g)&&(f+=g+`
|
|
23
|
+
`,e=e.substring(g.length+1),p=!0),!p){const B=this.rules.other.nextBulletRegex(w),H=this.rules.other.hrRegex(w),O=this.rules.other.fencesBeginRegex(w),E=this.rules.other.headingBeginRegex(w),re=this.rules.other.htmlBeginRegex(w);for(;e;){const me=e.split(`
|
|
24
|
+
`,1)[0];let fe;if(g=me,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),fe=g):fe=g.replace(this.rules.other.tabCharGlobal," "),O.test(g)||E.test(g)||re.test(g)||B.test(g)||H.test(g))break;if(fe.search(this.rules.other.nonSpaceChar)>=w||!g.trim())_+=`
|
|
25
|
+
`+fe.slice(w);else{if(b||S.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||O.test(S)||E.test(S)||H.test(S))break;_+=`
|
|
26
|
+
`+g}!b&&!g.trim()&&(b=!0),f+=me+`
|
|
27
|
+
`,e=e.substring(me.length+1),S=fe.slice(w)}}s.loose||(c?s.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(c=!0));let M=null,j;this.options.gfm&&(M=this.rules.other.listIsTask.exec(_),M&&(j=M[0]!=="[ ] ",_=_.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:f,task:!!M,checked:j,loose:!1,text:_,tokens:[]}),s.raw+=f}const d=s.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let p=0;p<s.items.length;p++)if(this.lexer.state.top=!1,s.items[p].tokens=this.lexer.blockTokens(s.items[p].text,[]),!s.loose){const f=s.items[p].tokens.filter(S=>S.type==="space"),_=f.length>0&&f.some(S=>this.rules.other.anyLine.test(S.raw));s.loose=_}if(s.loose)for(let p=0;p<s.items.length;p++)s.items[p].loose=!0;return s}}html(e){const n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(e){const n=this.rules.block.def.exec(e);if(n){const t=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:t,raw:n[0],href:a,title:s}}}table(e){const n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;const t=To(n[1]),a=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=n[3]?.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
28
|
+
`):[],l={type:"table",raw:n[0],header:[],align:[],rows:[]};if(t.length===a.length){for(const c of a)this.rules.other.tableAlignRight.test(c)?l.align.push("right"):this.rules.other.tableAlignCenter.test(c)?l.align.push("center"):this.rules.other.tableAlignLeft.test(c)?l.align.push("left"):l.align.push(null);for(let c=0;c<t.length;c++)l.header.push({text:t[c],tokens:this.lexer.inline(t[c]),header:!0,align:l.align[c]});for(const c of s)l.rows.push(To(c,l.header.length).map((d,p)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:l.align[p]})));return l}}lheading(e){const n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){const n=this.rules.block.paragraph.exec(e);if(n){const t=n[1].charAt(n[1].length-1)===`
|
|
29
|
+
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:t,tokens:this.lexer.inline(t)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){const n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const t=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const l=Wn(t.slice(0,-1),"\\");if((t.length-l.length)%2===0)return}else{const l=cl(n[2],"()");if(l===-2)return;if(l>-1){const d=(n[0].indexOf("!")===0?5:4)+n[1].length+l;n[2]=n[2].substring(0,l),n[0]=n[0].substring(0,d).trim(),n[3]=""}}let a=n[2],s="";if(this.options.pedantic){const l=this.rules.other.pedanticHrefTitle.exec(a);l&&(a=l[1],s=l[3])}else s=n[3]?n[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?a=a.slice(1):a=a.slice(1,-1)),Mo(n,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let t;if((t=this.rules.inline.reflink.exec(e))||(t=this.rules.inline.nolink.exec(e))){const a=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=n[a.toLowerCase()];if(!s){const l=t[0].charAt(0);return{type:"text",raw:l,text:l}}return Mo(t,s,t[0],this.lexer,this.rules)}}emStrong(e,n,t=""){let a=this.rules.inline.emStrongLDelim.exec(e);if(!a||a[3]&&t.match(this.rules.other.unicodeAlphaNumeric))return;if(!(a[1]||a[2]||"")||!t||this.rules.inline.punctuation.exec(t)){const l=[...a[0]].length-1;let c,d,p=l,f=0;const _=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(_.lastIndex=0,n=n.slice(-1*e.length+l);(a=_.exec(n))!=null;){if(c=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!c)continue;if(d=[...c].length,a[3]||a[4]){p+=d;continue}else if((a[5]||a[6])&&l%3&&!((l+d)%3)){f+=d;continue}if(p-=d,p>0)continue;d=Math.min(d,d+p+f);const S=[...a[0]][0].length,g=e.slice(0,l+a.index+S+d);if(Math.min(l,d)%2){const w=g.slice(1,-1);return{type:"em",raw:g,text:w,tokens:this.lexer.inlineTokens(w)}}const b=g.slice(2,-2);return{type:"strong",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let t=n[2].replace(this.rules.other.newLineCharGlobal," ");const a=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return a&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:n[0],text:t}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){const n=this.rules.inline.autolink.exec(e);if(n){let t,a;return n[2]==="@"?(t=n[1],a="mailto:"+t):(t=n[1],a=t),{type:"link",raw:n[0],text:t,href:a,tokens:[{type:"text",raw:t,text:t}]}}}url(e){let n;if(n=this.rules.inline.url.exec(e)){let t,a;if(n[2]==="@")t=n[0],a="mailto:"+t;else{let s;do s=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(s!==n[0]);t=n[0],n[1]==="www."?a="http://"+n[0]:a=n[0]}return{type:"link",raw:n[0],text:t,href:a,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){const t=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:t}}}},dn=class Ur{tokens;options;state;tokenizer;inlineQueue;constructor(n){this.tokens=[],this.tokens.links=Object.create(null),this.options=n||En,this.options.tokenizer=this.options.tokenizer||new hr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:Et,block:ar.normal,inline:Vn.normal};this.options.pedantic?(t.block=ar.pedantic,t.inline=Vn.pedantic):this.options.gfm&&(t.block=ar.gfm,this.options.breaks?t.inline=Vn.breaks:t.inline=Vn.gfm),this.tokenizer.rules=t}static get rules(){return{block:ar,inline:Vn}}static lex(n,t){return new Ur(t).lex(n)}static lexInline(n,t){return new Ur(t).inlineTokens(n)}lex(n){n=n.replace(Et.carriageReturn,`
|
|
30
|
+
`),this.blockTokens(n,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const a=this.inlineQueue[t];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,t=[],a=!1){for(this.options.pedantic&&(n=n.replace(Et.tabCharGlobal," ").replace(Et.spaceLine,""));n;){let s;if(this.options.extensions?.block?.some(c=>(s=c.call({lexer:this},n,t))?(n=n.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(n)){n=n.substring(s.raw.length);const c=t.at(-1);s.raw.length===1&&c!==void 0?c.raw+=`
|
|
31
|
+
`:t.push(s);continue}if(s=this.tokenizer.code(n)){n=n.substring(s.raw.length);const c=t.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=`
|
|
32
|
+
`+s.raw,c.text+=`
|
|
33
|
+
`+s.text,this.inlineQueue.at(-1).src=c.text):t.push(s);continue}if(s=this.tokenizer.fences(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(n)){n=n.substring(s.raw.length);const c=t.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=`
|
|
34
|
+
`+s.raw,c.text+=`
|
|
35
|
+
`+s.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(n)){n=n.substring(s.raw.length),t.push(s);continue}let l=n;if(this.options.extensions?.startBlock){let c=1/0;const d=n.slice(1);let p;this.options.extensions.startBlock.forEach(f=>{p=f.call({lexer:this},d),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(l=n.substring(0,c+1))}if(this.state.top&&(s=this.tokenizer.paragraph(l))){const c=t.at(-1);a&&c?.type==="paragraph"?(c.raw+=`
|
|
36
|
+
`+s.raw,c.text+=`
|
|
37
|
+
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(s),a=l.length!==n.length,n=n.substring(s.raw.length);continue}if(s=this.tokenizer.text(n)){n=n.substring(s.raw.length);const c=t.at(-1);c?.type==="text"?(c.raw+=`
|
|
38
|
+
`+s.raw,c.text+=`
|
|
39
|
+
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(s);continue}if(n){const c="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,t}inline(n,t=[]){return this.inlineQueue.push({src:n,tokens:t}),t}inlineTokens(n,t=[]){let a=n,s=null;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)d.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,s.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let l=!1,c="";for(;n;){l||(c=""),l=!1;let d;if(this.options.extensions?.inline?.some(f=>(d=f.call({lexer:this},n,t))?(n=n.substring(d.raw.length),t.push(d),!0):!1))continue;if(d=this.tokenizer.escape(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.tag(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.link(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(d.raw.length);const f=t.at(-1);d.type==="text"&&f?.type==="text"?(f.raw+=d.raw,f.text+=d.text):t.push(d);continue}if(d=this.tokenizer.emStrong(n,a,c)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.codespan(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.br(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.del(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.autolink(n)){n=n.substring(d.raw.length),t.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(n))){n=n.substring(d.raw.length),t.push(d);continue}let p=n;if(this.options.extensions?.startInline){let f=1/0;const _=n.slice(1);let S;this.options.extensions.startInline.forEach(g=>{S=g.call({lexer:this},_),typeof S=="number"&&S>=0&&(f=Math.min(f,S))}),f<1/0&&f>=0&&(p=n.substring(0,f+1))}if(d=this.tokenizer.inlineText(p)){n=n.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(c=d.raw.slice(-1)),l=!0;const f=t.at(-1);f?.type==="text"?(f.raw+=d.raw,f.text+=d.text):t.push(d);continue}if(n){const f="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return t}},pr=class{options;parser;constructor(e){this.options=e||En}space(e){return""}code({text:e,lang:n,escaped:t}){const a=(n||"").match(Et.notSpaceStart)?.[0],s=e.replace(Et.endingNewline,"")+`
|
|
40
|
+
`;return a?'<pre><code class="language-'+on(a)+'">'+(t?s:on(s,!0))+`</code></pre>
|
|
41
|
+
`:"<pre><code>"+(t?s:on(s,!0))+`</code></pre>
|
|
42
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
43
|
+
${this.parser.parse(e)}</blockquote>
|
|
44
|
+
`}html({text:e}){return e}heading({tokens:e,depth:n}){return`<h${n}>${this.parser.parseInline(e)}</h${n}>
|
|
45
|
+
`}hr(e){return`<hr>
|
|
46
|
+
`}list(e){const n=e.ordered,t=e.start;let a="";for(let c=0;c<e.items.length;c++){const d=e.items[c];a+=this.listitem(d)}const s=n?"ol":"ul",l=n&&t!==1?' start="'+t+'"':"";return"<"+s+l+`>
|
|
47
|
+
`+a+"</"+s+`>
|
|
48
|
+
`}listitem(e){let n="";if(e.task){const t=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=t+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=t+" "+on(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:t+" ",text:t+" ",escaped:!0}):n+=t+" "}return n+=this.parser.parse(e.tokens,!!e.loose),`<li>${n}</li>
|
|
49
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
50
|
+
`}table(e){let n="",t="";for(let s=0;s<e.header.length;s++)t+=this.tablecell(e.header[s]);n+=this.tablerow({text:t});let a="";for(let s=0;s<e.rows.length;s++){const l=e.rows[s];t="";for(let c=0;c<l.length;c++)t+=this.tablecell(l[c]);a+=this.tablerow({text:t})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
|
|
51
|
+
<thead>
|
|
52
|
+
`+n+`</thead>
|
|
53
|
+
`+a+`</table>
|
|
54
|
+
`}tablerow({text:e}){return`<tr>
|
|
55
|
+
${e}</tr>
|
|
56
|
+
`}tablecell(e){const n=this.parser.parseInline(e.tokens),t=e.header?"th":"td";return(e.align?`<${t} align="${e.align}">`:`<${t}>`)+n+`</${t}>
|
|
57
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${on(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:t}){const a=this.parser.parseInline(t),s=_o(e);if(s===null)return a;e=s;let l='<a href="'+e+'"';return n&&(l+=' title="'+on(n)+'"'),l+=">"+a+"</a>",l}image({href:e,title:n,text:t,tokens:a}){a&&(t=this.parser.parseInline(a,this.parser.textRenderer));const s=_o(e);if(s===null)return on(t);e=s;let l=`<img src="${e}" alt="${t}"`;return n&&(l+=` title="${on(n)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:on(e.text)}},uo=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},fn=class jr{options;renderer;textRenderer;constructor(n){this.options=n||En,this.options.renderer=this.options.renderer||new pr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new uo}static parse(n,t){return new jr(t).parse(n)}static parseInline(n,t){return new jr(t).parseInline(n)}parse(n,t=!0){let a="";for(let s=0;s<n.length;s++){const l=n[s];if(this.options.extensions?.renderers?.[l.type]){const d=l,p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(d.type)){a+=p||"";continue}}const c=l;switch(c.type){case"space":{a+=this.renderer.space(c);continue}case"hr":{a+=this.renderer.hr(c);continue}case"heading":{a+=this.renderer.heading(c);continue}case"code":{a+=this.renderer.code(c);continue}case"table":{a+=this.renderer.table(c);continue}case"blockquote":{a+=this.renderer.blockquote(c);continue}case"list":{a+=this.renderer.list(c);continue}case"html":{a+=this.renderer.html(c);continue}case"paragraph":{a+=this.renderer.paragraph(c);continue}case"text":{let d=c,p=this.renderer.text(d);for(;s+1<n.length&&n[s+1].type==="text";)d=n[++s],p+=`
|
|
58
|
+
`+this.renderer.text(d);t?a+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):a+=p;continue}default:{const d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return a}parseInline(n,t=this.renderer){let a="";for(let s=0;s<n.length;s++){const l=n[s];if(this.options.extensions?.renderers?.[l.type]){const d=this.options.extensions.renderers[l.type].call({parser:this},l);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){a+=d||"";continue}}const c=l;switch(c.type){case"escape":{a+=t.text(c);break}case"html":{a+=t.html(c);break}case"link":{a+=t.link(c);break}case"image":{a+=t.image(c);break}case"strong":{a+=t.strong(c);break}case"em":{a+=t.em(c);break}case"codespan":{a+=t.codespan(c);break}case"br":{a+=t.br(c);break}case"del":{a+=t.del(c);break}case"text":{a+=t.text(c);break}default:{const d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return a}},ur=class{options;block;constructor(e){this.options=e||En}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?dn.lex:dn.lexInline}provideParser(){return this.block?fn.parse:fn.parseInline}},dl=class{defaults=no();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=fn;Renderer=pr;TextRenderer=uo;Lexer=dn;Tokenizer=hr;Hooks=ur;constructor(...e){this.use(...e)}walkTokens(e,n){let t=[];for(const a of e)switch(t=t.concat(n.call(this,a)),a.type){case"table":{const s=a;for(const l of s.header)t=t.concat(this.walkTokens(l.tokens,n));for(const l of s.rows)for(const c of l)t=t.concat(this.walkTokens(c.tokens,n));break}case"list":{const s=a;t=t.concat(this.walkTokens(s.items,n));break}default:{const s=a;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(l=>{const c=s[l].flat(1/0);t=t.concat(this.walkTokens(c,n))}):s.tokens&&(t=t.concat(this.walkTokens(s.tokens,n)))}}return t}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(t=>{const a={...t};if(a.async=this.defaults.async||a.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const l=n.renderers[s.name];l?n.renderers[s.name]=function(...c){let d=s.renderer.apply(this,c);return d===!1&&(d=l.apply(this,c)),d}:n.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=n[s.level];l?l.unshift(s.tokenizer):n[s.level]=[s.tokenizer],s.start&&(s.level==="block"?n.startBlock?n.startBlock.push(s.start):n.startBlock=[s.start]:s.level==="inline"&&(n.startInline?n.startInline.push(s.start):n.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(n.childTokens[s.name]=s.childTokens)}),a.extensions=n),t.renderer){const s=this.defaults.renderer||new pr(this.defaults);for(const l in t.renderer){if(!(l in s))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;const c=l,d=t.renderer[c],p=s[c];s[c]=(...f)=>{let _=d.apply(s,f);return _===!1&&(_=p.apply(s,f)),_||""}}a.renderer=s}if(t.tokenizer){const s=this.defaults.tokenizer||new hr(this.defaults);for(const l in t.tokenizer){if(!(l in s))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const c=l,d=t.tokenizer[c],p=s[c];s[c]=(...f)=>{let _=d.apply(s,f);return _===!1&&(_=p.apply(s,f)),_}}a.tokenizer=s}if(t.hooks){const s=this.defaults.hooks||new ur;for(const l in t.hooks){if(!(l in s))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;const c=l,d=t.hooks[c],p=s[c];ur.passThroughHooks.has(l)?s[c]=f=>{if(this.defaults.async)return Promise.resolve(d.call(s,f)).then(S=>p.call(s,S));const _=d.call(s,f);return p.call(s,_)}:s[c]=(...f)=>{let _=d.apply(s,f);return _===!1&&(_=p.apply(s,f)),_}}a.hooks=s}if(t.walkTokens){const s=this.defaults.walkTokens,l=t.walkTokens;a.walkTokens=function(c){let d=[];return d.push(l.call(this,c)),s&&(d=d.concat(s.call(this,c))),d}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return dn.lex(e,n??this.defaults)}parser(e,n){return fn.parse(e,n??this.defaults)}parseMarkdown(e){return(t,a)=>{const s={...a},l={...this.defaults,...s},c=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&s.async===!1)return c(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));l.hooks&&(l.hooks.options=l,l.hooks.block=e);const d=l.hooks?l.hooks.provideLexer():e?dn.lex:dn.lexInline,p=l.hooks?l.hooks.provideParser():e?fn.parse:fn.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(t):t).then(f=>d(f,l)).then(f=>l.hooks?l.hooks.processAllTokens(f):f).then(f=>l.walkTokens?Promise.all(this.walkTokens(f,l.walkTokens)).then(()=>f):f).then(f=>p(f,l)).then(f=>l.hooks?l.hooks.postprocess(f):f).catch(c);try{l.hooks&&(t=l.hooks.preprocess(t));let f=d(t,l);l.hooks&&(f=l.hooks.processAllTokens(f)),l.walkTokens&&this.walkTokens(f,l.walkTokens);let _=p(f,l);return l.hooks&&(_=l.hooks.postprocess(_)),_}catch(f){return c(f)}}}onError(e,n){return t=>{if(t.message+=`
|
|
59
|
+
Please report this to https://github.com/markedjs/marked.`,e){const a="<p>An error occurred:</p><pre>"+on(t.message+"",!0)+"</pre>";return n?Promise.resolve(a):a}if(n)return Promise.reject(t);throw t}}},An=new dl;function Ye(e,n){return An.parse(e,n)}Ye.options=Ye.setOptions=function(e){return An.setOptions(e),Ye.defaults=An.defaults,us(Ye.defaults),Ye};Ye.getDefaults=no;Ye.defaults=En;Ye.use=function(...e){return An.use(...e),Ye.defaults=An.defaults,us(Ye.defaults),Ye};Ye.walkTokens=function(e,n){return An.walkTokens(e,n)};Ye.parseInline=An.parseInline;Ye.Parser=fn;Ye.parser=fn.parse;Ye.Renderer=pr;Ye.TextRenderer=uo;Ye.Lexer=dn;Ye.lexer=dn.lex;Ye.Tokenizer=hr;Ye.Hooks=ur;Ye.parse=Ye;Ye.options;Ye.setOptions;Ye.use;Ye.walkTokens;Ye.parseInline;fn.parse;dn.lex;const{entries:ws,setPrototypeOf:Ao,isFrozen:fl,getPrototypeOf:ml,getOwnPropertyDescriptor:hl}=Object;let{freeze:Rt,seal:Wt,create:zr}=Object,{apply:Vr,construct:Wr}=typeof Reflect<"u"&&Reflect;Rt||(Rt=function(n){return n});Wt||(Wt=function(n){return n});Vr||(Vr=function(n,t){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];return n.apply(t,s)});Wr||(Wr=function(n){for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s<t;s++)a[s-1]=arguments[s];return new n(...a)});const ir=Pt(Array.prototype.forEach),pl=Pt(Array.prototype.lastIndexOf),Bo=Pt(Array.prototype.pop),Gn=Pt(Array.prototype.push),vl=Pt(Array.prototype.splice),dr=Pt(String.prototype.toLowerCase),Tr=Pt(String.prototype.toString),Mr=Pt(String.prototype.match),qn=Pt(String.prototype.replace),gl=Pt(String.prototype.indexOf),xl=Pt(String.prototype.trim),qt=Pt(Object.prototype.hasOwnProperty),At=Pt(RegExp.prototype.test),Kn=bl(TypeError);function Pt(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s<t;s++)a[s-1]=arguments[s];return Vr(e,n,a)}}function bl(e){return function(){for(var n=arguments.length,t=new Array(n),a=0;a<n;a++)t[a]=arguments[a];return Wr(e,t)}}function Ue(e,n){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:dr;Ao&&Ao(e,null);let a=n.length;for(;a--;){let s=n[a];if(typeof s=="string"){const l=t(s);l!==s&&(fl(n)||(n[a]=l),s=l)}e[s]=!0}return e}function yl(e){for(let n=0;n<e.length;n++)qt(e,n)||(e[n]=null);return e}function sn(e){const n=zr(null);for(const[t,a]of ws(e))qt(e,t)&&(Array.isArray(a)?n[t]=yl(a):a&&typeof a=="object"&&a.constructor===Object?n[t]=sn(a):n[t]=a);return n}function Zn(e,n){for(;e!==null;){const a=hl(e,n);if(a){if(a.get)return Pt(a.get);if(typeof a.value=="function")return Pt(a.value)}e=ml(e)}function t(){return null}return t}const Eo=Rt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ar=Rt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Br=Rt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),wl=Rt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Er=Rt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),kl=Rt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ro=Rt(["#text"]),Po=Rt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Rr=Rt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Do=Rt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),lr=Rt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Cl=Wt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$l=Wt(/<%[\w\W]*|[\w\W]*%>/gm),Sl=Wt(/\$\{[\w\W]*/gm),_l=Wt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Tl=Wt(/^aria-[\-\w]+$/),ks=Wt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ml=Wt(/^(?:\w+script|data):/i),Al=Wt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Cs=Wt(/^html$/i),Bl=Wt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Io=Object.freeze({__proto__:null,ARIA_ATTR:Tl,ATTR_WHITESPACE:Al,CUSTOM_ELEMENT:Bl,DATA_ATTR:_l,DOCTYPE_NAME:Cs,ERB_EXPR:$l,IS_ALLOWED_URI:ks,IS_SCRIPT_OR_DATA:Ml,MUSTACHE_EXPR:Cl,TMPLIT_EXPR:Sl});const Yn={element:1,text:3,progressingInstruction:7,comment:8,document:9},El=function(){return typeof window>"u"?null:window},Rl=function(n,t){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let a=null;const s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(a=t.getAttribute(s));const l="dompurify"+(a?"#"+a:"");try{return n.createPolicy(l,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},Lo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function $s(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:El();const n=ye=>$s(ye);if(n.version="3.3.1",n.removed=[],!e||!e.document||e.document.nodeType!==Yn.document||!e.Element)return n.isSupported=!1,n;let{document:t}=e;const a=t,s=a.currentScript,{DocumentFragment:l,HTMLTemplateElement:c,Node:d,Element:p,NodeFilter:f,NamedNodeMap:_=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:S,DOMParser:g,trustedTypes:b}=e,w=p.prototype,M=Zn(w,"cloneNode"),j=Zn(w,"remove"),B=Zn(w,"nextSibling"),H=Zn(w,"childNodes"),O=Zn(w,"parentNode");if(typeof c=="function"){const ye=t.createElement("template");ye.content&&ye.content.ownerDocument&&(t=ye.content.ownerDocument)}let E,re="";const{implementation:me,createNodeIterator:fe,createDocumentFragment:xe,getElementsByTagName:ke}=t,{importNode:te}=a;let z=Lo();n.isSupported=typeof ws=="function"&&typeof O=="function"&&me&&me.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:G,ERB_EXPR:I,TMPLIT_EXPR:W,DATA_ATTR:V,ARIA_ATTR:h,IS_SCRIPT_OR_DATA:m,ATTR_WHITESPACE:y,CUSTOM_ELEMENT:F}=Io;let{IS_ALLOWED_URI:J}=Io,X=null;const se=Ue({},[...Eo,...Ar,...Br,...Er,...Ro]);let Z=null;const Y=Ue({},[...Po,...Rr,...Do,...lr]);let oe=Object.seal(zr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ee=null,ae=null;const le=Object.seal(zr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Me=!0,ze=!0,Je=!1,he=!0,ne=!1,Ce=!0,De=!1,Fe=!1,je=!1,Ke=!1,ot=!1,jt=!1,Xt=!0,st=!1;const It="user-content-";let St=!0,_t=!1,Lt={},vt=null;const Ot=Ue({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Tt=null;const Nt=Ue({},["audio","video","img","source","image","track"]);let U=null;const ce=Ue({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Q="http://www.w3.org/1998/Math/MathML",ue="http://www.w3.org/2000/svg",be="http://www.w3.org/1999/xhtml";let Te=be,Be=!1,Oe=null;const kn=Ue({},[Q,ue,be],Tr);let Qt=Ue({},["mi","mo","mn","ms","mtext"]),Jt=Ue({},["annotation-xml"]);const Cn=Ue({},["title","style","font","a","script"]);let Gt=null;const mt=["application/xhtml+xml","text/html"],$n="text/html";let He=null,zt=null;const ct=t.createElement("form"),vn=function(A){return A instanceof RegExp||A instanceof Function},et=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(zt&&zt===A)){if((!A||typeof A!="object")&&(A={}),A=sn(A),Gt=mt.indexOf(A.PARSER_MEDIA_TYPE)===-1?$n:A.PARSER_MEDIA_TYPE,He=Gt==="application/xhtml+xml"?Tr:dr,X=qt(A,"ALLOWED_TAGS")?Ue({},A.ALLOWED_TAGS,He):se,Z=qt(A,"ALLOWED_ATTR")?Ue({},A.ALLOWED_ATTR,He):Y,Oe=qt(A,"ALLOWED_NAMESPACES")?Ue({},A.ALLOWED_NAMESPACES,Tr):kn,U=qt(A,"ADD_URI_SAFE_ATTR")?Ue(sn(ce),A.ADD_URI_SAFE_ATTR,He):ce,Tt=qt(A,"ADD_DATA_URI_TAGS")?Ue(sn(Nt),A.ADD_DATA_URI_TAGS,He):Nt,vt=qt(A,"FORBID_CONTENTS")?Ue({},A.FORBID_CONTENTS,He):Ot,ee=qt(A,"FORBID_TAGS")?Ue({},A.FORBID_TAGS,He):sn({}),ae=qt(A,"FORBID_ATTR")?Ue({},A.FORBID_ATTR,He):sn({}),Lt=qt(A,"USE_PROFILES")?A.USE_PROFILES:!1,Me=A.ALLOW_ARIA_ATTR!==!1,ze=A.ALLOW_DATA_ATTR!==!1,Je=A.ALLOW_UNKNOWN_PROTOCOLS||!1,he=A.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ne=A.SAFE_FOR_TEMPLATES||!1,Ce=A.SAFE_FOR_XML!==!1,De=A.WHOLE_DOCUMENT||!1,Ke=A.RETURN_DOM||!1,ot=A.RETURN_DOM_FRAGMENT||!1,jt=A.RETURN_TRUSTED_TYPE||!1,je=A.FORCE_BODY||!1,Xt=A.SANITIZE_DOM!==!1,st=A.SANITIZE_NAMED_PROPS||!1,St=A.KEEP_CONTENT!==!1,_t=A.IN_PLACE||!1,J=A.ALLOWED_URI_REGEXP||ks,Te=A.NAMESPACE||be,Qt=A.MATHML_TEXT_INTEGRATION_POINTS||Qt,Jt=A.HTML_INTEGRATION_POINTS||Jt,oe=A.CUSTOM_ELEMENT_HANDLING||{},A.CUSTOM_ELEMENT_HANDLING&&vn(A.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(oe.tagNameCheck=A.CUSTOM_ELEMENT_HANDLING.tagNameCheck),A.CUSTOM_ELEMENT_HANDLING&&vn(A.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(oe.attributeNameCheck=A.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),A.CUSTOM_ELEMENT_HANDLING&&typeof A.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(oe.allowCustomizedBuiltInElements=A.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ne&&(ze=!1),ot&&(Ke=!0),Lt&&(X=Ue({},Ro),Z=[],Lt.html===!0&&(Ue(X,Eo),Ue(Z,Po)),Lt.svg===!0&&(Ue(X,Ar),Ue(Z,Rr),Ue(Z,lr)),Lt.svgFilters===!0&&(Ue(X,Br),Ue(Z,Rr),Ue(Z,lr)),Lt.mathMl===!0&&(Ue(X,Er),Ue(Z,Do),Ue(Z,lr))),A.ADD_TAGS&&(typeof A.ADD_TAGS=="function"?le.tagCheck=A.ADD_TAGS:(X===se&&(X=sn(X)),Ue(X,A.ADD_TAGS,He))),A.ADD_ATTR&&(typeof A.ADD_ATTR=="function"?le.attributeCheck=A.ADD_ATTR:(Z===Y&&(Z=sn(Z)),Ue(Z,A.ADD_ATTR,He))),A.ADD_URI_SAFE_ATTR&&Ue(U,A.ADD_URI_SAFE_ATTR,He),A.FORBID_CONTENTS&&(vt===Ot&&(vt=sn(vt)),Ue(vt,A.FORBID_CONTENTS,He)),A.ADD_FORBID_CONTENTS&&(vt===Ot&&(vt=sn(vt)),Ue(vt,A.ADD_FORBID_CONTENTS,He)),St&&(X["#text"]=!0),De&&Ue(X,["html","head","body"]),X.table&&(Ue(X,["tbody"]),delete ee.tbody),A.TRUSTED_TYPES_POLICY){if(typeof A.TRUSTED_TYPES_POLICY.createHTML!="function")throw Kn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof A.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Kn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=A.TRUSTED_TYPES_POLICY,re=E.createHTML("")}else E===void 0&&(E=Rl(b,s)),E!==null&&typeof re=="string"&&(re=E.createHTML(""));Rt&&Rt(A),zt=A}},an=Ue({},[...Ar,...Br,...wl]),ut=Ue({},[...Er,...kl]),bt=function(A){let ie=O(A);(!ie||!ie.tagName)&&(ie={namespaceURI:Te,tagName:"template"});const ve=dr(A.tagName),qe=dr(ie.tagName);return Oe[A.namespaceURI]?A.namespaceURI===ue?ie.namespaceURI===be?ve==="svg":ie.namespaceURI===Q?ve==="svg"&&(qe==="annotation-xml"||Qt[qe]):!!an[ve]:A.namespaceURI===Q?ie.namespaceURI===be?ve==="math":ie.namespaceURI===ue?ve==="math"&&Jt[qe]:!!ut[ve]:A.namespaceURI===be?ie.namespaceURI===ue&&!Jt[qe]||ie.namespaceURI===Q&&!Qt[qe]?!1:!ut[ve]&&(Cn[ve]||!an[ve]):!!(Gt==="application/xhtml+xml"&&Oe[A.namespaceURI]):!1},Ve=function(A){Gn(n.removed,{element:A});try{O(A).removeChild(A)}catch{j(A)}},Ft=function(A,ie){try{Gn(n.removed,{attribute:ie.getAttributeNode(A),from:ie})}catch{Gn(n.removed,{attribute:null,from:ie})}if(ie.removeAttribute(A),A==="is")if(Ke||ot)try{Ve(ie)}catch{}else try{ie.setAttribute(A,"")}catch{}},at=function(A){let ie=null,ve=null;if(je)A="<remove></remove>"+A;else{const Ze=Mr(A,/^[\r\n\t ]+/);ve=Ze&&Ze[0]}Gt==="application/xhtml+xml"&&Te===be&&(A='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+A+"</body></html>");const qe=E?E.createHTML(A):A;if(Te===be)try{ie=new g().parseFromString(qe,Gt)}catch{}if(!ie||!ie.documentElement){ie=me.createDocument(Te,"template",null);try{ie.documentElement.innerHTML=Be?re:qe}catch{}}const We=ie.body||ie.documentElement;return A&&ve&&We.insertBefore(t.createTextNode(ve),We.childNodes[0]||null),Te===be?ke.call(ie,De?"html":"body")[0]:De?ie.documentElement:We},en=function(A){return fe.call(A.ownerDocument||A,A,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},it=function(A){return A instanceof S&&(typeof A.nodeName!="string"||typeof A.textContent!="string"||typeof A.removeChild!="function"||!(A.attributes instanceof _)||typeof A.removeAttribute!="function"||typeof A.setAttribute!="function"||typeof A.namespaceURI!="string"||typeof A.insertBefore!="function"||typeof A.hasChildNodes!="function")},ln=function(A){return typeof d=="function"&&A instanceof d};function Qe(ye,A,ie){ir(ye,ve=>{ve.call(n,A,ie,zt)})}const gn=function(A){let ie=null;if(Qe(z.beforeSanitizeElements,A,null),it(A))return Ve(A),!0;const ve=He(A.nodeName);if(Qe(z.uponSanitizeElement,A,{tagName:ve,allowedTags:X}),Ce&&A.hasChildNodes()&&!ln(A.firstElementChild)&&At(/<[/\w!]/g,A.innerHTML)&&At(/<[/\w!]/g,A.textContent)||A.nodeType===Yn.progressingInstruction||Ce&&A.nodeType===Yn.comment&&At(/<[/\w]/g,A.data))return Ve(A),!0;if(!(le.tagCheck instanceof Function&&le.tagCheck(ve))&&(!X[ve]||ee[ve])){if(!ee[ve]&&tn(ve)&&(oe.tagNameCheck instanceof RegExp&&At(oe.tagNameCheck,ve)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(ve)))return!1;if(St&&!vt[ve]){const qe=O(A)||A.parentNode,We=H(A)||A.childNodes;if(We&&qe){const Ze=We.length;for(let ht=Ze-1;ht>=0;--ht){const rt=M(We[ht],!0);rt.__removalCount=(A.__removalCount||0)+1,qe.insertBefore(rt,B(A))}}}return Ve(A),!0}return A instanceof p&&!bt(A)||(ve==="noscript"||ve==="noembed"||ve==="noframes")&&At(/<\/no(script|embed|frames)/i,A.innerHTML)?(Ve(A),!0):(ne&&A.nodeType===Yn.text&&(ie=A.textContent,ir([G,I,W],qe=>{ie=qn(ie,qe," ")}),A.textContent!==ie&&(Gn(n.removed,{element:A.cloneNode()}),A.textContent=ie)),Qe(z.afterSanitizeElements,A,null),!1)},dt=function(A,ie,ve){if(Xt&&(ie==="id"||ie==="name")&&(ve in t||ve in ct))return!1;if(!(ze&&!ae[ie]&&At(V,ie))){if(!(Me&&At(h,ie))){if(!(le.attributeCheck instanceof Function&&le.attributeCheck(ie,A))){if(!Z[ie]||ae[ie]){if(!(tn(A)&&(oe.tagNameCheck instanceof RegExp&&At(oe.tagNameCheck,A)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(A))&&(oe.attributeNameCheck instanceof RegExp&&At(oe.attributeNameCheck,ie)||oe.attributeNameCheck instanceof Function&&oe.attributeNameCheck(ie,A))||ie==="is"&&oe.allowCustomizedBuiltInElements&&(oe.tagNameCheck instanceof RegExp&&At(oe.tagNameCheck,ve)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(ve))))return!1}else if(!U[ie]){if(!At(J,qn(ve,y,""))){if(!((ie==="src"||ie==="xlink:href"||ie==="href")&&A!=="script"&&gl(ve,"data:")===0&&Tt[A])){if(!(Je&&!At(m,qn(ve,y,"")))){if(ve)return!1}}}}}}}return!0},tn=function(A){return A!=="annotation-xml"&&Mr(A,F)},ft=function(A){Qe(z.beforeSanitizeAttributes,A,null);const{attributes:ie}=A;if(!ie||it(A))return;const ve={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let qe=ie.length;for(;qe--;){const We=ie[qe],{name:Ze,namespaceURI:ht,value:rt}=We,Ht=He(Ze),gt=rt;let lt=Ze==="value"?gt:xl(gt);if(ve.attrName=Ht,ve.attrValue=lt,ve.keepAttr=!0,ve.forceKeepAttr=void 0,Qe(z.uponSanitizeAttribute,A,ve),lt=ve.attrValue,st&&(Ht==="id"||Ht==="name")&&(Ft(Ze,A),lt=It+lt),Ce&&At(/((--!?|])>)|<\/(style|title|textarea)/i,lt)){Ft(Ze,A);continue}if(Ht==="attributename"&&Mr(lt,"href")){Ft(Ze,A);continue}if(ve.forceKeepAttr)continue;if(!ve.keepAttr){Ft(Ze,A);continue}if(!he&&At(/\/>/i,lt)){Ft(Ze,A);continue}ne&&ir([G,I,W],k=>{lt=qn(lt,k," ")});const Vt=He(A.nodeName);if(!dt(Vt,Ht,lt)){Ft(Ze,A);continue}if(E&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!ht)switch(b.getAttributeType(Vt,Ht)){case"TrustedHTML":{lt=E.createHTML(lt);break}case"TrustedScriptURL":{lt=E.createScriptURL(lt);break}}if(lt!==gt)try{ht?A.setAttributeNS(ht,Ze,lt):A.setAttribute(Ze,lt),it(A)?Ve(A):Bo(n.removed)}catch{Ft(Ze,A)}}Qe(z.afterSanitizeAttributes,A,null)},Sn=function ye(A){let ie=null;const ve=en(A);for(Qe(z.beforeSanitizeShadowDOM,A,null);ie=ve.nextNode();)Qe(z.uponSanitizeShadowNode,ie,null),gn(ie),ft(ie),ie.content instanceof l&&ye(ie.content);Qe(z.afterSanitizeShadowDOM,A,null)};return n.sanitize=function(ye){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,ve=null,qe=null,We=null;if(Be=!ye,Be&&(ye="<!-->"),typeof ye!="string"&&!ln(ye))if(typeof ye.toString=="function"){if(ye=ye.toString(),typeof ye!="string")throw Kn("dirty is not a string, aborting")}else throw Kn("toString is not a function");if(!n.isSupported)return ye;if(Fe||et(A),n.removed=[],typeof ye=="string"&&(_t=!1),_t){if(ye.nodeName){const rt=He(ye.nodeName);if(!X[rt]||ee[rt])throw Kn("root node is forbidden and cannot be sanitized in-place")}}else if(ye instanceof d)ie=at("<!---->"),ve=ie.ownerDocument.importNode(ye,!0),ve.nodeType===Yn.element&&ve.nodeName==="BODY"||ve.nodeName==="HTML"?ie=ve:ie.appendChild(ve);else{if(!Ke&&!ne&&!De&&ye.indexOf("<")===-1)return E&&jt?E.createHTML(ye):ye;if(ie=at(ye),!ie)return Ke?null:jt?re:""}ie&&je&&Ve(ie.firstChild);const Ze=en(_t?ye:ie);for(;qe=Ze.nextNode();)gn(qe),ft(qe),qe.content instanceof l&&Sn(qe.content);if(_t)return ye;if(Ke){if(ot)for(We=xe.call(ie.ownerDocument);ie.firstChild;)We.appendChild(ie.firstChild);else We=ie;return(Z.shadowroot||Z.shadowrootmode)&&(We=te.call(a,We,!0)),We}let ht=De?ie.outerHTML:ie.innerHTML;return De&&X["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&At(Cs,ie.ownerDocument.doctype.name)&&(ht="<!DOCTYPE "+ie.ownerDocument.doctype.name+`>
|
|
60
|
+
`+ht),ne&&ir([G,I,W],rt=>{ht=qn(ht,rt," ")}),E&&jt?E.createHTML(ht):ht},n.setConfig=function(){let ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};et(ye),Fe=!0},n.clearConfig=function(){zt=null,Fe=!1},n.isValidAttribute=function(ye,A,ie){zt||et({});const ve=He(ye),qe=He(A);return dt(ve,qe,ie)},n.addHook=function(ye,A){typeof A=="function"&&Gn(z[ye],A)},n.removeHook=function(ye,A){if(A!==void 0){const ie=pl(z[ye],A);return ie===-1?void 0:vl(z[ye],ie,1)[0]}return Bo(z[ye])},n.removeHooks=function(ye){z[ye]=[]},n.removeAllHooks=function(){z=Lo()},n}var Ss=$s();const Pl={":art:":"🎨",":zap:":"⚡",":fire:":"🔥",":bug:":"🐛",":ambulance:":"🚑",":sparkles:":"✨",":memo:":"📝",":rocket:":"🚀",":lipstick:":"💄",":tada:":"🎉",":white_check_mark:":"✅",":lock:":"🔒",":closed_lock_with_key:":"🔐",":bookmark:":"🔖",":rotating_light:":"🚨",":construction:":"🚧",":green_heart:":"💚",":arrow_down:":"⬇️",":arrow_up:":"⬆️",":pushpin:":"📌",":construction_worker:":"👷",":chart_with_upwards_trend:":"📈",":recycle:":"♻️",":heavy_plus_sign:":"➕",":heavy_minus_sign:":"➖",":wrench:":"🔧",":hammer:":"🔨",":globe_with_meridians:":"🌐",":pencil2:":"✏️",":poop:":"💩",":rewind:":"⏪",":twisted_rightwards_arrows:":"🔀",":package:":"📦",":alien:":"👽",":truck:":"🚚",":page_facing_up:":"📄",":boom:":"💥",":bento:":"🍱",":wheelchair:":"♿",":bulb:":"💡",":beers:":"🍻",":speech_balloon:":"💬",":card_file_box:":"🗃️",":loud_sound:":"🔊",":mute:":"🔇",":busts_in_silhouette:":"👥",":children_crossing:":"🚸",":building_construction:":"🏗️",":iphone:":"📱",":clown_face:":"🤡",":egg:":"🥚",":see_no_evil:":"🙈",":camera_flash:":"📸",":alembic:":"⚗️",":mag:":"🔍",":label:":"🏷️",":seedling:":"🌱",":triangular_flag_on_post:":"🚩",":goal_net:":"🥅",":dizzy:":"💫",":wastebasket:":"🗑️",":passport_control:":"🛂",":adhesive_bandage:":"🩹",":monocle_face:":"🧐",":coffin:":"⚰️",":test_tube:":"🧪",":necktie:":"👔",":stethoscope:":"🩺",":bricks:":"🧱",":technologist:":"🧑💻",":money_with_wings:":"💸",":thread:":"🧵",":safety_vest:":"🦺"},Dl=/https?:\/\/[^\s<>)"']+/g;function Il(e){return e.replace(Dl,n=>`<a href="${n}" target="_blank" rel="noopener noreferrer" class="text-retro-blue hover:underline">${n}</a>`)}function Ll(e){return e.replace(/:[a-z0-9_]+:/g,n=>Pl[n]||n)}function Nl(e){if(!e)return"";let n=Ll(e);return n=Ye.parse(n),n=Il(n),n=Ss.sanitize(n,{ALLOWED_TAGS:["a","strong","em","code","b","i","br","p","ul","ol","li","pre","blockquote","h1","h2","h3"],ALLOWED_ATTR:["href","target","rel","class"]}),n}const Fl={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Hl={class:"flex items-center gap-2 min-w-0"},Ol={class:"text-retro-cyan font-mono text-sm"},Ul={class:"text-retro-muted text-sm truncate"},jl={class:"flex items-center gap-1 flex-shrink-0"},zl=["aria-label","title"],Vl={class:"flex-1 overflow-auto p-4 space-y-4"},Wl={class:"space-y-2"},Gl={class:"flex items-center gap-2 text-sm"},ql={class:"text-retro-text font-mono text-xs bg-retro-panel px-2 py-1 rounded"},Kl={class:"flex items-center gap-2 text-sm"},Zl={class:"text-retro-text"},Yl={class:"text-retro-muted"},Xl={key:0,class:"flex items-center gap-2 text-sm"},Ql={class:"text-retro-text"},Jl={class:"text-retro-muted"},ec={class:"flex items-center gap-2 text-sm"},tc={class:"text-retro-text"},nc={key:1,class:"flex items-start gap-2 text-sm"},rc={class:"flex flex-wrap gap-1"},oc=["onClick","title"],sc={key:2,class:"flex items-start gap-2 text-sm"},ac={class:"flex flex-wrap gap-1"},ic={key:3,class:"flex items-start gap-2 text-sm"},lc={class:"flex flex-wrap gap-1"},cc={class:"space-y-1"},uc={class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded"},dc={key:0,class:"space-y-1"},fc=["innerHTML"],mc={key:1,class:"space-y-2"},hc={class:"flex items-center gap-2 text-sm"},pc={class:"text-retro-muted"},vc={key:0,class:"flex items-center gap-2"},gc={class:"text-retro-green text-xs font-mono"},xc={class:"flex-1 h-2 rounded overflow-hidden bg-retro-panel flex"},bc={class:"text-retro-red text-xs font-mono"},yc={key:2,class:"space-y-2"},wc={class:"flex items-center justify-between"},kc={class:"text-retro-muted text-xs uppercase tracking-wide"},Cc={class:"flex items-center gap-1"},$c={key:0,class:"text-retro-muted text-sm py-2"},Sc={key:1,class:"space-y-0.5"},_c=["onClick"],Tc=["title"],Mc={class:"text-retro-text font-mono text-xs truncate flex-1"},Ac={class:"text-retro-muted"},Bc={class:"text-retro-text"},Ec={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Rc={key:0,class:"text-retro-green"},Pc={key:1,class:"text-retro-red"},Dc={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Ic={key:2,class:"space-y-0"},Lc=["onClick"],Nc={class:"text-retro-text font-mono text-xs"},Fc=["title"],Hc={class:"text-retro-text font-mono text-xs truncate flex-1"},Oc={class:"text-retro-muted"},Uc={class:"text-retro-text"},jc={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},zc={key:0,class:"text-retro-green"},Vc={key:1,class:"text-retro-red"},Wc={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Gc={key:3,class:"flex items-center gap-2 text-retro-muted text-sm py-2"},qc={key:4,class:"text-retro-muted text-sm py-2"},Kc=Ae({__name:"GitCommitDetail",props:{commit:{},files:{},stats:{},loading:{type:Boolean,default:!1},committer:{},committerEmail:{},detailPosition:{default:"inline"}},emits:["close","navigateToCommit","togglePosition","navigatePrev","navigateNext","openFileDiff"],setup(e,{emit:n}){const t=e,a=n,s=$(null),l=$("flat"),c=$(new Set),d=D(()=>!t.committer||!t.committerEmail?!1:t.committer!==t.commit.author||t.committerEmail!==t.commit.email),p=D(()=>{const z=t.commit.body;return z?Nl(z):""}),f=D(()=>{if(!t.stats)return"";const{filesChanged:z,additions:G,deletions:I}=t.stats,V=[`${z} ${z===1?"file":"files"} changed`];return G>0&&V.push(`+${G} insertion${G===1?"":"s"}`),I>0&&V.push(`-${I} deletion${I===1?"":"s"}`),V.join(", ")});function _(z){const G=[];for(const I of z){const W=I.path.split("/");let V=G;for(let h=0;h<W.length;h++){const m=W[h],y=h===W.length-1,F=W.slice(0,h+1).join("/");let J=V.find(X=>X.name===m&&X.isDirectory===!y);J||(J={name:m,fullPath:F,isDirectory:!y,children:[],file:y?I:void 0},V.push(J)),y||(V=J.children)}}return S(G),G}function S(z){for(const G of z)if(G.isDirectory)for(S(G.children);G.children.length===1&&G.children[0].isDirectory;){const I=G.children[0];G.name=`${G.name}/${I.name}`,G.fullPath=I.fullPath,G.children=I.children}}function g(z){return[...z].sort((G,I)=>G.isDirectory&&!I.isDirectory?-1:!G.isDirectory&&I.isDirectory?1:G.name.localeCompare(I.name))}function b(z,G,I){const W=[];for(const V of g(z)){const h=I.size===0?!0:I.has(V.fullPath);W.push({key:V.fullPath,depth:G,isDirectory:V.isDirectory,name:V.name,fullPath:V.fullPath,expanded:V.isDirectory?h:!1,file:V.file}),V.isDirectory&&h&&W.push(...b(V.children,G+1,I))}return W}const w=D(()=>!t.files||t.files.length===0?[]:_(t.files)),M=D(()=>b(w.value,0,c.value));function j(z){c.value.has(z)?c.value.delete(z):c.value.add(z),c.value=new Set(c.value)}function B(){const z=G=>{const I=[];for(const W of G)W.isDirectory&&(I.push(W.fullPath),I.push(...z(W.children)));return I};c.value=new Set(z(w.value))}function H(){c.value=new Set}Pe(l,z=>{z==="tree"&&B()});function O(z){return new Date(z*1e3).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}function E(z){return Fn[z]||{label:z,colorClass:"text-retro-muted"}}const re=D(()=>{if(!t.stats)return{addPct:0,delPct:0};const z=t.stats.additions+t.stats.deletions;return z===0?{addPct:50,delPct:50}:{addPct:Math.round(t.stats.additions/z*100),delPct:Math.round(t.stats.deletions/z*100)}});function me(z){z.key==="ArrowUp"?(z.preventDefault(),a("navigatePrev")):z.key==="ArrowDown"?(z.preventDefault(),a("navigateNext")):z.key==="Escape"&&(z.preventDefault(),a("close"))}xt(()=>{Kt(()=>{s.value?.focus()})}),Pe(()=>t.commit.hash,()=>{Kt(()=>{s.value?.focus()})});function fe(){a("close")}function xe(z){a("navigateToCommit",z)}function ke(){a("togglePosition")}function te(z){a("openFileDiff",z)}return(z,G)=>(i(),u("section",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:me,class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark focus:outline-none","aria-label":"Commit details",role:"region"},[r("div",Fl,[r("div",Hl,[r("span",Ol,C(e.commit.shortHash),1),r("span",Ul,C(e.commit.message.split(`
|
|
61
|
+
`)[0]),1)]),r("div",jl,[r("button",{onClick:ke,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":e.detailPosition==="inline"?"Dock detail to bottom":"Show detail inline",title:e.detailPosition==="inline"?"Dock to bottom":"Show inline"},[e.detailPosition==="inline"?(i(),de(o(Xo),{key:0,class:"w-4 h-4 text-retro-muted hover:text-retro-text"})):(i(),de(o(Yo),{key:1,class:"w-4 h-4 text-retro-muted hover:text-retro-text"}))],8,zl),r("button",{onClick:fe,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close commit details"},[q(o($t),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])])]),r("div",Vl,[r("div",Wl,[r("div",Gl,[G[2]||(G[2]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Hash:",-1)),r("code",ql,C(e.commit.hash),1)]),r("div",Kl,[q(o(Hr),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Zl,C(e.commit.author),1),r("span",Yl,"<"+C(e.commit.email)+">",1)]),d.value?(i(),u("div",Xl,[q(o(Hr),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),G[3]||(G[3]=r("span",{class:"text-retro-muted text-xs uppercase mr-1"},"Committer:",-1)),r("span",Ql,C(e.committer),1),r("span",Jl,"<"+C(e.committerEmail)+">",1)])):P("",!0),r("div",ec,[q(o(ts),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",tc,C(O(e.commit.timestamp)),1)]),e.commit.parents?.length>0?(i(),u("div",nc,[G[4]||(G[4]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Parents:",-1)),r("div",rc,[(i(!0),u(ge,null,Ie(e.commit.parents,I=>(i(),u("button",{key:I,onClick:W=>xe(I),class:"text-retro-cyan font-mono text-xs bg-retro-panel px-2 py-0.5 rounded hover:bg-retro-dark hover:text-retro-text transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-retro-cyan",title:`Navigate to parent ${I.substring(0,7)}`},C(I.substring(0,7)),9,oc))),128))])])):P("",!0),e.commit.branches?.length>0?(i(),u("div",sc,[G[5]||(G[5]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Branches:",-1)),r("div",ac,[(i(!0),u(ge,null,Ie(e.commit.branches,I=>(i(),u("span",{key:I,class:"text-retro-green font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},C(I),1))),128))])])):P("",!0),e.commit.tags?.length>0?(i(),u("div",ic,[G[6]||(G[6]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Tags:",-1)),r("div",lc,[(i(!0),u(ge,null,Ie(e.commit.tags,I=>(i(),u("span",{key:I,class:"text-retro-yellow font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},C(I),1))),128))])])):P("",!0)]),r("div",cc,[G[7]||(G[7]=r("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Message ",-1)),r("div",uc,C(e.commit.message.split(`
|
|
62
|
+
`)[0]),1)]),e.commit.body?(i(),u("div",dc,[G[8]||(G[8]=r("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Body ",-1)),r("div",{class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded commit-body-rendered",innerHTML:p.value},null,8,fc)])):P("",!0),e.stats?(i(),u("div",mc,[r("div",hc,[r("span",pc,C(f.value),1)]),e.stats.additions>0||e.stats.deletions>0?(i(),u("div",vc,[r("span",gc,"+"+C(e.stats.additions),1),r("div",xc,[r("div",{class:"bg-retro-green h-full transition-all",style:Bt({width:re.value.addPct+"%"})},null,4),r("div",{class:"bg-retro-red h-full transition-all",style:Bt({width:re.value.delPct+"%"})},null,4)]),r("span",bc,"-"+C(e.stats.deletions),1)])):P("",!0)])):P("",!0),e.files?(i(),u("div",yc,[r("div",wc,[r("h4",kc," Files Changed ("+C(e.files.length)+") ",1),r("div",Cc,[r("button",{onClick:G[0]||(G[0]=I=>l.value="flat"),class:we(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",l.value==="flat"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Flat file list",title:"Flat file list"},[q(o(as),{class:"w-4 h-4"})],2),r("button",{onClick:G[1]||(G[1]=I=>l.value="tree"),class:we(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",l.value==="tree"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Tree file view",title:"Tree file view"},[q(o(Fr),{class:"w-4 h-4"})],2)])]),e.files.length===0?(i(),u("div",$c," No files changed in this commit. ")):l.value==="flat"?(i(),u("ul",Sc,[(i(!0),u(ge,null,Ie(e.files,I=>(i(),u("li",{key:I.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group cursor-pointer",onClick:W=>te(I)},[r("span",{class:we(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",E(I.status).colorClass]),title:E(I.status).label},C(I.status),11,Tc),q(o(Nn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Mc,[I.status==="R"&&I.oldPath?(i(),u(ge,{key:0},[r("span",Ac,C(I.oldPath),1),G[9]||(G[9]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Bc,C(I.path),1)],64)):(i(),u(ge,{key:1},[Re(C(I.path),1)],64))]),!I.binary&&(I.additions>0||I.deletions>0)?(i(),u("span",Ec,[I.additions>0?(i(),u("span",Rc,"+"+C(I.additions),1)):P("",!0),I.deletions>0?(i(),u("span",Pc,"-"+C(I.deletions),1)):P("",!0)])):I.binary?(i(),u("span",Dc,"binary")):P("",!0)],8,_c))),128))])):(i(),u("div",Ic,[r("div",{class:"flex items-center gap-2 mb-1"},[r("button",{onClick:B,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Expand all "),G[10]||(G[10]=r("span",{class:"text-retro-muted text-xs"},"|",-1)),r("button",{onClick:H,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Collapse all ")]),(i(!0),u(ge,null,Ie(M.value,I=>(i(),u("div",{key:I.key,class:we(["flex items-center gap-1 py-0.5 px-1 hover:bg-retro-panel rounded text-sm cursor-pointer",{"select-none":I.isDirectory}]),style:Bt({paddingLeft:I.depth*16+4+"px"}),onClick:W=>I.isDirectory?j(I.fullPath):I.file?te(I.file):void 0},[I.isDirectory?(i(),u(ge,{key:0},[q(o(Zr),{class:we(["w-3 h-3 text-retro-muted transition-transform flex-shrink-0",{"rotate-90":I.expanded}])},null,8,["class"]),q(o(Fr),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("span",Nc,C(I.name),1)],64)):I.file?(i(),u(ge,{key:1},[r("span",{class:we(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",E(I.file.status).colorClass]),title:E(I.file.status).label},C(I.file.status),11,Fc),q(o(Nn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Hc,[I.file.status==="R"&&I.file.oldPath?(i(),u(ge,{key:0},[r("span",Oc,C(I.file.oldPath.split("/").pop()),1),G[11]||(G[11]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Uc,C(I.name),1)],64)):(i(),u(ge,{key:1},[Re(C(I.name),1)],64))]),!I.file.binary&&(I.file.additions>0||I.file.deletions>0)?(i(),u("span",jc,[I.file.additions>0?(i(),u("span",zc,"+"+C(I.file.additions),1)):P("",!0),I.file.deletions>0?(i(),u("span",Vc,"-"+C(I.file.deletions),1)):P("",!0)])):I.file.binary?(i(),u("span",Wc,"binary")):P("",!0)],64)):P("",!0)],14,Lc))),128))]))])):e.loading?(i(),u("div",Gc,[...G[12]||(G[12]=[r("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Re(" Loading file changes... ",-1)])])):(i(),u("div",qc," Failed to load file changes. "))])],544))}}),Zc=gr(Kc,[["__scopeId","data-v-29f450ea"]]),Yc={class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark","aria-label":"Uncommitted changes details"},Xc={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Qc={class:"flex items-center gap-2 min-w-0"},Jc={class:"text-retro-muted text-sm"},eu={key:0,class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin",title:"Staging..."},tu={class:"flex-1 overflow-auto p-4 space-y-3"},nu={class:"space-y-2"},ru=["disabled"],ou={class:"space-y-1"},su={class:"flex items-center justify-between"},au={class:"text-retro-green text-xs uppercase tracking-wide font-semibold"},iu={key:0,class:"text-retro-muted text-xs py-1"},lu={key:1,class:"space-y-0.5"},cu=["aria-label","onClick"],uu={class:"text-retro-text font-mono text-xs truncate"},du={class:"space-y-1"},fu={class:"flex items-center justify-between"},mu={class:"text-retro-yellow text-xs uppercase tracking-wide font-semibold"},hu={key:0,class:"text-retro-muted text-xs py-1"},pu={key:1,class:"space-y-0.5"},vu=["aria-label","onClick"],gu={class:"text-retro-text font-mono text-xs truncate"},xu=Ae({__name:"GitUncommittedDetail",props:{stagedFiles:{default:()=>[]},unstagedFiles:{default:()=>[]},isStaging:{type:Boolean,default:!1},isCommitting:{type:Boolean,default:!1}},emits:["close","stageFiles","unstageFiles","stageAll","unstageAll","commit"],setup(e,{emit:n}){const t=e,a=n,s=$(""),l=$(!1),c=D(()=>s.value.trim().length>0&&t.stagedFiles.length>0&&!l.value&&!t.isCommitting);function d(M){return Fn[M]||{label:M,colorClass:"text-retro-muted"}}function p(){a("close")}function f(M){a("stageFiles",[M.path])}function _(M){a("unstageFiles",[M.path])}function S(){a("stageAll")}function g(){a("unstageAll")}async function b(){c.value&&(l.value=!0,a("commit",s.value.trim()),s.value="",l.value=!1)}function w(M){(M.metaKey||M.ctrlKey)&&M.key==="Enter"&&(M.preventDefault(),b())}return(M,j)=>(i(),u("section",Yc,[r("div",Xc,[r("div",Qc,[q(o(On),{class:"w-4 h-4 text-retro-yellow"}),j[1]||(j[1]=r("span",{class:"text-retro-yellow font-semibold text-sm"},"Uncommitted Changes",-1)),r("span",Jc,"("+C(e.stagedFiles.length+e.unstagedFiles.length)+" files)",1),t.isStaging?(i(),u("div",eu)):P("",!0)]),r("button",{onClick:p,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close uncommitted changes details"},[q(o($t),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])]),r("div",tu,[r("div",nu,[Ne(r("textarea",{"onUpdate:modelValue":j[0]||(j[0]=B=>Ge(s)?s.value=B:null),placeholder:"Commit message...",rows:"3",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none font-mono",onKeydown:w},null,544),[[Ct,o(s)]]),r("button",{disabled:!o(c),class:we(["w-full px-3 py-1.5 text-sm font-semibold rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",o(c)?"bg-retro-green text-retro-dark hover:bg-retro-green/90":"bg-retro-green/30 text-retro-dark"]),onClick:b},C(o(l)||t.isCommitting?"Committing...":`Commit (${e.stagedFiles.length} staged)`),11,ru)]),r("div",ou,[r("div",su,[r("h4",au," Staged Changes ("+C(e.stagedFiles.length)+") ",1),e.stagedFiles.length>0?(i(),u("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:g}," Unstage All ")):P("",!0)]),e.stagedFiles.length===0?(i(),u("div",iu," No staged files. Stage files below to commit. ")):(i(),u("ul",lu,[(i(!0),u(ge,null,Ie(e.stagedFiles,B=>(i(),u("li",{key:"staged-"+B.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[r("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-red/20 transition-colors opacity-60 group-hover:opacity-100",title:"Unstage file","aria-label":`Unstage ${B.path}`,onClick:H=>_(B)},[q(o(da),{class:"w-3.5 h-3.5 text-retro-red"})],8,cu),r("span",{class:we(["flex-shrink-0 w-4 text-center text-xs font-bold",d(B.status).colorClass])},C(B.status),3),q(o(Nn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),r("span",uu,C(B.oldPath?`${B.oldPath} → ${B.path}`:B.path),1)]))),128))]))]),r("div",du,[r("div",fu,[r("h4",mu," Unstaged Changes ("+C(e.unstagedFiles.length)+") ",1),e.unstagedFiles.length>0?(i(),u("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:S}," Stage All ")):P("",!0)]),e.unstagedFiles.length===0?(i(),u("div",hu," No unstaged changes. ")):(i(),u("ul",pu,[(i(!0),u(ge,null,Ie(e.unstagedFiles,B=>(i(),u("li",{key:"unstaged-"+B.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[r("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-green/20 transition-colors opacity-60 group-hover:opacity-100",title:"Stage file","aria-label":`Stage ${B.path}`,onClick:H=>f(B)},[q(o(vr),{class:"w-3.5 h-3.5 text-retro-green"})],8,vu),r("span",{class:we(["flex-shrink-0 w-4 text-center text-xs font-bold",d(B.status).colorClass])},C(B.status),3),q(o(Nn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),r("span",gu,C(B.oldPath?`${B.oldPath} → ${B.path}`:B.path),1)]))),128))]))])])]))}}),bu=["aria-label"],yu={key:0,class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border truncate font-mono"},wu={key:0,class:"my-1 border-t border-retro-border",role:"separator"},ku=["aria-disabled","onClick","onMouseenter"],Cu={key:1,class:"w-4 h-4 flex-shrink-0"},er=Ae({__name:"GitContextMenu",props:{items:{},x:{},y:{},title:{}},emits:["close","action"],setup(e,{emit:n}){const t=e,a=n,s=$(null),l=$(-1),c=D(()=>t.items.map((b,w)=>({item:b,i:w})).filter(({item:b})=>!b.disabled).map(({i:b})=>b));let d=!1;function p(b){d&&s.value&&!s.value.contains(b.target)&&a("close")}xt(()=>{requestAnimationFrame(()=>{d=!0}),document.addEventListener("mousedown",p),document.addEventListener("contextmenu",p),Kt(()=>{s.value?.focus()})}),kt(()=>{d=!1,document.removeEventListener("mousedown",p),document.removeEventListener("contextmenu",p)});function f(b){const w=c.value;if(w.length===0)return;if(l.value===-1){l.value=b===1?w[0]:w[w.length-1];return}const M=w.indexOf(l.value);if(M===-1){l.value=b===1?w[0]:w[w.length-1];return}const j=M+b;j>=0&&j<w.length&&(l.value=w[j])}function _(b){switch(b.key){case"Escape":b.preventDefault(),a("close");break;case"ArrowDown":b.preventDefault(),f(1);break;case"ArrowUp":b.preventDefault(),f(-1);break;case"Enter":{b.preventDefault();const w=t.items[l.value];w&&!w.disabled&&(a("action",w.key),a("close"));break}}}function S(b){b.disabled||(a("action",b.key),a("close"))}const g=D(()=>{const w=t.title?29:0,M=t.items.filter(re=>re.separator).length,j=t.items.length*36+M*9+8,B=w+j,H=8;let O=t.x,E=t.y;return typeof window<"u"&&(O+220>window.innerWidth-H&&(O=window.innerWidth-220-H),O<H&&(O=H),E+B>window.innerHeight-H&&(E=window.innerHeight-B-H),E<H&&(E=H)),{left:`${O}px`,top:`${E}px`}});return(b,w)=>(i(),de(Zt,{to:"body"},[r("div",{ref_key:"menuRef",ref:s,class:"fixed z-50 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px]",style:Bt(o(g)),role:"menu","aria-label":e.title??"Context menu",tabindex:"-1",onKeydown:_},[e.title?(i(),u("div",yu,C(e.title),1)):P("",!0),(i(!0),u(ge,null,Ie(e.items,(M,j)=>(i(),u(ge,{key:M.key},[M.separator?(i(),u("div",wu)):P("",!0),r("button",{class:we(["w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors focus:outline-none",[M.disabled?"text-retro-muted/50 cursor-not-allowed":M.danger?["text-retro-red hover:bg-retro-red/10 focus:bg-retro-red/10",o(l)===j?"bg-retro-red/10":""]:["text-retro-text hover:bg-retro-cyan/10 focus:bg-retro-cyan/10",o(l)===j?"bg-retro-cyan/10":""]]]),role:"menuitem","aria-disabled":M.disabled||void 0,tabindex:-1,onClick:B=>S(M),onMouseenter:B=>l.value=M.disabled?o(l):j,onMouseleave:w[0]||(w[0]=B=>l.value=-1)},[M.icon?(i(),de(In(M.icon),{key:0,class:we(["w-4 h-4 flex-shrink-0",M.disabled?"opacity-50":M.danger?"":"text-retro-muted"])},null,8,["class"])):(i(),u("span",Cu)),Re(" "+C(M.label),1)],42,ku)],64))),128))],44,bu)]))}}),$u=Ae({__name:"GitBranchMenu",props:{branchName:{},isCurrentBranch:{type:Boolean},isLocal:{type:Boolean},x:{},y:{}},emits:["close","checkout","createBranch","deleteBranch","rename","merge","rebase","push","pull","fetch","copyName"],setup(e,{emit:n}){const t=e,a=n,s=D(()=>[{key:"checkout",label:"Checkout",icon:Mn,disabled:t.isCurrentBranch},{key:"rename",label:"Rename",icon:is,separator:!0},{key:"deleteBranch",label:"Delete",icon:pn,danger:!0,disabled:t.isCurrentBranch},{key:"merge",label:"Merge into Current",icon:Qo,separator:!0,disabled:t.isCurrentBranch},{key:"rebase",label:"Rebase Current Onto",icon:qo,disabled:t.isCurrentBranch},{key:"push",label:"Push",icon:Ko,separator:!0},{key:"copyName",label:"Copy Branch Name",icon:Ln,separator:!0}]),l=D(()=>[{key:"checkout",label:"Checkout",icon:Mn},{key:"deleteBranch",label:"Delete Remote Branch",icon:pn,separator:!0,danger:!0},{key:"fetch",label:"Fetch",icon:ns,separator:!0},{key:"pull",label:"Pull into Current",icon:Ks},{key:"copyName",label:"Copy Branch Name",icon:Ln,separator:!0}]),c=D(()=>t.isLocal?s.value:l.value),d={checkout:()=>a("checkout"),createBranch:()=>a("createBranch"),deleteBranch:()=>a("deleteBranch"),rename:()=>a("rename"),merge:()=>a("merge"),rebase:()=>a("rebase"),push:()=>a("push"),pull:()=>a("pull"),fetch:()=>a("fetch"),copyName:()=>a("copyName")};function p(f){const _=d[f];_&&_(),a("close")}return(f,_)=>{const S=er;return i(),de(S,{items:o(c),x:e.x,y:e.y,title:e.branchName,onAction:p,onClose:_[0]||(_[0]=g=>a("close"))},null,8,["items","x","y","title"])}}}),Su=Ae({__name:"GitCommitMenu",props:{commit:{},x:{},y:{}},emits:["close","addTag","createBranch","checkout","cherryPick","revert","mergeInto","reset","copyHash","copySubject"],setup(e,{emit:n}){const t=n,a=D(()=>[{key:"addTag",label:"Add Tag",icon:to},{key:"createBranch",label:"Create Branch",icon:vr},{key:"checkout",label:"Checkout (detached HEAD)",icon:Mn,separator:!0},{key:"cherryPick",label:"Cherry Pick",icon:ra},{key:"revert",label:"Revert",icon:Zo},{key:"mergeInto",label:"Merge into Current",icon:Qo,separator:!0},{key:"reset",label:"Reset Current Branch to Here",icon:qo,danger:!0},{key:"copyHash",label:"Copy Commit Hash",icon:Ln,separator:!0},{key:"copySubject",label:"Copy Commit Subject",icon:Ln}]),s={addTag:()=>t("addTag"),createBranch:()=>t("createBranch"),checkout:()=>t("checkout"),cherryPick:()=>t("cherryPick"),revert:()=>t("revert"),mergeInto:()=>t("mergeInto"),reset:()=>t("reset"),copyHash:()=>t("copyHash"),copySubject:()=>t("copySubject")};function l(c){const d=s[c];d&&d(),t("close")}return(c,d)=>{const p=er;return i(),de(p,{items:o(a),x:e.x,y:e.y,title:e.commit.shortHash,onAction:l,onClose:d[0]||(d[0]=f=>t("close"))},null,8,["items","x","y","title"])}}}),_u=Ae({__name:"GitTagMenu",props:{tagName:{},x:{},y:{}},emits:["close","viewDetails","deleteTag","pushTag","copyName"],setup(e,{emit:n}){const t=n,a=[{key:"viewDetails",label:"View Details",icon:to},{key:"deleteTag",label:"Delete Tag",icon:pn,separator:!0,danger:!0},{key:"pushTag",label:"Push Tag",icon:Ko},{key:"copyName",label:"Copy Tag Name",icon:Ln,separator:!0}];function s(l){switch(l){case"viewDetails":t("viewDetails");break;case"deleteTag":t("deleteTag");break;case"pushTag":t("pushTag");break;case"copyName":t("copyName");break}}return(l,c)=>{const d=er;return i(),de(d,{items:a,x:e.x,y:e.y,title:e.tagName,onClose:c[0]||(c[0]=p=>t("close")),onAction:s},null,8,["x","y","title"])}}}),Tu=Ae({__name:"GitStashMenu",props:{stashIndex:{},stashMessage:{},x:{},y:{}},emits:["close","apply","pop","drop","createBranch","copyName","copyHash"],setup(e,{emit:n}){const t=n,a=[{key:"apply",label:"Apply Stash",icon:qs},{key:"pop",label:"Pop Stash",icon:Zo},{key:"createBranch",label:"Create Branch from Stash",icon:Nr,separator:!0},{key:"drop",label:"Drop Stash",icon:pn,separator:!0,danger:!0},{key:"copyName",label:"Copy Stash Reference",icon:Ln,separator:!0},{key:"copyHash",label:"Copy Stash Hash",icon:la}];function s(l){switch(l){case"apply":t("apply");break;case"pop":t("pop");break;case"drop":t("drop");break;case"createBranch":t("createBranch");break;case"copyName":t("copyName");break;case"copyHash":t("copyHash");break}}return(l,c)=>{const d=er;return i(),de(d,{items:a,x:e.x,y:e.y,title:e.stashMessage,onClose:c[0]||(c[0]=p=>t("close")),onAction:s},null,8,["x","y","title"])}}}),Mu=Ae({__name:"GitUncommittedMenu",props:{x:{},y:{}},emits:["close","stash","reset","clean"],setup(e,{emit:n}){const t=n,a=[{key:"stash",label:"Stash Uncommitted Changes",icon:Gs},{key:"reset",label:"Reset Working Directory",icon:Mn,separator:!0,danger:!0},{key:"clean",label:"Clean Untracked Files",icon:pn,danger:!0}];function s(l){switch(l){case"stash":t("stash");break;case"reset":t("reset");break;case"clean":t("clean");break}}return(l,c)=>{const d=er;return i(),de(d,{items:a,x:e.x,y:e.y,title:"Uncommitted Changes",onClose:c[0]||(c[0]=p=>t("close")),onAction:s},null,8,["x","y"])}}}),Au={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Bu={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},Eu={class:"text-sm font-mono text-retro-text"},Ru={class:"p-4"},Pu={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Du={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},Iu=["disabled"],Lu=["disabled"],Dt=Ae({__name:"GitDialog",props:{title:{},visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null},confirmLabel:{default:"Confirm"},confirmDanger:{type:Boolean,default:!1},cancelLabel:{default:"Cancel"}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n;function s(l){l.key==="Escape"&&a("close"),l.key==="Enter"&&!t.loading&&(l.preventDefault(),a("confirm"))}return Pe(()=>t.visible,l=>{l?document.addEventListener("keydown",s):document.removeEventListener("keydown",s)}),kt(()=>{document.removeEventListener("keydown",s)}),(l,c)=>(i(),de(Zt,{to:"body"},[q(hn,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:nt(()=>[e.visible?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:c[3]||(c[3]=wt(d=>a("close"),["self"]))},[r("div",Au,[r("div",Bu,[r("h3",Eu,C(e.title),1),r("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:c[0]||(c[0]=d=>a("close"))},[q(o($t),{class:"h-4 w-4"})])]),r("div",Ru,[e.error?(i(),u("div",Pu,C(e.error),1)):P("",!0),Es(l.$slots,"default")]),r("div",Du,[r("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono text-retro-muted hover:text-retro-text bg-retro-panel hover:bg-retro-border rounded transition-colors",disabled:e.loading,onClick:c[1]||(c[1]=d=>a("close"))},C(e.cancelLabel),9,Iu),r("button",{type:"button",class:we(["px-3 py-1.5 text-xs font-mono rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",[e.confirmDanger?"text-retro-red bg-retro-red/10 border border-retro-red/30 hover:bg-retro-red/20":"text-retro-black bg-retro-cyan hover:bg-retro-cyan/80"]]),disabled:e.loading,onClick:c[2]||(c[2]=d=>a("confirm"))},C(e.loading?"Loading...":e.confirmLabel),11,Lu)])])])):P("",!0)]),_:3})]))}}),Cr=qr("gitGraph",()=>{const e=$([]),n=$([]),t=$([]),a=$(new Set),s=$([]),l=$([]),c=$(0),d=$(!1),p=$(null),f=$(null),_=$(null),S=$(!1),g=$(null),b=$(!1),w=$(0),M=$(""),j=$([]),B=$(null),H=$(!1),O=$(!1),E=$(!1),re=$(!1),me=$(null);let fe=null;function xe(L){me.value=L,fe&&clearTimeout(fe),fe=setTimeout(()=>{me.value=null},8e3)}function ke(){me.value=null,fe&&(clearTimeout(fe),fe=null)}async function te(L,K,Se,Mt){if(!B.value)return{success:!1,error:"No working directory set"};try{const nn=await $fetch(L,{method:Mt?.method??"POST",body:{workingDirectory:B.value,...K}});return(Mt?.reloadGraph??!0)&&await It(B.value),{success:!0,data:nn}}catch(nn){const rn=sr(nn,Se);return xe(rn),{success:!1,error:rn}}}const z=$(null),G=$(!1),I=$(!1),W=$(null),V=$([]),h=$([]),m=$(null),y=$(null),F=$(null),J=$("inline"),X=$("list"),se=$("rounded"),Z=$(!1),Y=$({date:!0,author:!0,commit:!0}),oe=$(0),ee=$(0),ae=$(null),le=$(null),Me=$(null),ze=$(null),Je=$(null),he=$(null),ne=$(null),Ce=$(null),De=$(null),Fe=$(null),je=$(null),Ke=$(!1),ot=new Map,jt=10,Xt=D(()=>{if(!M.value&&j.value.length===0)return e.value;let L=e.value;if(M.value){const K=M.value.toLowerCase(),Se=`${K}:${e.value.length}`;if(ot.has(Se))L=ot.get(Se);else{if(L=Co(L,K),ot.size>=jt){const Mt=ot.keys().next().value;Mt&&ot.delete(Mt)}ot.set(Se,L)}}if(j.value.length>0){const K=new Set(j.value);L=di(L,K)}return L}),st=D(()=>n.value.find(L=>L.isHead)||null);async function It(L){B.value=L,S.value=!0,g.value=null;try{const[K,Se,Mt,nn,rn]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:L}}),$fetch("/api/git/status",{query:{workingDirectory:L}}),$fetch("/api/git/stash",{query:{workingDirectory:L}}).then(bn=>bn.stashes).catch(()=>[]),$fetch("/api/git/remotes",{query:{workingDirectory:L}}).then(bn=>bn.remotes).catch(()=>[]),$fetch("/api/git/state",{query:{workingDirectory:L}}).then(bn=>bn.state).catch(()=>null)]);e.value=K.commits,n.value=K.branches,t.value=K.tags,a.value=new Set(K.localBranches??[]),b.value=K.hasMore,w.value=K.totalCount,s.value=Se.stagedFiles??[],l.value=Se.unstagedFiles??[],c.value=(Se.stagedCount??0)+(Se.unstagedCount??0),V.value=Mt,h.value=nn,W.value=rn,z.value=Date.now(),await R()}catch(K){const Se=K instanceof Error?K.message:"Failed to load git graph";g.value=Se,e.value=[],n.value=[],t.value=[],s.value=[],l.value=[],c.value=0,V.value=[],h.value=[]}finally{S.value=!1}}async function St(){if(B.value)try{const L=await $fetch("/api/git/status",{query:{workingDirectory:B.value}});s.value=L.stagedFiles??[],l.value=L.unstagedFiles??[],c.value=(L.stagedCount??0)+(L.unstagedCount??0)}catch(L){console.error("Failed to refresh uncommitted changes:",L)}}const _t=$(!1);async function Lt(){if(!(!B.value||!b.value||S.value||_t.value)){_t.value=!0;try{const L=await $fetch("/api/git/log",{query:{workingDirectory:B.value,offset:e.value.length}});e.value=[...e.value,...L.commits],b.value=L.hasMore}catch(L){console.error("Failed to load more commits:",L)}finally{_t.value=!1}}}async function vt(L){if(p.value=L,f.value=null,_.value=null,d.value=!1,H.value=!0,!B.value){H.value=!1;return}try{const K=await $fetch("/api/git/show",{query:{workingDirectory:B.value,hash:L.hash}});f.value=K.files,_.value=K.stats}catch(K){console.error("Failed to load commit details:",K),f.value=[],_.value={additions:0,deletions:0,filesChanged:0},xe("Failed to load commit details")}finally{H.value=!1}}function Ot(){p.value=null,f.value=null,_.value=null,d.value=!1}function Tt(){p.value=null,_.value=null,f.value=null,d.value=!0}function Nt(L){M.value=L,oe.value=0,ce()}const U=D(()=>M.value?Co(e.value,M.value).map(L=>L.hash):[]);function ce(){ee.value=U.value.length}function Q(){U.value.length!==0&&(oe.value=(oe.value+1)%U.value.length,ce(),be())}function ue(){U.value.length!==0&&(oe.value=oe.value<=0?U.value.length-1:oe.value-1,ce(),be())}function be(){const L=U.value[oe.value];if(L){const K=e.value.find(Se=>Se.hash===L);K&&vt(K)}}function Te(L){const K=j.value.indexOf(L);K===-1?j.value.push(L):j.value.splice(K,1)}function Be(){M.value="",j.value=[]}async function Oe(L){if(!B.value)return{success:!1,error:"No working directory set"};re.value=!0;try{const K=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:B.value,branchName:L}});return K.success&&await It(B.value),{success:K.success,error:K.error}}catch(K){const Se=K instanceof Error?K.message:"Failed to checkout branch";return xe(Se),{success:!1,error:Se}}finally{re.value=!1}}async function kn(L,K){if(!B.value)return{success:!1,error:"No working directory set"};try{const Se=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:B.value,branchName:L,createBranch:!0,fromCommit:K}});return Se.success&&await It(B.value),{success:Se.success,error:Se.error}}catch(Se){return{success:!1,error:Se instanceof Error?Se.message:"Failed to create branch"}}}async function Qt(L,K=!1){return te("/api/git/branch",{branchName:L,force:K},"Failed to delete branch",{method:"DELETE"})}async function Jt(L){return te("/api/git/branch",{branchName:L,remote:!0},"Failed to delete remote branch",{method:"DELETE"})}async function Cn(L){if(!B.value)return{success:!1,error:"No working directory set"};O.value=!0;try{return await $fetch("/api/git/stage",{method:"POST",body:{workingDirectory:B.value,files:L}}),await St(),{success:!0}}catch(K){const Se=K instanceof Error?K.message:"Failed to stage files";return xe(Se),{success:!1,error:Se}}finally{O.value=!1}}async function Gt(L){if(!B.value)return{success:!1,error:"No working directory set"};O.value=!0;try{return await $fetch("/api/git/unstage",{method:"POST",body:{workingDirectory:B.value,files:L}}),await St(),{success:!0}}catch(K){const Se=K instanceof Error?K.message:"Failed to unstage files";return xe(Se),{success:!1,error:Se}}finally{O.value=!1}}async function mt(L){if(!B.value)return{success:!1,error:"No working directory set"};E.value=!0;try{return await $fetch("/api/git/commit",{method:"POST",body:{workingDirectory:B.value,message:L}}),await It(B.value),{success:!0}}catch(K){const Se=K instanceof Error?K.message:"Failed to commit changes";return xe(Se),{success:!1,error:Se}}finally{E.value=!1}}async function $n(L,K){return te("/api/git/branch-rename",{oldName:L,newName:K},"Failed to rename branch")}async function He(L,K){return te("/api/git/merge",{branch:L,...K},"Failed to merge branch")}async function zt(L){return te("/api/git/rebase",{onto:L},"Failed to rebase branch")}async function ct(L,K,Se,Mt){return te("/api/git/push",{branch:L,remote:K,force:Se,forceWithLease:Mt},"Failed to push branch")}async function vn(L,K,Se,Mt){return te("/api/git/pull",{branch:L,remote:K,noFastForward:Se,squash:Mt},"Failed to pull branch")}async function et(L,K,Se){return te("/api/git/fetch",{branch:L,remote:K,...Se},"Failed to fetch")}async function an(L,K,Se){return te("/api/git/cherry-pick",{hash:L,recordOrigin:K,noCommit:Se},"Failed to cherry-pick commit")}async function ut(L){return te("/api/git/revert",{hash:L},"Failed to revert commit")}async function bt(L,K){return te("/api/git/reset",{hash:L,mode:K},"Failed to reset to commit")}async function Ve(L){if(!B.value)return{success:!1,error:"No working directory set"};try{return await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:B.value,branchName:L}}),await It(B.value),{success:!0}}catch(K){const Se=K?.data?.message||K?.statusMessage||K?.message||"Failed to checkout commit";return xe(Se),{success:!1,error:Se}}}async function Ft(L){try{const K=L.message.split(`
|
|
63
|
+
`)[0];return await Un(K),{success:!0}}catch(K){const Se=K?.message||"Failed to copy commit subject";return xe(Se),{success:!1,error:Se}}}async function at(L,K,Se,Mt,nn){return te("/api/git/tag",{name:L,hash:K,annotated:Se,message:Mt,pushToRemote:nn},"Failed to create tag")}async function en(L,K){return te("/api/git/tag",{name:L,deleteFromRemote:K},"Failed to delete tag",{method:"DELETE"})}async function it(L,K){return te("/api/git/tag-push",{name:L,remote:K},"Failed to push tag")}async function ln(L){if(!B.value)return{success:!1,error:"No working directory set"};try{return{success:!0,data:await $fetch(`/api/git/tag/${encodeURIComponent(L)}`,{query:{workingDirectory:B.value}})}}catch(K){const Se=sr(K,"Failed to get tag detail");return xe(Se),{success:!1,error:Se}}}async function Qe(L){try{return await Un(L),{success:!0}}catch(K){const Se=K?.message||"Failed to copy tag name";return xe(Se),{success:!1,error:Se}}}async function gn(){if(!B.value)return{success:!1,error:"No working directory set"};try{const L=await $fetch("/api/git/stash",{query:{workingDirectory:B.value}});return V.value=L.stashes,{success:!0}}catch(L){const K=sr(L,"Failed to load stashes");return xe(K),{success:!1,error:K}}}async function dt(L,K){return te("/api/git/stash-apply",{index:L,reinstateIndex:K},"Failed to apply stash")}async function tn(L,K){return te("/api/git/stash-pop",{index:L,reinstateIndex:K},"Failed to pop stash")}async function ft(L){return te("/api/git/stash-drop",{index:L},"Failed to drop stash")}async function Sn(L,K){return te("/api/git/stash-branch",{index:L,branchName:K},"Failed to create branch from stash")}async function ye(L,K){return te("/api/git/stash",{message:L,includeUntracked:K},"Failed to stash changes")}async function A(){if(!B.value)return{success:!1,error:"No working directory set"};try{const L=await $fetch("/api/git/remotes",{query:{workingDirectory:B.value}});return h.value=L.remotes,{success:!0}}catch(L){const K=sr(L,"Failed to load remotes");return xe(K),{success:!1,error:K}}}async function ie(L,K){return te("/api/git/remote",{name:L,url:K},"Failed to add remote")}async function ve(L,K){return te("/api/git/remote",{name:L,newUrl:K},"Failed to edit remote",{method:"PUT"})}async function qe(L){return te("/api/git/remote",{name:L},"Failed to delete remote",{method:"DELETE"})}async function We(L,K){return te("/api/git/fetch",{all:!0,prune:L,pruneTags:K},"Failed to fetch all")}function Ze(){J.value=J.value==="inline"?"bottom":"inline"}function ht(){X.value=X.value==="list"?"tree":"list"}function rt(L){se.value=L}function Ht(){Z.value=!Z.value}function gt(L){Y.value={...Y.value,[L]:!Y.value[L]}}async function lt(L){if(ae.value=L,le.value=null,L&&B.value)try{const K=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:L}});le.value=K.mergeBase}catch{le.value=null}}async function Vt(L,K){if(Me.value=L,ze.value=null,Je.value=K??null,L&&B.value)try{const Se=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:L,baseBranch:K??void 0}});ze.value=Se.mergeBase}catch{ze.value=null}}async function k(L,K){if(he.value=L,ne.value=null,Ce.value=K??null,L&&B.value)try{const Se=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:L,baseBranch:K??void 0}});ne.value=Se.mergeBase}catch{ne.value=null}}async function R(){if(!B.value)return;const L=[];ae.value&&L.push((async()=>{try{const K=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:ae.value}});le.value=K.mergeBase}catch{le.value=null}})()),Me.value&&L.push((async()=>{try{const K=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:Me.value,baseBranch:Je.value??void 0}});ze.value=K.mergeBase}catch{ze.value=null}})()),he.value&&L.push((async()=>{try{const K=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:he.value,baseBranch:Ce.value??void 0}});ne.value=K.mergeBase}catch{ne.value=null}})()),L.length>0&&await Promise.all(L)}function T(L){const K=e.value.find(Se=>Se.hash===L||Se.shortHash===L);K&&vt(K)}async function N(L){return te("/api/git/reset",{hash:"HEAD",mode:L},"Failed to reset working directory")}async function v(){return te("/api/git/clean",{},"Failed to clean untracked files")}function x(L){y.value=L}function pe(){y.value=null}function _e(L){F.value=L}function Le(){F.value=null}const tt=$(null),yt=$(null),xn=$(!1),cn=D(()=>!!m.value&&!!p.value);function Sr(L){m.value=L,L&&p.value&&tr()}function _r(){m.value=null,tt.value=null,yt.value=null,xn.value=!1}async function tr(){if(!(!B.value||!p.value||!m.value)){xn.value=!0;try{const L=m.value.hash,K=p.value.hash,Se=await $fetch("/api/git/diff",{query:{workingDirectory:B.value,from:L,to:K}});tt.value=Se.files,yt.value=Se.stats}catch(L){console.error("Failed to load comparison:",L),xe("Failed to load commit comparison"),tt.value=null,yt.value=null}finally{xn.value=!1}}}async function Un(L){navigator?.clipboard&&await navigator.clipboard.writeText(L)}async function jn(L,K){De.value=K,Fe.value=L,je.value=null,Ke.value=!0,await zn()}function Ee(){De.value=null,Fe.value=null,je.value=null,Ke.value=!1}async function zn(){if(!B.value||!Fe.value||!De.value){Ke.value=!1;return}Ke.value=!0;try{const L=await $fetch("/api/git/file-diff",{query:{workingDirectory:B.value,commitHash:Fe.value,filePath:De.value.path}});je.value=L}catch(L){console.error("Failed to load file diff:",L),xe("Failed to load file diff"),je.value=null}finally{Ke.value=!1}}function Rn(){e.value=[],n.value=[],t.value=[],a.value=new Set,s.value=[],l.value=[],c.value=0,d.value=!1,p.value=null,f.value=null,_.value=null,S.value=!1,g.value=null,b.value=!1,w.value=0,M.value="",j.value=[],B.value=null,z.value=null,G.value=!1,I.value=!1,W.value=null,_t.value=!1,H.value=!1,O.value=!1,E.value=!1,re.value=!1,V.value=[],h.value=[],m.value=null,tt.value=null,yt.value=null,xn.value=!1,y.value=null,F.value=null,J.value="inline",X.value="list",se.value="rounded",Z.value=!1,Y.value={date:!0,author:!0,commit:!0},oe.value=0,ee.value=0,ae.value=null,Me.value=null,ze.value=null,Je.value=null,he.value=null,ne.value=null,Ce.value=null,De.value=null,Fe.value=null,je.value=null,Ke.value=!1,ke(),ot.clear()}async function ho(){if(!B.value||I.value||S.value)return!1;I.value=!0;try{const L=(await $fetch("/api/git/state",{query:{workingDirectory:B.value}})).state,K=W.value;if(W.value=L,z.value=Date.now(),!K)return!1;const Se=K.headCommit!==L.headCommit||K.branchListHash!==L.branchListHash,Mt=K.workingTreeHash!==L.workingTreeHash,nn=K.stashListHash!==L.stashListHash;if(Se){const[yn,nr,As]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:B.value}}),$fetch("/api/git/status",{query:{workingDirectory:B.value}}),$fetch("/api/git/stash",{query:{workingDirectory:B.value}}).then(Bs=>Bs.stashes).catch(()=>[])]);return e.value=yn.commits,n.value=yn.branches,t.value=yn.tags,a.value=new Set(yn.localBranches??[]),b.value=yn.hasMore,w.value=yn.totalCount,s.value=nr.stagedFiles??[],l.value=nr.unstagedFiles??[],c.value=(nr.stagedCount??0)+(nr.unstagedCount??0),V.value=As,await R(),!0}if(!Mt&&!nn)return!1;const[rn,bn]=await Promise.all([Mt?$fetch("/api/git/status",{query:{workingDirectory:B.value}}):Promise.resolve(null),nn?$fetch("/api/git/stash",{query:{workingDirectory:B.value}}).then(yn=>yn.stashes).catch(()=>[]):Promise.resolve(null)]);return rn&&(s.value=rn.stagedFiles??[],l.value=rn.unstagedFiles??[],c.value=(rn.stagedCount??0)+(rn.unstagedCount??0)),bn&&(V.value=bn),!0}catch(L){return console.error("Failed to refresh git graph:",L),!1}finally{I.value=!1}}function Ts(){G.value=!0}function Ms(){G.value=!1}return{commits:$e(e),branches:$e(n),tags:$e(t),localBranchNames:$e(a),stagedFiles:$e(s),unstagedFiles:$e(l),uncommittedChangesCount:$e(c),isUncommittedChangesSelected:$e(d),selectedCommit:$e(p),selectedCommitFiles:$e(f),selectedCommitStats:$e(_),loading:$e(S),loadingMore:$e(_t),error:$e(g),hasMore:$e(b),totalCount:$e(w),searchQuery:$e(M),filteredBranches:$e(j),workingDirectory:$e(B),stashes:$e(V),remotes:$e(h),comparisonCommit:$e(m),comparisonFiles:$e(tt),comparisonStats:$e(yt),comparisonLoading:$e(xn),isComparing:cn,activeDialog:$e(y),activeContextMenu:$e(F),detailViewPosition:$e(J),fileViewMode:$e(X),graphStyle:$e(se),muteNonAncestral:$e(Z),columnVisibility:$e(Y),searchResultIndex:$e(oe),searchResultCount:$e(ee),selectedFeatureId:$e(ae),featureMergeBase:$e(le),conversationBranch:$e(Me),conversationMergeBase:$e(ze),conversationBaseBranch:$e(Je),previewBranch:$e(he),previewMergeBase:$e(ne),previewBaseBranch:$e(Ce),diffViewerFile:$e(De),diffViewerCommitHash:$e(Fe),diffViewerContent:$e(je),diffViewerLoading:$e(Ke),lastRefreshTime:$e(z),isPollingActive:$e(G),isRefreshing:$e(I),isLoadingDetails:$e(H),isStaging:$e(O),isCommitting:$e(E),isCheckingOut:$e(re),operationError:$e(me),filteredCommits:Xt,currentBranch:st,searchResultHashes:U,loadGitGraph:It,loadMoreCommits:Lt,refreshUncommittedChanges:St,selectCommit:vt,selectUncommittedChanges:Tt,clearSelection:Ot,setSearchQuery:Nt,toggleBranchFilter:Te,clearFilters:Be,nextSearchResult:Q,prevSearchResult:ue,checkoutBranch:Oe,createBranch:kn,deleteLocalBranch:Qt,deleteRemoteBranch:Jt,stageFiles:Cn,unstageFiles:Gt,commitChanges:mt,reset:Rn,clearOperationError:ke,renameBranch:$n,mergeBranch:He,rebaseBranch:zt,pushBranch:ct,pullBranch:vn,fetchBranch:et,cherryPickCommit:an,revertCommit:ut,resetToCommit:bt,checkoutCommit:Ve,copyCommitSubject:Ft,createTag:at,deleteTag:en,pushTag:it,getTagDetail:ln,copyTagName:Qe,loadStashes:gn,applyStash:dt,popStash:tn,dropStash:ft,stashBranch:Sn,stashChanges:ye,loadRemotes:A,addRemote:ie,editRemote:ve,deleteRemote:qe,fetchAll:We,setActiveDialog:x,clearActiveDialog:pe,setActiveContextMenu:_e,clearActiveContextMenu:Le,selectComparisonCommit:Sr,clearComparison:_r,loadComparisonData:tr,copyToClipboard:Un,toggleDetailViewPosition:Ze,toggleFileViewMode:ht,setGraphStyle:rt,toggleMuteNonAncestral:Ht,toggleColumnVisibility:gt,navigateToCommit:T,resetWorking:N,cleanUntracked:v,setSelectedFeatureId:lt,setConversationBranch:Vt,setPreviewBranch:k,openFileDiff:jn,closeFileDiff:Ee,checkAndRefresh:ho,startPolling:Ts,stopPolling:Ms}});async function Nu(){if(typeof window>"u")return{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};try{const e=await $fetch("/api/conversations");if(!e||!Array.isArray(e.conversations))return console.warn("[conversationStorage] Invalid data structure from server"),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};e.version!==fr&&console.warn(`[conversationStorage] Storage version mismatch: ${e.version} vs ${fr}`);const n=e.conversations.map(p=>{if(!p||typeof p!="object")return p;const f=p;return"claudeSessionId"in f&&!("providerSessionId"in f)?{...f,providerSessionId:f.claudeSessionId}:p}),a=(Array.isArray(e.archivedConversations)?e.archivedConversations:[]).map(p=>{if(!p||typeof p!="object")return p;const f=p;return"claudeSessionId"in f&&!("providerSessionId"in f)?{...f,providerSessionId:f.claudeSessionId}:p}),s=n.filter(Fs),l=a.filter(Hs),c=n.length-s.length,d=a.length-l.length;return c>0&&console.warn(`[conversationStorage] Discarded ${c} corrupted active conversation(s)`),d>0&&console.warn(`[conversationStorage] Discarded ${d} corrupted archive conversation(s)`),{conversations:s,archivedConversations:l,discardedConversations:c,discardedArchives:d}}catch(e){return console.error("[conversationStorage] Failed to load conversations:",e),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0}}}async function Fu(e,n=[]){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations",{method:"POST",body:{version:fr,conversations:e,archivedConversations:n}}),!0}catch(t){return console.error("Failed to save conversations:",t),!1}}async function No(e){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations/update",{method:"POST",body:{version:fr,conversation:e}}),!0}catch(n){return console.error("Failed to save conversation:",n),!1}}function Hu(e){return e?e.map(n=>{switch(n.type){case"text":return n.text;case"tool_use":return`[${n.name}] ${n.inputSummary}`;case"tool_result":return n.isError?`Error: ${n.content.slice(0,100)}`:"";case"thinking":case"result_summary":case"session_init":return"";default:return""}}).filter(Boolean).join(`
|
|
64
|
+
`):""}const Yt=qr("chat",()=>{const e=$(!1),n=$(Os),t=$("ask"),a=$(""),s=$([]),l=$([]),c=$(null),d=$("active"),p=$(new Set),f=new Map,_=$(!1),S=$(0),g=new Map,b=1200,w=$(null),M=$(null);function j(k){return k?f.get(k)??null:null}function B(k){let R=f.get(k);return R||(R={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},f.set(k,R)),R}const H=D(()=>s.value.find(k=>k.id===c.value)||null),O=D(()=>H.value?.messages??[]),E=D(()=>(S.value,j(c.value)?.session??null)),re=D(()=>(S.value,j(c.value)?.pendingPermission??null)),me=D(()=>(S.value,j(c.value)?.pendingPlanApproval??null)),fe=D(()=>(S.value,j(c.value)?.lastError??null)),xe=D(()=>(S.value,j(c.value)?.debugEvents??[])),ke=D(()=>E.value?.status==="streaming"),te=D(()=>H.value?.providerSessionId??""),z=D(()=>O.value.length>0),G=D(()=>O.value[O.value.length-1]||null);function I(k){return p.value.has(k)}const W=D(()=>c.value?p.value.has(c.value):!1),V=D(()=>s.value.length>0),h=D(()=>l.value.length>0),m=D(()=>s.value.length),y=D(()=>m.value>=go),F=D(()=>s.value),J=D(()=>l.value),X=D(()=>w.value&&s.value.find(k=>k.id===w.value)||null);function se(k){return w.value===k}function Z(k){d.value=k}async function Y(k){if(!(!k?.previewBranch||!k.worktreePath))try{const R=await $fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:k.previewBranch,worktreePath:k.worktreePath}});if(!R.success)throw new Error(R.error||"Unknown preview sync failure")}catch(R){console.warn("[chat] Failed to sync preview branch after worktree update",{conversationId:k.id,previewBranch:k.previewBranch,worktreePath:k.worktreePath,error:R instanceof Error?R.message:String(R)})}}async function oe(k){if(I(k))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(T=>T.id===k)===-1)return{success:!1,error:"Conversation not found"};try{const T=await $fetch(`/api/conversations/${k}/archive`,{method:"POST"});if(T.success&&T.archived){const N=g.get(k);return N&&(clearTimeout(N),g.delete(k)),f.delete(k),s.value=Array.isArray(T.conversations)?T.conversations:s.value.filter(v=>v.id!==k),l.value=Array.isArray(T.archivedConversations)?T.archivedConversations:[T.archived,...l.value],en(),w.value===k&&(w.value=null),c.value===k&&(c.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:c.value}}).catch(v=>{console.error("Failed to save active conversation:",v)}),{success:!0}}return{success:!1,error:"Failed to archive conversation"}}catch(T){return{success:!1,error:T instanceof Error?T.message:"Failed to archive conversation"}}}async function ee(k,R){if(Ht().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${xo}.`};if(!l.value.some(N=>N.id===k))return{success:!1,error:"Archived conversation not found"};try{const N=await $fetch(`/api/conversations/archives/${k}/restore`,{method:"POST",body:{baseBranch:R}});return N.success&&N.conversation?(s.value=Array.isArray(N.conversations)?N.conversations:[N.conversation,...s.value],Array.isArray(N.archivedConversations)?l.value=N.archivedConversations:l.value=l.value.filter(v=>v.id!==k),d.value="active",ln(N.conversation.id),at(),bt(),{success:!0,conversationId:N.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(N){return{success:!1,error:N instanceof Error?N.message:"Failed to restore archived conversation"}}}async function ae(k){const R=l.value.findIndex(T=>T.id===k);if(R===-1)return{success:!1,error:"Archived conversation not found"};try{const T=await $fetch(`/api/conversations/archives/${k}`,{method:"DELETE"});return T.success?(Array.isArray(T.archivedConversations)?l.value=T.archivedConversations:l.value.splice(R,1),en(),{success:!0}):{success:!1,error:"Failed to delete archived conversation"}}catch{return l.value.splice(R,1),bt(),{success:!0}}}async function le(){if(!(typeof window>"u"))try{const k=await $fetch("/api/settings");if(k){if(typeof k.panelWidth=="number"){const N=k.panelWidth;N>=bo&&N<=yo&&(n.value=N)}typeof k.isPanelOpen=="boolean"&&(e.value=k.isPanelOpen),typeof k.activeConversationId=="string"&&(c.value=k.activeConversationId);const{useSettingsStore:R}=await _n(async()=>{const{useSettingsStore:N}=await import("./DqVSe5UI.js").then(v=>v.s);return{useSettingsStore:N}},__vite__mapDeps([0,1,2]),import.meta.url),T=R();await T.hydrate(),t.value=T.permissionMode}}catch(k){console.error("Failed to load chat settings:",k)}}function Me(k){t.value=k,typeof window<"u"&&_n(async()=>{const{useSettingsStore:R}=await import("./DqVSe5UI.js").then(T=>T.s);return{useSettingsStore:R}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:R})=>{R().setPermissionMode(k)})}function ze(k,R){const T=R??c.value;if(!T)return;const N=B(T);N.pendingPermission=k,S.value++}function Je(k){const R=k??c.value;if(!R)return;const T=f.get(R);T&&(T.pendingPermission=null,S.value++)}function he(k,R){const T=R??c.value;if(!T)return;const N=B(T);N.pendingPlanApproval=k,S.value++}function ne(k){const R=k??c.value;if(!R)return;const T=f.get(R);T&&(T.pendingPlanApproval=null,S.value++)}function Ce(){e.value=!e.value,je()}function De(){e.value=!0,je()}function Fe(){e.value=!1,je()}function je(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:e.value}}).catch(k=>{console.error("Failed to save panel state:",k)})}function Ke(k){const R=Math.max(bo,Math.min(yo,k));n.value=R,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:R}}).catch(T=>{console.error("Failed to save panel width:",T)})}function ot(k){a.value=k}function jt(k,R){const T=R??c.value;if(!T)return;const N=s.value.find(v=>v.id===T);N&&(N.providerSessionId=k)}function Xt(k,R){const T=s.value.find(N=>N.id===k);T&&(T.worktreeBranch=R,T.lastCommitTime=new Date().toISOString())}async function st(k){const R=s.value.find(N=>N.id===k);if(!R?.worktreeBranch)return null;const T=R.worktreeBranch.trim();if(!T)return null;try{const v=(await $fetch("/api/specs/features")).features.find(x=>x.id===T);return v?(R.featureId!==v.id&&(R.featureId=v.id,R.updatedAt=new Date().toISOString(),bt()),v.id):null}catch(N){return console.warn("[chat] Failed to map branch to feature",{conversationId:k,branchName:T,error:N instanceof Error?N.message:String(N)}),null}}function It(k,R,T){const N=s.value.find(v=>v.id===k);N&&(N.providerId=R,N.providerModelKey=T)}function St(k){const R=k??c.value;if(!R)return;const T=s.value.find(N=>N.id===R);T&&(T.providerSessionId="")}function _t(k){return s.value.find(T=>T.id===k)?.providerSessionId??""}function Lt(k){p.value.add(k)}function vt(k){p.value.delete(k)}function Ot(k,R){const T=R??c.value;if(!T)return;const N=s.value.find(v=>v.id===T);N&&N.messages.push(k)}function Tt(k,R,T){const N={id:wo(),role:"user",content:k,attachments:T&&T.length>0?T:void 0,timestamp:new Date().toISOString()};return Ot(N,R),N}function Nt(k){const R={id:wo(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return Ot(R,k),R}function U(k,R,T){const N=T??c.value;if(!N)return;const v=s.value.find(pe=>pe.id===N);if(!v)return;const x=v.messages.findIndex(pe=>pe.id===k);x!==-1&&(v.messages[x]={...v.messages[x],...R})}function ce(k,R,T){const N=T??c.value;if(!N)return;const v=s.value.find(pe=>pe.id===N);if(!v)return;const x=v.messages.findIndex(pe=>pe.id===k);x!==-1&&(v.messages[x].content+=R)}function Q(k,R,T){const N=T??c.value;if(!N)return;const v=s.value.find(pe=>pe.id===N);if(!v)return;const x=v.messages.findIndex(pe=>pe.id===k);if(x!==-1){const pe=v.messages[x],_e=pe.tools?[...pe.tools,R]:[R];v.messages[x]={...pe,tools:_e}}}function ue(k,R,T,N){const v=N??c.value;if(!v)return;const x=s.value.find(_e=>_e.id===v);if(!x)return;const pe=x.messages.findIndex(_e=>_e.id===k);if(pe!==-1){const _e=x.messages[pe];if(_e.tools){const Le=_e.tools.findIndex(tt=>tt.id===R);if(Le!==-1){const tt=[..._e.tools];tt[Le]={...tt[Le],...T},x.messages[pe]={..._e,tools:tt}}}}Ve(v,!1)}function be(k){k.contentBlocks&&(k.content=Hu(k.contentBlocks))}function Te(k,R){if(k.type!==R.type)return!0;switch(R.type){case"text":return k.text!==R.text;case"tool_use":{const T=k;return T.name!==R.name||T.inputSummary!==R.inputSummary}case"tool_result":{const T=k;return T.content!==R.content||T.isError!==R.isError}default:return!1}}function Be(k,R){const T=R??c.value;if(!T)return;const N=s.value.find(x=>x.id===T);if(!N)return;const v=N.messages.find(x=>x.id===k);v&&!v.contentBlocks&&(v.contentBlocks=[])}function Oe(k,R,T){const N=T??c.value;if(!N)return;const v=s.value.find(pe=>pe.id===N);if(!v)return;const x=v.messages.find(pe=>pe.id===k);x&&(x.contentBlocks||(x.contentBlocks=[]),x.contentBlocks.push(R),be(x))}function kn(k,R,T,N){const v=N??c.value;if(!v)return;const x=s.value.find(yt=>yt.id===v);if(!x)return;const pe=x.messages.find(yt=>yt.id===k);if(!pe?.contentBlocks)return;const _e=pe.contentBlocks.findIndex(yt=>yt.id===R);if(_e===-1)return;const tt={...pe.contentBlocks[_e]};T(tt),pe.contentBlocks[_e]=tt}function Qt(k,R,T,N,v){const x=N??c.value;if(!x)return;const pe=s.value.find(cn=>cn.id===x);if(!pe)return;const _e=pe.messages.find(cn=>cn.id===k);if(!_e?.contentBlocks)return;const Le=_e.contentBlocks.findIndex(cn=>cn.id===R);if(Le===-1)return;const tt=_e.contentBlocks[Le],yt={...tt};T(yt),_e.contentBlocks[Le]=yt,v?.syncContent!==!1&&Te(tt,yt)&&be(_e),Ve(x,!1)}function Jt(k,R,T){const N=T??c.value;if(!N)return;const v=s.value.find(pe=>pe.id===N);if(!v)return;const x=v.messages.find(pe=>pe.id===k);x&&(x.contentBlocks||(x.contentBlocks=[]),x.contentBlocks.push(R),be(x),Ve(N,!1))}function Cn(k,R,T){const N=T??c.value;if(!N)return null;const v=s.value.find(pe=>pe.id===N);if(!v)return null;const x=v.messages.find(pe=>pe.id===k);return x?.contentBlocks?x.contentBlocks.find(pe=>pe.type==="tool_use"&&pe.toolUseId===R)??null:null}function Gt(k,R){const T=R??c.value;if(!T)return;const N=f.get(T);N?.session&&(N.session.status=k,S.value++)}function mt(k,R){const T=R??c.value;if(!T)return;const N=B(T);N.session={sessionId:k,cwd:a.value,status:"streaming",startedAt:new Date().toISOString()},N.lastError=null,S.value++}function $n(k){const R=k??c.value;if(!R)return;const T=f.get(R);T?.session&&(T.session.status="idle",S.value++)}function He(k,R){const T=R??c.value;if(!T)return;const N=B(T);N.session&&(N.session.status="error",N.session.error=k),N.lastError=k,S.value++}function zt(k,R){if(!_.value)return;const T=R??c.value;if(!T)return;const N=B(T),v=(()=>{if(typeof k.payload=="string")return k.payload;try{return JSON.stringify(k.payload,null,2)}catch{return String(k.payload)}})(),x=8e3,pe=300,_e=v.length>x?`${v.slice(0,x)}
|
|
65
|
+
... (truncated)`:v;N.debugEvents.push({id:`dbg-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,timestamp:new Date().toISOString(),direction:k.direction,channel:k.channel,eventType:k.eventType||"unknown",payload:_e}),N.debugEvents.length>pe&&N.debugEvents.splice(0,N.debugEvents.length-pe),S.value++}function ct(k){_.value=k}function vn(k){const R=k??c.value;if(!R)return;const T=f.get(R);T&&(T.debugEvents=[],S.value++)}function et(){if(!c.value)return;const k=s.value.find(T=>T.id===c.value);k&&(k.messages=[]);const R=c.value;f.delete(R),S.value++}function an(k){const R=k??c.value;if(!R)return;const T=f.get(R);T&&(T.lastError=null,T.session&&(T.session.error=void 0),S.value++)}async function ut(){const k=await Nu();if(s.value=k.conversations,l.value=k.archivedConversations,k.discardedArchives>0&&console.warn(`[chat] Skipped ${k.discardedArchives} corrupted archived conversation(s)`),at(),en(),!w.value){const R=s.value.find(T=>!!T.previewBranch&&!T.finalized);R&&(w.value=R.id)}if(c.value){const R=s.value.find(T=>T.id===c.value);R&&R.cwd?a.value=R.cwd:R||(c.value=null,e.value=!1)}}function bt(){Fu(s.value,l.value)}function Ve(k,R=!1){const T=s.value.find(N=>N.id===k);if(T)if(R){const N=g.get(k);N&&(clearTimeout(N),g.delete(k)),T.updatedAt=new Date().toISOString(),No(T)}else{if(g.get(k))return;const v=setTimeout(()=>{T.updatedAt=new Date().toISOString(),No(T),g.delete(k)},b);g.set(k,v)}}function Ft(k=!1){c.value&&Ve(c.value,k)}function at(){s.value.sort((k,R)=>new Date(R.createdAt).getTime()-new Date(k.createdAt).getTime())}function en(){l.value.sort((k,R)=>new Date(R.archivedAt).getTime()-new Date(k.archivedAt).getTime())}async function it(k){if(Ht().atLimit)return"";const T=Us();let N=null;if(k?.featureId){const _e=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:T,featureId:k.featureId,baseBranch:k.baseBranch}});if(!_e.success&&_e.error)throw new Error(_e.error);N=_e}let v=null;if(typeof window<"u")try{const{useSettingsStore:_e}=await _n(async()=>{const{useSettingsStore:tt}=await import("./DqVSe5UI.js").then(yt=>yt.s);return{useSettingsStore:tt}},__vite__mapDeps([0,1,2]),import.meta.url),Le=_e();await Le.hydrate(),v=Le.providerSelection}catch(_e){console.warn("[chat] Failed to load provider selection for new conversation",_e)}const x=v||{providerId:Go,modelKey:Wo},pe={id:T,title:"New Conversation",messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:a.value||process.cwd?.()||"",featureId:k?.featureId,providerId:x.providerId,providerModelKey:x.modelKey};if(N?.success&&N.worktreePath&&N.branch&&(pe.worktreePath=N.worktreePath,pe.worktreeBranch=N.branch,pe.cwd=N.worktreePath,pe.hasWorktree=!0,N.baseBranch&&(pe.baseBranch=N.baseBranch)),s.value.unshift(pe),c.value=T,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:T}}).catch(_e=>{console.error("Failed to save active conversation:",_e)}),!k?.featureId)try{const _e=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:T,baseBranch:k?.baseBranch}});if(_e.success&&_e.worktreePath&&_e.branch){const Le=s.value.find(tt=>tt.id===T);Le&&(Le.worktreePath=_e.worktreePath,Le.worktreeBranch=_e.branch,Le.cwd=_e.worktreePath,Le.hasWorktree=!0,_e.baseBranch&&(Le.baseBranch=_e.baseBranch))}}catch(_e){console.warn("[chat] Failed to create worktree for conversation",T,_e)}return bt(),T}function ln(k){const R=s.value.find(T=>T.id===k);R&&(c.value=k,e.value=!0,R.cwd&&(a.value=R.cwd),!R.featureId&&R.worktreeBranch&&st(k),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:k,isPanelOpen:!0}}).catch(T=>{console.error("Failed to save active conversation:",T)}))}async function Qe(k){const R=s.value.findIndex(v=>v.id===k);if(R===-1)return;const T=s.value[R];if(w.value===k&&(w.value=null),T.hasWorktree&&T.worktreePath&&T.worktreeBranch)try{await $fetch("/api/chat/worktree",{method:"DELETE",body:{worktreePath:T.worktreePath,branch:T.worktreeBranch}})}catch(v){console.warn("[chat] Failed to clean up worktree for conversation",k,v)}s.value.splice(R,1),f.delete(k);const N=g.get(k);N&&(clearTimeout(N),g.delete(k)),c.value===k&&(c.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(v=>{console.error("Failed to clear active conversation:",v)})),bt()}async function gn(k,R,T){const N=s.value.find(x=>x.id===k);if(!N)return{success:!1,error:"Conversation not found"};if(!N.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const v=T||N.baseBranch;try{const x=await $fetch("/api/chat/finalize",{method:"POST",body:{conversationId:k,commitMessage:R,baseBranch:v,worktreePath:N.worktreePath,worktreeBranch:N.worktreeBranch,previewBranch:N.previewBranch}});return x.success?(w.value===k&&(w.value=null),N.worktreePath=void 0,N.worktreeBranch=void 0,N.hasWorktree=!1,N.baseBranch=void 0,N.previewBranch=void 0,N.finalized=!0,N.updatedAt=new Date().toISOString(),bt()):x.rebaseInProgress&&x.conflictFiles?.length&&await tn(k,N.worktreePath,v||"main",R),x}catch(x){return{success:!1,error:x instanceof Error?x.message:String(x)}}}async function dt(k,R){const T=s.value.find(v=>v.id===k);if(!T)return{success:!1,error:"Conversation not found"};if(!T.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const N=R||T.baseBranch;try{const v=await $fetch("/api/chat/rebase",{method:"POST",body:{conversationId:k,baseBranch:N,worktreePath:T.worktreePath}});return v.rebaseInProgress&&v.conflictFiles?.length?await tn(k,T.worktreePath,N||"main","","sync"):v.success&&(await Y(T),T.baseBranch=N,bt()),v}catch(v){return{success:!1,error:v instanceof Error?v.message:String(v)}}}async function tn(k,R,T,N,v="finalize"){M.value={conversationId:k,worktreePath:R,baseBranch:T,commitMessage:N,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:v};try{const x=await $fetch("/api/rebase/conflicts",{params:{worktreePath:R}});M.value&&(M.value.files=x.files,M.value.loading=!1)}catch(x){M.value&&(M.value.error=x instanceof Error?x.message:String(x),M.value.loading=!1)}}async function ft(k,R){if(!M.value)return!1;try{const T=await $fetch("/api/rebase/resolve",{method:"PUT",body:{worktreePath:M.value.worktreePath,filePath:k,content:R}});return T.success&&M.value&&M.value.resolvedFiles.add(k),T.success}catch{return!1}}async function Sn(){if(!M.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:k,commitMessage:R,baseBranch:T,mode:N,worktreePath:v}=M.value,x=N==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue";try{const pe=s.value.find(Le=>Le.id===k),_e=await $fetch(x,{method:"POST",body:{conversationId:k,commitMessage:R,baseBranch:T,worktreePath:v,worktreeBranch:pe?.worktreeBranch,previewBranch:pe?.previewBranch}});if(_e.success){if(N==="finalize"){w.value===k&&(w.value=null);const Le=s.value.find(tt=>tt.id===k);Le&&(Le.worktreePath=void 0,Le.worktreeBranch=void 0,Le.hasWorktree=!1,Le.baseBranch=void 0,Le.previewBranch=void 0,Le.finalized=!0,Le.updatedAt=new Date().toISOString(),bt())}else if(N==="sync"){const Le=s.value.find(tt=>tt.id===k);Le&&(await Y(Le),Le.baseBranch=T,Le.updatedAt=new Date().toISOString(),bt())}M.value=null}else _e.rebaseInProgress&&_e.conflictFiles?.length&&await tn(k,v,T,R,N);return _e}catch(pe){return{success:!1,error:pe instanceof Error?pe.message:String(pe)}}}async function ye(){if(!M.value)return!1;try{const k=await $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:M.value.worktreePath}});return M.value=null,k.success}catch{return M.value=null,!1}}async function A(k){if(!M.value)return!1;const R=M.value.files.find(T=>T.path===k);if(!R)return!1;try{const T=await $fetch("/api/rebase/ai-resolve",{method:"POST",body:{worktreePath:M.value.worktreePath,filePath:k,conflictContent:R.content}});return T.success&&T.resolvedContent!==void 0?(R.content=T.resolvedContent,await ft(k,T.resolvedContent)):!1}catch{return!1}}async function ie(){if(!M.value)return;const k=M.value.files.filter(R=>!M.value.resolvedFiles.has(R.path));for(const R of k)await A(R.path)}async function ve(k){const R=s.value.find(T=>T.id===k);if(!R)return{success:!1,error:"Conversation not found"};if(!R.hasWorktree||!R.worktreePath||!R.baseBranch)return{success:!1,error:"No worktree to preview"};try{const T=await $fetch("/api/chat/preview",{method:"POST",body:{conversationId:k,worktreePath:R.worktreePath,baseBranch:R.baseBranch}});return T.success&&T.previewBranch&&(R.previewBranch=T.previewBranch,w.value=k,R.updatedAt=new Date().toISOString(),bt()),{success:T.success,error:T.error}}catch(T){return{success:!1,error:T instanceof Error?T.message:String(T)}}}async function qe(k){const R=s.value.find(T=>T.id===k);if(!R)return{success:!1,error:"Conversation not found"};if(!R.previewBranch||!R.baseBranch)return w.value=null,{success:!1,error:"No active preview"};try{const T=await $fetch("/api/chat/preview",{method:"DELETE",body:{previewBranch:R.previewBranch,baseBranch:R.baseBranch}});return T.success&&(R.previewBranch=void 0,w.value=null,R.updatedAt=new Date().toISOString(),bt()),{success:T.success,error:T.error}}catch(T){return{success:!1,error:T instanceof Error?T.message:String(T)}}}async function We(k){if(w.value===k)return await qe(k);if(w.value){const R=await qe(w.value);if(!R.success)return{success:!1,error:`Failed to end previous preview: ${R.error}`}}return await ve(k)}function Ze(k){const R=k.trim();if(!R)return null;const T=s.value.filter(N=>N.featureId===R?!0:N.worktreeBranch?.trim()===R);return T.length===0?null:T.sort((N,v)=>new Date(v.updatedAt).getTime()-new Date(N.updatedAt).getTime())[0]||null}function ht(k,R){const T=s.value.find(N=>N.id===k);T&&(T.title=R.trim(),T.updatedAt=new Date().toISOString(),at(),bt())}function rt(k){const R=c.value;if(!R)return;const T=s.value.find(v=>v.id===R);if(!T||T.title!=="New Conversation")return;const N=T.messages.find(v=>v.role==="user");N&&(N.content.trim().length>0?T.title=js(N.content):N.attachments&&N.attachments.length>0&&(T.title=N.attachments.length===1?"[Image] New Conversation":`[${N.attachments.length} Images] New Conversation`))}function Ht(){const k=s.value.length;return{atLimit:k>=xo,nearLimit:k>=go,count:k}}async function gt(k,R){c.value||await it();const T=Tt(k,void 0,R);return rt(),Ft(!0),T}function lt(k,R,T){const N=T??c.value;ce(k,R,N??void 0),N&&Ve(N,!1)}function Vt(k,R){const T=R??c.value;U(k,{status:"complete"},T??void 0),T&&Ve(T,!0)}return{messages:O,session:E,isPanelOpen:e,panelWidth:$e(n),permissionMode:$e(t),pendingPermission:re,pendingPlanApproval:me,cwd:$e(a),lastError:fe,debugEvents:xe,debugStreamEnabled:$e(_),providerSessionId:te,conversations:$e(s),archivedConversations:$e(l),activeConversationId:$e(c),conversationViewMode:$e(d),conflictState:$e(M),previewingConversationId:$e(w),isStreaming:ke,hasMessages:z,lastMessage:G,isActiveConversationStreaming:W,hasConversations:V,hasArchivedConversations:h,activeConversation:H,conversationCount:m,isNearStorageLimit:y,sortedConversations:F,sortedArchivedConversations:J,previewingConversation:X,streamingConversations:$e(p),initialize:le,togglePanel:Ce,openPanel:De,closePanel:Fe,setPanelWidth:Ke,setPermissionMode:Me,setPendingPermission:ze,clearPendingPermission:Je,setPendingPlanApproval:he,clearPendingPlanApproval:ne,setCwd:ot,setProviderSessionId:jt,clearProviderSession:St,getProviderSessionId:_t,updateWorktreeBranch:Xt,setConversationProviderSelection:It,startConversationStreaming:Lt,endConversationStreaming:vt,isConversationStreaming:I,addMessage:Ot,addUserMessage:Tt,addAssistantMessage:Nt,updateMessage:U,appendToMessage:ce,addToolToMessage:Q,updateToolInMessage:ue,initContentBlocks:Be,appendContentBlock:Oe,appendContentBlockWithSave:Jt,updateBlockById:kn,updateBlockWithSave:Qt,findToolUseBlock:Cn,syncContentFromBlocks:be,setSessionStatus:Gt,startSession:mt,endSession:$n,setSessionError:He,setDebugStreamEnabled:ct,pushDebugEvent:zt,clearDebugEvents:vn,clearMessages:et,clearError:an,loadConversations:ut,saveAllConversations:bt,saveCurrentConversation:Ft,saveConversation:Ve,createConversation:it,selectConversation:ln,deleteConversation:Qe,archiveConversation:oe,restoreArchivedConversation:ee,deleteArchivedConversation:ae,setConversationViewMode:Z,findConversationByFeature:Ze,syncConversationFeatureFromBranch:st,renameConversation:ht,checkStorageLimits:Ht,finalizeConversation:gn,rebaseConversation:dt,resolveConflictFile:ft,continueRebase:Sn,abortRebase:ye,aiResolveConflictFile:A,aiResolveAllConflicts:ie,previewConversation:ve,unpreviewConversation:qe,togglePreview:We,isConversationPreviewing:se,addUserMessageWithConversation:gt,appendToMessageWithSave:lt,completeMessageWithSave:Vt}});function Ou(e={}){const n=Cr(),t=300,a=5e3,s=250;let l=null,c=null,d=null,p=null,f=null,_=!1,S=!1;const g=$(!1),b=$(!1);let w=e;function M(G){w=G}async function j(){const G=w.getScrollPosition?.()??0,I=await n.checkAndRefresh();return I&&w.setScrollPosition&&(await Kt(),w.setScrollPosition(G)),I}function B(){return g.value||!!n.activeContextMenu||!!n.activeDialog}async function H(){if(B()){b.value=!0;return}E()}async function O(){if(_){S=!0;return}_=!0;try{await j()}finally{_=!1,S&&(S=!1,E())}}function E(){c&&clearTimeout(c),c=setTimeout(()=>{c=null,O()},s)}function re(G){if(typeof window>"u")return;if(d&&d.readyState===WebSocket.OPEN){d.send(JSON.stringify({type:"watch",workingDirectory:G}));return}p&&(clearTimeout(p),p=null);const W=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;d=new WebSocket(W),d.onopen=()=>{d.send(JSON.stringify({type:"watch",workingDirectory:G}))},d.onmessage=V=>{try{JSON.parse(V.data).type==="git_changed"&&H()}catch{}},d.onclose=()=>{d=null,n.isPollingActive&&f&&(p=setTimeout(()=>{f&&re(f)},a))},d.onerror=()=>{}}function me(){p&&(clearTimeout(p),p=null),d&&(d.close(),d=null)}function fe(G){G&&(f=G),!n.isPollingActive&&(n.startPolling(),f&&re(f))}function xe(){me(),n.stopPolling()}function ke(){g.value=!0,l&&(clearTimeout(l),l=null)}function te(){l&&clearTimeout(l),l=setTimeout(async()=>{g.value=!1,b.value&&(b.value=!1,E())},t)}function z(){xe(),l&&(clearTimeout(l),l=null),c&&(clearTimeout(c),c=null),_=!1,S=!1,f=null}return Pe(()=>[n.activeContextMenu,n.activeDialog],()=>{!n.activeContextMenu&&!n.activeDialog&&b.value&&!g.value&&(b.value=!1,E())}),{isUserInteracting:$e(g),isDeferredRefresh:$e(b),startPolling:fe,stopPolling:xe,startInteraction:ke,endInteraction:te,cleanup:z,setScrollCallbacks:M}}function Uu(e){function n(s){if((s.ctrlKey||s.metaKey)&&s.key==="h"){s.preventDefault(),e.onScrollToHead();return}if(s.key==="Escape"){s.preventDefault(),e.onEscape();return}}function t(){document.addEventListener("keydown",n)}function a(){document.removeEventListener("keydown",n)}return{start:t,stop:a}}const ju={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},zu={class:"text-sm font-mono text-retro-cyan"},Vu={class:"text-xs font-mono text-retro-text mt-1 truncate"},Wu={class:"space-y-3"},Gu={class:"flex items-start gap-2 cursor-pointer group"},qu={class:"flex items-start gap-2 cursor-pointer group"},Ku=Ae({__name:"CherryPickDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=$(!1),s=$(!1);function l(){t("confirm",{recordOrigin:a.value,noCommit:s.value})}function c(){a.value=!1,s.value=!1,t("close")}return(d,p)=>(i(),de(Dt,{title:"Cherry-Pick Commit",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Cherry-Pick",onClose:c,onConfirm:l},{default:nt(()=>[r("div",ju,[p[2]||(p[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),r("div",zu,C(e.commitHash.slice(0,7)),1),r("div",Vu,C(e.commitMessage.split(`
|
|
66
|
+
`)[0]),1)]),r("div",Wu,[r("label",Gu,[Ne(r("input",{"onUpdate:modelValue":p[0]||(p[0]=f=>Ge(a)?a.value=f:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ut,o(a)]]),p[3]||(p[3]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Record origin (-x) "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"},' Append "(cherry picked from commit ...)" to the commit message ')],-1))]),r("label",qu,[Ne(r("input",{"onUpdate:modelValue":p[1]||(p[1]=f=>Ge(s)?s.value=f:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ut,o(s)]]),p[4]||(p[4]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," No commit "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Apply changes to the working directory without committing ")],-1))])])]),_:1},8,["visible","loading","error"]))}}),Zu={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Yu={class:"text-sm font-mono text-retro-cyan"},Xu={class:"mb-4"},Qu={class:"flex items-start gap-2 cursor-pointer group"},Ju=Ae({__name:"CreateBranchDialog",props:{visible:{type:Boolean},fromCommit:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=$(""),s=$(!0),l=D(()=>a.value.trim().length>0);function c(){l.value&&t("confirm",{name:a.value.trim(),checkout:s.value})}function d(){a.value="",s.value=!0,t("close")}return(p,f)=>(i(),de(Dt,{title:"Create Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Create Branch",onClose:d,onConfirm:c},{default:nt(()=>[r("div",Zu,[f[2]||(f[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"From",-1)),r("div",Yu,C(e.fromCommit.slice(0,7)),1)]),r("div",Xu,[f[3]||(f[3]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Branch name",-1)),Ne(r("input",{"onUpdate:modelValue":f[0]||(f[0]=_=>Ge(a)?a.value=_:null),type:"text",placeholder:"feature/my-branch",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[Ct,o(a)]])]),r("label",Qu,[Ne(r("input",{"onUpdate:modelValue":f[1]||(f[1]=_=>Ge(s)?s.value=_:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ut,o(s)]]),f[4]||(f[4]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Switch to new branch "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Checkout the branch after creating it ")],-1))])]),_:1},8,["visible","loading","error"]))}}),ed=Ae({__name:"CleanUntrackedDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n;return(a,s)=>(i(),de(Dt,{title:"Clean Untracked Files",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Clean","confirm-danger":"",onClose:s[0]||(s[0]=l=>t("close")),onConfirm:s[1]||(s[1]=l=>t("confirm"))},{default:nt(()=>[...s[2]||(s[2]=[r("div",{class:"space-y-3"},[r("p",{class:"text-retro-text text-sm font-mono"}," Remove all untracked files and directories from the working tree. "),r("p",{class:"text-retro-muted text-xs font-mono"},[Re(" This runs "),r("code",null,"git clean -fd"),Re(" and cannot be undone. ")])],-1)])]),_:1},8,["visible","loading","error"]))}}),td={class:"text-retro-text text-sm font-mono mb-2"},nd={class:"text-retro-cyan"},rd={class:"space-y-3 mt-4"},od={class:"flex items-center gap-2 cursor-pointer"},sd=Ae({__name:"DeleteBranchDialog",props:{visible:{type:Boolean},branchName:{},isLocal:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=$(!1);function l(){a("confirm",{force:s.value})}return Pe(()=>t.visible,c=>{c&&(s.value=!1)}),(c,d)=>(i(),de(Dt,{title:"Delete Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Delete","confirm-danger":!0,onClose:d[1]||(d[1]=p=>a("close")),onConfirm:l},{default:nt(()=>[d[4]||(d[4]=r("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),r("p",td,[Re(" Delete "+C(e.isLocal?"local":"remote")+" branch ",1),r("span",nd,C(e.branchName),1),d[2]||(d[2]=Re("? ",-1))]),r("div",rd,[r("label",od,[Ne(r("input",{"onUpdate:modelValue":d[0]||(d[0]=p=>Ge(s)?s.value=p:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(s)]]),d[3]||(d[3]=r("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),ad={class:"text-retro-text text-sm font-mono mb-4"},id={class:"text-retro-cyan"},ld={class:"space-y-3"},cd={class:"flex items-center gap-2 cursor-pointer"},ud={class:"flex items-center gap-2 cursor-pointer"},dd={class:"flex items-center gap-2 cursor-pointer"},fd=Ae({__name:"MergeDialog",props:{visible:{type:Boolean},branchName:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=$(!1),l=$(!1),c=$(!1);function d(){a("confirm",{noCommit:s.value,noFastForward:l.value,squash:c.value})}return Pe(()=>t.visible,p=>{p&&(s.value=!1,l.value=!1,c.value=!1)}),(p,f)=>(i(),de(Dt,{title:"Merge Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Merge",onClose:f[3]||(f[3]=_=>a("close")),onConfirm:d},{default:nt(()=>[r("p",ad,[f[4]||(f[4]=Re(" Merge ",-1)),r("span",id,C(e.branchName),1),f[5]||(f[5]=Re(" into current branch ",-1))]),r("div",ld,[r("label",cd,[Ne(r("input",{"onUpdate:modelValue":f[0]||(f[0]=_=>Ge(s)?s.value=_:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(s)]]),f[6]||(f[6]=r("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),r("label",ud,[Ne(r("input",{"onUpdate:modelValue":f[1]||(f[1]=_=>Ge(l)?l.value=_:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(l)]]),f[7]||(f[7]=r("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),r("label",dd,[Ne(r("input",{"onUpdate:modelValue":f[2]||(f[2]=_=>Ge(c)?c.value=_:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(c)]]),f[8]||(f[8]=r("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),md={class:"text-retro-text text-sm font-mono mb-4"},hd={class:"text-retro-cyan"},pd={class:"space-y-3"},vd=["value"],gd={class:"flex items-center gap-2 cursor-pointer"},xd={class:"flex items-center gap-2 cursor-pointer"},bd=Ae({__name:"PullDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=$("origin"),l=$(!1),c=$(!1);function d(){a("confirm",{remote:s.value,noFastForward:l.value,squash:c.value})}return Pe(()=>t.visible,p=>{p&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",l.value=!1,c.value=!1)}),(p,f)=>(i(),de(Dt,{title:"Pull Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Pull",onClose:f[3]||(f[3]=_=>a("close")),onConfirm:d},{default:nt(()=>[r("p",md,[f[4]||(f[4]=Re(" Pull ",-1)),r("span",hd,C(e.branchName),1),f[5]||(f[5]=Re(" from remote ",-1))]),r("div",pd,[r("div",null,[f[6]||(f[6]=r("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),Ne(r("select",{"onUpdate:modelValue":f[0]||(f[0]=_=>Ge(s)?s.value=_:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(i(!0),u(ge,null,Ie(e.remotes,_=>(i(),u("option",{key:_,value:_},C(_),9,vd))),128))],512),[[Bn,o(s)]])]),r("label",gd,[Ne(r("input",{"onUpdate:modelValue":f[1]||(f[1]=_=>Ge(l)?l.value=_:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(l)]]),f[7]||(f[7]=r("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),r("label",xd,[Ne(r("input",{"onUpdate:modelValue":f[2]||(f[2]=_=>Ge(c)?c.value=_:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(c)]]),f[8]||(f[8]=r("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),yd={class:"text-retro-text text-sm font-mono mb-4"},wd={class:"text-retro-cyan"},kd={class:"space-y-3"},Cd=["value"],$d={class:"flex items-center gap-2 cursor-pointer"},Sd=["checked"],_d={class:"flex items-center gap-2 cursor-pointer"},Td=["checked"],Md={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},Ad=Ae({__name:"PushDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=$("origin"),l=$(!1),c=$(!1);function d(_){l.value=_,_&&(c.value=!1)}function p(_){c.value=_,_&&(l.value=!1)}function f(){a("confirm",{remote:s.value,force:l.value,forceWithLease:c.value})}return Pe(()=>t.visible,_=>{_&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",l.value=!1,c.value=!1)}),(_,S)=>(i(),de(Dt,{title:"Push Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Push",onClose:S[3]||(S[3]=g=>a("close")),onConfirm:f},{default:nt(()=>[r("p",yd,[S[4]||(S[4]=Re(" Push ",-1)),r("span",wd,C(e.branchName),1),S[5]||(S[5]=Re(" to remote ",-1))]),r("div",kd,[r("div",null,[S[6]||(S[6]=r("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),Ne(r("select",{"onUpdate:modelValue":S[0]||(S[0]=g=>Ge(s)?s.value=g:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(i(!0),u(ge,null,Ie(e.remotes,g=>(i(),u("option",{key:g,value:g},C(g),9,Cd))),128))],512),[[Bn,o(s)]])]),r("label",$d,[r("input",{checked:o(l),type:"checkbox",class:"accent-retro-cyan",onChange:S[1]||(S[1]=g=>d(g.target.checked))},null,40,Sd),S[7]||(S[7]=r("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),r("label",_d,[r("input",{checked:o(c),type:"checkbox",class:"accent-retro-cyan",onChange:S[2]||(S[2]=g=>p(g.target.checked))},null,40,Td),S[8]||(S[8]=r("span",{class:"text-retro-muted text-sm"},"Force with lease (safer force push)",-1))]),o(l)||o(c)?(i(),u("div",Md,C(o(l)?"Force push will overwrite remote history. Use with caution.":"Force with lease will reject the push if the remote has been updated since your last fetch."),1)):P("",!0)])]),_:1},8,["visible","loading","error"]))}}),Bd={class:"text-retro-text text-sm font-mono mb-4"},Ed={class:"text-retro-cyan"},Rd={class:"text-retro-cyan"},Pd={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},Dd={class:"text-retro-cyan"},Id={class:"text-retro-cyan"},Ld=Ae({__name:"RebaseDialog",props:{visible:{type:Boolean},branchName:{},ontoBranch:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n;return(a,s)=>(i(),de(Dt,{title:"Rebase Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Rebase",onClose:s[0]||(s[0]=l=>t("close")),onConfirm:s[1]||(s[1]=l=>t("confirm"))},{default:nt(()=>[r("p",Bd,[s[2]||(s[2]=Re(" Rebase ",-1)),r("span",Ed,C(e.branchName),1),s[3]||(s[3]=Re(" onto ",-1)),r("span",Rd,C(e.ontoBranch),1)]),r("div",Pd,[s[4]||(s[4]=Re(" This will rewrite commit history. Commits from ",-1)),r("span",Dd,C(e.branchName),1),s[5]||(s[5]=Re(" will be replayed on top of ",-1)),r("span",Id,C(e.ontoBranch),1),s[6]||(s[6]=Re(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),Nd={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Fd={class:"text-sm font-mono text-retro-cyan"},Hd={class:"text-xs font-mono text-retro-text mt-1 truncate"},Od={class:"space-y-2"},Ud=["value"],jd={key:0,class:"mt-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},zd=Ae({__name:"ResetDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=$("mixed"),s=[{value:"soft",label:"Soft",description:"Move HEAD, keep staged changes and working directory"},{value:"mixed",label:"Mixed",description:"Move HEAD, reset staging area, keep working directory"},{value:"hard",label:"Hard",description:"Move HEAD, reset staging area and working directory (DESTRUCTIVE)"}];function l(){t("confirm",{mode:a.value})}function c(){a.value="mixed",t("close")}return(d,p)=>(i(),de(Dt,{title:"Reset to Commit",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Reset","confirm-danger":o(a)==="hard",onClose:c,onConfirm:l},{default:nt(()=>[r("div",Nd,[p[1]||(p[1]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Reset to",-1)),r("div",Fd,C(e.commitHash.slice(0,7)),1),r("div",Hd,C(e.commitMessage.split(`
|
|
67
|
+
`)[0]),1)]),r("div",Od,[p[2]||(p[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-2"},"Reset mode",-1)),(i(),u(ge,null,Ie(s,f=>r("label",{key:f.value,class:we(["flex items-start gap-2 p-2 rounded cursor-pointer group border transition-colors",[o(a)===f.value?"border-retro-cyan bg-retro-cyan/5":"border-transparent hover:bg-retro-panel"]])},[Ne(r("input",{"onUpdate:modelValue":p[0]||(p[0]=_=>Ge(a)?a.value=_:null),type:"radio",name:"reset-mode",value:f.value,class:"mt-0.5 accent-retro-cyan"},null,8,Ud),[[Dr,o(a)]]),r("div",null,[r("span",{class:we(["text-sm font-mono transition-colors",[f.value==="hard"?"text-retro-red":"text-retro-text",o(a)===f.value?"text-retro-cyan":""]])},C(f.label),3),r("p",{class:we(["text-xs font-mono mt-0.5",f.value==="hard"?"text-retro-red/70":"text-retro-muted"])},C(f.description),3)])],2)),64))]),o(a)==="hard"?(i(),u("div",jd," Warning: Hard reset will permanently discard all uncommitted changes in your working directory and staging area. This action cannot be undone. ")):P("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Vd={class:"space-y-3"},Wd={class:"flex items-start gap-2 cursor-pointer"},Gd={class:"flex items-start gap-2 cursor-pointer"},qd={key:0,class:"mt-4 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Kd=Ae({__name:"ResetWorkingDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=$("mixed"),l=D(()=>s.value==="hard");function c(){a("confirm",{mode:s.value})}return Pe(()=>t.visible,d=>{d&&(s.value="mixed")}),(d,p)=>(i(),de(Dt,{title:"Reset Working Directory",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Reset","confirm-danger":o(l),onClose:p[2]||(p[2]=f=>a("close")),onConfirm:c},{default:nt(()=>[p[5]||(p[5]=r("p",{class:"text-retro-text text-sm font-mono mb-4"}," Reset the working directory to HEAD. ",-1)),r("div",Vd,[r("label",Wd,[Ne(r("input",{"onUpdate:modelValue":p[0]||(p[0]=f=>Ge(s)?s.value=f:null),type:"radio",value:"mixed",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Dr,o(s)]]),p[3]||(p[3]=r("div",null,[r("span",{class:"text-retro-text text-sm font-mono"},"Mixed"),r("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area, keep working directory ")],-1))]),r("label",Gd,[Ne(r("input",{"onUpdate:modelValue":p[1]||(p[1]=f=>Ge(s)?s.value=f:null),type:"radio",value:"hard",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Dr,o(s)]]),p[4]||(p[4]=r("div",null,[r("span",{class:"text-retro-text text-sm font-mono"},"Hard"),r("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area AND working directory (DESTRUCTIVE) ")],-1))])]),o(l)?(i(),u("div",qd," WARNING: Hard reset will permanently discard all uncommitted changes. This cannot be undone. ")):P("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Zd={class:"space-y-4"},Yd={class:"flex items-center gap-2 cursor-pointer"},Xd=Ae({__name:"StashDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=$(""),l=$(!1);function c(){a("confirm",{message:s.value.trim()||void 0,includeUntracked:l.value})}return Pe(()=>t.visible,d=>{d&&(s.value="",l.value=!1)}),(d,p)=>(i(),de(Dt,{title:"Stash Changes",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Stash",onClose:p[2]||(p[2]=f=>a("close")),onConfirm:c},{default:nt(()=>[p[5]||(p[5]=r("p",{class:"text-retro-text text-sm font-mono mb-4"}," Save uncommitted changes to the stash. ",-1)),r("div",Zd,[r("div",null,[p[3]||(p[3]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message (optional)",-1)),Ne(r("input",{"onUpdate:modelValue":p[0]||(p[0]=f=>Ge(s)?s.value=f:null),type:"text",placeholder:"Stash description...",class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted/50 focus:outline-none focus:border-retro-cyan"},null,512),[[Ct,o(s)]])]),r("label",Yd,[Ne(r("input",{"onUpdate:modelValue":p[1]||(p[1]=f=>Ge(l)?l.value=f:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(l)]]),p[4]||(p[4]=r("span",{class:"text-retro-muted text-sm"},"Include untracked files",-1))])])]),_:1},8,["visible","loading","error"]))}}),Qd={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Jd={class:"text-sm font-mono text-retro-cyan"},ef={class:"mb-4"},tf={class:"mb-3"},nf={class:"flex items-start gap-2 cursor-pointer group"},rf={key:0,class:"mb-4"},of={class:"space-y-2"},sf={class:"flex items-start gap-2 cursor-pointer group"},af=["disabled"],lf={key:0,class:"ml-6"},cf=["value"],uf=Ae({__name:"TagCreateDialog",props:{visible:{type:Boolean},commitHash:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=$(""),s=$(!1),l=$(""),c=$(!1),d=$(""),p=D(()=>a.value.trim().length>0);function f(){if(!p.value)return;const S={name:a.value.trim(),annotated:s.value};s.value&&l.value.trim()&&(S.message=l.value.trim()),c.value&&d.value&&(S.pushToRemote=d.value),t("confirm",S)}function _(){a.value="",s.value=!1,l.value="",c.value=!1,d.value="",t("close")}return Pe(()=>s.value,S=>{S||(l.value="")}),(S,g)=>(i(),de(Dt,{title:"Create Tag",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Create Tag",onClose:_,onConfirm:f},{default:nt(()=>[r("div",Qd,[g[5]||(g[5]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"At commit",-1)),r("div",Jd,C(e.commitHash.slice(0,7)),1)]),r("div",ef,[g[6]||(g[6]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag name",-1)),Ne(r("input",{"onUpdate:modelValue":g[0]||(g[0]=b=>Ge(a)?a.value=b:null),type:"text",placeholder:"v1.0.0",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[Ct,o(a)]])]),r("div",tf,[r("label",nf,[Ne(r("input",{"onUpdate:modelValue":g[1]||(g[1]=b=>Ge(s)?s.value=b:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ut,o(s)]]),g[7]||(g[7]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Annotated tag "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Create a full tag object with message and tagger info ")],-1))])]),o(s)?(i(),u("div",rf,[g[8]||(g[8]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag message",-1)),Ne(r("textarea",{"onUpdate:modelValue":g[2]||(g[2]=b=>Ge(l)?l.value=b:null),rows:"3",placeholder:"Release description...",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none"},null,512),[[Ct,o(l)]])])):P("",!0),r("div",of,[r("label",sf,[Ne(r("input",{"onUpdate:modelValue":g[3]||(g[3]=b=>Ge(c)?c.value=b:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan",disabled:e.remotes.length===0},null,8,af),[[Ut,o(c)]]),r("div",null,[r("span",{class:we(["text-sm font-mono transition-colors",e.remotes.length===0?"text-retro-muted":"text-retro-text group-hover:text-retro-cyan"])}," Push to remote ",2)])]),o(c)&&e.remotes.length>0?(i(),u("div",lf,[Ne(r("select",{"onUpdate:modelValue":g[4]||(g[4]=b=>Ge(d)?d.value=b:null),class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[g[9]||(g[9]=r("option",{value:"",disabled:"",class:"text-retro-muted"},"Select remote",-1)),(i(!0),u(ge,null,Ie(e.remotes,b=>(i(),u("option",{key:b,value:b},C(b),9,cf))),128))],512),[[Bn,o(d)]])])):P("",!0)])]),_:1},8,["visible","loading","error"]))}}),df={class:"text-retro-text text-sm font-mono mb-2"},ff={class:"text-retro-cyan"},mf={class:"space-y-3 mt-4"},hf={class:"flex items-center gap-2 cursor-pointer"},pf={key:0,class:"ml-6"},vf=["value"],gf=Ae({__name:"TagDeleteDialog",props:{visible:{type:Boolean},tagName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=$(!1),l=$("origin");function c(){a("confirm",{deleteFromRemote:s.value,remote:s.value?l.value:void 0})}return Pe(()=>t.visible,d=>{d&&(s.value=!1,l.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin")}),(d,p)=>(i(),de(Dt,{title:"Delete Tag",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Delete","confirm-danger":!0,onClose:p[2]||(p[2]=f=>a("close")),onConfirm:c},{default:nt(()=>[p[7]||(p[7]=r("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),r("p",df,[p[3]||(p[3]=Re(" Delete tag ",-1)),r("span",ff,C(e.tagName),1),p[4]||(p[4]=Re("? ",-1))]),r("div",mf,[r("label",hf,[Ne(r("input",{"onUpdate:modelValue":p[0]||(p[0]=f=>Ge(s)?s.value=f:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(s)]]),p[5]||(p[5]=r("span",{class:"text-retro-muted text-sm"},"Also delete from remote",-1))]),o(s)?(i(),u("div",pf,[p[6]||(p[6]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Remote",-1)),Ne(r("select",{"onUpdate:modelValue":p[1]||(p[1]=f=>Ge(l)?l.value=f:null),class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[(i(!0),u(ge,null,Ie(e.remotes,f=>(i(),u("option",{key:f,value:f},C(f),9,vf))),128))],512),[[Bn,o(l)]])])):P("",!0)])]),_:1},8,["visible","loading","error"]))}}),xf={class:"mb-4"},bf={class:"text-retro-cyan text-sm font-mono"},yf={class:"mb-4"},wf={class:"text-retro-text text-sm font-mono"},kf={class:"mb-4"},Cf={class:"text-retro-text text-sm font-mono break-all select-all"},$f={class:"mb-4"},Sf={class:"text-retro-text text-sm font-mono"},_f={class:"text-retro-muted"},Tf={class:"mb-4"},Mf={class:"text-retro-text text-sm font-mono"},Af={key:1,class:"mb-2"},Bf={class:"p-2 text-sm font-mono text-retro-text bg-retro-panel border border-retro-border rounded whitespace-pre-wrap"},Ef={key:1,class:"text-retro-muted text-sm font-mono text-center py-4"},Rf=Ae({__name:"TagDetailDialog",props:{visible:{type:Boolean},tagName:{},tagDetail:{},loading:{type:Boolean,default:!1}},emits:["close"],setup(e,{emit:n}){const t=n;return(a,s)=>(i(),de(Dt,{title:"Tag Details",visible:e.visible,loading:e.loading,"confirm-label":"Close","cancel-label":"Close",onClose:s[0]||(s[0]=l=>t("close")),onConfirm:s[1]||(s[1]=l=>t("close"))},{default:nt(()=>[r("div",xf,[s[2]||(s[2]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tag",-1)),r("p",bf,C(e.tagName),1)]),e.tagDetail?(i(),u(ge,{key:0},[r("div",yf,[s[3]||(s[3]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Type",-1)),r("p",wf,C(e.tagDetail.isAnnotated?"Annotated":"Lightweight"),1)]),r("div",kf,[s[4]||(s[4]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Hash",-1)),r("p",Cf,C(e.tagDetail.hash),1)]),e.tagDetail.tagger?(i(),u(ge,{key:0},[r("div",$f,[s[5]||(s[5]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tagger",-1)),r("p",Sf,[Re(C(e.tagDetail.tagger.name)+" ",1),r("span",_f,"<"+C(e.tagDetail.tagger.email)+">",1)])]),r("div",Tf,[s[6]||(s[6]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Date",-1)),r("p",Mf,C(e.tagDetail.tagger.date),1)])],64)):P("",!0),e.tagDetail.message?(i(),u("div",Af,[s[7]||(s[7]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message",-1)),r("div",Bf,C(e.tagDetail.message),1)])):P("",!0)],64)):e.loading?(i(),u("div",Ef," Loading tag details... ")):P("",!0)]),_:1},8,["visible","loading"]))}}),fo=globalThis.setInterval,Pf={class:"h-full flex flex-col bg-retro-dark",role:"region","aria-label":"Git Graph"},Df={key:0,class:"flex-1 flex flex-col items-center justify-center gap-3"},If={key:1,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Lf={key:2,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Nf={class:"text-retro-red text-sm mb-4"},Ff={key:3,class:"flex-1 flex items-center justify-center p-4"},Hf={class:"flex-shrink-0 flex items-center gap-2 p-2 border-b border-retro-border"},Of={class:"relative"},Uf={key:0,class:"absolute left-0 top-full mt-1 z-10 bg-retro-panel border border-retro-border rounded shadow-lg py-2 min-w-[200px]"},jf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},zf=["checked"],Vf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Wf=["checked"],Gf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},qf=["checked"],Kf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Zf=["checked"],Yf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Xf=["checked"],Qf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Jf=["checked"],em={class:"relative"},tm=["aria-expanded"],nm={key:0,class:"text-xs"},rm={key:0,class:"absolute right-0 top-full mt-1 z-10 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px] max-h-[400px] overflow-auto"},om=["checked","onChange"],sm={class:"text-sm text-retro-text truncate"},am={key:0,class:"text-[10px] text-retro-cyan"},im={class:"px-3 py-1 text-[10px] text-retro-orange font-semibold uppercase tracking-wider mt-1"},lm=["checked","onChange"],cm={class:"text-sm text-retro-text truncate"},um={class:"relative"},dm={key:0,class:"absolute right-0 top-full mt-1 z-20"},fm=["title"],mm={class:"text-retro-muted text-sm"},hm={class:"text-retro-cyan font-mono"},pm={class:"space-y-3"},vm={class:"text-retro-muted text-sm"},gm={class:"text-retro-cyan font-mono"},xm={class:"space-y-3"},bm={class:"text-retro-muted text-sm"},ym={class:"text-retro-magenta font-mono"},wm={key:0,class:"fixed bottom-4 right-4 z-50 flex items-center gap-2 px-4 py-2.5 text-sm bg-retro-red/90 text-white rounded-lg shadow-lg max-w-sm",role:"alert"},km={class:"flex-1"},Cm=Ae({__name:"GitGraph",props:{workingDirectory:{},isActive:{type:Boolean,default:!0}},setup(e){const n=e,t=Cr(),a=Yt(),s=Ou(),l=D(()=>{const v=a.activeConversation?.worktreeBranch;return v?[v]:[]}),c=D(()=>{const v=[],x=t.selectedFeatureId;x&&v.push(x);const pe=t.conversationBranch;return pe&&!v.includes(pe)&&v.push(pe),v});Pe(()=>[a.activeConversation?.worktreeBranch,a.activeConversation?.baseBranch],([v,x])=>{t.setConversationBranch(v??null,x??null)},{immediate:!0});const d=D(()=>{const v=t.previewBranch;return v?[v]:[]});Pe(()=>[a.previewingConversation?.worktreeBranch,a.previewingConversation?.baseBranch],([v,x])=>{t.setPreviewBranch(v??null,x??null)},{immediate:!0});const p=D(()=>{const v={};return t.previewBranch&&t.previewMergeBase&&(v[t.previewBranch]=t.previewMergeBase),v}),f=D(()=>{const v={};return t.selectedFeatureId&&t.featureMergeBase&&(v[t.selectedFeatureId]=t.featureMergeBase),t.conversationBranch&&t.conversationMergeBase&&(v[t.conversationBranch]=t.conversationMergeBase),v}),_=D(()=>t.remotes.map(v=>v.name)),S=$(null);Pe(()=>n.workingDirectory,async v=>{if(v){await t.loadGitGraph(v);const x=a.previewingConversation?.worktreeBranch;x&&await t.setPreviewBranch(x,a.previewingConversation?.baseBranch??null);const pe=a.activeConversation?.worktreeBranch;pe&&await t.setConversationBranch(pe,a.activeConversation?.baseBranch??null)}},{immediate:!0}),Pe(()=>n.isActive,v=>{v&&t.commits.length>0&&!t.error?s.startPolling(n.workingDirectory):s.stopPolling()},{immediate:!0}),Pe(()=>t.commits.length,v=>{v>0&&n.isActive&&!t.error&&s.startPolling(n.workingDirectory)}),Pe(()=>S.value,v=>{v&&s.setScrollCallbacks({getScrollPosition:()=>v.getScrollPosition(),setScrollPosition:x=>v.setScrollPosition(x)})}),kt(()=>{s.cleanup(),t.reset()});const g=D(()=>t.error?.includes("Not a Git repository")),b=$(Date.now());let w=null;const M=()=>{w||(w=fo(()=>{b.value=Date.now()},5e3))},j=()=>{w&&(clearInterval(w),w=null)};xt(()=>{Pe(()=>n.isActive,v=>{v?(b.value=Date.now(),M()):j()},{immediate:!0})}),kt(()=>{j()});const B=D(()=>{const v=t.lastRefreshTime;if(!v)return null;const x=Math.floor((b.value-v)/1e3);return t.isRefreshing?"Syncing...":x<5?"Just now":x<60?`${x}s ago`:`${Math.floor(x/60)}m ago`}),H=$(!1),O=$(!1),E=$(null);function re(){H.value=!0,Kt(()=>E.value?.focus())}function me(){H.value=!1,t.setSearchQuery("")}function fe(v){t.setSearchQuery(v)}const xe=Uu({onScrollToHead:()=>{const v=t.commits.find(x=>x.isHead);v&&t.selectCommit(v)},onEscape:()=>{ke.value?ke.value=!1:O.value?O.value=!1:te.value?te.value=!1:H.value?me():t.isComparing?t.clearComparison():(t.selectedCommit||t.isUncommittedChangesSelected)&&t.clearSelection()}});xt(()=>{xe.start()}),kt(()=>{xe.stop()});const ke=$(!1),te=$(!1);async function z(){await t.fetchAll(!0)}async function G(v){await t.addRemote(v.name,v.url)}async function I(v){await t.editRemote(v.name,v.newUrl)}async function W(v){await t.deleteRemote(v)}const V=D(()=>{const v=[],x={};for(const pe of t.branches)if(t.localBranchNames.has(pe.name))v.push(pe);else{const _e=pe.name.indexOf("/");if(_e>0){const Le=pe.name.substring(0,_e);x[Le]||(x[Le]=[]),x[Le].push(pe)}else v.push(pe)}return{local:v,remotes:x}}),h=$({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function m(v){h.value={visible:!0,...v},t.setActiveContextMenu({type:"branch",props:v,position:{x:v.x,y:v.y}})}function y(){h.value.visible=!1,t.clearActiveContextMenu()}function F(){y(),mt.value={visible:!0,branchName:h.value.branch,loading:!1,error:null}}function J(){const v=h.value.branch;y(),et.value={visible:!0,branchName:v,newName:v,loading:!1,error:null}}function X(){const{branch:v,isLocal:x}=h.value;y(),ct.value={visible:!0,branchName:v,isLocal:x,force:!1,loading:!1,error:null}}function se(){const v=h.value.branch;y(),ut.value={visible:!0,branchName:v,loading:!1,error:null}}function Z(){const v=h.value.branch;y(),Ve.value={visible:!0,branchName:v,loading:!1,error:null}}function Y(){const v=h.value.branch;y(),at.value={visible:!0,branchName:v,loading:!1,error:null}}function oe(){const v=h.value.branch;y(),it.value={visible:!0,branchName:v,loading:!1,error:null}}async function ee(){const v=h.value.branch;y(),await t.fetchBranch(v)}async function ae(){const v=h.value.branch;y(),await t.copyToClipboard(v),k(h.value.x,h.value.y)}function le(){y(),He.value={visible:!0,fromCommit:h.value.commitHash,loading:!1,error:null}}const Me=$({visible:!1,commit:null,x:0,y:0});function ze(v){Me.value={visible:!0,commit:v.commit,x:v.x,y:v.y},t.setActiveContextMenu({type:"commit",props:v,position:{x:v.x,y:v.y}})}function Je(){Me.value.visible=!1,t.clearActiveContextMenu()}function he(v){const x=Me.value.commit;if(!x)return!1;Je();const pe=v(x);return pe&&typeof pe.then=="function"?pe.then(()=>!0):!0}function ne(){he(v=>{ft.value={visible:!0,commitHash:v.hash,loading:!1,error:null}})}function Ce(){he(v=>{He.value={visible:!0,fromCommit:v.hash,loading:!1,error:null}})}function De(){he(v=>{mt.value={visible:!0,branchName:v.hash,loading:!1,error:null}})}function Fe(){he(v=>{Qe.value={visible:!0,commitHash:v.hash,commitMessage:v.message,loading:!1,error:null}})}async function je(){await he(v=>t.revertCommit(v.hash))}function Ke(){he(v=>{ut.value={visible:!0,branchName:v.shortHash,loading:!1,error:null}})}function ot(){he(v=>{dt.value={visible:!0,commitHash:v.hash,commitMessage:v.message,loading:!1,error:null}})}async function jt(){const{x:v,y:x}=Me.value;await he(_e=>t.copyToClipboard(_e.hash))&&k(v,x)}async function Xt(){await he(v=>t.copyCommitSubject(v))}const st=$({visible:!1,tag:"",x:0,y:0,commitHash:""});function It(v){st.value={visible:!0,...v},t.setActiveContextMenu({type:"tag",props:v,position:{x:v.x,y:v.y}})}function St(){st.value.visible=!1,t.clearActiveContextMenu()}async function _t(){const v=st.value.tag;St(),ie.value={visible:!0,tagName:v,loading:!0,tagDetail:null};const x=await t.getTagDetail(v);ie.value.loading=!1,x.success&&x.data&&(ie.value.tagDetail=x.data)}function Lt(){const v=st.value.tag;St(),ye.value={visible:!0,tagName:v,loading:!1,error:null}}async function vt(){const v=st.value.tag;St(),await t.pushTag(v)}async function Ot(){const v=st.value.tag;St(),await t.copyToClipboard(v),k(st.value.x,st.value.y)}const Tt=$({visible:!1,x:0,y:0});function Nt(){Tt.value.visible=!1,t.clearActiveContextMenu()}function U(){Nt(),ve.value={visible:!0,loading:!1,error:null}}function ce(){Nt(),rt.value={visible:!0,loading:!1,error:null}}async function Q(){Nt(),gt.value={visible:!0,loading:!1,error:null}}const ue=$({visible:!1,stash:null,x:0,y:0});function be(v){ue.value={visible:!0,stash:v.stash,x:v.x,y:v.y},t.setActiveContextMenu({type:"stash",props:v,position:{x:v.x,y:v.y}})}function Te(){ue.value.visible=!1,t.clearActiveContextMenu()}function Be(v){const x=ue.value.stash;if(!x)return!1;Te();const pe=v(x);return pe&&typeof pe.then=="function"?pe.then(()=>!0):!0}async function Oe(){await Be(v=>t.applyStash(v.index))}async function kn(){await Be(v=>t.popStash(v.index))}async function Qt(){await Be(v=>t.dropStash(v.index))}function Jt(){Be(v=>{We.value={visible:!0,stashIndex:v.index,loading:!1,error:null}})}async function Cn(){const{x:v,y:x}=ue.value;await Be(_e=>t.copyToClipboard(`stash@{${_e.index}}`))&&k(v,x)}async function Gt(){const{x:v,y:x}=ue.value;await Be(_e=>t.copyToClipboard(_e.hash))&&k(v,x)}const mt=$({visible:!1,branchName:"",loading:!1,error:null});async function $n(){mt.value.loading=!0,mt.value.error=null;const v=await t.checkoutBranch(mt.value.branchName);mt.value.loading=!1,v.success?mt.value.visible=!1:mt.value.error=v.error||"Unknown error"}const He=$({visible:!1,fromCommit:"",loading:!1,error:null});async function zt(v){He.value.loading=!0,He.value.error=null;const x=await t.createBranch(v.name,He.value.fromCommit);He.value.loading=!1,x.success?(v.checkout&&await t.checkoutBranch(v.name),He.value.visible=!1):He.value.error=x.error||"Unknown error"}const ct=$({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function vn(v){ct.value.loading=!0,ct.value.error=null;const{branchName:x,isLocal:pe}=ct.value,_e=v?.force??ct.value.force,Le=pe?await t.deleteLocalBranch(x,_e):await t.deleteRemoteBranch(x);ct.value.loading=!1,Le.success?ct.value.visible=!1:ct.value.error=Le.error||"Unknown error"}const et=$({visible:!1,branchName:"",newName:"",loading:!1,error:null});async function an(){if(!et.value.newName.trim()){et.value.error="Branch name is required";return}et.value.loading=!0,et.value.error=null;const v=await t.renameBranch(et.value.branchName,et.value.newName.trim());et.value.loading=!1,v.success?et.value.visible=!1:et.value.error=v.error||"Unknown error"}const ut=$({visible:!1,branchName:"",loading:!1,error:null});async function bt(v){ut.value.loading=!0,ut.value.error=null;const x=await t.mergeBranch(ut.value.branchName,v);ut.value.loading=!1,x.success?ut.value.visible=!1:ut.value.error=x.error||"Unknown error"}const Ve=$({visible:!1,branchName:"",loading:!1,error:null});async function Ft(){Ve.value.loading=!0,Ve.value.error=null;const v=await t.rebaseBranch(Ve.value.branchName);Ve.value.loading=!1,v.success?Ve.value.visible=!1:Ve.value.error=v.error||"Unknown error"}const at=$({visible:!1,branchName:"",loading:!1,error:null});async function en(v){at.value.loading=!0,at.value.error=null;const x=await t.pushBranch(at.value.branchName,v.remote,v.force,v.forceWithLease);at.value.loading=!1,x.success?at.value.visible=!1:at.value.error=x.error||"Unknown error"}const it=$({visible:!1,branchName:"",loading:!1,error:null});async function ln(v){it.value.loading=!0,it.value.error=null;const x=await t.pullBranch(it.value.branchName,v.remote,v.noFastForward,v.squash);it.value.loading=!1,x.success?it.value.visible=!1:it.value.error=x.error||"Unknown error"}const Qe=$({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function gn(v){Qe.value.loading=!0,Qe.value.error=null;const x=await t.cherryPickCommit(Qe.value.commitHash,v.recordOrigin,v.noCommit);Qe.value.loading=!1,x.success?Qe.value.visible=!1:Qe.value.error=x.error||"Unknown error"}const dt=$({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function tn(v){dt.value.loading=!0,dt.value.error=null;const x=await t.resetToCommit(dt.value.commitHash,v.mode);dt.value.loading=!1,x.success?dt.value.visible=!1:dt.value.error=x.error||"Unknown error"}const ft=$({visible:!1,commitHash:"",loading:!1,error:null});async function Sn(v){ft.value.loading=!0,ft.value.error=null;const x=await t.createTag(v.name,ft.value.commitHash,v.annotated,v.message,v.pushToRemote);ft.value.loading=!1,x.success?ft.value.visible=!1:ft.value.error=x.error||"Unknown error"}const ye=$({visible:!1,tagName:"",loading:!1,error:null});async function A(v){ye.value.loading=!0,ye.value.error=null;const x=await t.deleteTag(ye.value.tagName,v.deleteFromRemote?v.remote||"origin":void 0);ye.value.loading=!1,x.success?ye.value.visible=!1:ye.value.error=x.error||"Unknown error"}const ie=$({visible:!1,tagName:"",loading:!1,tagDetail:null}),ve=$({visible:!1,loading:!1,error:null});async function qe(v){ve.value.loading=!0,ve.value.error=null;const x=await t.stashChanges(v.message,v.includeUntracked);ve.value.loading=!1,x.success?ve.value.visible=!1:ve.value.error=x.error||"Unknown error"}const We=$({visible:!1,stashIndex:0,loading:!1,error:null}),Ze=$("");async function ht(v){We.value.loading=!0,We.value.error=null;const x=await t.stashBranch(We.value.stashIndex,v);We.value.loading=!1,x.success?We.value.visible=!1:We.value.error=x.error||"Unknown error"}const rt=$({visible:!1,loading:!1,error:null});async function Ht(v){rt.value.loading=!0,rt.value.error=null;const x=await t.resetWorking(v.mode);rt.value.loading=!1,x.success?rt.value.visible=!1:rt.value.error=x.error||"Unknown error"}const gt=$({visible:!1,loading:!1,error:null});async function lt(){gt.value.loading=!0,gt.value.error=null;const v=await t.cleanUntracked();gt.value.loading=!1,v.success?gt.value.visible=!1:gt.value.error=v.error||"Unknown error"}const Vt=$({visible:!1,x:0,y:0});function k(v,x){Vt.value={visible:!0,x:v,y:x},setTimeout(()=>{Vt.value.visible=!1},1500)}const R=D(()=>mt.value.visible||He.value.visible||ct.value.visible||et.value.visible||ut.value.visible||Ve.value.visible||at.value.visible||it.value.visible||Qe.value.visible||dt.value.visible||ft.value.visible||ye.value.visible||ie.value.visible||ve.value.visible||We.value.visible||rt.value.visible||gt.value.visible);Pe(R,v=>{v?t.setActiveDialog({type:"generic",props:{}}):t.clearActiveDialog()});function T(v){t.selectedCommit?t.selectComparisonCommit(v):t.selectCommit(v)}function N(v){t.navigateToCommit(v)}return(v,x)=>{const pe=ka,_e=Na,Le=ci,tt=Ai,yt=Zc,xn=xu,cn=$u,Sr=Su,_r=_u,tr=Tu,Un=Mu,jn=Dt;return i(),u("div",Pf,[o(t).loading&&o(t).commits.length===0?(i(),u("div",Df,[...x[42]||(x[42]=[r("div",{class:"w-6 h-6 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),r("div",{class:"text-retro-muted text-sm"},"Loading git history...",-1)])])):o(g)?(i(),u("div",If,[q(o(wn),{class:"w-12 h-12 text-retro-yellow mb-4"}),x[43]||(x[43]=r("h3",{class:"text-retro-text font-semibold mb-2"},"Not a Git Repository",-1)),x[44]||(x[44]=r("p",{class:"text-retro-muted text-sm max-w-xs"},[Re(" This directory is not initialized as a Git repository. Run "),r("code",{class:"text-retro-cyan"},"git init"),Re(" to get started. ")],-1))])):o(t).error?(i(),u("div",Lf,[q(o(wn),{class:"w-10 h-10 text-retro-red mb-3"}),r("p",Nf,C(o(t).error),1),r("button",{class:"flex items-center gap-2 px-3 py-1.5 text-sm text-retro-text border border-retro-border rounded hover:border-retro-cyan hover:text-retro-cyan transition-colors",onClick:x[0]||(x[0]=Ee=>o(t).loadGitGraph(n.workingDirectory))},[q(o(Mn),{class:"w-4 h-4"}),x[45]||(x[45]=Re(" Retry ",-1))])])):o(t).commits.length===0?(i(),u("div",Ff,[...x[46]||(x[46]=[r("div",{class:"text-retro-muted text-center"},[r("p",null,"No commits found in this repository.")],-1)])])):(i(),u(ge,{key:4},[o(H)?(i(),de(pe,{key:0,ref_key:"findWidgetRef",ref:E,resultCount:o(t).searchResultHashes.length,currentIndex:o(t).searchResultIndex,onSearch:fe,onNext:o(t).nextSearchResult,onPrev:o(t).prevSearchResult,onClose:me},null,8,["resultCount","currentIndex","onNext","onPrev"])):P("",!0),r("div",Hf,[r("button",{class:we(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(H)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Find",title:"Find",onClick:x[1]||(x[1]=Ee=>o(H)?me():re())},[q(o(Tn),{class:"w-4 h-4"})],2),r("div",Of,[r("button",{class:we(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(ke)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Graph settings",title:"Settings",onClick:x[2]||(x[2]=Ee=>ke.value=!o(ke))},[q(o(Ws),{class:"w-4 h-4"})],2),o(ke)?(i(),u("div",Uf,[x[53]||(x[53]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mb-1"}," Graph Style ",-1)),r("label",jf,[r("input",{type:"radio",name:"graphStyle",value:"rounded",checked:o(t).graphStyle==="rounded",class:"accent-retro-cyan",onChange:x[3]||(x[3]=Ee=>o(t).setGraphStyle("rounded"))},null,40,zf),x[47]||(x[47]=r("span",{class:"text-sm text-retro-text"},"Rounded",-1))]),r("label",Vf,[r("input",{type:"radio",name:"graphStyle",value:"angular",checked:o(t).graphStyle==="angular",class:"accent-retro-cyan",onChange:x[4]||(x[4]=Ee=>o(t).setGraphStyle("angular"))},null,40,Wf),x[48]||(x[48]=r("span",{class:"text-sm text-retro-text"},"Angular",-1))]),x[54]||(x[54]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Display ",-1)),r("label",Gf,[r("input",{type:"checkbox",checked:o(t).muteNonAncestral,class:"accent-retro-cyan",onChange:x[5]||(x[5]=Ee=>o(t).toggleMuteNonAncestral())},null,40,qf),x[49]||(x[49]=r("span",{class:"text-sm text-retro-text"},"Mute non-ancestral",-1))]),x[55]||(x[55]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Columns ",-1)),r("label",Kf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.commit!==!1,class:"accent-retro-cyan",onChange:x[6]||(x[6]=Ee=>o(t).toggleColumnVisibility("commit"))},null,40,Zf),x[50]||(x[50]=r("span",{class:"text-sm text-retro-text"},"Hash",-1))]),r("label",Yf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.author!==!1,class:"accent-retro-cyan",onChange:x[7]||(x[7]=Ee=>o(t).toggleColumnVisibility("author"))},null,40,Xf),x[51]||(x[51]=r("span",{class:"text-sm text-retro-text"},"Author",-1))]),r("label",Qf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.date!==!1,class:"accent-retro-cyan",onChange:x[8]||(x[8]=Ee=>o(t).toggleColumnVisibility("date"))},null,40,Jf),x[52]||(x[52]=r("span",{class:"text-sm text-retro-text"},"Date",-1))])])):P("",!0)]),x[58]||(x[58]=r("span",{class:"flex-1"},null,-1)),r("div",em,[r("button",{class:we(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(O)||o(t).filteredBranches.length>0?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Filter by branch","aria-expanded":o(O),onClick:x[9]||(x[9]=Ee=>O.value=!o(O))},[q(o(ia),{class:"w-4 h-4"}),o(t).filteredBranches.length>0?(i(),u("span",nm," ("+C(o(t).filteredBranches.length)+") ",1)):P("",!0)],10,tm),o(O)?(i(),u("div",rm,[x[57]||(x[57]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border"}," Filter by Branch ",-1)),o(t).filteredBranches.length>0?(i(),u("button",{key:0,class:"w-full text-left px-3 py-1.5 text-sm text-retro-cyan hover:bg-retro-cyan/10",onClick:x[10]||(x[10]=Ee=>o(t).clearFilters())}," Clear All Filters ")):P("",!0),o(V).local.length>0?(i(),u(ge,{key:1},[x[56]||(x[56]=r("div",{class:"px-3 py-1 text-[10px] text-retro-green font-semibold uppercase tracking-wider mt-1"}," Local ",-1)),(i(!0),u(ge,null,Ie(o(V).local,Ee=>(i(),u("label",{key:Ee.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[r("input",{type:"checkbox",checked:o(t).filteredBranches.includes(Ee.name),class:"accent-retro-cyan",onChange:zn=>o(t).toggleBranchFilter(Ee.name)},null,40,om),r("span",sm,C(Ee.name),1),Ee.isHead?(i(),u("span",am,"(HEAD)")):P("",!0)]))),128))],64)):P("",!0),(i(!0),u(ge,null,Ie(o(V).remotes,(Ee,zn)=>(i(),u(ge,{key:zn},[r("div",im,C(zn),1),(i(!0),u(ge,null,Ie(Ee,Rn=>(i(),u("label",{key:Rn.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[r("input",{type:"checkbox",checked:o(t).filteredBranches.includes(Rn.name),class:"accent-retro-cyan",onChange:ho=>o(t).toggleBranchFilter(Rn.name)},null,40,lm),r("span",cm,C(Rn.name),1)]))),128))],64))),128))])):P("",!0)]),r("button",{class:we(["flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors",{"animate-spin":o(t).isRefreshing}]),"aria-label":"Refresh",title:"Refresh",onClick:x[11]||(x[11]=Ee=>o(t).loadGitGraph(n.workingDirectory))},[q(o(Mn),{class:"w-4 h-4"})],2),r("button",{class:"flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors","aria-label":"Fetch all remotes",title:"Fetch All",onClick:z},[q(o(ns),{class:"w-4 h-4"})]),r("div",um,[r("button",{class:we(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(te)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Manage remotes",title:"Remotes",onClick:x[12]||(x[12]=Ee=>te.value=!o(te))},[q(o(rs),{class:"w-4 h-4"})],2),o(te)?(i(),u("div",dm,[q(_e,{remotes:o(t).remotes,onAdd:G,onEdit:I,onDelete:W,onClose:x[13]||(x[13]=Ee=>te.value=!1)},null,8,["remotes"])])):P("",!0)]),o(B)&&n.isActive?(i(),u("div",{key:0,class:we(["flex items-center text-[10px] text-retro-muted",{"text-retro-cyan":o(t).isRefreshing}]),title:o(t).lastRefreshTime?`Last checked: ${new Date(o(t).lastRefreshTime).toLocaleTimeString()}`:"","aria-live":"polite","aria-atomic":"true"},[r("span",{class:we(["inline-block w-1.5 h-1.5 rounded-full mr-1",o(t).isRefreshing?"bg-retro-cyan animate-pulse":"bg-retro-muted/50"]),"aria-hidden":"true"},null,2),Re(" "+C(o(B)),1)],10,fm)):P("",!0)]),r("div",{class:we(["flex-1 min-h-0 overflow-hidden",{"max-h-[50%]":o(t).selectedCommit||o(t).isUncommittedChangesSelected}])},[q(Le,{ref_key:"commitListRef",ref:S,commits:o(t).filteredCommits,stashes:o(t).stashes,selectedCommit:o(t).selectedCommit,hasMore:o(t).hasMore,loading:o(t).loading,loadingMore:o(t).loadingMore,searchQuery:o(t).searchQuery,uncommittedChangesCount:o(t).uncommittedChangesCount,isUncommittedChangesSelected:o(t).isUncommittedChangesSelected,highlightBranches:o(l),featureHighlightBranches:o(c),featureMergeBases:o(f),previewHighlightBranches:o(d),previewMergeBases:o(p),currentBranchName:o(t).currentBranch?.name,localBranchNames:o(t).localBranchNames,graphStyle:o(t).graphStyle,muteNonAncestral:o(t).muteNonAncestral,columnVisibility:o(t).columnVisibility,onSelect:o(t).selectCommit,onLoadMore:o(t).loadMoreCommits,onBranchContextMenu:m,onCommitContextMenu:ze,onTagContextMenu:It,onStashContextMenu:be,onCompareSelect:T,onSelectUncommittedChanges:o(t).selectUncommittedChanges,onScrollStart:o(s).startInteraction,onScrollEnd:o(s).endInteraction},null,8,["commits","stashes","selectedCommit","hasMore","loading","loadingMore","searchQuery","uncommittedChangesCount","isUncommittedChangesSelected","highlightBranches","featureHighlightBranches","featureMergeBases","previewHighlightBranches","previewMergeBases","currentBranchName","localBranchNames","graphStyle","muteNonAncestral","columnVisibility","onSelect","onLoadMore","onSelectUncommittedChanges","onScrollStart","onScrollEnd"])],2),o(t).isComparing&&o(t).selectedCommit&&o(t).comparisonCommit?(i(),de(tt,{key:1,fromCommit:o(t).comparisonCommit,toCommit:o(t).selectedCommit,files:o(t).comparisonFiles,stats:o(t).comparisonStats,loading:o(t).comparisonLoading,onClose:o(t).clearComparison},null,8,["fromCommit","toCommit","files","stats","loading","onClose"])):o(t).selectedCommit?(i(),de(yt,{key:2,commit:o(t).selectedCommit,files:o(t).selectedCommitFiles,stats:o(t).selectedCommitStats,loading:o(t).isLoadingDetails,detailPosition:o(t).detailViewPosition,onClose:o(t).clearSelection,onNavigateToCommit:N,onTogglePosition:o(t).toggleDetailViewPosition,onOpenFileDiff:x[14]||(x[14]=Ee=>o(t).selectedCommit&&o(t).openFileDiff(o(t).selectedCommit.hash,Ee))},null,8,["commit","files","stats","loading","detailPosition","onClose","onTogglePosition"])):P("",!0),o(t).isUncommittedChangesSelected?(i(),de(xn,{key:3,stagedFiles:o(t).stagedFiles,unstagedFiles:o(t).unstagedFiles,isStaging:o(t).isStaging,isCommitting:o(t).isCommitting,onClose:o(t).clearSelection,onStageFiles:x[15]||(x[15]=Ee=>o(t).stageFiles(Ee)),onUnstageFiles:x[16]||(x[16]=Ee=>o(t).unstageFiles(Ee)),onStageAll:x[17]||(x[17]=()=>o(t).stageFiles([])),onUnstageAll:x[18]||(x[18]=()=>o(t).unstageFiles([])),onCommit:x[19]||(x[19]=Ee=>o(t).commitChanges(Ee))},null,8,["stagedFiles","unstagedFiles","isStaging","isCommitting","onClose"])):P("",!0)],64)),o(h).visible?(i(),de(cn,{key:5,branchName:o(h).branch,isCurrentBranch:o(h).isCurrentBranch,isLocal:o(h).isLocal,x:o(h).x,y:o(h).y,onClose:y,onCheckout:F,onCreateBranch:le,onDeleteBranch:X,onRename:J,onMerge:se,onRebase:Z,onPush:Y,onPull:oe,onFetch:ee,onCopyName:ae},null,8,["branchName","isCurrentBranch","isLocal","x","y"])):P("",!0),o(Me).visible&&o(Me).commit?(i(),de(Sr,{key:6,commit:o(Me).commit,x:o(Me).x,y:o(Me).y,onClose:Je,onAddTag:ne,onCreateBranch:Ce,onCheckout:De,onCherryPick:Fe,onRevert:je,onMergeInto:Ke,onReset:ot,onCopyHash:jt,onCopySubject:Xt},null,8,["commit","x","y"])):P("",!0),o(st).visible?(i(),de(_r,{key:7,tagName:o(st).tag,x:o(st).x,y:o(st).y,onClose:St,onViewDetails:_t,onDeleteTag:Lt,onPushTag:vt,onCopyName:Ot},null,8,["tagName","x","y"])):P("",!0),o(ue).visible&&o(ue).stash?(i(),de(tr,{key:8,stashIndex:o(ue).stash.index,stashMessage:o(ue).stash.message,x:o(ue).x,y:o(ue).y,onClose:Te,onApply:Oe,onPop:kn,onDrop:Qt,onCreateBranch:Jt,onCopyName:Cn,onCopyHash:Gt},null,8,["stashIndex","stashMessage","x","y"])):P("",!0),o(Tt).visible?(i(),de(Un,{key:9,x:o(Tt).x,y:o(Tt).y,onClose:Nt,onStash:U,onReset:ce,onClean:Q},null,8,["x","y"])):P("",!0),o(mt).visible?(i(),de(jn,{key:10,title:"Checkout",visible:o(mt).visible,loading:o(mt).loading,error:o(mt).error,confirmLabel:"Checkout",onClose:x[20]||(x[20]=Ee=>o(mt).visible=!1),onConfirm:$n},{default:nt(()=>[r("p",mm,[x[59]||(x[59]=Re(" Are you sure you want to checkout ",-1)),r("span",hm,C(o(mt).branchName),1),x[60]||(x[60]=Re("? ",-1))])]),_:1},8,["visible","loading","error"])):P("",!0),o(et).visible?(i(),de(jn,{key:11,title:"Rename Branch",visible:o(et).visible,loading:o(et).loading,error:o(et).error,confirmLabel:"Rename",onClose:x[22]||(x[22]=Ee=>o(et).visible=!1),onConfirm:an},{default:nt(()=>[r("div",pm,[r("p",vm,[x[61]||(x[61]=Re(" Rename ",-1)),r("span",gm,C(o(et).branchName),1)]),Ne(r("input",{"onUpdate:modelValue":x[21]||(x[21]=Ee=>o(et).newName=Ee),type:"text",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",placeholder:"New branch name",onKeyup:mn(an,["enter"])},null,544),[[Ct,o(et).newName]])])]),_:1},8,["visible","loading","error"])):P("",!0),o(ut).visible?(i(),de(fd,{key:12,visible:o(ut).visible,branchName:o(ut).branchName,loading:o(ut).loading,error:o(ut).error,onClose:x[23]||(x[23]=Ee=>o(ut).visible=!1),onConfirm:bt},null,8,["visible","branchName","loading","error"])):P("",!0),o(ct).visible?(i(),de(sd,{key:13,visible:o(ct).visible,branchName:o(ct).branchName,isLocal:o(ct).isLocal,loading:o(ct).loading,error:o(ct).error,onClose:x[24]||(x[24]=Ee=>o(ct).visible=!1),onConfirm:vn},null,8,["visible","branchName","isLocal","loading","error"])):P("",!0),o(at).visible?(i(),de(Ad,{key:14,visible:o(at).visible,branchName:o(at).branchName,remotes:o(_),loading:o(at).loading,error:o(at).error,onClose:x[25]||(x[25]=Ee=>o(at).visible=!1),onConfirm:en},null,8,["visible","branchName","remotes","loading","error"])):P("",!0),o(it).visible?(i(),de(bd,{key:15,visible:o(it).visible,branchName:o(it).branchName,remotes:o(_),loading:o(it).loading,error:o(it).error,onClose:x[26]||(x[26]=Ee=>o(it).visible=!1),onConfirm:ln},null,8,["visible","branchName","remotes","loading","error"])):P("",!0),o(Ve).visible?(i(),de(Ld,{key:16,visible:o(Ve).visible,branchName:o(t).currentBranch?.name||"HEAD",ontoBranch:o(Ve).branchName,loading:o(Ve).loading,error:o(Ve).error,onClose:x[27]||(x[27]=Ee=>o(Ve).visible=!1),onConfirm:Ft},null,8,["visible","branchName","ontoBranch","loading","error"])):P("",!0),o(Qe).visible?(i(),de(Ku,{key:17,visible:o(Qe).visible,commitHash:o(Qe).commitHash,commitMessage:o(Qe).commitMessage,loading:o(Qe).loading,error:o(Qe).error,onClose:x[28]||(x[28]=Ee=>o(Qe).visible=!1),onConfirm:gn},null,8,["visible","commitHash","commitMessage","loading","error"])):P("",!0),o(dt).visible?(i(),de(zd,{key:18,visible:o(dt).visible,commitHash:o(dt).commitHash,commitMessage:o(dt).commitMessage,loading:o(dt).loading,error:o(dt).error,onClose:x[29]||(x[29]=Ee=>o(dt).visible=!1),onConfirm:tn},null,8,["visible","commitHash","commitMessage","loading","error"])):P("",!0),o(ft).visible?(i(),de(uf,{key:19,visible:o(ft).visible,commitHash:o(ft).commitHash,remotes:o(_),loading:o(ft).loading,error:o(ft).error,onClose:x[30]||(x[30]=Ee=>o(ft).visible=!1),onConfirm:Sn},null,8,["visible","commitHash","remotes","loading","error"])):P("",!0),o(ye).visible?(i(),de(gf,{key:20,visible:o(ye).visible,tagName:o(ye).tagName,remotes:o(_),loading:o(ye).loading,error:o(ye).error,onClose:x[31]||(x[31]=Ee=>o(ye).visible=!1),onConfirm:A},null,8,["visible","tagName","remotes","loading","error"])):P("",!0),o(ie).visible?(i(),de(Rf,{key:21,visible:o(ie).visible,tagName:o(ie).tagName,tagDetail:o(ie).tagDetail,loading:o(ie).loading,onClose:x[32]||(x[32]=Ee=>o(ie).visible=!1)},null,8,["visible","tagName","tagDetail","loading"])):P("",!0),o(He).visible?(i(),de(Ju,{key:22,visible:o(He).visible,fromCommit:o(He).fromCommit,loading:o(He).loading,error:o(He).error,onClose:x[33]||(x[33]=Ee=>o(He).visible=!1),onConfirm:zt},null,8,["visible","fromCommit","loading","error"])):P("",!0),o(We).visible?(i(),de(jn,{key:23,title:"Create Branch from Stash",visible:o(We).visible,loading:o(We).loading,error:o(We).error,confirmLabel:"Create Branch",onClose:x[36]||(x[36]=Ee=>o(We).visible=!1),onConfirm:x[37]||(x[37]=Ee=>ht(o(Ze)))},{default:nt(()=>[r("div",xm,[r("p",bm,[x[62]||(x[62]=Re(" Create a new branch from ",-1)),r("span",ym,"stash@"+C("{")+C(o(We).stashIndex)+C("}"),1)]),Ne(r("input",{"onUpdate:modelValue":x[34]||(x[34]=Ee=>Ge(Ze)?Ze.value=Ee:null),type:"text",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",placeholder:"Branch name",onKeyup:x[35]||(x[35]=mn(Ee=>ht(o(Ze)),["enter"]))},null,544),[[Ct,o(Ze)]])])]),_:1},8,["visible","loading","error"])):P("",!0),o(ve).visible?(i(),de(Xd,{key:24,visible:o(ve).visible,loading:o(ve).loading,error:o(ve).error,onClose:x[38]||(x[38]=Ee=>o(ve).visible=!1),onConfirm:qe},null,8,["visible","loading","error"])):P("",!0),o(rt).visible?(i(),de(Kd,{key:25,visible:o(rt).visible,loading:o(rt).loading,error:o(rt).error,onClose:x[39]||(x[39]=Ee=>o(rt).visible=!1),onConfirm:Ht},null,8,["visible","loading","error"])):P("",!0),o(gt).visible?(i(),de(ed,{key:26,visible:o(gt).visible,loading:o(gt).loading,error:o(gt).error,onClose:x[40]||(x[40]=Ee=>o(gt).visible=!1),onConfirm:lt},null,8,["visible","loading","error"])):P("",!0),(i(),de(Zt,{to:"body"},[q(hn,{name:"fade"},{default:nt(()=>[o(Vt).visible?(i(),u("div",{key:0,class:"fixed z-50 px-3 py-1.5 text-sm bg-retro-green text-retro-dark rounded shadow-lg",style:Bt({left:`${o(Vt).x}px`,top:`${o(Vt).y-40}px`})}," Copied! ",4)):P("",!0)]),_:1})])),(i(),de(Zt,{to:"body"},[q(hn,{name:"fade"},{default:nt(()=>[o(t).operationError?(i(),u("div",wm,[q(o(wn),{class:"w-4 h-4 flex-shrink-0"}),r("span",km,C(o(t).operationError),1),r("button",{class:"flex-shrink-0 p-0.5 hover:bg-white/20 rounded transition-colors",onClick:x[41]||(x[41]=Ee=>o(t).clearOperationError()),"aria-label":"Dismiss error"},[q(o($t),{class:"w-3.5 h-3.5"})])])):P("",!0)]),_:1})]))])}}}),$m=gr(Cm,[["__scopeId","data-v-7f64563b"]]),Sm=Rs("/app-logo.svg"),_m={class:"flex items-start justify-between gap-2"},Tm={class:"flex-1 min-w-0"},Mm={class:"flex items-center gap-2"},Am={class:"font-mono text-sm text-retro-text truncate"},Bm={class:"text-xs font-mono text-retro-muted mt-1 truncate"},Em={class:"flex items-center gap-1 flex-shrink-0"},Rm={key:0,class:"text-[11px] font-mono text-retro-muted mr-1",title:"Completed tasks / total tasks"},Pm={key:1,class:"w-2 h-2 rounded-full bg-retro-green",title:"spec"},Dm={key:2,class:"w-2 h-2 rounded-full bg-retro-cyan",title:"plan"},Im={key:3,class:"w-2 h-2 rounded-full bg-retro-yellow",title:"tasks"},Lm={class:"flex flex-wrap items-center justify-between gap-1 mt-2"},Nm={key:0,class:"flex items-center gap-1"},Fm=["title","disabled","onClick"],Hm=Ae({__name:"FeatureCard",props:{feature:{},skills:{},isActive:{type:Boolean}},emits:["select","cascade","openChat","skill"],setup(e,{emit:n}){const t={DocumentCheckIcon:na,PuzzlePieceIcon:ko,DocumentMagnifyingGlassIcon:oa,WrenchScrewdriverIcon:va,SparklesIcon:br,BeakerIcon:Ys,ShieldCheckIcon:ls,CommandLineIcon:ta,CpuChipIcon:os,LightBulbIcon:ua},a=e,s=n,l=Yt();function c(g){return t[g]||ko}function d(g){return g.prerequisites.every(b=>a.feature.files.some(w=>w.filename===b))}function p(g){return g.prerequisites.filter(b=>!a.feature.files.some(w=>w.filename===b))}function f(g){return d(g)?`${g.name} (Shift+click: new conversation)`:`Requires: ${p(g).join(", ")}`}const _=D(()=>{const g=l.findConversationByFeature(a.feature.id);return g?l.isConversationStreaming(g.id):!1}),S=D(()=>a.isActive?["border-retro-cyan shadow-retro","feature-card-active","dark:bg-gradient-to-br dark:from-retro-cyan/10 dark:via-retro-panel dark:to-retro-magenta/5"]:["border-retro-border","feature-card-light","hover:border-retro-muted","dark:bg-gradient-to-br","dark:from-retro-panel dark:via-retro-panel dark:to-retro-cyan/5","dark:hover:from-retro-cyan/5 dark:hover:via-retro-panel dark:hover:to-retro-magenta/5"]);return(g,b)=>(i(),u("button",{type:"button",class:we(["w-full p-3 text-left rounded-lg border transition-all duration-200 group",o(S)]),onClick:b[5]||(b[5]=w=>s("select",e.feature.id))},[r("div",_m,[r("div",Tm,[r("div",Mm,[q(o(Nn),{class:we(["h-4 w-4 flex-shrink-0 transition-colors duration-200",e.isActive?"text-retro-cyan":"text-retro-muted group-hover:text-retro-cyan"])},null,8,["class"]),r("span",Am,C(e.feature.id),1)]),r("p",Bm,C(e.feature.name),1)]),r("div",Em,[e.feature.hasTasks?(i(),u("span",Rm,C(e.feature.completedTasks)+"/"+C(e.feature.totalTasks),1)):P("",!0),e.feature.hasSpec?(i(),u("span",Pm)):P("",!0),e.feature.hasPlan?(i(),u("span",Dm)):P("",!0),e.feature.hasTasks?(i(),u("span",Im)):P("",!0)])]),r("div",Lm,[e.feature.hasSpec?(i(),u("div",Nm,[r("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Clarify spec (Shift+click: new conversation)",onClick:b[0]||(b[0]=wt(w=>s("cascade",w,e.feature.id,"clarify"),["stop"]))},[q(o(Jr),{class:"h-3.5 w-3.5"})]),r("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Plan → Tasks → Implement (Shift+click: new conversation)",onClick:b[1]||(b[1]=wt(w=>s("cascade",w,e.feature.id,"plan"),["stop"]))},[q(o(Xr),{class:"h-3.5 w-3.5"})]),e.feature.hasPlan?(i(),u("button",{key:0,type:"button",class:"flex items-center justify-center p-1 bg-retro-yellow/20 text-retro-yellow rounded hover:bg-retro-yellow/30 transition-colors",title:"Tasks → Implement (Shift+click: new conversation)",onClick:b[2]||(b[2]=wt(w=>s("cascade",w,e.feature.id,"tasks"),["stop"]))},[q(o(as),{class:"h-3.5 w-3.5"})])):P("",!0),e.feature.hasTasks?(i(),u("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-magenta/20 text-retro-magenta rounded hover:bg-retro-magenta/30 transition-colors",title:"Implement (Shift+click: new conversation)",onClick:b[3]||(b[3]=wt(w=>s("cascade",w,e.feature.id,"implement"),["stop"]))},[q(o(ha),{class:"h-3.5 w-3.5"})])):P("",!0),e.skills.length>0?(i(),u(ge,{key:2},[b[6]||(b[6]=r("div",{class:"w-px h-4 bg-retro-border mx-0.5"},null,-1)),(i(!0),u(ge,null,Ie(e.skills,w=>(i(),u("button",{key:w.id,type:"button",class:we(["flex items-center justify-center p-1 rounded transition-colors",[d(w)&&!o(_)?"bg-retro-pink/20 text-retro-pink hover:bg-retro-pink/30":"bg-retro-subtle/10 text-retro-subtle cursor-not-allowed",o(_)?"animate-pulse":""]]),title:f(w),disabled:!d(w)||o(_),onClick:wt(M=>s("skill",M,e.feature.id,w.id),["stop"])},[(i(),de(In(c(w.icon)),{class:"h-3.5 w-3.5"}))],10,Fm))),128))],64)):P("",!0)])):P("",!0),e.feature.hasSpec?(i(),u("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-green/20 text-retro-green rounded hover:bg-retro-green/30 transition-colors",title:"Open new chat linked to this spec",onClick:b[4]||(b[4]=wt(w=>s("openChat",w,e.feature.id),["stop"]))},[q(o(es),{class:"h-3.5 w-3.5"})])):P("",!0)])],2))}});function $r(){function e(n){const t=Ye.parse(n);return Ss.sanitize(t)}return{renderMarkdown:e}}const Om={class:"fixed inset-0 z-50 flex items-center justify-center"},Um={class:"relative w-[96vw] h-[94vh] bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},jm={class:"flex-shrink-0 flex items-center justify-between px-4 h-12 border-b border-retro-border bg-retro-dark"},zm={class:"flex items-center gap-3 min-w-0"},Vm={class:"text-sm font-mono font-bold text-retro-cyan truncate"},Wm={class:"text-xs font-mono text-retro-subtle"},Gm={class:"flex items-center gap-2"},qm=["disabled"],Km={key:0,class:"flex-shrink-0 flex items-center gap-0 border-b border-retro-border bg-retro-dark overflow-x-auto"},Zm=["onClick"],Ym={class:"flex-1 min-h-0 overflow-y-auto"},Xm={key:0,class:"flex items-center justify-center py-12"},Qm={key:1,class:"flex flex-col items-center justify-center py-12 text-center px-4"},Jm={class:"text-sm font-mono text-retro-red"},eh={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},th={key:3,class:"h-full flex flex-col"},nh=["innerHTML"],rh=Ae({__name:"SpecViewerModal",props:{feature:{}},emits:["close"],setup(e,{emit:n}){const t=e,a=n,s=Hn(),{renderMarkdown:l}=$r(),c=$(t.feature.files[0]?.filename||""),d=$(""),p=$(!1),f=$(null),_=$(!1),S=$(""),g=$(!1);async function b(){if(c.value){p.value=!0,f.value=null;try{const E=`/api/specs/${t.feature.id}/${c.value}`,re=await $fetch(E);d.value=re.content}catch{f.value="Failed to load file",d.value=""}finally{p.value=!1}}}const w=D(()=>d.value?l(d.value):"");function M(E){_.value&&(_.value=!1),c.value=E,b()}function j(){S.value=d.value,_.value=!0}function B(){_.value=!1,S.value=""}async function H(){g.value=!0;try{const E=`/api/specs/${t.feature.id}/${c.value}`;await $fetch(E,{method:"PUT",body:{content:S.value}}),d.value=S.value,_.value=!1,s.success("Saved")}catch{s.error("Failed to save")}finally{g.value=!1}}function O(E){E.key==="Escape"&&(_.value?B():a("close"))}return xt(()=>{window.addEventListener("keydown",O),b()}),kt(()=>{window.removeEventListener("keydown",O)}),(E,re)=>(i(),de(Zt,{to:"body"},[r("div",Om,[r("div",{class:"absolute inset-0 bg-black/80",onClick:re[0]||(re[0]=me=>a("close"))}),r("div",Um,[r("div",jm,[r("div",zm,[r("span",Vm,C(e.feature.name),1),r("span",Wm,C(e.feature.id),1)]),r("div",Gm,[o(_)?(i(),u(ge,{key:0},[r("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-muted transition-colors",onClick:B}," Cancel "),r("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-cyan text-retro-cyan hover:bg-retro-cyan/10 transition-colors disabled:opacity-50",disabled:o(g),onClick:H},C(o(g)?"Saving...":"Save"),9,qm)],64)):o(d)&&!o(p)&&!o(f)?(i(),u("button",{key:1,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Edit",onClick:j},[q(o(Qr),{class:"h-4 w-4"})])):P("",!0),r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (ESC)",onClick:re[1]||(re[1]=me=>a("close"))},[q(o($t),{class:"h-4 w-4"})])])]),e.feature.files.length>0?(i(),u("div",Km,[(i(!0),u(ge,null,Ie(e.feature.files,me=>(i(),u("button",{key:me.filename,type:"button",class:we(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap",[o(c)===me.filename?"border-retro-cyan text-retro-cyan bg-retro-black":"border-transparent text-retro-muted hover:text-retro-text hover:bg-retro-panel"]]),onClick:fe=>M(me.filename)},C(me.label),11,Zm))),128))])):P("",!0),r("div",Ym,[o(p)?(i(),u("div",Xm,[...re[3]||(re[3]=[r("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading...",-1)])])):o(f)?(i(),u("div",Qm,[r("p",Jm,C(o(f)),1),r("button",{type:"button",class:"mt-3 px-3 py-1.5 text-xs font-mono bg-retro-panel border border-retro-border rounded text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:b}," Retry ")])):e.feature.files.length===0?(i(),u("div",eh,[...re[4]||(re[4]=[r("p",{class:"text-sm font-mono text-retro-muted"},"No spec files found",-1),r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," This feature directory has no .md files ",-1)])])):o(_)?(i(),u("div",th,[Ne(r("textarea",{"onUpdate:modelValue":re[2]||(re[2]=me=>Ge(S)?S.value=me:null),class:"flex-1 w-full p-4 bg-retro-black text-sm font-mono text-retro-text resize-none focus:outline-none",spellcheck:"false"},null,512),[[Ct,o(S)]])])):(i(),u("div",{key:4,class:"spec-markdown p-6 text-sm font-mono text-retro-text max-w-4xl mx-auto",innerHTML:o(w)},null,8,nh))])])])]))}}),oh={class:"w-full max-w-2xl rounded-xl border border-retro-border/80 bg-retro-black shadow-[0_24px_70px_rgba(0,0,0,0.55)] overflow-hidden"},sh={class:"flex items-center justify-between px-4 py-2 border-b border-retro-border/60 bg-retro-dark/70"},ah={class:"flex items-center gap-2 px-4 py-3 border-b border-retro-border/60"},ih={class:"flex items-center justify-between px-4 py-1.5 border-b border-retro-border/40 bg-retro-dark/30 text-[10px] font-mono text-retro-subtle"},lh={class:"flex items-center gap-3"},ch={class:"inline-flex items-center gap-1"},uh={key:0},dh={key:0,class:"truncate max-w-[42%]"},fh={class:"max-h-[58vh] overflow-y-auto"},mh={key:0,class:"px-4 py-3 text-xs font-mono text-retro-subtle animate-pulse"},hh={key:1,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},ph={key:2,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},vh={key:3,class:"px-4 py-3 text-xs font-mono text-retro-red"},gh={key:4,class:"py-2 px-2 space-y-2"},xh=["onMouseenter","onClick"],bh={class:"flex items-center justify-between gap-3 text-[10px] font-mono"},yh={class:"text-retro-cyan/90"},wh={class:"text-retro-subtle truncate"},kh=["innerHTML"],Ch={key:5,class:"px-4 py-3 text-xs font-mono text-retro-subtle"},$h={class:"flex items-center justify-between gap-3 px-4 py-2 border-t border-retro-border/60 bg-retro-dark/50 text-[11px] font-mono text-retro-subtle"},Sh={key:0,class:"text-retro-yellow"},_h={key:0,class:"px-4 pb-3 text-xs font-mono text-retro-red flex items-center gap-2"},Th=400,Mh=Ae({__name:"FeatureSearchModal",props:{availableFeatureIds:{}},emits:["close","select"],setup(e,{emit:n}){const t=e,a=n,{renderMarkdown:s}=$r(),l=$(""),c=$(!1),d=$(!1),p=$(null),f=$(null),_=$(null),S=$(null),g=$([]),b=$(-1),w=$(null),M=$([]);let j=null,B=0;const H=D(()=>l.value.trim()),O=D(()=>{const V=H.value.toLowerCase().split(/\s+/).map(h=>h.trim()).filter(h=>h.length>=2);return Array.from(new Set(V)).slice(0,8)}),E=D(()=>p.value||f.value?"error":!H.value&&d.value?"empty-query":g.value.length>0?"results":d.value&&!c.value?"no-results":"idle");function re(V){return{featureId:V.chunk.featureId,sourcePath:V.chunk.sourcePath,headingHierarchy:V.chunk.headingHierarchy,snippet:V.chunk.content,matchType:V.matchType,score:V.score,lineStart:V.chunk.lineStart,lineEnd:V.chunk.lineEnd}}async function me(){const V=H.value;if(f.value=null,!V){d.value=!0,_.value=null,S.value=null,p.value=null,g.value=[],b.value=-1;return}const h=++B;d.value=!0,p.value=null,c.value=!0;try{const m=await $fetch("/api/specs/search",{query:{q:V,mode:"keyword",limit:20}});if(h!==B)return;_.value=m.warning??null,S.value=m.searchTime,g.value=m.results.map(re),b.value=g.value.length>0?0:-1}catch(m){if(h!==B)return;const y=m instanceof Error?m.message:"Failed to search specs";p.value=y,S.value=null,g.value=[],b.value=-1}finally{h===B&&(c.value=!1)}}Pe(l,()=>{p.value=null,f.value=null,j&&clearTimeout(j),j=setTimeout(()=>{me()},Th)}),Pe(g,()=>{M.value=[]}),Pe(b,async V=>{V<0||(await Kt(),M.value[V]?.scrollIntoView({block:"nearest"}))});function fe(){a("close")}function xe(V){const h=g.value[V];if(h){if(!t.availableFeatureIds.includes(h.featureId)){f.value="Feature unavailable";return}a("select",h.featureId),a("close")}}function ke(V){if(g.value.length===0)return;if(b.value<0){b.value=0;return}const h=b.value+V;if(h<0){b.value=g.value.length-1;return}if(h>=g.value.length){b.value=0;return}b.value=h}function te(V){if(V.key==="ArrowDown"){V.preventDefault(),ke(1);return}if(V.key==="ArrowUp"){V.preventDefault(),ke(-1);return}if(V.key==="Enter"){V.preventDefault(),b.value>=0&&xe(b.value);return}V.key==="Escape"&&(V.preventDefault(),fe())}function z(V){V.target===V.currentTarget&&fe()}function G(V,h){if(!h){M.value[V]=null;return}if(h instanceof HTMLElement){M.value[V]=h;return}const m=h.$el;M.value[V]=m instanceof HTMLElement?m:null}function I(){me()}function W(V){const h=V.trim();if(!h)return"";const m=h.length>700?`${h.slice(0,700)}...`:h,y=s(m);if(O.value.length===0)return y;const F=O.value.map(X=>X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),J=new RegExp(`(${F.join("|")})`,"gi");return y.split(/(<[^>]+>)/g).map(X=>X.startsWith("<")?X:X.replace(J,"<mark>$1</mark>")).join("")}return xt(()=>{Kt(()=>{w.value?.focus()})}),kt(()=>{j&&clearTimeout(j)}),(V,h)=>(i(),de(Zt,{to:"body"},[q(hn,{appear:"","enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition duration-120 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:nt(()=>[r("div",{class:"fixed inset-0 z-50 flex items-start justify-center pt-16 px-4 bg-black/75 backdrop-blur-[1px]",onClick:z},[q(hn,{appear:"","enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0 translate-y-2 scale-[0.99]","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition duration-120 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-1 scale-[0.995]"},{default:nt(()=>[r("div",oh,[r("div",sh,[h[1]||(h[1]=r("div",{class:"flex items-center gap-2"},[r("span",{class:"inline-flex items-center rounded px-2 py-0.5 text-[10px] font-mono border border-retro-cyan/50 text-retro-cyan bg-retro-cyan/10"}," Command Palette "),r("span",{class:"text-[10px] font-mono text-retro-subtle"},"Global spec search")],-1)),r("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (Escape)",onClick:fe},[q(o($t),{class:"h-4 w-4"})])]),r("div",ah,[q(o(Tn),{class:"h-4 w-4 text-retro-cyan"}),Ne(r("input",{ref_key:"inputRef",ref:w,"onUpdate:modelValue":h[0]||(h[0]=m=>Ge(l)?l.value=m:null),type:"text",placeholder:"Search specs across all features...",class:"flex-1 bg-transparent text-sm font-mono text-retro-text placeholder:text-retro-subtle focus:outline-none",onKeydown:te},null,544),[[Ct,o(l)]]),h[2]||(h[2]=r("span",{class:"text-[10px] font-mono text-retro-subtle border border-retro-border/60 rounded px-1.5 py-0.5"},"400ms",-1))]),r("div",ih,[r("div",lh,[r("span",ch,[q(o(Nn),{class:"h-3.5 w-3.5"}),Re(" "+C(o(g).length)+" results ",1)]),o(S)!==null?(i(),u("span",uh,C(o(S))+"ms",1)):P("",!0)]),o(H)?(i(),u("span",dh,"“"+C(o(H))+"”",1)):P("",!0)]),r("div",fh,[o(c)?(i(),u("div",mh," Searching... ")):o(E)==="empty-query"?(i(),u("div",hh," Enter a search term to search across all feature specs. ")):o(E)==="no-results"?(i(),u("div",ph," No matching features found. ")):o(E)==="error"?(i(),u("div",vh,[r("p",null,C(o(f)||o(p)),1),o(p)?(i(),u("button",{key:0,type:"button",class:"mt-2 px-2 py-1 rounded border border-retro-border text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:I}," Retry ")):P("",!0)])):o(g).length>0?(i(),u("ul",gh,[(i(!0),u(ge,null,Ie(o(g),(m,y)=>(i(),u("li",{key:`${m.featureId}:${m.sourcePath}:${y}`},[r("button",{type:"button",ref_for:!0,ref:F=>G(y,F),class:we(["w-full text-left px-4 py-3 min-h-[132px] rounded-lg border border-retro-border/40 border-l-2 transition-colors",y===o(b)?"border-retro-cyan bg-retro-panel/95 text-retro-text shadow-[0_0_0_1px_rgba(34,211,238,0.18)]":"text-retro-muted hover:text-retro-text hover:bg-retro-panel/90"]),onMouseenter:F=>b.value=y,onClick:F=>xe(y)},[r("div",bh,[r("span",yh,C(m.featureId),1),r("span",wh,C(m.sourcePath)+":"+C(m.lineStart)+"-"+C(m.lineEnd),1)]),r("div",{class:"snippet-markdown mt-2 max-h-20 overflow-hidden text-xs text-retro-text",innerHTML:W(m.snippet)},null,8,kh),h[3]||(h[3]=r("div",{class:"mt-2 text-[10px] font-mono text-retro-subtle"}," Select feature ",-1))],42,xh)]))),128))])):(i(),u("div",Ch," Start typing to search. "))]),r("div",$h,[h[4]||(h[4]=r("div",{class:"flex items-center gap-2"},[r("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"↑↓ move"),r("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"Enter select"),r("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"Esc close")],-1)),o(_)?(i(),u("span",Sh,C(o(_)),1)):P("",!0)]),o(f)?(i(),u("div",_h,[q(o(wn),{class:"h-3.5 w-3.5"}),r("span",null,C(o(f)),1)])):P("",!0)])]),_:1})])]),_:1})]))}}),Ah=gr(Mh,[["__scopeId","data-v-5199b408"]]);function Bh(e){return/^\/speckit\.(clarify|plan|tasks|implement)(\s|$)/.test(e)}function Eh(e=Date.now,n=Math.random){return`req-${e()}-${n().toString(36).slice(2,8)}`}function Fo(e=Date.now){return`session-${e()}`}function Pr(e,n=!1){const t={};return(!n||e?.hasWorktree)&&e?.worktreePath&&(t.cwd=e.worktreePath,t.worktreeBranch=e.worktreeBranch),e?.featureId&&(t.featureId=e.featureId),Object.keys(t).length>0?t:void 0}function Rh(e){if(e.file_path)return String(e.file_path);if(e.path)return String(e.path);if(e.command)return String(e.command).slice(0,50);if(e.pattern)return String(e.pattern);for(const n of Object.values(e))if(typeof n=="string"&&n.length<100)return n;return""}function Ho(e,n="Permission"){const t=e||"",a=t.match(/write to (.+?)(?:[\s,?]|$)/i),s=t.match(/read (.+?)(?:[\s,?]|$)/i),l=t.match(/run (.+?)(?:[?,]|$)/i);return a?.[1]?{tool:"Write",description:t,filePath:a[1].trim()}:s?.[1]?{tool:"Read",description:t,filePath:s[1].trim()}:l?.[1]?{tool:"Bash",description:t,command:l[1].trim()}:{tool:n,description:t}}const pt=new Map,un=new Map,cr=new Set,Ph=3e4,Dh=18e4;function Ih(e){switch(e){case 1e3:return"Normal closure";case 1001:return"Endpoint is going away (server shutdown or page navigation)";case 1002:return"Protocol error";case 1003:return"Unsupported data";case 1005:return"No status code received from peer (close frame had no code)";case 1006:return"Abnormal closure (connection dropped without close frame)";case 1007:return"Invalid payload data";case 1008:return"Policy violation";case 1009:return"Message too big";case 1010:return"Missing required extension";case 1011:return"Internal server error";case 1012:return"Service restart";case 1013:return"Try again later (temporary overload)";case 1015:return"TLS handshake failure";default:return e>=4e3&&e<=4999?"Application-specific close code":"Unknown close code"}}function Lh(e,n){const t=[];return e.reason?t.push(e.reason):t.push(Ih(e.code)),n?.lastServerError?t.push(`Last server error: ${n.lastServerError}`):n?.lastSocketError&&t.push(`Last socket error: ${n.lastSocketError}`),t.push(`wasClean: ${e.wasClean?"yes":"no"}`),t.join(" | ")}function mo(){const e=Yt(),n=Qn();function t(){return typeof document>"u"||typeof document.hasFocus!="function"?!1:document.visibilityState==="visible"&&document.hasFocus()}function a(h){const y=e.conversations.find(F=>F.id===h)?.title?.trim()||"Chat";return new Notification("Spec Cat",{body:`${y} response completed.`,tag:`chat-complete-${h}`})}async function s(h){if(!(typeof window>"u"||typeof Notification>"u")&&!t()){if(Notification.permission==="granted"){a(h);return}if(Notification.permission==="default")try{await Notification.requestPermission()==="granted"&&a(h)}catch(m){console.warn("[useChatStream] Failed to request browser notification permission:",m)}}}function l(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`}function c(h){h.healthCheckInterval&&(clearInterval(h.healthCheckInterval),h.healthCheckInterval=null)}function d(h){c(h),h.lastMessageTime=Date.now(),h.healthCheckInterval=fo(()=>{const m=h.conversationId;if(h.ws.readyState!==WebSocket.OPEN){console.warn(`[useChatStream] Health check: WebSocket not open for ${m}`),c(h),e.isConversationStreaming(m)&&(S(h.currentMessageId,m,"error"),e.updateMessage(h.currentMessageId,{status:"error"},m),e.setSessionError("Connection lost during streaming",m),e.endSession(m),e.endConversationStreaming(m)),pt.delete(m);return}if(e.isConversationStreaming(m)){const y=Date.now()-h.lastMessageTime;y>Dh&&(console.warn(`[useChatStream] Health check: streaming timeout for ${m} (${Math.round(y/1e3)}s)`),c(h),S(h.currentMessageId,m,"error"),e.updateMessage(h.currentMessageId,{status:"error"},m),e.setSessionError("Streaming timed out — no response from server for 3 minutes",m),e.endSession(m),e.endConversationStreaming(m),h.ws.close(),pt.delete(m))}},Ph)}function p(h,m){return e.conversations.find(F=>F.id===h)?.messages.find(F=>F.id===m)?.status}function f(h,m=!0){const y=pt.get(h);y&&(c(y),m&&y.ws.readyState===WebSocket.OPEN&&y.ws.close(),pt.delete(h))}function _(h,m,y){!y||!h.currentTextBlockId||(e.updateBlockWithSave(h.currentMessageId,h.currentTextBlockId,F=>{F.type==="text"&&(F.text+=y)},m,{syncContent:!1}),e.appendToMessage(h.currentMessageId,y,m))}function S(h,m,y){const J=e.conversations.find(X=>X.id===m)?.messages.find(X=>X.id===h);if(J?.contentBlocks)for(const X of J.contentBlocks)X.type==="tool_use"&&(X.status==="running"||X.status==="pending")&&e.updateBlockById(h,X.id,se=>{se.type==="tool_use"&&(se.status=y)},m)}async function g(h){try{(await b(h)).send(JSON.stringify({type:"reset_context"})),e.clearProviderSession(h),console.log("[useChatStream] Context reset requested for conversation:",h)}catch(m){throw console.error("[useChatStream] Failed to reset context:",m),m}}function b(h){return new Promise((m,y)=>{const F=pt.get(h);if(F&&F.ws.readyState===WebSocket.OPEN){m(F.ws);return}F&&(F.ws.close(),pt.delete(h));const J=l(),X=new WebSocket(J),se={ws:X,currentMessageId:"",conversationId:h,activeTools:new Map,currentTextBlockId:null,currentThinkingBlockId:null,healthCheckInterval:null,lastMessageTime:Date.now(),lastServerError:null,lastSocketError:null};pt.set(h,se),X.onopen=()=>{m(X)},X.onerror=Z=>{console.error(`[useChatStream] WebSocket error for conversation ${h}:`,Z);const Y=pt.get(h);Y&&(Y.lastSocketError="Browser reported a WebSocket transport error (network/proxy/server)"),e.isConversationStreaming(h)&&(Y?.currentMessageId&&(S(Y.currentMessageId,h,"error"),e.updateMessage(Y.currentMessageId,{status:"error"},h)),e.setSessionError("Connection error during streaming",h),e.endSession(h),e.endConversationStreaming(h)),pt.delete(h),y(new Error("WebSocket connection failed. Server may be unavailable."))},X.onclose=Z=>{const Y=pt.get(h);if(Y&&c(Y),pt.delete(h),un.delete(h),e.isConversationStreaming(h)){Y?.currentMessageId&&(S(Y.currentMessageId,h,"error"),e.updateMessage(Y.currentMessageId,{status:"error"},h));const oe=Lh(Z,Y);e.setSessionError(`Connection closed: ${oe} (code: ${Z.code})`,h),e.endSession(h),e.endConversationStreaming(h)}},X.onmessage=Z=>{B(Z.data,h)}})}async function w(h,m=3){for(let y=0;y<m;y++){const F=e.conversations.find(J=>J.id===h);if(F)return F;y<m-1&&await new Promise(J=>setTimeout(J,100))}console.error("[useChatStream] Conversation not found after retries:",h)}function M(h,m){return`${h}:${m}`}function j(h,m){const y=e.conversations.find(J=>J.id===h);if(!y)return null;const F=y.messages.findIndex(J=>J.id===m);if(F<=0)return null;for(let J=F-1;J>=0;J--){const X=y.messages[J];if(X.role==="user"&&X.content.trim().length>0)return X.content}return null}async function B(h,m){const y=pt.get(m);if(y){y.lastMessageTime=Date.now();try{e.pushDebugEvent({direction:"in",channel:"ws",eventType:"ws.raw",payload:h},m);const F=JSON.parse(h);if(e.pushDebugEvent({direction:"in",channel:"ws",eventType:F.type,payload:F},m),F.type==="error"){console.error(`[useChatStream] Server error for ${m}:`,F.error);const J=F.error||"Unknown server error";y.lastServerError=J;const X=/codex cannot access session files|failed to clean up stale arg0 temp dirs: Permission denied|failed to initialize rollout recorder: Permission denied|failed to create session: Permission denied|\/\.codex\/.*permission denied/i.test(J);if(/state db missing rollout path for thread/i.test(J)&&!X){const Z=M(m,y.currentMessageId);if(!cr.has(Z)){const Y=j(m,y.currentMessageId);if(Y){cr.add(Z),e.setProviderSessionId("",m),E(y.currentMessageId,`
|
|
68
|
+
|
|
69
|
+
> **Session Reset**: Codex resume state was corrupted. Retrying once with a fresh session...
|
|
70
|
+
|
|
71
|
+
`,m);try{const oe=e.conversations.find(ae=>ae.id===m),ee=Pr(oe);await me(Y,y.currentMessageId,m,ee);return}catch(oe){console.error(`[useChatStream] Rollout-path recovery retry failed for ${m}:`,oe)}}}}c(y),S(y.currentMessageId,m,"error"),e.updateMessage(y.currentMessageId,{status:"error"},m),/state db missing rollout path for thread/i.test(J)&&e.setProviderSessionId("",m),cr.delete(M(m,y.currentMessageId)),e.setSessionError(J,m),e.endSession(m),e.endConversationStreaming(m),ke(m),e.saveConversation(m,!0),f(m);return}if(F.type==="done"){c(y);const J=p(m,y.currentMessageId);if(cr.delete(M(m,y.currentMessageId)),F.denied){S(y.currentMessageId,m,"error"),e.updateMessage(y.currentMessageId,{status:"stopped"},m),e.endSession(m),e.endConversationStreaming(m),ke(m),e.clearPendingPermission(m),y.activeTools.clear(),e.saveConversation(m,!0),f(m);return}if(J==="error"||J==="stopped"){S(y.currentMessageId,m,"error"),e.endSession(m),e.endConversationStreaming(m),ke(m),e.clearPendingPermission(m),y.activeTools.clear(),e.saveConversation(m,!0),f(m);return}S(y.currentMessageId,m,"complete"),e.completeMessageWithSave(y.currentMessageId,m),e.endSession(m),e.endConversationStreaming(m),s(m);const X=await w(m),se=X?.hasWorktree&&X.worktreePath?$fetch("/api/chat/worktree-commit",{method:"POST",body:{worktreePath:X.worktreePath,conversationId:m,previousBranch:X.worktreeBranch}}).then(Y=>X.previewBranch&&X.worktreePath?$fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:X.previewBranch,worktreePath:X.worktreePath}}).then(oe=>{if(!oe.success)throw new Error(oe.error||"Unknown preview sync failure");return Y}):Y).then(async Y=>{if(Y?.success&&Y.currentBranch!==X.worktreeBranch){const oe=X.worktreeBranch||"unknown";e.updateWorktreeBranch(m,Y.currentBranch);const ee=await e.syncConversationFeatureFromBranch(m),ae=Y.deletedPreviousBranch?` and deleted \`${oe}\``:"",le=ee?` and linked to feature \`${ee}\``:"";E(y.currentMessageId,`
|
|
72
|
+
|
|
73
|
+
> **Branch changed**: AI switched from \`${oe}\` to \`${Y.currentBranch}\`${ae}${le}
|
|
74
|
+
|
|
75
|
+
`,m)}else Y?.success&&X.worktreeBranch&&e.updateWorktreeBranch(m,X.worktreeBranch);return e.saveConversation(m,!1),Y}).catch(Y=>{console.warn("[useChatStream] Auto-commit/preview-sync failed:",Y)}):Promise.resolve(),Z=un.get(m);if(Z&&Z.queue.length>0){const Y=Z.queue.shift(),oe=Z.featureId;se.then(()=>{setTimeout(()=>{te(m,oe,Y)},1500)}),Z.queue.length===0&&un.delete(m)}e.clearPendingPermission(m),e.saveConversation(m,!0),y.activeTools.clear(),f(m),un.delete(m);return}if(F.type==="pong")return;if(F.type==="session_reset"){console.warn(`[useChatStream] Session reset for ${m}:`,F.reason),e.setProviderSessionId("",m),E(y.currentMessageId,`
|
|
76
|
+
|
|
77
|
+
> **Session Reset**: Previous session could not be resumed. Retrying with a fresh session...
|
|
78
|
+
|
|
79
|
+
`,m);return}if(F.type==="worktree_recovered"){console.log(`[useChatStream] Worktree recovered for ${m}`),E(y.currentMessageId,`
|
|
80
|
+
|
|
81
|
+
> **Worktree recovered**: The work directory was restored after a system restart.
|
|
82
|
+
|
|
83
|
+
`,m);return}if(F.type==="context_reset"){console.log(`[useChatStream] Context reset confirmed for ${m}`);return}if(F.type==="aborted"){console.log(`[useChatStream] Abort confirmed for ${m}`);return}if(F.type==="permission_request"){c(y),e.endConversationStreaming(m);const J=Ho(F.description||"",F.tool||"Permission");e.setPendingPermission(J,m);let X=`
|
|
84
|
+
|
|
85
|
+
**Permission Required**: ${J.tool}`;J.filePath&&(X+=` - ${J.filePath}`),E(y.currentMessageId,X+`
|
|
86
|
+
`,m);return}if(F.type==="permission_prompt"&&F.text){c(y),e.endConversationStreaming(m);const J=Ho(F.text,"Permission");e.setPendingPermission(J,m);const X=`
|
|
87
|
+
|
|
88
|
+
**${J.tool}**: ${J.filePath||J.command||J.description}
|
|
89
|
+
`;E(y.currentMessageId,X,m);return}F.type==="ui_event"&&F.event?H(F.event,m):F.type==="provider_json"&&F.data}catch(F){console.error(`[useChatStream] Failed to parse WebSocket message for ${m}:`,F,"Raw data:",h?.slice(0,200)),S(y.currentMessageId,m,"error"),e.updateMessage(y.currentMessageId,{status:"error"},m),e.setSessionError(`Failed to parse server response: ${F instanceof Error?F.message:"Invalid JSON"}`,m),e.endSession(m),e.endConversationStreaming(m),ke(m),e.saveConversation(m,!0),f(m)}}}function H(h,m){const y=pt.get(m);if(y)switch(e.pushDebugEvent({direction:"in",channel:"ui",eventType:h.type,payload:h},m),h.sessionId&&e.setProviderSessionId(h.sessionId,m),h.type){case"session_init":{O(y.currentMessageId,m);const F={id:Pn(),type:"session_init",model:h.model,tools:h.tools,permissionMode:h.permissionMode,cwd:h.cwd};e.appendContentBlockWithSave(y.currentMessageId,F,m);break}case"block_start":{O(y.currentMessageId,m);const F=h.blockId||Pn();if(h.blockType==="text"){const J={id:F,type:"text",text:h.text||""};e.appendContentBlockWithSave(y.currentMessageId,J,m),y.currentTextBlockId=F}else if(h.blockType==="thinking"){const J={id:F,type:"thinking",thinking:h.thinking||""};e.appendContentBlockWithSave(y.currentMessageId,J,m),y.currentThinkingBlockId=F}else if(h.blockType==="tool_use"&&h.toolUseId&&h.name){const J={id:F,type:"tool_use",toolUseId:h.toolUseId,name:h.name,input:{},inputSummary:"",status:"running"};e.appendContentBlockWithSave(y.currentMessageId,J,m),y.activeTools.set(h.index??0,{blockId:F,toolUseId:h.toolUseId,name:h.name,inputJson:""})}break}case"block_delta":{if(h.text&&y.currentTextBlockId&&_(y,m,h.text),h.thinking&&y.currentThinkingBlockId&&e.updateBlockWithSave(y.currentMessageId,y.currentThinkingBlockId,F=>{F.type==="thinking"&&(F.thinking+=h.thinking)},m,{syncContent:!1}),h.partialJson&&h.index!==void 0){const F=y.activeTools.get(h.index);F&&(F.inputJson+=h.partialJson)}break}case"block_end":{if(y.currentTextBlockId&&(y.currentTextBlockId=null),y.currentThinkingBlockId&&(y.currentThinkingBlockId=null),h.index!==void 0){const F=y.activeTools.get(h.index);if(F){let J={};try{J=JSON.parse(F.inputJson)}catch{}if(F.name==="ExitPlanMode"){const X={allowedPrompts:J.allowedPrompts};e.setPendingPlanApproval(X,m)}e.updateBlockWithSave(y.currentMessageId,F.blockId,X=>{if(X.type==="tool_use"){const se=X;se.input=J,se.inputSummary=Rh(J),se.status="pending"}},m)}}break}case"tool_result":{O(y.currentMessageId,m);const F=e.findToolUseBlock(y.currentMessageId,h.toolUseId,m);F&&F.type==="tool_use"&&e.updateBlockById(y.currentMessageId,F.id,X=>{X.type==="tool_use"&&(X.status=h.isError?"error":"complete")},m);const J={id:Pn(),type:"tool_result",toolUseId:h.toolUseId,content:h.content||"",isError:!!h.isError};e.appendContentBlockWithSave(y.currentMessageId,J,m);break}case"permission_request":{c(y),e.endConversationStreaming(m);const F={tool:h.tool,description:h.description,input:h.input,tools:h.tools};e.setPendingPermission(F,m);let J=`
|
|
90
|
+
|
|
91
|
+
**Permission Required**: ${F.tool}`;E(y.currentMessageId,J+`
|
|
92
|
+
`,m);break}case"turn_result":{if(h.subtype!=="success"&&(e.updateMessage(y.currentMessageId,{status:"error"},m),ke(m),h.subtype==="max_turns"&&e.setSessionError("Maximum conversation turns reached. Please start a new conversation.",m)),h.subtype==="success"&&h.usage){O(y.currentMessageId,m);const F={id:Pn(),type:"result_summary",totalCostUsd:h.totalCostUsd??0,durationMs:h.durationMs??0,numTurns:h.numTurns??0,usage:h.usage};e.appendContentBlockWithSave(y.currentMessageId,F,m)}break}case"error":{e.updateMessage(y.currentMessageId,{status:"error"},m),e.setSessionError(h.error,m);break}}}function O(h,m){e.initContentBlocks(h,m)}function E(h,m,y){O(h,y);const F={id:Pn(),type:"text",text:m};e.appendContentBlockWithSave(h,F,y)}function re(h,m){return!!e.conversations.find(J=>J.id===m)?.messages.find(J=>J.id===h)?.contentBlocks?.some(J=>J.type==="session_init")}async function me(h,m,y,F){if(typeof window>"u")return;const J=Eh();try{const X=await b(y),se=pt.get(y);se&&(se.currentMessageId=m,se.activeTools.clear(),se.currentTextBlockId=null,se.currentThinkingBlockId=null,d(se)),Bh(h)&&e.setProviderSessionId("",y);const Y=e.getProviderSessionId(y),oe=e.conversations.find(Me=>Me.id===y),ee=oe?.providerId||n.providerSelection.providerId||Go,ae=oe?.providerModelKey||n.providerSelection.modelKey||Wo;oe&&(!oe.providerId||!oe.providerModelKey)&&(e.setConversationProviderSelection(y,ee,ae),e.saveConversation(y,!0));const le={type:"chat",message:h,attachments:F?.attachments,requestId:J,sessionId:Y||void 0,permissionMode:e.permissionMode,conversationId:y,cwd:F?.cwd,worktreeBranch:F?.worktreeBranch,featureId:F?.featureId,providerId:ee,providerModelKey:ae};if(ee==="codex"&&!re(m,y)){O(m,y);const Me=e.permissionMode==="bypass"||e.permissionMode==="auto",Je={id:Pn(),type:"session_init",model:ae,tools:Array.from({length:32},(he,ne)=>`tool-${ne+1}`),permissionMode:Me?"bypassPermissions":e.permissionMode,cwd:F?.cwd||oe?.cwd||""};e.appendContentBlockWithSave(m,Je,y)}e.pushDebugEvent({direction:"out",channel:"ws",eventType:"chat",payload:le},y),X.send(JSON.stringify(le))}catch(X){e.updateMessage(m,{status:"error"},y),e.setSessionError(X.message||"Connection failed",y),e.endSession(y),e.endConversationStreaming(y),e.saveConversation(y,!0),f(y)}}function fe(h,m){const y=m??e.activeConversationId;if(!y)return;const F=pt.get(y);if(!F||F.ws.readyState!==WebSocket.OPEN)return;const J={type:"permission_response",allow:h};e.pushDebugEvent({direction:"out",channel:"ws",eventType:"permission_response",payload:J},y),F.ws.send(JSON.stringify(J)),h&&(e.startConversationStreaming(y),d(F));const X=h?"Allowed":"Denied";E(F.currentMessageId,`${X}
|
|
93
|
+
`,y),e.clearPendingPermission(y)}function xe(h,m,y){un.set(m,{featureId:h,queue:[...y]})}function ke(h){h?un.delete(h):un.clear()}async function te(h,m,y){e.activeConversationId!==h&&e.selectConversation(h);const F=e.conversations.find(Z=>Z.id===h);let J;if(y.startsWith("skill:")){const Z=y.replace("skill:","");try{J=(await $fetch(`/api/skills/${Z}/prompt`,{method:"POST",body:{featureId:m,cwd:F?.worktreePath}})).prompt}catch(Y){console.error(`[useChatStream] Failed to render skill prompt for ${Z}:`,Y);return}}else J=`/speckit.${y} ${m}`;e.addUserMessage(J,h),e.saveConversation(h,!0);const X=e.addAssistantMessage(h);e.startSession(Fo(),h),e.startConversationStreaming(h);const se=Pr(F);await me(J,X.id,h,se)}function z(h){const m=h??e.activeConversationId;if(!m)return;const y=pt.get(m);if(y){if(y.ws.readyState===WebSocket.OPEN){const F={type:"abort"};e.pushDebugEvent({direction:"out",channel:"ws",eventType:"abort",payload:F},m),y.ws.send(JSON.stringify(F)),y.ws.close()}y.currentMessageId&&(S(y.currentMessageId,m,"error"),e.updateMessage(y.currentMessageId,{status:"stopped"},m),e.endSession(m),e.saveConversation(m,!0)),pt.delete(m)}e.endConversationStreaming(m),e.clearPendingPermission(m),ke(m)}function G(h){const m=pt.get(h);m&&(c(m),m.ws.close(),pt.delete(h)),un.delete(h)}function I(){for(const[h,m]of pt)c(m),m.ws.close(),pt.delete(h);un.clear()}async function W(h){const m=h??e.activeConversationId;if(!m)return;e.clearPendingPlanApproval(m),e.setPermissionMode("auto");const y="Approved. Proceed with the implementation.";e.addUserMessage(y,m),e.saveConversation(m,!0);const F=e.addAssistantMessage(m);e.startSession(Fo(),m),e.startConversationStreaming(m);const J=e.conversations.find(se=>se.id===m),X=Pr(J,!0);await me(y,F.id,m,X)}function V(h){const m=h??e.activeConversationId;m&&e.clearPendingPlanApproval(m)}return kt(()=>{I()}),{sendMessage:me,sendPermissionResponse:fe,approvePlan:W,rejectPlan:V,abort:z,disconnect:I,disconnectConversation:G,enableCascade:xe,disableCascade:ke,resetContext:g}}const Nh={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Fh={class:"px-4 py-3 border-b border-retro-border flex items-center justify-between"},Hh=["disabled"],Oh={class:"px-4 py-4 space-y-3"},Uh={class:"relative"},jh=["disabled"],zh={key:0,value:""},Vh=["value"],Wh={key:0,class:"text-xs font-mono text-retro-red"},Gh={key:1,class:"text-xs font-mono text-retro-muted"},qh={class:"px-4 py-3 border-t border-retro-border flex items-center gap-2 justify-end"},Kh=["disabled"],Zh=["disabled"],Gr=Ae({__name:"NewConversationModal",props:{show:{type:Boolean},creating:{type:Boolean}},emits:["close","create"],setup(e,{emit:n}){const t=e,a=n,s=$([]),l=$(""),c=$(!1),d=$(""),p=D(()=>!c.value&&!t.creating&&l.value.length>0&&s.value.length>0);async function f(){c.value=!0,d.value="";try{const S=await $fetch("/api/git/branches"),g=S.branches.filter(w=>!w.isRemote&&!w.name.startsWith("sc/")).map(w=>w.name);if(s.value=g,!g.length){l.value="",d.value="No local branches available for chat creation.";return}const b=(S.current&&g.includes(S.current)?S.current:"")||(g.includes("main")?"main":"")||(g.includes("master")?"master":"")||g[0];l.value=b}catch(S){s.value=[],l.value="",d.value=S instanceof Error?S.message:"Failed to load branches"}finally{c.value=!1}}Pe(()=>t.show,S=>{S&&f()});function _(){p.value&&a("create",l.value)}return(S,g)=>(i(),de(Zt,{to:"body"},[q(hn,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:nt(()=>[e.show?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:g[3]||(g[3]=wt(b=>a("close"),["self"]))},[r("div",Nh,[r("div",Fh,[g[4]||(g[4]=r("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"New Conversation",-1)),r("button",{type:"button",class:"p-1 text-retro-muted hover:text-retro-text transition-colors",disabled:e.creating,onClick:g[0]||(g[0]=b=>a("close"))},[q(o($t),{class:"w-4 h-4"})],8,Hh)]),r("div",Oh,[g[5]||(g[5]=r("label",{class:"block text-xs font-mono text-retro-muted"},"Base Branch",-1)),r("div",Uh,[Ne(r("select",{"onUpdate:modelValue":g[1]||(g[1]=b=>l.value=b),disabled:c.value||e.creating||s.value.length===0,class:"w-full appearance-none bg-retro-black border border-retro-border rounded px-2 py-1.5 pr-7 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan disabled:opacity-40"},[c.value?(i(),u("option",zh,"Loading branches...")):P("",!0),(i(!0),u(ge,null,Ie(s.value,b=>(i(),u("option",{key:b,value:b},C(b),9,Vh))),128))],8,jh),[[Bn,l.value]]),q(o(Yr),{class:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})]),d.value?(i(),u("p",Wh,C(d.value),1)):(i(),u("p",Gh," The conversation worktree will be created from the selected branch. "))]),r("div",qh,[r("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",disabled:e.creating,onClick:g[2]||(g[2]=b=>a("close"))}," Cancel ",8,Kh),r("button",{type:"button",disabled:!p.value,class:"px-3 py-1.5 text-xs font-mono rounded border bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:_},C(e.creating?"Creating...":"Create"),9,Zh)])])])):P("",!0)]),_:1})]))}}),Yh={class:"h-full flex flex-col bg-retro-black"},Xh={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border"},Qh={class:"flex items-center gap-2 min-w-0"},Jh={class:"flex items-center gap-1"},ep={class:"flex-shrink-0 px-3 pt-3"},tp={class:"relative"},np={class:"flex-1 overflow-y-auto p-3"},rp={class:"space-y-2"},op={key:0,class:"flex items-center justify-center py-12"},sp={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},ap={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},ip=Ae({__name:"FeaturesPanel",setup(e){const n=Yt(),t=Cr(),{sendMessage:a,enableCascade:s}=mo(),l=Hn(),c=$("features"),d=$(null),p=$(null),f=$([]),_=$([]),S=$(!1),g=$(!1),b=$(null),w=$(!1),M=$(!1),j=$(!1),B=$(null),H=$(""),O=$("");let E=null;Pe(H,he=>{E&&clearTimeout(E),E=setTimeout(()=>{O.value=he},300)});const re=D(()=>{const he=O.value.trim().toLowerCase();return he?f.value.filter(ne=>ne.name.toLowerCase().includes(he)||ne.id.toLowerCase().includes(he)):f.value}),me=$({}),fe=D(()=>{const he=n.activeConversation;if(!he)return null;if(he.featureId)return he.featureId;const ne=he.worktreeBranch?.trim();return ne&&f.value.some(Ce=>Ce.id===ne)?ne:null}),xe=D(()=>fe.value||d.value);Pe(()=>n.activeConversationId,()=>{d.value=null;const he=fe.value;t.setSelectedFeatureId(he),he&&Kt(()=>{const ne=me.value[he];ne&&ne.scrollIntoView({behavior:"auto",block:"nearest"})})}),Pe(d,he=>{he&&Kt(()=>{const ne=me.value[he];ne&&ne.scrollIntoView({behavior:"auto",block:"nearest"})})});async function ke(){S.value=!0;try{const he=await $fetch("/api/specs/features");f.value=he.features}catch{l.error("Failed to load features"),f.value=[]}finally{S.value=!1}}async function te(){try{const he=await $fetch("/api/skills");_.value=he.skills}catch{_.value=[]}}xt(()=>{ke(),te(),window.addEventListener("keydown",I)}),kt(()=>{window.removeEventListener("keydown",I)});function z(he,ne={}){if(d.value=he,p.value=null,c.value="files",t.setSelectedFeatureId(he),ne.openViewer!==!1){const Ce=f.value.find(De=>De.id===he);Ce&&(b.value=Ce,g.value=!0)}}function G(){g.value=!1,b.value=null}function I(he){(he.ctrlKey||he.metaKey)&&he.key.toLowerCase()==="k"&&(he.preventDefault(),w.value||(w.value=!0))}function W(){w.value=!1}function V(he){z(he,{openViewer:!1}),w.value=!1}function h(){w.value=!0}const m=D(()=>f.value.map(he=>he.id)),y={plan:["tasks","implement"],tasks:["implement"],implement:[],clarify:[],analyze:[]},F={analyze:["skill:better-spec"]};async function J(he,ne,Ce){if(he.startsWith("skill:")){const De=he.replace("skill:",""),Fe=Ce?n.conversations.find(Ke=>Ke.id===Ce):null;return(await $fetch(`/api/skills/${De}/prompt`,{method:"POST",body:{featureId:ne,cwd:Fe?.worktreePath}})).prompt}return`/speckit.${he} ${ne}`}function X(he,ne){if(ne)return null;const Ce=n.findConversationByFeature(he);return Ce&&!n.isConversationStreaming(Ce.id)&&!Ce.finalized?(n.selectConversation(Ce.id),Ce.id):null}function se(he){const ne=n.findConversationByFeature(he);return ne&&ne.finalized?(l.error(`This feature has a finalized conversation "${ne.title}". Please archive it first to start a new conversation.`),n.selectConversation(ne.id),!0):!1}async function Z(he,ne,Ce){const De=await n.createConversation({featureId:he,baseBranch:Ce});if(!De)throw new Error("Failed to create conversation");return n.renameConversation(De,ne),n.selectConversation(De),De}async function Y(he,ne){n.addUserMessage(ne,he),n.saveConversation(he,!0);const Ce=n.conversations.find(je=>je.id===he),De=n.addAssistantMessage(he);n.startSession(`session-${Date.now()}`,he),n.startConversationStreaming(he);const Fe={};Ce?.worktreePath&&(Fe.cwd=Ce.worktreePath,Fe.worktreeBranch=Ce.worktreeBranch),Ce?.featureId&&(Fe.featureId=Ce.featureId),await a(ne,De.id,he,Object.keys(Fe).length>0?Fe:void 0)}async function oe(he,ne,Ce){const De=F[ne];let Fe;if(De&&De.length>0){const je=[...De.slice(1),ne,...y[ne]||[]];s(he,Ce,je);const Ke=De[0];try{Fe=await J(Ke,he,Ce)}catch(ot){l.error(ot instanceof Error?ot.message:"Failed to resolve prerequisite step");return}}else{const je=y[ne]||[];je.length>0&&s(he,Ce,je),Fe=`/speckit.${ne} ${he}`}await Y(Ce,Fe)}async function ee(he,ne,Ce){const De=he.shiftKey;if(!De&&se(ne))return;const Fe=X(ne,De);if(Fe){try{await oe(ne,Ce,Fe)}catch(je){l.error(je instanceof Error?je.message:"Failed to run cascade action")}return}B.value={type:"cascade",featureId:ne,command:Ce,title:`${Ce}: ${ne}`},M.value=!0}async function ae(he,ne){se(ne)||(B.value={type:"open-chat",featureId:ne,title:`spec: ${ne}`},M.value=!0)}async function le(he,ne,Ce){let De;try{const Fe=n.conversations.find(je=>je.id===Ce);De=await $fetch(`/api/skills/${ne}/prompt`,{method:"POST",body:{featureId:he,cwd:Fe?.worktreePath}})}catch(Fe){throw new Error(Fe instanceof Error?Fe.message:"Failed to render skill prompt")}await Y(Ce,De.prompt)}async function Me(he,ne,Ce){const De=he.shiftKey;if(!De&&se(ne))return;const Fe=X(ne,De);if(Fe){try{await le(ne,Ce,Fe)}catch(je){l.error(je instanceof Error?je.message:"Failed to run skill")}return}B.value={type:"skill",featureId:ne,skillId:Ce,title:`skill: ${Ce} — ${ne}`},M.value=!0}function ze(){M.value=!1,B.value=null}async function Je(he){if(B.value){j.value=!0;try{const ne=B.value,Ce=await Z(ne.featureId,ne.title,he);ne.type==="cascade"?await oe(ne.featureId,ne.command,Ce):ne.type==="skill"&&await le(ne.featureId,ne.skillId,Ce),M.value=!1,B.value=null}catch(ne){l.error(ne instanceof Error?ne.message:"Failed to create conversation")}finally{j.value=!1}}}return(he,ne)=>{const Ce=Ps("AutoModeToggle"),De=Hm,Fe=rh,je=Ah;return i(),u("div",Yh,[r("div",Xh,[r("div",Qh,[q(Ce)]),r("div",Jh,[r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Search (Ctrl/Cmd+K)",onClick:h},[q(o(Tn),{class:"h-4 w-4"})]),r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Refresh",onClick:ke},[q(o(Mn),{class:we(["h-4 w-4",{"animate-spin":o(S)}])},null,8,["class"])])])]),r("div",ep,[r("div",tp,[q(o(Tn),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-retro-subtle"}),Ne(r("input",{"onUpdate:modelValue":ne[0]||(ne[0]=Ke=>Ge(H)?H.value=Ke:null),type:"text",placeholder:"Search features...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono rounded border border-retro-border bg-retro-panel text-retro-text placeholder:text-retro-subtle focus:outline-none focus:border-retro-cyan transition-colors"},null,512),[[Ct,o(H)]])])]),r("div",np,[r("div",rp,[(i(!0),u(ge,null,Ie(o(re),Ke=>(i(),u("div",{key:Ke.id,ref_for:!0,ref:ot=>{o(me)[Ke.id]=ot}},[q(De,{feature:Ke,skills:o(_),"is-active":o(xe)===Ke.id,onSelect:ne[1]||(ne[1]=ot=>z(ot,{openViewer:!0})),onCascade:ee,onOpenChat:ae,onSkill:Me},null,8,["feature","skills","is-active"])]))),128))]),o(S)&&o(f).length===0?(i(),u("div",op,[...ne[2]||(ne[2]=[r("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading features...",-1)])])):P("",!0),!o(S)&&o(f).length>0&&o(re).length===0?(i(),u("div",sp,[q(o(Tn),{class:"h-10 w-10 text-retro-subtle mb-3"}),ne[3]||(ne[3]=r("p",{class:"text-sm font-mono text-retro-muted"},"No matching features",-1)),ne[4]||(ne[4]=r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Try a different search term ",-1))])):P("",!0),!o(S)&&o(f).length===0?(i(),u("div",ap,[q(o(aa),{class:"h-10 w-10 text-retro-subtle mb-3"}),ne[5]||(ne[5]=r("p",{class:"text-sm font-mono text-retro-muted"},"No features found",-1)),ne[6]||(ne[6]=r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Create a feature in specs/ to get started ",-1))])):P("",!0)]),o(g)&&o(b)?(i(),de(Fe,{key:0,feature:o(b),onClose:G},null,8,["feature"])):P("",!0),o(w)?(i(),de(je,{key:1,"available-feature-ids":o(m),onClose:W,onSelect:V},null,8,["available-feature-ids"])):P("",!0),q(Gr,{show:o(M),creating:o(j),onClose:ze,onCreate:Je},null,8,["show","creating"])])}}}),lp={class:"flex items-start justify-between gap-2"},cp={class:"flex-1 min-w-0"},up={key:1,class:"flex items-center gap-2"},dp={key:0,class:"flex-shrink-0 relative"},fp={class:"text-sm font-mono text-retro-text truncate"},mp={key:2,class:"text-xs font-mono text-retro-green bg-retro-green/10 px-1.5 py-0.5 rounded flex-shrink-0"},hp={key:4,class:"text-xs font-mono text-retro-orange bg-retro-orange/10 px-1.5 py-0.5 rounded flex-shrink-0"},pp={class:"text-xs text-retro-muted mt-1 truncate pl-6"},vp={class:"text-xs text-retro-muted/60 mt-1 pl-6"},gp={class:"truncate"},xp={class:"truncate"},bp={class:"truncate"},yp=Ae({__name:"ConversationItem",props:{conversation:{},isActive:{type:Boolean},isStreaming:{type:Boolean},isPreviewing:{type:Boolean}},emits:["select","archive","rename"],setup(e,{emit:n}){const t=e,a=n,s=$(!1),l=$("");function c(){l.value=t.conversation.title,s.value=!0}function d(){const b=l.value.trim();b&&b!==t.conversation.title&&a("rename",b),s.value=!1}function p(){s.value=!1}const f=Hn();async function _(b){try{await navigator.clipboard.writeText(b),f.success("Copied to clipboard",1500)}catch{f.error("Failed to copy")}}const S=D(()=>{const b=t.conversation.messages;if(!b.length)return"No messages";const w=b[b.length-1],M=w.content.slice(0,60);return M.length<w.content.length?M+"...":M}),g=D(()=>{const b=new Date(t.conversation.updatedAt),M=new Date().getTime()-b.getTime(),j=Math.floor(M/(1e3*60*60*24));return j===0?b.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):j===1?"Yesterday":j<7?`${j} days ago`:b.toLocaleDateString()});return(b,w)=>(i(),u("div",{class:we(["p-3 rounded border cursor-pointer transition-colors",[e.isPreviewing&&e.isActive?"border-retro-red bg-retro-red/20 ring-1 ring-retro-red/60 shadow-[0_0_0_1px_rgba(248,113,113,0.35)]":e.isPreviewing?"border-retro-red/40 bg-retro-red/10":e.isActive?"border-retro-cyan bg-retro-cyan/10":"border-retro-border hover:border-retro-cyan/50"]]),onClick:w[8]||(w[8]=M=>a("select"))},[r("div",lp,[r("div",cp,[s.value?(i(),u("div",{key:0,class:"flex gap-2",onClick:w[1]||(w[1]=wt(()=>{},["stop"]))},[Ne(r("input",{"onUpdate:modelValue":w[0]||(w[0]=M=>l.value=M),onKeyup:[mn(d,["enter"]),mn(p,["escape"])],onBlur:d,class:"flex-1 px-2 py-1 text-sm font-mono bg-retro-black border border-retro-cyan rounded text-retro-text focus:outline-none focus:ring-1 focus:ring-retro-cyan",autofocus:""},null,544),[[Ct,l.value]])])):(i(),u("div",up,[e.isStreaming?(i(),u("div",dp,[...w[9]||(w[9]=[r("div",{class:"w-4 h-4 rounded-full bg-retro-orange/30 animate-pulse"},null,-1),r("div",{class:"absolute inset-0 flex items-center justify-center"},[r("div",{class:"w-2 h-2 rounded-full bg-retro-orange animate-ping"})],-1)])])):(i(),de(o(es),{key:1,class:"w-4 h-4 text-retro-muted flex-shrink-0 -translate-y-px"})),r("h3",fp,C(e.conversation.title),1),e.conversation.finalized?(i(),u("span",mp," finalized ")):e.isPreviewing?(i(),u("span",{key:3,class:we(["text-xs font-mono px-1.5 py-0.5 rounded flex-shrink-0",e.isActive?"text-retro-red bg-retro-red/20 border border-retro-red/40":"text-retro-red bg-retro-red/10"])}," previewing ",2)):P("",!0),e.isStreaming?(i(),u("span",hp," streaming ")):P("",!0)])),r("p",pp,C(S.value),1),r("p",vp,C(g.value),1),e.conversation.worktreeBranch||e.conversation.baseBranch?(i(),u("div",{key:2,class:"mt-1.5 pl-6 flex flex-wrap gap-1",onClick:w[5]||(w[5]=wt(()=>{},["stop"]))},[e.conversation.baseBranch?(i(),u("button",{key:0,onClick:w[2]||(w[2]=M=>_(e.conversation.baseBranch)),class:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs font-mono rounded border border-retro-cyan/30 text-retro-cyan hover:border-retro-cyan hover:bg-retro-cyan/10 transition-colors max-w-full",title:"Click to copy base branch"},[q(o(Nr),{class:"w-3 h-3 flex-shrink-0"}),r("span",gp,"base: "+C(e.conversation.baseBranch),1)])):P("",!0),r("button",{onClick:w[3]||(w[3]=M=>_(e.conversation.worktreeBranch)),class:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs font-mono rounded border border-retro-green/30 text-retro-green hover:border-retro-green hover:bg-retro-green/10 transition-colors max-w-full",title:"Click to copy branch"},[q(o(Nr),{class:"w-3 h-3 flex-shrink-0"}),r("span",xp,C(e.conversation.worktreeBranch),1)]),e.conversation.worktreePath?(i(),u("button",{key:1,onClick:w[4]||(w[4]=M=>_(e.conversation.worktreePath)),class:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs font-mono rounded border border-retro-muted/30 text-retro-muted hover:border-retro-muted hover:bg-retro-muted/10 transition-colors max-w-full",title:"Click to copy path"},[q(o(Fr),{class:"w-3 h-3 flex-shrink-0"}),r("span",bp,C(e.conversation.worktreePath),1)])):P("",!0)])):P("",!0)]),r("div",{class:"flex gap-1 flex-shrink-0",onClick:w[7]||(w[7]=wt(()=>{},["stop"]))},[r("button",{onClick:c,class:"p-1 hover:bg-retro-panel rounded transition-colors",title:"Rename conversation"},[q(o(is),{class:"w-4 h-4 text-retro-muted hover:text-retro-cyan"})]),r("button",{onClick:w[6]||(w[6]=M=>a("archive")),class:"p-1 hover:bg-retro-cyan/20 rounded transition-colors",title:"Archive conversation"},[q(o(Lr),{class:"w-4 h-4 text-retro-muted hover:text-retro-cyan"})])])])],2))}}),wp={class:"h-full flex flex-col bg-retro-black"},kp={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border space-y-2"},Cp={class:"flex items-center justify-between gap-2"},$p={class:"flex items-center gap-1"},Sp={class:"relative"},_p=["placeholder"],Tp={key:0,class:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-retro-yellow/10 border-b border-retro-yellow/30 text-xs"},Mp={class:"text-retro-yellow font-mono"},Ap={class:"flex-1 overflow-y-auto p-2"},Bp={key:0,class:"space-y-1"},Ep={key:1,class:"text-center py-6 text-retro-muted"},Rp={class:"font-mono text-xs"},Pp={key:1,class:"text-center py-8 text-retro-muted"},Dp={key:0,class:"space-y-2"},Ip={class:"flex items-start justify-between gap-2"},Lp={class:"min-w-0"},Np={class:"text-sm font-mono text-retro-text truncate"},Fp={class:"text-xs text-retro-muted mt-1 truncate"},Hp={class:"text-xs text-retro-muted/70 mt-1"},Op={class:"text-xs text-retro-muted/70"},Up={class:"flex items-center gap-1 flex-shrink-0"},jp=["onClick"],zp=["onClick"],Vp={key:1,class:"text-center py-6 text-retro-muted"},Wp={class:"font-mono text-xs"},Gp={key:1,class:"text-center py-8 text-retro-muted"},qp=Ae({__name:"ConversationsPanel",setup(e){const n=Yt(),t=Hn(),a=$(""),s=$(""),l=$(!1),c=$(!1),d=$(!1),p=$(!1),f=$(null);let _=null;Pe(a,h=>{_&&clearTimeout(_),_=setTimeout(()=>{s.value=h},180)},{immediate:!0}),kt(()=>{_&&(clearTimeout(_),_=null)});const S=new Map,g=new Map;Pe(()=>n.sortedConversations.map(h=>h.id),h=>{const m=new Set(h);for(const y of S.keys())m.has(y)||S.delete(y)},{immediate:!0}),Pe(()=>n.sortedArchivedConversations.map(h=>h.id),h=>{const m=new Set(h);for(const y of g.keys())m.has(y)||g.delete(y)},{immediate:!0});function b(h){const m=h.messages[h.messages.length-1];return[h.updatedAt,h.title,h.messages.length,m?.id||"",m?.content?.length||0].join("|")}function w(h){const m=h.messages[h.messages.length-1];return[h.updatedAt,h.archivedAt,h.title,h.messages.length,m?.id||"",m?.content?.length||0].join("|")}function M(h){const m=b(h),y=S.get(h.id);if(y&&y.signature===m)return y.text;const F=[h.title,...h.messages.map(J=>J.content||"")].join(`
|
|
94
|
+
`).toLowerCase();return S.set(h.id,{signature:m,text:F}),F}function j(h){const m=w(h),y=g.get(h.id);if(y&&y.signature===m)return y.text;const F=[h.title,...h.messages.map(J=>J.content||"")].join(`
|
|
95
|
+
`).toLowerCase();return g.set(h.id,{signature:m,text:F}),F}const B=D(()=>n.conversationViewMode==="archive"),H=D(()=>{const h=n.sortedConversations;if(!s.value.trim())return h;const m=s.value.toLowerCase().trim();return h.filter(y=>M(y).includes(m))}),O=D(()=>{const h=n.sortedArchivedConversations;if(!s.value.trim())return h;const m=s.value.toLowerCase().trim();return h.filter(y=>j(y).includes(m))}),E=D(()=>n.previewingConversationId);async function re(){if(n.checkStorageLimits().atLimit){t.error("Delete or archive a conversation first (limit: 100).");return}l.value=!0}async function me(h){c.value=!0;try{if(!await n.createConversation({baseBranch:h})){t.error("Failed to create conversation");return}l.value=!1}catch(m){t.error(m instanceof Error?m.message:"Failed to create conversation")}finally{c.value=!1}}function fe(h){n.selectConversation(h),n.setConversationViewMode("active")}async function xe(h){const m=await n.archiveConversation(h);if(!m.success){t.error(m.error||"Failed to archive conversation");return}t.success("Conversation archived")}async function ke(h){f.value=h,d.value=!0}function te(){d.value=!1,f.value=null}async function z(h){if(f.value){p.value=!0;try{const m=await n.restoreArchivedConversation(f.value,h);if(!m.success){t.error(m.error||"Failed to restore archived conversation");return}t.success("Archived conversation restored"),d.value=!1,f.value=null}finally{p.value=!1}}}async function G(h){const m=await n.deleteArchivedConversation(h);if(!m.success){t.error(m.error||"Failed to delete archived conversation");return}t.success("Archived conversation deleted")}function I(h,m){n.renameConversation(h,m)}function W(h){return new Date(h).toLocaleString()}function V(h){if(!h.length)return"No messages";const y=(h[h.length-1].content||"").trim();return y?y.length>80?`${y.slice(0,80)}...`:y:"No messages"}return(h,m)=>(i(),u("div",wp,[r("div",kp,[r("div",Cp,[r("button",{onClick:re,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"New conversation","aria-label":"New conversation"},[q(o(vr),{class:"w-4 h-4"})]),r("div",$p,[r("button",{onClick:m[0]||(m[0]=y=>o(n).setConversationViewMode("active")),class:we(["p-1.5 rounded transition-colors",B.value?"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel":"text-retro-cyan bg-retro-cyan/10"]),title:"Active conversations","aria-label":"Active conversations"},[q(o(Qs),{class:"w-4 h-4"})],2),r("button",{onClick:m[1]||(m[1]=y=>o(n).setConversationViewMode("archive")),class:we(["p-1.5 rounded transition-colors",B.value?"text-retro-cyan bg-retro-cyan/10":"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel"]),title:"Archived conversations","aria-label":"Archived conversations"},[q(o(Lr),{class:"w-4 h-4"})],2)])]),r("div",Sp,[q(o(Tn),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted"}),Ne(r("input",{"onUpdate:modelValue":m[2]||(m[2]=y=>a.value=y),type:"text",placeholder:B.value?"Search archive...":"Search conversations...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono bg-retro-black border border-retro-border rounded focus:border-retro-cyan focus:outline-none focus:ring-1 focus:ring-retro-cyan text-retro-text placeholder-retro-muted"},null,8,_p),[[Ct,a.value]])])]),o(n).isNearStorageLimit?(i(),u("div",Tp,[q(o(wn),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("p",Mp,C(o(n).conversationCount)+" active conversations. Limit is 100. ",1)])):P("",!0),r("div",Ap,[B.value?(i(),u(ge,{key:1},[o(n).hasArchivedConversations?(i(),u("div",Dp,[O.value.length>0?(i(!0),u(ge,{key:0},Ie(O.value,(y,F,J,X)=>{const se=[y.id,y.title,y.updatedAt,y.archivedAt,y.messages.length];if(X&&X.key===y.id&&po(X,se))return X;const Z=(i(),u("div",{key:y.id,onClick:Y=>ke(y.id),onKeydown:[mn(wt(Y=>ke(y.id),["prevent"]),["enter"]),mn(wt(Y=>ke(y.id),["prevent"]),["space"])],class:"w-full text-left p-3 rounded border border-retro-border hover:border-retro-cyan/50 hover:bg-retro-cyan/5 transition-colors",role:"button",tabindex:"0"},[r("div",Ip,[r("div",Lp,[r("h3",Np,C(y.title),1),r("p",Fp,C(V(y.messages)),1),r("p",Hp," Archived: "+C(W(y.archivedAt)),1),r("p",Op," Updated: "+C(W(y.updatedAt)),1)]),r("div",Up,[r("button",{onClick:wt(Y=>ke(y.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-retro-cyan/40 text-retro-cyan rounded hover:bg-retro-cyan/10 transition-colors",title:"Restore archived conversation"},[q(o(Lr),{class:"w-3.5 h-3.5"}),m[9]||(m[9]=Re(" Restore ",-1))],8,jp),r("button",{onClick:wt(Y=>G(y.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-red-400/40 text-red-300 rounded hover:bg-red-500/10 transition-colors",title:"Delete archived conversation"},[q(o(pn),{class:"w-3.5 h-3.5"}),m[10]||(m[10]=Re(" Delete ",-1))],8,zp)])])],40,["onClick","onKeydown"]));return Z.memo=se,Z},m,5),128)):(i(),u("div",Vp,[r("p",Wp,'No archived results for "'+C(a.value)+'"',1)]))])):(i(),u("div",Gp,[...m[11]||(m[11]=[r("p",{class:"font-mono text-sm"},"No archived conversations",-1),r("p",{class:"text-xs mt-1"},"Archived conversations will appear here",-1)])]))],64)):(i(),u(ge,{key:0},[o(n).hasConversations?(i(),u("div",Bp,[H.value.length>0?(i(!0),u(ge,{key:0},Ie(H.value,(y,F,J,X)=>{const se=[y.id,y.title,y.updatedAt,y.messages.length,y.finalized,y.id===o(n).activeConversationId,o(n).isConversationStreaming(y.id),E.value===y.id];if(X&&X.key===y.id&&po(X,se))return X;const Z=(i(),u("div",{key:y.id},[q(yp,{conversation:y,"is-active":y.id===o(n).activeConversationId,"is-streaming":o(n).isConversationStreaming(y.id),"is-previewing":E.value===y.id,onSelect:Y=>fe(y.id),onArchive:Y=>xe(y.id),onRename:Y=>I(y.id,Y)},null,8,["conversation","is-active","is-streaming","is-previewing","onSelect","onArchive","onRename"])]));return Z.memo=se,Z},m,3),128)):(i(),u("div",Ep,[r("p",Rp,'No results for "'+C(a.value)+'"',1)]))])):(i(),u("div",Pp,[...m[8]||(m[8]=[r("p",{class:"font-mono text-sm"},"No conversations",-1),r("p",{class:"text-xs mt-1"},'Click "New" to start',-1)])]))],64))]),q(Gr,{show:l.value,creating:c.value,onClose:m[7]||(m[7]=y=>l.value=!1),onCreate:me},null,8,["show","creating"]),q(Gr,{show:d.value,creating:p.value,onClose:te,onCreate:z},null,8,["show","creating"])]))}}),Kp={mobile:768,tablet:1024};function Zp(e,n){return e<n.mobile?"mobile":e<n.tablet?"tablet":"desktop"}const _s=qr("layout",{state:()=>({currentViewport:"desktop",chatFullscreen:!1}),getters:{isMobile:e=>e.currentViewport==="mobile",isTablet:e=>e.currentViewport==="tablet",isDesktop:e=>e.currentViewport==="desktop",isChatFullscreen:e=>e.chatFullscreen},actions:{updateViewport(e){this.currentViewport=Zp(e,Kp)},toggleChatFullscreen(){this.chatFullscreen=!this.chatFullscreen},setChatFullscreen(e){this.chatFullscreen=e}}});function Yp(){const e=$(null),n=$(!0);let t=null,a="smooth";const s=50;function l(){const g=e.value;return g?g.scrollHeight-g.scrollTop-g.clientHeight<s:!0}function c(){n.value=l()}function d(g="smooth"){if(a=g,t!==null)return;t=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):w=>setTimeout(()=>w(Date.now()),16))(()=>{t=null,Kt(()=>{const w=e.value;w&&w.scrollTo({top:w.scrollHeight,behavior:a})})})}function p(g="smooth"){d(g),n.value=!0}function f(g="smooth"){n.value&&d(g)}function _(){n.value=!0}function S(){n.value=!1}return{containerRef:e,shouldAutoScroll:$e(n),onScroll:c,scrollToBottom:d,forceScrollToBottom:p,maybeScrollToBottom:f,enableAutoScroll:_,disableAutoScroll:S}}function Xp(e){if(!e)return null;if(e instanceof HTMLElement)return e;if(typeof e=="object"&&"$el"in e){const n=e.$el;return n instanceof HTMLElement?n:null}return null}function Qp(e){const{allMessages:n,containerRef:t,estimateItemHeight:a=120,overscan:s=6}=e,l=$(0),c=$(0),d=$(new Map),p=new Map;let f=null;function _(H,O){if(!Number.isFinite(O)||O<=0)return;const E=Math.ceil(O);if(d.value.get(H)===E)return;const re=new Map(d.value);re.set(H,E),d.value=re}function S(H,O){_(H,O.getBoundingClientRect().height)}function g(H,O){const E=p.get(H);E&&f&&f.unobserve(E),E&&delete E.dataset.virtualMessageId,p.delete(H);const re=Xp(O);re&&(re.dataset.virtualMessageId=H,p.set(H,re),S(H,re),f&&f.observe(re))}function b(){const H=t.value;H&&(l.value=H.scrollTop)}const w=D(()=>{const H=n.value,O=new Array(H.length);let E=0;for(let re=0;re<H.length;re++)O[re]=E,E+=d.value.get(H[re].id)??a;return{offsets:O,totalHeight:E}});function M(H,O){let E=0,re=H.length-1,me=H.length;for(;E<=re;){const fe=Math.floor((E+re)/2);H[fe]>=O?(me=fe,re=fe-1):E=fe+1}return me===H.length?Math.max(0,H.length-1):me}const j=D(()=>{const H=n.value;if(H.length===0)return[];const{offsets:O}=w.value,E=l.value,re=E+Math.max(c.value,1),me=M(O,Math.max(0,E-a));let fe=me;for(;fe<H.length&&O[fe]<re;)fe++;const xe=Math.max(0,me-s),ke=Math.min(H.length,fe+s),te=[];for(let z=xe;z<ke;z++)te.push({message:H[z],index:z,top:O[z]});return te}),B=D(()=>w.value.totalHeight);return xt(()=>{const H=t.value;H&&(c.value=H.clientHeight,l.value=H.scrollTop),f=new ResizeObserver(O=>{for(const E of O){const re=E.target;if(t.value&&re===t.value){c.value=E.contentRect.height;continue}const me=re.dataset.virtualMessageId;me&&_(me,E.contentRect.height)}}),t.value&&f.observe(t.value);for(const[O,E]of p)E.dataset.virtualMessageId=O,f.observe(E),S(O,E)}),kt(()=>{f&&(f.disconnect(),f=null),p.clear()}),{visibleItems:j,totalHeight:B,onVirtualScroll:b,setItemRef:g}}const Jp=["innerHTML"],ev=Ae({__name:"ChatTextBlock",props:{block:{}},setup(e){const n=e,{renderMarkdown:t}=$r(),a=D(()=>t(n.block.text));return(s,l)=>e.block.text.trim()?(i(),u("div",{key:0,class:"text-sm font-mono text-retro-text break-words chat-markdown",innerHTML:o(a)},null,8,Jp)):P("",!0)}}),tv={class:"my-1 border border-retro-border/30 rounded bg-retro-dark/30"},nv={key:0,class:"text-retro-muted/80 truncate min-w-0"},rv={class:"ml-auto text-retro-muted/60 text-[10px]"},ov={key:0,class:"px-3 pb-2 text-xs font-mono text-retro-muted whitespace-pre-wrap max-h-60 overflow-y-auto scrollbar-custom border-t border-retro-border/20"},sv=Ae({__name:"ChatThinkingBlock",props:{block:{}},setup(e){const n=e,t=$(!1),a=D(()=>n.block.thinking.split(`
|
|
96
|
+
`).length),s=D(()=>n.block.thinking.length>0&&n.block.thinking.length<=240&&a.value<=6),l=D(()=>{const c=n.block.thinking.replace(/\s+/g," ").trim();return c?c.length>140?`${c.slice(0,140)}...`:c:""});return Pe(()=>n.block.id,()=>{t.value=s.value},{immediate:!0}),(c,d)=>(i(),u("div",tv,[r("button",{class:"flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-retro-muted hover:text-retro-yellow transition-colors",onClick:d[0]||(d[0]=p=>t.value=!o(t))},[q(o(Zr),{class:we(["w-3 h-3 transition-transform flex-shrink-0",{"rotate-90":o(t)}])},null,8,["class"]),d[1]||(d[1]=r("span",{class:"text-retro-yellow"},"Thinking",-1)),!o(t)&&o(l)?(i(),u("span",nv,C(o(l)),1)):P("",!0),r("span",rv,C(o(a))+" lines · "+C(e.block.thinking.length)+" chars ",1)]),o(t)?(i(),u("div",ov,C(e.block.thinking),1)):P("",!0)]))}}),av={class:"my-2 border border-retro-border/40 rounded bg-retro-dark/30"},iv={key:0,class:"w-3 h-3 border-2 border-retro-yellow border-t-transparent rounded-full animate-spin flex-shrink-0"},lv={class:"text-retro-muted"},cv={class:"text-retro-cyan font-bold"},uv={class:"text-retro-muted truncate"},dv={key:0,class:"px-3 pb-2 border-t border-retro-border/20"},fv={key:0,class:"mt-2"},mv={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-36 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},hv={class:"text-xs font-mono text-retro-muted space-y-2 mt-2"},pv={key:0,class:"flex items-start gap-2"},vv={class:"text-retro-cyan break-all"},gv={key:1,class:"flex items-start gap-2"},xv={class:"text-retro-cyan break-all whitespace-pre-wrap"},bv={key:2,class:"flex items-start gap-2"},yv={key:1,class:"mt-2"},wv={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-52 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},kv={key:0,class:"text-[10px] text-retro-muted mt-1"},Cv={key:2,class:"mt-2"},$v={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-40 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},Sv={key:0,class:"text-[10px] text-retro-muted mt-1"},_v={key:3,class:"mt-2"},Tv={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-40 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},Mv={key:0,class:"text-[10px] text-retro-muted mt-1"},Av={class:"mt-2"},Bv={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded mt-1 overflow-x-auto max-h-40 overflow-y-auto scrollbar-custom"},Ev={key:4,class:"mt-3"},Rv={class:"space-y-2"},Pv={key:0,class:"text-[11px] font-mono text-retro-yellow mb-1"},Dv={key:1,class:"text-xs font-mono text-retro-text whitespace-pre-wrap"},Iv={key:2,class:"mt-2 space-y-1"},Lv={key:0,class:"text-retro-muted/80"},Nv={key:1,class:"px-3 pb-2 border-t border-retro-border/20"},Fv={class:"mb-1 text-[10px] text-retro-muted"},Hv={class:"text-retro-green"},Ov={class:"text-retro-red"},Uv={class:"space-y-0.5"},jv={class:"whitespace-pre-wrap"},zv={class:"whitespace-pre-wrap"},Vv=Ae({__name:"ChatToolBlock",props:{block:{},result:{}},setup(e){const n=e,t=$(!1),a=$(!1);function s(ee,ae){for(const le of ae){const Me=ee[le];if(typeof Me=="string"&&Me.trim())return Me}return""}function l(ee,ae){for(const le of ae){const Me=ee[le];if(typeof Me=="number"&&Number.isFinite(Me))return Me;if(typeof Me=="string"&&Me.trim()){const ze=Number(Me);if(Number.isFinite(ze))return ze}}return null}function c(ee,ae=14,le=1400){if(!ee)return{text:"",truncated:!1};const Me=ee.split(`
|
|
97
|
+
`);let ze=Me.slice(0,ae).join(`
|
|
98
|
+
`),Je=Me.length>ae;return ze.length>le&&(ze=ze.slice(0,le),Je=!0),{text:ze,truncated:Je}}const d=D(()=>n.block.name.toLowerCase()),p=D(()=>d.value.replace(/[^a-z0-9]/g,"")),f=D(()=>p.value==="requestuserinput"||p.value==="askuserquestion"),_=D(()=>d.value==="read"),S=D(()=>d.value==="write"),g=D(()=>d.value==="edit"||d.value==="multiedit"),b=D(()=>["bash","exec","execcommand","runcommand"].includes(d.value)),w=D(()=>n.block.status==="running"||n.block.status==="error"||S.value||g.value||f.value),M=D(()=>{if(!f.value)return[];const ee=n.block.input.questions;if(Array.isArray(ee))return ee.map(le=>le&&typeof le=="object"?le:null).filter(le=>!!le);const ae={header:s(n.block.input,["header","title"]),id:s(n.block.input,["id"]),question:s(n.block.input,["question"]),prompt:s(n.block.input,["prompt"]),message:s(n.block.input,["message","text","description"]),options:Array.isArray(n.block.input.options)?n.block.input.options:void 0};return!ae.question&&!ae.prompt&&!ae.message&&!ae.header?[]:[ae]});function j(ee,ae=120){const le=ee.replace(/\s+/g," ").trim();return le?le.length>ae?`${le.slice(0,ae)}...`:le:""}const B=D(()=>{const ee=M.value[0];return ee?j(ee.question||ee.prompt||ee.message||ee.header||""):""}),H=D(()=>s(n.block.input,["file_path","path","file","filepath","target_file"])),O=D(()=>{const ee=l(n.block.input,["offset","start_line","line"]),ae=l(n.block.input,["limit","lines","line_count"]),le=l(n.block.input,["end_line"]);return ee!==null&&ae!==null?`from line ${ee}, ${ae} lines`:ee!==null&&le!==null?`lines ${ee}-${le}`:ee!==null?`from line ${ee}`:ae!==null?`${ae} lines`:""}),E=D(()=>s(n.block.input,["content","text","new_content"])),re=D(()=>s(n.block.input,["old_string","oldText","old"])),me=D(()=>s(n.block.input,["new_string","newText","new","replacement"])),fe=D(()=>s(n.block.input,["cmd","command","script","chars"])),xe=D(()=>c(E.value)),ke=D(()=>c(re.value,10,1e3)),te=D(()=>c(me.value,10,1e3)),z=D(()=>{if(f.value)return B.value||"Prompting user for clarification";if(_.value){if(H.value&&O.value)return`Read ${H.value} (${O.value})`;if(H.value)return`Read ${H.value}`}return S.value&&H.value?`Write ${H.value}`:g.value&&H.value?`Edit ${H.value}`:b.value&&fe.value?`$ ${fe.value}`:n.block.inputSummary}),G=D(()=>{switch(n.block.status){case"running":return"[RUN]";case"pending":return"[WAIT]";case"complete":return"[OK]";case"error":return"[ERR]"}}),I=D(()=>Object.entries(n.block.input).filter(([ae,le])=>le==null||typeof le=="string"&&(!le.trim()||le.length>90)?!1:!["content","new_content","text","old_string","new_string"].includes(ae)).slice(0,6).map(([ae,le])=>`${ae}=${JSON.stringify(le)}`)),W=D(()=>{switch(n.block.status){case"running":return"text-retro-yellow";case"pending":return"text-retro-muted";case"complete":return"text-retro-green";case"error":return"text-retro-red"}}),V=D(()=>n.result?.content??""),h=D(()=>n.result?.isError??!1),m=D(()=>V.value.length),y=D(()=>V.value.split(`
|
|
99
|
+
`)),F=D(()=>a.value?y.value:y.value.slice(0,6)),J=D(()=>!V.value||!/^diff --git\s|\+\+\+\s|---\s|@@\s/m.test(V.value)?!1:/^[+\- ]/.test(y.value.find(ae=>ae.length>0)||"")||y.value.some(ae=>ae.startsWith("@@"))),X=D(()=>{if(!J.value)return{added:0,removed:0};let ee=0,ae=0;for(const le of y.value)le.startsWith("+++")||le.startsWith("---")||(le.startsWith("+")&&(ee+=1),le.startsWith("-")&&(ae+=1));return{added:ee,removed:ae}}),se=D(()=>V.value?V.value.split(`
|
|
100
|
+
`).slice(0,3).join(`
|
|
101
|
+
`):""),Z=D(()=>V.value?y.value.length>6||V.value.length>320:!1),Y=D(()=>V.value.trim().length>0);function oe(ee){return ee.startsWith("@@")?"text-retro-cyan bg-retro-cyan/10":ee.startsWith("+")&&!ee.startsWith("+++")?"text-retro-green bg-retro-green/10":ee.startsWith("-")&&!ee.startsWith("---")?"text-retro-red bg-retro-red/10":ee.startsWith("diff --git")||ee.startsWith("index ")||ee.startsWith("---")||ee.startsWith("+++")?"text-retro-yellow":"text-retro-muted"}return Pe(()=>n.block.id,()=>{t.value=w.value,a.value=!1},{immediate:!0}),Pe(()=>n.block.status,ee=>{(ee==="running"||ee==="error")&&(t.value=!0)}),(ee,ae)=>(i(),u("div",av,[r("button",{class:"flex items-center gap-2 w-full px-3 py-2 text-xs font-mono hover:bg-retro-dark/40 transition-colors text-left",onClick:ae[0]||(ae[0]=le=>t.value=!o(t))},[e.block.status==="running"?(i(),u("span",iv)):e.block.status==="pending"?(i(),de(o(ts),{key:1,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-muted animate-pulse"})):e.block.status==="complete"?(i(),de(o(xr),{key:2,class:we(["w-3.5 h-3.5 flex-shrink-0",o(W)])},null,8,["class"])):(i(),de(o(On),{key:3,class:we(["w-3.5 h-3.5 flex-shrink-0",o(W)])},null,8,["class"])),r("span",lv,C(o(G)),1),r("span",cv,C(e.block.name),1),r("span",uv,C(o(z)||e.block.inputSummary),1),q(o(Zr),{class:we(["w-3 h-3 ml-auto transition-transform text-retro-muted flex-shrink-0",{"rotate-90":o(t)}])},null,8,["class"])]),o(t)?(i(),u("div",dv,[o(I).length>0?(i(),u("div",fv,[ae[5]||(ae[5]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"Args",-1)),r("pre",mv,C(o(I).join(`
|
|
102
|
+
`)),1)])):P("",!0),r("div",hv,[o(H)?(i(),u("div",pv,[ae[6]||(ae[6]=r("span",{class:"text-retro-muted/80 min-w-12"},"File",-1)),r("code",vv,C(o(H)),1)])):P("",!0),o(b)&&o(fe)?(i(),u("div",gv,[ae[7]||(ae[7]=r("span",{class:"text-retro-muted/80 min-w-12"},"Cmd",-1)),r("code",xv,C(o(fe)),1)])):P("",!0),o(_)&&o(O)?(i(),u("div",bv,[ae[8]||(ae[8]=r("span",{class:"text-retro-muted/80 min-w-12"},"Range",-1)),r("span",null,C(o(O)),1)])):P("",!0)]),o(S)&&o(xe).text?(i(),u("div",yv,[ae[9]||(ae[9]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"New Content",-1)),r("pre",wv,C(o(xe).text),1),o(xe).truncated?(i(),u("div",kv,"Truncated preview")):P("",!0)])):P("",!0),o(g)&&o(ke).text?(i(),u("div",Cv,[ae[10]||(ae[10]=r("div",{class:"text-[11px] font-mono text-retro-yellow mb-1"},"Before",-1)),r("pre",$v,C(o(ke).text),1),o(ke).truncated?(i(),u("div",Sv,"Truncated preview")):P("",!0)])):P("",!0),o(g)&&o(te).text?(i(),u("div",_v,[ae[11]||(ae[11]=r("div",{class:"text-[11px] font-mono text-retro-green mb-1"},"After",-1)),r("pre",Tv,C(o(te).text),1),o(te).truncated?(i(),u("div",Mv,"Truncated preview")):P("",!0)])):P("",!0),r("details",Av,[ae[12]||(ae[12]=r("summary",{class:"text-[11px] font-mono text-retro-muted cursor-pointer hover:text-retro-cyan"},"Raw input JSON",-1)),r("pre",Bv,C(JSON.stringify(e.block.input,null,2)),1)]),o(f)&&o(M).length>0?(i(),u("div",Ev,[ae[13]||(ae[13]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"Clarification Prompt",-1)),r("div",Rv,[(i(!0),u(ge,null,Ie(o(M),(le,Me)=>(i(),u("div",{key:`${le.id||"q"}-${Me}`,class:"rounded border border-retro-border/30 bg-retro-panel/40 p-2"},[le.header?(i(),u("div",Pv,C(le.header),1)):P("",!0),le.question||le.prompt||le.message?(i(),u("div",Dv,C(le.question||le.prompt||le.message),1)):P("",!0),Array.isArray(le.options)&&le.options.length>0?(i(),u("div",Iv,[(i(!0),u(ge,null,Ie(le.options,(ze,Je)=>(i(),u("div",{key:`${le.id||"q"}-opt-${Je}`,class:"text-xs font-mono text-retro-muted"},[Re(C(ze.label||`Option ${Je+1}`)+" ",1),ze.description?(i(),u("span",Lv," - "+C(ze.description),1)):P("",!0)]))),128))])):P("",!0)]))),128))])])):P("",!0)])):P("",!0),o(Y)?(i(),u("div",Nv,[r("div",{class:we(["text-xs font-mono rounded p-2 mt-1 overflow-y-auto scrollbar-custom border",o(h)?"text-retro-red bg-retro-red/5 border-retro-red/40":"text-retro-muted bg-retro-panel/60 border-retro-border/30"]),style:Bt(o(a)?"max-height: 20rem":"")},[o(J)?(i(),u(ge,{key:0},[r("div",Fv,[ae[14]||(ae[14]=Re(" Diff · ",-1)),r("span",Hv,"+"+C(o(X).added),1),ae[15]||(ae[15]=Re(" / ",-1)),r("span",Ov,"-"+C(o(X).removed),1)]),r("div",Uv,[(i(!0),u(ge,null,Ie(o(F),(le,Me)=>(i(),u("div",{key:`diff-${Me}`,class:we(["px-1 rounded whitespace-pre-wrap break-all",oe(le)])},C(le||" "),3))),128))]),!o(a)&&o(Z)?(i(),u("button",{key:0,class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:ae[1]||(ae[1]=wt(le=>a.value=!0,["stop"]))}," Show full diff ("+C(o(m))+" chars) ",1)):o(Z)?(i(),u("button",{key:1,class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:ae[2]||(ae[2]=wt(le=>a.value=!1,["stop"]))}," Collapse diff ")):P("",!0)],64)):!o(a)&&o(Z)?(i(),u(ge,{key:1},[r("pre",jv,C(o(se)),1),r("button",{class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:ae[3]||(ae[3]=wt(le=>a.value=!0,["stop"]))}," Show full ("+C(o(m))+" chars) ",1)],64)):(i(),u(ge,{key:2},[r("pre",zv,C(o(V)),1),o(Z)?(i(),u("button",{key:0,class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:ae[4]||(ae[4]=wt(le=>a.value=!1,["stop"]))}," Collapse ")):P("",!0)],64))],6)])):P("",!0)]))}}),Wv={class:"mt-2 pt-2 border-t border-retro-border/20 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] font-mono text-retro-muted"},Gv={class:"flex items-center gap-1"},qv={class:"flex items-center gap-1"},Kv=Ae({__name:"ChatResultSummary",props:{block:{}},setup(e){const n=e,t=D(()=>{const l=Math.round(n.block.durationMs/1e3);return l<60?`${l}s`:`${Math.floor(l/60)}m ${l%60}s`}),a=D(()=>`$${n.block.totalCostUsd.toFixed(4)}`),s=D(()=>{const{inputTokens:l,outputTokens:c}=n.block.usage;return`${l.toLocaleString()} in / ${c.toLocaleString()} out`});return(l,c)=>(i(),u("div",Wv,[r("span",Gv,[c[0]||(c[0]=r("span",{class:"text-retro-muted/60"},"time",-1)),Re(" "+C(o(t)),1)]),r("span",qv,[c[1]||(c[1]=r("span",{class:"text-retro-muted/60"},"cost",-1)),Re(" "+C(o(a)),1)]),r("span",null,C(o(s)),1),r("span",null,C(e.block.numTurns)+" turn"+C(e.block.numTurns!==1?"s":""),1)]))}}),Zv={class:"px-2 py-1 text-[10px] font-mono text-retro-muted border-b border-retro-border/20 mb-1 flex items-center gap-2"},Yv={class:"text-retro-cyan"},Xv={key:0,class:"text-retro-border"},Qv={key:1},Jv=Ae({__name:"ChatSessionInit",props:{block:{}},setup(e){return(n,t)=>(i(),u("div",Zv,[r("span",Yv,C(e.block.model),1),t[0]||(t[0]=r("span",{class:"text-retro-border"},"|",-1)),r("span",null,C(e.block.tools.length)+" tools",1),e.block.permissionMode?(i(),u("span",Xv,"|")):P("",!0),e.block.permissionMode?(i(),u("span",Qv,C(e.block.permissionMode),1)):P("",!0)]))}}),eg=Ae({__name:"ChatContentBlock",props:{block:{},toolResultsByUseId:{}},setup(e){const n=e,t=D(()=>{if(n.block.type==="tool_use")return n.toolResultsByUseId.get(n.block.toolUseId)});return(a,s)=>{const l=ev,c=sv,d=Vv,p=Kv,f=Jv;return e.block.type==="text"?(i(),de(l,{key:0,block:e.block},null,8,["block"])):e.block.type==="thinking"?(i(),de(c,{key:1,block:e.block},null,8,["block"])):e.block.type==="tool_use"?(i(),de(d,{key:2,block:e.block,result:o(t)},null,8,["block","result"])):e.block.type==="result_summary"?(i(),de(p,{key:3,block:e.block},null,8,["block"])):e.block.type==="session_init"?(i(),de(f,{key:4,block:e.block},null,8,["block"])):P("",!0)}}}),tg={class:"flex-1 min-w-0"},ng={class:"flex items-center gap-2 mb-1"},rg={class:"text-xs font-mono text-retro-muted"},og={key:0,class:"text-xs font-mono text-retro-yellow animate-pulse"},sg={key:1,class:"text-xs font-mono text-retro-muted"},ag={key:2,class:"text-xs font-mono text-retro-red"},ig={key:1,class:"mb-2 flex flex-wrap gap-2"},lg=["href","download"],cg=["src","alt"],ug={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},dg=["innerHTML"],fg={key:3,class:"text-xs font-mono text-retro-muted italic"},mg={key:4,class:"inline-block w-2 h-4 bg-retro-cyan animate-pulse ml-0.5"},hg=Ae({__name:"ChatMessage",props:{message:{}},setup(e){const n=e,{renderMarkdown:t}=$r(),a=D(()=>n.message.role==="user"),s=D(()=>n.message.status==="streaming"),l=D(()=>n.message.status==="error"),c=D(()=>n.message.status==="stopped"),d=D(()=>zs(n.message)),p=D(()=>{const M=new Map;for(const j of n.message.contentBlocks??[])j.type==="tool_result"&&M.set(j.toolUseId,j);return M}),f=D(()=>{if(!n.message.contentBlocks)return[];const M=n.message.contentBlocks.filter(B=>B.type!=="tool_result"),j=[];for(const B of M){const H=j.length>0?j[j.length-1]:null;if(H?.type==="text"&&B.type==="text"){const O=H.text||"",E=B.text||"";H.text=`${O}${E}`;continue}if(H?.type==="thinking"&&B.type==="thinking"){const O=H.thinking||"",E=B.thinking||"";H.thinking=`${O}${E}`;continue}j.push({...B})}return j}),_=D(()=>d.value&&f.value.length>0),S=D(()=>n.message.content.trim().length>0),g=D(()=>n.message.attachments??[]),b=M=>new Date(M).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),w=D(()=>t(n.message.content));return(M,j)=>{const B=eg;return i(),u("div",{class:we(["flex gap-3 p-3",[o(a)?"bg-retro-dark/50":"bg-transparent",o(l)?"border-l-2 border-retro-red":""]])},[r("div",{class:we(["flex-shrink-0 w-6 h-6 rounded flex items-center justify-center",o(a)?"bg-retro-cyan/20":"bg-retro-green/20"])},[o(a)?(i(),de(o(Hr),{key:0,class:"w-4 h-4 text-retro-cyan"})):(i(),de(o(os),{key:1,class:"w-4 h-4 text-retro-green"}))],2),r("div",tg,[r("div",ng,[r("span",{class:we(["text-xs font-mono",o(a)?"text-retro-cyan":"text-retro-green"])},C(o(a)?"You":"Assistant"),3),r("span",rg,C(b(e.message.timestamp)),1),o(s)?(i(),u("span",og," typing... ")):P("",!0),o(c)?(i(),u("span",sg," (stopped) ")):P("",!0),o(l)?(i(),u("span",ag," (error) ")):P("",!0)]),o(_)?(i(!0),u(ge,{key:0},Ie(o(f),H=>(i(),de(B,{key:H.id,block:H,"tool-results-by-use-id":o(p)},null,8,["block","tool-results-by-use-id"]))),128)):P("",!0),o(a)&&o(g).length>0?(i(),u("div",ig,[(i(!0),u(ge,null,Ie(o(g),H=>(i(),u("a",{key:H.id,href:H.dataUrl,download:H.name,target:"_blank",rel:"noopener noreferrer",class:"w-28 rounded border border-retro-border/70 bg-retro-black/70 p-1 hover:border-retro-cyan/60"},[r("img",{src:H.dataUrl,alt:H.name,class:"h-20 w-full rounded object-cover"},null,8,cg),r("div",ug,C(H.name),1)],8,lg))),128))])):P("",!0),!o(_)&&o(S)?(i(),u("div",{key:2,class:"text-sm font-mono text-retro-text break-words chat-markdown",innerHTML:o(w)},null,8,dg)):P("",!0),!o(_)&&!o(S)&&!o(a)&&!o(s)?(i(),u("div",fg," (no visible response content) ")):P("",!0),o(s)?(i(),u("span",mg)):P("",!0)])],2)}}}),pg={key:0,class:"flex flex-col items-center justify-center h-full p-8 text-center"},vg={key:1,class:"relative"},gg={class:"sticky bottom-0"},xg={key:0,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50 backdrop-blur-sm"},bg={key:1,class:"px-4 py-2.5 bg-retro-red/20 border-t border-retro-red/50"},yg={class:"flex items-start gap-2"},wg={class:"flex-1 min-w-0"},kg={class:"flex items-center justify-between gap-2 mb-0.5"},Cg={class:"text-xs font-mono text-retro-red/80 break-words whitespace-pre-wrap"},$g={key:2,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50"},Sg=Ae({__name:"ChatMessages",setup(e){const n=Yt(),{containerRef:t,onScroll:a,maybeScrollToBottom:s,scrollToBottom:l,forceScrollToBottom:c}=Yp(),{visibleItems:d,totalHeight:p,onVirtualScroll:f,setItemRef:_}=Qp({allMessages:D(()=>n.messages),containerRef:t});function S(){a(),f()}const g=D(()=>n.isActiveConversationStreaming),b=D(()=>{const H=n.lastMessage;return!H||H.role!=="assistant"?null:H.status}),w=$(!1);function M(H){const O=H.contentBlocks;return!O||O.length===0?"":O.map(E=>{switch(E.type){case"tool_use":return`u:${E.id}:${E.status}:${E.inputSummary}`;case"tool_result":return`r:${E.id}:${E.toolUseId}:${E.isError?1:0}:${E.content.length}`;case"text":return`t:${E.id}:${E.text.length}`;case"thinking":return`k:${E.id}:${E.thinking.length}`;case"result_summary":return`s:${E.id}:${E.numTurns}:${E.durationMs}`;case"session_init":return`i:${E.id}:${E.model}:${E.tools.length}`;default:return""}}).join("|")}const j=$(null);function B(){if(j.value&&(j.value(),j.value=null),!t.value||typeof ResizeObserver>"u")return;const H=new ResizeObserver(()=>{s("instant")});H.observe(t.value),j.value=()=>{H.disconnect()}}return xt(()=>{l("instant"),B()}),kt(()=>{j.value&&j.value()}),Pe(()=>n.activeConversationId,()=>{w.value=!1,l("instant")}),Pe(t,()=>{B()}),Pe(()=>[n.activeConversationId,n.messages.length],([H,O])=>{!H||O===0||w.value||(w.value=!0,c("instant"))},{immediate:!0}),Pe(()=>n.messages.length,()=>{s("instant")}),Pe(()=>n.lastMessage?.content,()=>{s("instant")}),Pe([g,()=>n.lastError],()=>{s("instant")}),Pe(p,()=>{s("instant")}),(H,O)=>(i(),u("div",{ref_key:"containerRef",ref:t,class:"flex-1 overflow-y-auto",onScroll:S},[o(n).hasMessages?(i(),u("div",vg,[r("div",{class:"relative",style:Bt({height:`${o(p)}px`})},[(i(!0),u(ge,null,Ie(o(d),E=>(i(),u("div",{key:E.message.id,class:"absolute left-0 right-0 border-b border-retro-border/30",style:Bt({transform:`translateY(${E.top}px)`})},[r("div",{ref_for:!0,ref:re=>o(_)(E.message.id,re)},[zo([E.message.id,E.message.status,E.message.content,E.message.contentBlocks?.length||0,M(E.message),E.message.tools?.length||0],()=>q(hg,{message:E.message},null,8,["message"]),O,0)],512)],4))),128))],4)])):(i(),u("div",pg,[...O[2]||(O[2]=[r("div",{class:"text-retro-muted text-sm font-mono mb-2"}," No messages yet ",-1),r("div",{class:"text-retro-muted text-xs font-mono"}," Send a message to start chatting ",-1)])])),r("div",gg,[o(g)&&!o(n).lastError?(i(),u("div",xg,[...O[3]||(O[3]=[Vo('<div class="flex items-center gap-2"><div class="flex gap-1"><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:0ms;"></span><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:150ms;"></span><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:300ms;"></span></div><span class="text-xs font-mono text-retro-muted">Processing...</span></div>',1)])])):P("",!0),o(n).lastError?(i(),u("div",bg,[r("div",yg,[q(o(On),{class:"w-4 h-4 text-retro-red flex-shrink-0 mt-0.5"}),r("div",wg,[r("div",kg,[O[4]||(O[4]=r("p",{class:"text-xs font-mono font-semibold text-retro-red"},"Error",-1)),r("button",{class:"text-xs font-mono text-retro-red/60 hover:text-retro-red underline",onClick:O[1]||(O[1]=E=>o(n).clearError())}," Dismiss ")]),r("p",Cg,C(o(n).lastError),1),O[5]||(O[5]=r("p",{class:"text-xs font-mono text-retro-muted mt-1"}," Check browser console (F12) for more details ",-1))])])])):o(b)==="stopped"?(i(),u("div",$g,[...O[6]||(O[6]=[r("div",{class:"flex items-center gap-2"},[r("span",{class:"w-2 h-2 rounded-full bg-retro-muted"}),r("span",{class:"text-xs font-mono text-retro-muted"},"Stopped")],-1)])])):P("",!0)])],544))}});function _g(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"fill-rule":"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z","clip-rule":"evenodd"})])}function Oo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"fill-rule":"evenodd",d:"M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z","clip-rule":"evenodd"})])}function Tg(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})])}function Mg(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"fill-rule":"evenodd",d:"M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z","clip-rule":"evenodd"})])}const Ag={class:"flex-shrink-0 flex-grow-0 border-t border-retro-border bg-retro-dark p-3"},Bg={class:"flex items-center gap-2 mb-2"},Eg={class:"relative min-w-0 flex-1 max-w-[154px] model-selector"},Rg=["disabled"],Pg={class:"truncate text-left"},Dg={key:0,class:"absolute bottom-full left-0 mb-1 py-1 bg-retro-dark border border-retro-border rounded shadow-lg z-10 min-w-[220px] max-w-[280px]"},Ig={key:0,class:"px-3 py-1.5 text-xs font-mono text-retro-muted"},Lg={class:"px-3 py-1 text-[11px] font-mono uppercase tracking-wide text-retro-cyan/80 select-none"},Ng=["disabled","onClick"],Fg={class:"truncate"},Hg={class:"relative mode-selector"},Og={key:0,class:"absolute bottom-full left-0 mb-1 py-1 bg-retro-dark border border-retro-border rounded shadow-lg z-10 min-w-[140px]"},Ug=["onClick"],jg={class:"text-xs font-mono text-retro-muted"},zg={key:0,class:"mb-3 p-3 bg-retro-yellow/10 border border-retro-yellow/50 rounded"},Vg={class:"flex items-center justify-between gap-3"},Wg={class:"flex-1 min-w-0"},Gg={class:"text-xs font-mono text-retro-text truncate"},qg={class:"text-retro-cyan"},Kg={key:0,class:"text-retro-muted"},Zg={key:1,class:"text-retro-muted"},Yg={key:1,class:"mb-3 p-3 bg-retro-cyan/10 border border-retro-cyan/50 rounded"},Xg={key:2,class:"mb-2 flex flex-wrap gap-2"},Qg=["src","alt"],Jg={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},e1={class:"truncate text-[10px] font-mono text-retro-muted/80"},t1=["onClick"],n1={class:"flex gap-2 items-start"},r1=["disabled"],o1={class:"flex-1 relative min-h-[40px]"},s1=["disabled","placeholder"],a1=["disabled"],Uo=4,i1=5*1024*1024,l1=Ae({__name:"ChatInput",props:{disabled:{type:Boolean}},setup(e){const n=e,t=Yt(),a=Qn(),{sendMessage:s,sendPermissionResponse:l,approvePlan:c,rejectPlan:d,abort:p,resetContext:f}=mo(),_=$(""),S=$(null),g=$(null),b=$(!1),w=$(!1),M=$(!1),j=$([]);let B=null;const H=$(null),{data:O,pending:E}=Ir("chat-input-ai-providers",()=>$fetch("/api/ai/providers"),{server:!1,default:()=>({providers:[]})}),re=D(()=>O.value?.providers??[]),me=D(()=>t.permissionMode==="ask"||t.permissionMode==="plan"),fe=D(()=>{const U=new Map;for(const Q of re.value)for(const ue of Q.models)U.set(ue.label,(U.get(ue.label)??0)+1);return re.value.flatMap(Q=>Q.models.map(ue=>{const be=Q.capabilities.streaming&&(!me.value||Q.capabilities.permissions),Te=(U.get(ue.label)??0)>1;return{key:`${Q.id}::${ue.key}`,providerId:Q.id,providerName:Q.name,modelKey:ue.key,modelLabel:ue.label,label:Te?`${ue.label} · ${Q.name}`:ue.label,compatible:be}})).sort((Q,ue)=>Q.modelLabel.localeCompare(ue.modelLabel,void 0,{sensitivity:"base"})||Q.providerName.localeCompare(ue.providerName,void 0,{sensitivity:"base"}))}),xe=D(()=>{const U=new Map;for(const ue of fe.value){const be=U.get(ue.providerId);if(be){be.options.push(ue);continue}U.set(ue.providerId,{providerId:ue.providerId,providerName:ue.providerName,options:[ue]})}const ce=new Map([["codex",0],["claude",1]]),Q=Array.from(U.values());return Q.sort((ue,be)=>{const Te=ce.get(ue.providerId)??99,Be=ce.get(be.providerId)??99;return Te!==Be?Te-Be:ue.providerName.localeCompare(be.providerName,void 0,{sensitivity:"base"})}),Q});function ke(U){return`${U.providerId}::${U.modelKey}`}const te=D(()=>{const U=t.activeConversation;return U?.providerId&&U.providerModelKey?{providerId:U.providerId,modelKey:U.providerModelKey}:H.value?H.value:a.providerSelection}),z=D(()=>ke(te.value)),G=D(()=>fe.value.find(U=>U.key===z.value)||null),I=D(()=>G.value?.label||"Select model");function W(U,ce){t.setConversationProviderSelection(U,ce.providerId,ce.modelKey),t.clearProviderSession(U),t.saveConversation(U,!0)}function V(U){H.value&&(W(U,H.value),H.value=null)}function h(U){if(!U||!U.compatible)return;const ce={providerId:U.providerId,modelKey:U.modelKey},Q=t.activeConversationId;if(Q){W(Q,ce),H.value=null,M.value=!1;return}H.value=ce,M.value=!1}const m={plan:Xr,ask:Jr,auto:Jo,bypass:eo},y={plan:"text-retro-cyan",ask:"text-retro-green",auto:"text-retro-yellow",bypass:"text-retro-red"};function F(U){t.setPermissionMode(U),w.value=!1}function J(U){const ce=U.target;ce.closest(".mode-selector")||(w.value=!1),ce.closest(".model-selector")||(M.value=!1)}xt(()=>{document.addEventListener("click",J),a.hydrate()}),kt(()=>{document.removeEventListener("click",J),B!==null&&typeof window<"u"&&typeof window.cancelAnimationFrame=="function"&&(window.cancelAnimationFrame(B),B=null)});const X=D(()=>(_.value.trim().length>0||j.value.length>0)&&!t.isActiveConversationStreaming&&!b.value&&!t.pendingPermission&&!Y.value),se=D(()=>t.isActiveConversationStreaming&&!t.pendingPermission),Z=D(()=>t.pendingPermission!==null),Y=D(()=>t.pendingPlanApproval!==null);function oe(){l(!0,t.activeConversationId)}function ee(){l(!1,t.activeConversationId)}function ae(){c(t.activeConversationId)}function le(){d(t.activeConversationId)}function Me(){j.value=[],g.value&&(g.value.value="")}function ze(U){j.value=j.value.filter(ce=>ce.id!==U)}function Je(U){return U<1024?`${U} B`:U<1024*1024?`${(U/1024).toFixed(1)} KB`:`${(U/(1024*1024)).toFixed(1)} MB`}function he(U){return new Promise((ce,Q)=>{const ue=new FileReader;ue.onload=()=>{typeof ue.result=="string"?ce(ue.result):Q(new Error("Failed to read image"))},ue.onerror=()=>Q(ue.error||new Error("Failed to read image")),ue.readAsDataURL(U)})}async function ne(U){const ce=U.target,Q=ce.files?Array.from(ce.files):[];if(Q.length===0)return;const{useToast:ue}=await _n(async()=>{const{useToast:Be}=await import("./DqVSe5UI.js").then(Oe=>Oe.o);return{useToast:Be}},__vite__mapDeps([0,1,2]),import.meta.url),be=ue();let Te=Uo-j.value.length;if(Te<=0){be.warning(`You can attach up to ${Uo} images per message.`),ce.value="";return}for(const Be of Q){if(Te<=0)break;if(!Be.type.startsWith("image/")){be.warning(`Skipped "${Be.name}": only image files are supported.`);continue}if(Be.size>i1){be.warning(`Skipped "${Be.name}": max size is 5 MB.`);continue}try{const Oe=await he(Be);j.value.push({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:Be.name,mimeType:Be.type,size:Be.size,dataUrl:Oe}),Te--}catch{be.error(`Failed to attach "${Be.name}".`)}}ce.value=""}const Ce=D(()=>{if(t.isActiveConversationStreaming||b.value)return!1;const U=t.lastMessage;return U?.role==="assistant"&&U?.status==="error"});function De(U){const ce=U.instructionFiles.length>0?U.instructionFiles.map(ue=>{const be=ue.source==="cwd"?"cwd":"ancestor",Te=ue.mtime?` (mtime: ${ue.mtime})`:"";return`- \`${ue.path}\` [${be}] - ${ue.hint}${Te}`}):["- (none detected from current cwd ancestry)"],Q=U.specContext.files.length>0?U.specContext.files.map(ue=>`- \`${ue}\``):["- (none)"];return["## Context Snapshot","",`- Time: ${U.generatedAt}`,`- Session state: **${U.sessionState}**`,`- Provider session ID: \`${U.providerSessionId??"(empty)"}\``,`- Provider: \`${U.providerId}\` / \`${U.providerModelKey}\``,`- Permission mode: \`${U.permissionMode}\``,`- CWD (requested): \`${U.requestedCwd}\``,`- CWD (effective): \`${U.effectiveCwd}\``,`- Feature: \`${U.featureId??"(none)"}\``,"","### Spec Context Injection",`- Active on next turn: **${U.specContext.active?"yes":"no"}**`,`- Reason: ${U.specContext.reason}`,...Q,"","### Detected Instruction Files",...ce].join(`
|
|
103
|
+
`)}function Fe(U){return(U.match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(Q=>Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'")?Q.slice(1,-1):Q)}function je(U){const ce=U.match(/^\/(?:spec-search|specsearch)\b(.*)$/i);if(!ce)return null;const Q=Fe(ce[1]?.trim()??""),ue=[],be={q:""};for(let Te=0;Te<Q.length;Te++){const Be=Q[Te];if(Be==="--mode"&&Q[Te+1]){const Oe=Q[++Te];(Oe==="keyword"||Oe==="semantic"||Oe==="hybrid")&&(be.mode=Oe);continue}if(Be.startsWith("--mode=")){const Oe=Be.slice(7);(Oe==="keyword"||Oe==="semantic"||Oe==="hybrid")&&(be.mode=Oe);continue}if(Be==="--feature"&&Q[Te+1]){be.featureId=Q[++Te];continue}if(Be.startsWith("--feature=")){be.featureId=Be.slice(10);continue}if(Be==="--file-type"&&Q[Te+1]){be.fileType=Q[++Te];continue}if(Be.startsWith("--file-type=")){be.fileType=Be.slice(12);continue}if(Be==="--limit"&&Q[Te+1]){const Oe=Number.parseInt(Q[++Te],10);Number.isFinite(Oe)&&Oe>0&&(be.limit=Oe);continue}if(Be.startsWith("--limit=")){const Oe=Number.parseInt(Be.slice(8),10);Number.isFinite(Oe)&&Oe>0&&(be.limit=Oe);continue}ue.push(Be)}return be.q=ue.join(" ").trim(),be}function Ke(U,ce=1400){const Q=U.trim();return Q.length<=ce?Q:`${Q.slice(0,ce)}
|
|
104
|
+
...`}function ot(U,ce){const Q=[];if(Q.push("## Spec Search Results"),Q.push(""),Q.push(`- Query: \`${U.q}\``),Q.push(`- Mode: \`${ce.mode}\``),U.featureId&&Q.push(`- Feature filter: \`${U.featureId}\``),U.fileType&&Q.push(`- File type filter: \`${U.fileType}\``),Q.push(`- Hits: **${ce.totalCount}** (${ce.searchTime}ms)`),ce.warning&&Q.push(`- Warning: ${ce.warning}`),ce.results.length===0)return Q.push(""),Q.push("No matching indexed chunks were found."),Q.join(`
|
|
105
|
+
`);Q.push("");for(const[ue,be]of ce.results.entries()){const Te=be.chunk;Q.push(`### ${ue+1}. \`${Te.sourcePath}:${Te.lineStart}\``),Q.push(`- Match: \`${be.matchType}\` (score: ${be.score.toFixed(3)})`),Te.headingHierarchy.length>0&&Q.push(`- Headings: ${Te.headingHierarchy.join(" > ")}`),Q.push(""),Q.push(Ke(Te.content)),Q.push("")}return Q.join(`
|
|
106
|
+
`)}async function jt(U){const ce=t.activeConversationId??await t.createConversation(),Q=t.addAssistantMessage(ce);if(!U.q){t.updateMessage(Q.id,{content:["Usage: `/spec-search <query> [--mode keyword|semantic|hybrid] [--feature <feature-id>] [--file-type <type>] [--limit <n>]`","","Examples:","- `/spec-search FR-001`",'- `/spec-search "indexing indicator" --mode hybrid --feature 008-spec-search --limit 5`'].join(`
|
|
107
|
+
`),status:"complete"},ce);return}const ue=t.activeConversation,be={q:U.q,mode:U.mode??"hybrid",featureId:U.featureId??ue?.featureId,fileType:U.fileType,limit:String(U.limit??5)};try{const Te=await $fetch("/api/specs/search",{query:be});t.updateMessage(Q.id,{content:ot({...U,mode:be.mode,featureId:be.featureId},Te),status:"complete"},ce)}catch(Te){const Be=Te instanceof Error?Te.message:"Failed to run spec search";t.updateMessage(Q.id,{content:`Spec search failed: ${Be}`,status:"error"},ce)}}async function Xt(){const U=t.activeConversation,ce={permissionMode:t.permissionMode};U?.hasWorktree&&U.worktreePath?ce.cwd=U.worktreePath:U?.cwd&&(ce.cwd=U.cwd),U?.featureId&&(ce.featureId=U.featureId),U?.providerId&&(ce.providerId=U.providerId),U?.providerModelKey&&(ce.providerModelKey=U.providerModelKey),U?.providerSessionId&&(ce.providerSessionId=U.providerSessionId);const Q=await $fetch("/api/chat/context",{query:ce}),ue=t.activeConversationId??await t.createConversation(),be=t.addAssistantMessage(ue);t.updateMessage(be.id,{content:De(Q),status:"complete"},ue)}async function st(){const U=_.value.trim(),ce=[...j.value];if(U.length===0&&ce.length===0||t.isActiveConversationStreaming||b.value||n.disabled)return;const Q=!!t.activeConversationId;if(U==="/reset"||U==="/reset-context"){await St();return}if(U==="/context"||U==="/ctx"){await Xt(),_.value="",Me(),Tt();return}const ue=je(U);if(ue){await jt(ue),_.value="",Me(),Tt();return}b.value=!0,_.value="",Me(),Tt();try{await t.addUserMessageWithConversation(U,ce);const be=t.activeConversationId;Q||V(be);const Te=t.addAssistantMessage();t.startSession(`session-${Date.now()}`),t.startConversationStreaming(be);const Be=t.activeConversation,Oe={};Be?.hasWorktree&&Be.worktreePath&&(Oe.cwd=Be.worktreePath,Oe.worktreeBranch=Be.worktreeBranch),Be?.featureId&&(Oe.featureId=Be.featureId),ce.length>0&&(Oe.attachments=ce),await s(U,Te.id,be,Object.keys(Oe).length>0?Oe:void 0)}catch(be){const Te=be instanceof Error?be.message:"Failed to send message";t.setSessionError(Te);const Be=t.lastMessage;Be&&Be.role==="assistant"&&t.updateMessage(Be.id,{status:"error"}),t.activeConversationId&&(t.endSession(t.activeConversationId),t.endConversationStreaming(t.activeConversationId))}finally{b.value=!1}}async function It(){try{p(t.activeConversationId)}catch{}}async function St(){if(t.activeConversationId){_.value="",Me(),Tt(),b.value=!0;try{await f(t.activeConversationId);const U=t.addAssistantMessage(t.activeConversationId);t.updateMessage(U.id,{content:"✨ **Context cleared** — The AI conversation context has been reset. Starting fresh from here.",status:"complete"},t.activeConversationId);const{useToast:ce}=await _n(async()=>{const{useToast:ue}=await import("./DqVSe5UI.js").then(be=>be.o);return{useToast:ue}},__vite__mapDeps([0,1,2]),import.meta.url);ce().success("AI context has been reset. The conversation will start fresh.")}catch(U){console.error("Failed to reset context:",U);const{useToast:ce}=await _n(async()=>{const{useToast:ue}=await import("./DqVSe5UI.js").then(be=>be.o);return{useToast:ue}},__vite__mapDeps([0,1,2]),import.meta.url);ce().error("Failed to reset context. Please try again.")}finally{b.value=!1}}}async function _t(){const U=t.messages;let ce=null;for(let ue=U.length-1;ue>=0;ue--)if(U[ue].role==="user"){ce={content:U[ue].content,attachments:U[ue].attachments??[]};break}if(!ce||!t.activeConversationId)return;const Q=t.activeConversationId;t.clearError(),b.value=!0;try{const ue=t.addAssistantMessage();t.startSession(`session-${Date.now()}`),t.startConversationStreaming(Q);const be=t.activeConversation,Te={};be?.hasWorktree&&be.worktreePath&&(Te.cwd=be.worktreePath,Te.worktreeBranch=be.worktreeBranch),be?.featureId&&(Te.featureId=be.featureId),ce.attachments.length>0&&(Te.attachments=ce.attachments),await s(ce.content,ue.id,Q,Object.keys(Te).length>0?Te:void 0)}catch(ue){const be=ue instanceof Error?ue.message:"Failed to retry message";t.setSessionError(be);const Te=t.lastMessage;Te&&Te.role==="assistant"&&t.updateMessage(Te.id,{status:"error"}),t.endSession(Q),t.endConversationStreaming(Q)}finally{b.value=!1}}function Lt(U){U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),st())}function vt(){const U=S.value;if(U){if(!_.value.trim()){U.style.height="";return}U.style.height="auto",U.style.height=Math.min(U.scrollHeight,200)+"px"}}function Ot(){if(B!==null)return;B=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):ce=>setTimeout(()=>ce(Date.now()),16))(()=>{B=null,vt()})}function Tt(){const U=S.value;U&&(U.style.height="")}function Nt(){Kt(()=>{S.value?.focus()})}return Pe(_,Ot),Pe(()=>t.isActiveConversationStreaming,(U,ce)=>{ce&&!U&&Nt()}),Pe(()=>t.activeConversationId,()=>{t.activeConversationId&&(H.value=null),Me(),Nt()}),(U,ce)=>(i(),u("div",Ag,[r("div",Bg,[r("div",Eg,[r("button",{disabled:e.disabled||o(t).isActiveConversationStreaming||o(Z)||o(Y)||o(E)||o(fe).length===0,class:"flex items-center justify-between gap-1.5 w-full px-2 py-1 rounded border border-retro-border/50 hover:border-retro-border text-xs font-mono text-retro-muted transition-colors disabled:opacity-60 disabled:cursor-not-allowed",onClick:ce[0]||(ce[0]=Q=>M.value=!o(M))},[r("span",Pg,C(o(I)),1),q(o(Oo),{class:"w-3 h-3 flex-shrink-0"})],8,Rg),o(M)?(i(),u("div",Dg,[o(fe).length===0?(i(),u("div",Ig," Loading models... ")):P("",!0),(i(!0),u(ge,null,Ie(o(xe),Q=>(i(),u("div",{key:Q.providerId,class:"py-0.5"},[r("div",Lg,C(Q.providerName),1),(i(!0),u(ge,null,Ie(Q.options,ue=>(i(),u("button",{key:ue.key,disabled:!ue.compatible,class:we(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors disabled:opacity-50 disabled:cursor-not-allowed",o(z)===ue.key?"bg-retro-panel text-retro-text":"text-retro-muted"]),onClick:be=>h(ue)},[r("span",Fg,C(ue.modelLabel)+C(ue.compatible?"":" (unsupported for current permission mode)"),1)],10,Ng))),128))]))),128))])):P("",!0)]),r("div",Hg,[r("button",{class:we(["flex items-center gap-1.5 px-2 py-1 rounded border border-retro-border/50 hover:border-retro-border text-xs font-mono transition-colors",y[o(t).permissionMode]]),onClick:ce[1]||(ce[1]=Q=>w.value=!o(w))},[(i(),de(In(m[o(t).permissionMode]),{class:"w-4 h-4"})),r("span",null,C(o(Dn)[o(t).permissionMode]),1),q(o(Oo),{class:"w-3 h-3"})],2),o(w)?(i(),u("div",Og,[(i(),u(ge,null,Ie(["plan","ask","auto","bypass"],Q=>r("button",{key:Q,class:we(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors",[y[Q],o(t).permissionMode===Q?"bg-retro-panel":""]]),onClick:ue=>F(Q)},[(i(),de(In(m[Q]),{class:"w-4 h-4"})),r("span",null,C(o(Dn)[Q]),1)],10,Ug)),64))])):P("",!0)]),r("span",jg,C(o(t).permissionMode==="plan"?"Plan only":o(t).permissionMode==="ask"?"Ask before actions":o(t).permissionMode==="auto"?"Auto approve":"All permissions"),1)]),o(Z)?(i(),u("div",zg,[r("div",Vg,[r("div",Wg,[ce[4]||(ce[4]=r("div",{class:"text-xs font-mono text-retro-yellow font-bold mb-1"}," Permission Required ",-1)),r("div",Gg,[r("span",qg,C(o(t).pendingPermission?.tool),1),o(t).pendingPermission?.filePath?(i(),u("span",Kg," - "+C(o(t).pendingPermission.filePath),1)):o(t).pendingPermission?.command?(i(),u("span",Zg," - "+C(o(t).pendingPermission.command),1)):P("",!0)])]),r("div",{class:"flex gap-2 flex-shrink-0"},[r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-green/20 text-retro-green border border-retro-green/50 hover:bg-retro-green/30 transition-colors",onClick:oe}," Allow "),r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-red/20 text-retro-red border border-retro-red/50 hover:bg-retro-red/30 transition-colors",onClick:ee}," Deny ")])])])):P("",!0),o(Y)?(i(),u("div",Yg,[r("div",{class:"flex items-center justify-between gap-3"},[ce[5]||(ce[5]=r("div",{class:"flex-1 min-w-0"},[r("div",{class:"text-xs font-mono text-retro-cyan font-bold mb-1"}," Plan Ready for Review "),r("div",{class:"text-xs font-mono text-retro-muted"}," Approve to switch to Auto mode and start implementation. ")],-1)),r("div",{class:"flex gap-2 flex-shrink-0"},[r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-green/20 text-retro-green border border-retro-green/50 hover:bg-retro-green/30 transition-colors",onClick:ae}," Approve & Implement "),r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-red/20 text-retro-red border border-retro-red/50 hover:bg-retro-red/30 transition-colors",onClick:le}," Reject ")])])])):P("",!0),o(j).length>0?(i(),u("div",Xg,[(i(!0),u(ge,null,Ie(o(j),Q=>(i(),u("div",{key:Q.id,class:"relative w-24 rounded border border-retro-border/70 bg-retro-black/80 p-1"},[r("img",{src:Q.dataUrl,alt:Q.name,class:"h-16 w-full rounded object-cover"},null,8,Qg),r("div",Jg,C(Q.name),1),r("div",e1,C(Je(Q.size)),1),r("button",{class:"absolute -right-2 -top-2 rounded-full border border-retro-border bg-retro-panel p-0.5 text-retro-red hover:bg-retro-red/20",type:"button",onClick:ue=>ze(Q.id)},[q(o($t),{class:"h-3 w-3"})],8,t1)]))),128))])):P("",!0),r("div",n1,[r("input",{ref_key:"fileInputRef",ref:g,type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:ne},null,544),r("button",{class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-panel/70 text-retro-muted hover:text-retro-cyan hover:bg-retro-panel disabled:opacity-50 disabled:cursor-not-allowed transition-colors",type:"button",title:"Attach images",disabled:e.disabled||o(t).isActiveConversationStreaming||o(Z)||o(Y),onClick:ce[2]||(ce[2]=Q=>o(g)?.click())},[q(o(ma),{class:"w-5 h-5"})],8,r1),r("div",o1,[Ne(r("textarea",{ref_key:"inputRef",ref:S,"onUpdate:modelValue":ce[3]||(ce[3]=Q=>Ge(_)?_.value=Q:null),disabled:e.disabled||o(t).isActiveConversationStreaming||o(Z)||o(Y),placeholder:e.disabled?"This conversation is finalized (read-only)":"Type a message...",rows:"1",class:"w-full h-full min-h-[40px] px-3 py-2 bg-retro-black border border-retro-border rounded text-sm font-mono text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan disabled:opacity-50 disabled:cursor-not-allowed resize-none overflow-hidden",onKeydown:Lt},null,40,s1),[[Ct,o(_)]])]),o(Ce)?(i(),u("button",{key:0,class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-yellow/20 text-retro-yellow hover:bg-retro-yellow/30 transition-colors",title:"Retry last message",onClick:_t},[q(o(_g),{class:"w-5 h-5"})])):P("",!0),!o(se)&&!o(Z)?(i(),u("button",{key:1,disabled:!o(X),class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-cyan/20 text-retro-cyan hover:bg-retro-cyan/30 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",onClick:st},[q(o(Tg),{class:"w-5 h-5"})],8,a1)):o(se)?(i(),u("button",{key:2,class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-red/20 text-retro-red hover:bg-retro-red/30 transition-colors",onClick:It},[q(o(Mg),{class:"w-5 h-5"})])):P("",!0)]),ce[6]||(ce[6]=r("div",{class:"mt-1 text-xs font-mono text-retro-muted"}," Press Enter to send, Shift+Enter for new line. Slash commands: `/context`, `/reset`, `/spec-search`. You can attach up to 4 images (5 MB each). ",-1))]))}}),c1={class:"h-64 border-t border-retro-border bg-retro-dark/50 flex flex-col"},u1={class:"h-9 flex items-center justify-between px-3 border-b border-retro-border/40"},d1={key:0,class:"flex-1 flex items-center justify-center text-xs font-mono text-retro-muted"},f1={key:1,class:"flex-1 overflow-y-auto scrollbar-custom"},m1={class:"flex items-center gap-2 text-[10px] font-mono"},h1={class:"text-retro-muted"},p1={class:"text-retro-muted"},v1={class:"text-retro-green truncate"},g1={class:"mt-1 text-[11px] font-mono text-retro-text whitespace-pre-wrap break-words"},x1=Ae({__name:"ChatDebugPanel",setup(e){const n=Yt(),{debugEvents:t}=Ds(n);function a(l){return new Date(l).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function s(l){return l==="in"?"text-retro-cyan":l==="out"?"text-retro-yellow":"text-retro-muted"}return(l,c)=>(i(),u("div",c1,[r("div",u1,[c[1]||(c[1]=r("div",{class:"text-[11px] font-mono text-retro-text"}," Debug Stream (CLI/Provider) ",-1)),r("button",{class:"p-1 rounded hover:bg-retro-panel transition-colors",title:"Clear debug events",onClick:c[0]||(c[0]=d=>o(n).clearDebugEvents())},[q(o(pn),{class:"w-3.5 h-3.5 text-retro-muted"})])]),o(t).length===0?(i(),u("div",d1," No debug events yet ")):(i(),u("div",f1,[(i(!0),u(ge,null,Ie(o(t),d=>(i(),u("div",{key:d.id,class:"px-3 py-2 border-b border-retro-border/20"},[r("div",m1,[r("span",h1,C(a(d.timestamp)),1),r("span",{class:we(s(d.direction))},C(d.direction.toUpperCase()),3),r("span",p1,C(d.channel),1),r("span",v1,C(d.eventType),1)]),r("pre",g1,C(d.payload),1)]))),128))]))]))}}),b1={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},y1={class:"flex items-center justify-between"},w1={class:"space-y-1 text-xs font-mono"},k1={class:"flex items-center gap-2"},C1={class:"relative"},$1=["disabled"],S1=["value"],_1=["value"],T1={class:"flex items-center gap-2"},M1={class:"text-retro-text"},A1={class:"relative"},B1=["disabled"],E1=["disabled"],R1={class:"flex items-center gap-2"},P1=["disabled"],D1=["disabled"],I1=Ae({__name:"FinalizeConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=e,a=n,s=$(""),l=$(null),c=$(!1),d=$(!1),p=$(t.baseBranch),f=$([]),_=$(!1);async function S(){d.value=!0;try{const b=await $fetch("/api/chat/generate-commit-message",{method:"POST",body:{conversationId:t.worktreePath.split("/").pop()?.replace("sc-","")||"",worktreePath:t.worktreePath}});b.success&&b.message&&(s.value=b.message)}catch{}finally{d.value=!1}}xt(async()=>{const b=(async()=>{try{const M=t.worktreePath.split("/").pop()||"",j=await $fetch(`/api/commits/${encodeURIComponent(M)}`,{params:{workingDirectory:t.worktreePath}});l.value=j.aheadCount}catch{l.value=null}})(),w=(async()=>{_.value=!0;try{const M=await $fetch("/api/git/branches");f.value=M.branches.filter(j=>!j.isRemote&&!j.name.startsWith("sc/")).map(j=>j.name),f.value.length>0&&!f.value.includes(p.value)&&(p.value=f.value.includes("main")?"main":f.value.includes("master")?"master":f.value[0])}catch{f.value=[]}finally{_.value=!1}})();await Promise.all([b,w])});function g(){s.value.trim()&&(c.value=!0,a("confirm",s.value.trim(),p.value))}return(b,w)=>(i(),u("div",b1,[r("div",y1,[w[4]||(w[4]=r("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Finalize ",-1)),r("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:w[0]||(w[0]=M=>a("cancel"))},[q(o($t),{class:"w-4 h-4"})])]),r("div",w1,[r("div",k1,[w[5]||(w[5]=r("span",{class:"text-retro-muted"},"target:",-1)),r("div",C1,[Ne(r("select",{"onUpdate:modelValue":w[1]||(w[1]=M=>p.value=M),disabled:c.value||_.value,class:"appearance-none bg-retro-black border border-retro-border rounded px-2 py-0.5 pr-6 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan cursor-pointer disabled:opacity-40"},[_.value?(i(),u("option",{key:0,value:e.baseBranch},C(e.baseBranch),9,S1)):P("",!0),(i(!0),u(ge,null,Ie(f.value,M=>(i(),u("option",{key:M,value:M},C(M),9,_1))),128))],8,$1),[[Bn,p.value]]),q(o(Yr),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),r("div",T1,[w[6]||(w[6]=r("span",{class:"text-retro-muted"},"commits:",-1)),r("span",M1,C(l.value!==null?l.value:"..."),1)])]),r("div",A1,[Ne(r("textarea",{"onUpdate:modelValue":w[2]||(w[2]=M=>s.value=M),placeholder:"Squash commit message...",rows:"2",class:"w-full px-2 py-1.5 pr-8 text-xs font-mono bg-retro-black border border-retro-border rounded text-retro-text placeholder-retro-subtle focus:outline-none focus:border-retro-cyan resize-none",disabled:c.value||d.value},null,8,B1),[[Ct,s.value]]),r("button",{type:"button",disabled:c.value||d.value,class:"absolute right-1.5 top-1.5 p-0.5 rounded text-retro-muted hover:text-retro-cyan transition-colors disabled:opacity-40",title:"Generate commit message",onClick:S},[q(o(br),{class:we(["w-4 h-4",{"animate-spin":d.value}])},null,8,["class"])],8,E1)]),r("div",R1,[r("button",{type:"button",disabled:!s.value.trim()||c.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:g},[q(o(Kr),{class:"w-3.5 h-3.5"}),Re(" "+C(c.value?"Finalizing...":"Confirm"),1)],8,P1),r("button",{type:"button",disabled:c.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:w[3]||(w[3]=M=>a("cancel"))}," Cancel ",8,D1)])]))}}),L1={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},N1={class:"flex items-center justify-between"},F1={class:"space-y-1 text-xs font-mono"},H1={class:"flex items-center gap-2"},O1={class:"text-retro-cyan"},U1={class:"flex items-center gap-2"},j1={class:"relative"},z1=["disabled"],V1=["value"],W1=["value"],G1={class:"flex items-center gap-2"},q1={class:"text-retro-text"},K1={class:"flex items-center gap-2"},Z1=["disabled"],Y1=["disabled"],X1=Ae({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=e,a=n,s=$(null),l=$(!1),c=$(t.baseBranch),d=$([]),p=$(!1);async function f(S){try{const g=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:S}});s.value=g.ahead}catch{s.value=null}}xt(async()=>{const S=f(c.value),g=(async()=>{p.value=!0;try{const b=await $fetch("/api/git/branches");d.value=b.branches.filter(w=>!w.isRemote&&!w.name.startsWith("sc/")).map(w=>w.name),d.value.length>0&&!d.value.includes(c.value)&&(c.value=d.value.includes("main")?"main":d.value.includes("master")?"master":d.value[0])}catch{d.value=[]}finally{p.value=!1}})();await Promise.all([S,g])}),Pe(c,S=>{f(S)});function _(){l.value=!0,a("confirm",c.value)}return(S,g)=>(i(),u("div",L1,[r("div",N1,[g[3]||(g[3]=r("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Rebase Worktree ",-1)),r("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:g[0]||(g[0]=b=>a("cancel"))},[q(o($t),{class:"w-4 h-4"})])]),r("div",F1,[r("div",H1,[g[4]||(g[4]=r("span",{class:"text-retro-muted"},"worktree:",-1)),r("span",O1,C(e.worktreeBranch),1)]),r("div",U1,[g[5]||(g[5]=r("span",{class:"text-retro-muted"},"target:",-1)),r("div",j1,[Ne(r("select",{"onUpdate:modelValue":g[1]||(g[1]=b=>c.value=b),disabled:l.value||p.value,class:"appearance-none bg-retro-black border border-retro-border rounded px-2 py-0.5 pr-6 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan cursor-pointer disabled:opacity-40"},[p.value?(i(),u("option",{key:0,value:e.baseBranch},C(e.baseBranch),9,V1)):P("",!0),(i(!0),u(ge,null,Ie(d.value,b=>(i(),u("option",{key:b,value:b},C(b),9,W1))),128))],8,z1),[[Bn,c.value]]),q(o(Yr),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),r("div",G1,[g[6]||(g[6]=r("span",{class:"text-retro-muted"},"commits ahead:",-1)),r("span",q1,C(s.value!==null?s.value:"..."),1)])]),r("div",K1,[r("button",{type:"button",disabled:l.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:_},[q(o(Kr),{class:"w-3.5 h-3.5"}),Re(" "+C(l.value?"Rebasing...":"Confirm"),1)],8,Z1),r("button",{type:"button",disabled:l.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:g[2]||(g[2]=b=>a("cancel"))}," Cancel ",8,Y1)])]))}}),Q1={class:"flex-1 flex flex-col overflow-hidden"},J1={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},ex={class:"text-xs font-mono text-retro-text truncate"},tx={class:"flex items-center gap-2 flex-shrink-0"},nx=["title"],rx=["disabled"],ox=["disabled"],sx={key:5,class:"text-xs font-mono text-retro-green"},ax={key:6,class:"text-[11px] font-mono text-retro-muted"},ix={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},lx=["innerHTML"],cx=["value","readonly"],ux={key:2,class:"flex-shrink-0 px-4 py-2 border-t border-retro-border bg-retro-yellow/10 text-retro-yellow text-xs font-mono"},dx=Ae({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},aiResolving:{type:Boolean}},emits:["resolve","aiResolve"],setup(e,{emit:n}){const t=e,a=n,s=$(t.file.content),l=$(!1),c=$(""),d=$(!1);Pe(()=>t.file.path,()=>{s.value=t.file.content,l.value=!1,b()}),Pe(()=>t.file.content,()=>{l.value||(s.value=t.file.content,b())});const p=/^<{7}\s.*\n([\s\S]*?)^={7}\n([\s\S]*?)^>{7}\s.*\n/gm,f=/^<{7}[^\n]*\n([\s\S]*?)^={7}[^\n]*\n([\s\S]*?)^>{7}[^\n]*\n?/gm,_=D(()=>/^<{7}\s/m.test(s.value)),S=D(()=>B(s.value).length);function g(te){const z=te.split(".").pop()?.toLowerCase()||"";return{ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",vue:"vue",html:"html",css:"css",scss:"scss",less:"less",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",sh:"bash",zsh:"bash",sql:"sql",graphql:"graphql",xml:"xml",svg:"xml",toml:"toml",ini:"ini",dockerfile:"dockerfile"}[z]||"text"}async function b(){d.value=!0;try{const{codeToHtml:te}=await _n(async()=>{const{codeToHtml:F}=await import("./vkftdPXk.js");return{codeToHtml:F}},__vite__mapDeps([3,1,2]),import.meta.url),z=g(t.file.path),I=s.value.split(`
|
|
108
|
+
`);let W="",V=!1,h=!1,m=0,y=-1;for(const F of I){m++;const J=/^<{7}\s/.test(F),X=/^={7}$/.test(F),se=/^>{7}\s/.test(F);if(J){y++,V=!0,h=!1,W+=`<div class="conflict-line conflict-marker-line" data-line="${m}"><span class="line-number">${m}</span><span class="line-content conflict-marker">${w(F)}</span></div>
|
|
109
|
+
`,t.resolved||(W+=E(y));continue}if(X&&V){V=!1,h=!0,W+=`<div class="conflict-line conflict-marker-line" data-line="${m}"><span class="line-number">${m}</span><span class="line-content conflict-marker">${w(F)}</span></div>
|
|
110
|
+
`;continue}if(se){h=!1,W+=`<div class="conflict-line conflict-marker-line" data-line="${m}"><span class="line-number">${m}</span><span class="line-content conflict-marker">${w(F)}</span></div>
|
|
111
|
+
`;continue}let Z=w(F);try{const ee=(await te(F||" ",{lang:z,theme:"vitesse-dark"})).match(/<code[^>]*><span class="line">(.*?)<\/span><\/code>/s);ee&&(Z=ee[1])}catch{}let Y="";V?Y="conflict-ours":h&&(Y="conflict-theirs"),W+=`<div class="conflict-line ${Y}" data-line="${m}"><span class="line-number">${m}</span><span class="line-content">${Z}</span></div>
|
|
112
|
+
`}c.value=W}catch{const te=s.value.split(`
|
|
113
|
+
`);c.value=te.map((z,G)=>{const I=G+1;return`<div class="conflict-line" data-line="${I}"><span class="line-number">${I}</span><span class="line-content">${w(z)}</span></div>`}).join(`
|
|
114
|
+
`)}finally{d.value=!1}}function w(te){return te.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function M(){O("ours")}function j(){O("theirs")}function B(te){const z=[],G=new RegExp(f.source,f.flags);let I=null,W=0;for(;(I=G.exec(te))!==null;)z.push({index:W,start:I.index,end:G.lastIndex,ours:I[1]??"",theirs:I[2]??""}),W++;return z}function H(te,z){return te?z?te.endsWith(`
|
|
115
|
+
`)||z.startsWith(`
|
|
116
|
+
`)?`${te}${z}`:`${te}
|
|
117
|
+
${z}`:te:z}function O(te,z){const G=s.value,I=B(G);if(I.length){if(typeof z=="number"){const W=I.find(h=>h.index===z);if(!W)return;const V=te==="ours"?W.ours:te==="theirs"?W.theirs:H(W.ours,W.theirs);s.value=G.slice(0,W.start)+V+G.slice(W.end)}else s.value=G.replace(p,(W,V,h)=>te==="ours"?V:te==="theirs"?h:H(V,h));b()}}function E(te){return`<div class="conflict-inline-actions" data-conflict-controls="${te}">
|
|
118
|
+
<button type="button" class="conflict-inline-button conflict-inline-button-ours" data-conflict-index="${te}" data-conflict-action="ours">Accept Ours</button>
|
|
119
|
+
<button type="button" class="conflict-inline-button conflict-inline-button-theirs" data-conflict-index="${te}" data-conflict-action="theirs">Accept Theirs</button>
|
|
120
|
+
<button type="button" class="conflict-inline-button conflict-inline-button-both" data-conflict-index="${te}" data-conflict-action="both">Accept Both</button>
|
|
121
|
+
</div>
|
|
122
|
+
`}function re(te){const z=te.target?.closest("button[data-conflict-action]");if(!z||t.resolved)return;const G=z.dataset.conflictAction,I=z.dataset.conflictIndex;if(!G||I===void 0)return;const W=Number.parseInt(I,10);Number.isNaN(W)||O(G,W)}function me(){_.value||a("resolve",t.file.path,s.value)}function fe(){a("aiResolve",t.file.path)}function xe(){l.value=!l.value,l.value||b()}function ke(te){const z=te.target;s.value=z.value}return xt(()=>{b()}),(te,z)=>(i(),u("div",Q1,[r("div",J1,[r("span",ex,C(e.file.path),1),r("div",tx,[e.resolved?P("",!0):(i(),u("button",{key:0,type:"button",class:we(["px-2 py-0.5 text-xs font-mono rounded border transition-colors",l.value?"border-retro-yellow/50 text-retro-yellow hover:bg-retro-yellow/10":"border-retro-subtle/50 text-retro-muted hover:bg-retro-subtle/10"]),title:l.value?"Switch to highlighted view":"Switch to edit mode",onClick:xe},[l.value?(i(),de(o(ss),{key:0,class:"w-3.5 h-3.5 inline-block"})):(i(),de(o(Qr),{key:1,class:"w-3.5 h-3.5 inline-block"}))],10,nx)),!e.resolved&&_.value?(i(),u("button",{key:1,type:"button",disabled:e.aiResolving,class:"flex items-center gap-1 px-2 py-0.5 text-xs font-mono rounded border border-retro-orange/50 text-retro-orange hover:bg-retro-orange/10 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:fe},[q(o(br),{class:"w-3.5 h-3.5"}),Re(" "+C(e.aiResolving?"Resolving...":"AI Resolve"),1)],8,rx)):P("",!0),!e.resolved&&_.value?(i(),u("button",{key:2,type:"button",class:"px-2 py-0.5 text-xs font-mono rounded border border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/10 transition-colors",onClick:M}," Accept All Ours ")):P("",!0),!e.resolved&&_.value?(i(),u("button",{key:3,type:"button",class:"px-2 py-0.5 text-xs font-mono rounded border border-retro-magenta/50 text-retro-magenta hover:bg-retro-magenta/10 transition-colors",onClick:j}," Accept All Theirs ")):P("",!0),e.resolved?P("",!0):(i(),u("button",{key:4,type:"button",disabled:_.value,class:"px-2 py-0.5 text-xs font-mono rounded border border-retro-green/50 text-retro-green hover:bg-retro-green/10 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:me}," Mark Resolved ",8,ox)),e.resolved?(i(),u("span",sx," Resolved ")):S.value>0?(i(),u("span",ax,C(S.value)+" conflict "+C(S.value===1?"block":"blocks"),1)):P("",!0)])]),l.value?P("",!0):(i(),u("div",{key:0,class:we(["flex-1 overflow-auto bg-retro-black conflict-viewer",{"opacity-60":e.resolved}]),onClick:re},[d.value?(i(),u("div",ix," Highlighting... ")):(i(),u("div",{key:1,class:"conflict-code",innerHTML:c.value},null,8,lx))],2)),l.value?(i(),u("textarea",{key:1,value:s.value,readonly:e.resolved,class:we(["flex-1 w-full p-4 font-mono text-xs bg-retro-black text-retro-text resize-none focus:outline-none leading-relaxed",{"opacity-60":e.resolved}]),spellcheck:"false",onInput:ke},null,42,cx)):P("",!0),_.value&&!e.resolved?(i(),u("div",ux," File still contains conflict markers. Remove all <<<<<<<, =======, >>>>>>> markers to resolve. ")):P("",!0)]))}}),fx={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60"},mx={class:"w-full max-w-5xl mx-4 my-8 h-[80vh] bg-retro-dark border border-retro-border rounded-lg shadow-xl flex flex-col overflow-hidden"},hx={class:"flex-shrink-0 px-4 py-3 border-b border-retro-border flex items-center justify-between"},px={class:"flex items-center gap-3"},vx={class:"text-xs font-mono text-retro-muted"},gx={class:"flex items-center gap-2"},xx=["disabled"],bx=["disabled"],yx=["disabled"],wx={key:0,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},kx={key:1,class:"flex-1 flex items-center justify-center text-retro-red text-sm font-mono"},Cx={key:2,class:"flex-1 flex overflow-hidden"},$x={class:"w-64 flex-shrink-0 border-r border-retro-border overflow-y-auto bg-retro-dark"},Sx={class:"py-1"},_x=["onClick"],Tx={key:1,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},Mx=Ae({__name:"ConflictResolutionModal",emits:["close"],setup(e,{emit:n}){const t=n,a=Yt(),s=$(null),l=$(!1),c=$(!1),d=$(null),p=$(!1),f=D(()=>a.conflictState?.files??[]),_=D(()=>a.conflictState?.resolvedFiles??new Set),S=D(()=>f.value.length),g=D(()=>_.value.size),b=D(()=>S.value>0&&g.value>=S.value),w=D(()=>S.value-g.value),M=D(()=>s.value?f.value.find(fe=>fe.path===s.value)??null:null);function j(fe){return _.value.has(fe)}function B(fe){s.value=fe}async function H(fe,xe){await a.resolveConflictFile(fe,xe)}async function O(fe){d.value=fe,await a.aiResolveConflictFile(fe),d.value=null}async function E(){p.value=!0,await a.aiResolveAllConflicts(),p.value=!1}async function re(){l.value=!0;const fe=await a.continueRebase();l.value=!1,fe.success&&t("close")}async function me(){c.value=!0,await a.abortRebase(),c.value=!1,t("close")}return(fe,xe)=>(i(),de(Zt,{to:"body"},[q(hn,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:nt(()=>[o(a).conflictState?(i(),u("div",fx,[r("div",mx,[r("div",hx,[r("div",px,[q(o(wn),{class:"w-5 h-5 text-retro-yellow"}),xe[0]||(xe[0]=r("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"Resolve Rebase Conflicts",-1)),r("span",vx,C(g.value)+"/"+C(S.value)+" resolved ",1)]),r("div",gx,[w.value>0?(i(),u("button",{key:0,type:"button",disabled:p.value||l.value||c.value,class:"flex items-center gap-1 px-3 py-1.5 text-xs font-mono rounded border transition-colors bg-retro-orange/10 border-retro-orange/50 text-retro-orange hover:bg-retro-orange/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:E},[q(o(br),{class:"w-3.5 h-3.5"}),Re(" "+C(p.value?"AI Resolving...":`AI Resolve All (${w.value})`),1)],8,xx)):P("",!0),r("button",{type:"button",disabled:!b.value||l.value||c.value,class:"flex items-center gap-1 px-3 py-1.5 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:re},C(l.value?"Continuing...":"Continue Rebase"),9,bx),r("button",{type:"button",disabled:l.value||c.value,class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-red/50 text-retro-red hover:bg-retro-red/10 transition-colors disabled:opacity-40",onClick:me},C(c.value?"Aborting...":"Abort"),9,yx)])]),o(a).conflictState?.loading?(i(),u("div",wx," Loading conflict files... ")):o(a).conflictState?.error?(i(),u("div",kx,C(o(a).conflictState.error),1)):(i(),u("div",Cx,[r("div",$x,[r("div",Sx,[(i(!0),u(ge,null,Ie(f.value,ke=>(i(),u("button",{key:ke.path,type:"button",class:we(["w-full text-left px-3 py-2 text-xs font-mono flex items-center gap-2 transition-colors hover:bg-retro-panel",{"bg-retro-panel":s.value===ke.path}]),onClick:te=>B(ke.path)},[j(ke.path)?(i(),de(o(xr),{key:0,class:"w-3.5 h-3.5 text-retro-green flex-shrink-0"})):(i(),de(o(On),{key:1,class:"w-3.5 h-3.5 text-retro-yellow flex-shrink-0"})),r("span",{class:we(["truncate",j(ke.path)?"text-retro-green":"text-retro-yellow"])},C(ke.path),3)],10,_x))),128))])]),M.value?(i(),de(dx,{key:0,file:M.value,resolved:j(M.value.path),"ai-resolving":d.value===M.value.path||p.value,onResolve:H,onAiResolve:O},null,8,["file","resolved","ai-resolving"])):(i(),u("div",Tx," Select a file to resolve "))]))])])):P("",!0)]),_:1})]))}}),Ax={key:0,class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Bx={class:"flex items-center justify-between p-4 border-b border-retro-border"},Ex={class:"flex items-center gap-2"},Rx={class:"p-4"},Px={class:"mt-2 text-sm text-retro-text font-mono truncate"},Dx={class:"flex justify-end gap-3 p-4 border-t border-retro-border"},Ix=Ae({__name:"DeleteConfirmModal",props:{show:{type:Boolean},title:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=n;function a(s){s.target===s.currentTarget&&t("cancel")}return(s,l)=>(i(),de(Zt,{to:"body"},[q(hn,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:nt(()=>[e.show?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:a},[q(hn,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:nt(()=>[e.show?(i(),u("div",Ax,[r("div",Bx,[r("div",Ex,[q(o(wn),{class:"w-5 h-5 text-retro-red"}),l[3]||(l[3]=r("h3",{class:"text-lg font-mono text-retro-text"},"Delete Conversation",-1))]),r("button",{onClick:l[0]||(l[0]=c=>t("cancel")),class:"p-1 hover:bg-retro-panel rounded transition-colors"},[q(o($t),{class:"w-5 h-5 text-retro-muted"})])]),r("div",Rx,[l[4]||(l[4]=r("p",{class:"text-sm text-retro-muted font-mono"}," Are you sure you want to delete this conversation? ",-1)),r("p",Px,' "'+C(e.title)+'" ',1),l[5]||(l[5]=r("p",{class:"mt-3 text-xs text-retro-muted"}," This action cannot be undone. ",-1))]),r("div",Dx,[r("button",{onClick:l[1]||(l[1]=c=>t("cancel")),class:"px-4 py-2 text-sm font-mono text-retro-muted border border-retro-border rounded hover:bg-retro-panel transition-colors"}," Cancel "),r("button",{onClick:l[2]||(l[2]=c=>t("confirm")),class:"px-4 py-2 text-sm font-mono text-white bg-retro-red/80 border border-retro-red rounded hover:bg-retro-red transition-colors"}," Delete ")])])):P("",!0)]),_:1})])):P("",!0)]),_:1})]))}}),Lx={class:"h-full flex flex-col bg-retro-black"},Nx={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},Fx={class:"flex items-center gap-2 min-w-0"},Hx={class:"text-xs font-mono text-retro-text truncate"},Ox={class:"flex items-center gap-1"},Ux=["disabled","title"],jx=["title"],zx=["title"],Vx=["disabled"],Wx={key:4,class:"flex-shrink-0 px-4 py-2 border-b border-retro-border bg-retro-green/10 text-retro-green text-xs font-mono text-center"},Gx={class:"flex-1 min-h-0 flex flex-col"},qx=Ae({__name:"ChatPanel",setup(e){const n=Yt(),t=_s(),{disconnectConversation:a}=mo();xt(async()=>{try{const m=await $fetch("/api/cwd");n.setCwd(m.cwd)}catch{}});const s=D(()=>n.activeConversation?.title||"New Chat"),l=$(!1),c=D(()=>t.isChatFullscreen),d=$(!1);Pe(d,m=>{n.setDebugStreamEnabled(m)}),kt(()=>{n.setDebugStreamEnabled(!1)});function p(){t.toggleChatFullscreen()}async function f(){l.value=!1;const m=n.activeConversationId;m&&(a(m),await n.deleteConversation(m)),n.clearMessages()}function _(){n.hasMessages&&(l.value=!0)}function S(){l.value=!1}const g=$(!1),b=$(null),w=D(()=>n.activeConversation?.finalized===!0),M=D(()=>w.value),j=$(null),B=$(!1);async function H(){const m=n.activeConversation;if(!m?.worktreePath||!m?.baseBranch){j.value=null;return}B.value=!0;try{const y=await $fetch("/api/chat/compare",{params:{worktreePath:m.worktreePath,baseBranch:m.baseBranch}});j.value=y}catch{j.value=null}finally{B.value=!1}}Pe(()=>[n.activeConversationId,n.activeConversation?.worktreePath,n.activeConversation?.baseBranch,n.activeConversation?.lastCommitTime],()=>{H()},{immediate:!0});const O=D(()=>j.value?j.value.ahead===0&&j.value.behind===0:!1),E=D(()=>{const m=n.activeConversation;return m?.hasWorktree&&!m?.finalized&&!n.isActiveConversationStreaming}),re=D(()=>E.value&&!O.value);function me(){g.value=!0,b.value=null}async function fe(m,y){const F=n.activeConversationId;if(!F)return;const J=await n.finalizeConversation(F,m,y);if(g.value=!1,J.success)b.value={type:"success",message:`Merged to ${y}`},setTimeout(()=>{b.value=null},5e3);else if(J.rebaseInProgress)b.value=null;else{const X=J.conflictFiles?.length?`Conflict in: ${J.conflictFiles.join(", ")}`:J.error||"Finalize failed";b.value={type:"error",message:X}}}function xe(){g.value=!1}function ke(){if(!n.conflictState&&n.activeConversation?.hasWorktree){const m=n.activeConversation?.baseBranch||"main";b.value={type:"success",message:`Rebased onto ${m}`},setTimeout(()=>{b.value=null},5e3)}else b.value=null}const te=$(!1),z=D(()=>!!n.activeConversation?.previewBranch);async function G(){const m=n.activeConversationId;if(!m)return;te.value=!0,b.value=null;const y=z.value,F=await n.togglePreview(m);if(F.success){const J=y?`Switched back to ${n.activeConversation?.baseBranch}`:"Preview active — main worktree updated";b.value={type:"success",message:J},setTimeout(()=>{b.value=null},3e3)}else b.value={type:"error",message:F.error||"Preview toggle failed"};te.value=!1}const I=$(!1);function W(){I.value=!0,b.value=null}async function V(m){const y=n.activeConversationId;if(!y)return;const F=await n.rebaseConversation(y,m);I.value=!1,F.success?(b.value={type:"success",message:`Rebased onto ${m}`},setTimeout(()=>{b.value=null},5e3)):F.rebaseInProgress?b.value=null:b.value={type:"error",message:F.error||"Rebase failed"}}function h(){I.value=!1}return(m,y)=>(i(),u("div",Lx,[r("div",Nx,[r("div",Fx,[r("span",Hx,C(o(s)),1)]),r("div",Ox,[o(E)?(i(),u("button",{key:0,disabled:o(te),class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:o(z)?"End preview: switch back to base branch":"Preview: test worktree changes in main worktree",onClick:G},[o(z)?(i(),de(o(sa),{key:0,class:"w-4 h-4 text-retro-cyan"})):(i(),de(o(ss),{key:1,class:"w-4 h-4"}))],8,Ux)):P("",!0),o(re)?(i(),u("button",{key:1,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Rebase: sync worktree onto target base branch",onClick:W},[...y[2]||(y[2]=[Vo('<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="7" cy="4.5" r="1.5" fill="currentColor"></circle><circle cx="18" cy="20" r="1.5" fill="currentColor"></circle><circle cx="12" cy="7" r="1.4" fill="currentColor" opacity="0.9"></circle><path d="M7 6V16M7 16L4.5 13.5M7 16L9.5 13.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.4 7H12.5C15.5376 7 18 9.46243 18 12.5V18.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M15.5 16L18 18.5L20.5 16" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>',1)])])):P("",!0),o(re)?(i(),u("button",{key:2,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Finalize: squash & merge to base branch",onClick:me},[q(o(xr),{class:"w-4 h-4"})])):P("",!0),r("button",{class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:o(c)?"Exit fullscreen chat":"Fullscreen chat",onClick:p},[o(c)?(i(),de(o(Yo),{key:0,class:"w-4 h-4"})):(i(),de(o(Xo),{key:1,class:"w-4 h-4"}))],8,jx),r("button",{class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:o(d)?"Hide debug stream":"Show debug stream",onClick:y[0]||(y[0]=F=>d.value=!o(d))},[q(o(Xs),{class:we(["w-4 h-4",o(d)?"text-retro-cyan":""])},null,8,["class"])],8,zx),r("button",{disabled:!o(n).hasMessages,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"New conversation",onClick:_},[q(o(pn),{class:"w-4 h-4"})],8,Vx)])]),q(Ix,{show:o(l),title:o(s),onConfirm:f,onCancel:S},null,8,["show","title"]),o(g)&&o(n).activeConversation?.hasWorktree?(i(),de(I1,{key:0,"base-branch":o(n).activeConversation.baseBranch||"main","worktree-branch":o(n).activeConversation.worktreeBranch||"","worktree-path":o(n).activeConversation.worktreePath||"",onConfirm:fe,onCancel:xe},null,8,["base-branch","worktree-branch","worktree-path"])):P("",!0),o(I)&&o(n).activeConversation?.hasWorktree?(i(),de(X1,{key:1,"base-branch":o(n).activeConversation.baseBranch||"main","worktree-branch":o(n).activeConversation.worktreeBranch||"","worktree-path":o(n).activeConversation.worktreePath||"",onConfirm:V,onCancel:h},null,8,["base-branch","worktree-branch","worktree-path"])):P("",!0),o(n).conflictState?(i(),de(Mx,{key:2,onClose:ke})):P("",!0),o(b)?(i(),u("div",{key:3,class:we(["flex-shrink-0 px-4 py-2 border-b border-retro-border text-xs font-mono",o(b).type==="success"?"bg-retro-green/10 text-retro-green":"bg-retro-red/10 text-retro-red"])},[Re(C(o(b).message)+" ",1),o(b).type==="error"?(i(),u("button",{key:0,class:"ml-2 underline hover:no-underline",onClick:y[1]||(y[1]=F=>b.value=null)}," dismiss ")):P("",!0)],2)):P("",!0),o(w)?(i(),u("div",Wx," This conversation has been finalized and is read-only. ")):P("",!0),r("div",Gx,[q(Sg,{class:"flex-1 overflow-hidden"}),o(d)?(i(),de(x1,{key:0})):P("",!0)]),q(l1,{disabled:o(M)},null,8,["disabled"])]))}}),Kx={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Zx={class:"flex items-center gap-2 min-w-0"},Yx=["title"],Xx={class:"text-retro-text font-mono text-sm truncate"},Qx={class:"text-retro-muted"},Jx={class:"text-retro-text"},e0={class:"text-retro-muted font-mono text-xs flex-shrink-0"},t0={class:"flex-1 overflow-auto"},n0={key:0,class:"flex items-center justify-center gap-2 text-retro-muted text-sm py-8"},r0={key:1,class:"flex items-center justify-center text-retro-muted text-sm py-8"},o0={key:2,class:"flex items-center justify-center text-retro-muted text-sm py-8"},s0={key:3,class:"w-full text-xs font-mono border-collapse diff-table"},a0={key:0,class:"diff-warning"},i0={key:0,colspan:"3",class:"diff-hunk-header px-4 py-1"},l0={class:"diff-line-num select-none text-right px-2 w-12"},c0={class:"diff-line-num select-none text-right px-2 w-12 border-r border-retro-border"},u0={class:"diff-line-content px-3 whitespace-pre-wrap break-all"},d0={key:0,class:"diff-sign"},f0={key:1,class:"diff-sign"},m0={key:2,class:"diff-sign"},h0={key:4,class:"flex items-center justify-center text-retro-muted text-sm py-8"},p0=Ae({__name:"GitFileDiffViewer",props:{file:{},commitHash:{},content:{},loading:{type:Boolean}},emits:["close"],setup(e,{emit:n}){const t=e,a=n,s=$(null),l=D(()=>t.commitHash.substring(0,7)),c=D(()=>Fn[t.file.status]||{label:t.file.status,colorClass:"text-retro-muted"}),d=D(()=>t.file.status==="R"&&t.file.oldPath);function p(f){f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),a("close"))}return xt(()=>{s.value?.focus()}),kt(()=>{}),(f,_)=>(i(),u("div",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:p,class:"flex flex-col h-full bg-retro-dark focus:outline-none","aria-label":"File diff viewer",role:"region"},[r("div",Kx,[r("div",Zx,[r("span",{class:we(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",c.value.colorClass]),title:c.value.label},C(e.file.status),11,Yx),r("span",Xx,[d.value&&e.file.oldPath?(i(),u(ge,{key:0},[r("span",Qx,C(e.file.oldPath),1),_[1]||(_[1]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Jx,C(e.file.path),1)],64)):(i(),u(ge,{key:1},[Re(C(e.file.path),1)],64))]),r("span",e0," @ "+C(l.value),1)]),r("button",{onClick:_[0]||(_[0]=S=>a("close")),class:"p-1 hover:bg-retro-dark rounded transition-colors flex-shrink-0 focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close diff viewer",title:"Close (Esc)"},[q(o($t),{class:"w-5 h-5 text-retro-muted hover:text-retro-text"})])]),r("div",t0,[e.loading?(i(),u("div",n0,[..._[2]||(_[2]=[r("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Re(" Loading diff... ",-1)])])):e.content&&e.content.binary?(i(),u("div",r0,[..._[3]||(_[3]=[r("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," Binary file — cannot display diff ",-1)])])):e.content&&e.content.lines.length===0?(i(),u("div",o0,[..._[4]||(_[4]=[r("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," No changes in this file ",-1)])])):e.content?(i(),u("table",s0,[r("tbody",null,[e.content.truncated?(i(),u("tr",a0,[..._[5]||(_[5]=[r("td",{colspan:"3",class:"px-4 py-2 text-retro-yellow bg-retro-panel text-center"}," Diff truncated — file has more than 10,000 lines ",-1)])])):P("",!0),(i(!0),u(ge,null,Ie(e.content.lines,(S,g)=>(i(),u("tr",{key:g,class:we({"diff-add":S.type==="add","diff-delete":S.type==="delete","diff-context":S.type==="context","diff-header":S.type==="header"})},[S.type==="header"?(i(),u("td",i0,C(S.content),1)):(i(),u(ge,{key:1},[r("td",l0,C(S.oldLineNumber??""),1),r("td",c0,C(S.newLineNumber??""),1),r("td",u0,[S.type==="add"?(i(),u("span",d0,"+")):S.type==="delete"?(i(),u("span",f0,"-")):(i(),u("span",m0," ")),Re(" "+C(S.content),1)])],64))],2))),128))])])):(i(),u("div",h0," Failed to load diff content. "))])],544))}}),v0=gr(p0,[["__scopeId","data-v-c726b0c5"]]),g0={class:"fixed inset-0 z-50 flex items-center justify-center"},x0={class:"relative w-[90vw] max-w-lg bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},b0={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},y0={class:"flex items-center gap-2"},w0={class:"text-sm font-mono text-retro-text"},k0={class:"p-6 overflow-y-auto max-h-[70vh] space-y-6"},C0={key:0},$0={class:"space-y-6"},S0={class:"space-y-1.5"},_0=["value","checked","onChange"],T0={class:"flex-1"},M0={class:"text-sm font-mono text-retro-text"},A0={class:"text-xs text-retro-muted leading-tight"},B0={class:"text-xs font-mono text-retro-muted"},E0={class:"text-xs text-retro-muted mb-3"},R0=["disabled"],P0={class:"space-y-1.5"},D0=["value","checked","onChange"],I0={class:"flex-1"},L0={class:"text-sm font-mono text-retro-text"},N0={class:"text-xs text-retro-muted leading-tight"},F0={key:1,class:"space-y-4"},H0={class:"space-y-1.5"},O0=["checked"],U0=["checked"],j0={class:"flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel"},z0={class:"text-xs font-mono text-retro-cyan"},V0=Ae({__name:"SettingsModal",emits:["close"],setup(e,{emit:n}){const t=n,a=Qn(),s=Is(),l=Hn(),c=$("main"),d=$(!1),p=D(()=>s.public.appVersion||"unknown"),f=[{value:"dark",label:"Dark",description:"Retro terminal theme with dark backgrounds"},{value:"light",label:"Light",description:"Bright theme for well-lit environments"}],_=[{value:"plan",label:Dn.plan,description:rr.plan,icon:Xr,color:"text-retro-cyan"},{value:"ask",label:Dn.ask,description:rr.ask,icon:Jr,color:"text-retro-green"},{value:"auto",label:Dn.auto,description:rr.auto,icon:Jo,color:"text-retro-yellow"},{value:"bypass",label:Dn.bypass,description:rr.bypass,icon:eo,color:"text-retro-red"}],{data:S,pending:g,error:b}=Ir("ai-providers",()=>$fetch("/api/ai/providers"),{server:!1}),w=D(()=>S.value?.providers??[]),M=D(()=>{const I=b.value;return I?I instanceof Error?I.message:String(I):null}),{data:j,refresh:B}=Ir("spec-search-status",()=>$fetch("/api/specs/status"),{server:!1,default:()=>null}),H=D(()=>{const I=j.value;return I?I.isIndexing?`Indexing (${I.currentJob||"running"})`:I.schedulerActive?`Indexed ${I.fileCount} files / ${I.chunkCount} chunks`:"Scheduler inactive":"Status unavailable"});xt(()=>{a.hydrate()});const O=I=>{a.setProviderSelection(I),l.success("Settings saved")},E=()=>{c.value="provider"},re=()=>{c.value="main"},me=I=>{a.setTheme(I),l.success("Settings saved")},fe=I=>{a.setPermissionMode(I),l.success("Settings saved")},xe=I=>{a.setAutoGenerateCommitMessages(I),l.success("Settings saved")},ke=()=>{t("close")},te=async()=>{if(!d.value){d.value=!0;try{const I=await $fetch("/api/specs/reindex",{method:"POST",body:{}});!I.success&&I.status==="already-indexing"?l.info("Spec index is already running"):l.success("Spec reindex started"),await B()}catch(I){l.error(I instanceof Error?I.message:"Failed to start spec reindex")}finally{d.value=!1}}},z=I=>{I.key==="Escape"&&t("close")};xt(()=>{window.addEventListener("keydown",z)}),kt(()=>{window.removeEventListener("keydown",z)});let G=null;return xt(()=>{G=fo(()=>{B()},5e3)}),kt(()=>{G&&clearInterval(G)}),(I,W)=>(i(),de(Zt,{to:"body"},[r("div",g0,[r("div",{class:"absolute inset-0 bg-black/70",onClick:ke}),r("div",x0,[r("div",b0,[r("div",y0,[c.value==="provider"?(i(),u("button",{key:0,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Back",onClick:re},[q(o(Zs),{class:"h-4 w-4"})])):P("",!0),r("h2",w0,C(c.value==="provider"?"AI Provider Settings":"Settings"),1)]),r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:W[0]||(W[0]=V=>t("close"))},[q(o($t),{class:"h-4 w-4"})])]),r("div",k0,[c.value==="main"?(i(),u("section",C0,[r("div",$0,[r("section",null,[W[3]||(W[3]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Theme",-1)),W[4]||(W[4]=r("p",{class:"text-xs text-retro-muted mb-3"}," Choose between dark and light appearance. ",-1)),r("div",S0,[(i(),u(ge,null,Ie(f,V=>r("label",{key:V.value,class:we(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).theme===V.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[r("input",{type:"radio",name:"theme",value:V.value,checked:o(a).theme===V.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:h=>me(V.value)},null,40,_0),r("div",T0,[r("div",M0,C(V.label),1),r("div",A0,C(V.description),1)])],2)),64))])]),W[11]||(W[11]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[W[6]||(W[6]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider",-1)),W[7]||(W[7]=r("p",{class:"text-xs text-retro-muted mb-3"}," Configure provider and model settings for new conversations. ",-1)),r("button",{type:"button",class:"w-full flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel hover:border-retro-muted transition-colors",onClick:E},[W[5]||(W[5]=r("span",{class:"text-sm font-mono text-retro-text"},"Provider Settings",-1)),r("span",B0,C(o(a).providerSelection.providerId)+" / "+C(o(a).providerSelection.modelKey),1)])]),W[12]||(W[12]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[W[8]||(W[8]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec Search Index",-1)),r("p",E0,C(H.value),1),r("button",{type:"button",class:"w-full flex items-center justify-center px-3 py-2 rounded border border-retro-border bg-retro-panel text-retro-text hover:border-retro-muted transition-colors disabled:opacity-60",disabled:d.value||o(j)?.isIndexing,onClick:te},C(d.value?"Starting reindex...":"Reindex Specs"),9,R0)]),W[13]||(W[13]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[W[9]||(W[9]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Default Permission Mode",-1)),W[10]||(W[10]=r("p",{class:"text-xs text-retro-muted mb-3"}," Set the default permission mode for all new chat conversations. ",-1)),r("div",P0,[(i(),u(ge,null,Ie(_,V=>r("label",{key:V.value,class:we(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).permissionMode===V.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[r("input",{type:"radio",name:"permission-mode",value:V.value,checked:o(a).permissionMode===V.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:h=>fe(V.value)},null,40,D0),(i(),de(In(V.icon),{class:we(["w-4 h-4 flex-shrink-0",V.color])},null,8,["class"])),r("div",I0,[r("div",L0,C(V.label),1),r("div",N0,C(V.description),1)])],2)),64))])]),W[14]||(W[14]=r("div",{class:"border-t border-retro-border"},null,-1))])])):(i(),u("section",F0,[W[15]||(W[15]=r("div",null,[r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider"),r("p",{class:"text-xs text-retro-muted mb-3"}," Choose which registered provider and model powers new conversations. ")],-1)),q(Vs,{providers:w.value,selected:o(a).providerSelection,permissionMode:o(a).permissionMode,pending:o(g),errorMessage:M.value,onSelect:O},null,8,["providers","selected","permissionMode","pending","errorMessage"])])),W[23]||(W[23]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[W[18]||(W[18]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Commit Messages",-1)),W[19]||(W[19]=r("p",{class:"text-xs text-retro-muted mb-3"}," Choose whether to use AI to generate commit messages automatically. ",-1)),r("div",H0,[r("label",{class:we(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).autoGenerateCommitMessages?"border-retro-border bg-retro-panel hover:border-retro-muted":"border-retro-cyan bg-retro-cyan/10"]])},[r("input",{type:"radio",name:"commit-messages",value:!1,checked:!o(a).autoGenerateCommitMessages,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:W[1]||(W[1]=V=>xe(!1))},null,40,O0),W[16]||(W[16]=r("div",{class:"flex-1"},[r("div",{class:"text-sm font-mono text-retro-text"},"Template (Recommended)"),r("div",{class:"text-xs text-retro-muted leading-tight"},"Simple template-based messages. No token usage.")],-1))],2),r("label",{class:we(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).autoGenerateCommitMessages?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[r("input",{type:"radio",name:"commit-messages",value:!0,checked:o(a).autoGenerateCommitMessages,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:W[2]||(W[2]=V=>xe(!0))},null,40,U0),W[17]||(W[17]=r("div",{class:"flex-1"},[r("div",{class:"text-sm font-mono text-retro-text"},"AI-Generated"),r("div",{class:"text-xs text-retro-muted leading-tight"},"Uses Claude Haiku to create meaningful commit messages. ~300-500 tokens per commit.")],-1))],2)])]),W[24]||(W[24]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[W[21]||(W[21]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec-Cat",-1)),W[22]||(W[22]=r("p",{class:"text-xs text-retro-muted mb-3"}," Application version. ",-1)),r("div",j0,[W[20]||(W[20]=r("span",{class:"text-sm font-mono text-retro-text"},"Version",-1)),r("span",z0,C(p.value),1)])])])])])]))}}),W0={class:"fixed top-4 right-4 z-50 flex flex-col gap-2 max-w-sm"},G0={class:"flex-1 text-sm font-mono text-retro-text"},q0=["onClick"],K0=Ae({__name:"ToastContainer",setup(e){const{toasts:n,remove:t}=Hn(),a={success:{bg:"bg-retro-green/20",icon:"text-retro-green",border:"border-retro-green/50"},error:{bg:"bg-retro-red/20",icon:"text-retro-red",border:"border-retro-red/50"},info:{bg:"bg-retro-cyan/20",icon:"text-retro-cyan",border:"border-retro-cyan/50"},warning:{bg:"bg-retro-yellow/20",icon:"text-retro-yellow",border:"border-retro-yellow/50"}},s=l=>{switch(l){case"success":return xr;case"error":return On;case"warning":return wn;default:return ca}};return(l,c)=>(i(),de(Zt,{to:"body"},[r("div",W0,[q(Ls,{"enter-active-class":"transition-all duration-300 ease-out","leave-active-class":"transition-all duration-200 ease-in","enter-from-class":"opacity-0 translate-x-4","enter-to-class":"opacity-100 translate-x-0","leave-from-class":"opacity-100 translate-x-0","leave-to-class":"opacity-0 translate-x-4"},{default:nt(()=>[(i(!0),u(ge,null,Ie(o(n),d=>(i(),u("div",{key:d.id,class:we(["flex items-start gap-3 p-3 rounded-lg border shadow-lg",[a[d.type].bg,a[d.type].border]])},[(i(),de(In(s(d.type)),{class:we(["h-5 w-5 flex-shrink-0 mt-0.5",a[d.type].icon])},null,8,["class"])),r("p",G0,C(d.message),1),r("button",{type:"button",class:"p-0.5 rounded text-retro-muted hover:text-retro-text transition-colors",onClick:p=>o(t)(d.id)},[q(o($t),{class:"h-4 w-4"})],8,q0)],2))),128))]),_:1})])]))}});function jo(e){typeof document>"u"||(e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),document.cookie=`spec-cat-theme=${e};path=/;SameSite=Lax`)}function Z0(){const e=Qn(),n=D(()=>e.theme),t=D(()=>e.theme==="dark");function a(){const s=e.theme==="dark"?"light":"dark";e.setTheme(s),jo(s)}return Pe(()=>e.theme,s=>{jo(s)},{immediate:!0}),{theme:n,isDark:t,toggleTheme:a}}const Y0={class:"flex h-screen min-w-[320px] overflow-x-auto bg-retro-black text-retro-text"},X0={class:"flex flex-col overflow-hidden",style:{flex:"3"}},Q0={class:"flex-shrink-0 h-14 flex items-center justify-between px-4 border-b border-retro-border bg-retro-panel"},J0={class:"flex items-center gap-2 min-w-0"},eb={key:0,class:"text-xs text-retro-muted font-mono truncate"},tb={class:"flex items-center gap-1"},nb=["title"],rb={class:"flex-1 min-h-0 overflow-y-auto"},ob={class:"relative flex min-w-0",style:{flex:"7"}},sb={class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},ab={class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},ib={key:0,class:"absolute inset-0 z-30 flex flex-col overflow-hidden border-l border-retro-border bg-retro-black"},fb=Ae({__name:"default",setup(e){const n=_s(),t=Qn(),a=Yt(),s=Cr(),{isDark:l,toggleTheme:c}=Z0(),d=D(()=>s.diffViewerFile!==null),p=D(()=>n.isChatFullscreen),f=D(()=>p.value),_=D(()=>p.value?7:3),S=$(!1),g=$(""),b=D(()=>{if(!g.value)return"";const j=g.value.replace(/\/+$/,"").split("/");return j[j.length-1]||""}),w=D(()=>b.value?`spec cat :: ${b.value}`:"spec cat");Ns(()=>({title:w.value}));const M=()=>{typeof window<"u"&&n.updateViewport(window.innerWidth)};return xt(async()=>{typeof window<"u"&&(n.updateViewport(window.innerWidth),window.addEventListener("resize",M)),await t.hydrate(),await a.initialize(),await a.loadConversations();try{const j=await $fetch("/api/cwd");g.value=j.cwd}catch{g.value=""}}),kt(()=>{typeof window<"u"&&window.removeEventListener("resize",M)}),(j,B)=>{const H=$m;return i(),u("div",Y0,[r("div",X0,[r("div",Q0,[r("div",J0,[B[4]||(B[4]=r("img",{alt:"SpecCat",src:Sm,class:"w-5 h-5 text-retro-cyan mb-1"},null,-1)),B[5]||(B[5]=r("span",{class:"text-sm font-bold text-retro-cyan font-mono uppercase tracking-wider flex-shrink-0"},"SPECCAT",-1)),b.value?(i(),u("span",eb,"/ "+C(b.value),1)):P("",!0)]),r("div",tb,[r("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:o(l)?"Switch to light theme":"Switch to dark theme",onClick:B[0]||(B[0]=(...O)=>o(c)&&o(c)(...O))},[o(l)?(i(),de(o(pa),{key:0,class:"w-5 h-5"})):(i(),de(o(fa),{key:1,class:"w-5 h-5"}))],8,nb),r("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:"Settings",onClick:B[1]||(B[1]=O=>S.value=!0)},[q(o(rs),{class:"w-5 h-5"})])])]),r("div",rb,[q(H,{"working-directory":g.value},null,8,["working-directory"])])]),r("div",ob,[Ne(r("div",sb,[q(ip)],512),[[vo,!f.value]]),Ne(r("div",ab,[q(qp)],512),[[vo,!f.value]]),r("div",{class:"flex flex-col overflow-hidden border-l border-retro-border",style:Bt({flex:_.value})},[q(qx)],4),d.value?(i(),u("div",ib,[q(v0,{file:o(s).diffViewerFile,"commit-hash":o(s).diffViewerCommitHash,content:o(s).diffViewerContent,loading:o(s).diffViewerLoading,onClose:B[2]||(B[2]=O=>o(s).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):P("",!0)]),S.value?(i(),de(V0,{key:0,onClose:B[3]||(B[3]=O=>S.value=!1)})):P("",!0),q(K0)])}}});export{fb as default};
|