spec-cat 0.1.35 → 0.1.36
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/{CAqXi7E0.js → -2tR8Cph.js} +1 -1
- package/.output/public/_nuxt/{BouwExBZ.js → BBA9sqLe.js} +1 -1
- package/.output/public/_nuxt/{dbPDc6Lb.js → BdnBYIQg.js} +6 -6
- package/.output/public/_nuxt/{BLiXDnUt.js → BjExtU_8.js} +1 -1
- package/.output/public/_nuxt/{CE6PQN7h.js → C5VmlmOK.js} +1 -1
- package/.output/public/_nuxt/{BKZAxZcC.js → CPsvWw1J.js} +1 -1
- package/.output/public/_nuxt/{2XXwAFmK.js → CUhpW37J.js} +4 -4
- package/.output/public/_nuxt/{BzX5dxvd.js → DFgtAR95.js} +1 -1
- package/.output/public/_nuxt/{DTJSvQUl.js → DIEyni0K.js} +1 -1
- package/.output/public/_nuxt/{CFoLn9L9.js → D_05ko21.js} +1 -1
- package/.output/public/_nuxt/DphOOigU.js +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/7a0d0443-5ff4-47d0-b629-668dc37b3124.json +1 -0
- package/.output/public/_nuxt/{entry.DWv01Nib.css → entry.DJNhqbsn.css} +1 -1
- package/.output/public/_nuxt/{D1PodrLU.js → lyWV44Wc.js} +1 -1
- package/.output/public/_nuxt/wserZ5KO.js +4 -0
- package/.output/server/chunks/_/error-500.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 +626 -626
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/renderer.mjs.map +1 -1
- package/.output/server/package.json +1 -1
- package/package.json +1 -1
- package/.output/public/_nuxt/Bai8qLnn.js +0 -1
- package/.output/public/_nuxt/CxPW3eha.js +0 -4
- package/.output/public/_nuxt/builds/meta/e3e6b956-26c4-4882-9c99-a78efcb98231.json +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./
|
|
2
|
-
import{y as v,z as y,A as f,d as Ie,C as J,G as p,Q as je,S as _t,R as et,I as ke,E as Xe,B as _,K as U,g as Q,J as Ne,U as as,k as K,V as er,L as Re,H as pe,o as pt,W as kt,X as Xm,N as Ve,Y as Xt,T as Pr,Z as Vs,_ as Qu,$ as Me,a0 as ls,O as pn,D as ct,P as kr,a1 as Im,a2 as pr,a3 as gs,a4 as kc,a5 as P1,c as T1,a6 as Lh,a7 as Vm,a8 as M1,q as A1,a9 as _1,x as R1}from"./CxPW3eha.js";import{r as wt,c as gn,b as ul,a as hs,u as Pu}from"./CE6PQN7h.js";import{g as po,m as B1,p as Z1,h as Xh,i as E1,j as Ih,k as D1,l as L1,n as X1,w as I1,o as V1,q as zm,s as Vh,C as z1,_ as N1,t as Tu,u as W1,r as q1,a as j1}from"./2XXwAFmK.js";import{_ as Os}from"./DlAUqK2U.js";import{S as Qa,i as Y1,b as F1,P as U1,W as zh,M as Nh,c as Wh,d as qh,g as jh,e as G1,D as Nm,f as Wm,h as H1,a as go,j as Gt,u as Oo,k as Ts,l as Bo}from"./CFoLn9L9.js";import{u as wc,_ as K1}from"./D1PodrLU.js";function J1(r,e){return v(),y("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"},[f("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 ev(r,e){return v(),y("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"},[f("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 tv(r,e){return v(),y("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"},[f("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 rv(r,e){return v(),y("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"},[f("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 nv(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function qm(r,e){return v(),y("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"},[f("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 jm(r,e){return v(),y("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"},[f("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 Ym(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function Fm(r,e){return v(),y("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"},[f("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 Um(r,e){return v(),y("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"},[f("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 Gm(r,e){return v(),y("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"},[f("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 sv(r,e){return v(),y("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"},[f("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 Hm(r,e){return v(),y("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"},[f("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 iv(r,e){return v(),y("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"},[f("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 ov(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z"})])}function av(r,e){return v(),y("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"},[f("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 lv(r,e){return v(),y("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"},[f("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 Mu(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function cv(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}function Au(r,e){return v(),y("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"},[f("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 uv(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"})])}function _u(r,e){return v(),y("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"},[f("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 zs(r,e){return v(),y("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"},[f("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 Km(r,e){return v(),y("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"},[f("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 Jm(r,e){return v(),y("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"},[f("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"}),f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function hv(r,e){return v(),y("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"},[f("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 dv(r,e){return v(),y("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"},[f("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 fv(r,e){return v(),y("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"},[f("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 mv(r,e){return v(),y("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"},[f("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 Ns(r,e){return v(),y("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"},[f("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 En(r,e){return v(),y("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"},[f("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 pv(r,e){return v(),y("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"},[f("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 gv(r,e){return v(),y("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"},[f("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"}),f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function Ov(r,e){return v(),y("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"},[f("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 vv(r,e){return v(),y("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"},[f("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 bv(r,e){return v(),y("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"},[f("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 xv(r,e){return v(),y("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"},[f("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 yv(r,e){return v(),y("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"},[f("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 ep(r,e){return v(),y("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"},[f("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 cs(r,e){return v(),y("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"},[f("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 kv(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"})])}function wv(r,e){return v(),y("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"},[f("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 tp(r,e){return v(),y("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"},[f("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 Sv(r,e){return v(),y("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"},[f("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 Yh(r,e){return v(),y("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"},[f("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 Ru(r,e){return v(),y("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"},[f("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 $v(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})])}function rp(r,e){return v(),y("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"},[f("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 Bu(r,e){return v(),y("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"},[f("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 Pa(r,e){return v(),y("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"},[f("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 Cv(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}),f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9.563C9 9.252 9.252 9 9.563 9h4.874c.311 0 .563.252.563.563v4.874c0 .311-.252.563-.563.563H9.564A.562.562 0 0 1 9 14.437V9.564Z"})])}function Zu(r,e){return v(),y("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"},[f("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"}),f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 6h.008v.008H6V6Z"})])}function Qv(r,e){return v(),y("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"},[f("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"})])}async function Fh(r){return $fetch("/api/chat/worktree",{method:"POST",body:r})}async function Pv(r){await $fetch("/api/chat/worktree",{method:"DELETE",body:r})}async function Tv(r){const e=await $fetch("/api/chat/preview-sync",{method:"POST",body:r});if(!e.success)throw new Error(e.error||"Unknown preview sync failure")}const Mv={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},Av={class:"relative flex-1 min-w-0"},_v={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},Rv=["disabled"],Bv=["disabled"],Zv=Ie({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(r,{expose:e,emit:t}){const n=t,s=Q(""),i=Q(null);let o=null;function a(){o&&clearTimeout(o),o=setTimeout(()=>{n("search",s.value)},200)}function l(u){u.key==="Escape"?(u.preventDefault(),n("close")):u.key==="Enter"&&(u.preventDefault(),u.shiftKey?n("prev"):n("next"))}function c(){i.value?.focus(),i.value?.select()}return e({focus:c}),(u,h)=>(v(),y("div",Mv,[J(p(cs),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),f("div",Av,[je(f("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":h[0]||(h[0]=d=>et(s)?s.value=d: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:a,onKeydown:l},null,544),[[_t,p(s)]])]),p(s)?(v(),y("span",_v,[r.resultCount>0?(v(),y(ke,{key:0},[Xe(_(r.currentIndex+1)+" of "+_(r.resultCount),1)],64)):(v(),y(ke,{key:1},[Xe(" No results ")],64))])):U("",!0),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:r.resultCount===0,"aria-label":"Previous result",title:"Previous (Shift+Enter)",onClick:h[1]||(h[1]=d=>n("prev"))},[J(p(uv),{class:"w-4 h-4"})],8,Rv),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:r.resultCount===0,"aria-label":"Next result",title:"Next (Enter)",onClick:h[2]||(h[2]=d=>n("next"))},[J(p(cv),{class:"w-4 h-4"})],8,Bv),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors","aria-label":"Close find widget",title:"Close (Escape)",onClick:h[3]||(h[3]=d=>n("close"))},[J(p(wt),{class:"w-4 h-4"})])]))}}),Ev={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},Dv={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},Lv={class:"flex-1 overflow-auto max-h-[300px]"},Xv={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},Iv=["onKeyup"],Vv=["onClick"],zv={class:"text-retro-muted truncate flex-1 font-mono"},Nv=["onClick"],Wv=["onClick"],qv={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},jv={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},Yv={class:"flex gap-2 justify-end"},Fv=["disabled"],Uv={key:1,class:"px-3 py-2 border-t border-retro-border"},Gv=Ie({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(r,{emit:e}){const t=e,n=Q(!1),s=Q(""),i=Q(""),o=Q(null),a=Q("");function l(){n.value=!0,s.value="",i.value=""}function c(){!s.value.trim()||!i.value.trim()||(t("add",{name:s.value.trim(),url:i.value.trim()}),n.value=!1)}function u(m){o.value=m.name,a.value=m.fetchUrl}function h(m){a.value.trim()&&(t("edit",{name:m,newUrl:a.value.trim()}),o.value=null)}function d(){o.value=null}return(m,g)=>(v(),y("div",Ev,[f("div",Dv,[g[5]||(g[5]=f("h3",{class:"text-sm font-semibold text-retro-text"},"Remote Repositories",-1)),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",onClick:g[0]||(g[0]=O=>t("close"))},[J(p(wt),{class:"w-4 h-4"})])]),f("div",Lv,[(v(!0),y(ke,null,Ne(r.remotes,O=>(v(),y("div",{key:O.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[f("span",Xv,_(O.name),1),p(o)===O.name?(v(),y(ke,{key:0},[je(f("input",{"onUpdate:modelValue":g[1]||(g[1]=b=>et(a)?a.value=b: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:[as(b=>h(O.name),["enter"]),as(d,["escape"])]},null,40,Iv),[[_t,p(a)]]),f("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:b=>h(O.name)},[J(p(Mu),{class:"w-3.5 h-3.5"})],8,Vv),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:d},[J(p(wt),{class:"w-3.5 h-3.5"})])],64)):(v(),y(ke,{key:1},[f("span",zv,_(O.fetchUrl),1),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:b=>u(O)},[J(p(tp),{class:"w-3.5 h-3.5"})],8,Nv),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:b=>t("delete",O.name)},[J(p(gn),{class:"w-3.5 h-3.5"})],8,Wv)],64))]))),128)),r.remotes.length===0?(v(),y("div",qv," No remotes configured ")):U("",!0)]),p(n)?(v(),y("div",jv,[je(f("input",{"onUpdate:modelValue":g[2]||(g[2]=O=>et(s)?s.value=O: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),[[_t,p(s)]]),je(f("input",{"onUpdate:modelValue":g[3]||(g[3]=O=>et(i)?i.value=O: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:as(c,["enter"])},null,544),[[_t,p(i)]]),f("div",Yv,[f("button",{class:"px-2 py-1 text-xs text-retro-muted hover:text-retro-text transition-colors",onClick:g[4]||(g[4]=O=>n.value=!1)}," Cancel "),f("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:!p(s).trim()||!p(i).trim(),onClick:c}," Add Remote ",8,Fv)])])):U("",!0),p(n)?U("",!0):(v(),y("div",Uv,[f("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:l},[J(p(ul),{class:"w-3.5 h-3.5"}),g[6]||(g[6]=Xe(" Add Remote ",-1))])]))]))}}),hl={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},Zo=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Ws={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"}},Hv=["width","height"],Kv=["d","stroke","stroke-dasharray"],Jv={key:0},eb=["cx","r"],tb=["cx","r","fill"],rb=["cx","r","stroke"],nb=["cx","r","fill"],sb=["cx","r","stroke"],ib=["cx","r","fill"],ob=["cx","r"],ab=["cx","r","fill"],np=Ie({__name:"GitGraphSvg",props:{rowData:{},maxLane:{default:4},highlightBranches:{},tooltipText:{}},setup(r){const e=r,{COLUMN_WIDTH:t,ROW_HEIGHT:n,NODE_RADIUS:s,PADDING:i}=hl,o=K(()=>i*2+(e.maxLane+1)*t),a=n,l=n/2;function c(d){return i+d*t}function u(d){const m=c(d.fromLane),g=c(d.toLane);if(d.type==="vertical")return`M ${m} 0 L ${g} ${a}`;if(d.type==="vertical-top")return`M ${m} 0 L ${m} ${l}`;if(d.type==="vertical-bottom")return`M ${m} ${l} L ${m} ${a}`;if(d.style==="rounded")return`M ${m} ${l} C ${m} ${a}, ${g} ${a}, ${g} ${a}`;{const O=a*.75;return`M ${m} ${l} L ${m} ${O} L ${g} ${a}`}}const h=K(()=>e.rowData?c(e.rowData.lane):i);return(d,m)=>(v(),y("svg",{width:p(o),height:p(a),class:"block flex-shrink-0","aria-hidden":"true"},[r.rowData?(v(),y(ke,{key:0},[(v(!0),y(ke,null,Ne(r.rowData.connections,(g,O)=>(v(),y("path",{key:O,d:u(g),stroke:g.color,"stroke-width":"2",fill:"none","stroke-dasharray":g.type.startsWith("merge")?"4 3":"none"},null,8,Kv))),128)),f("g",null,[r.tooltipText?(v(),y("title",Jv,_(r.tooltipText),1)):U("",!0),r.rowData.nodeType==="head"?(v(),y(ke,{key:1},[f("circle",{cx:p(h),cy:l,r:p(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,eb),f("circle",{cx:p(h),cy:l,r:p(s),fill:r.rowData.color},null,8,tb)],64)):r.rowData.nodeType==="merge"?(v(),y(ke,{key:2},[f("circle",{cx:p(h),cy:l,r:p(s)+1,fill:"none",stroke:r.rowData.color,"stroke-width":"1.5"},null,8,rb),f("circle",{cx:p(h),cy:l,r:p(s)-1,fill:r.rowData.color},null,8,nb)],64)):r.rowData.nodeType==="stash"?(v(),y(ke,{key:3},[f("circle",{cx:p(h),cy:l,r:p(s),fill:"none",stroke:r.rowData.color,"stroke-width":"2"},null,8,sb),f("circle",{cx:p(h),cy:l,r:p(s)-2,fill:r.rowData.color},null,8,ib)],64)):r.rowData.nodeType==="uncommitted"?(v(),y("circle",{key:4,cx:p(h),cy:l,r:p(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,ob)):(v(),y("circle",{key:5,cx:p(h),cy:l,r:p(s),fill:r.rowData.color},null,8,ab))])],64)):U("",!0)],8,Hv))}}),lb=["aria-selected","aria-label"],cb={key:1,class:"flex gap-1 flex-shrink-0"},ub=["title","onContextmenu"],hb={key:2,class:"flex gap-1 flex-shrink-0"},db=["onContextmenu"],fb={class:"text-retro-text text-xs truncate flex-1"},mb={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},pb={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},Uh=72,gb=Ie({__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(r,{emit:e}){const t=r,n=e,s=K(()=>{const d=t.commit.branches;if(d.length===0)return[];const m=t.localBranchNames,g=[],O=[];for(const C of d)m.has(C)?g.push(C):O.push(C);const b=new Set(g),x=new Map,w=[];for(const C of O){const M=C.indexOf("/");if(M>0){const X=C.substring(M+1),V=C.substring(0,M);b.has(X)?(x.has(X)||x.set(X,[]),x.get(X).push(V)):w.push(C)}else w.push(C)}const S=[];for(const C of g){const M=x.get(C)||[];M.length>0?S.push({displayName:`${C}/${M.join(",")}`,originalBranches:[C,...M.map(X=>`${X}/${C}`)],isLocal:!0}):S.push({displayName:C,originalBranches:[C],isLocal:!0})}for(const C of w)S.push({displayName:C,originalBranches:[C],isLocal:!1});return S});function i(d,m){d.preventDefault(),d.stopPropagation();const g=m.originalBranches[0];n("branchContextMenu",{branch:g,x:d.clientX,y:d.clientY,isCurrentBranch:m.isLocal&&m.originalBranches.includes(t.currentBranchName??""),isLocal:m.isLocal})}function o(d,m){d.preventDefault(),d.stopPropagation(),n("tagContextMenu",{tag:m,x:d.clientX,y:d.clientY})}function a(d){d.preventDefault(),d.stopPropagation(),n("commitContextMenu",{x:d.clientX,y:d.clientY})}const{ROW_HEIGHT:l}=hl,c=K(()=>{const d=[t.commit.shortHash];return t.commit.branches.length>0&&d.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&d.push(t.commit.tags.map(m=>`tag: ${m}`).join(", ")),d.join(" — ")});function u(d){const g=Date.now()/1e3-d;return g<60?"just now":g<3600?`${Math.floor(g/60)}m ago`:g<86400?`${Math.floor(g/3600)}h ago`:g<604800?`${Math.floor(g/86400)}d ago`:g<2592e3?`${Math.floor(g/604800)}w ago`:new Date(d*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function h(d){const m=d.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./D_05ko21.js","./wserZ5KO.js","./entry.DJNhqbsn.css","./BBA9sqLe.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{y as v,z as y,A as f,d as Ie,C as J,G as p,Q as je,S as _t,R as et,I as ke,E as Xe,B as _,K as U,g as Q,J as Ne,U as as,k as K,V as er,L as Re,H as pe,o as pt,W as kt,X as Xm,N as Ve,Y as Xt,T as Pr,Z as Vs,_ as Qu,$ as Me,a0 as ls,O as pn,D as ct,P as kr,a1 as Im,a2 as pr,a3 as gs,a4 as kc,a5 as P1,c as T1,a6 as Lh,a7 as Vm,a8 as M1,q as A1,a9 as _1,x as R1}from"./wserZ5KO.js";import{r as wt,c as gn,b as ul,a as hs,u as Pu}from"./C5VmlmOK.js";import{g as po,m as B1,p as Z1,h as Xh,i as E1,j as Ih,k as D1,l as L1,n as X1,w as I1,o as V1,q as zm,s as Vh,C as z1,_ as N1,t as Tu,u as W1,r as q1,a as j1}from"./CUhpW37J.js";import{_ as Os}from"./DlAUqK2U.js";import{S as Qa,i as Y1,b as F1,P as U1,W as zh,M as Nh,c as Wh,d as qh,g as jh,e as G1,D as Nm,f as Wm,h as H1,a as go,j as Gt,u as Oo,k as Ts,l as Bo}from"./D_05ko21.js";import{u as wc,_ as K1}from"./lyWV44Wc.js";function J1(r,e){return v(),y("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"},[f("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 ev(r,e){return v(),y("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"},[f("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 tv(r,e){return v(),y("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"},[f("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 rv(r,e){return v(),y("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"},[f("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 nv(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function qm(r,e){return v(),y("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"},[f("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 jm(r,e){return v(),y("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"},[f("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 Ym(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function Fm(r,e){return v(),y("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"},[f("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 Um(r,e){return v(),y("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"},[f("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 Gm(r,e){return v(),y("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"},[f("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 sv(r,e){return v(),y("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"},[f("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 Hm(r,e){return v(),y("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"},[f("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 iv(r,e){return v(),y("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"},[f("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 ov(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z"})])}function av(r,e){return v(),y("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"},[f("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 lv(r,e){return v(),y("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"},[f("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 Mu(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function cv(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}function Au(r,e){return v(),y("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"},[f("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 uv(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"})])}function _u(r,e){return v(),y("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"},[f("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 zs(r,e){return v(),y("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"},[f("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 Km(r,e){return v(),y("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"},[f("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 Jm(r,e){return v(),y("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"},[f("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"}),f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function hv(r,e){return v(),y("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"},[f("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 dv(r,e){return v(),y("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"},[f("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 fv(r,e){return v(),y("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"},[f("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 mv(r,e){return v(),y("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"},[f("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 Ns(r,e){return v(),y("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"},[f("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 En(r,e){return v(),y("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"},[f("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 pv(r,e){return v(),y("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"},[f("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 gv(r,e){return v(),y("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"},[f("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"}),f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function Ov(r,e){return v(),y("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"},[f("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 vv(r,e){return v(),y("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"},[f("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 bv(r,e){return v(),y("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"},[f("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 xv(r,e){return v(),y("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"},[f("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 yv(r,e){return v(),y("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"},[f("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 ep(r,e){return v(),y("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"},[f("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 cs(r,e){return v(),y("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"},[f("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 kv(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"})])}function wv(r,e){return v(),y("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"},[f("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 tp(r,e){return v(),y("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"},[f("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 Sv(r,e){return v(),y("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"},[f("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 Yh(r,e){return v(),y("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"},[f("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 Ru(r,e){return v(),y("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"},[f("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 $v(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})])}function rp(r,e){return v(),y("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"},[f("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 Bu(r,e){return v(),y("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"},[f("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 Pa(r,e){return v(),y("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"},[f("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 Cv(r,e){return v(),y("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"},[f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}),f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9.563C9 9.252 9.252 9 9.563 9h4.874c.311 0 .563.252.563.563v4.874c0 .311-.252.563-.563.563H9.564A.562.562 0 0 1 9 14.437V9.564Z"})])}function Zu(r,e){return v(),y("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"},[f("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"}),f("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 6h.008v.008H6V6Z"})])}function Qv(r,e){return v(),y("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"},[f("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"})])}async function Fh(r){return $fetch("/api/chat/worktree",{method:"POST",body:r})}async function Pv(r){await $fetch("/api/chat/worktree",{method:"DELETE",body:r})}async function Tv(r){const e=await $fetch("/api/chat/preview-sync",{method:"POST",body:r});if(!e.success)throw new Error(e.error||"Unknown preview sync failure")}const Mv={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},Av={class:"relative flex-1 min-w-0"},_v={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},Rv=["disabled"],Bv=["disabled"],Zv=Ie({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(r,{expose:e,emit:t}){const n=t,s=Q(""),i=Q(null);let o=null;function a(){o&&clearTimeout(o),o=setTimeout(()=>{n("search",s.value)},200)}function l(u){u.key==="Escape"?(u.preventDefault(),n("close")):u.key==="Enter"&&(u.preventDefault(),u.shiftKey?n("prev"):n("next"))}function c(){i.value?.focus(),i.value?.select()}return e({focus:c}),(u,h)=>(v(),y("div",Mv,[J(p(cs),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),f("div",Av,[je(f("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":h[0]||(h[0]=d=>et(s)?s.value=d: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:a,onKeydown:l},null,544),[[_t,p(s)]])]),p(s)?(v(),y("span",_v,[r.resultCount>0?(v(),y(ke,{key:0},[Xe(_(r.currentIndex+1)+" of "+_(r.resultCount),1)],64)):(v(),y(ke,{key:1},[Xe(" No results ")],64))])):U("",!0),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:r.resultCount===0,"aria-label":"Previous result",title:"Previous (Shift+Enter)",onClick:h[1]||(h[1]=d=>n("prev"))},[J(p(uv),{class:"w-4 h-4"})],8,Rv),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:r.resultCount===0,"aria-label":"Next result",title:"Next (Enter)",onClick:h[2]||(h[2]=d=>n("next"))},[J(p(cv),{class:"w-4 h-4"})],8,Bv),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors","aria-label":"Close find widget",title:"Close (Escape)",onClick:h[3]||(h[3]=d=>n("close"))},[J(p(wt),{class:"w-4 h-4"})])]))}}),Ev={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},Dv={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},Lv={class:"flex-1 overflow-auto max-h-[300px]"},Xv={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},Iv=["onKeyup"],Vv=["onClick"],zv={class:"text-retro-muted truncate flex-1 font-mono"},Nv=["onClick"],Wv=["onClick"],qv={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},jv={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},Yv={class:"flex gap-2 justify-end"},Fv=["disabled"],Uv={key:1,class:"px-3 py-2 border-t border-retro-border"},Gv=Ie({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(r,{emit:e}){const t=e,n=Q(!1),s=Q(""),i=Q(""),o=Q(null),a=Q("");function l(){n.value=!0,s.value="",i.value=""}function c(){!s.value.trim()||!i.value.trim()||(t("add",{name:s.value.trim(),url:i.value.trim()}),n.value=!1)}function u(m){o.value=m.name,a.value=m.fetchUrl}function h(m){a.value.trim()&&(t("edit",{name:m,newUrl:a.value.trim()}),o.value=null)}function d(){o.value=null}return(m,g)=>(v(),y("div",Ev,[f("div",Dv,[g[5]||(g[5]=f("h3",{class:"text-sm font-semibold text-retro-text"},"Remote Repositories",-1)),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",onClick:g[0]||(g[0]=O=>t("close"))},[J(p(wt),{class:"w-4 h-4"})])]),f("div",Lv,[(v(!0),y(ke,null,Ne(r.remotes,O=>(v(),y("div",{key:O.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[f("span",Xv,_(O.name),1),p(o)===O.name?(v(),y(ke,{key:0},[je(f("input",{"onUpdate:modelValue":g[1]||(g[1]=b=>et(a)?a.value=b: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:[as(b=>h(O.name),["enter"]),as(d,["escape"])]},null,40,Iv),[[_t,p(a)]]),f("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:b=>h(O.name)},[J(p(Mu),{class:"w-3.5 h-3.5"})],8,Vv),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:d},[J(p(wt),{class:"w-3.5 h-3.5"})])],64)):(v(),y(ke,{key:1},[f("span",zv,_(O.fetchUrl),1),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:b=>u(O)},[J(p(tp),{class:"w-3.5 h-3.5"})],8,Nv),f("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:b=>t("delete",O.name)},[J(p(gn),{class:"w-3.5 h-3.5"})],8,Wv)],64))]))),128)),r.remotes.length===0?(v(),y("div",qv," No remotes configured ")):U("",!0)]),p(n)?(v(),y("div",jv,[je(f("input",{"onUpdate:modelValue":g[2]||(g[2]=O=>et(s)?s.value=O: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),[[_t,p(s)]]),je(f("input",{"onUpdate:modelValue":g[3]||(g[3]=O=>et(i)?i.value=O: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:as(c,["enter"])},null,544),[[_t,p(i)]]),f("div",Yv,[f("button",{class:"px-2 py-1 text-xs text-retro-muted hover:text-retro-text transition-colors",onClick:g[4]||(g[4]=O=>n.value=!1)}," Cancel "),f("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:!p(s).trim()||!p(i).trim(),onClick:c}," Add Remote ",8,Fv)])])):U("",!0),p(n)?U("",!0):(v(),y("div",Uv,[f("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:l},[J(p(ul),{class:"w-3.5 h-3.5"}),g[6]||(g[6]=Xe(" Add Remote ",-1))])]))]))}}),hl={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},Zo=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Ws={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"}},Hv=["width","height"],Kv=["d","stroke","stroke-dasharray"],Jv={key:0},eb=["cx","r"],tb=["cx","r","fill"],rb=["cx","r","stroke"],nb=["cx","r","fill"],sb=["cx","r","stroke"],ib=["cx","r","fill"],ob=["cx","r"],ab=["cx","r","fill"],np=Ie({__name:"GitGraphSvg",props:{rowData:{},maxLane:{default:4},highlightBranches:{},tooltipText:{}},setup(r){const e=r,{COLUMN_WIDTH:t,ROW_HEIGHT:n,NODE_RADIUS:s,PADDING:i}=hl,o=K(()=>i*2+(e.maxLane+1)*t),a=n,l=n/2;function c(d){return i+d*t}function u(d){const m=c(d.fromLane),g=c(d.toLane);if(d.type==="vertical")return`M ${m} 0 L ${g} ${a}`;if(d.type==="vertical-top")return`M ${m} 0 L ${m} ${l}`;if(d.type==="vertical-bottom")return`M ${m} ${l} L ${m} ${a}`;if(d.style==="rounded")return`M ${m} ${l} C ${m} ${a}, ${g} ${a}, ${g} ${a}`;{const O=a*.75;return`M ${m} ${l} L ${m} ${O} L ${g} ${a}`}}const h=K(()=>e.rowData?c(e.rowData.lane):i);return(d,m)=>(v(),y("svg",{width:p(o),height:p(a),class:"block flex-shrink-0","aria-hidden":"true"},[r.rowData?(v(),y(ke,{key:0},[(v(!0),y(ke,null,Ne(r.rowData.connections,(g,O)=>(v(),y("path",{key:O,d:u(g),stroke:g.color,"stroke-width":"2",fill:"none","stroke-dasharray":g.type.startsWith("merge")?"4 3":"none"},null,8,Kv))),128)),f("g",null,[r.tooltipText?(v(),y("title",Jv,_(r.tooltipText),1)):U("",!0),r.rowData.nodeType==="head"?(v(),y(ke,{key:1},[f("circle",{cx:p(h),cy:l,r:p(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,eb),f("circle",{cx:p(h),cy:l,r:p(s),fill:r.rowData.color},null,8,tb)],64)):r.rowData.nodeType==="merge"?(v(),y(ke,{key:2},[f("circle",{cx:p(h),cy:l,r:p(s)+1,fill:"none",stroke:r.rowData.color,"stroke-width":"1.5"},null,8,rb),f("circle",{cx:p(h),cy:l,r:p(s)-1,fill:r.rowData.color},null,8,nb)],64)):r.rowData.nodeType==="stash"?(v(),y(ke,{key:3},[f("circle",{cx:p(h),cy:l,r:p(s),fill:"none",stroke:r.rowData.color,"stroke-width":"2"},null,8,sb),f("circle",{cx:p(h),cy:l,r:p(s)-2,fill:r.rowData.color},null,8,ib)],64)):r.rowData.nodeType==="uncommitted"?(v(),y("circle",{key:4,cx:p(h),cy:l,r:p(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,ob)):(v(),y("circle",{key:5,cx:p(h),cy:l,r:p(s),fill:r.rowData.color},null,8,ab))])],64)):U("",!0)],8,Hv))}}),lb=["aria-selected","aria-label"],cb={key:1,class:"flex gap-1 flex-shrink-0"},ub=["title","onContextmenu"],hb={key:2,class:"flex gap-1 flex-shrink-0"},db=["onContextmenu"],fb={class:"text-retro-text text-xs truncate flex-1"},mb={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},pb={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},Uh=72,gb=Ie({__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(r,{emit:e}){const t=r,n=e,s=K(()=>{const d=t.commit.branches;if(d.length===0)return[];const m=t.localBranchNames,g=[],O=[];for(const C of d)m.has(C)?g.push(C):O.push(C);const b=new Set(g),x=new Map,w=[];for(const C of O){const M=C.indexOf("/");if(M>0){const X=C.substring(M+1),V=C.substring(0,M);b.has(X)?(x.has(X)||x.set(X,[]),x.get(X).push(V)):w.push(C)}else w.push(C)}const S=[];for(const C of g){const M=x.get(C)||[];M.length>0?S.push({displayName:`${C}/${M.join(",")}`,originalBranches:[C,...M.map(X=>`${X}/${C}`)],isLocal:!0}):S.push({displayName:C,originalBranches:[C],isLocal:!0})}for(const C of w)S.push({displayName:C,originalBranches:[C],isLocal:!1});return S});function i(d,m){d.preventDefault(),d.stopPropagation();const g=m.originalBranches[0];n("branchContextMenu",{branch:g,x:d.clientX,y:d.clientY,isCurrentBranch:m.isLocal&&m.originalBranches.includes(t.currentBranchName??""),isLocal:m.isLocal})}function o(d,m){d.preventDefault(),d.stopPropagation(),n("tagContextMenu",{tag:m,x:d.clientX,y:d.clientY})}function a(d){d.preventDefault(),d.stopPropagation(),n("commitContextMenu",{x:d.clientX,y:d.clientY})}const{ROW_HEIGHT:l}=hl,c=K(()=>{const d=[t.commit.shortHash];return t.commit.branches.length>0&&d.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&d.push(t.commit.tags.map(m=>`tag: ${m}`).join(", ")),d.join(" — ")});function u(d){const g=Date.now()/1e3-d;return g<60?"just now":g<3600?`${Math.floor(g/60)}m ago`:g<86400?`${Math.floor(g/3600)}h ago`:g<604800?`${Math.floor(g/86400)}d ago`:g<2592e3?`${Math.floor(g/604800)}w ago`:new Date(d*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function h(d){const m=d.split(`
|
|
3
3
|
`)[0];return m.length>Uh?m.substring(0,Uh-3)+"...":m}return(d,m)=>{const g=np;return v(),y("div",{class:Re(["flex items-center cursor-pointer group focus:outline-none focus:ring-1 focus:ring-retro-cyan/50 focus:ring-inset",{"opacity-40":r.isMuted,"bg-retro-magenta/10":r.isPreviewHighlighted,"bg-retro-yellow/20":r.isFeatureHighlighted&&!r.isPreviewHighlighted}]),style:er({height:`${p(l)}px`}),role:"row",tabindex:"0","aria-selected":r.isSelected,"aria-label":`Commit ${r.commit.shortHash} by ${r.commit.author}: ${r.commit.message.split(`
|
|
4
4
|
`)[0]}`,onClick:m[0]||(m[0]=O=>n("click",O)),onKeydown:m[1]||(m[1]=O=>n("keydown",O)),onContextmenu:a},[J(g,{rowData:r.graphRowData,maxLane:r.maxLane,tooltipText:p(c)},null,8,["rowData","maxLane","tooltipText"]),f("div",{class:Re(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-magenta/10 border-l-2 border-retro-magenta/40":r.isPreviewHighlighted,"bg-retro-yellow/30 border-l-2 border-retro-yellow":r.isFeatureHighlighted&&!r.isPreviewHighlighted,"bg-retro-cyan/15":r.isSelected&&!r.isFeatureHighlighted&&!r.isPreviewHighlighted,"bg-retro-yellow/10":r.isHighlighted&&!r.isSelected&&!r.isFeatureHighlighted&&!r.isPreviewHighlighted,"bg-retro-cyan/5":r.isBranchHighlighted&&!r.isSelected&&!r.isHighlighted&&!r.isFeatureHighlighted&&!r.isPreviewHighlighted,"group-hover:bg-retro-panel/50":!r.isSelected&&!r.isHighlighted&&!r.isFeatureHighlighted&&!r.isPreviewHighlighted&&!r.isBranchHighlighted}]),style:er({height:`${p(l)-4}px`})},[!r.columnVisibility||r.columnVisibility.commit!==!1?(v(),y("span",{key:0,class:Re(["flex-shrink-0 font-mono text-[11px]",r.commit.isHead?"text-retro-cyan font-semibold":"text-retro-muted"])},_(r.commit.shortHash),3)):U("",!0),p(s).length>0?(v(),y("div",cb,[(v(!0),y(ke,null,Ne(p(s),O=>(v(),y("span",{key:O.displayName,class:Re(["px-1.5 py-0.5 text-[10px] rounded font-semibold leading-none cursor-context-menu hover:ring-1 hover:ring-retro-cyan/50",r.commit.isHead&&O.isLocal?"bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40":r.isPreviewHighlighted?"bg-retro-magenta/10 text-retro-magenta border border-retro-magenta/40":r.isFeatureHighlighted?"bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/30":r.isBranchHighlighted?"bg-retro-cyan/15 text-retro-cyan/80 border border-retro-cyan/30":O.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:O.originalBranches.join(", "),onContextmenu:b=>i(b,O)},_(O.displayName),43,ub))),128))])):U("",!0),r.commit.tags.length>0?(v(),y("div",hb,[(v(!0),y(ke,null,Ne(r.commit.tags,O=>(v(),y("span",{key:O,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:b=>o(b,O)},[J(p(Zu),{class:"w-2.5 h-2.5"}),Xe(" "+_(O),1)],40,db))),128))])):U("",!0),f("span",fb,_(h(r.commit.message)),1),r.commit.signatureStatus==="good"?(v(),pe(p(rp),{key:3,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-green",title:"Verified signature"})):r.commit.signatureStatus==="bad"?(v(),pe(p(Bu),{key:4,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-red",title:"Bad signature"})):U("",!0),!r.columnVisibility||r.columnVisibility.author!==!1?(v(),y("span",mb,_(r.commit.author),1)):U("",!0),!r.columnVisibility||r.columnVisibility.date!==!1?(v(),y("span",pb,_(u(r.commit.timestamp)),1)):U("",!0)],6)],46,lb)}}});function Ob(){const{COLUMN_WIDTH:r,ROW_HEIGHT:e,NODE_RADIUS:t,PADDING:n}=hl;function s(l){let c=0;for(let u=0;u<l.length;u++){const h=l.charCodeAt(u);c=(c<<5)-c+h,c=c&c}return Math.abs(c)}function i(l){const c=s(l)%Zo.length;return Zo[c]}function o(l,c="rounded"){const u=new Map;if(l.length===0)return u;const h=new Set,d=new Map;for(const S of l)d.set(S.hash,S);const m=l.find(S=>S.isHead)||l[0];if(m){let S=m;for(;S;){h.add(S.hash);const C=S.parents?.[0];S=C?d.get(C):void 0}}const g=new Map,O=new Map,b=new Map,x=new Map,w=new Map;for(let S=0;S<l.length;S++){const C=l[S];w.set(C.hash,S);const M=h.has(C.hash);let X,V;if(x.has(C.hash)){const I=x.get(C.hash);X=I.lane,V=I.color,x.delete(C.hash)}else if(M)X=0,V=Zo[0];else{for(X=1;b.has(X);)X++;V=i(C.hash.substring(0,7))}g.set(C.hash,X),O.set(C.hash,V),b.set(X,C.hash);const se=C.isMerge||C.parents&&C.parents.length>1;let le="regular";C.isHead?le="head":se&&(le="merge"),u.set(C.hash,{commitHash:C.hash,lane:X,color:V,nodeType:le,isMainline:h.has(C.hash),connections:[]});const ue=C.parents||[];for(let I=0;I<ue.length;I++){const Z=ue[I];if(g.has(Z)||x.has(Z))continue;const F=h.has(Z);let W,N;if(I===0)W=X,N=V;else if(F)W=0,N=Zo[0];else{for(W=1;b.has(W)||W===X;)W++;N=i(Z.substring(0,7))}x.set(Z,{lane:W,color:N,childHash:C.hash})}const j=ue[0];if(!j)b.delete(X);else{const I=g.get(j),Z=x.get(j),F=I??Z?.lane;F!==void 0&&F!==X&&b.delete(X)}}for(let S=0;S<l.length;S++){const C=l[S],M=u.get(C.hash);if(!M)continue;const X=C.parents||[];for(let V=0;V<X.length;V++){const se=X[V],le=g.get(se),ue=w.get(se);if(le===void 0)continue;const j=M.lane,I=le,Z=V===0?M.color:O.get(se)||i(se.substring(0,7));if(j===I?M.connections.push({type:"vertical-bottom",fromLane:j,toLane:I,color:Z,style:c}):V>0?M.connections.push({type:j<I?"merge-out":"merge-in",fromLane:j,toLane:I,color:Z,style:c}):M.connections.push({type:j<I?"branch-out":"branch-in",fromLane:j,toLane:I,color:Z,style:c}),ue!==void 0&&ue>S+1)for(let F=S+1;F<ue;F++){const W=l[F],N=u.get(W.hash);N&&N.connections.push({type:"vertical",fromLane:I,toLane:I,color:Z,style:c})}if(ue!==void 0){const F=u.get(se);F&&F.connections.push({type:"vertical-top",fromLane:I,toLane:I,color:Z,style:c})}}}return u}function a(l){let c=0;for(const u of l.values()){u.lane>c&&(c=u.lane);for(const h of u.connections)h.fromLane>c&&(c=h.fromLane),h.toLane>c&&(c=h.toLane)}return c}return{computeGraphRows:o,computeMaxLane:a,getBranchColor:i,COLUMN_WIDTH:r,ROW_HEIGHT:e,NODE_RADIUS:t,PADDING:n}}const vb=["aria-selected"],bb={class:"text-retro-yellow text-xs font-medium"},xb={key:1,class:"flex items-center justify-center gap-2 p-2 text-retro-muted text-sm"},yb={key:2,class:"p-2 text-center text-retro-muted/50 text-xs"},kb=Ie({__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(r,{expose:e,emit:t}){const n=r,s=t;function i(){s("selectUncommittedChanges")}function o(te){(te.key==="Enter"||te.key===" ")&&(te.preventDefault(),s("selectUncommittedChanges"))}const a=K(()=>n.searchQuery?.toLowerCase()??""),l=K(()=>new Set(n.highlightBranches??[])),c=K(()=>l.value.size>0),u=K(()=>{const te=a.value;if(!te)return new Set;const ge=new Set;for(const me of n.commits)(me.message.toLowerCase().includes(te)||me.author.toLowerCase().includes(te)||me.shortHash.toLowerCase().includes(te)||me.hash.toLowerCase().includes(te)||me.branches.some(Se=>Se.toLowerCase().includes(te))||me.tags.some(Se=>Se.toLowerCase().includes(te)))&&ge.add(me.hash);return ge}),h=K(()=>{if(!c.value)return new Set;const te=new Set;for(const ge of n.commits)ge.branches.some(me=>l.value.has(me))&&te.add(ge.hash);return te}),d=K(()=>{if(!n.featureHighlightBranches||n.featureHighlightBranches.length===0)return new Set;const te=n.featureMergeBases??{},ge=new Map;for(const Se of n.commits)ge.set(Se.hash,Se);const me=new Set;for(const Se of n.featureHighlightBranches){const Qe=n.commits.find(T=>T.branches.includes(Se));if(!Qe)continue;const Ye=te[Se]??null;if(!Ye)continue;let P=Qe;for(;P&&P.hash!==Ye;)me.add(P.hash),P=P.parents?.[0]?ge.get(P.parents[0]):void 0}return me}),m=K(()=>{if(!n.previewHighlightBranches||n.previewHighlightBranches.length===0)return new Set;const te=n.previewMergeBases??{},ge=new Map;for(const Se of n.commits)ge.set(Se.hash,Se);const me=new Set;for(const Se of n.previewHighlightBranches){const Qe=n.commits.find(T=>T.branches.includes(Se));if(!Qe)continue;const Ye=te[Se]??null;if(!Ye)continue;let P=Qe;for(;P&&P.hash!==Ye;)me.add(P.hash),P=P.parents?.[0]?ge.get(P.parents[0]):void 0}return me});function g(te,ge){s("branchContextMenu",{...ge,commitHash:te.hash})}function O(te,ge){s("commitContextMenu",{commit:te,...ge})}function b(te,ge){s("tagContextMenu",{...ge,commitHash:te.hash})}const{ROW_HEIGHT:x,VISIBLE_BUFFER:w}=hl,{computeGraphRows:S,computeMaxLane:C}=Ob(),M=K(()=>S([...n.commits],n.graphStyle)),X=K(()=>C(M.value)),V=K(()=>{const te=n.stashes||[];if(te.length===0)return n.commits.map((Qe,Ye)=>({type:"commit",commit:Qe,commitIndex:Ye}));const ge=[],me=[...te].sort((Qe,Ye)=>new Date(Ye.date).getTime()-new Date(Qe.date).getTime());let Se=0;for(let Qe=0;Qe<n.commits.length;Qe++){const Ye=n.commits[Qe],P=Ye.timestamp*1e3;for(;Se<me.length&&new Date(me[Se].date).getTime()>=P;)ge.push({type:"stash",stash:me[Se]}),Se++;ge.push({type:"commit",commit:Ye,commitIndex:Qe})}for(;Se<me.length;)ge.push({type:"stash",stash:me[Se]}),Se++;return ge}),se=Q(null),le=Q(0),ue=Q(400);let j=null;const I=K(()=>{const te=w,ge=V.value.length,me=Math.max(0,Math.floor(le.value/x)-te),Se=Math.min(ge,Math.ceil((le.value+ue.value)/x)+te);return{startIndex:me,endIndex:Se}}),Z=K(()=>{const{startIndex:te,endIndex:ge}=I.value;return V.value.slice(te,ge).map((me,Se)=>({row:me,index:te+Se,graphRow:me.type==="commit"&&M.value.get(me.commit.hash)||null,isHighlighted:me.type==="commit"?u.value.has(me.commit.hash):!1,isBranchHighlighted:me.type==="commit"?h.value.has(me.commit.hash):!1,isFeatureHighlighted:me.type==="commit"?d.value.has(me.commit.hash):!1,isPreviewHighlighted:me.type==="commit"?m.value.has(me.commit.hash):!1,isMuted:me.type==="commit"&&n.muteNonAncestral?!(M.value.get(me.commit.hash)?.isMainline??!1):!1}))}),F=K(()=>V.value.length*x),W=K(()=>I.value.startIndex*x);function N(te){const ge=te.target;le.value=ge.scrollTop,j||s("scrollStart"),j&&clearTimeout(j),j=setTimeout(()=>{j=null,s("scrollEnd")},150),n.hasMore&&!n.loading&&!n.loadingMore&&ge.scrollTop+ge.clientHeight>=ge.scrollHeight-200&&s("loadMore")}function L(te,ge){ge.ctrlKey||ge.metaKey?s("compareSelect",te):s("select",te)}function z(te,ge,me){if(te.key==="Enter"||te.key===" ")te.preventDefault(),s("select",ge);else if(te.key==="ArrowDown"){te.preventDefault();for(let Se=me+1;Se<V.value.length;Se++){const Qe=V.value[Se];if(Qe.type==="commit"){s("select",Qe.commit),ve(Se);break}}}else if(te.key==="ArrowUp"){te.preventDefault();for(let Se=me-1;Se>=0;Se--){const Qe=V.value[Se];if(Qe.type==="commit"){s("select",Qe.commit),ve(Se);break}}}}function ve(te){if(!se.value)return;const ge=te*x,me=se.value.scrollTop,Se=me+se.value.clientHeight;ge<me?se.value.scrollTop=ge:ge+x>Se&&(se.value.scrollTop=ge+x-se.value.clientHeight)}pt(()=>{if(se.value){ue.value=se.value.clientHeight;const te=new ResizeObserver(ge=>{for(const me of ge)ue.value=me.contentRect.height});te.observe(se.value),kt(()=>te.disconnect())}});function H(){return se.value?.scrollTop??0}function G(te){se.value&&(se.value.scrollTop=te)}return e({getScrollPosition:H,setScrollPosition:G,scrollToIndex:ve}),(te,ge)=>{const me=np,Se=gb;return v(),y("div",{ref_key:"containerRef",ref:se,class:"h-full overflow-auto",role:"list","aria-label":"Commit history",onScroll:N},[r.uncommittedChangesCount&&r.uncommittedChangesCount>0?(v(),y("div",{key:0,class:"flex items-center cursor-pointer group sticky top-0 z-10 bg-retro-dark border-b border-retro-border",style:er({height:`${p(x)}px`}),role:"button",tabindex:"0","aria-selected":r.isUncommittedChangesSelected,onClick:i,onKeydown:o},[J(me,{rowData:{commitHash:"uncommitted",lane:0,color:"#F59E0B",nodeType:"uncommitted",isMainline:!1,connections:[]},maxLane:p(X)},null,8,["maxLane"]),f("div",{class:Re(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-yellow/15":r.isUncommittedChangesSelected,"group-hover:bg-retro-panel/50":!r.isUncommittedChangesSelected}]),style:er({height:`${p(x)-4}px`})},[J(p(po),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),f("span",bb," Uncommitted Changes ("+_(r.uncommittedChangesCount)+") ",1),ge[1]||(ge[1]=f("span",{class:"flex-1"},null,-1)),ge[2]||(ge[2]=f("span",{class:"text-retro-muted text-[10px]"},"Working tree",-1))],6)],44,vb)):U("",!0),f("div",{class:"relative",style:er({height:`${p(F)}px`})},[f("div",{class:"absolute left-0 right-0",style:er({transform:`translateY(${p(W)}px)`})},[(v(!0),y(ke,null,Ne(p(Z),({row:Qe,index:Ye,graphRow:P,isHighlighted:T,isBranchHighlighted:E,isFeatureHighlighted:B,isPreviewHighlighted:be,isMuted:Ae})=>(v(),y(ke,{key:Qe.type==="commit"?Qe.commit.hash:`stash-${Qe.stash.index}`},[Qe.type==="commit"?Xm([Qe.commit.hash,Qe.commit.message,Qe.commit.timestamp,Qe.commit.branches.join("|"),Qe.commit.tags.join("|"),r.selectedCommit?.hash===Qe.commit.hash,T,E,B,be,Ae,n.currentBranchName||"",n.columnVisibility?.date!==!1,n.columnVisibility?.author!==!1,n.columnVisibility?.commit!==!1],()=>(v(),pe(Se,{key:0,commit:Qe.commit,index:Qe.commitIndex,isSelected:r.selectedCommit?.hash===Qe.commit.hash,isHighlighted:T,isBranchHighlighted:E,isFeatureHighlighted:B,isPreviewHighlighted:be,isMuted:Ae,currentBranchName:n.currentBranchName,localBranchNames:n.localBranchNames,graphRowData:P,maxLane:p(X),columnVisibility:n.columnVisibility,onClick:Te=>L(Qe.commit,Te),onKeydown:Te=>z(Te,Qe.commit,Ye),onBranchContextMenu:Te=>g(Qe.commit,Te),onCommitContextMenu:Te=>O(Qe.commit,Te),onTagContextMenu:Te=>b(Qe.commit,Te)},null,8,["commit","index","isSelected","isHighlighted","isBranchHighlighted","isFeatureHighlighted","isPreviewHighlighted","isMuted","currentBranchName","localBranchNames","graphRowData","maxLane","columnVisibility","onClick","onKeydown","onBranchContextMenu","onCommitContextMenu","onTagContextMenu"])),ge,0):U("",!0)],64))),128))],4)],4),(r.loading||r.loadingMore)&&r.commits.length>0?(v(),y("div",xb,[...ge[3]||(ge[3]=[f("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Xe(" Loading more commits... ",-1)])])):U("",!0),!r.hasMore&&r.commits.length>0&&!r.loading?(v(),y("div",yb,_(r.commits.length)+" commits loaded ",1)):U("",!0)],544)}}});function wb(r){const e=r.charAt(0).toUpperCase();return e in Ws?e:"M"}function Eo(r,e){if(r&&typeof r=="object"){const t=r;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 r instanceof Error&&r.message?r.message:e}function sp(r,e){const t=e.trim().toLowerCase();return t?r.filter(n=>n.message.toLowerCase().includes(t)||n.author.toLowerCase().includes(t)||n.shortHash.includes(t)||n.hash.includes(t)||n.branches.some(s=>s.toLowerCase().includes(t))||n.tags.some(s=>s.toLowerCase().includes(t))):[...r]}function Sb(r,e){return e.size===0?[...r]:r.filter(t=>t.branches.some(n=>e.has(n)))}function $b(r=10){const e=new Map;function t(s,i){const o=i.toLowerCase(),a=`${o}:${s.length}`,l=e.get(a);if(l)return l;const c=sp(s,o);if(e.size>=r){const u=e.keys().next().value;u!==void 0&&e.delete(u)}return e.set(a,c),c}function n(){e.clear()}return{filter:t,clear:n}}const Cb={class:"flex flex-col h-full border-t border-retro-border bg-retro-dark"},Qb={class:"flex items-center justify-between p-2 border-b border-retro-border flex-shrink-0"},Pb={class:"flex items-center gap-2 text-xs min-w-0"},Tb={class:"font-mono text-retro-cyan"},Mb={class:"font-mono text-retro-cyan"},Ab={key:0,class:"px-3 py-1.5 text-xs text-retro-muted border-b border-retro-border flex-shrink-0"},_b={class:"text-retro-green"},Rb={class:"text-retro-red"},Bb={key:1,class:"flex-1 flex items-center justify-center"},Zb={key:2,class:"flex-1 overflow-auto"},Eb={class:"text-retro-text truncate flex-1"},Db={class:"text-retro-muted"},Lb={key:0,class:"flex-shrink-0 text-[10px] font-mono"},Xb={key:0,class:"text-retro-green"},Ib={key:1,class:"text-retro-red ml-1"},Vb={key:1,class:"flex-shrink-0 text-[10px] text-retro-muted italic"},zb={key:3,class:"flex-1 flex items-center justify-center text-retro-muted text-sm"},Nb=Ie({__name:"GitComparisonView",props:{fromCommit:{},toCommit:{},files:{},stats:{},loading:{type:Boolean}},emits:["close"],setup(r,{emit:e}){const t=e;function n(s){const i=wb(s);return Ws[i]||Ws.M}return(s,i)=>(v(),y("div",Cb,[f("div",Qb,[f("div",Pb,[i[1]||(i[1]=f("span",{class:"text-retro-muted"},"Comparing",-1)),f("span",Tb,_(r.fromCommit.shortHash),1),i[2]||(i[2]=f("span",{class:"text-retro-muted"},"→",-1)),f("span",Mb,_(r.toCommit.shortHash),1)]),f("button",{class:"p-1 text-retro-muted hover:text-retro-text transition-colors flex-shrink-0","aria-label":"Close comparison",onClick:i[0]||(i[0]=o=>t("close"))},[J(p(wt),{class:"w-4 h-4"})])]),r.stats?(v(),y("div",Ab,[Xe(_(r.stats.filesChanged)+" file"+_(r.stats.filesChanged!==1?"s":"")+" changed, ",1),f("span",_b,"+"+_(r.stats.additions),1),f("span",Rb," -"+_(r.stats.deletions),1)])):U("",!0),r.loading?(v(),y("div",Bb,[...i[3]||(i[3]=[f("div",{class:"flex items-center gap-2 text-retro-muted text-sm"},[f("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"}),Xe(" Loading comparison... ")],-1)])])):r.files&&r.files.length>0?(v(),y("div",Zb,[(v(!0),y(ke,null,Ne(r.files,o=>(v(),y("div",{key:o.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"},[f("span",{class:Re(["flex-shrink-0 w-4 text-center font-semibold text-[10px]",n(o.status).colorClass])},_(o.status.charAt(0)),3),f("span",Eb,[o.oldPath&&o.status.startsWith("R")?(v(),y(ke,{key:0},[f("span",Db,_(o.oldPath),1),i[4]||(i[4]=f("span",{class:"text-retro-muted mx-1"},"→",-1))],64)):U("",!0),Xe(" "+_(o.path),1)]),o.binary?(v(),y("span",Vb,"binary")):(v(),y("span",Lb,[o.additions>0?(v(),y("span",Xb,"+"+_(o.additions),1)):U("",!0),o.deletions>0?(v(),y("span",Ib,"-"+_(o.deletions),1)):U("",!0)]))]))),128))])):r.files&&r.files.length===0?(v(),y("div",zb," No differences between these commits ")):U("",!0)]))}}),Wb={":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:":"🦺"},qb=/https?:\/\/[^\s<>)"']+/g;function jb(r){return r.replace(qb,e=>`<a href="${e}" target="_blank" rel="noopener noreferrer" class="text-retro-blue hover:underline">${e}</a>`)}function Yb(r){return r.replace(/:[a-z0-9_]+:/g,e=>Wb[e]||e)}function Fb(r){if(!r)return"";let e=Yb(r);return e=B1.parse(e),e=jb(e),e=Z1.sanitize(e,{ALLOWED_TAGS:["a","strong","em","code","b","i","br","p","ul","ol","li","pre","blockquote","h1","h2","h3"],ALLOWED_ATTR:["href","target","rel","class"]}),e}const Ub={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Gb={class:"flex items-center gap-2 min-w-0"},Hb={class:"text-retro-cyan font-mono text-sm"},Kb={class:"text-retro-muted text-sm truncate"},Jb={class:"flex items-center gap-1 flex-shrink-0"},ex=["aria-label","title"],tx={class:"flex-1 overflow-auto p-4 space-y-4"},rx={class:"space-y-2"},nx={class:"flex items-center gap-2 text-sm"},sx={class:"text-retro-text font-mono text-xs bg-retro-panel px-2 py-1 rounded"},ix={class:"flex items-center gap-2 text-sm"},ox={class:"text-retro-text"},ax={class:"text-retro-muted"},lx={key:0,class:"flex items-center gap-2 text-sm"},cx={class:"text-retro-text"},ux={class:"text-retro-muted"},hx={class:"flex items-center gap-2 text-sm"},dx={class:"text-retro-text"},fx={key:1,class:"flex items-start gap-2 text-sm"},mx={class:"flex flex-wrap gap-1"},px=["onClick","title"],gx={key:2,class:"flex items-start gap-2 text-sm"},Ox={class:"flex flex-wrap gap-1"},vx={key:3,class:"flex items-start gap-2 text-sm"},bx={class:"flex flex-wrap gap-1"},xx={class:"space-y-1"},yx={class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded"},kx={key:0,class:"space-y-1"},wx=["innerHTML"],Sx={key:1,class:"space-y-2"},$x={class:"flex items-center gap-2 text-sm"},Cx={class:"text-retro-muted"},Qx={key:0,class:"flex items-center gap-2"},Px={class:"text-retro-green text-xs font-mono"},Tx={class:"flex-1 h-2 rounded overflow-hidden bg-retro-panel flex"},Mx={class:"text-retro-red text-xs font-mono"},Ax={key:2,class:"space-y-2"},_x={class:"flex items-center justify-between"},Rx={class:"text-retro-muted text-xs uppercase tracking-wide"},Bx={class:"flex items-center gap-1"},Zx={key:0,class:"text-retro-muted text-sm py-2"},Ex={key:1,class:"space-y-0.5"},Dx=["onClick"],Lx=["title"],Xx={class:"text-retro-text font-mono text-xs truncate flex-1"},Ix={class:"text-retro-muted"},Vx={class:"text-retro-text"},zx={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Nx={key:0,class:"text-retro-green"},Wx={key:1,class:"text-retro-red"},qx={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},jx={key:2,class:"space-y-0"},Yx=["onClick"],Fx={class:"text-retro-text font-mono text-xs"},Ux=["title"],Gx={class:"text-retro-text font-mono text-xs truncate flex-1"},Hx={class:"text-retro-muted"},Kx={class:"text-retro-text"},Jx={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},ey={key:0,class:"text-retro-green"},ty={key:1,class:"text-retro-red"},ry={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},ny={key:3,class:"flex items-center gap-2 text-retro-muted text-sm py-2"},sy={key:4,class:"text-retro-muted text-sm py-2"},iy=Ie({__name:"GitCommitDetail",props:{commit:{},files:{},stats:{},loading:{type:Boolean,default:!1},committer:{},committerEmail:{},detailPosition:{default:"inline"}},emits:["close","navigateToCommit","togglePosition","navigatePrev","navigateNext","openFileDiff"],setup(r,{emit:e}){const t=r,n=e,s=Q(null),i=Q("flat"),o=Q(new Set),a=K(()=>!t.committer||!t.committerEmail?!1:t.committer!==t.commit.author||t.committerEmail!==t.commit.email),l=K(()=>{const j=t.commit.body;return j?Fb(j):""}),c=K(()=>{if(!t.stats)return"";const{filesChanged:j,additions:I,deletions:Z}=t.stats,W=[`${j} ${j===1?"file":"files"} changed`];return I>0&&W.push(`+${I} insertion${I===1?"":"s"}`),Z>0&&W.push(`-${Z} deletion${Z===1?"":"s"}`),W.join(", ")});function u(j){const I=[];for(const Z of j){const F=Z.path.split("/");let W=I;for(let N=0;N<F.length;N++){const L=F[N],z=N===F.length-1,ve=F.slice(0,N+1).join("/");let H=W.find(G=>G.name===L&&G.isDirectory===!z);H||(H={name:L,fullPath:ve,isDirectory:!z,children:[],file:z?Z:void 0},W.push(H)),z||(W=H.children)}}return h(I),I}function h(j){for(const I of j)if(I.isDirectory)for(h(I.children);I.children.length===1&&I.children[0].isDirectory;){const Z=I.children[0];I.name=`${I.name}/${Z.name}`,I.fullPath=Z.fullPath,I.children=Z.children}}function d(j){return[...j].sort((I,Z)=>I.isDirectory&&!Z.isDirectory?-1:!I.isDirectory&&Z.isDirectory?1:I.name.localeCompare(Z.name))}function m(j,I,Z){const F=[];for(const W of d(j)){const N=Z.size===0?!0:Z.has(W.fullPath);F.push({key:W.fullPath,depth:I,isDirectory:W.isDirectory,name:W.name,fullPath:W.fullPath,expanded:W.isDirectory?N:!1,file:W.file}),W.isDirectory&&N&&F.push(...m(W.children,I+1,Z))}return F}const g=K(()=>!t.files||t.files.length===0?[]:u(t.files)),O=K(()=>m(g.value,0,o.value));function b(j){o.value.has(j)?o.value.delete(j):o.value.add(j),o.value=new Set(o.value)}function x(){const j=I=>{const Z=[];for(const F of I)F.isDirectory&&(Z.push(F.fullPath),Z.push(...j(F.children)));return Z};o.value=new Set(j(g.value))}function w(){o.value=new Set}Ve(i,j=>{j==="tree"&&x()});function S(j){return new Date(j*1e3).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}function C(j){return Ws[j]||{label:j,colorClass:"text-retro-muted"}}const M=K(()=>{if(!t.stats)return{addPct:0,delPct:0};const j=t.stats.additions+t.stats.deletions;return j===0?{addPct:50,delPct:50}:{addPct:Math.round(t.stats.additions/j*100),delPct:Math.round(t.stats.deletions/j*100)}});function X(j){j.key==="ArrowUp"?(j.preventDefault(),n("navigatePrev")):j.key==="ArrowDown"?(j.preventDefault(),n("navigateNext")):j.key==="Escape"&&(j.preventDefault(),n("close"))}pt(()=>{Xt(()=>{s.value?.focus()})}),Ve(()=>t.commit.hash,()=>{Xt(()=>{s.value?.focus()})});function V(){n("close")}function se(j){n("navigateToCommit",j)}function le(){n("togglePosition")}function ue(j){n("openFileDiff",j)}return(j,I)=>(v(),y("section",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:X,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"},[f("div",Ub,[f("div",Gb,[f("span",Hb,_(r.commit.shortHash),1),f("span",Kb,_(r.commit.message.split(`
|
|
5
5
|
`)[0]),1)]),f("div",Jb,[f("button",{onClick:le,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":r.detailPosition==="inline"?"Dock detail to bottom":"Show detail inline",title:r.detailPosition==="inline"?"Dock to bottom":"Show inline"},[r.detailPosition==="inline"?(v(),pe(p(Um),{key:0,class:"w-4 h-4 text-retro-muted hover:text-retro-text"})):(v(),pe(p(Fm),{key:1,class:"w-4 h-4 text-retro-muted hover:text-retro-text"}))],8,ex),f("button",{onClick:V,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"},[J(p(wt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])])]),f("div",tx,[f("div",rx,[f("div",nx,[I[2]||(I[2]=f("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Hash:",-1)),f("code",sx,_(r.commit.hash),1)]),f("div",ix,[J(p(Xh),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),f("span",ox,_(r.commit.author),1),f("span",ax,"<"+_(r.commit.email)+">",1)]),a.value?(v(),y("div",lx,[J(p(Xh),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),I[3]||(I[3]=f("span",{class:"text-retro-muted text-xs uppercase mr-1"},"Committer:",-1)),f("span",cx,_(r.committer),1),f("span",ux,"<"+_(r.committerEmail)+">",1)])):U("",!0),f("div",hx,[J(p(E1),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),f("span",dx,_(S(r.commit.timestamp)),1)]),r.commit.parents?.length>0?(v(),y("div",fx,[I[4]||(I[4]=f("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Parents:",-1)),f("div",mx,[(v(!0),y(ke,null,Ne(r.commit.parents,Z=>(v(),y("button",{key:Z,onClick:F=>se(Z),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 ${Z.substring(0,7)}`},_(Z.substring(0,7)),9,px))),128))])])):U("",!0),r.commit.branches?.length>0?(v(),y("div",gx,[I[5]||(I[5]=f("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Branches:",-1)),f("div",Ox,[(v(!0),y(ke,null,Ne(r.commit.branches,Z=>(v(),y("span",{key:Z,class:"text-retro-green font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},_(Z),1))),128))])])):U("",!0),r.commit.tags?.length>0?(v(),y("div",vx,[I[6]||(I[6]=f("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Tags:",-1)),f("div",bx,[(v(!0),y(ke,null,Ne(r.commit.tags,Z=>(v(),y("span",{key:Z,class:"text-retro-yellow font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},_(Z),1))),128))])])):U("",!0)]),f("div",xx,[I[7]||(I[7]=f("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Message ",-1)),f("div",yx,_(r.commit.message.split(`
|
|
6
6
|
`)[0]),1)]),r.commit.body?(v(),y("div",kx,[I[8]||(I[8]=f("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Body ",-1)),f("div",{class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded commit-body-rendered",innerHTML:l.value},null,8,wx)])):U("",!0),r.stats?(v(),y("div",Sx,[f("div",$x,[f("span",Cx,_(c.value),1)]),r.stats.additions>0||r.stats.deletions>0?(v(),y("div",Qx,[f("span",Px,"+"+_(r.stats.additions),1),f("div",Tx,[f("div",{class:"bg-retro-green h-full transition-all",style:er({width:M.value.addPct+"%"})},null,4),f("div",{class:"bg-retro-red h-full transition-all",style:er({width:M.value.delPct+"%"})},null,4)]),f("span",Mx,"-"+_(r.stats.deletions),1)])):U("",!0)])):U("",!0),r.files?(v(),y("div",Ax,[f("div",_x,[f("h4",Rx," Files Changed ("+_(r.files.length)+") ",1),f("div",Bx,[f("button",{onClick:I[0]||(I[0]=Z=>i.value="flat"),class:Re(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",i.value==="flat"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Flat file list",title:"Flat file list"},[J(p(ep),{class:"w-4 h-4"})],2),f("button",{onClick:I[1]||(I[1]=Z=>i.value="tree"),class:Re(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",i.value==="tree"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Tree file view",title:"Tree file view"},[J(p(Ih),{class:"w-4 h-4"})],2)])]),r.files.length===0?(v(),y("div",Zx," No files changed in this commit. ")):i.value==="flat"?(v(),y("ul",Ex,[(v(!0),y(ke,null,Ne(r.files,Z=>(v(),y("li",{key:Z.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group cursor-pointer",onClick:F=>ue(Z)},[f("span",{class:Re(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",C(Z.status).colorClass]),title:C(Z.status).label},_(Z.status),11,Lx),J(p(Ns),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),f("span",Xx,[Z.status==="R"&&Z.oldPath?(v(),y(ke,{key:0},[f("span",Ix,_(Z.oldPath),1),I[9]||(I[9]=f("span",{class:"text-retro-yellow mx-1"},"→",-1)),f("span",Vx,_(Z.path),1)],64)):(v(),y(ke,{key:1},[Xe(_(Z.path),1)],64))]),!Z.binary&&(Z.additions>0||Z.deletions>0)?(v(),y("span",zx,[Z.additions>0?(v(),y("span",Nx,"+"+_(Z.additions),1)):U("",!0),Z.deletions>0?(v(),y("span",Wx,"-"+_(Z.deletions),1)):U("",!0)])):Z.binary?(v(),y("span",qx,"binary")):U("",!0)],8,Dx))),128))])):(v(),y("div",jx,[f("div",{class:"flex items-center gap-2 mb-1"},[f("button",{onClick:x,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Expand all "),I[10]||(I[10]=f("span",{class:"text-retro-muted text-xs"},"|",-1)),f("button",{onClick:w,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Collapse all ")]),(v(!0),y(ke,null,Ne(O.value,Z=>(v(),y("div",{key:Z.key,class:Re(["flex items-center gap-1 py-0.5 px-1 hover:bg-retro-panel rounded text-sm cursor-pointer",{"select-none":Z.isDirectory}]),style:er({paddingLeft:Z.depth*16+4+"px"}),onClick:F=>Z.isDirectory?b(Z.fullPath):Z.file?ue(Z.file):void 0},[Z.isDirectory?(v(),y(ke,{key:0},[J(p(D1),{class:Re(["w-3 h-3 text-retro-muted transition-transform flex-shrink-0",{"rotate-90":Z.expanded}])},null,8,["class"]),J(p(Ih),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),f("span",Fx,_(Z.name),1)],64)):Z.file?(v(),y(ke,{key:1},[f("span",{class:Re(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",C(Z.file.status).colorClass]),title:C(Z.file.status).label},_(Z.file.status),11,Ux),J(p(Ns),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),f("span",Gx,[Z.file.status==="R"&&Z.file.oldPath?(v(),y(ke,{key:0},[f("span",Hx,_(Z.file.oldPath.split("/").pop()),1),I[11]||(I[11]=f("span",{class:"text-retro-yellow mx-1"},"→",-1)),f("span",Kx,_(Z.name),1)],64)):(v(),y(ke,{key:1},[Xe(_(Z.name),1)],64))]),!Z.file.binary&&(Z.file.additions>0||Z.file.deletions>0)?(v(),y("span",Jx,[Z.file.additions>0?(v(),y("span",ey,"+"+_(Z.file.additions),1)):U("",!0),Z.file.deletions>0?(v(),y("span",ty,"-"+_(Z.file.deletions),1)):U("",!0)])):Z.file.binary?(v(),y("span",ry,"binary")):U("",!0)],64)):U("",!0)],14,Yx))),128))]))])):r.loading?(v(),y("div",ny,[...I[12]||(I[12]=[f("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Xe(" Loading file changes... ",-1)])])):(v(),y("div",sy," Failed to load file changes. "))])],544))}}),oy=Os(iy,[["__scopeId","data-v-29f450ea"]]),ay={class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark","aria-label":"Uncommitted changes details"},ly={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},cy={class:"flex items-center gap-2 min-w-0"},uy={class:"text-retro-muted text-sm"},hy={key:0,class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin",title:"Staging..."},dy={class:"flex-1 overflow-auto p-4 space-y-3"},fy={class:"space-y-2"},my=["disabled"],py={class:"space-y-1"},gy={class:"flex items-center justify-between"},Oy={class:"text-retro-green text-xs uppercase tracking-wide font-semibold"},vy={key:0,class:"text-retro-muted text-xs py-1"},by={key:1,class:"space-y-0.5"},xy=["aria-label","onClick"],yy={class:"text-retro-text font-mono text-xs truncate"},ky={class:"space-y-1"},wy={class:"flex items-center justify-between"},Sy={class:"text-retro-yellow text-xs uppercase tracking-wide font-semibold"},$y={key:0,class:"text-retro-muted text-xs py-1"},Cy={key:1,class:"space-y-0.5"},Qy=["aria-label","onClick"],Py={class:"text-retro-text font-mono text-xs truncate"},Ty=Ie({__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(r,{emit:e}){const t=r,n=e,s=Q(""),i=Q(!1),o=K(()=>s.value.trim().length>0&&t.stagedFiles.length>0&&!i.value&&!t.isCommitting);function a(O){return Ws[O]||{label:O,colorClass:"text-retro-muted"}}function l(){n("close")}function c(O){n("stageFiles",[O.path])}function u(O){n("unstageFiles",[O.path])}function h(){n("stageAll")}function d(){n("unstageAll")}async function m(){o.value&&(i.value=!0,n("commit",s.value.trim()),s.value="",i.value=!1)}function g(O){(O.metaKey||O.ctrlKey)&&O.key==="Enter"&&(O.preventDefault(),m())}return(O,b)=>(v(),y("section",ay,[f("div",ly,[f("div",cy,[J(p(po),{class:"w-4 h-4 text-retro-yellow"}),b[1]||(b[1]=f("span",{class:"text-retro-yellow font-semibold text-sm"},"Uncommitted Changes",-1)),f("span",uy,"("+_(r.stagedFiles.length+r.unstagedFiles.length)+" files)",1),t.isStaging?(v(),y("div",hy)):U("",!0)]),f("button",{onClick:l,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"},[J(p(wt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])]),f("div",dy,[f("div",fy,[je(f("textarea",{"onUpdate:modelValue":b[0]||(b[0]=x=>et(s)?s.value=x: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:g},null,544),[[_t,p(s)]]),f("button",{disabled:!p(o),class:Re(["w-full px-3 py-1.5 text-sm font-semibold rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",p(o)?"bg-retro-green text-retro-dark hover:bg-retro-green/90":"bg-retro-green/30 text-retro-dark"]),onClick:m},_(p(i)||t.isCommitting?"Committing...":`Commit (${r.stagedFiles.length} staged)`),11,my)]),f("div",py,[f("div",gy,[f("h4",Oy," Staged Changes ("+_(r.stagedFiles.length)+") ",1),r.stagedFiles.length>0?(v(),y("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:d}," Unstage All ")):U("",!0)]),r.stagedFiles.length===0?(v(),y("div",vy," No staged files. Stage files below to commit. ")):(v(),y("ul",by,[(v(!0),y(ke,null,Ne(r.stagedFiles,x=>(v(),y("li",{key:"staged-"+x.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[f("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 ${x.path}`,onClick:w=>u(x)},[J(p(kv),{class:"w-3.5 h-3.5 text-retro-red"})],8,xy),f("span",{class:Re(["flex-shrink-0 w-4 text-center text-xs font-bold",a(x.status).colorClass])},_(x.status),3),J(p(Ns),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),f("span",yy,_(x.oldPath?`${x.oldPath} → ${x.path}`:x.path),1)]))),128))]))]),f("div",ky,[f("div",wy,[f("h4",Sy," Unstaged Changes ("+_(r.unstagedFiles.length)+") ",1),r.unstagedFiles.length>0?(v(),y("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:h}," Stage All ")):U("",!0)]),r.unstagedFiles.length===0?(v(),y("div",$y," No unstaged changes. ")):(v(),y("ul",Cy,[(v(!0),y(ke,null,Ne(r.unstagedFiles,x=>(v(),y("li",{key:"unstaged-"+x.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[f("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 ${x.path}`,onClick:w=>c(x)},[J(p(ul),{class:"w-3.5 h-3.5 text-retro-green"})],8,Qy),f("span",{class:Re(["flex-shrink-0 w-4 text-center text-xs font-bold",a(x.status).colorClass])},_(x.status),3),J(p(Ns),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),f("span",Py,_(x.oldPath?`${x.oldPath} → ${x.path}`:x.path),1)]))),128))]))])])]))}}),My=["aria-label"],Ay={key:0,class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border truncate font-mono"},_y={key:0,class:"my-1 border-t border-retro-border",role:"separator"},Ry=["aria-disabled","onClick","onMouseenter"],By={key:1,class:"w-4 h-4 flex-shrink-0"},Gh=220,Zy=36,Ey=9,Dy=29,cn=8,vo=Ie({__name:"GitContextMenu",props:{items:{},x:{},y:{},title:{}},emits:["close","action"],setup(r,{emit:e}){const t=r,n=e,s=Q(null),i=Q(-1),o=K(()=>t.items.map((m,g)=>({item:m,i:g})).filter(({item:m})=>!m.disabled).map(({i:m})=>m));let a=!1;function l(m){a&&s.value&&!s.value.contains(m.target)&&n("close")}pt(()=>{requestAnimationFrame(()=>{a=!0}),document.addEventListener("mousedown",l),document.addEventListener("contextmenu",l),Xt(()=>{s.value?.focus()})}),kt(()=>{a=!1,document.removeEventListener("mousedown",l),document.removeEventListener("contextmenu",l)});function c(m){const g=o.value;if(g.length===0)return;if(i.value===-1){i.value=m===1?g[0]:g[g.length-1];return}const O=g.indexOf(i.value);if(O===-1){i.value=m===1?g[0]:g[g.length-1];return}const b=O+m;b>=0&&b<g.length&&(i.value=g[b])}function u(m){switch(m.key){case"Escape":m.preventDefault(),n("close");break;case"ArrowDown":m.preventDefault(),c(1);break;case"ArrowUp":m.preventDefault(),c(-1);break;case"Enter":{m.preventDefault();const g=t.items[i.value];g&&!g.disabled&&(n("action",g.key),n("close"));break}}}function h(m){m.disabled||(n("action",m.key),n("close"))}const d=K(()=>{const m=t.title?Dy:0,g=t.items.filter(S=>S.separator).length,O=t.items.length*Zy+g*Ey+cn,b=m+O;let x=t.x,w=t.y;return typeof window<"u"&&(x+Gh>window.innerWidth-cn&&(x=window.innerWidth-Gh-cn),x<cn&&(x=cn),w+b>window.innerHeight-cn&&(w=window.innerHeight-b-cn),w<cn&&(w=cn)),{left:`${x}px`,top:`${w}px`}});return(m,g)=>(v(),pe(Pr,{to:"body"},[f("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:er(p(d)),role:"menu","aria-label":r.title??"Context menu",tabindex:"-1",onKeydown:u},[r.title?(v(),y("div",Ay,_(r.title),1)):U("",!0),(v(!0),y(ke,null,Ne(r.items,(O,b)=>(v(),y(ke,{key:O.key},[O.separator?(v(),y("div",_y)):U("",!0),f("button",{class:Re(["w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors focus:outline-none",[O.disabled?"text-retro-muted/50 cursor-not-allowed":O.danger?["text-retro-red hover:bg-retro-red/10 focus:bg-retro-red/10",p(i)===b?"bg-retro-red/10":""]:["text-retro-text hover:bg-retro-cyan/10 focus:bg-retro-cyan/10",p(i)===b?"bg-retro-cyan/10":""]]]),role:"menuitem","aria-disabled":O.disabled||void 0,tabindex:-1,onClick:x=>h(O),onMouseenter:x=>i.value=O.disabled?p(i):b,onMouseleave:g[0]||(g[0]=x=>i.value=-1)},[O.icon?(v(),pe(Vs(O.icon),{key:0,class:Re(["w-4 h-4 flex-shrink-0",O.disabled?"opacity-50":O.danger?"":"text-retro-muted"])},null,8,["class"])):(v(),y("span",By)),Xe(" "+_(O.label),1)],42,Ry)],64))),128))],44,My)]))}}),Ly=Ie({__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(r,{emit:e}){const t=r,n=e,s=K(()=>[{key:"checkout",label:"Checkout",icon:hs,disabled:t.isCurrentBranch},{key:"rename",label:"Rename",icon:L1,separator:!0},{key:"deleteBranch",label:"Delete",icon:gn,danger:!0,disabled:t.isCurrentBranch},{key:"merge",label:"Merge into Current",icon:Gm,separator:!0,disabled:t.isCurrentBranch},{key:"rebase",label:"Rebase Current Onto",icon:qm,disabled:t.isCurrentBranch},{key:"push",label:"Push",icon:jm,separator:!0},{key:"copyName",label:"Copy Branch Name",icon:zs,separator:!0}]),i=K(()=>[{key:"checkout",label:"Checkout",icon:hs},{key:"deleteBranch",label:"Delete Remote Branch",icon:gn,separator:!0,danger:!0},{key:"fetch",label:"Fetch",icon:Km,separator:!0},{key:"pull",label:"Pull into Current",icon:rv},{key:"copyName",label:"Copy Branch Name",icon:zs,separator:!0}]),o=K(()=>t.isLocal?s.value:i.value),a={checkout:()=>n("checkout"),createBranch:()=>n("createBranch"),deleteBranch:()=>n("deleteBranch"),rename:()=>n("rename"),merge:()=>n("merge"),rebase:()=>n("rebase"),push:()=>n("push"),pull:()=>n("pull"),fetch:()=>n("fetch"),copyName:()=>n("copyName")};function l(c){a[c]?.(),n("close")}return(c,u)=>{const h=vo;return v(),pe(h,{items:p(o),x:r.x,y:r.y,title:r.branchName,onAction:l,onClose:u[0]||(u[0]=d=>n("close"))},null,8,["items","x","y","title"])}}}),Xy=Ie({__name:"GitCommitMenu",props:{commit:{},x:{},y:{}},emits:["close","addTag","createBranch","checkout","cherryPick","revert","mergeInto","reset","copyHash","copySubject"],setup(r,{emit:e}){const t=e,n=K(()=>[{key:"addTag",label:"Add Tag",icon:Zu},{key:"createBranch",label:"Create Branch",icon:ul},{key:"checkout",label:"Checkout (detached HEAD)",icon:hs,separator:!0},{key:"cherryPick",label:"Cherry Pick",icon:fv},{key:"revert",label:"Revert",icon:Ym},{key:"mergeInto",label:"Merge into Current",icon:Gm,separator:!0},{key:"reset",label:"Reset Current Branch to Here",icon:qm,danger:!0},{key:"copyHash",label:"Copy Commit Hash",icon:zs,separator:!0},{key:"copySubject",label:"Copy Commit Subject",icon:zs}]),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 i(o){s[o]?.(),t("close")}return(o,a)=>{const l=vo;return v(),pe(l,{items:p(n),x:r.x,y:r.y,title:r.commit.shortHash,onAction:i,onClose:a[0]||(a[0]=c=>t("close"))},null,8,["items","x","y","title"])}}}),Iy=Ie({__name:"GitTagMenu",props:{tagName:{},x:{},y:{}},emits:["close","viewDetails","deleteTag","pushTag","copyName"],setup(r,{emit:e}){const t=e,n=[{key:"viewDetails",label:"View Details",icon:Zu},{key:"deleteTag",label:"Delete Tag",icon:gn,separator:!0,danger:!0},{key:"pushTag",label:"Push Tag",icon:jm},{key:"copyName",label:"Copy Tag Name",icon:zs,separator:!0}],s={viewDetails:()=>t("viewDetails"),deleteTag:()=>t("deleteTag"),pushTag:()=>t("pushTag"),copyName:()=>t("copyName")};function i(o){s[o]?.()}return(o,a)=>{const l=vo;return v(),pe(l,{items:n,x:r.x,y:r.y,title:r.tagName,onClose:a[0]||(a[0]=c=>t("close")),onAction:i},null,8,["x","y","title"])}}}),Vy=Ie({__name:"GitStashMenu",props:{stashIndex:{},stashMessage:{},x:{},y:{}},emits:["close","apply","pop","drop","createBranch","copyName","copyHash"],setup(r,{emit:e}){const t=e,n=[{key:"apply",label:"Apply Stash",icon:tv},{key:"pop",label:"Pop Stash",icon:Ym},{key:"createBranch",label:"Create Branch from Stash",icon:X1,separator:!0},{key:"drop",label:"Drop Stash",icon:gn,separator:!0,danger:!0},{key:"copyName",label:"Copy Stash Reference",icon:zs,separator:!0},{key:"copyHash",label:"Copy Stash Hash",icon:bv}],s={apply:()=>t("apply"),pop:()=>t("pop"),drop:()=>t("drop"),createBranch:()=>t("createBranch"),copyName:()=>t("copyName"),copyHash:()=>t("copyHash")};function i(o){s[o]?.()}return(o,a)=>{const l=vo;return v(),pe(l,{items:n,x:r.x,y:r.y,title:r.stashMessage,onClose:a[0]||(a[0]=c=>t("close")),onAction:i},null,8,["x","y","title"])}}}),zy=Ie({__name:"GitUncommittedMenu",props:{x:{},y:{}},emits:["close","stash","reset","clean"],setup(r,{emit:e}){const t=e,n=[{key:"stash",label:"Stash Uncommitted Changes",icon:ev},{key:"reset",label:"Reset Working Directory",icon:hs,separator:!0,danger:!0},{key:"clean",label:"Clean Untracked Files",icon:gn,danger:!0}],s={stash:()=>t("stash"),reset:()=>t("reset"),clean:()=>t("clean")};function i(o){s[o]?.()}return(o,a)=>{const l=vo;return v(),pe(l,{items:n,x:r.x,y:r.y,title:"Uncommitted Changes",onClose:a[0]||(a[0]=c=>t("close")),onAction:i},null,8,["x","y"])}}});async function Ny(r,e,t){try{return(await $fetch("/api/git/merge-base",{params:{workingDirectory:r,branch:e,baseBranch:t??void 0}})).mergeBase}catch{return null}}function Hh(r){const e={};for(const{branch:t,mergeBase:n}of r)t&&n&&(e[t]=n);return e}async function Wy(r){return $fetch("/api/git/file-diff",{query:r})}async function qy(r){return $fetch("/api/git/diff",{query:r})}const dl=Qu("gitGraph",()=>{const r=Q([]),e=Q([]),t=Q([]),n=Q(new Set),s=Q([]),i=Q([]),o=Q(0),a=Q(!1),l=Q(null),c=Q(null),u=Q(null),h=Q(!1),d=Q(null),m=Q(!1),g=Q(0),O=Q(""),b=Q([]),x=Q(null),w=Q(!1),S=Q(!1),C=Q(!1),M=Q(!1),X=8e3,V=Q(null);let se=null;function le(Y){V.value=Y,se&&clearTimeout(se),se=setTimeout(()=>{V.value=null},X)}function ue(){V.value=null,se&&(clearTimeout(se),se=null)}async function j(Y,ne,Le,Ft){if(!x.value)return{success:!1,error:"No working directory set"};try{const Ir=await $fetch(Y,{method:Ft?.method??"POST",body:{workingDirectory:x.value,...ne}});return(Ft?.reloadGraph??!0)&&await nr(x.value),{success:!0,data:Ir}}catch(Ir){const Vr=Eo(Ir,Le);return le(Vr),{success:!1,error:Vr}}}const I=Q(null),Z=Q(!1),F=Q(!1),W=Q(null),N=Q([]),L=Q([]),z=Q(null),ve=Q(null),H=Q(null),G=Q("inline"),te=Q("list"),ge=Q("rounded"),me=Q(!1),Se=Q({date:!0,author:!0,commit:!0}),Qe=Q(0),Ye=Q(0),P=Q(null),T=Q(null),E=Q(null),B=Q(null),be=Q(null),Ae=Q(null),Te=Q(null),ae=Q(null),re=Q(null),$e=Q(null),q=Q(null),Oe=Q(!1),Be=$b(),st=K(()=>{if(!O.value&&b.value.length===0)return r.value;let Y=r.value;if(O.value&&(Y=Be.filter(Y,O.value)),b.value.length>0){const ne=new Set(b.value);Y=Sb(Y,ne)}return Y}),zt=K(()=>e.value.find(Y=>Y.isHead)||null);async function nr(Y){x.value=Y,h.value=!0,d.value=null;try{const[ne,Le,Ft,Ir,Vr]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:Y}}),$fetch("/api/git/status",{query:{workingDirectory:Y}}),$fetch("/api/git/stash",{query:{workingDirectory:Y}}).then(Pn=>Pn.stashes).catch(()=>[]),$fetch("/api/git/remotes",{query:{workingDirectory:Y}}).then(Pn=>Pn.remotes).catch(()=>[]),$fetch("/api/git/state",{query:{workingDirectory:Y}}).then(Pn=>Pn.state).catch(()=>null)]);r.value=ne.commits,e.value=ne.branches,t.value=ne.tags,n.value=new Set(ne.localBranches??[]),m.value=ne.hasMore,g.value=ne.totalCount,s.value=Le.stagedFiles??[],i.value=Le.unstagedFiles??[],o.value=(Le.stagedCount??0)+(Le.unstagedCount??0),N.value=Ft,L.value=Ir,W.value=Vr,I.value=Date.now(),await ws()}catch(ne){const Le=ne instanceof Error?ne.message:"Failed to load git graph";d.value=Le,r.value=[],e.value=[],t.value=[],s.value=[],i.value=[],o.value=0,N.value=[],L.value=[]}finally{h.value=!1}}async function nn(){if(x.value)try{const Y=await $fetch("/api/git/status",{query:{workingDirectory:x.value}});s.value=Y.stagedFiles??[],i.value=Y.unstagedFiles??[],o.value=(Y.stagedCount??0)+(Y.unstagedCount??0)}catch(Y){console.error("Failed to refresh uncommitted changes:",Y)}}const vr=Q(!1);async function qn(){if(!(!x.value||!m.value||h.value||vr.value)){vr.value=!0;try{const Y=await $fetch("/api/git/log",{query:{workingDirectory:x.value,offset:r.value.length}});r.value=[...r.value,...Y.commits],m.value=Y.hasMore}catch(Y){console.error("Failed to load more commits:",Y)}finally{vr.value=!1}}}async function sn(Y){if(l.value=Y,c.value=null,u.value=null,a.value=!1,w.value=!0,!x.value){w.value=!1;return}try{const ne=await $fetch("/api/git/show",{query:{workingDirectory:x.value,hash:Y.hash}});c.value=ne.files,u.value=ne.stats}catch(ne){console.error("Failed to load commit details:",ne),c.value=[],u.value={additions:0,deletions:0,filesChanged:0},le("Failed to load commit details")}finally{w.value=!1}}function jn(){l.value=null,c.value=null,u.value=null,a.value=!1}function on(){l.value=null,u.value=null,c.value=null,a.value=!0}function kn(Y){O.value=Y,Qe.value=0,Nt()}const Zt=K(()=>O.value?sp(r.value,O.value).map(Y=>Y.hash):[]);function Nt(){Ye.value=Zt.value.length}function ce(){Zt.value.length!==0&&(Qe.value=(Qe.value+1)%Zt.value.length,Nt(),_e())}function xe(){Zt.value.length!==0&&(Qe.value=Qe.value<=0?Zt.value.length-1:Qe.value-1,Nt(),_e())}function _e(){const Y=Zt.value[Qe.value];if(Y){const ne=r.value.find(Le=>Le.hash===Y);ne&&sn(ne)}}function qe(Y){const ne=b.value.indexOf(Y);ne===-1?b.value.push(Y):b.value.splice(ne,1)}function Fe(){O.value="",b.value=[]}async function $t(Y){if(!x.value)return{success:!1,error:"No working directory set"};M.value=!0;try{const ne=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:x.value,branchName:Y}});return ne.success&&await nr(x.value),{success:ne.success,error:ne.error}}catch(ne){const Le=ne instanceof Error?ne.message:"Failed to checkout branch";return le(Le),{success:!1,error:Le}}finally{M.value=!1}}async function it(Y,ne){if(!x.value)return{success:!1,error:"No working directory set"};try{const Le=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:x.value,branchName:Y,createBranch:!0,fromCommit:ne}});return Le.success&&await nr(x.value),{success:Le.success,error:Le.error}}catch(Le){return{success:!1,error:Le instanceof Error?Le.message:"Failed to create branch"}}}async function Yt(Y,ne=!1){return j("/api/git/branch",{branchName:Y,force:ne},"Failed to delete branch",{method:"DELETE"})}async function sr(Y){return j("/api/git/branch",{branchName:Y,remote:!0},"Failed to delete remote branch",{method:"DELETE"})}async function br(Y){if(!x.value)return{success:!1,error:"No working directory set"};S.value=!0;try{return await $fetch("/api/git/stage",{method:"POST",body:{workingDirectory:x.value,files:Y}}),await nn(),{success:!0}}catch(ne){const Le=ne instanceof Error?ne.message:"Failed to stage files";return le(Le),{success:!1,error:Le}}finally{S.value=!1}}async function Yn(Y){if(!x.value)return{success:!1,error:"No working directory set"};S.value=!0;try{return await $fetch("/api/git/unstage",{method:"POST",body:{workingDirectory:x.value,files:Y}}),await nn(),{success:!0}}catch(ne){const Le=ne instanceof Error?ne.message:"Failed to unstage files";return le(Le),{success:!1,error:Le}}finally{S.value=!1}}async function Lr(Y){if(!x.value)return{success:!1,error:"No working directory set"};C.value=!0;try{return await $fetch("/api/git/commit",{method:"POST",body:{workingDirectory:x.value,message:Y}}),await nr(x.value),{success:!0}}catch(ne){const Le=ne instanceof Error?ne.message:"Failed to commit changes";return le(Le),{success:!1,error:Le}}finally{C.value=!1}}async function ai(Y,ne){return j("/api/git/branch-rename",{oldName:Y,newName:ne},"Failed to rename branch")}async function li(Y,ne){return j("/api/git/merge",{branch:Y,...ne},"Failed to merge branch")}async function ci(Y){return j("/api/git/rebase",{onto:Y},"Failed to rebase branch")}async function ui(Y,ne,Le,Ft){return j("/api/git/push",{branch:Y,remote:ne,force:Le,forceWithLease:Ft},"Failed to push branch")}async function hi(Y,ne,Le,Ft){return j("/api/git/pull",{branch:Y,remote:ne,noFastForward:Le,squash:Ft},"Failed to pull branch")}async function di(Y,ne,Le){return j("/api/git/fetch",{branch:Y,remote:ne,...Le},"Failed to fetch")}async function fi(Y,ne,Le){return j("/api/git/cherry-pick",{hash:Y,recordOrigin:ne,noCommit:Le},"Failed to cherry-pick commit")}async function mi(Y){return j("/api/git/revert",{hash:Y},"Failed to revert commit")}async function pi(Y,ne){return j("/api/git/reset",{hash:Y,mode:ne},"Failed to reset to commit")}async function gi(Y){if(!x.value)return{success:!1,error:"No working directory set"};try{return await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:x.value,branchName:Y}}),await nr(x.value),{success:!0}}catch(ne){const Le=ne?.data?.message||ne?.statusMessage||ne?.message||"Failed to checkout commit";return le(Le),{success:!1,error:Le}}}async function Et(Y){const ne=Y.message.split(`
|
|
7
7
|
`)[0];return Fn(ne)}async function ir(Y,ne,Le,Ft,Ir){return j("/api/git/tag",{name:Y,hash:ne,annotated:Le,message:Ft,pushToRemote:Ir},"Failed to create tag")}async function vs(Y,ne){return j("/api/git/tag",{name:Y,deleteFromRemote:ne},"Failed to delete tag",{method:"DELETE"})}async function wn(Y,ne){return j("/api/git/tag-push",{name:Y,remote:ne},"Failed to push tag")}async function Sn(Y){if(!x.value)return{success:!1,error:"No working directory set"};try{return{success:!0,data:await $fetch(`/api/git/tag/${encodeURIComponent(Y)}`,{query:{workingDirectory:x.value}})}}catch(ne){const Le=Eo(ne,"Failed to get tag detail");return le(Le),{success:!1,error:Le}}}async function bs(Y){return Fn(Y)}async function $n(){if(!x.value)return{success:!1,error:"No working directory set"};try{const Y=await $fetch("/api/git/stash",{query:{workingDirectory:x.value}});return N.value=Y.stashes,{success:!0}}catch(Y){const ne=Eo(Y,"Failed to load stashes");return le(ne),{success:!1,error:ne}}}async function an(Y,ne){return j("/api/git/stash-apply",{index:Y,reinstateIndex:ne},"Failed to apply stash")}async function Oi(Y,ne){return j("/api/git/stash-pop",{index:Y,reinstateIndex:ne},"Failed to pop stash")}async function xs(Y){return j("/api/git/stash-drop",{index:Y},"Failed to drop stash")}async function Cn(Y,ne){return j("/api/git/stash-branch",{index:Y,branchName:ne},"Failed to create branch from stash")}async function gt(Y,ne){return j("/api/git/stash",{message:Y,includeUntracked:ne},"Failed to stash changes")}async function xr(){if(!x.value)return{success:!1,error:"No working directory set"};try{const Y=await $fetch("/api/git/remotes",{query:{workingDirectory:x.value}});return L.value=Y.remotes,{success:!0}}catch(Y){const ne=Eo(Y,"Failed to load remotes");return le(ne),{success:!1,error:ne}}}async function ys(Y,ne){return j("/api/git/remote",{name:Y,url:ne},"Failed to add remote")}async function vi(Y,ne){return j("/api/git/remote",{name:Y,newUrl:ne},"Failed to edit remote",{method:"PUT"})}async function Qn(Y){return j("/api/git/remote",{name:Y},"Failed to delete remote",{method:"DELETE"})}async function bi(Y,ne){return j("/api/git/fetch",{all:!0,prune:Y,pruneTags:ne},"Failed to fetch all")}function ks(){G.value=G.value==="inline"?"bottom":"inline"}function yr(){te.value=te.value==="list"?"tree":"list"}function or(Y){ge.value=Y}function xi(){me.value=!me.value}function yi(Y){Se.value={...Se.value,[Y]:!Se.value[Y]}}async function Xr(Y,ne,Le){if(!ne||!x.value){Y.value=null;return}Y.value=await Ny(x.value,ne,Le)}async function ki(Y){P.value=Y,await Xr(T,Y)}async function ln(Y,ne){E.value=Y,be.value=ne??null,await Xr(B,Y,ne)}async function wi(Y,ne){Ae.value=Y,ae.value=ne??null,await Xr(Te,Y,ne)}async function ws(){x.value&&await Promise.all([Xr(T,P.value),Xr(B,E.value,be.value),Xr(Te,Ae.value,ae.value)])}function Ze(Y){const ne=r.value.find(Le=>Le.hash===Y||Le.shortHash===Y);ne&&sn(ne)}async function k(Y){return j("/api/git/reset",{hash:"HEAD",mode:Y},"Failed to reset working directory")}async function R(){return j("/api/git/clean",{},"Failed to clean untracked files")}function A(Y){ve.value=Y}function D(){ve.value=null}function oe(Y){H.value=Y}function he(){H.value=null}const ie=Q(null),de=Q(null),He=Q(!1),ot=K(()=>!!z.value&&!!l.value);function Wt(Y){z.value=Y,Y&&l.value&&Ue()}function _o(){z.value=null,ie.value=null,de.value=null,He.value=!1}async function Ue(){if(!(!x.value||!l.value||!z.value)){He.value=!0;try{const Y=await qy({workingDirectory:x.value,from:z.value.hash,to:l.value.hash});ie.value=Y.files,de.value=Y.stats}catch(Y){console.error("Failed to load comparison:",Y),le("Failed to load commit comparison"),ie.value=null,de.value=null}finally{He.value=!1}}}async function Fn(Y){try{return await I1(Y),{success:!0}}catch(ne){const Le=ne?.message||"Failed to copy to clipboard";return le(Le),{success:!1,error:Le}}}async function Ss(Y,ne){re.value=ne,$e.value=Y,q.value=null,Oe.value=!0,await y1()}function Dh(){re.value=null,$e.value=null,q.value=null,Oe.value=!1}async function y1(){if(!x.value||!$e.value||!re.value){Oe.value=!1;return}Oe.value=!0;try{q.value=await Wy({workingDirectory:x.value,commitHash:$e.value,filePath:re.value.path})}catch(Y){console.error("Failed to load file diff:",Y),le("Failed to load file diff"),q.value=null}finally{Oe.value=!1}}function k1(){r.value=[],e.value=[],t.value=[],n.value=new Set,s.value=[],i.value=[],o.value=0,a.value=!1,l.value=null,c.value=null,u.value=null,h.value=!1,d.value=null,m.value=!1,g.value=0,O.value="",b.value=[],x.value=null,I.value=null,Z.value=!1,F.value=!1,W.value=null,vr.value=!1,w.value=!1,S.value=!1,C.value=!1,M.value=!1,N.value=[],L.value=[],z.value=null,ie.value=null,de.value=null,He.value=!1,ve.value=null,H.value=null,G.value="inline",te.value="list",ge.value="rounded",me.value=!1,Se.value={date:!0,author:!0,commit:!0},Qe.value=0,Ye.value=0,P.value=null,E.value=null,B.value=null,be.value=null,Ae.value=null,Te.value=null,ae.value=null,re.value=null,$e.value=null,q.value=null,Oe.value=!1,ue(),Be.clear()}async function w1(){if(!x.value||F.value||h.value)return!1;F.value=!0;try{const Y=(await $fetch("/api/git/state",{query:{workingDirectory:x.value}})).state,ne=W.value;if(W.value=Y,I.value=Date.now(),!ne)return!1;const Le=ne.headCommit!==Y.headCommit||ne.branchListHash!==Y.branchListHash,Ft=ne.workingTreeHash!==Y.workingTreeHash,Ir=ne.stashListHash!==Y.stashListHash;if(Le){const[Tn,Ro,C1]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:x.value}}),$fetch("/api/git/status",{query:{workingDirectory:x.value}}),$fetch("/api/git/stash",{query:{workingDirectory:x.value}}).then(Q1=>Q1.stashes).catch(()=>[])]);return r.value=Tn.commits,e.value=Tn.branches,t.value=Tn.tags,n.value=new Set(Tn.localBranches??[]),m.value=Tn.hasMore,g.value=Tn.totalCount,s.value=Ro.stagedFiles??[],i.value=Ro.unstagedFiles??[],o.value=(Ro.stagedCount??0)+(Ro.unstagedCount??0),N.value=C1,await ws(),!0}if(!Ft&&!Ir)return!1;const[Vr,Pn]=await Promise.all([Ft?$fetch("/api/git/status",{query:{workingDirectory:x.value}}):Promise.resolve(null),Ir?$fetch("/api/git/stash",{query:{workingDirectory:x.value}}).then(Tn=>Tn.stashes).catch(()=>[]):Promise.resolve(null)]);return Vr&&(s.value=Vr.stagedFiles??[],i.value=Vr.unstagedFiles??[],o.value=(Vr.stagedCount??0)+(Vr.unstagedCount??0)),Pn&&(N.value=Pn),!0}catch(Y){return console.error("Failed to refresh git graph:",Y),!1}finally{F.value=!1}}function S1(){Z.value=!0}function $1(){Z.value=!1}return{commits:Me(r),branches:Me(e),tags:Me(t),localBranchNames:Me(n),stagedFiles:Me(s),unstagedFiles:Me(i),uncommittedChangesCount:Me(o),isUncommittedChangesSelected:Me(a),selectedCommit:Me(l),selectedCommitFiles:Me(c),selectedCommitStats:Me(u),loading:Me(h),loadingMore:Me(vr),error:Me(d),hasMore:Me(m),totalCount:Me(g),searchQuery:Me(O),filteredBranches:Me(b),workingDirectory:Me(x),stashes:Me(N),remotes:Me(L),comparisonCommit:Me(z),comparisonFiles:Me(ie),comparisonStats:Me(de),comparisonLoading:Me(He),isComparing:ot,activeDialog:Me(ve),activeContextMenu:Me(H),detailViewPosition:Me(G),fileViewMode:Me(te),graphStyle:Me(ge),muteNonAncestral:Me(me),columnVisibility:Me(Se),searchResultIndex:Me(Qe),searchResultCount:Me(Ye),selectedFeatureId:Me(P),featureMergeBase:Me(T),conversationBranch:Me(E),conversationMergeBase:Me(B),conversationBaseBranch:Me(be),previewBranch:Me(Ae),previewMergeBase:Me(Te),previewBaseBranch:Me(ae),diffViewerFile:Me(re),diffViewerCommitHash:Me($e),diffViewerContent:Me(q),diffViewerLoading:Me(Oe),lastRefreshTime:Me(I),isPollingActive:Me(Z),isRefreshing:Me(F),isLoadingDetails:Me(w),isStaging:Me(S),isCommitting:Me(C),isCheckingOut:Me(M),operationError:Me(V),filteredCommits:st,currentBranch:zt,searchResultHashes:Zt,loadGitGraph:nr,loadMoreCommits:qn,refreshUncommittedChanges:nn,selectCommit:sn,selectUncommittedChanges:on,clearSelection:jn,setSearchQuery:kn,toggleBranchFilter:qe,clearFilters:Fe,nextSearchResult:ce,prevSearchResult:xe,checkoutBranch:$t,createBranch:it,deleteLocalBranch:Yt,deleteRemoteBranch:sr,stageFiles:br,unstageFiles:Yn,commitChanges:Lr,reset:k1,clearOperationError:ue,renameBranch:ai,mergeBranch:li,rebaseBranch:ci,pushBranch:ui,pullBranch:hi,fetchBranch:di,cherryPickCommit:fi,revertCommit:mi,resetToCommit:pi,checkoutCommit:gi,copyCommitSubject:Et,createTag:ir,deleteTag:vs,pushTag:wn,getTagDetail:Sn,copyTagName:bs,loadStashes:$n,applyStash:an,popStash:Oi,dropStash:xs,stashBranch:Cn,stashChanges:gt,loadRemotes:xr,addRemote:ys,editRemote:vi,deleteRemote:Qn,fetchAll:bi,setActiveDialog:A,clearActiveDialog:D,setActiveContextMenu:oe,clearActiveContextMenu:he,selectComparisonCommit:Wt,clearComparison:_o,loadComparisonData:Ue,copyToClipboard:Fn,toggleDetailViewPosition:ks,toggleFileViewMode:yr,setGraphStyle:or,toggleMuteNonAncestral:xi,toggleColumnVisibility:yi,navigateToCommit:Ze,resetWorking:k,cleanUntracked:R,setSelectedFeatureId:ki,setConversationBranch:ln,setPreviewBranch:wi,openFileDiff:Ss,closeFileDiff:Dh,checkAndRefresh:w1,startPolling:S1,stopPolling:$1}});async function Kh(){if(typeof window>"u")return{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};try{const r=await $fetch("/api/conversations");if(!r||!Array.isArray(r.conversations))return console.warn("[conversationStorage] Invalid data structure from server"),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};r.version!==Qa&&console.warn(`[conversationStorage] Storage version mismatch: ${r.version} vs ${Qa}`);const e=r.conversations.map(l=>{if(!l||typeof l!="object")return l;const c=l;return"claudeSessionId"in c&&!("providerSessionId"in c)?{...c,providerSessionId:c.claudeSessionId}:l}),n=(Array.isArray(r.archivedConversations)?r.archivedConversations:[]).map(l=>{if(!l||typeof l!="object")return l;const c=l;return"claudeSessionId"in c&&!("providerSessionId"in c)?{...c,providerSessionId:c.claudeSessionId}:l}),s=e.filter(Y1),i=n.filter(F1),o=e.length-s.length,a=n.length-i.length;return o>0&&console.warn(`[conversationStorage] Discarded ${o} corrupted active conversation(s)`),a>0&&console.warn(`[conversationStorage] Discarded ${a} corrupted archive conversation(s)`),{conversations:s,archivedConversations:i,discardedConversations:o,discardedArchives:a}}catch(r){return console.error("[conversationStorage] Failed to load conversations:",r),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0}}}async function jy(r,e=[]){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations",{method:"POST",body:{version:Qa,conversations:r,archivedConversations:e}}),!0}catch(t){return console.error("Failed to save conversations:",t),!1}}async function Yy(r){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations/update",{method:"POST",body:{version:Qa,conversation:r}}),!0}catch(e){return console.error("Failed to save conversation:",e),!1}}function Fy(r){return r?r.map(e=>{switch(e.type){case"text":return e.text;case"tool_use":return`[${e.name}] ${e.inputSummary}`;case"tool_result":return e.isError?`Error: ${e.content.slice(0,100)}`:"";case"thinking":case"result_summary":case"session_init":return"";default:return""}}).filter(Boolean).join(`
|
|
8
|
-
`):""}function Do(r){r.contentBlocks&&(r.content=Fy(r.contentBlocks))}function Uy(r,e){if(r.type!==e.type)return!0;switch(e.type){case"text":return r.text!==e.text;case"tool_use":{const t=r;return t.name!==e.name||t.inputSummary!==e.inputSummary}case"tool_result":{const t=r;return t.content!==e.content||t.isError!==e.isError}default:return!1}}function Gy(r,e,t="info",n,s=Date.now,i=Math.random){return{id:`conflict-msg-${s()}-${i().toString(36).slice(2,7)}`,role:r,content:e,timestamp:s(),type:t,fileRef:n}}function Hy(r,e){return e===0?{message:`All ${r} file${r===1?"":"s"} resolved successfully. Click "Continue Rebase" to proceed.`,succeeded:!0}:{message:`Resolution complete: ${r} succeeded, ${e} failed. You can retry or abort.`,succeeded:!1}}function Ky(r,e){const t=[];for(let n=0;n<r.length;n+=e)t.push(r.slice(n,n+e));return t}function Jy(r,e){return r.filter(t=>!e.has(t.path))}function ek(r){return`Detected ${r} conflicted file${r===1?"":"s"}. Enter optional guidance below and click "Resolve Conflicts Automatically" to start.`}function tk(r){return`Starting AI resolution for ${r} file${r===1?"":"s"} (parallel)...`}async function rk(r){return $fetch("/api/chat/preview",{method:"POST",body:r})}async function nk(r){return $fetch("/api/chat/preview",{method:"DELETE",body:r})}function sk(r,e){return r===e?{kind:"end-current",id:e}:r?{kind:"swap",endId:r,startId:e}:{kind:"start",id:e}}function ik(r){const e=new Map,t=r.setTimer??setTimeout,n=r.clearTimer??clearTimeout;function s(l){if(e.has(l))return;const c=t(()=>{e.delete(l),r.onFlush(l)},r.delayMs);e.set(l,c)}function i(l){const c=e.get(l);c&&(n(c),e.delete(l)),r.onFlush(l)}function o(l){const c=e.get(l);c&&(n(c),e.delete(l))}function a(){for(const l of e.values())n(l);e.clear()}return{schedule:s,flush:i,cancel:o,cancelAll:a,hasPending:l=>e.has(l),pendingCount:()=>e.size}}async function ok(r){return $fetch("/api/chat/finalize",{method:"POST",body:r})}async function ak(r){return $fetch("/api/chat/rebase",{method:"POST",body:r})}async function lk(r){return $fetch("/api/rebase/conflicts",{params:{worktreePath:r}})}async function ck(r){return $fetch("/api/rebase/resolve",{method:"PUT",body:r})}async function uk(r){const e=r.mode==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue",{mode:t,...n}=r;return $fetch(e,{method:"POST",body:n})}async function Jh(r){return $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:r}})}async function hk(r){return $fetch("/api/rebase/ai-resolve",{method:"POST",body:r})}const gr=Qu("chat",()=>{const r=Q(!1),e=Q(U1),t=Q("ask"),n=Q(""),s=Q([]),i=Q([]),o=Q(null),a=Q("active"),l=Q(new Set),c=new Map,u=Q(!1),h=Q(0),m=ik({delayMs:1200,onFlush:k=>{const R=s.value.find(A=>A.id===k);R&&(R.updatedAt=new Date().toISOString(),Yy(R))}}),g=Q(null),O=Q(null);let b=null;function x(k){return k?c.get(k)??null:null}function w(k){let R=c.get(k);return R||(R={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},c.set(k,R)),R}const S=K(()=>s.value.find(k=>k.id===o.value)||null),C=K(()=>S.value?.messages??[]),M=K(()=>(h.value,x(o.value)?.session??null)),X=K(()=>(h.value,x(o.value)?.pendingPermission??null)),V=K(()=>(h.value,x(o.value)?.pendingPlanApproval??null)),se=K(()=>(h.value,x(o.value)?.lastError??null)),le=K(()=>(h.value,x(o.value)?.debugEvents??[])),ue=K(()=>M.value?.status==="streaming"),j=K(()=>S.value?.providerSessionId??""),I=K(()=>C.value.length>0),Z=K(()=>C.value[C.value.length-1]||null);function F(k){return l.value.has(k)}const W=K(()=>o.value?l.value.has(o.value):!1),N=K(()=>s.value.length>0),L=K(()=>i.value.length>0),z=K(()=>s.value.length),ve=K(()=>z.value>=zh),H=K(()=>s.value),G=K(()=>i.value),te=K(()=>g.value&&s.value.find(k=>k.id===g.value)||null);function ge(k){return g.value===k}function me(k){a.value=k}async function Se(k){if(!(!k?.previewBranch||!k.worktreePath))try{await Tv({previewBranch:k.previewBranch,worktreePath:k.worktreePath})}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 Qe(k){if(F(k))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(A=>A.id===k)===-1)return{success:!1,error:"Conversation not found"};try{const A=await $fetch(`/api/conversations/${k}/archive`,{method:"POST"});return A.success&&A.archived?(m.cancel(k),c.delete(k),s.value=Array.isArray(A.conversations)?A.conversations:s.value.filter(D=>D.id!==k),i.value=Array.isArray(A.archivedConversations)?A.archivedConversations:[A.archived,...i.value],Sn(),g.value===k&&(g.value=null),o.value===k&&(o.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:o.value}}).catch(D=>{console.error("Failed to save active conversation:",D)}),{success:!0}):{success:!1,error:"Failed to archive conversation"}}catch(A){return{success:!1,error:A instanceof Error?A.message:"Failed to archive conversation"}}}async function Ye(k,R){if(ln().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${Nh}.`};if(!i.value.some(D=>D.id===k))return{success:!1,error:"Archived conversation not found"};try{const D=await $fetch(`/api/conversations/archives/${k}/restore`,{method:"POST",body:{baseBranch:R}});return D.success&&D.conversation?(s.value=Array.isArray(D.conversations)?D.conversations:[D.conversation,...s.value],Array.isArray(D.archivedConversations)?i.value=D.archivedConversations:i.value=i.value.filter(oe=>oe.id!==k),a.value="active",$n(D.conversation.id),wn(),Et(),{success:!0,conversationId:D.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(D){return{success:!1,error:D instanceof Error?D.message:"Failed to restore archived conversation"}}}async function P(k){const R=i.value.findIndex(A=>A.id===k);if(R===-1)return{success:!1,error:"Archived conversation not found"};try{return await $fetch(`/api/conversations/archives/${k}`,{method:"DELETE"}),i.value.splice(R,1),Sn(),{success:!0}}catch{return i.value.splice(R,1),Et(),{success:!0}}}async function T(){if(!(typeof window>"u"))try{const k=await $fetch("/api/settings");if(k){if(typeof k.panelWidth=="number"){const D=k.panelWidth;D>=Wh&&D<=qh&&(e.value=D)}typeof k.isPanelOpen=="boolean"&&(r.value=k.isPanelOpen),typeof k.activeConversationId=="string"&&(o.value=k.activeConversationId);const{useSettingsStore:R}=await ls(async()=>{const{useSettingsStore:D}=await import("./CFoLn9L9.js").then(oe=>oe.s);return{useSettingsStore:D}},__vite__mapDeps([0,1,2]),import.meta.url),A=R();await A.hydrate(),t.value=A.permissionMode}}catch(k){console.error("Failed to load chat settings:",k)}}function E(k){t.value=k,typeof window<"u"&&ls(async()=>{const{useSettingsStore:R}=await import("./CFoLn9L9.js").then(A=>A.s);return{useSettingsStore:R}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:R})=>{R().setPermissionMode(k)})}function B(k,R){const A=R??o.value;if(!A)return;const D=w(A);D.pendingPermission=k,h.value++}function be(k){const R=k??o.value;if(!R)return;const A=c.get(R);A&&(A.pendingPermission=null,h.value++)}function Ae(k,R){const A=R??o.value;if(!A)return;const D=w(A);D.pendingPlanApproval=k,h.value++}function Te(k){const R=k??o.value;if(!R)return;const A=c.get(R);A&&(A.pendingPlanApproval=null,h.value++)}function ae(){r.value=!r.value,q()}function re(){r.value=!0,q()}function $e(){r.value=!1,q()}function q(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:r.value}}).catch(k=>{console.error("Failed to save panel state:",k)})}function Oe(k){const R=Math.max(Wh,Math.min(qh,k));e.value=R,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:R}}).catch(A=>{console.error("Failed to save panel width:",A)})}function Be(k){n.value=k}function st(k,R){const A=R??o.value;if(!A)return;const D=s.value.find(oe=>oe.id===A);D&&(D.providerSessionId=k)}function zt(k,R){const A=s.value.find(D=>D.id===k);A&&(A.worktreeBranch=R,A.lastCommitTime=new Date().toISOString())}async function nr(k){const R=s.value.find(D=>D.id===k);if(!R?.worktreeBranch)return null;const A=R.worktreeBranch.trim();if(!A)return null;try{const oe=(await $fetch("/api/specs/features")).features.find(he=>he.id===A);return oe?(R.featureId!==oe.id&&(R.featureId=oe.id,R.updatedAt=new Date().toISOString(),Et()),oe.id):null}catch(D){return console.warn("[chat] Failed to map branch to feature",{conversationId:k,branchName:A,error:D instanceof Error?D.message:String(D)}),null}}function nn(k,R,A){const D=s.value.find(oe=>oe.id===k);D&&(D.providerId=R,D.providerModelKey=A)}function vr(k){const R=k??o.value;if(!R)return;const A=s.value.find(D=>D.id===R);A&&(A.providerSessionId="")}function qn(k){return s.value.find(A=>A.id===k)?.providerSessionId??""}function sn(k){l.value.add(k)}function jn(k){l.value.delete(k)}function on(k,R){const A=R??o.value;if(!A)return;const D=s.value.find(oe=>oe.id===A);D&&D.messages.push(k)}function kn(k,R,A){const D={id:jh(),role:"user",content:k,attachments:A&&A.length>0?A:void 0,timestamp:new Date().toISOString()};return on(D,R),D}function Zt(k){const R={id:jh(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return on(R,k),R}function Nt(k,R,A){const D=A??o.value;if(!D)return;const oe=s.value.find(ie=>ie.id===D);if(!oe)return;const he=oe.messages.findIndex(ie=>ie.id===k);he!==-1&&(oe.messages[he]={...oe.messages[he],...R})}function ce(k,R){const A=s.value.find(oe=>oe.id===R);if(!A)return;const D=A.messages.findIndex(oe=>oe.id===k);D!==-1&&(A.messages[D]={...A.messages[D],content:"",status:"streaming",contentBlocks:[]})}function xe(k,R,A){const D=A??o.value;if(!D)return;const oe=s.value.find(ie=>ie.id===D);if(!oe)return;const he=oe.messages.findIndex(ie=>ie.id===k);he!==-1&&(oe.messages[he].content+=R)}function _e(k,R,A){const D=A??o.value;if(!D)return;const oe=s.value.find(ie=>ie.id===D);if(!oe)return;const he=oe.messages.findIndex(ie=>ie.id===k);if(he!==-1){const ie=oe.messages[he],de=ie.tools?[...ie.tools,R]:[R];oe.messages[he]={...ie,tools:de}}}function qe(k,R,A,D){const oe=D??o.value;if(!oe)return;const he=s.value.find(de=>de.id===oe);if(!he)return;const ie=he.messages.findIndex(de=>de.id===k);if(ie!==-1){const de=he.messages[ie];if(de.tools){const He=de.tools.findIndex(ot=>ot.id===R);if(He!==-1){const ot=[...de.tools];ot[He]={...ot[He],...A},he.messages[ie]={...de,tools:ot}}}}ir(oe,!1)}function Fe(k,R){const A=R??o.value;if(!A)return;const D=s.value.find(he=>he.id===A);if(!D)return;const oe=D.messages.find(he=>he.id===k);oe&&!oe.contentBlocks&&(oe.contentBlocks=[])}function $t(k,R,A){const D=A??o.value;if(!D)return;const oe=s.value.find(ie=>ie.id===D);if(!oe)return;const he=oe.messages.find(ie=>ie.id===k);he&&(he.contentBlocks||(he.contentBlocks=[]),he.contentBlocks.push(R),Do(he))}function it(k,R,A,D){const oe=D??o.value;if(!oe)return;const he=s.value.find(Wt=>Wt.id===oe);if(!he)return;const ie=he.messages.find(Wt=>Wt.id===k);if(!ie?.contentBlocks)return;const de=ie.contentBlocks.findIndex(Wt=>Wt.id===R);if(de===-1)return;const ot={...ie.contentBlocks[de]};A(ot),ie.contentBlocks[de]=ot}function Yt(k,R,A,D,oe){const he=D??o.value;if(!he)return;const ie=s.value.find(Ue=>Ue.id===he);if(!ie)return;const de=ie.messages.find(Ue=>Ue.id===k);if(!de?.contentBlocks)return;const He=de.contentBlocks.findIndex(Ue=>Ue.id===R);if(He===-1)return;const ot=de.contentBlocks[He],Wt={...ot};A(Wt),de.contentBlocks[He]=Wt,oe?.syncContent!==!1&&Uy(ot,Wt)&&Do(de),ir(he,!1)}function sr(k,R,A){const D=A??o.value;if(!D)return;const oe=s.value.find(ie=>ie.id===D);if(!oe)return;const he=oe.messages.find(ie=>ie.id===k);he&&(he.contentBlocks||(he.contentBlocks=[]),he.contentBlocks.push(R),Do(he),ir(D,!1))}function br(k,R,A){const D=A??o.value;if(!D)return null;const oe=s.value.find(ie=>ie.id===D);if(!oe)return null;const he=oe.messages.find(ie=>ie.id===k);return he?.contentBlocks?he.contentBlocks.find(ie=>ie.type==="tool_use"&&ie.toolUseId===R)??null:null}function Yn(k,R,A,D,oe){const he=s.value.find(de=>de.id===oe);if(!he)return;const ie=he.messages.findIndex(de=>de.id===k);ie!==-1&&(he.messages[ie]={...he.messages[ie],content:A,contentBlocks:R,status:D},ir(oe,!0))}function Lr(k,R){const A=R??o.value;if(!A)return;const D=c.get(A);D?.session&&(D.session.status=k,h.value++)}function ai(k,R){const A=R??o.value;if(!A)return;const D=w(A);D.session={sessionId:k,cwd:n.value,status:"streaming",startedAt:new Date().toISOString()},D.lastError=null,h.value++}function li(k){const R=k??o.value;if(!R)return;const A=c.get(R);A?.session&&(A.session.status="idle",h.value++)}function ci(k,R){const A=R??o.value;if(!A)return;const D=w(A);D.session&&(D.session.status="error",D.session.error=k),D.lastError=k,h.value++}function ui(k,R){if(!u.value)return;const A=R??o.value;if(!A)return;const D=w(A),oe=(()=>{if(typeof k.payload=="string")return k.payload;try{return JSON.stringify(k.payload,null,2)}catch{return String(k.payload)}})(),he=8e3,ie=300,de=oe.length>he?`${oe.slice(0,he)}
|
|
9
|
-
... (truncated)`:oe;D.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:de}),D.debugEvents.length>ie&&D.debugEvents.splice(0,D.debugEvents.length-ie),h.value++}function hi(k){u.value=k}function di(k){const R=k??o.value;if(!R)return;const A=c.get(R);A&&(A.debugEvents=[],h.value++)}function fi(){if(!o.value)return;const k=s.value.find(A=>A.id===o.value);k&&(k.messages=[]);const R=o.value;c.delete(R),h.value++}function mi(k){const R=k??o.value;if(!R)return;const A=c.get(R);A&&(A.lastError=null,A.session&&(A.session.error=void 0),h.value++)}async function pi(){const k=await Kh();if(s.value=k.conversations,i.value=k.archivedConversations,k.discardedArchives>0&&console.warn(`[chat] Skipped ${k.discardedArchives} corrupted archived conversation(s)`),wn(),Sn(),!g.value){const R=s.value.find(A=>!!A.previewBranch&&!A.finalized);R&&(g.value=R.id)}if(o.value){const R=s.value.find(A=>A.id===o.value);R&&R.cwd?n.value=R.cwd:R||(o.value=null,r.value=!1)}}async function gi(){const k=await Kh(),R=new Map(s.value.map(ie=>[ie.id,ie])),A=new Set(k.conversations.map(ie=>ie.id));let D=0,oe=0,he=0;for(const ie of k.conversations){const de=R.get(ie.id);if(!de)s.value.push(ie),R.set(ie.id,ie),D++,console.log(`[chat] refresh: added new conversation ${ie.id} (source=${ie.source}, msgs=${ie.messages.length})`);else if(ie.source!=="user"&&(ie.messages.length>de.messages.length||ie.updatedAt>(de.updatedAt||""))){const He=s.value.findIndex(ot=>ot.id===ie.id);He!==-1&&(s.value.splice(He,1,ie),console.log(`[chat] refresh: updated conversation ${ie.id} (msgs: ${de.messages.length} → ${ie.messages.length}, updatedAt: ${de.updatedAt} → ${ie.updatedAt})`)),oe++}else de&&ie.messages.length!==de.messages.length&&console.log(`[chat] refresh: skipped update for ${ie.id} (source=${ie.source}, server msgs=${ie.messages.length}, local msgs=${de.messages.length})`)}for(let ie=s.value.length-1;ie>=0;ie--){const de=s.value[ie];!A.has(de.id)&&!l.value.has(de.id)&&(console.log(`[chat] refresh: removed conversation ${de.id} (no longer on server)`),o.value===de.id&&(o.value=null),s.value.splice(ie,1),he++)}return k.archivedConversations&&(i.value=k.archivedConversations),(D>0||oe>0||he>0)&&wn(),console.log(`[chat] refreshServerConversations: loaded=${k.conversations.length}, added=${D}, updated=${oe}, removed=${he}`),D+oe+he}function Et(){jy(s.value,i.value)}function ir(k,R=!1){s.value.find(D=>D.id===k)&&(R?m.flush(k):m.schedule(k))}function vs(k=!1){o.value&&ir(o.value,k)}function wn(){s.value.sort((k,R)=>new Date(R.createdAt).getTime()-new Date(k.createdAt).getTime())}function Sn(){i.value.sort((k,R)=>new Date(R.archivedAt).getTime()-new Date(k.archivedAt).getTime())}async function bs(k){if(ln().atLimit)return"";const A=G1();let D=null;if(k?.featureId){const de=await Fh({conversationId:A,featureId:k.featureId,baseBranch:k.baseBranch});if(!de.success&&de.error)throw new Error(de.error);D=de}let oe=null;if(typeof window<"u")try{const{useSettingsStore:de}=await ls(async()=>{const{useSettingsStore:ot}=await import("./CFoLn9L9.js").then(Wt=>Wt.s);return{useSettingsStore:ot}},__vite__mapDeps([0,1,2]),import.meta.url),He=de();await He.hydrate(),oe=He.providerSelection}catch(de){console.warn("[chat] Failed to load provider selection for new conversation",de)}const he=oe||{providerId:Wm,modelKey:Nm},ie={id:A,title:"New Conversation",messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:n.value||process.cwd?.()||"",source:k?.featureId?"cascade":"user",featureId:k?.featureId,providerId:he.providerId,providerModelKey:he.modelKey};if(D?.success&&D.worktreePath&&D.branch&&(ie.worktreePath=D.worktreePath,ie.worktreeBranch=D.branch,ie.cwd=D.worktreePath,ie.hasWorktree=!0,D.baseBranch&&(ie.baseBranch=D.baseBranch)),s.value.unshift(ie),o.value=A,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:A}}).catch(de=>{console.error("Failed to save active conversation:",de)}),!k?.featureId)try{const de=await Fh({conversationId:A,baseBranch:k?.baseBranch});if(de.success&&de.worktreePath&&de.branch){const He=s.value.find(ot=>ot.id===A);He&&(He.worktreePath=de.worktreePath,He.worktreeBranch=de.branch,He.cwd=de.worktreePath,He.hasWorktree=!0,de.baseBranch&&(He.baseBranch=de.baseBranch))}}catch(de){console.warn("[chat] Failed to create worktree for conversation",A,de)}return ir(A,!0),A}function $n(k){const R=s.value.find(A=>A.id===k);R&&(o.value=k,r.value=!0,R.cwd&&(n.value=R.cwd),!R.featureId&&R.worktreeBranch&&nr(k),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:k,isPanelOpen:!0}}).catch(A=>{console.error("Failed to save active conversation:",A)}))}async function an(k){const R=s.value.findIndex(D=>D.id===k);if(R===-1)return;const A=s.value[R];if(g.value===k&&(g.value=null),A.hasWorktree&&A.worktreePath&&A.worktreeBranch)try{await Pv({worktreePath:A.worktreePath,branch:A.worktreeBranch})}catch(D){console.warn("[chat] Failed to clean up worktree for conversation",k,D)}s.value.splice(R,1),c.delete(k),m.cancel(k),o.value===k&&(o.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(D=>{console.error("Failed to clear active conversation:",D)})),Et()}async function Oi(k,R,A){const D=s.value.find(he=>he.id===k);if(!D)return{success:!1,error:"Conversation not found"};if(!D.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const oe=A||D.baseBranch;try{const he=await ok({conversationId:k,commitMessage:R,baseBranch:oe,worktreePath:D.worktreePath,worktreeBranch:D.worktreeBranch,previewBranch:D.previewBranch});return he.success?(g.value===k&&(g.value=null),D.worktreePath=void 0,D.worktreeBranch=void 0,D.hasWorktree=!1,D.baseBranch=void 0,D.previewBranch=void 0,D.finalized=!0,D.updatedAt=new Date().toISOString(),Et()):he.rebaseInProgress&&await Cn(k,D.worktreePath,oe||"main",R),he}catch(he){return{success:!1,error:he instanceof Error?he.message:String(he)}}}async function xs(k,R){const A=s.value.find(oe=>oe.id===k);if(!A)return{success:!1,error:"Conversation not found"};if(!A.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const D=R||A.baseBranch;try{const oe=await ak({conversationId:k,baseBranch:D,worktreePath:A.worktreePath});return oe.rebaseInProgress?await Cn(k,A.worktreePath,D||"main","","sync"):oe.success&&(await Se(A),A.baseBranch=D,Et()),oe}catch(oe){return{success:!1,error:oe instanceof Error?oe.message:String(oe)}}}async function Cn(k,R,A,D,oe="finalize"){O.value={conversationId:k,worktreePath:R,baseBranch:A,commitMessage:D,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:oe,chatMessages:[],userGuidance:"",lifecycleState:"detected"};try{const he=await lk(R);O.value&&(O.value.files=he.files,O.value.loading=!1,gt("system",ek(he.files.length),"info"))}catch(he){O.value&&(O.value.error=he instanceof Error?he.message:String(he),O.value.loading=!1)}}function gt(k,R,A="info",D){O.value&&O.value.chatMessages.push(Gy(k,R,A,D))}async function xr(k,R){if(!O.value)return!1;try{const A=await ck({worktreePath:O.value.worktreePath,filePath:k,content:R});return A.success&&O.value&&O.value.resolvedFiles.add(k),A.success}catch{return!1}}async function ys(){if(!O.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:k,commitMessage:R,baseBranch:A,mode:D,worktreePath:oe}=O.value;try{const he=s.value.find(de=>de.id===k),ie=await uk({mode:D,conversationId:k,commitMessage:R,baseBranch:A,worktreePath:oe,worktreeBranch:he?.worktreeBranch,previewBranch:he?.previewBranch});if(ie.success){if(D==="finalize"){g.value===k&&(g.value=null);const de=s.value.find(He=>He.id===k);de&&(de.worktreePath=void 0,de.worktreeBranch=void 0,de.hasWorktree=!1,de.baseBranch=void 0,de.previewBranch=void 0,de.finalized=!0,de.updatedAt=new Date().toISOString(),Et())}else if(D==="sync"){const de=s.value.find(He=>He.id===k);de&&(await Se(de),de.baseBranch=A,de.updatedAt=new Date().toISOString(),Et())}O.value=null}else ie.rebaseInProgress&&await Cn(k,oe,A,R,D);return ie}catch(he){return{success:!1,error:he instanceof Error?he.message:String(he)}}}async function vi(){if(!O.value)return!1;try{const k=await Jh(O.value.worktreePath);return O.value=null,k.success}catch{return O.value=null,!1}}async function Qn(k){if(!O.value)return!1;const R=O.value.files.find(A=>A.path===k);if(!R)return!1;try{const A=await hk({worktreePath:O.value.worktreePath,filePath:k,conflictContent:R.content,userGuidance:O.value.userGuidance||void 0});if(A.success&&A.resolvedContent!==void 0){R.content=A.resolvedContent;const D=await xr(k,A.resolvedContent);return D?gt("assistant",`Resolved: ${k}`,"success",k):gt("assistant",`Failed to write resolved content for ${k}`,"error",k),D}return gt("assistant",`Failed to resolve ${k}: ${A.error||"Unknown error"}`,"error",k),!1}catch(A){const D=A instanceof Error?A.message:String(A);return gt("assistant",`Error resolving ${k}: ${D}`,"error",k),!1}}async function bi(){if(!O.value)return;const k=Jy(O.value.files,O.value.resolvedFiles);if(k.length===0){gt("system","All files are already resolved.","info");return}b=new AbortController;const R=b.signal;O.value.lifecycleState="resolving";const A=O.value.userGuidance;A&>("user",A),gt("system",tk(k.length),"info");let D=0,oe=0;const he=Ky(k,3);for(const de of he){if(!O.value||R.aborted)break;for(const ot of de)gt("assistant",`Resolving: ${ot.path}...`,"progress",ot.path);const He=await Promise.all(de.map(ot=>Qn(ot.path)));for(const ot of He)ot?D++:oe++}if(b=null,!O.value||R.aborted)return;const ie=Hy(D,oe);O.value.lifecycleState=ie.succeeded?"resolved":"failed",gt("system",ie.message,"summary")}async function ks(){if(!O.value)return;b&&(b.abort(),b=null);const{conversationId:k,worktreePath:R,baseBranch:A,commitMessage:D,mode:oe}=O.value;gt("system","Resolution cancelled. Resetting conflict state...","info");try{await Jh(R)}catch{}O.value=null,gt("system","Conflict resolution aborted and reset.","info")}async function yr(k){const R=s.value.find(A=>A.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 A=await rk({conversationId:k,worktreePath:R.worktreePath,baseBranch:R.baseBranch});return A.success&&A.previewBranch&&(R.previewBranch=A.previewBranch,g.value=k,R.updatedAt=new Date().toISOString(),Et()),{success:A.success,error:A.error}}catch(A){return{success:!1,error:A instanceof Error?A.message:String(A)}}}async function or(k){const R=s.value.find(A=>A.id===k);if(!R)return{success:!1,error:"Conversation not found"};if(!R.previewBranch||!R.baseBranch)return g.value=null,{success:!1,error:"No active preview"};try{const A=await nk({previewBranch:R.previewBranch,baseBranch:R.baseBranch});return A.success&&(R.previewBranch=void 0,g.value=null,R.updatedAt=new Date().toISOString(),Et()),{success:A.success,error:A.error}}catch(A){return{success:!1,error:A instanceof Error?A.message:String(A)}}}async function xi(k){const R=sk(g.value,k);if(R.kind==="end-current")return await or(R.id);if(R.kind==="swap"){const A=await or(R.endId);return A.success?await yr(R.startId):{success:!1,error:`Failed to end previous preview: ${A.error}`}}return await yr(R.id)}function yi(k){const R=k.trim();if(!R)return null;const A=s.value.filter(D=>D.featureId===R?!0:D.worktreeBranch?.trim()===R);return A.length===0?null:A.sort((D,oe)=>new Date(oe.updatedAt).getTime()-new Date(D.updatedAt).getTime())[0]||null}function Xr(k,R){const A=s.value.find(D=>D.id===k);A&&(A.title=R.trim(),A.updatedAt=new Date().toISOString(),wn(),Et())}function ki(k){const R=o.value;if(!R)return;const A=s.value.find(oe=>oe.id===R);if(!A||A.title!=="New Conversation")return;const D=A.messages.find(oe=>oe.role==="user");D&&(D.content.trim().length>0?A.title=H1(D.content):D.attachments&&D.attachments.length>0&&(A.title=D.attachments.length===1?"[Image] New Conversation":`[${D.attachments.length} Images] New Conversation`))}function ln(){const k=s.value.length;return{atLimit:k>=Nh,nearLimit:k>=zh,count:k}}async function wi(k,R){o.value||await bs();const A=kn(k,void 0,R);return ki(),vs(!0),A}function ws(k,R,A){const D=A??o.value;xe(k,R,D??void 0),D&&ir(D,!1)}function Ze(k,R){const A=R??o.value;Nt(k,{status:"complete"},A??void 0),A&&ir(A,!0)}return{messages:C,session:M,isPanelOpen:r,panelWidth:Me(e),permissionMode:Me(t),pendingPermission:X,pendingPlanApproval:V,cwd:Me(n),lastError:se,debugEvents:le,debugStreamEnabled:Me(u),providerSessionId:j,conversations:Me(s),archivedConversations:Me(i),activeConversationId:Me(o),conversationViewMode:Me(a),conflictState:Me(O),previewingConversationId:Me(g),isStreaming:ue,hasMessages:I,lastMessage:Z,isActiveConversationStreaming:W,hasConversations:N,hasArchivedConversations:L,activeConversation:S,conversationCount:z,isNearStorageLimit:ve,sortedConversations:H,sortedArchivedConversations:G,previewingConversation:te,streamingConversations:Me(l),initialize:T,togglePanel:ae,openPanel:re,closePanel:$e,setPanelWidth:Oe,setPermissionMode:E,setPendingPermission:B,clearPendingPermission:be,setPendingPlanApproval:Ae,clearPendingPlanApproval:Te,setCwd:Be,setProviderSessionId:st,clearProviderSession:vr,getProviderSessionId:qn,updateWorktreeBranch:zt,setConversationProviderSelection:nn,startConversationStreaming:sn,endConversationStreaming:jn,isConversationStreaming:F,addMessage:on,addUserMessage:kn,addAssistantMessage:Zt,updateMessage:Nt,resetMessageForReplay:ce,appendToMessage:xe,addToolToMessage:_e,updateToolInMessage:qe,initContentBlocks:Fe,appendContentBlock:$t,appendContentBlockWithSave:sr,updateBlockById:it,updateBlockWithSave:Yt,findToolUseBlock:br,batchSetMessageBlocks:Yn,syncContentFromBlocks:Do,setSessionStatus:Lr,startSession:ai,endSession:li,setSessionError:ci,setDebugStreamEnabled:hi,pushDebugEvent:ui,clearDebugEvents:di,clearMessages:fi,clearError:mi,loadConversations:pi,refreshServerConversations:gi,saveAllConversations:Et,saveCurrentConversation:vs,saveConversation:ir,createConversation:bs,selectConversation:$n,deleteConversation:an,archiveConversation:Qe,restoreArchivedConversation:Ye,deleteArchivedConversation:P,setConversationViewMode:me,findConversationByFeature:yi,syncConversationFeatureFromBranch:nr,renameConversation:Xr,checkStorageLimits:ln,finalizeConversation:Oi,rebaseConversation:xs,resolveConflictFile:xr,continueRebase:ys,abortRebase:vi,aiResolveConflictFile:Qn,aiResolveAllConflicts:bi,addConflictChatMessage:gt,cancelConflictResolution:ks,previewConversation:yr,unpreviewConversation:or,togglePreview:xi,isConversationPreviewing:ge,addUserMessageWithConversation:wi,appendToMessageWithSave:ws,completeMessageWithSave:Ze}});function dk(r={}){const e=dl(),t=300,n=5e3,s=250;let i=null,o=null,a=null,l=null,c=null,u=!1,h=!1;const d=Q(!1),m=Q(!1);let g=r;function O(I){g=I}async function b(){const I=g.getScrollPosition?.()??0,Z=await e.checkAndRefresh();return Z&&g.setScrollPosition&&(await Xt(),g.setScrollPosition(I)),Z}function x(){return d.value||!!e.activeContextMenu||!!e.activeDialog}async function w(){if(x()){m.value=!0;return}C()}async function S(){if(u){h=!0;return}u=!0;try{await b()}finally{u=!1,h&&(h=!1,C())}}function C(){o&&clearTimeout(o),o=setTimeout(()=>{o=null,S()},s)}function M(I){if(typeof window>"u")return;if(a&&a.readyState===WebSocket.OPEN){a.send(JSON.stringify({type:"watch",workingDirectory:I}));return}l&&(clearTimeout(l),l=null);const F=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;a=new WebSocket(F),a.onopen=()=>{a.send(JSON.stringify({type:"watch",workingDirectory:I}))},a.onmessage=W=>{try{JSON.parse(W.data).type==="git_changed"&&w()}catch{}},a.onclose=()=>{a=null,e.isPollingActive&&c&&(l=setTimeout(()=>{c&&M(c)},n))},a.onerror=()=>{}}function X(){l&&(clearTimeout(l),l=null),a&&(a.close(),a=null)}function V(I){I&&(c=I),!e.isPollingActive&&(e.startPolling(),c&&M(c))}function se(){X(),e.stopPolling()}function le(){d.value=!0,i&&(clearTimeout(i),i=null)}function ue(){i&&clearTimeout(i),i=setTimeout(async()=>{d.value=!1,m.value&&(m.value=!1,C())},t)}function j(){se(),i&&(clearTimeout(i),i=null),o&&(clearTimeout(o),o=null),u=!1,h=!1,c=null}return Ve(()=>[e.activeContextMenu,e.activeDialog],()=>{!e.activeContextMenu&&!e.activeDialog&&m.value&&!d.value&&(m.value=!1,C())}),{isUserInteracting:Me(d),isDeferredRefresh:Me(m),startPolling:V,stopPolling:se,startInteraction:le,endInteraction:ue,cleanup:j,setScrollCallbacks:O}}function fk(r){function e(s){if((s.ctrlKey||s.metaKey)&&s.key==="h"){s.preventDefault(),r.onScrollToHead();return}if(s.key==="Escape"){s.preventDefault(),r.onEscape();return}}function t(){document.addEventListener("keydown",e)}function n(){document.removeEventListener("keydown",e)}return{start:t,stop:n}}function mk(r){const e=Q({visible:!1,branchName:"",loading:!1,error:null});async function t(){e.value.loading=!0,e.value.error=null;const H=await r.checkoutBranch(e.value.branchName);e.value.loading=!1,H.success?e.value.visible=!1:e.value.error=H.error||"Unknown error"}const n=Q({visible:!1,fromCommit:"",loading:!1,error:null});async function s(H){n.value.loading=!0,n.value.error=null;const G=await r.createBranch(H.name,n.value.fromCommit);n.value.loading=!1,G.success?(H.checkout&&await r.checkoutBranch(H.name),n.value.visible=!1):n.value.error=G.error||"Unknown error"}const i=Q({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function o(H){i.value.loading=!0,i.value.error=null;const{branchName:G,isLocal:te}=i.value,ge=H?.force??i.value.force,me=te?await r.deleteLocalBranch(G,ge):await r.deleteRemoteBranch(G);i.value.loading=!1,me.success?i.value.visible=!1:i.value.error=me.error||"Unknown error"}const a=Q({visible:!1,branchName:"",newName:"",loading:!1,error:null});async function l(){if(!a.value.newName.trim()){a.value.error="Branch name is required";return}a.value.loading=!0,a.value.error=null;const H=await r.renameBranch(a.value.branchName,a.value.newName.trim());a.value.loading=!1,H.success?a.value.visible=!1:a.value.error=H.error||"Unknown error"}const c=Q({visible:!1,branchName:"",loading:!1,error:null});async function u(H){c.value.loading=!0,c.value.error=null;const G=await r.mergeBranch(c.value.branchName,H);c.value.loading=!1,G.success?c.value.visible=!1:c.value.error=G.error||"Unknown error"}const h=Q({visible:!1,branchName:"",loading:!1,error:null});async function d(){h.value.loading=!0,h.value.error=null;const H=await r.rebaseBranch(h.value.branchName);h.value.loading=!1,H.success?h.value.visible=!1:h.value.error=H.error||"Unknown error"}const m=Q({visible:!1,branchName:"",loading:!1,error:null});async function g(H){m.value.loading=!0,m.value.error=null;const G=await r.pushBranch(m.value.branchName,H.remote,H.force,H.forceWithLease);m.value.loading=!1,G.success?m.value.visible=!1:m.value.error=G.error||"Unknown error"}const O=Q({visible:!1,branchName:"",loading:!1,error:null});async function b(H){O.value.loading=!0,O.value.error=null;const G=await r.pullBranch(O.value.branchName,H.remote,H.noFastForward,H.squash);O.value.loading=!1,G.success?O.value.visible=!1:O.value.error=G.error||"Unknown error"}const x=Q({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function w(H){x.value.loading=!0,x.value.error=null;const G=await r.cherryPickCommit(x.value.commitHash,H.recordOrigin,H.noCommit);x.value.loading=!1,G.success?x.value.visible=!1:x.value.error=G.error||"Unknown error"}const S=Q({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function C(H){S.value.loading=!0,S.value.error=null;const G=await r.resetToCommit(S.value.commitHash,H.mode);S.value.loading=!1,G.success?S.value.visible=!1:S.value.error=G.error||"Unknown error"}const M=Q({visible:!1,commitHash:"",loading:!1,error:null});async function X(H){M.value.loading=!0,M.value.error=null;const G=await r.createTag(H.name,M.value.commitHash,H.annotated,H.message,H.pushToRemote);M.value.loading=!1,G.success?M.value.visible=!1:M.value.error=G.error||"Unknown error"}const V=Q({visible:!1,tagName:"",loading:!1,error:null});async function se(H){V.value.loading=!0,V.value.error=null;const G=await r.deleteTag(V.value.tagName,H.deleteFromRemote?H.remote||"origin":void 0);V.value.loading=!1,G.success?V.value.visible=!1:V.value.error=G.error||"Unknown error"}const le=Q({visible:!1,tagName:"",loading:!1,tagDetail:null}),ue=Q({visible:!1,loading:!1,error:null});async function j(H){ue.value.loading=!0,ue.value.error=null;const G=await r.stashChanges(H.message,H.includeUntracked);ue.value.loading=!1,G.success?ue.value.visible=!1:ue.value.error=G.error||"Unknown error"}const I=Q({visible:!1,stashIndex:0,loading:!1,error:null}),Z=Q("");async function F(H){I.value.loading=!0,I.value.error=null;const G=await r.stashBranch(I.value.stashIndex,H);I.value.loading=!1,G.success?I.value.visible=!1:I.value.error=G.error||"Unknown error"}const W=Q({visible:!1,loading:!1,error:null});async function N(H){W.value.loading=!0,W.value.error=null;const G=await r.resetWorking(H.mode);W.value.loading=!1,G.success?W.value.visible=!1:W.value.error=G.error||"Unknown error"}const L=Q({visible:!1,loading:!1,error:null});async function z(){L.value.loading=!0,L.value.error=null;const H=await r.cleanUntracked();L.value.loading=!1,H.success?L.value.visible=!1:L.value.error=H.error||"Unknown error"}const ve=K(()=>e.value.visible||n.value.visible||i.value.visible||a.value.visible||c.value.visible||h.value.visible||m.value.visible||O.value.visible||x.value.visible||S.value.visible||M.value.visible||V.value.visible||le.value.visible||ue.value.visible||I.value.visible||W.value.visible||L.value.visible);return{checkoutDialog:e,confirmCheckout:t,createBranchDialog:n,confirmCreateBranch:s,deleteBranchDialog:i,confirmDeleteBranch:o,renameDialog:a,confirmRenameBranch:l,mergeDialog:c,confirmMerge:u,rebaseDialog:h,confirmRebase:d,pushDialog:m,confirmPush:g,pullDialog:O,confirmPull:b,cherryPickDialog:x,confirmCherryPick:w,resetDialog:S,confirmReset:C,tagCreateDialog:M,confirmTagCreate:X,tagDeleteDialog:V,confirmTagDelete:se,tagDetailDialog:le,stashDialog:ue,confirmStash:j,stashBranchDialog:I,stashBranchInput:Z,confirmStashBranch:F,resetWorkingDialog:W,confirmResetWorking:N,cleanUntrackedDialog:L,confirmCleanUntracked:z,isAnyDialogOpen:ve}}function pk(r,e){const t=Q({visible:!1,x:0,y:0});function n(q,Oe){t.value={visible:!0,x:q,y:Oe},setTimeout(()=>{t.value.visible=!1},1500)}const s=Q({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function i(q){s.value={visible:!0,...q},r.setActiveContextMenu({type:"branch",props:q,position:{x:q.x,y:q.y}})}function o(){s.value.visible=!1,r.clearActiveContextMenu()}function a(){o(),e.checkoutDialog.value={visible:!0,branchName:s.value.branch,loading:!1,error:null}}function l(){const q=s.value.branch;o(),e.renameDialog.value={visible:!0,branchName:q,newName:q,loading:!1,error:null}}function c(){const{branch:q,isLocal:Oe}=s.value;o(),e.deleteBranchDialog.value={visible:!0,branchName:q,isLocal:Oe,force:!1,loading:!1,error:null}}function u(){const q=s.value.branch;o(),e.mergeDialog.value={visible:!0,branchName:q,loading:!1,error:null}}function h(){const q=s.value.branch;o(),e.rebaseDialog.value={visible:!0,branchName:q,loading:!1,error:null}}function d(){const q=s.value.branch;o(),e.pushDialog.value={visible:!0,branchName:q,loading:!1,error:null}}function m(){const q=s.value.branch;o(),e.pullDialog.value={visible:!0,branchName:q,loading:!1,error:null}}async function g(){const q=s.value.branch;o(),await r.fetchBranch(q)}async function O(){const{branch:q,x:Oe,y:Be}=s.value;o(),(await r.copyToClipboard(q)).success&&n(Oe,Be)}function b(){o(),e.createBranchDialog.value={visible:!0,fromCommit:s.value.commitHash,loading:!1,error:null}}const x=Q({visible:!1,commit:null,x:0,y:0});function w(q){x.value={visible:!0,commit:q.commit,x:q.x,y:q.y},r.setActiveContextMenu({type:"commit",props:q,position:{x:q.x,y:q.y}})}function S(){x.value.visible=!1,r.clearActiveContextMenu()}function C(q){return q===!1?!1:typeof q=="object"&&q!==null&&"success"in q?!!q.success:!0}function M(q){const Oe=x.value.commit;if(!Oe)return!1;S();const Be=q(Oe);return Be&&typeof Be.then=="function"?Be.then(C).catch(()=>!1):C(Be)}function X(){M(q=>{e.tagCreateDialog.value={visible:!0,commitHash:q.hash,loading:!1,error:null}})}function V(){M(q=>{e.createBranchDialog.value={visible:!0,fromCommit:q.hash,loading:!1,error:null}})}function se(){M(q=>{e.checkoutDialog.value={visible:!0,branchName:q.hash,loading:!1,error:null}})}function le(){M(q=>{e.cherryPickDialog.value={visible:!0,commitHash:q.hash,commitMessage:q.message,loading:!1,error:null}})}async function ue(){await M(q=>r.revertCommit(q.hash))}function j(){M(q=>{e.mergeDialog.value={visible:!0,branchName:q.shortHash,loading:!1,error:null}})}function I(){M(q=>{e.resetDialog.value={visible:!0,commitHash:q.hash,commitMessage:q.message,loading:!1,error:null}})}async function Z(){const{x:q,y:Oe}=x.value;await M(st=>r.copyToClipboard(st.hash))&&n(q,Oe)}async function F(){const{x:q,y:Oe}=x.value;await M(st=>r.copyCommitSubject(st))&&n(q,Oe)}const W=Q({visible:!1,tag:"",x:0,y:0,commitHash:""});function N(q){W.value={visible:!0,...q},r.setActiveContextMenu({type:"tag",props:q,position:{x:q.x,y:q.y}})}function L(){W.value.visible=!1,r.clearActiveContextMenu()}async function z(){const q=W.value.tag;L(),e.tagDetailDialog.value={visible:!0,tagName:q,loading:!0,tagDetail:null};const Oe=await r.getTagDetail(q);e.tagDetailDialog.value.loading=!1,Oe.success&&Oe.data&&(e.tagDetailDialog.value.tagDetail=Oe.data)}function ve(){const q=W.value.tag;L(),e.tagDeleteDialog.value={visible:!0,tagName:q,loading:!1,error:null}}async function H(){const q=W.value.tag;L(),await r.pushTag(q)}async function G(){const{tag:q,x:Oe,y:Be}=W.value;L(),(await r.copyToClipboard(q)).success&&n(Oe,Be)}const te=Q({visible:!1,x:0,y:0});function ge(q){te.value={visible:!0,...q},r.setActiveContextMenu({type:"uncommitted",props:q,position:{x:q.x,y:q.y}})}function me(){te.value.visible=!1,r.clearActiveContextMenu()}function Se(){me(),e.stashDialog.value={visible:!0,loading:!1,error:null}}function Qe(){me(),e.resetWorkingDialog.value={visible:!0,loading:!1,error:null}}function Ye(){me(),e.cleanUntrackedDialog.value={visible:!0,loading:!1,error:null}}const P=Q({visible:!1,stash:null,x:0,y:0});function T(q){P.value={visible:!0,stash:q.stash,x:q.x,y:q.y},r.setActiveContextMenu({type:"stash",props:q,position:{x:q.x,y:q.y}})}function E(){P.value.visible=!1,r.clearActiveContextMenu()}function B(q){const Oe=P.value.stash;if(!Oe)return!1;E();const Be=q(Oe);return Be&&typeof Be.then=="function"?Be.then(C).catch(()=>!1):C(Be)}async function be(){await B(q=>r.applyStash(q.index))}async function Ae(){await B(q=>r.popStash(q.index))}async function Te(){await B(q=>r.dropStash(q.index))}function ae(){B(q=>{e.stashBranchDialog.value={visible:!0,stashIndex:q.index,loading:!1,error:null}})}async function re(){const{x:q,y:Oe}=P.value;await B(st=>r.copyToClipboard(`stash@{${st.index}}`))&&n(q,Oe)}async function $e(){const{x:q,y:Oe}=P.value;await B(st=>r.copyToClipboard(st.hash))&&n(q,Oe)}return{copyFeedback:t,showCopyFeedback:n,branchMenu:s,handleBranchContextMenu:i,closeBranchMenu:o,handleBranchCheckout:a,handleBranchRename:l,handleBranchDelete:c,handleBranchMerge:u,handleBranchRebase:h,handleBranchPush:d,handleBranchPull:m,handleBranchFetch:g,handleBranchCopyName:O,handleBranchCreateBranch:b,commitMenu:x,handleCommitContextMenu:w,closeCommitMenu:S,handleCommitAddTag:X,handleCommitCreateBranch:V,handleCommitCheckout:se,handleCommitCherryPick:le,handleCommitRevert:ue,handleCommitMergeInto:j,handleCommitReset:I,handleCommitCopyHash:Z,handleCommitCopySubject:F,tagMenu:W,handleTagContextMenu:N,closeTagMenu:L,handleTagViewDetails:z,handleTagDelete:ve,handleTagPush:H,handleTagCopyName:G,uncommittedMenu:te,handleUncommittedContextMenu:ge,closeUncommittedMenu:me,handleUncommittedStash:Se,handleUncommittedReset:Qe,handleUncommittedClean:Ye,stashMenu:P,handleStashContextMenu:T,closeStashMenu:E,handleStashApply:be,handleStashPop:Ae,handleStashDrop:Te,handleStashCreateBranch:ae,handleStashCopyName:re,handleStashCopyHash:$e}}const gk={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Ok={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},vk={class:"text-sm font-mono text-retro-text"},bk={class:"p-4"},xk={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},yk={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},kk=["disabled"],wk=["disabled"],Rt=Ie({__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(r,{emit:e}){const t=r,n=e;function s(i){i.key==="Escape"&&n("close"),i.key==="Enter"&&!t.loading&&(i.preventDefault(),n("confirm"))}return Ve(()=>t.visible,i=>{i?document.addEventListener("keydown",s):document.removeEventListener("keydown",s)}),kt(()=>{document.removeEventListener("keydown",s)}),(i,o)=>(v(),pe(Pr,{to:"body"},[J(pn,{"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:ct(()=>[r.visible?(v(),y("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:o[3]||(o[3]=kr(a=>n("close"),["self"]))},[f("div",gk,[f("div",Ok,[f("h3",vk,_(r.title),1),f("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:o[0]||(o[0]=a=>n("close"))},[J(p(wt),{class:"h-4 w-4"})])]),f("div",bk,[r.error?(v(),y("div",xk,_(r.error),1)):U("",!0),Im(i.$slots,"default")]),f("div",yk,[f("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:r.loading,onClick:o[1]||(o[1]=a=>n("close"))},_(r.cancelLabel),9,kk),f("button",{type:"button",class:Re(["px-3 py-1.5 text-xs font-mono rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",[r.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:r.loading,onClick:o[2]||(o[2]=a=>n("confirm"))},_(r.loading?"Loading...":r.confirmLabel),11,wk)])])])):U("",!0)]),_:3})]))}}),Sk={class:"text-retro-text text-sm font-mono mb-4"},$k={class:"text-retro-cyan"},Ck={class:"space-y-3"},Qk={class:"flex items-center gap-2 cursor-pointer"},Pk={class:"flex items-center gap-2 cursor-pointer"},Tk={class:"flex items-center gap-2 cursor-pointer"},Mk=Ie({__name:"MergeDialog",props:{visible:{type:Boolean},branchName:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q(!1),i=Q(!1),o=Q(!1);function a(){n("confirm",{noCommit:s.value,noFastForward:i.value,squash:o.value})}return Ve(()=>t.visible,l=>{l&&(s.value=!1,i.value=!1,o.value=!1)}),(l,c)=>(v(),pe(Rt,{title:"Merge Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Merge",onClose:c[3]||(c[3]=u=>n("close")),onConfirm:a},{default:ct(()=>[f("p",Sk,[c[4]||(c[4]=Xe(" Merge ",-1)),f("span",$k,_(r.branchName),1),c[5]||(c[5]=Xe(" into current branch ",-1))]),f("div",Ck,[f("label",Qk,[je(f("input",{"onUpdate:modelValue":c[0]||(c[0]=u=>et(s)?s.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(s)]]),c[6]||(c[6]=f("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),f("label",Pk,[je(f("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>et(i)?i.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(i)]]),c[7]||(c[7]=f("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),f("label",Tk,[je(f("input",{"onUpdate:modelValue":c[2]||(c[2]=u=>et(o)?o.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(o)]]),c[8]||(c[8]=f("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),Ak={class:"text-retro-text text-sm font-mono mb-2"},_k={class:"text-retro-cyan"},Rk={class:"space-y-3 mt-4"},Bk={class:"flex items-center gap-2 cursor-pointer"},Zk=Ie({__name:"DeleteBranchDialog",props:{visible:{type:Boolean},branchName:{},isLocal:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q(!1);function i(){n("confirm",{force:s.value})}return Ve(()=>t.visible,o=>{o&&(s.value=!1)}),(o,a)=>(v(),pe(Rt,{title:"Delete Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Delete","confirm-danger":!0,onClose:a[1]||(a[1]=l=>n("close")),onConfirm:i},{default:ct(()=>[a[4]||(a[4]=f("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)),f("p",Ak,[Xe(" Delete "+_(r.isLocal?"local":"remote")+" branch ",1),f("span",_k,_(r.branchName),1),a[2]||(a[2]=Xe("? ",-1))]),f("div",Rk,[f("label",Bk,[je(f("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>et(s)?s.value=l:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(s)]]),a[3]||(a[3]=f("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),Ek={class:"text-retro-text text-sm font-mono mb-4"},Dk={class:"text-retro-cyan"},Lk={class:"space-y-3"},Xk=["value"],Ik={class:"flex items-center gap-2 cursor-pointer"},Vk=["checked"],zk={class:"flex items-center gap-2 cursor-pointer"},Nk=["checked"],Wk={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},qk=Ie({__name:"PushDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q("origin"),i=Q(!1),o=Q(!1);function a(u){i.value=u,u&&(o.value=!1)}function l(u){o.value=u,u&&(i.value=!1)}function c(){n("confirm",{remote:s.value,force:i.value,forceWithLease:o.value})}return Ve(()=>t.visible,u=>{u&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",i.value=!1,o.value=!1)}),(u,h)=>(v(),pe(Rt,{title:"Push Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Push",onClose:h[3]||(h[3]=d=>n("close")),onConfirm:c},{default:ct(()=>[f("p",Ek,[h[4]||(h[4]=Xe(" Push ",-1)),f("span",Dk,_(r.branchName),1),h[5]||(h[5]=Xe(" to remote ",-1))]),f("div",Lk,[f("div",null,[h[6]||(h[6]=f("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),je(f("select",{"onUpdate:modelValue":h[0]||(h[0]=d=>et(s)?s.value=d: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"},[(v(!0),y(ke,null,Ne(r.remotes,d=>(v(),y("option",{key:d,value:d},_(d),9,Xk))),128))],512),[[gs,p(s)]])]),f("label",Ik,[f("input",{checked:p(i),type:"checkbox",class:"accent-retro-cyan",onChange:h[1]||(h[1]=d=>a(d.target.checked))},null,40,Vk),h[7]||(h[7]=f("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),f("label",zk,[f("input",{checked:p(o),type:"checkbox",class:"accent-retro-cyan",onChange:h[2]||(h[2]=d=>l(d.target.checked))},null,40,Nk),h[8]||(h[8]=f("span",{class:"text-retro-muted text-sm"},"Force with lease (safer force push)",-1))]),p(i)||p(o)?(v(),y("div",Wk,_(p(i)?"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)):U("",!0)])]),_:1},8,["visible","loading","error"]))}}),jk={class:"text-retro-text text-sm font-mono mb-4"},Yk={class:"text-retro-cyan"},Fk={class:"space-y-3"},Uk=["value"],Gk={class:"flex items-center gap-2 cursor-pointer"},Hk={class:"flex items-center gap-2 cursor-pointer"},Kk=Ie({__name:"PullDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q("origin"),i=Q(!1),o=Q(!1);function a(){n("confirm",{remote:s.value,noFastForward:i.value,squash:o.value})}return Ve(()=>t.visible,l=>{l&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",i.value=!1,o.value=!1)}),(l,c)=>(v(),pe(Rt,{title:"Pull Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Pull",onClose:c[3]||(c[3]=u=>n("close")),onConfirm:a},{default:ct(()=>[f("p",jk,[c[4]||(c[4]=Xe(" Pull ",-1)),f("span",Yk,_(r.branchName),1),c[5]||(c[5]=Xe(" from remote ",-1))]),f("div",Fk,[f("div",null,[c[6]||(c[6]=f("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),je(f("select",{"onUpdate:modelValue":c[0]||(c[0]=u=>et(s)?s.value=u: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"},[(v(!0),y(ke,null,Ne(r.remotes,u=>(v(),y("option",{key:u,value:u},_(u),9,Uk))),128))],512),[[gs,p(s)]])]),f("label",Gk,[je(f("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>et(i)?i.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(i)]]),c[7]||(c[7]=f("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),f("label",Hk,[je(f("input",{"onUpdate:modelValue":c[2]||(c[2]=u=>et(o)?o.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(o)]]),c[8]||(c[8]=f("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),Jk={class:"text-retro-text text-sm font-mono mb-4"},ew={class:"text-retro-cyan"},tw={class:"text-retro-cyan"},rw={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},nw={class:"text-retro-cyan"},sw={class:"text-retro-cyan"},iw=Ie({__name:"RebaseDialog",props:{visible:{type:Boolean},branchName:{},ontoBranch:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e;return(n,s)=>(v(),pe(Rt,{title:"Rebase Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Rebase",onClose:s[0]||(s[0]=i=>t("close")),onConfirm:s[1]||(s[1]=i=>t("confirm"))},{default:ct(()=>[f("p",Jk,[s[2]||(s[2]=Xe(" Rebase ",-1)),f("span",ew,_(r.branchName),1),s[3]||(s[3]=Xe(" onto ",-1)),f("span",tw,_(r.ontoBranch),1)]),f("div",rw,[s[4]||(s[4]=Xe(" This will rewrite commit history. Commits from ",-1)),f("span",nw,_(r.branchName),1),s[5]||(s[5]=Xe(" will be replayed on top of ",-1)),f("span",sw,_(r.ontoBranch),1),s[6]||(s[6]=Xe(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),ow={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},aw={class:"text-sm font-mono text-retro-cyan"},lw={class:"text-xs font-mono text-retro-text mt-1 truncate"},cw={class:"space-y-3"},uw={class:"flex items-start gap-2 cursor-pointer group"},hw={class:"flex items-start gap-2 cursor-pointer group"},dw=Ie({__name:"CherryPickDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e,n=Q(!1),s=Q(!1);function i(){t("confirm",{recordOrigin:n.value,noCommit:s.value})}function o(){n.value=!1,s.value=!1,t("close")}return(a,l)=>(v(),pe(Rt,{title:"Cherry-Pick Commit",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Cherry-Pick",onClose:o,onConfirm:i},{default:ct(()=>[f("div",ow,[l[2]||(l[2]=f("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),f("div",aw,_(r.commitHash.slice(0,7)),1),f("div",lw,_(r.commitMessage.split(`
|
|
8
|
+
`):""}function Do(r){r.contentBlocks&&(r.content=Fy(r.contentBlocks))}function Uy(r,e){if(r.type!==e.type)return!0;switch(e.type){case"text":return r.text!==e.text;case"tool_use":{const t=r;return t.name!==e.name||t.inputSummary!==e.inputSummary}case"tool_result":{const t=r;return t.content!==e.content||t.isError!==e.isError}default:return!1}}function Gy(r,e,t="info",n,s=Date.now,i=Math.random){return{id:`conflict-msg-${s()}-${i().toString(36).slice(2,7)}`,role:r,content:e,timestamp:s(),type:t,fileRef:n}}function Hy(r,e){return e===0?{message:`All ${r} file${r===1?"":"s"} resolved successfully. Click "Continue Rebase" to proceed.`,succeeded:!0}:{message:`Resolution complete: ${r} succeeded, ${e} failed. You can retry or abort.`,succeeded:!1}}function Ky(r,e){const t=[];for(let n=0;n<r.length;n+=e)t.push(r.slice(n,n+e));return t}function Jy(r,e){return r.filter(t=>!e.has(t.path))}function ek(r){return`Detected ${r} conflicted file${r===1?"":"s"}. Enter optional guidance below and click "Resolve Conflicts Automatically" to start.`}function tk(r){return`Starting AI resolution for ${r} file${r===1?"":"s"} (parallel)...`}async function rk(r){return $fetch("/api/chat/preview",{method:"POST",body:r})}async function nk(r){return $fetch("/api/chat/preview",{method:"DELETE",body:r})}function sk(r,e){return r===e?{kind:"end-current",id:e}:r?{kind:"swap",endId:r,startId:e}:{kind:"start",id:e}}function ik(r){const e=new Map,t=r.setTimer??setTimeout,n=r.clearTimer??clearTimeout;function s(l){if(e.has(l))return;const c=t(()=>{e.delete(l),r.onFlush(l)},r.delayMs);e.set(l,c)}function i(l){const c=e.get(l);c&&(n(c),e.delete(l)),r.onFlush(l)}function o(l){const c=e.get(l);c&&(n(c),e.delete(l))}function a(){for(const l of e.values())n(l);e.clear()}return{schedule:s,flush:i,cancel:o,cancelAll:a,hasPending:l=>e.has(l),pendingCount:()=>e.size}}async function ok(r){return $fetch("/api/chat/finalize",{method:"POST",body:r})}async function ak(r){return $fetch("/api/chat/rebase",{method:"POST",body:r})}async function lk(r){return $fetch("/api/rebase/conflicts",{params:{worktreePath:r}})}async function ck(r){return $fetch("/api/rebase/resolve",{method:"PUT",body:r})}async function uk(r){const e=r.mode==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue",{mode:t,...n}=r;return $fetch(e,{method:"POST",body:n})}async function Jh(r){return $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:r}})}async function hk(r){return $fetch("/api/rebase/ai-resolve",{method:"POST",body:r})}const gr=Qu("chat",()=>{const r=Q(!1),e=Q(U1),t=Q("ask"),n=Q(""),s=Q([]),i=Q([]),o=Q(null),a=Q("active"),l=Q(new Set),c=new Map,u=Q(!1),h=Q(0),m=ik({delayMs:1200,onFlush:k=>{const R=s.value.find(A=>A.id===k);R&&(R.updatedAt=new Date().toISOString(),Yy(R))}}),g=Q(null),O=Q(null);let b=null;function x(k){return k?c.get(k)??null:null}function w(k){let R=c.get(k);return R||(R={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},c.set(k,R)),R}const S=K(()=>s.value.find(k=>k.id===o.value)||null),C=K(()=>S.value?.messages??[]),M=K(()=>(h.value,x(o.value)?.session??null)),X=K(()=>(h.value,x(o.value)?.pendingPermission??null)),V=K(()=>(h.value,x(o.value)?.pendingPlanApproval??null)),se=K(()=>(h.value,x(o.value)?.lastError??null)),le=K(()=>(h.value,x(o.value)?.debugEvents??[])),ue=K(()=>M.value?.status==="streaming"),j=K(()=>S.value?.providerSessionId??""),I=K(()=>C.value.length>0),Z=K(()=>C.value[C.value.length-1]||null);function F(k){return l.value.has(k)}const W=K(()=>o.value?l.value.has(o.value):!1),N=K(()=>s.value.length>0),L=K(()=>i.value.length>0),z=K(()=>s.value.length),ve=K(()=>z.value>=zh),H=K(()=>s.value),G=K(()=>i.value),te=K(()=>g.value&&s.value.find(k=>k.id===g.value)||null);function ge(k){return g.value===k}function me(k){a.value=k}async function Se(k){if(!(!k?.previewBranch||!k.worktreePath))try{await Tv({previewBranch:k.previewBranch,worktreePath:k.worktreePath})}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 Qe(k){if(F(k))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(A=>A.id===k)===-1)return{success:!1,error:"Conversation not found"};try{const A=await $fetch(`/api/conversations/${k}/archive`,{method:"POST"});return A.success&&A.archived?(m.cancel(k),c.delete(k),s.value=Array.isArray(A.conversations)?A.conversations:s.value.filter(D=>D.id!==k),i.value=Array.isArray(A.archivedConversations)?A.archivedConversations:[A.archived,...i.value],Sn(),g.value===k&&(g.value=null),o.value===k&&(o.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:o.value}}).catch(D=>{console.error("Failed to save active conversation:",D)}),{success:!0}):{success:!1,error:"Failed to archive conversation"}}catch(A){return{success:!1,error:A instanceof Error?A.message:"Failed to archive conversation"}}}async function Ye(k,R){if(ln().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${Nh}.`};if(!i.value.some(D=>D.id===k))return{success:!1,error:"Archived conversation not found"};try{const D=await $fetch(`/api/conversations/archives/${k}/restore`,{method:"POST",body:{baseBranch:R}});return D.success&&D.conversation?(s.value=Array.isArray(D.conversations)?D.conversations:[D.conversation,...s.value],Array.isArray(D.archivedConversations)?i.value=D.archivedConversations:i.value=i.value.filter(oe=>oe.id!==k),a.value="active",$n(D.conversation.id),wn(),Et(),{success:!0,conversationId:D.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(D){return{success:!1,error:D instanceof Error?D.message:"Failed to restore archived conversation"}}}async function P(k){const R=i.value.findIndex(A=>A.id===k);if(R===-1)return{success:!1,error:"Archived conversation not found"};try{return await $fetch(`/api/conversations/archives/${k}`,{method:"DELETE"}),i.value.splice(R,1),Sn(),{success:!0}}catch{return i.value.splice(R,1),Et(),{success:!0}}}async function T(){if(!(typeof window>"u"))try{const k=await $fetch("/api/settings");if(k){if(typeof k.panelWidth=="number"){const D=k.panelWidth;D>=Wh&&D<=qh&&(e.value=D)}typeof k.isPanelOpen=="boolean"&&(r.value=k.isPanelOpen),typeof k.activeConversationId=="string"&&(o.value=k.activeConversationId);const{useSettingsStore:R}=await ls(async()=>{const{useSettingsStore:D}=await import("./D_05ko21.js").then(oe=>oe.s);return{useSettingsStore:D}},__vite__mapDeps([0,1,2]),import.meta.url),A=R();await A.hydrate(),t.value=A.permissionMode}}catch(k){console.error("Failed to load chat settings:",k)}}function E(k){t.value=k,typeof window<"u"&&ls(async()=>{const{useSettingsStore:R}=await import("./D_05ko21.js").then(A=>A.s);return{useSettingsStore:R}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:R})=>{R().setPermissionMode(k)})}function B(k,R){const A=R??o.value;if(!A)return;const D=w(A);D.pendingPermission=k,h.value++}function be(k){const R=k??o.value;if(!R)return;const A=c.get(R);A&&(A.pendingPermission=null,h.value++)}function Ae(k,R){const A=R??o.value;if(!A)return;const D=w(A);D.pendingPlanApproval=k,h.value++}function Te(k){const R=k??o.value;if(!R)return;const A=c.get(R);A&&(A.pendingPlanApproval=null,h.value++)}function ae(){r.value=!r.value,q()}function re(){r.value=!0,q()}function $e(){r.value=!1,q()}function q(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:r.value}}).catch(k=>{console.error("Failed to save panel state:",k)})}function Oe(k){const R=Math.max(Wh,Math.min(qh,k));e.value=R,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:R}}).catch(A=>{console.error("Failed to save panel width:",A)})}function Be(k){n.value=k}function st(k,R){const A=R??o.value;if(!A)return;const D=s.value.find(oe=>oe.id===A);D&&(D.providerSessionId=k)}function zt(k,R){const A=s.value.find(D=>D.id===k);A&&(A.worktreeBranch=R,A.lastCommitTime=new Date().toISOString())}async function nr(k){const R=s.value.find(D=>D.id===k);if(!R?.worktreeBranch)return null;const A=R.worktreeBranch.trim();if(!A)return null;try{const oe=(await $fetch("/api/specs/features")).features.find(he=>he.id===A);return oe?(R.featureId!==oe.id&&(R.featureId=oe.id,R.updatedAt=new Date().toISOString(),Et()),oe.id):null}catch(D){return console.warn("[chat] Failed to map branch to feature",{conversationId:k,branchName:A,error:D instanceof Error?D.message:String(D)}),null}}function nn(k,R,A){const D=s.value.find(oe=>oe.id===k);D&&(D.providerId=R,D.providerModelKey=A)}function vr(k){const R=k??o.value;if(!R)return;const A=s.value.find(D=>D.id===R);A&&(A.providerSessionId="")}function qn(k){return s.value.find(A=>A.id===k)?.providerSessionId??""}function sn(k){l.value.add(k)}function jn(k){l.value.delete(k)}function on(k,R){const A=R??o.value;if(!A)return;const D=s.value.find(oe=>oe.id===A);D&&D.messages.push(k)}function kn(k,R,A){const D={id:jh(),role:"user",content:k,attachments:A&&A.length>0?A:void 0,timestamp:new Date().toISOString()};return on(D,R),D}function Zt(k){const R={id:jh(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return on(R,k),R}function Nt(k,R,A){const D=A??o.value;if(!D)return;const oe=s.value.find(ie=>ie.id===D);if(!oe)return;const he=oe.messages.findIndex(ie=>ie.id===k);he!==-1&&(oe.messages[he]={...oe.messages[he],...R})}function ce(k,R){const A=s.value.find(oe=>oe.id===R);if(!A)return;const D=A.messages.findIndex(oe=>oe.id===k);D!==-1&&(A.messages[D]={...A.messages[D],content:"",status:"streaming",contentBlocks:[]})}function xe(k,R,A){const D=A??o.value;if(!D)return;const oe=s.value.find(ie=>ie.id===D);if(!oe)return;const he=oe.messages.findIndex(ie=>ie.id===k);he!==-1&&(oe.messages[he].content+=R)}function _e(k,R,A){const D=A??o.value;if(!D)return;const oe=s.value.find(ie=>ie.id===D);if(!oe)return;const he=oe.messages.findIndex(ie=>ie.id===k);if(he!==-1){const ie=oe.messages[he],de=ie.tools?[...ie.tools,R]:[R];oe.messages[he]={...ie,tools:de}}}function qe(k,R,A,D){const oe=D??o.value;if(!oe)return;const he=s.value.find(de=>de.id===oe);if(!he)return;const ie=he.messages.findIndex(de=>de.id===k);if(ie!==-1){const de=he.messages[ie];if(de.tools){const He=de.tools.findIndex(ot=>ot.id===R);if(He!==-1){const ot=[...de.tools];ot[He]={...ot[He],...A},he.messages[ie]={...de,tools:ot}}}}ir(oe,!1)}function Fe(k,R){const A=R??o.value;if(!A)return;const D=s.value.find(he=>he.id===A);if(!D)return;const oe=D.messages.find(he=>he.id===k);oe&&!oe.contentBlocks&&(oe.contentBlocks=[])}function $t(k,R,A){const D=A??o.value;if(!D)return;const oe=s.value.find(ie=>ie.id===D);if(!oe)return;const he=oe.messages.find(ie=>ie.id===k);he&&(he.contentBlocks||(he.contentBlocks=[]),he.contentBlocks.push(R),Do(he))}function it(k,R,A,D){const oe=D??o.value;if(!oe)return;const he=s.value.find(Wt=>Wt.id===oe);if(!he)return;const ie=he.messages.find(Wt=>Wt.id===k);if(!ie?.contentBlocks)return;const de=ie.contentBlocks.findIndex(Wt=>Wt.id===R);if(de===-1)return;const ot={...ie.contentBlocks[de]};A(ot),ie.contentBlocks[de]=ot}function Yt(k,R,A,D,oe){const he=D??o.value;if(!he)return;const ie=s.value.find(Ue=>Ue.id===he);if(!ie)return;const de=ie.messages.find(Ue=>Ue.id===k);if(!de?.contentBlocks)return;const He=de.contentBlocks.findIndex(Ue=>Ue.id===R);if(He===-1)return;const ot=de.contentBlocks[He],Wt={...ot};A(Wt),de.contentBlocks[He]=Wt,oe?.syncContent!==!1&&Uy(ot,Wt)&&Do(de),ir(he,!1)}function sr(k,R,A){const D=A??o.value;if(!D)return;const oe=s.value.find(ie=>ie.id===D);if(!oe)return;const he=oe.messages.find(ie=>ie.id===k);he&&(he.contentBlocks||(he.contentBlocks=[]),he.contentBlocks.push(R),Do(he),ir(D,!1))}function br(k,R,A){const D=A??o.value;if(!D)return null;const oe=s.value.find(ie=>ie.id===D);if(!oe)return null;const he=oe.messages.find(ie=>ie.id===k);return he?.contentBlocks?he.contentBlocks.find(ie=>ie.type==="tool_use"&&ie.toolUseId===R)??null:null}function Yn(k,R,A,D,oe){const he=s.value.find(de=>de.id===oe);if(!he)return;const ie=he.messages.findIndex(de=>de.id===k);ie!==-1&&(he.messages[ie]={...he.messages[ie],content:A,contentBlocks:R,status:D},ir(oe,!0))}function Lr(k,R){const A=R??o.value;if(!A)return;const D=c.get(A);D?.session&&(D.session.status=k,h.value++)}function ai(k,R){const A=R??o.value;if(!A)return;const D=w(A);D.session={sessionId:k,cwd:n.value,status:"streaming",startedAt:new Date().toISOString()},D.lastError=null,h.value++}function li(k){const R=k??o.value;if(!R)return;const A=c.get(R);A?.session&&(A.session.status="idle",h.value++)}function ci(k,R){const A=R??o.value;if(!A)return;const D=w(A);D.session&&(D.session.status="error",D.session.error=k),D.lastError=k,h.value++}function ui(k,R){if(!u.value)return;const A=R??o.value;if(!A)return;const D=w(A),oe=(()=>{if(typeof k.payload=="string")return k.payload;try{return JSON.stringify(k.payload,null,2)}catch{return String(k.payload)}})(),he=8e3,ie=300,de=oe.length>he?`${oe.slice(0,he)}
|
|
9
|
+
... (truncated)`:oe;D.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:de}),D.debugEvents.length>ie&&D.debugEvents.splice(0,D.debugEvents.length-ie),h.value++}function hi(k){u.value=k}function di(k){const R=k??o.value;if(!R)return;const A=c.get(R);A&&(A.debugEvents=[],h.value++)}function fi(){if(!o.value)return;const k=s.value.find(A=>A.id===o.value);k&&(k.messages=[]);const R=o.value;c.delete(R),h.value++}function mi(k){const R=k??o.value;if(!R)return;const A=c.get(R);A&&(A.lastError=null,A.session&&(A.session.error=void 0),h.value++)}async function pi(){const k=await Kh();if(s.value=k.conversations,i.value=k.archivedConversations,k.discardedArchives>0&&console.warn(`[chat] Skipped ${k.discardedArchives} corrupted archived conversation(s)`),wn(),Sn(),!g.value){const R=s.value.find(A=>!!A.previewBranch&&!A.finalized);R&&(g.value=R.id)}if(o.value){const R=s.value.find(A=>A.id===o.value);R&&R.cwd?n.value=R.cwd:R||(o.value=null,r.value=!1)}}async function gi(){const k=await Kh(),R=new Map(s.value.map(ie=>[ie.id,ie])),A=new Set(k.conversations.map(ie=>ie.id));let D=0,oe=0,he=0;for(const ie of k.conversations){const de=R.get(ie.id);if(!de)s.value.push(ie),R.set(ie.id,ie),D++,console.log(`[chat] refresh: added new conversation ${ie.id} (source=${ie.source}, msgs=${ie.messages.length})`);else if(ie.source!=="user"&&(ie.messages.length>de.messages.length||ie.updatedAt>(de.updatedAt||""))){const He=s.value.findIndex(ot=>ot.id===ie.id);He!==-1&&(s.value.splice(He,1,ie),console.log(`[chat] refresh: updated conversation ${ie.id} (msgs: ${de.messages.length} → ${ie.messages.length}, updatedAt: ${de.updatedAt} → ${ie.updatedAt})`)),oe++}else de&&ie.messages.length!==de.messages.length&&console.log(`[chat] refresh: skipped update for ${ie.id} (source=${ie.source}, server msgs=${ie.messages.length}, local msgs=${de.messages.length})`)}for(let ie=s.value.length-1;ie>=0;ie--){const de=s.value[ie];!A.has(de.id)&&!l.value.has(de.id)&&(console.log(`[chat] refresh: removed conversation ${de.id} (no longer on server)`),o.value===de.id&&(o.value=null),s.value.splice(ie,1),he++)}return k.archivedConversations&&(i.value=k.archivedConversations),(D>0||oe>0||he>0)&&wn(),console.log(`[chat] refreshServerConversations: loaded=${k.conversations.length}, added=${D}, updated=${oe}, removed=${he}`),D+oe+he}function Et(){jy(s.value,i.value)}function ir(k,R=!1){s.value.find(D=>D.id===k)&&(R?m.flush(k):m.schedule(k))}function vs(k=!1){o.value&&ir(o.value,k)}function wn(){s.value.sort((k,R)=>new Date(R.createdAt).getTime()-new Date(k.createdAt).getTime())}function Sn(){i.value.sort((k,R)=>new Date(R.archivedAt).getTime()-new Date(k.archivedAt).getTime())}async function bs(k){if(ln().atLimit)return"";const A=G1();let D=null;if(k?.featureId){const de=await Fh({conversationId:A,featureId:k.featureId,baseBranch:k.baseBranch});if(!de.success&&de.error)throw new Error(de.error);D=de}let oe=null;if(typeof window<"u")try{const{useSettingsStore:de}=await ls(async()=>{const{useSettingsStore:ot}=await import("./D_05ko21.js").then(Wt=>Wt.s);return{useSettingsStore:ot}},__vite__mapDeps([0,1,2]),import.meta.url),He=de();await He.hydrate(),oe=He.providerSelection}catch(de){console.warn("[chat] Failed to load provider selection for new conversation",de)}const he=oe||{providerId:Wm,modelKey:Nm},ie={id:A,title:"New Conversation",messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:n.value||process.cwd?.()||"",source:k?.featureId?"cascade":"user",featureId:k?.featureId,providerId:he.providerId,providerModelKey:he.modelKey};if(D?.success&&D.worktreePath&&D.branch&&(ie.worktreePath=D.worktreePath,ie.worktreeBranch=D.branch,ie.cwd=D.worktreePath,ie.hasWorktree=!0,D.baseBranch&&(ie.baseBranch=D.baseBranch)),s.value.unshift(ie),o.value=A,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:A}}).catch(de=>{console.error("Failed to save active conversation:",de)}),!k?.featureId)try{const de=await Fh({conversationId:A,baseBranch:k?.baseBranch});if(de.success&&de.worktreePath&&de.branch){const He=s.value.find(ot=>ot.id===A);He&&(He.worktreePath=de.worktreePath,He.worktreeBranch=de.branch,He.cwd=de.worktreePath,He.hasWorktree=!0,de.baseBranch&&(He.baseBranch=de.baseBranch))}}catch(de){console.warn("[chat] Failed to create worktree for conversation",A,de)}return ir(A,!0),A}function $n(k){const R=s.value.find(A=>A.id===k);R&&(o.value=k,r.value=!0,R.cwd&&(n.value=R.cwd),!R.featureId&&R.worktreeBranch&&nr(k),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:k,isPanelOpen:!0}}).catch(A=>{console.error("Failed to save active conversation:",A)}))}async function an(k){const R=s.value.findIndex(D=>D.id===k);if(R===-1)return;const A=s.value[R];if(g.value===k&&(g.value=null),A.hasWorktree&&A.worktreePath&&A.worktreeBranch)try{await Pv({worktreePath:A.worktreePath,branch:A.worktreeBranch})}catch(D){console.warn("[chat] Failed to clean up worktree for conversation",k,D)}s.value.splice(R,1),c.delete(k),m.cancel(k),o.value===k&&(o.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(D=>{console.error("Failed to clear active conversation:",D)})),Et()}async function Oi(k,R,A){const D=s.value.find(he=>he.id===k);if(!D)return{success:!1,error:"Conversation not found"};if(!D.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const oe=A||D.baseBranch;try{const he=await ok({conversationId:k,commitMessage:R,baseBranch:oe,worktreePath:D.worktreePath,worktreeBranch:D.worktreeBranch,previewBranch:D.previewBranch});return he.success?(g.value===k&&(g.value=null),D.worktreePath=void 0,D.worktreeBranch=void 0,D.hasWorktree=!1,D.baseBranch=void 0,D.previewBranch=void 0,D.finalized=!0,D.updatedAt=new Date().toISOString(),Et()):he.rebaseInProgress&&await Cn(k,D.worktreePath,oe||"main",R),he}catch(he){return{success:!1,error:he instanceof Error?he.message:String(he)}}}async function xs(k,R){const A=s.value.find(oe=>oe.id===k);if(!A)return{success:!1,error:"Conversation not found"};if(!A.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const D=R||A.baseBranch;try{const oe=await ak({conversationId:k,baseBranch:D,worktreePath:A.worktreePath});return oe.rebaseInProgress?await Cn(k,A.worktreePath,D||"main","","sync"):oe.success&&(await Se(A),A.baseBranch=D,Et()),oe}catch(oe){return{success:!1,error:oe instanceof Error?oe.message:String(oe)}}}async function Cn(k,R,A,D,oe="finalize"){O.value={conversationId:k,worktreePath:R,baseBranch:A,commitMessage:D,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:oe,chatMessages:[],userGuidance:"",lifecycleState:"detected"};try{const he=await lk(R);O.value&&(O.value.files=he.files,O.value.loading=!1,gt("system",ek(he.files.length),"info"))}catch(he){O.value&&(O.value.error=he instanceof Error?he.message:String(he),O.value.loading=!1)}}function gt(k,R,A="info",D){O.value&&O.value.chatMessages.push(Gy(k,R,A,D))}async function xr(k,R){if(!O.value)return!1;try{const A=await ck({worktreePath:O.value.worktreePath,filePath:k,content:R});return A.success&&O.value&&O.value.resolvedFiles.add(k),A.success}catch{return!1}}async function ys(){if(!O.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:k,commitMessage:R,baseBranch:A,mode:D,worktreePath:oe}=O.value;try{const he=s.value.find(de=>de.id===k),ie=await uk({mode:D,conversationId:k,commitMessage:R,baseBranch:A,worktreePath:oe,worktreeBranch:he?.worktreeBranch,previewBranch:he?.previewBranch});if(ie.success){if(D==="finalize"){g.value===k&&(g.value=null);const de=s.value.find(He=>He.id===k);de&&(de.worktreePath=void 0,de.worktreeBranch=void 0,de.hasWorktree=!1,de.baseBranch=void 0,de.previewBranch=void 0,de.finalized=!0,de.updatedAt=new Date().toISOString(),Et())}else if(D==="sync"){const de=s.value.find(He=>He.id===k);de&&(await Se(de),de.baseBranch=A,de.updatedAt=new Date().toISOString(),Et())}O.value=null}else ie.rebaseInProgress&&await Cn(k,oe,A,R,D);return ie}catch(he){return{success:!1,error:he instanceof Error?he.message:String(he)}}}async function vi(){if(!O.value)return!1;try{const k=await Jh(O.value.worktreePath);return O.value=null,k.success}catch{return O.value=null,!1}}async function Qn(k){if(!O.value)return!1;const R=O.value.files.find(A=>A.path===k);if(!R)return!1;try{const A=await hk({worktreePath:O.value.worktreePath,filePath:k,conflictContent:R.content,userGuidance:O.value.userGuidance||void 0});if(A.success&&A.resolvedContent!==void 0){R.content=A.resolvedContent;const D=await xr(k,A.resolvedContent);return D?gt("assistant",`Resolved: ${k}`,"success",k):gt("assistant",`Failed to write resolved content for ${k}`,"error",k),D}return gt("assistant",`Failed to resolve ${k}: ${A.error||"Unknown error"}`,"error",k),!1}catch(A){const D=A instanceof Error?A.message:String(A);return gt("assistant",`Error resolving ${k}: ${D}`,"error",k),!1}}async function bi(){if(!O.value)return;const k=Jy(O.value.files,O.value.resolvedFiles);if(k.length===0){gt("system","All files are already resolved.","info");return}b=new AbortController;const R=b.signal;O.value.lifecycleState="resolving";const A=O.value.userGuidance;A&>("user",A),gt("system",tk(k.length),"info");let D=0,oe=0;const he=Ky(k,3);for(const de of he){if(!O.value||R.aborted)break;for(const ot of de)gt("assistant",`Resolving: ${ot.path}...`,"progress",ot.path);const He=await Promise.all(de.map(ot=>Qn(ot.path)));for(const ot of He)ot?D++:oe++}if(b=null,!O.value||R.aborted)return;const ie=Hy(D,oe);O.value.lifecycleState=ie.succeeded?"resolved":"failed",gt("system",ie.message,"summary")}async function ks(){if(!O.value)return;b&&(b.abort(),b=null);const{conversationId:k,worktreePath:R,baseBranch:A,commitMessage:D,mode:oe}=O.value;gt("system","Resolution cancelled. Resetting conflict state...","info");try{await Jh(R)}catch{}O.value=null,gt("system","Conflict resolution aborted and reset.","info")}async function yr(k){const R=s.value.find(A=>A.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 A=await rk({conversationId:k,worktreePath:R.worktreePath,baseBranch:R.baseBranch});return A.success&&A.previewBranch&&(R.previewBranch=A.previewBranch,g.value=k,R.updatedAt=new Date().toISOString(),Et()),{success:A.success,error:A.error}}catch(A){return{success:!1,error:A instanceof Error?A.message:String(A)}}}async function or(k){const R=s.value.find(A=>A.id===k);if(!R)return{success:!1,error:"Conversation not found"};if(!R.previewBranch||!R.baseBranch)return g.value=null,{success:!1,error:"No active preview"};try{const A=await nk({previewBranch:R.previewBranch,baseBranch:R.baseBranch});return A.success&&(R.previewBranch=void 0,g.value=null,R.updatedAt=new Date().toISOString(),Et()),{success:A.success,error:A.error}}catch(A){return{success:!1,error:A instanceof Error?A.message:String(A)}}}async function xi(k){const R=sk(g.value,k);if(R.kind==="end-current")return await or(R.id);if(R.kind==="swap"){const A=await or(R.endId);return A.success?await yr(R.startId):{success:!1,error:`Failed to end previous preview: ${A.error}`}}return await yr(R.id)}function yi(k){const R=k.trim();if(!R)return null;const A=s.value.filter(D=>D.featureId===R?!0:D.worktreeBranch?.trim()===R);return A.length===0?null:A.sort((D,oe)=>new Date(oe.updatedAt).getTime()-new Date(D.updatedAt).getTime())[0]||null}function Xr(k,R){const A=s.value.find(D=>D.id===k);A&&(A.title=R.trim(),A.updatedAt=new Date().toISOString(),wn(),Et())}function ki(k){const R=o.value;if(!R)return;const A=s.value.find(oe=>oe.id===R);if(!A||A.title!=="New Conversation")return;const D=A.messages.find(oe=>oe.role==="user");D&&(D.content.trim().length>0?A.title=H1(D.content):D.attachments&&D.attachments.length>0&&(A.title=D.attachments.length===1?"[Image] New Conversation":`[${D.attachments.length} Images] New Conversation`))}function ln(){const k=s.value.length;return{atLimit:k>=Nh,nearLimit:k>=zh,count:k}}async function wi(k,R){o.value||await bs();const A=kn(k,void 0,R);return ki(),vs(!0),A}function ws(k,R,A){const D=A??o.value;xe(k,R,D??void 0),D&&ir(D,!1)}function Ze(k,R){const A=R??o.value;Nt(k,{status:"complete"},A??void 0),A&&ir(A,!0)}return{messages:C,session:M,isPanelOpen:r,panelWidth:Me(e),permissionMode:Me(t),pendingPermission:X,pendingPlanApproval:V,cwd:Me(n),lastError:se,debugEvents:le,debugStreamEnabled:Me(u),providerSessionId:j,conversations:Me(s),archivedConversations:Me(i),activeConversationId:Me(o),conversationViewMode:Me(a),conflictState:Me(O),previewingConversationId:Me(g),isStreaming:ue,hasMessages:I,lastMessage:Z,isActiveConversationStreaming:W,hasConversations:N,hasArchivedConversations:L,activeConversation:S,conversationCount:z,isNearStorageLimit:ve,sortedConversations:H,sortedArchivedConversations:G,previewingConversation:te,streamingConversations:Me(l),initialize:T,togglePanel:ae,openPanel:re,closePanel:$e,setPanelWidth:Oe,setPermissionMode:E,setPendingPermission:B,clearPendingPermission:be,setPendingPlanApproval:Ae,clearPendingPlanApproval:Te,setCwd:Be,setProviderSessionId:st,clearProviderSession:vr,getProviderSessionId:qn,updateWorktreeBranch:zt,setConversationProviderSelection:nn,startConversationStreaming:sn,endConversationStreaming:jn,isConversationStreaming:F,addMessage:on,addUserMessage:kn,addAssistantMessage:Zt,updateMessage:Nt,resetMessageForReplay:ce,appendToMessage:xe,addToolToMessage:_e,updateToolInMessage:qe,initContentBlocks:Fe,appendContentBlock:$t,appendContentBlockWithSave:sr,updateBlockById:it,updateBlockWithSave:Yt,findToolUseBlock:br,batchSetMessageBlocks:Yn,syncContentFromBlocks:Do,setSessionStatus:Lr,startSession:ai,endSession:li,setSessionError:ci,setDebugStreamEnabled:hi,pushDebugEvent:ui,clearDebugEvents:di,clearMessages:fi,clearError:mi,loadConversations:pi,refreshServerConversations:gi,saveAllConversations:Et,saveCurrentConversation:vs,saveConversation:ir,createConversation:bs,selectConversation:$n,deleteConversation:an,archiveConversation:Qe,restoreArchivedConversation:Ye,deleteArchivedConversation:P,setConversationViewMode:me,findConversationByFeature:yi,syncConversationFeatureFromBranch:nr,renameConversation:Xr,checkStorageLimits:ln,finalizeConversation:Oi,rebaseConversation:xs,resolveConflictFile:xr,continueRebase:ys,abortRebase:vi,aiResolveConflictFile:Qn,aiResolveAllConflicts:bi,addConflictChatMessage:gt,cancelConflictResolution:ks,previewConversation:yr,unpreviewConversation:or,togglePreview:xi,isConversationPreviewing:ge,addUserMessageWithConversation:wi,appendToMessageWithSave:ws,completeMessageWithSave:Ze}});function dk(r={}){const e=dl(),t=300,n=5e3,s=250;let i=null,o=null,a=null,l=null,c=null,u=!1,h=!1;const d=Q(!1),m=Q(!1);let g=r;function O(I){g=I}async function b(){const I=g.getScrollPosition?.()??0,Z=await e.checkAndRefresh();return Z&&g.setScrollPosition&&(await Xt(),g.setScrollPosition(I)),Z}function x(){return d.value||!!e.activeContextMenu||!!e.activeDialog}async function w(){if(x()){m.value=!0;return}C()}async function S(){if(u){h=!0;return}u=!0;try{await b()}finally{u=!1,h&&(h=!1,C())}}function C(){o&&clearTimeout(o),o=setTimeout(()=>{o=null,S()},s)}function M(I){if(typeof window>"u")return;if(a&&a.readyState===WebSocket.OPEN){a.send(JSON.stringify({type:"watch",workingDirectory:I}));return}l&&(clearTimeout(l),l=null);const F=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;a=new WebSocket(F),a.onopen=()=>{a.send(JSON.stringify({type:"watch",workingDirectory:I}))},a.onmessage=W=>{try{JSON.parse(W.data).type==="git_changed"&&w()}catch{}},a.onclose=()=>{a=null,e.isPollingActive&&c&&(l=setTimeout(()=>{c&&M(c)},n))},a.onerror=()=>{}}function X(){l&&(clearTimeout(l),l=null),a&&(a.close(),a=null)}function V(I){I&&(c=I),!e.isPollingActive&&(e.startPolling(),c&&M(c))}function se(){X(),e.stopPolling()}function le(){d.value=!0,i&&(clearTimeout(i),i=null)}function ue(){i&&clearTimeout(i),i=setTimeout(async()=>{d.value=!1,m.value&&(m.value=!1,C())},t)}function j(){se(),i&&(clearTimeout(i),i=null),o&&(clearTimeout(o),o=null),u=!1,h=!1,c=null}return Ve(()=>[e.activeContextMenu,e.activeDialog],()=>{!e.activeContextMenu&&!e.activeDialog&&m.value&&!d.value&&(m.value=!1,C())}),{isUserInteracting:Me(d),isDeferredRefresh:Me(m),startPolling:V,stopPolling:se,startInteraction:le,endInteraction:ue,cleanup:j,setScrollCallbacks:O}}function fk(r){function e(s){if((s.ctrlKey||s.metaKey)&&s.key==="h"){s.preventDefault(),r.onScrollToHead();return}if(s.key==="Escape"){s.preventDefault(),r.onEscape();return}}function t(){document.addEventListener("keydown",e)}function n(){document.removeEventListener("keydown",e)}return{start:t,stop:n}}function mk(r){const e=Q({visible:!1,branchName:"",loading:!1,error:null});async function t(){e.value.loading=!0,e.value.error=null;const H=await r.checkoutBranch(e.value.branchName);e.value.loading=!1,H.success?e.value.visible=!1:e.value.error=H.error||"Unknown error"}const n=Q({visible:!1,fromCommit:"",loading:!1,error:null});async function s(H){n.value.loading=!0,n.value.error=null;const G=await r.createBranch(H.name,n.value.fromCommit);n.value.loading=!1,G.success?(H.checkout&&await r.checkoutBranch(H.name),n.value.visible=!1):n.value.error=G.error||"Unknown error"}const i=Q({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function o(H){i.value.loading=!0,i.value.error=null;const{branchName:G,isLocal:te}=i.value,ge=H?.force??i.value.force,me=te?await r.deleteLocalBranch(G,ge):await r.deleteRemoteBranch(G);i.value.loading=!1,me.success?i.value.visible=!1:i.value.error=me.error||"Unknown error"}const a=Q({visible:!1,branchName:"",newName:"",loading:!1,error:null});async function l(){if(!a.value.newName.trim()){a.value.error="Branch name is required";return}a.value.loading=!0,a.value.error=null;const H=await r.renameBranch(a.value.branchName,a.value.newName.trim());a.value.loading=!1,H.success?a.value.visible=!1:a.value.error=H.error||"Unknown error"}const c=Q({visible:!1,branchName:"",loading:!1,error:null});async function u(H){c.value.loading=!0,c.value.error=null;const G=await r.mergeBranch(c.value.branchName,H);c.value.loading=!1,G.success?c.value.visible=!1:c.value.error=G.error||"Unknown error"}const h=Q({visible:!1,branchName:"",loading:!1,error:null});async function d(){h.value.loading=!0,h.value.error=null;const H=await r.rebaseBranch(h.value.branchName);h.value.loading=!1,H.success?h.value.visible=!1:h.value.error=H.error||"Unknown error"}const m=Q({visible:!1,branchName:"",loading:!1,error:null});async function g(H){m.value.loading=!0,m.value.error=null;const G=await r.pushBranch(m.value.branchName,H.remote,H.force,H.forceWithLease);m.value.loading=!1,G.success?m.value.visible=!1:m.value.error=G.error||"Unknown error"}const O=Q({visible:!1,branchName:"",loading:!1,error:null});async function b(H){O.value.loading=!0,O.value.error=null;const G=await r.pullBranch(O.value.branchName,H.remote,H.noFastForward,H.squash);O.value.loading=!1,G.success?O.value.visible=!1:O.value.error=G.error||"Unknown error"}const x=Q({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function w(H){x.value.loading=!0,x.value.error=null;const G=await r.cherryPickCommit(x.value.commitHash,H.recordOrigin,H.noCommit);x.value.loading=!1,G.success?x.value.visible=!1:x.value.error=G.error||"Unknown error"}const S=Q({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function C(H){S.value.loading=!0,S.value.error=null;const G=await r.resetToCommit(S.value.commitHash,H.mode);S.value.loading=!1,G.success?S.value.visible=!1:S.value.error=G.error||"Unknown error"}const M=Q({visible:!1,commitHash:"",loading:!1,error:null});async function X(H){M.value.loading=!0,M.value.error=null;const G=await r.createTag(H.name,M.value.commitHash,H.annotated,H.message,H.pushToRemote);M.value.loading=!1,G.success?M.value.visible=!1:M.value.error=G.error||"Unknown error"}const V=Q({visible:!1,tagName:"",loading:!1,error:null});async function se(H){V.value.loading=!0,V.value.error=null;const G=await r.deleteTag(V.value.tagName,H.deleteFromRemote?H.remote||"origin":void 0);V.value.loading=!1,G.success?V.value.visible=!1:V.value.error=G.error||"Unknown error"}const le=Q({visible:!1,tagName:"",loading:!1,tagDetail:null}),ue=Q({visible:!1,loading:!1,error:null});async function j(H){ue.value.loading=!0,ue.value.error=null;const G=await r.stashChanges(H.message,H.includeUntracked);ue.value.loading=!1,G.success?ue.value.visible=!1:ue.value.error=G.error||"Unknown error"}const I=Q({visible:!1,stashIndex:0,loading:!1,error:null}),Z=Q("");async function F(H){I.value.loading=!0,I.value.error=null;const G=await r.stashBranch(I.value.stashIndex,H);I.value.loading=!1,G.success?I.value.visible=!1:I.value.error=G.error||"Unknown error"}const W=Q({visible:!1,loading:!1,error:null});async function N(H){W.value.loading=!0,W.value.error=null;const G=await r.resetWorking(H.mode);W.value.loading=!1,G.success?W.value.visible=!1:W.value.error=G.error||"Unknown error"}const L=Q({visible:!1,loading:!1,error:null});async function z(){L.value.loading=!0,L.value.error=null;const H=await r.cleanUntracked();L.value.loading=!1,H.success?L.value.visible=!1:L.value.error=H.error||"Unknown error"}const ve=K(()=>e.value.visible||n.value.visible||i.value.visible||a.value.visible||c.value.visible||h.value.visible||m.value.visible||O.value.visible||x.value.visible||S.value.visible||M.value.visible||V.value.visible||le.value.visible||ue.value.visible||I.value.visible||W.value.visible||L.value.visible);return{checkoutDialog:e,confirmCheckout:t,createBranchDialog:n,confirmCreateBranch:s,deleteBranchDialog:i,confirmDeleteBranch:o,renameDialog:a,confirmRenameBranch:l,mergeDialog:c,confirmMerge:u,rebaseDialog:h,confirmRebase:d,pushDialog:m,confirmPush:g,pullDialog:O,confirmPull:b,cherryPickDialog:x,confirmCherryPick:w,resetDialog:S,confirmReset:C,tagCreateDialog:M,confirmTagCreate:X,tagDeleteDialog:V,confirmTagDelete:se,tagDetailDialog:le,stashDialog:ue,confirmStash:j,stashBranchDialog:I,stashBranchInput:Z,confirmStashBranch:F,resetWorkingDialog:W,confirmResetWorking:N,cleanUntrackedDialog:L,confirmCleanUntracked:z,isAnyDialogOpen:ve}}function pk(r,e){const t=Q({visible:!1,x:0,y:0});function n(q,Oe){t.value={visible:!0,x:q,y:Oe},setTimeout(()=>{t.value.visible=!1},1500)}const s=Q({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function i(q){s.value={visible:!0,...q},r.setActiveContextMenu({type:"branch",props:q,position:{x:q.x,y:q.y}})}function o(){s.value.visible=!1,r.clearActiveContextMenu()}function a(){o(),e.checkoutDialog.value={visible:!0,branchName:s.value.branch,loading:!1,error:null}}function l(){const q=s.value.branch;o(),e.renameDialog.value={visible:!0,branchName:q,newName:q,loading:!1,error:null}}function c(){const{branch:q,isLocal:Oe}=s.value;o(),e.deleteBranchDialog.value={visible:!0,branchName:q,isLocal:Oe,force:!1,loading:!1,error:null}}function u(){const q=s.value.branch;o(),e.mergeDialog.value={visible:!0,branchName:q,loading:!1,error:null}}function h(){const q=s.value.branch;o(),e.rebaseDialog.value={visible:!0,branchName:q,loading:!1,error:null}}function d(){const q=s.value.branch;o(),e.pushDialog.value={visible:!0,branchName:q,loading:!1,error:null}}function m(){const q=s.value.branch;o(),e.pullDialog.value={visible:!0,branchName:q,loading:!1,error:null}}async function g(){const q=s.value.branch;o(),await r.fetchBranch(q)}async function O(){const{branch:q,x:Oe,y:Be}=s.value;o(),(await r.copyToClipboard(q)).success&&n(Oe,Be)}function b(){o(),e.createBranchDialog.value={visible:!0,fromCommit:s.value.commitHash,loading:!1,error:null}}const x=Q({visible:!1,commit:null,x:0,y:0});function w(q){x.value={visible:!0,commit:q.commit,x:q.x,y:q.y},r.setActiveContextMenu({type:"commit",props:q,position:{x:q.x,y:q.y}})}function S(){x.value.visible=!1,r.clearActiveContextMenu()}function C(q){return q===!1?!1:typeof q=="object"&&q!==null&&"success"in q?!!q.success:!0}function M(q){const Oe=x.value.commit;if(!Oe)return!1;S();const Be=q(Oe);return Be&&typeof Be.then=="function"?Be.then(C).catch(()=>!1):C(Be)}function X(){M(q=>{e.tagCreateDialog.value={visible:!0,commitHash:q.hash,loading:!1,error:null}})}function V(){M(q=>{e.createBranchDialog.value={visible:!0,fromCommit:q.hash,loading:!1,error:null}})}function se(){M(q=>{e.checkoutDialog.value={visible:!0,branchName:q.hash,loading:!1,error:null}})}function le(){M(q=>{e.cherryPickDialog.value={visible:!0,commitHash:q.hash,commitMessage:q.message,loading:!1,error:null}})}async function ue(){await M(q=>r.revertCommit(q.hash))}function j(){M(q=>{e.mergeDialog.value={visible:!0,branchName:q.shortHash,loading:!1,error:null}})}function I(){M(q=>{e.resetDialog.value={visible:!0,commitHash:q.hash,commitMessage:q.message,loading:!1,error:null}})}async function Z(){const{x:q,y:Oe}=x.value;await M(st=>r.copyToClipboard(st.hash))&&n(q,Oe)}async function F(){const{x:q,y:Oe}=x.value;await M(st=>r.copyCommitSubject(st))&&n(q,Oe)}const W=Q({visible:!1,tag:"",x:0,y:0,commitHash:""});function N(q){W.value={visible:!0,...q},r.setActiveContextMenu({type:"tag",props:q,position:{x:q.x,y:q.y}})}function L(){W.value.visible=!1,r.clearActiveContextMenu()}async function z(){const q=W.value.tag;L(),e.tagDetailDialog.value={visible:!0,tagName:q,loading:!0,tagDetail:null};const Oe=await r.getTagDetail(q);e.tagDetailDialog.value.loading=!1,Oe.success&&Oe.data&&(e.tagDetailDialog.value.tagDetail=Oe.data)}function ve(){const q=W.value.tag;L(),e.tagDeleteDialog.value={visible:!0,tagName:q,loading:!1,error:null}}async function H(){const q=W.value.tag;L(),await r.pushTag(q)}async function G(){const{tag:q,x:Oe,y:Be}=W.value;L(),(await r.copyToClipboard(q)).success&&n(Oe,Be)}const te=Q({visible:!1,x:0,y:0});function ge(q){te.value={visible:!0,...q},r.setActiveContextMenu({type:"uncommitted",props:q,position:{x:q.x,y:q.y}})}function me(){te.value.visible=!1,r.clearActiveContextMenu()}function Se(){me(),e.stashDialog.value={visible:!0,loading:!1,error:null}}function Qe(){me(),e.resetWorkingDialog.value={visible:!0,loading:!1,error:null}}function Ye(){me(),e.cleanUntrackedDialog.value={visible:!0,loading:!1,error:null}}const P=Q({visible:!1,stash:null,x:0,y:0});function T(q){P.value={visible:!0,stash:q.stash,x:q.x,y:q.y},r.setActiveContextMenu({type:"stash",props:q,position:{x:q.x,y:q.y}})}function E(){P.value.visible=!1,r.clearActiveContextMenu()}function B(q){const Oe=P.value.stash;if(!Oe)return!1;E();const Be=q(Oe);return Be&&typeof Be.then=="function"?Be.then(C).catch(()=>!1):C(Be)}async function be(){await B(q=>r.applyStash(q.index))}async function Ae(){await B(q=>r.popStash(q.index))}async function Te(){await B(q=>r.dropStash(q.index))}function ae(){B(q=>{e.stashBranchDialog.value={visible:!0,stashIndex:q.index,loading:!1,error:null}})}async function re(){const{x:q,y:Oe}=P.value;await B(st=>r.copyToClipboard(`stash@{${st.index}}`))&&n(q,Oe)}async function $e(){const{x:q,y:Oe}=P.value;await B(st=>r.copyToClipboard(st.hash))&&n(q,Oe)}return{copyFeedback:t,showCopyFeedback:n,branchMenu:s,handleBranchContextMenu:i,closeBranchMenu:o,handleBranchCheckout:a,handleBranchRename:l,handleBranchDelete:c,handleBranchMerge:u,handleBranchRebase:h,handleBranchPush:d,handleBranchPull:m,handleBranchFetch:g,handleBranchCopyName:O,handleBranchCreateBranch:b,commitMenu:x,handleCommitContextMenu:w,closeCommitMenu:S,handleCommitAddTag:X,handleCommitCreateBranch:V,handleCommitCheckout:se,handleCommitCherryPick:le,handleCommitRevert:ue,handleCommitMergeInto:j,handleCommitReset:I,handleCommitCopyHash:Z,handleCommitCopySubject:F,tagMenu:W,handleTagContextMenu:N,closeTagMenu:L,handleTagViewDetails:z,handleTagDelete:ve,handleTagPush:H,handleTagCopyName:G,uncommittedMenu:te,handleUncommittedContextMenu:ge,closeUncommittedMenu:me,handleUncommittedStash:Se,handleUncommittedReset:Qe,handleUncommittedClean:Ye,stashMenu:P,handleStashContextMenu:T,closeStashMenu:E,handleStashApply:be,handleStashPop:Ae,handleStashDrop:Te,handleStashCreateBranch:ae,handleStashCopyName:re,handleStashCopyHash:$e}}const gk={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Ok={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},vk={class:"text-sm font-mono text-retro-text"},bk={class:"p-4"},xk={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},yk={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},kk=["disabled"],wk=["disabled"],Rt=Ie({__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(r,{emit:e}){const t=r,n=e;function s(i){i.key==="Escape"&&n("close"),i.key==="Enter"&&!t.loading&&(i.preventDefault(),n("confirm"))}return Ve(()=>t.visible,i=>{i?document.addEventListener("keydown",s):document.removeEventListener("keydown",s)}),kt(()=>{document.removeEventListener("keydown",s)}),(i,o)=>(v(),pe(Pr,{to:"body"},[J(pn,{"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:ct(()=>[r.visible?(v(),y("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:o[3]||(o[3]=kr(a=>n("close"),["self"]))},[f("div",gk,[f("div",Ok,[f("h3",vk,_(r.title),1),f("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:o[0]||(o[0]=a=>n("close"))},[J(p(wt),{class:"h-4 w-4"})])]),f("div",bk,[r.error?(v(),y("div",xk,_(r.error),1)):U("",!0),Im(i.$slots,"default")]),f("div",yk,[f("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:r.loading,onClick:o[1]||(o[1]=a=>n("close"))},_(r.cancelLabel),9,kk),f("button",{type:"button",class:Re(["px-3 py-1.5 text-xs font-mono rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",[r.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:r.loading,onClick:o[2]||(o[2]=a=>n("confirm"))},_(r.loading?"Loading...":r.confirmLabel),11,wk)])])])):U("",!0)]),_:3})]))}}),Sk={class:"text-retro-text text-sm font-mono mb-4"},$k={class:"text-retro-cyan"},Ck={class:"space-y-3"},Qk={class:"flex items-center gap-2 cursor-pointer"},Pk={class:"flex items-center gap-2 cursor-pointer"},Tk={class:"flex items-center gap-2 cursor-pointer"},Mk=Ie({__name:"MergeDialog",props:{visible:{type:Boolean},branchName:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q(!1),i=Q(!1),o=Q(!1);function a(){n("confirm",{noCommit:s.value,noFastForward:i.value,squash:o.value})}return Ve(()=>t.visible,l=>{l&&(s.value=!1,i.value=!1,o.value=!1)}),(l,c)=>(v(),pe(Rt,{title:"Merge Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Merge",onClose:c[3]||(c[3]=u=>n("close")),onConfirm:a},{default:ct(()=>[f("p",Sk,[c[4]||(c[4]=Xe(" Merge ",-1)),f("span",$k,_(r.branchName),1),c[5]||(c[5]=Xe(" into current branch ",-1))]),f("div",Ck,[f("label",Qk,[je(f("input",{"onUpdate:modelValue":c[0]||(c[0]=u=>et(s)?s.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(s)]]),c[6]||(c[6]=f("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),f("label",Pk,[je(f("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>et(i)?i.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(i)]]),c[7]||(c[7]=f("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),f("label",Tk,[je(f("input",{"onUpdate:modelValue":c[2]||(c[2]=u=>et(o)?o.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(o)]]),c[8]||(c[8]=f("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),Ak={class:"text-retro-text text-sm font-mono mb-2"},_k={class:"text-retro-cyan"},Rk={class:"space-y-3 mt-4"},Bk={class:"flex items-center gap-2 cursor-pointer"},Zk=Ie({__name:"DeleteBranchDialog",props:{visible:{type:Boolean},branchName:{},isLocal:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q(!1);function i(){n("confirm",{force:s.value})}return Ve(()=>t.visible,o=>{o&&(s.value=!1)}),(o,a)=>(v(),pe(Rt,{title:"Delete Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Delete","confirm-danger":!0,onClose:a[1]||(a[1]=l=>n("close")),onConfirm:i},{default:ct(()=>[a[4]||(a[4]=f("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)),f("p",Ak,[Xe(" Delete "+_(r.isLocal?"local":"remote")+" branch ",1),f("span",_k,_(r.branchName),1),a[2]||(a[2]=Xe("? ",-1))]),f("div",Rk,[f("label",Bk,[je(f("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>et(s)?s.value=l:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(s)]]),a[3]||(a[3]=f("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),Ek={class:"text-retro-text text-sm font-mono mb-4"},Dk={class:"text-retro-cyan"},Lk={class:"space-y-3"},Xk=["value"],Ik={class:"flex items-center gap-2 cursor-pointer"},Vk=["checked"],zk={class:"flex items-center gap-2 cursor-pointer"},Nk=["checked"],Wk={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},qk=Ie({__name:"PushDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q("origin"),i=Q(!1),o=Q(!1);function a(u){i.value=u,u&&(o.value=!1)}function l(u){o.value=u,u&&(i.value=!1)}function c(){n("confirm",{remote:s.value,force:i.value,forceWithLease:o.value})}return Ve(()=>t.visible,u=>{u&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",i.value=!1,o.value=!1)}),(u,h)=>(v(),pe(Rt,{title:"Push Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Push",onClose:h[3]||(h[3]=d=>n("close")),onConfirm:c},{default:ct(()=>[f("p",Ek,[h[4]||(h[4]=Xe(" Push ",-1)),f("span",Dk,_(r.branchName),1),h[5]||(h[5]=Xe(" to remote ",-1))]),f("div",Lk,[f("div",null,[h[6]||(h[6]=f("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),je(f("select",{"onUpdate:modelValue":h[0]||(h[0]=d=>et(s)?s.value=d: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"},[(v(!0),y(ke,null,Ne(r.remotes,d=>(v(),y("option",{key:d,value:d},_(d),9,Xk))),128))],512),[[gs,p(s)]])]),f("label",Ik,[f("input",{checked:p(i),type:"checkbox",class:"accent-retro-cyan",onChange:h[1]||(h[1]=d=>a(d.target.checked))},null,40,Vk),h[7]||(h[7]=f("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),f("label",zk,[f("input",{checked:p(o),type:"checkbox",class:"accent-retro-cyan",onChange:h[2]||(h[2]=d=>l(d.target.checked))},null,40,Nk),h[8]||(h[8]=f("span",{class:"text-retro-muted text-sm"},"Force with lease (safer force push)",-1))]),p(i)||p(o)?(v(),y("div",Wk,_(p(i)?"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)):U("",!0)])]),_:1},8,["visible","loading","error"]))}}),jk={class:"text-retro-text text-sm font-mono mb-4"},Yk={class:"text-retro-cyan"},Fk={class:"space-y-3"},Uk=["value"],Gk={class:"flex items-center gap-2 cursor-pointer"},Hk={class:"flex items-center gap-2 cursor-pointer"},Kk=Ie({__name:"PullDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q("origin"),i=Q(!1),o=Q(!1);function a(){n("confirm",{remote:s.value,noFastForward:i.value,squash:o.value})}return Ve(()=>t.visible,l=>{l&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",i.value=!1,o.value=!1)}),(l,c)=>(v(),pe(Rt,{title:"Pull Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Pull",onClose:c[3]||(c[3]=u=>n("close")),onConfirm:a},{default:ct(()=>[f("p",jk,[c[4]||(c[4]=Xe(" Pull ",-1)),f("span",Yk,_(r.branchName),1),c[5]||(c[5]=Xe(" from remote ",-1))]),f("div",Fk,[f("div",null,[c[6]||(c[6]=f("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),je(f("select",{"onUpdate:modelValue":c[0]||(c[0]=u=>et(s)?s.value=u: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"},[(v(!0),y(ke,null,Ne(r.remotes,u=>(v(),y("option",{key:u,value:u},_(u),9,Uk))),128))],512),[[gs,p(s)]])]),f("label",Gk,[je(f("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>et(i)?i.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(i)]]),c[7]||(c[7]=f("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),f("label",Hk,[je(f("input",{"onUpdate:modelValue":c[2]||(c[2]=u=>et(o)?o.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(o)]]),c[8]||(c[8]=f("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),Jk={class:"text-retro-text text-sm font-mono mb-4"},ew={class:"text-retro-cyan"},tw={class:"text-retro-cyan"},rw={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},nw={class:"text-retro-cyan"},sw={class:"text-retro-cyan"},iw=Ie({__name:"RebaseDialog",props:{visible:{type:Boolean},branchName:{},ontoBranch:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e;return(n,s)=>(v(),pe(Rt,{title:"Rebase Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Rebase",onClose:s[0]||(s[0]=i=>t("close")),onConfirm:s[1]||(s[1]=i=>t("confirm"))},{default:ct(()=>[f("p",Jk,[s[2]||(s[2]=Xe(" Rebase ",-1)),f("span",ew,_(r.branchName),1),s[3]||(s[3]=Xe(" onto ",-1)),f("span",tw,_(r.ontoBranch),1)]),f("div",rw,[s[4]||(s[4]=Xe(" This will rewrite commit history. Commits from ",-1)),f("span",nw,_(r.branchName),1),s[5]||(s[5]=Xe(" will be replayed on top of ",-1)),f("span",sw,_(r.ontoBranch),1),s[6]||(s[6]=Xe(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),ow={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},aw={class:"text-sm font-mono text-retro-cyan"},lw={class:"text-xs font-mono text-retro-text mt-1 truncate"},cw={class:"space-y-3"},uw={class:"flex items-start gap-2 cursor-pointer group"},hw={class:"flex items-start gap-2 cursor-pointer group"},dw=Ie({__name:"CherryPickDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e,n=Q(!1),s=Q(!1);function i(){t("confirm",{recordOrigin:n.value,noCommit:s.value})}function o(){n.value=!1,s.value=!1,t("close")}return(a,l)=>(v(),pe(Rt,{title:"Cherry-Pick Commit",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Cherry-Pick",onClose:o,onConfirm:i},{default:ct(()=>[f("div",ow,[l[2]||(l[2]=f("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),f("div",aw,_(r.commitHash.slice(0,7)),1),f("div",lw,_(r.commitMessage.split(`
|
|
10
10
|
`)[0]),1)]),f("div",cw,[f("label",uw,[je(f("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>et(n)?n.value=c:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[pr,p(n)]]),l[3]||(l[3]=f("div",null,[f("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Record origin (-x) "),f("p",{class:"text-xs font-mono text-retro-muted mt-0.5"},' Append "(cherry picked from commit ...)" to the commit message ')],-1))]),f("label",hw,[je(f("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>et(s)?s.value=c:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[pr,p(s)]]),l[4]||(l[4]=f("div",null,[f("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," No commit "),f("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"]))}}),fw={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},mw={class:"text-sm font-mono text-retro-cyan"},pw={class:"text-xs font-mono text-retro-text mt-1 truncate"},gw={class:"space-y-2"},Ow=["value"],vw={key:0,class:"mt-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},bw=Ie({__name:"ResetDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e,n=Q("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 i(){t("confirm",{mode:n.value})}function o(){n.value="mixed",t("close")}return(a,l)=>(v(),pe(Rt,{title:"Reset to Commit",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Reset","confirm-danger":p(n)==="hard",onClose:o,onConfirm:i},{default:ct(()=>[f("div",fw,[l[1]||(l[1]=f("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Reset to",-1)),f("div",mw,_(r.commitHash.slice(0,7)),1),f("div",pw,_(r.commitMessage.split(`
|
|
11
11
|
`)[0]),1)]),f("div",gw,[l[2]||(l[2]=f("div",{class:"text-xs font-mono text-retro-muted mb-2"},"Reset mode",-1)),(v(),y(ke,null,Ne(s,c=>f("label",{key:c.value,class:Re(["flex items-start gap-2 p-2 rounded cursor-pointer group border transition-colors",[p(n)===c.value?"border-retro-cyan bg-retro-cyan/5":"border-transparent hover:bg-retro-panel"]])},[je(f("input",{"onUpdate:modelValue":l[0]||(l[0]=u=>et(n)?n.value=u:null),type:"radio",name:"reset-mode",value:c.value,class:"mt-0.5 accent-retro-cyan"},null,8,Ow),[[kc,p(n)]]),f("div",null,[f("span",{class:Re(["text-sm font-mono transition-colors",[c.value==="hard"?"text-retro-red":"text-retro-text",p(n)===c.value?"text-retro-cyan":""]])},_(c.label),3),f("p",{class:Re(["text-xs font-mono mt-0.5",c.value==="hard"?"text-retro-red/70":"text-retro-muted"])},_(c.description),3)])],2)),64))]),p(n)==="hard"?(v(),y("div",vw," Warning: Hard reset will permanently discard all uncommitted changes in your working directory and staging area. This action cannot be undone. ")):U("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),xw={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},yw={class:"text-sm font-mono text-retro-cyan"},kw={class:"mb-4"},ww={class:"mb-3"},Sw={class:"flex items-start gap-2 cursor-pointer group"},$w={key:0,class:"mb-4"},Cw={class:"space-y-2"},Qw={class:"flex items-start gap-2 cursor-pointer group"},Pw=["disabled"],Tw={key:0,class:"ml-6"},Mw=["value"],Aw=Ie({__name:"TagCreateDialog",props:{visible:{type:Boolean},commitHash:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e,n=Q(""),s=Q(!1),i=Q(""),o=Q(!1),a=Q(""),l=K(()=>n.value.trim().length>0);function c(){if(!l.value)return;const h={name:n.value.trim(),annotated:s.value};s.value&&i.value.trim()&&(h.message=i.value.trim()),o.value&&a.value&&(h.pushToRemote=a.value),t("confirm",h)}function u(){n.value="",s.value=!1,i.value="",o.value=!1,a.value="",t("close")}return Ve(()=>s.value,h=>{h||(i.value="")}),(h,d)=>(v(),pe(Rt,{title:"Create Tag",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Create Tag",onClose:u,onConfirm:c},{default:ct(()=>[f("div",xw,[d[5]||(d[5]=f("div",{class:"text-xs font-mono text-retro-muted mb-1"},"At commit",-1)),f("div",yw,_(r.commitHash.slice(0,7)),1)]),f("div",kw,[d[6]||(d[6]=f("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag name",-1)),je(f("input",{"onUpdate:modelValue":d[0]||(d[0]=m=>et(n)?n.value=m: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),[[_t,p(n)]])]),f("div",ww,[f("label",Sw,[je(f("input",{"onUpdate:modelValue":d[1]||(d[1]=m=>et(s)?s.value=m:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[pr,p(s)]]),d[7]||(d[7]=f("div",null,[f("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Annotated tag "),f("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Create a full tag object with message and tagger info ")],-1))])]),p(s)?(v(),y("div",$w,[d[8]||(d[8]=f("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag message",-1)),je(f("textarea",{"onUpdate:modelValue":d[2]||(d[2]=m=>et(i)?i.value=m: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),[[_t,p(i)]])])):U("",!0),f("div",Cw,[f("label",Qw,[je(f("input",{"onUpdate:modelValue":d[3]||(d[3]=m=>et(o)?o.value=m:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan",disabled:r.remotes.length===0},null,8,Pw),[[pr,p(o)]]),f("div",null,[f("span",{class:Re(["text-sm font-mono transition-colors",r.remotes.length===0?"text-retro-muted":"text-retro-text group-hover:text-retro-cyan"])}," Push to remote ",2)])]),p(o)&&r.remotes.length>0?(v(),y("div",Tw,[je(f("select",{"onUpdate:modelValue":d[4]||(d[4]=m=>et(a)?a.value=m: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"},[d[9]||(d[9]=f("option",{value:"",disabled:"",class:"text-retro-muted"},"Select remote",-1)),(v(!0),y(ke,null,Ne(r.remotes,m=>(v(),y("option",{key:m,value:m},_(m),9,Mw))),128))],512),[[gs,p(a)]])])):U("",!0)])]),_:1},8,["visible","loading","error"]))}}),_w={class:"text-retro-text text-sm font-mono mb-2"},Rw={class:"text-retro-cyan"},Bw={class:"space-y-3 mt-4"},Zw={class:"flex items-center gap-2 cursor-pointer"},Ew={key:0,class:"ml-6"},Dw=["value"],Lw=Ie({__name:"TagDeleteDialog",props:{visible:{type:Boolean},tagName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q(!1),i=Q("origin");function o(){n("confirm",{deleteFromRemote:s.value,remote:s.value?i.value:void 0})}return Ve(()=>t.visible,a=>{a&&(s.value=!1,i.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin")}),(a,l)=>(v(),pe(Rt,{title:"Delete Tag",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Delete","confirm-danger":!0,onClose:l[2]||(l[2]=c=>n("close")),onConfirm:o},{default:ct(()=>[l[7]||(l[7]=f("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)),f("p",_w,[l[3]||(l[3]=Xe(" Delete tag ",-1)),f("span",Rw,_(r.tagName),1),l[4]||(l[4]=Xe("? ",-1))]),f("div",Bw,[f("label",Zw,[je(f("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>et(s)?s.value=c:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(s)]]),l[5]||(l[5]=f("span",{class:"text-retro-muted text-sm"},"Also delete from remote",-1))]),p(s)?(v(),y("div",Ew,[l[6]||(l[6]=f("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Remote",-1)),je(f("select",{"onUpdate:modelValue":l[1]||(l[1]=c=>et(i)?i.value=c: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"},[(v(!0),y(ke,null,Ne(r.remotes,c=>(v(),y("option",{key:c,value:c},_(c),9,Dw))),128))],512),[[gs,p(i)]])])):U("",!0)])]),_:1},8,["visible","loading","error"]))}}),Xw={class:"mb-4"},Iw={class:"text-retro-cyan text-sm font-mono"},Vw={class:"mb-4"},zw={class:"text-retro-text text-sm font-mono"},Nw={class:"mb-4"},Ww={class:"text-retro-text text-sm font-mono break-all select-all"},qw={class:"mb-4"},jw={class:"text-retro-text text-sm font-mono"},Yw={class:"text-retro-muted"},Fw={class:"mb-4"},Uw={class:"text-retro-text text-sm font-mono"},Gw={key:1,class:"mb-2"},Hw={class:"p-2 text-sm font-mono text-retro-text bg-retro-panel border border-retro-border rounded whitespace-pre-wrap"},Kw={key:1,class:"text-retro-muted text-sm font-mono text-center py-4"},Jw=Ie({__name:"TagDetailDialog",props:{visible:{type:Boolean},tagName:{},tagDetail:{},loading:{type:Boolean,default:!1}},emits:["close"],setup(r,{emit:e}){const t=e;return(n,s)=>(v(),pe(Rt,{title:"Tag Details",visible:r.visible,loading:r.loading,"confirm-label":"Close","cancel-label":"Close",onClose:s[0]||(s[0]=i=>t("close")),onConfirm:s[1]||(s[1]=i=>t("close"))},{default:ct(()=>[f("div",Xw,[s[2]||(s[2]=f("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tag",-1)),f("p",Iw,_(r.tagName),1)]),r.tagDetail?(v(),y(ke,{key:0},[f("div",Vw,[s[3]||(s[3]=f("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Type",-1)),f("p",zw,_(r.tagDetail.isAnnotated?"Annotated":"Lightweight"),1)]),f("div",Nw,[s[4]||(s[4]=f("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Hash",-1)),f("p",Ww,_(r.tagDetail.hash),1)]),r.tagDetail.tagger?(v(),y(ke,{key:0},[f("div",qw,[s[5]||(s[5]=f("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tagger",-1)),f("p",jw,[Xe(_(r.tagDetail.tagger.name)+" ",1),f("span",Yw,"<"+_(r.tagDetail.tagger.email)+">",1)])]),f("div",Fw,[s[6]||(s[6]=f("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Date",-1)),f("p",Uw,_(r.tagDetail.tagger.date),1)])],64)):U("",!0),r.tagDetail.message?(v(),y("div",Gw,[s[7]||(s[7]=f("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message",-1)),f("div",Hw,_(r.tagDetail.message),1)])):U("",!0)],64)):r.loading?(v(),y("div",Kw," Loading tag details... ")):U("",!0)]),_:1},8,["visible","loading"]))}}),eS={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},tS={class:"text-sm font-mono text-retro-cyan"},rS={class:"mb-4"},nS={class:"flex items-start gap-2 cursor-pointer group"},sS=Ie({__name:"CreateBranchDialog",props:{visible:{type:Boolean},fromCommit:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e,n=Q(""),s=Q(!0),i=K(()=>n.value.trim().length>0);function o(){i.value&&t("confirm",{name:n.value.trim(),checkout:s.value})}function a(){n.value="",s.value=!0,t("close")}return(l,c)=>(v(),pe(Rt,{title:"Create Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Create Branch",onClose:a,onConfirm:o},{default:ct(()=>[f("div",eS,[c[2]||(c[2]=f("div",{class:"text-xs font-mono text-retro-muted mb-1"},"From",-1)),f("div",tS,_(r.fromCommit.slice(0,7)),1)]),f("div",rS,[c[3]||(c[3]=f("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Branch name",-1)),je(f("input",{"onUpdate:modelValue":c[0]||(c[0]=u=>et(n)?n.value=u: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),[[_t,p(n)]])]),f("label",nS,[je(f("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>et(s)?s.value=u:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[pr,p(s)]]),c[4]||(c[4]=f("div",null,[f("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Switch to new branch "),f("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Checkout the branch after creating it ")],-1))])]),_:1},8,["visible","loading","error"]))}}),iS={class:"space-y-4"},oS={class:"flex items-center gap-2 cursor-pointer"},aS=Ie({__name:"StashDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q(""),i=Q(!1);function o(){n("confirm",{message:s.value.trim()||void 0,includeUntracked:i.value})}return Ve(()=>t.visible,a=>{a&&(s.value="",i.value=!1)}),(a,l)=>(v(),pe(Rt,{title:"Stash Changes",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Stash",onClose:l[2]||(l[2]=c=>n("close")),onConfirm:o},{default:ct(()=>[l[5]||(l[5]=f("p",{class:"text-retro-text text-sm font-mono mb-4"}," Save uncommitted changes to the stash. ",-1)),f("div",iS,[f("div",null,[l[3]||(l[3]=f("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message (optional)",-1)),je(f("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>et(s)?s.value=c: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),[[_t,p(s)]])]),f("label",oS,[je(f("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>et(i)?i.value=c:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[pr,p(i)]]),l[4]||(l[4]=f("span",{class:"text-retro-muted text-sm"},"Include untracked files",-1))])])]),_:1},8,["visible","loading","error"]))}}),lS={class:"space-y-3"},cS={class:"flex items-start gap-2 cursor-pointer"},uS={class:"flex items-start gap-2 cursor-pointer"},hS={key:0,class:"mt-4 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},dS=Ie({__name:"ResetWorkingDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=Q("mixed"),i=K(()=>s.value==="hard");function o(){n("confirm",{mode:s.value})}return Ve(()=>t.visible,a=>{a&&(s.value="mixed")}),(a,l)=>(v(),pe(Rt,{title:"Reset Working Directory",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Reset","confirm-danger":p(i),onClose:l[2]||(l[2]=c=>n("close")),onConfirm:o},{default:ct(()=>[l[5]||(l[5]=f("p",{class:"text-retro-text text-sm font-mono mb-4"}," Reset the working directory to HEAD. ",-1)),f("div",lS,[f("label",cS,[je(f("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>et(s)?s.value=c:null),type:"radio",value:"mixed",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[kc,p(s)]]),l[3]||(l[3]=f("div",null,[f("span",{class:"text-retro-text text-sm font-mono"},"Mixed"),f("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area, keep working directory ")],-1))]),f("label",uS,[je(f("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>et(s)?s.value=c:null),type:"radio",value:"hard",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[kc,p(s)]]),l[4]||(l[4]=f("div",null,[f("span",{class:"text-retro-text text-sm font-mono"},"Hard"),f("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area AND working directory (DESTRUCTIVE) ")],-1))])]),p(i)?(v(),y("div",hS," WARNING: Hard reset will permanently discard all uncommitted changes. This cannot be undone. ")):U("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),fS=Ie({__name:"CleanUntrackedDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e;return(n,s)=>(v(),pe(Rt,{title:"Clean Untracked Files",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Clean","confirm-danger":"",onClose:s[0]||(s[0]=i=>t("close")),onConfirm:s[1]||(s[1]=i=>t("confirm"))},{default:ct(()=>[...s[2]||(s[2]=[f("div",{class:"space-y-3"},[f("p",{class:"text-retro-text text-sm font-mono"}," Remove all untracked files and directories from the working tree. "),f("p",{class:"text-retro-muted text-xs font-mono"},[Xe(" This runs "),f("code",null,"git clean -fd"),Xe(" and cannot be undone. ")])],-1)])]),_:1},8,["visible","loading","error"]))}}),mS={class:"text-retro-muted text-sm"},pS={class:"text-retro-cyan font-mono"},gS={class:"space-y-3"},OS={class:"text-retro-muted text-sm"},vS={class:"text-retro-cyan font-mono"},bS={class:"space-y-3"},xS={class:"text-retro-muted text-sm"},yS={class:"text-retro-magenta font-mono"},kS={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"},wS={class:"flex-1"},SS=Ie({__name:"GitGraphDialogs",props:{dialogs:{},store:{},remoteNames:{},copyFeedback:{}},setup(r){const e=r,{checkoutDialog:t,confirmCheckout:n,createBranchDialog:s,confirmCreateBranch:i,deleteBranchDialog:o,confirmDeleteBranch:a,renameDialog:l,confirmRenameBranch:c,mergeDialog:u,confirmMerge:h,rebaseDialog:d,confirmRebase:m,pushDialog:g,confirmPush:O,pullDialog:b,confirmPull:x,cherryPickDialog:w,confirmCherryPick:S,resetDialog:C,confirmReset:M,tagCreateDialog:X,confirmTagCreate:V,tagDeleteDialog:se,confirmTagDelete:le,tagDetailDialog:ue,stashDialog:j,confirmStash:I,stashBranchDialog:Z,stashBranchInput:F,confirmStashBranch:W,resetWorkingDialog:N,confirmResetWorking:L,cleanUntrackedDialog:z,confirmCleanUntracked:ve}=e.dialogs;return(H,G)=>(v(),y(ke,null,[p(t).visible?(v(),pe(Rt,{key:0,title:"Checkout",visible:p(t).visible,loading:p(t).loading,error:p(t).error,confirmLabel:"Checkout",onClose:G[0]||(G[0]=te=>p(t).visible=!1),onConfirm:p(n)},{default:ct(()=>[f("p",mS,[G[23]||(G[23]=Xe(" Are you sure you want to checkout ",-1)),f("span",pS,_(p(t).branchName),1),G[24]||(G[24]=Xe("? ",-1))])]),_:1},8,["visible","loading","error","onConfirm"])):U("",!0),p(l).visible?(v(),pe(Rt,{key:1,title:"Rename Branch",visible:p(l).visible,loading:p(l).loading,error:p(l).error,confirmLabel:"Rename",onClose:G[3]||(G[3]=te=>p(l).visible=!1),onConfirm:p(c)},{default:ct(()=>[f("div",gS,[f("p",OS,[G[25]||(G[25]=Xe(" Rename ",-1)),f("span",vS,_(p(l).branchName),1)]),je(f("input",{"onUpdate:modelValue":G[1]||(G[1]=te=>p(l).newName=te),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:G[2]||(G[2]=as((...te)=>p(c)&&p(c)(...te),["enter"]))},null,544),[[_t,p(l).newName]])])]),_:1},8,["visible","loading","error","onConfirm"])):U("",!0),p(u).visible?(v(),pe(Mk,{key:2,visible:p(u).visible,branchName:p(u).branchName,loading:p(u).loading,error:p(u).error,onClose:G[4]||(G[4]=te=>p(u).visible=!1),onConfirm:p(h)},null,8,["visible","branchName","loading","error","onConfirm"])):U("",!0),p(o).visible?(v(),pe(Zk,{key:3,visible:p(o).visible,branchName:p(o).branchName,isLocal:p(o).isLocal,loading:p(o).loading,error:p(o).error,onClose:G[5]||(G[5]=te=>p(o).visible=!1),onConfirm:p(a)},null,8,["visible","branchName","isLocal","loading","error","onConfirm"])):U("",!0),p(g).visible?(v(),pe(qk,{key:4,visible:p(g).visible,branchName:p(g).branchName,remotes:r.remoteNames,loading:p(g).loading,error:p(g).error,onClose:G[6]||(G[6]=te=>p(g).visible=!1),onConfirm:p(O)},null,8,["visible","branchName","remotes","loading","error","onConfirm"])):U("",!0),p(b).visible?(v(),pe(Kk,{key:5,visible:p(b).visible,branchName:p(b).branchName,remotes:r.remoteNames,loading:p(b).loading,error:p(b).error,onClose:G[7]||(G[7]=te=>p(b).visible=!1),onConfirm:p(x)},null,8,["visible","branchName","remotes","loading","error","onConfirm"])):U("",!0),p(d).visible?(v(),pe(iw,{key:6,visible:p(d).visible,branchName:r.store.currentBranch?.name||"HEAD",ontoBranch:p(d).branchName,loading:p(d).loading,error:p(d).error,onClose:G[8]||(G[8]=te=>p(d).visible=!1),onConfirm:p(m)},null,8,["visible","branchName","ontoBranch","loading","error","onConfirm"])):U("",!0),p(w).visible?(v(),pe(dw,{key:7,visible:p(w).visible,commitHash:p(w).commitHash,commitMessage:p(w).commitMessage,loading:p(w).loading,error:p(w).error,onClose:G[9]||(G[9]=te=>p(w).visible=!1),onConfirm:p(S)},null,8,["visible","commitHash","commitMessage","loading","error","onConfirm"])):U("",!0),p(C).visible?(v(),pe(bw,{key:8,visible:p(C).visible,commitHash:p(C).commitHash,commitMessage:p(C).commitMessage,loading:p(C).loading,error:p(C).error,onClose:G[10]||(G[10]=te=>p(C).visible=!1),onConfirm:p(M)},null,8,["visible","commitHash","commitMessage","loading","error","onConfirm"])):U("",!0),p(X).visible?(v(),pe(Aw,{key:9,visible:p(X).visible,commitHash:p(X).commitHash,remotes:r.remoteNames,loading:p(X).loading,error:p(X).error,onClose:G[11]||(G[11]=te=>p(X).visible=!1),onConfirm:p(V)},null,8,["visible","commitHash","remotes","loading","error","onConfirm"])):U("",!0),p(se).visible?(v(),pe(Lw,{key:10,visible:p(se).visible,tagName:p(se).tagName,remotes:r.remoteNames,loading:p(se).loading,error:p(se).error,onClose:G[12]||(G[12]=te=>p(se).visible=!1),onConfirm:p(le)},null,8,["visible","tagName","remotes","loading","error","onConfirm"])):U("",!0),p(ue).visible?(v(),pe(Jw,{key:11,visible:p(ue).visible,tagName:p(ue).tagName,tagDetail:p(ue).tagDetail,loading:p(ue).loading,onClose:G[13]||(G[13]=te=>p(ue).visible=!1)},null,8,["visible","tagName","tagDetail","loading"])):U("",!0),p(s).visible?(v(),pe(sS,{key:12,visible:p(s).visible,fromCommit:p(s).fromCommit,loading:p(s).loading,error:p(s).error,onClose:G[14]||(G[14]=te=>p(s).visible=!1),onConfirm:p(i)},null,8,["visible","fromCommit","loading","error","onConfirm"])):U("",!0),p(Z).visible?(v(),pe(Rt,{key:13,title:"Create Branch from Stash",visible:p(Z).visible,loading:p(Z).loading,error:p(Z).error,confirmLabel:"Create Branch",onClose:G[17]||(G[17]=te=>p(Z).visible=!1),onConfirm:G[18]||(G[18]=te=>p(W)(p(F)))},{default:ct(()=>[f("div",bS,[f("p",xS,[G[26]||(G[26]=Xe(" Create a new branch from ",-1)),f("span",yS,"stash@"+_("{")+_(p(Z).stashIndex)+_("}"),1)]),je(f("input",{"onUpdate:modelValue":G[15]||(G[15]=te=>et(F)?F.value=te: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:G[16]||(G[16]=as(te=>p(W)(p(F)),["enter"]))},null,544),[[_t,p(F)]])])]),_:1},8,["visible","loading","error"])):U("",!0),p(j).visible?(v(),pe(aS,{key:14,visible:p(j).visible,loading:p(j).loading,error:p(j).error,onClose:G[19]||(G[19]=te=>p(j).visible=!1),onConfirm:p(I)},null,8,["visible","loading","error","onConfirm"])):U("",!0),p(N).visible?(v(),pe(dS,{key:15,visible:p(N).visible,loading:p(N).loading,error:p(N).error,onClose:G[20]||(G[20]=te=>p(N).visible=!1),onConfirm:p(L)},null,8,["visible","loading","error","onConfirm"])):U("",!0),p(z).visible?(v(),pe(fS,{key:16,visible:p(z).visible,loading:p(z).loading,error:p(z).error,onClose:G[21]||(G[21]=te=>p(z).visible=!1),onConfirm:p(ve)},null,8,["visible","loading","error","onConfirm"])):U("",!0),(v(),pe(Pr,{to:"body"},[J(pn,{name:"fade"},{default:ct(()=>[r.copyFeedback.visible?(v(),y("div",{key:0,class:"fixed z-50 px-3 py-1.5 text-sm bg-retro-green text-retro-dark rounded shadow-lg",style:er({left:`${r.copyFeedback.x}px`,top:`${r.copyFeedback.y-40}px`})}," Copied! ",4)):U("",!0)]),_:1})])),(v(),pe(Pr,{to:"body"},[J(pn,{name:"fade"},{default:ct(()=>[r.store.operationError?(v(),y("div",kS,[J(p(En),{class:"w-4 h-4 flex-shrink-0"}),f("span",wS,_(r.store.operationError),1),f("button",{class:"flex-shrink-0 p-0.5 hover:bg-white/20 rounded transition-colors",onClick:G[22]||(G[22]=te=>r.store.clearOperationError()),"aria-label":"Dismiss error"},[J(p(wt),{class:"w-3.5 h-3.5"})])])):U("",!0)]),_:1})]))],64))}}),$S=Os(SS,[["__scopeId","data-v-c47c4487"]]),Eu=globalThis.setInterval,CS={class:"h-full flex flex-col bg-retro-dark",role:"region","aria-label":"Git Graph"},QS={key:0,class:"flex-1 flex flex-col items-center justify-center gap-3"},PS={key:1,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},TS={key:2,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},MS={class:"text-retro-red text-sm mb-4"},AS={key:3,class:"flex-1 flex items-center justify-center p-4"},_S={class:"flex-shrink-0 flex items-center gap-2 p-2 border-b border-retro-border"},RS={class:"relative"},BS={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]"},ZS={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},ES=["checked"],DS={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},LS=["checked"],XS={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},IS=["checked"],VS={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},zS=["checked"],NS={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},WS=["checked"],qS={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},jS=["checked"],YS={class:"relative"},FS=["aria-expanded"],US={key:0,class:"text-xs"},GS={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"},HS=["checked","onChange"],KS={class:"text-sm text-retro-text truncate"},JS={key:0,class:"text-[10px] text-retro-cyan"},e2={class:"px-3 py-1 text-[10px] text-retro-orange font-semibold uppercase tracking-wider mt-1"},t2=["checked","onChange"],r2={class:"text-sm text-retro-text truncate"},n2={class:"relative"},s2={key:0,class:"absolute right-0 top-full mt-1 z-20"},i2=["title"],o2=5e3,a2=Ie({__name:"GitGraph",props:{workingDirectory:{},isActive:{type:Boolean,default:!0}},setup(r){const e=r,t=dl(),n=gr(),s=dk(),i=mk(t),o=pk(t,i),{checkoutDialog:a,confirmCheckout:l,createBranchDialog:c,confirmCreateBranch:u,deleteBranchDialog:h,confirmDeleteBranch:d,renameDialog:m,confirmRenameBranch:g,mergeDialog:O,confirmMerge:b,rebaseDialog:x,confirmRebase:w,pushDialog:S,confirmPush:C,pullDialog:M,confirmPull:X,cherryPickDialog:V,confirmCherryPick:se,resetDialog:le,confirmReset:ue,tagCreateDialog:j,confirmTagCreate:I,tagDeleteDialog:Z,confirmTagDelete:F,tagDetailDialog:W,stashDialog:N,confirmStash:L,stashBranchDialog:z,stashBranchInput:ve,confirmStashBranch:H,resetWorkingDialog:G,confirmResetWorking:te,cleanUntrackedDialog:ge,confirmCleanUntracked:me,isAnyDialogOpen:Se}=i,{copyFeedback:Qe,branchMenu:Ye,handleBranchContextMenu:P,closeBranchMenu:T,handleBranchCheckout:E,handleBranchRename:B,handleBranchDelete:be,handleBranchMerge:Ae,handleBranchRebase:Te,handleBranchPush:ae,handleBranchPull:re,handleBranchFetch:$e,handleBranchCopyName:q,handleBranchCreateBranch:Oe,commitMenu:Be,handleCommitContextMenu:st,closeCommitMenu:zt,handleCommitAddTag:nr,handleCommitCreateBranch:nn,handleCommitCheckout:vr,handleCommitCherryPick:qn,handleCommitRevert:sn,handleCommitMergeInto:jn,handleCommitReset:on,handleCommitCopyHash:kn,handleCommitCopySubject:Zt,tagMenu:Nt,handleTagContextMenu:ce,closeTagMenu:xe,handleTagViewDetails:_e,handleTagDelete:qe,handleTagPush:Fe,handleTagCopyName:$t,uncommittedMenu:it,closeUncommittedMenu:Yt,handleUncommittedStash:sr,handleUncommittedReset:br,handleUncommittedClean:Yn,stashMenu:Lr,handleStashContextMenu:ai,closeStashMenu:li,handleStashApply:ci,handleStashPop:ui,handleStashDrop:hi,handleStashCreateBranch:di,handleStashCopyName:fi,handleStashCopyHash:mi}=o,pi=K(()=>{const Ze=n.activeConversation?.worktreeBranch;return Ze?[Ze]:[]}),gi=K(()=>{const Ze=[],k=t.selectedFeatureId;k&&Ze.push(k);const R=t.conversationBranch;return R&&!Ze.includes(R)&&Ze.push(R),Ze});Ve(()=>[n.activeConversation?.worktreeBranch,n.activeConversation?.baseBranch],([Ze,k])=>{t.setConversationBranch(Ze??null,k??null)},{immediate:!0});const Et=K(()=>{const Ze=t.previewBranch;return Ze?[Ze]:[]});Ve(()=>[n.previewingConversation?.worktreeBranch,n.previewingConversation?.baseBranch],([Ze,k])=>{t.setPreviewBranch(Ze??null,k??null)},{immediate:!0});const ir=K(()=>Hh([{branch:t.previewBranch,mergeBase:t.previewMergeBase}])),vs=K(()=>Hh([{branch:t.selectedFeatureId,mergeBase:t.featureMergeBase},{branch:t.conversationBranch,mergeBase:t.conversationMergeBase}])),wn=K(()=>t.remotes.map(Ze=>Ze.name)),Sn=Q(null);Ve(()=>e.workingDirectory,async Ze=>{if(Ze){await t.loadGitGraph(Ze);const k=n.previewingConversation?.worktreeBranch;k&&await t.setPreviewBranch(k,n.previewingConversation?.baseBranch??null);const R=n.activeConversation?.worktreeBranch;R&&await t.setConversationBranch(R,n.activeConversation?.baseBranch??null)}},{immediate:!0}),Ve(()=>e.isActive,Ze=>{Ze&&t.commits.length>0&&!t.error?s.startPolling(e.workingDirectory):s.stopPolling()},{immediate:!0}),Ve(()=>t.commits.length,Ze=>{Ze>0&&e.isActive&&!t.error&&s.startPolling(e.workingDirectory)}),Ve(()=>Sn.value,Ze=>{Ze&&s.setScrollCallbacks({getScrollPosition:()=>Ze.getScrollPosition(),setScrollPosition:k=>Ze.setScrollPosition(k)})}),kt(()=>{s.cleanup(),t.reset()});const bs=K(()=>t.error?.includes("Not a Git repository")),$n=Q(Date.now());let an=null;const Oi=()=>{an||(an=Eu(()=>{$n.value=Date.now()},o2))},xs=()=>{an&&(clearInterval(an),an=null)};pt(()=>{Ve(()=>e.isActive,Ze=>{Ze?($n.value=Date.now(),Oi()):xs()},{immediate:!0})}),kt(()=>{xs()});const Cn=K(()=>{const Ze=t.lastRefreshTime;if(!Ze)return null;const k=Math.floor(($n.value-Ze)/1e3);return t.isRefreshing?"Syncing...":k<5?"Just now":k<60?`${k}s ago`:`${Math.floor(k/60)}m ago`}),gt=Q(!1),xr=Q(!1),ys=Q(null);function vi(){gt.value=!0,Xt(()=>ys.value?.focus())}function Qn(){gt.value=!1,t.setSearchQuery("")}function bi(Ze){t.setSearchQuery(Ze)}const ks=fk({onScrollToHead:()=>{const Ze=t.commits.find(k=>k.isHead);Ze&&t.selectCommit(Ze)},onEscape:()=>{yr.value?yr.value=!1:xr.value?xr.value=!1:or.value?or.value=!1:gt.value?Qn():t.isComparing?t.clearComparison():(t.selectedCommit||t.isUncommittedChangesSelected)&&t.clearSelection()}});pt(()=>{ks.start()}),kt(()=>{ks.stop()});const yr=Q(!1),or=Q(!1);async function xi(){await t.fetchAll(!0)}async function yi(Ze){await t.addRemote(Ze.name,Ze.url)}async function Xr(Ze){await t.editRemote(Ze.name,Ze.newUrl)}async function ki(Ze){await t.deleteRemote(Ze)}const ln=K(()=>{const Ze=[],k={};for(const R of t.branches)if(t.localBranchNames.has(R.name))Ze.push(R);else{const A=R.name.indexOf("/");if(A>0){const D=R.name.substring(0,A);k[D]||(k[D]=[]),k[D].push(R)}else Ze.push(R)}return{local:Ze,remotes:k}});Ve(Se,Ze=>{Ze?t.setActiveDialog({type:"generic",props:{}}):t.clearActiveDialog()});function wi(Ze){t.selectedCommit?t.selectComparisonCommit(Ze):t.selectCommit(Ze)}function ws(Ze){t.navigateToCommit(Ze)}return(Ze,k)=>{const R=Zv,A=Gv,D=kb,oe=Nb,he=oy,ie=Ty,de=Ly,He=Xy,ot=Iy,Wt=Vy,_o=zy;return v(),y("div",CS,[p(t).loading&&p(t).commits.length===0?(v(),y("div",QS,[...k[20]||(k[20]=[f("div",{class:"w-6 h-6 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),f("div",{class:"text-retro-muted text-sm"},"Loading git history...",-1)])])):p(bs)?(v(),y("div",PS,[J(p(En),{class:"w-12 h-12 text-retro-yellow mb-4"}),k[21]||(k[21]=f("h3",{class:"text-retro-text font-semibold mb-2"},"Not a Git Repository",-1)),k[22]||(k[22]=f("p",{class:"text-retro-muted text-sm max-w-xs"},[Xe(" This directory is not initialized as a Git repository. Run "),f("code",{class:"text-retro-cyan"},"git init"),Xe(" to get started. ")],-1))])):p(t).error?(v(),y("div",TS,[J(p(En),{class:"w-10 h-10 text-retro-red mb-3"}),f("p",MS,_(p(t).error),1),f("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:k[0]||(k[0]=Ue=>p(t).loadGitGraph(e.workingDirectory))},[J(p(hs),{class:"w-4 h-4"}),k[23]||(k[23]=Xe(" Retry ",-1))])])):p(t).commits.length===0?(v(),y("div",AS,[...k[24]||(k[24]=[f("div",{class:"text-retro-muted text-center"},[f("p",null,"No commits found in this repository.")],-1)])])):(v(),y(ke,{key:4},[p(gt)?(v(),pe(R,{key:0,ref_key:"findWidgetRef",ref:ys,resultCount:p(t).searchResultHashes.length,currentIndex:p(t).searchResultIndex,onSearch:bi,onNext:p(t).nextSearchResult,onPrev:p(t).prevSearchResult,onClose:Qn},null,8,["resultCount","currentIndex","onNext","onPrev"])):U("",!0),f("div",_S,[f("button",{class:Re(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",p(gt)?"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:k[1]||(k[1]=Ue=>p(gt)?Qn():vi())},[J(p(cs),{class:"w-4 h-4"})],2),f("div",RS,[f("button",{class:Re(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",p(yr)?"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:k[2]||(k[2]=Ue=>yr.value=!p(yr))},[J(p(J1),{class:"w-4 h-4"})],2),p(yr)?(v(),y("div",BS,[k[31]||(k[31]=f("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mb-1"}," Graph Style ",-1)),f("label",ZS,[f("input",{type:"radio",name:"graphStyle",value:"rounded",checked:p(t).graphStyle==="rounded",class:"accent-retro-cyan",onChange:k[3]||(k[3]=Ue=>p(t).setGraphStyle("rounded"))},null,40,ES),k[25]||(k[25]=f("span",{class:"text-sm text-retro-text"},"Rounded",-1))]),f("label",DS,[f("input",{type:"radio",name:"graphStyle",value:"angular",checked:p(t).graphStyle==="angular",class:"accent-retro-cyan",onChange:k[4]||(k[4]=Ue=>p(t).setGraphStyle("angular"))},null,40,LS),k[26]||(k[26]=f("span",{class:"text-sm text-retro-text"},"Angular",-1))]),k[32]||(k[32]=f("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Display ",-1)),f("label",XS,[f("input",{type:"checkbox",checked:p(t).muteNonAncestral,class:"accent-retro-cyan",onChange:k[5]||(k[5]=Ue=>p(t).toggleMuteNonAncestral())},null,40,IS),k[27]||(k[27]=f("span",{class:"text-sm text-retro-text"},"Mute non-ancestral",-1))]),k[33]||(k[33]=f("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Columns ",-1)),f("label",VS,[f("input",{type:"checkbox",checked:p(t).columnVisibility.commit!==!1,class:"accent-retro-cyan",onChange:k[6]||(k[6]=Ue=>p(t).toggleColumnVisibility("commit"))},null,40,zS),k[28]||(k[28]=f("span",{class:"text-sm text-retro-text"},"Hash",-1))]),f("label",NS,[f("input",{type:"checkbox",checked:p(t).columnVisibility.author!==!1,class:"accent-retro-cyan",onChange:k[7]||(k[7]=Ue=>p(t).toggleColumnVisibility("author"))},null,40,WS),k[29]||(k[29]=f("span",{class:"text-sm text-retro-text"},"Author",-1))]),f("label",qS,[f("input",{type:"checkbox",checked:p(t).columnVisibility.date!==!1,class:"accent-retro-cyan",onChange:k[8]||(k[8]=Ue=>p(t).toggleColumnVisibility("date"))},null,40,jS),k[30]||(k[30]=f("span",{class:"text-sm text-retro-text"},"Date",-1))])])):U("",!0)]),k[36]||(k[36]=f("span",{class:"flex-1"},null,-1)),f("div",YS,[f("button",{class:Re(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",p(xr)||p(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":p(xr),onClick:k[9]||(k[9]=Ue=>xr.value=!p(xr))},[J(p(vv),{class:"w-4 h-4"}),p(t).filteredBranches.length>0?(v(),y("span",US," ("+_(p(t).filteredBranches.length)+") ",1)):U("",!0)],10,FS),p(xr)?(v(),y("div",GS,[k[35]||(k[35]=f("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border"}," Filter by Branch ",-1)),p(t).filteredBranches.length>0?(v(),y("button",{key:0,class:"w-full text-left px-3 py-1.5 text-sm text-retro-cyan hover:bg-retro-cyan/10",onClick:k[10]||(k[10]=Ue=>p(t).clearFilters())}," Clear All Filters ")):U("",!0),p(ln).local.length>0?(v(),y(ke,{key:1},[k[34]||(k[34]=f("div",{class:"px-3 py-1 text-[10px] text-retro-green font-semibold uppercase tracking-wider mt-1"}," Local ",-1)),(v(!0),y(ke,null,Ne(p(ln).local,Ue=>(v(),y("label",{key:Ue.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[f("input",{type:"checkbox",checked:p(t).filteredBranches.includes(Ue.name),class:"accent-retro-cyan",onChange:Fn=>p(t).toggleBranchFilter(Ue.name)},null,40,HS),f("span",KS,_(Ue.name),1),Ue.isHead?(v(),y("span",JS,"(HEAD)")):U("",!0)]))),128))],64)):U("",!0),(v(!0),y(ke,null,Ne(p(ln).remotes,(Ue,Fn)=>(v(),y(ke,{key:Fn},[f("div",e2,_(Fn),1),(v(!0),y(ke,null,Ne(Ue,Ss=>(v(),y("label",{key:Ss.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[f("input",{type:"checkbox",checked:p(t).filteredBranches.includes(Ss.name),class:"accent-retro-cyan",onChange:Dh=>p(t).toggleBranchFilter(Ss.name)},null,40,t2),f("span",r2,_(Ss.name),1)]))),128))],64))),128))])):U("",!0)]),f("button",{class:Re(["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":p(t).isRefreshing}]),"aria-label":"Refresh",title:"Refresh",onClick:k[11]||(k[11]=Ue=>p(t).loadGitGraph(e.workingDirectory))},[J(p(hs),{class:"w-4 h-4"})],2),f("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:xi},[J(p(Km),{class:"w-4 h-4"})]),f("div",n2,[f("button",{class:Re(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",p(or)?"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:k[12]||(k[12]=Ue=>or.value=!p(or))},[J(p(Jm),{class:"w-4 h-4"})],2),p(or)?(v(),y("div",s2,[J(A,{remotes:p(t).remotes,onAdd:yi,onEdit:Xr,onDelete:ki,onClose:k[13]||(k[13]=Ue=>or.value=!1)},null,8,["remotes"])])):U("",!0)]),p(Cn)&&e.isActive?(v(),y("div",{key:0,class:Re(["flex items-center text-[10px] text-retro-muted",{"text-retro-cyan":p(t).isRefreshing}]),title:p(t).lastRefreshTime?`Last checked: ${new Date(p(t).lastRefreshTime).toLocaleTimeString()}`:"","aria-live":"polite","aria-atomic":"true"},[f("span",{class:Re(["inline-block w-1.5 h-1.5 rounded-full mr-1",p(t).isRefreshing?"bg-retro-cyan animate-pulse":"bg-retro-muted/50"]),"aria-hidden":"true"},null,2),Xe(" "+_(p(Cn)),1)],10,i2)):U("",!0)]),f("div",{class:Re(["flex-1 min-h-0 overflow-hidden",{"max-h-[50%]":p(t).selectedCommit||p(t).isUncommittedChangesSelected}])},[J(D,{ref_key:"commitListRef",ref:Sn,commits:p(t).filteredCommits,stashes:p(t).stashes,selectedCommit:p(t).selectedCommit,hasMore:p(t).hasMore,loading:p(t).loading,loadingMore:p(t).loadingMore,searchQuery:p(t).searchQuery,uncommittedChangesCount:p(t).uncommittedChangesCount,isUncommittedChangesSelected:p(t).isUncommittedChangesSelected,highlightBranches:p(pi),featureHighlightBranches:p(gi),featureMergeBases:p(vs),previewHighlightBranches:p(Et),previewMergeBases:p(ir),currentBranchName:p(t).currentBranch?.name,localBranchNames:p(t).localBranchNames,graphStyle:p(t).graphStyle,muteNonAncestral:p(t).muteNonAncestral,columnVisibility:p(t).columnVisibility,onSelect:p(t).selectCommit,onLoadMore:p(t).loadMoreCommits,onBranchContextMenu:p(P),onCommitContextMenu:p(st),onTagContextMenu:p(ce),onStashContextMenu:p(ai),onCompareSelect:wi,onSelectUncommittedChanges:p(t).selectUncommittedChanges,onScrollStart:p(s).startInteraction,onScrollEnd:p(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","onBranchContextMenu","onCommitContextMenu","onTagContextMenu","onStashContextMenu","onSelectUncommittedChanges","onScrollStart","onScrollEnd"])],2),p(t).isComparing&&p(t).selectedCommit&&p(t).comparisonCommit?(v(),pe(oe,{key:1,fromCommit:p(t).comparisonCommit,toCommit:p(t).selectedCommit,files:p(t).comparisonFiles,stats:p(t).comparisonStats,loading:p(t).comparisonLoading,onClose:p(t).clearComparison},null,8,["fromCommit","toCommit","files","stats","loading","onClose"])):p(t).selectedCommit?(v(),pe(he,{key:2,commit:p(t).selectedCommit,files:p(t).selectedCommitFiles,stats:p(t).selectedCommitStats,loading:p(t).isLoadingDetails,detailPosition:p(t).detailViewPosition,onClose:p(t).clearSelection,onNavigateToCommit:ws,onTogglePosition:p(t).toggleDetailViewPosition,onOpenFileDiff:k[14]||(k[14]=Ue=>p(t).selectedCommit&&p(t).openFileDiff(p(t).selectedCommit.hash,Ue))},null,8,["commit","files","stats","loading","detailPosition","onClose","onTogglePosition"])):U("",!0),p(t).isUncommittedChangesSelected?(v(),pe(ie,{key:3,stagedFiles:p(t).stagedFiles,unstagedFiles:p(t).unstagedFiles,isStaging:p(t).isStaging,isCommitting:p(t).isCommitting,onClose:p(t).clearSelection,onStageFiles:k[15]||(k[15]=Ue=>p(t).stageFiles(Ue)),onUnstageFiles:k[16]||(k[16]=Ue=>p(t).unstageFiles(Ue)),onStageAll:k[17]||(k[17]=()=>p(t).stageFiles([])),onUnstageAll:k[18]||(k[18]=()=>p(t).unstageFiles([])),onCommit:k[19]||(k[19]=Ue=>p(t).commitChanges(Ue))},null,8,["stagedFiles","unstagedFiles","isStaging","isCommitting","onClose"])):U("",!0)],64)),p(Ye).visible?(v(),pe(de,{key:5,branchName:p(Ye).branch,isCurrentBranch:p(Ye).isCurrentBranch,isLocal:p(Ye).isLocal,x:p(Ye).x,y:p(Ye).y,onClose:p(T),onCheckout:p(E),onCreateBranch:p(Oe),onDeleteBranch:p(be),onRename:p(B),onMerge:p(Ae),onRebase:p(Te),onPush:p(ae),onPull:p(re),onFetch:p($e),onCopyName:p(q)},null,8,["branchName","isCurrentBranch","isLocal","x","y","onClose","onCheckout","onCreateBranch","onDeleteBranch","onRename","onMerge","onRebase","onPush","onPull","onFetch","onCopyName"])):U("",!0),p(Be).visible&&p(Be).commit?(v(),pe(He,{key:6,commit:p(Be).commit,x:p(Be).x,y:p(Be).y,onClose:p(zt),onAddTag:p(nr),onCreateBranch:p(nn),onCheckout:p(vr),onCherryPick:p(qn),onRevert:p(sn),onMergeInto:p(jn),onReset:p(on),onCopyHash:p(kn),onCopySubject:p(Zt)},null,8,["commit","x","y","onClose","onAddTag","onCreateBranch","onCheckout","onCherryPick","onRevert","onMergeInto","onReset","onCopyHash","onCopySubject"])):U("",!0),p(Nt).visible?(v(),pe(ot,{key:7,tagName:p(Nt).tag,x:p(Nt).x,y:p(Nt).y,onClose:p(xe),onViewDetails:p(_e),onDeleteTag:p(qe),onPushTag:p(Fe),onCopyName:p($t)},null,8,["tagName","x","y","onClose","onViewDetails","onDeleteTag","onPushTag","onCopyName"])):U("",!0),p(Lr).visible&&p(Lr).stash?(v(),pe(Wt,{key:8,stashIndex:p(Lr).stash.index,stashMessage:p(Lr).stash.message,x:p(Lr).x,y:p(Lr).y,onClose:p(li),onApply:p(ci),onPop:p(ui),onDrop:p(hi),onCreateBranch:p(di),onCopyName:p(fi),onCopyHash:p(mi)},null,8,["stashIndex","stashMessage","x","y","onClose","onApply","onPop","onDrop","onCreateBranch","onCopyName","onCopyHash"])):U("",!0),p(it).visible?(v(),pe(_o,{key:9,x:p(it).x,y:p(it).y,onClose:p(Yt),onStash:p(sr),onReset:p(br),onClean:p(Yn)},null,8,["x","y","onClose","onStash","onReset","onClean"])):U("",!0),J($S,{dialogs:p(i),store:p(t),remoteNames:p(wn),copyFeedback:p(Qe)},null,8,["dialogs","store","remoteNames","copyFeedback"])])}}}),l2=Os(a2,[["__scopeId","data-v-e2b31aba"]]),c2=P1("/app-logo.svg"),u2={class:"flex items-start justify-between gap-2"},h2={class:"flex-1 min-w-0"},d2={class:"flex items-center gap-2"},f2={class:"font-mono text-sm text-retro-text truncate"},m2={class:"text-xs font-mono text-retro-muted mt-1 truncate"},p2={class:"flex items-center gap-1 flex-shrink-0"},g2={key:0,class:"inline-flex items-center gap-1 text-[10px] font-mono text-retro-red",title:"Critical traceability gaps"},O2={key:1,class:"inline-flex items-center gap-1 text-[10px] font-mono text-retro-yellow",title:"Major traceability gaps"},v2={key:2,class:"text-[10px] font-mono text-retro-muted mr-1",title:"Completed tasks / total tasks"},b2={key:3,class:"w-2 h-2 rounded-full bg-retro-green",title:"spec"},x2={key:4,class:"w-2 h-2 rounded-full bg-retro-cyan",title:"plan"},y2={key:5,class:"w-2 h-2 rounded-full bg-retro-yellow",title:"tasks"},k2={class:"flex flex-wrap items-center justify-between gap-1 mt-2"},w2={key:0,class:"flex items-center gap-1"},S2=["title","disabled","onClick"],$2=Ie({__name:"FeatureCard",props:{feature:{},skills:{},isActive:{type:Boolean},criticalAlerts:{},majorAlerts:{}},emits:["select","cascade","openChat","skill"],setup(r,{emit:e}){const t={DocumentCheckIcon:dv,PuzzlePieceIcon:Yh,DocumentMagnifyingGlassIcon:mv,WrenchScrewdriverIcon:Qv,SparklesIcon:Pa,BeakerIcon:sv,ShieldCheckIcon:rp,CommandLineIcon:hv,CpuChipIcon:V1,LightBulbIcon:yv},n=r,s=e,i=gr();function o(d){return t[d]||Yh}function a(d){return d.prerequisites.every(m=>n.feature.files.some(g=>g.filename===m))}function l(d){return d.prerequisites.filter(m=>!n.feature.files.some(g=>g.filename===m))}function c(d){return a(d)?`${d.name} (Shift+click: new conversation)`:`Requires: ${l(d).join(", ")}`}const u=K(()=>{const d=i.findConversationByFeature(n.feature.id);return d?i.isConversationStreaming(d.id):!1}),h=K(()=>n.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(d,m)=>(v(),y("button",{type:"button",class:Re(["w-full p-3 text-left rounded-lg border transition-all duration-200 group",p(h)]),onClick:m[5]||(m[5]=g=>s("select",r.feature.id))},[f("div",u2,[f("div",h2,[f("div",d2,[J(p(Ns),{class:Re(["h-4 w-4 flex-shrink-0 transition-colors duration-200",r.isActive?"text-retro-cyan":"text-retro-muted group-hover:text-retro-cyan"])},null,8,["class"]),f("span",f2,_(r.feature.id),1)]),f("p",m2,_(r.feature.name),1)]),f("div",p2,[r.criticalAlerts>0?(v(),y("span",g2,[m[6]||(m[6]=f("span",{class:"w-1.5 h-1.5 rounded-full bg-retro-red"},null,-1)),Xe(" "+_(r.criticalAlerts),1)])):U("",!0),r.majorAlerts>0?(v(),y("span",O2,[m[7]||(m[7]=f("span",{class:"w-1.5 h-1.5 rounded-full bg-retro-yellow"},null,-1)),Xe(" "+_(r.majorAlerts),1)])):U("",!0),r.feature.hasTasks?(v(),y("span",v2,_(r.feature.completedTasks)+"/"+_(r.feature.totalTasks),1)):U("",!0),r.feature.hasSpec?(v(),y("span",b2)):U("",!0),r.feature.hasPlan?(v(),y("span",x2)):U("",!0),r.feature.hasTasks?(v(),y("span",y2)):U("",!0)])]),f("div",k2,[r.feature.hasSpec?(v(),y("div",w2,[f("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:m[0]||(m[0]=kr(g=>s("cascade",g,r.feature.id,"clarify"),["stop"]))},[J(p(Ru),{class:"h-3.5 w-3.5"})]),f("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:m[1]||(m[1]=kr(g=>s("cascade",g,r.feature.id,"plan"),["stop"]))},[J(p(_u),{class:"h-3.5 w-3.5"})]),r.feature.hasPlan?(v(),y("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:m[2]||(m[2]=kr(g=>s("cascade",g,r.feature.id,"tasks"),["stop"]))},[J(p(ep),{class:"h-3.5 w-3.5"})])):U("",!0),r.feature.hasTasks?(v(),y("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:m[3]||(m[3]=kr(g=>s("cascade",g,r.feature.id,"implement"),["stop"]))},[J(p(Sv),{class:"h-3.5 w-3.5"})])):U("",!0),r.skills.length>0?(v(),y(ke,{key:2},[m[8]||(m[8]=f("div",{class:"w-px h-4 bg-retro-border mx-0.5"},null,-1)),(v(!0),y(ke,null,Ne(r.skills,g=>(v(),y("button",{key:g.id,type:"button",class:Re(["flex items-center justify-center p-1 rounded transition-colors",[a(g)&&!p(u)?"bg-retro-pink/20 text-retro-pink hover:bg-retro-pink/30":"bg-retro-subtle/10 text-retro-subtle cursor-not-allowed",p(u)?"animate-pulse":""]]),title:c(g),disabled:!a(g)||p(u),onClick:kr(O=>s("skill",O,r.feature.id,g.id),["stop"])},[(v(),pe(Vs(o(g.icon)),{class:"h-3.5 w-3.5"}))],10,S2))),128))],64)):U("",!0)])):U("",!0),r.feature.hasSpec?(v(),y("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:m[4]||(m[4]=kr(g=>s("openChat",g,r.feature.id),["stop"]))},[J(p(lv),{class:"h-3.5 w-3.5"})])):U("",!0)])],2))}});let Sc=[],ip=[];(()=>{let r="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<r.length;e++)(e%2?ip:Sc).push(t=t+r[e])})();function C2(r){if(r<768)return!1;for(let e=0,t=Sc.length;;){let n=e+t>>1;if(r<Sc[n])t=n;else if(r>=ip[n])e=n+1;else return!0;if(e==t)return!1}}function ed(r){return r>=127462&&r<=127487}const td=8205;function Q2(r,e,t=!0,n=!0){return(t?op:P2)(r,e,n)}function op(r,e,t){if(e==r.length)return e;e&&ap(r.charCodeAt(e))&&lp(r.charCodeAt(e-1))&&e--;let n=Tl(r,e);for(e+=rd(n);e<r.length;){let s=Tl(r,e);if(n==td||s==td||t&&C2(s))e+=rd(s),n=s;else if(ed(s)){let i=0,o=e-2;for(;o>=0&&ed(Tl(r,o));)i++,o-=2;if(i%2==0)break;e+=2}else break}return e}function P2(r,e,t){for(;e>0;){let n=op(r,e-2,t);if(n<e)return n;e--}return 0}function Tl(r,e){let t=r.charCodeAt(e);if(!lp(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return ap(n)?(t-55296<<10)+(n-56320)+65536:t}function ap(r){return r>=56320&&r<57344}function lp(r){return r>=55296&&r<56320}function rd(r){return r<65536?1:2}class tt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=qs(this,e,t);let s=[];return this.decompose(0,e,s,2),n.length&&n.decompose(0,n.length,s,3),this.decompose(t,this.length,s,1),jr.from(s,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=qs(this,e,t);let n=[];return this.decompose(e,t,n,0),jr.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),s=new Di(this),i=new Di(e);for(let o=t,a=t;;){if(s.next(o),i.next(o),o=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(a+=s.value.length,s.done||a>=n)return!0}}iter(e=1){return new Di(this,e)}iterRange(e,t=this.length){return new cp(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;n=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new up(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?tt.empty:e.length<=32?new Ot(e):jr.from(Ot.split(e,[]))}}class Ot extends tt{constructor(e,t=T2(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,s){for(let i=0;;i++){let o=this.text[i],a=s+o.length;if((t?n:a)>=e)return new M2(s,a,n,o);s=a+1,n++}}decompose(e,t,n,s){let i=e<=0&&t>=this.length?this:new Ot(nd(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=n.pop(),a=fa(i.text,o.text.slice(),0,i.length);if(a.length<=32)n.push(new Ot(a,o.length+i.length));else{let l=a.length>>1;n.push(new Ot(a.slice(0,l)),new Ot(a.slice(l)))}}else n.push(i)}replace(e,t,n){if(!(n instanceof Ot))return super.replace(e,t,n);[e,t]=qs(this,e,t);let s=fa(this.text,fa(n.text,nd(this.text,0,e)),t),i=this.length+n.length-(t-e);return s.length<=32?new Ot(s,i):jr.from(Ot.split(s,[]),i)}sliceString(e,t=this.length,n=`
|
|
12
12
|
`){[e,t]=qs(this,e,t);let s="";for(let i=0,o=0;i<=t&&o<this.text.length;o++){let a=this.text[o],l=i+a.length;i>e&&o&&(s+=n),e<l&&t>i&&(s+=a.slice(Math.max(0,e-i),t-i)),i=l+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],s=-1;for(let i of e)n.push(i),s+=i.length+1,n.length==32&&(t.push(new Ot(n,s)),n=[],s=-1);return s>-1&&t.push(new Ot(n,s)),t}}class jr extends tt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,s){for(let i=0;;i++){let o=this.children[i],a=s+o.length,l=n+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,n,s);s=a+1,n=l+1}}decompose(e,t,n,s){for(let i=0,o=0;o<=t&&i<this.children.length;i++){let a=this.children[i],l=o+a.length;if(e<=l&&t>=o){let c=s&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?n.push(a):a.decompose(e-o,t-o,n,c)}o=l+1}}replace(e,t,n){if([e,t]=qs(this,e,t),n.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let o=this.children[s],a=i+o.length;if(e>=i&&t<=a){let l=o.replace(e-i,t-i,n),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[s]=l,new jr(u,this.length-(t-e)+n.length)}return super.replace(i,a,l)}i=a+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
|
|
@@ -68,8 +68,8 @@ import{y as v,z as y,A as f,d as Ie,C as J,G as p,Q as je,S as _t,R as et,I as k
|
|
|
68
68
|
`)}function p7(r){return(r.match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(t=>t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t)}function g7(r){const e=r.match(/^\/(?:spec-search|specsearch)\b(.*)$/i);if(!e)return null;const t=p7(e[1]?.trim()??""),n=[],s={q:""};for(let i=0;i<t.length;i++){const o=t[i];if(o==="--mode"&&t[i+1]){const a=t[++i];(a==="keyword"||a==="semantic"||a==="hybrid")&&(s.mode=a);continue}if(o.startsWith("--mode=")){const a=o.slice(7);(a==="keyword"||a==="semantic"||a==="hybrid")&&(s.mode=a);continue}if(o==="--feature"&&t[i+1]){s.featureId=t[++i];continue}if(o.startsWith("--feature=")){s.featureId=o.slice(10);continue}if(o==="--file-type"&&t[i+1]){s.fileType=t[++i];continue}if(o.startsWith("--file-type=")){s.fileType=o.slice(12);continue}if(o==="--limit"&&t[i+1]){const a=Number.parseInt(t[++i],10);Number.isFinite(a)&&a>0&&(s.limit=a);continue}if(o.startsWith("--limit=")){const a=Number.parseInt(o.slice(8),10);Number.isFinite(a)&&a>0&&(s.limit=a);continue}n.push(o)}return s.q=n.join(" ").trim(),s}function O7(r,e=1400){const t=r.trim();return t.length<=e?t:`${t.slice(0,e)}
|
|
69
69
|
...`}function v7(r,e){const t=[];if(t.push("## Spec Search Results"),t.push(""),t.push(`- Query: \`${r.q}\``),t.push(`- Mode: \`${e.mode}\``),r.featureId&&t.push(`- Feature filter: \`${r.featureId}\``),r.fileType&&t.push(`- File type filter: \`${r.fileType}\``),t.push(`- Hits: **${e.totalCount}** (${e.searchTime}ms)`),e.warning&&t.push(`- Warning: ${e.warning}`),e.results.length===0)return t.push(""),t.push("No matching indexed chunks were found."),t.join(`
|
|
70
70
|
`);t.push("");for(const[n,s]of e.results.entries()){const i=s.chunk;t.push(`### ${n+1}. \`${i.sourcePath}:${i.lineStart}\``),t.push(`- Match: \`${s.matchType}\` (score: ${s.score.toFixed(3)})`),i.headingHierarchy.length>0&&t.push(`- Headings: ${i.headingHierarchy.join(" > ")}`),t.push(""),t.push(O7(i.content)),t.push("")}return t.join(`
|
|
71
|
-
`)}function x1(r){return`${r.providerId}::${r.modelKey}`}function b7(r,e){const t=new Map;for(const s of r)for(const i of s.models)t.set(i.label,(t.get(i.label)??0)+1);return r.flatMap(s=>s.models.map(i=>{const o=s.capabilities.streaming&&(!e||s.capabilities.permissions),a=(t.get(i.label)??0)>1;return{key:`${s.id}::${i.key}`,providerId:s.id,providerName:s.name,modelKey:i.key,modelLabel:i.label,label:a?`${i.label} · ${s.name}`:i.label,compatible:o}})).sort((s,i)=>s.modelLabel.localeCompare(i.modelLabel,void 0,{sensitivity:"base"})||s.providerName.localeCompare(i.providerName,void 0,{sensitivity:"base"}))}function x7(r){const e=new Map;for(const s of r){const i=e.get(s.providerId);if(i){i.options.push(s);continue}e.set(s.providerId,{providerId:s.providerId,providerName:s.providerName,options:[s]})}const t=new Map([["codex",0],["claude",1]]),n=Array.from(e.values());return n.sort((s,i)=>{const o=t.get(s.providerId)??99,a=t.get(i.providerId)??99;return o!==a?o-a:s.providerName.localeCompare(i.providerName,void 0,{sensitivity:"base"})}),n}function y7(r,e){const t=x1(e);return r.find(n=>n.key===t)??null}const Lm=4,k7=5*1024*1024;function w7(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function S7(r,e=k7){return r.type.startsWith("image/")?r.size>e?{ok:!1,reason:"too-large"}:{ok:!0}:{ok:!1,reason:"not-image"}}function $7(r){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{typeof n.result=="string"?e(n.result):t(new Error("Failed to read image"))},n.onerror=()=>t(n.error||new Error("Failed to read image")),n.readAsDataURL(r)})}function C7(r=Date.now,e=Math.random){return`att-${r()}-${e().toString(36).slice(2,8)}`}function Q7(r=Date.now,e=Math.random){return`q-${r()}-${e().toString(36).slice(2,8)}`}function P7(r,e=Q7){const t=r.text.trim();return t.length===0&&r.attachments.length===0?null:{id:e(),text:t,attachments:[...r.attachments]}}function T7(r,e){return r.filter(t=>t.id!==e)}const M7={class:"flex-shrink-0 flex-grow-0 border-t border-retro-border bg-retro-dark p-3"},A7={class:"flex items-center gap-2 mb-2"},_7={class:"relative min-w-0 flex-1 max-w-[154px] model-selector"},R7=["disabled"],B7={class:"truncate text-left"},Z7={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]"},E7={key:0,class:"px-3 py-1.5 text-xs font-mono text-retro-muted"},D7={class:"px-3 py-1 text-[11px] font-mono uppercase tracking-wide text-retro-cyan/80 select-none"},L7=["disabled","onClick"],X7={class:"truncate"},I7={class:"relative mode-selector"},V7={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]"},z7=["onClick"],N7={class:"text-xs font-mono text-retro-muted"},W7={key:0,class:"mb-3 p-3 bg-retro-yellow/10 border border-retro-yellow/50 rounded"},q7={class:"flex items-center justify-between gap-3"},j7={class:"flex-1 min-w-0"},Y7={class:"text-xs font-mono text-retro-text truncate"},F7={class:"text-retro-cyan"},U7={key:0,class:"text-retro-muted"},G7={key:1,class:"text-retro-muted"},H7={key:1,class:"mb-3 p-3 bg-retro-cyan/10 border border-retro-cyan/50 rounded"},K7={key:2,class:"mb-2 flex flex-wrap gap-2"},J7=["src","alt"],e8={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},t8={class:"truncate text-[10px] font-mono text-retro-muted/80"},r8=["onClick"],n8={key:3,class:"mb-2"},s8={class:"text-[10px] font-mono text-retro-muted mb-1 uppercase tracking-wide"},i8={class:"space-y-1"},o8={class:"text-[10px] font-mono text-retro-yellow flex-shrink-0"},a8={class:"flex-1 text-xs font-mono text-retro-text truncate"},l8={key:0,class:"text-[10px] font-mono text-retro-muted flex-shrink-0"},c8=["onClick"],u8={class:"flex gap-2 items-start"},h8=["disabled"],d8={class:"flex-1 relative min-h-[40px]"},f8=["disabled","placeholder"],m8=["disabled","title"],p8=Ie({__name:"ChatInput",props:{disabled:{type:Boolean}},setup(r){const e=r,t=gr(),n=Oo(),{sendMessage:s,sendPermissionResponse:i,approvePlan:o,rejectPlan:a,abort:l,resetContext:c}=Pl(),u=Q(""),h=Q(null),d=Q(null),m=Q(!1),g=Q(!1),O=Q(!1),b=Q([]);let x=null;const w=Q(null),S=Q({}),C=K(()=>{const ce=t.activeConversationId;return ce?S.value[ce]??[]:[]});function M(ce,xe){if(xe.length===0){const{[ce]:_e,...qe}=S.value;S.value=qe}else S.value={...S.value,[ce]:xe}}const{data:X,pending:V}=wc("chat-input-ai-providers",()=>$fetch("/api/ai/providers"),{server:!1,default:()=>({providers:[]})}),se=K(()=>X.value?.providers??[]),le=K(()=>t.permissionMode==="ask"||t.permissionMode==="plan"),ue=K(()=>b7(se.value,le.value)),j=K(()=>x7(ue.value)),I=K(()=>{const ce=t.activeConversation;return ce?.providerId&&ce.providerModelKey?{providerId:ce.providerId,modelKey:ce.providerModelKey}:w.value?w.value:n.providerSelection}),Z=K(()=>x1(I.value)),F=K(()=>y7(ue.value,I.value)),W=K(()=>F.value?.label||"Select model");function N(ce,xe){t.setConversationProviderSelection(ce,xe.providerId,xe.modelKey),t.clearProviderSession(ce),t.saveConversation(ce,!0)}function L(ce){w.value&&(N(ce,w.value),w.value=null)}function z(ce){if(!ce||!ce.compatible)return;const xe={providerId:ce.providerId,modelKey:ce.modelKey},_e=t.activeConversationId;if(_e){N(_e,xe),w.value=null,O.value=!1;return}w.value=xe,O.value=!1}const ve={plan:_u,ask:Ru,auto:Hm,bypass:Bu},H={plan:"text-retro-cyan",ask:"text-retro-green",auto:"text-retro-yellow",bypass:"text-retro-red"};function G(ce){t.setPermissionMode(ce),g.value=!1}function te(ce){const xe=ce.target;xe.closest(".mode-selector")||(g.value=!1),xe.closest(".model-selector")||(O.value=!1)}pt(()=>{document.addEventListener("click",te),n.hydrate()}),kt(()=>{document.removeEventListener("click",te),x!==null&&typeof window<"u"&&typeof window.cancelAnimationFrame=="function"&&(window.cancelAnimationFrame(x),x=null)});const ge=K(()=>(u.value.trim().length>0||b.value.length>0)&&!m.value&&!t.pendingPermission&&!Qe.value),me=K(()=>t.isActiveConversationStreaming&&!t.pendingPermission),Se=K(()=>t.pendingPermission!==null),Qe=K(()=>t.pendingPlanApproval!==null);function Ye(){i(!0,t.activeConversationId)}function P(){i(!1,t.activeConversationId)}function T(){o(t.activeConversationId)}function E(){a(t.activeConversationId)}function B(){b.value=[],d.value&&(d.value.value="")}function be(ce){b.value=b.value.filter(xe=>xe.id!==ce)}async function Ae(ce){const xe=ce.target,_e=xe.files?Array.from(xe.files):[];if(_e.length===0)return;const{useToast:qe}=await ls(async()=>{const{useToast:it}=await import("./
|
|
72
|
-
`),status:"complete"},xe);return}const qe=t.activeConversation,Fe=f7(ce,{featureId:qe?.featureId});try{const $t=await $fetch("/api/specs/search",{query:Fe});t.updateMessage(_e.id,{content:v7({...ce,mode:Fe.mode,featureId:Fe.featureId},$t),status:"complete"},xe)}catch($t){const it=$t instanceof Error?$t.message:"Failed to run spec search";t.updateMessage(_e.id,{content:`Spec search failed: ${it}`,status:"error"},xe)}}async function re(){const ce=d7(t.activeConversation,t.permissionMode),xe=await $fetch("/api/chat/context",{query:ce}),_e=t.activeConversationId??await t.createConversation(),qe=t.addAssistantMessage(_e);t.updateMessage(qe.id,{content:m7(xe),status:"complete"},_e)}function $e(ce=[]){const xe=Ca(t.activeConversation,!0)??{};return ce.length>0?{...xe,attachments:ce}:Object.keys(xe).length>0?xe:void 0}function q(ce){const xe=t.addAssistantMessage(ce);return t.startSession(`session-${Date.now()}`,ce),t.startConversationStreaming(ce),t.saveConversation(ce,!0),xe}function Oe(ce,xe,_e,qe){const Fe=_e instanceof Error?_e.message:qe;t.setSessionError(Fe,ce),t.updateMessage(xe,{status:"error"},ce),t.endSession(ce),t.endConversationStreaming(ce)}async function Be(ce,xe){const _e=ce!==void 0,qe=(ce??u.value).trim(),Fe=xe??[...b.value];if(qe.length===0&&Fe.length===0||t.isActiveConversationStreaming||m.value||e.disabled)return;const $t=!!t.activeConversationId;let it=null,Yt=null;const sr=h7(qe);if(sr.kind!=="none"){if(sr.kind==="reset"){await qn();return}sr.kind==="context"?await re():sr.kind==="spec-search"&&await ae(sr.command),_e||(u.value="",B(),Zt());return}m.value=!0,_e||(u.value="",B(),Zt());try{if(await t.addUserMessageWithConversation(qe,Fe),it=t.activeConversationId,!it)throw new Error("Failed to create or select a conversation");$t||L(it);const br=q(it);Yt=br.id,await s(qe,br.id,it,$e(Fe))}catch(br){if(it&&Yt)Oe(it,Yt,br,"Failed to send message");else{const Yn=br instanceof Error?br.message:"Failed to send message";t.setSessionError(Yn)}}finally{m.value=!1}}async function st(){try{l(t.activeConversationId)}catch{}}function zt(){t.isActiveConversationStreaming?nr():Be()}function nr(){const ce=t.activeConversationId;if(!ce)return;const xe=P7({text:u.value,attachments:b.value});xe&&(M(ce,[...C.value,xe]),u.value="",B(),Zt(),Nt())}function nn(ce){const xe=t.activeConversationId;xe&&M(xe,T7(C.value,ce))}async function vr(){const ce=t.activeConversationId;if(!ce)return;const xe=S.value[ce]??[];if(xe.length===0||t.isActiveConversationStreaming||m.value)return;const[_e,...qe]=xe;M(ce,qe),await Be(_e.text,_e.attachments)}async function qn(){if(t.activeConversationId){u.value="",B(),Zt(),m.value=!0;try{await c(t.activeConversationId);const ce=t.addAssistantMessage(t.activeConversationId);t.updateMessage(ce.id,{content:"✨ **Context cleared** — The AI conversation context has been reset. Starting fresh from here.",status:"complete"},t.activeConversationId);const{useToast:xe}=await ls(async()=>{const{useToast:qe}=await import("./CFoLn9L9.js").then(Fe=>Fe.n);return{useToast:qe}},__vite__mapDeps([0,1,2]),import.meta.url);xe().success("AI context has been reset. The conversation will start fresh.")}catch(ce){console.error("Failed to reset context:",ce);const{useToast:xe}=await ls(async()=>{const{useToast:qe}=await import("./CFoLn9L9.js").then(Fe=>Fe.n);return{useToast:qe}},__vite__mapDeps([0,1,2]),import.meta.url);xe().error("Failed to reset context. Please try again.")}finally{m.value=!1}}}async function sn(){const ce=t.messages;let xe=null;for(let Fe=ce.length-1;Fe>=0;Fe--)if(ce[Fe].role==="user"){xe={content:ce[Fe].content,attachments:ce[Fe].attachments??[]};break}if(!xe||!t.activeConversationId)return;const _e=t.activeConversationId;t.clearError(),m.value=!0;let qe=null;try{const Fe=q(_e);qe=Fe.id,await s(xe.content,Fe.id,_e,$e(xe.attachments))}catch(Fe){if(qe)Oe(_e,qe,Fe,"Failed to retry message");else{const $t=Fe instanceof Error?Fe.message:"Failed to retry message";t.setSessionError($t,_e)}}finally{m.value=!1}}function jn(ce){ce.key==="Enter"&&!ce.shiftKey&&(ce.preventDefault(),zt())}function on(){const ce=h.value;if(ce){if(!u.value.trim()){ce.style.height="";return}ce.style.height="auto",ce.style.height=Math.min(ce.scrollHeight,200)+"px"}}function kn(){if(x!==null)return;x=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):xe=>setTimeout(()=>xe(Date.now()),16))(()=>{x=null,on()})}function Zt(){const ce=h.value;ce&&(ce.style.height="")}function Nt(){Xt(()=>{h.value?.focus()})}return Ve(u,kn),Ve(()=>t.isActiveConversationStreaming,(ce,xe)=>{xe&&!ce&&(C.value.length>0?Xt(()=>vr()):Nt())}),Ve(()=>t.activeConversationId,()=>{t.activeConversationId&&(w.value=null),B(),Nt(),!t.isActiveConversationStreaming&&C.value.length>0&&Xt(()=>vr())}),(ce,xe)=>(v(),y("div",M7,[f("div",A7,[f("div",_7,[f("button",{disabled:r.disabled||p(t).isActiveConversationStreaming||p(Se)||p(Qe)||p(V)||p(ue).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:xe[0]||(xe[0]=_e=>O.value=!p(O))},[f("span",B7,_(p(W)),1),J(p(Dm),{class:"w-3 h-3 flex-shrink-0"})],8,R7),p(O)?(v(),y("div",Z7,[p(ue).length===0?(v(),y("div",E7," Loading models... ")):U("",!0),(v(!0),y(ke,null,Ne(p(j),_e=>(v(),y("div",{key:_e.providerId,class:"py-0.5"},[f("div",D7,_(_e.providerName),1),(v(!0),y(ke,null,Ne(_e.options,qe=>(v(),y("button",{key:qe.key,disabled:!qe.compatible,class:Re(["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",p(Z)===qe.key?"bg-retro-panel text-retro-text":"text-retro-muted"]),onClick:Fe=>z(qe)},[f("span",X7,_(qe.modelLabel)+_(qe.compatible?"":" (unsupported for current permission mode)"),1)],10,L7))),128))]))),128))])):U("",!0)]),f("div",I7,[f("button",{class:Re(["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",H[p(t).permissionMode]]),onClick:xe[1]||(xe[1]=_e=>g.value=!p(g))},[(v(),pe(Vs(ve[p(t).permissionMode]),{class:"w-4 h-4"})),f("span",null,_(p(Ts)[p(t).permissionMode]),1),J(p(Dm),{class:"w-3 h-3"})],2),p(g)?(v(),y("div",V7,[(v(),y(ke,null,Ne(["plan","ask","auto","bypass"],_e=>f("button",{key:_e,class:Re(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors",[H[_e],p(t).permissionMode===_e?"bg-retro-panel":""]]),onClick:qe=>G(_e)},[(v(),pe(Vs(ve[_e]),{class:"w-4 h-4"})),f("span",null,_(p(Ts)[_e]),1)],10,z7)),64))])):U("",!0)]),f("span",N7,_(p(t).permissionMode==="plan"?"Plan only":p(t).permissionMode==="ask"?"Ask before actions":p(t).permissionMode==="auto"?"Auto approve":"All permissions"),1)]),p(Se)?(v(),y("div",W7,[f("div",q7,[f("div",j7,[xe[4]||(xe[4]=f("div",{class:"text-xs font-mono text-retro-yellow font-bold mb-1"}," Permission Required ",-1)),f("div",Y7,[f("span",F7,_(p(t).pendingPermission?.tool),1),p(t).pendingPermission?.filePath?(v(),y("span",U7," - "+_(p(t).pendingPermission.filePath),1)):p(t).pendingPermission?.command?(v(),y("span",G7," - "+_(p(t).pendingPermission.command),1)):U("",!0)])]),f("div",{class:"flex gap-2 flex-shrink-0"},[f("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:Ye}," Allow "),f("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:P}," Deny ")])])])):U("",!0),p(Qe)?(v(),y("div",H7,[f("div",{class:"flex items-center justify-between gap-3"},[xe[5]||(xe[5]=f("div",{class:"flex-1 min-w-0"},[f("div",{class:"text-xs font-mono text-retro-cyan font-bold mb-1"}," Plan Ready for Review "),f("div",{class:"text-xs font-mono text-retro-muted"}," Approve to switch to Auto mode and start implementation. ")],-1)),f("div",{class:"flex gap-2 flex-shrink-0"},[f("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:T}," Approve & Implement "),f("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:E}," Reject ")])])])):U("",!0),p(b).length>0?(v(),y("div",K7,[(v(!0),y(ke,null,Ne(p(b),_e=>(v(),y("div",{key:_e.id,class:"relative w-24 rounded border border-retro-border/70 bg-retro-black/80 p-1"},[f("img",{src:_e.dataUrl,alt:_e.name,class:"h-16 w-full rounded object-cover"},null,8,J7),f("div",e8,_(_e.name),1),f("div",t8,_(p(w7)(_e.size)),1),f("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:qe=>be(_e.id)},[J(p(wt),{class:"h-3 w-3"})],8,r8)]))),128))])):U("",!0),p(C).length>0?(v(),y("div",n8,[f("div",s8," Queued ("+_(p(C).length)+") ",1),f("div",i8,[(v(!0),y(ke,null,Ne(p(C),(_e,qe)=>(v(),y("div",{key:_e.id,class:"flex items-center gap-2 px-2.5 py-1.5 bg-retro-panel/50 border border-retro-border/30 rounded"},[f("span",o8,"#"+_(qe+1),1),f("span",a8,_(_e.text),1),_e.attachments.length>0?(v(),y("span",l8," +"+_(_e.attachments.length)+" img ",1)):U("",!0),f("button",{class:"flex-shrink-0 p-0.5 text-retro-muted hover:text-retro-red transition-colors",title:"Cancel queued message",onClick:Fe=>nn(_e.id)},[J(p(wt),{class:"w-3.5 h-3.5"})],8,c8)]))),128))])])):U("",!0),f("div",u8,[f("input",{ref_key:"fileInputRef",ref:d,type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:Ae},null,544),f("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:r.disabled||p(Se)||p(Qe),onClick:xe[2]||(xe[2]=_e=>p(d)?.click())},[J(p(wv),{class:"w-5 h-5"})],8,h8),f("div",d8,[je(f("textarea",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":xe[3]||(xe[3]=_e=>et(u)?u.value=_e:null),disabled:r.disabled||p(Se)||p(Qe),placeholder:r.disabled?"This conversation is finalized (read-only)":p(t).isActiveConversationStreaming?"Type to queue a message...":"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:jn},null,40,f8),[[_t,p(u)]])]),p(Te)?(v(),y("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:sn},[J(p(o7),{class:"w-5 h-5"})])):U("",!0),p(Se)?U("",!0):(v(),y("button",{key:1,disabled:!p(ge),title:p(t).isActiveConversationStreaming?"Queue message":"Send message",class:Re(["flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded disabled:opacity-50 disabled:cursor-not-allowed transition-colors",p(t).isActiveConversationStreaming?"bg-retro-yellow/20 text-retro-yellow hover:bg-retro-yellow/30":"bg-retro-cyan/20 text-retro-cyan hover:bg-retro-cyan/30"]),onClick:zt},[p(t).isActiveConversationStreaming?(v(),pe(p($v),{key:0,class:"w-5 h-5"})):(v(),pe(p(a7),{key:1,class:"w-5 h-5"}))],10,m8)),p(me)?(v(),y("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:st},[J(p(l7),{class:"w-5 h-5"})])):U("",!0)]),xe[6]||(xe[6]=f("div",{class:"mt-1 text-xs font-mono text-retro-muted"}," Press Enter to send (or queue while AI is responding), Shift+Enter for new line. Slash commands: `/context`, `/reset`, `/new`, `/clear`, `/spec-search`. ",-1))]))}}),g8={class:"h-64 border-t border-retro-border bg-retro-dark/50 flex flex-col"},O8={class:"h-9 flex items-center justify-between px-3 border-b border-retro-border/40"},v8={key:0,class:"flex-1 flex items-center justify-center text-xs font-mono text-retro-muted"},b8={key:1,class:"flex-1 overflow-y-auto scrollbar-custom"},x8={class:"flex items-center gap-2 text-[10px] font-mono"},y8={class:"text-retro-muted"},k8={class:"text-retro-muted"},w8={class:"text-retro-green truncate"},S8={class:"mt-1 text-[11px] font-mono text-retro-text whitespace-pre-wrap break-words"},$8=Ie({__name:"ChatDebugPanel",setup(r){const e=gr(),{debugEvents:t}=M1(e);function n(i){return new Date(i).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function s(i){return i==="in"?"text-retro-cyan":i==="out"?"text-retro-yellow":"text-retro-muted"}return(i,o)=>(v(),y("div",g8,[f("div",O8,[o[1]||(o[1]=f("div",{class:"text-[11px] font-mono text-retro-text"}," Debug Stream (CLI/Provider) ",-1)),f("button",{class:"p-1 rounded hover:bg-retro-panel transition-colors",title:"Clear debug events",onClick:o[0]||(o[0]=a=>p(e).clearDebugEvents())},[J(p(gn),{class:"w-3.5 h-3.5 text-retro-muted"})])]),p(t).length===0?(v(),y("div",v8," No debug events yet ")):(v(),y("div",b8,[(v(!0),y(ke,null,Ne(p(t),a=>(v(),y("div",{key:a.id,class:"px-3 py-2 border-b border-retro-border/20"},[f("div",x8,[f("span",y8,_(n(a.timestamp)),1),f("span",{class:Re(s(a.direction))},_(a.direction.toUpperCase()),3),f("span",k8,_(a.channel),1),f("span",w8,_(a.eventType),1)]),f("pre",S8,_(a.payload),1)]))),128))]))]))}}),C8={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},Q8={class:"flex items-center justify-between"},P8={class:"space-y-1 text-xs font-mono"},T8={class:"flex items-center gap-2"},M8={class:"relative"},A8=["disabled"],_8=["value"],R8=["value"],B8={class:"flex items-center gap-2"},Z8={class:"text-retro-text"},E8={class:"relative"},D8=["disabled"],L8=["disabled"],X8={class:"flex items-center gap-2"},I8=["disabled"],V8=["disabled"],z8=Ie({__name:"FinalizeConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=r,n=e,s=Q(""),i=Q(null),o=Q(!1),a=Q(!1),l=Q(t.baseBranch),c=Q([]),u=Q(!1),h=Pu(),d=Q(null);async function m(){a.value=!0;try{const O=await $fetch("/api/chat/generate-commit-message",{method:"POST",body:{conversationId:t.worktreePath.split("/").pop()?.replace("sc-","")||"",worktreePath:t.worktreePath}});O.success&&O.message&&(s.value=O.message)}catch{}finally{a.value=!1}}pt(async()=>{const O=(async()=>{try{const x=t.worktreePath.split("/").pop()||"",w=await $fetch(`/api/commits/${encodeURIComponent(x)}`,{params:{workingDirectory:t.worktreePath}});i.value=w.aheadCount}catch{i.value=null}})(),b=(async()=>{u.value=!0;try{await h.initialize();const x=await $fetch("/api/git/branches",{query:{workingDirectory:h.workingDirectory}});c.value=x.branches.filter(w=>!w.isRemote&&!w.name.startsWith("sc/")).map(w=>w.name),c.value.length>0&&!c.value.includes(l.value)&&(l.value=c.value.includes("main")?"main":c.value.includes("master")?"master":c.value[0])}catch{c.value=[]}finally{u.value=!1}})();await Promise.all([O,b]),Xt(()=>d.value?.focus())});function g(){s.value.trim()&&(o.value=!0,n("confirm",s.value.trim(),l.value))}return(O,b)=>(v(),y("div",C8,[f("div",Q8,[b[4]||(b[4]=f("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Finalize ",-1)),f("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:b[0]||(b[0]=x=>n("cancel"))},[J(p(wt),{class:"w-4 h-4"})])]),f("div",P8,[f("div",T8,[b[5]||(b[5]=f("span",{class:"text-retro-muted"},"target:",-1)),f("div",M8,[je(f("select",{"onUpdate:modelValue":b[1]||(b[1]=x=>l.value=x),disabled:o.value||u.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"},[u.value?(v(),y("option",{key:0,value:r.baseBranch},_(r.baseBranch),9,_8)):U("",!0),(v(!0),y(ke,null,Ne(c.value,x=>(v(),y("option",{key:x,value:x},_(x),9,R8))),128))],8,A8),[[gs,l.value]]),J(p(Au),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),f("div",B8,[b[6]||(b[6]=f("span",{class:"text-retro-muted"},"commits:",-1)),f("span",Z8,_(i.value!==null?i.value:"..."),1)])]),f("div",E8,[je(f("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":b[2]||(b[2]=x=>s.value=x),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:o.value||a.value},null,8,D8),[[_t,s.value]]),f("button",{type:"button",disabled:o.value||a.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:m},[J(p(Pa),{class:Re(["w-4 h-4",{"animate-spin":a.value}])},null,8,["class"])],8,L8)]),f("div",X8,[f("button",{type:"button",disabled:!s.value.trim()||o.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},[J(p(Mu),{class:"w-3.5 h-3.5"}),Xe(" "+_(o.value?"Finalizing...":"Confirm"),1)],8,I8),f("button",{type:"button",disabled:o.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:b[3]||(b[3]=x=>n("cancel"))}," Cancel ",8,V8)])]))}}),N8={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},W8={class:"flex items-center justify-between"},q8={class:"space-y-1 text-xs font-mono"},j8={class:"flex items-center gap-2"},Y8={class:"text-retro-cyan"},F8={class:"flex items-center gap-2"},U8={class:"relative"},G8=["disabled"],H8=["value"],K8=["value"],J8={class:"flex items-center gap-2"},eZ={class:"text-retro-text"},tZ={class:"flex items-center gap-2"},rZ=["disabled"],nZ=["disabled"],sZ=Ie({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=r,n=e,s=Q(null),i=Q(!1),o=Q(t.baseBranch),a=Q([]),l=Q(!1),c=Pu();async function u(d){try{const m=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:d}});s.value=m.ahead}catch{s.value=null}}pt(async()=>{const d=u(o.value),m=(async()=>{l.value=!0;try{await c.initialize();const g=await $fetch("/api/git/branches",{query:{workingDirectory:c.workingDirectory}});a.value=g.branches.filter(O=>!O.isRemote&&!O.name.startsWith("sc/")).map(O=>O.name),a.value.length>0&&!a.value.includes(o.value)&&(o.value=a.value.includes("main")?"main":a.value.includes("master")?"master":a.value[0])}catch{a.value=[]}finally{l.value=!1}})();await Promise.all([d,m])}),Ve(o,d=>{u(d)});function h(){i.value=!0,n("confirm",o.value)}return(d,m)=>(v(),y("div",N8,[f("div",W8,[m[3]||(m[3]=f("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Rebase Worktree ",-1)),f("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:m[0]||(m[0]=g=>n("cancel"))},[J(p(wt),{class:"w-4 h-4"})])]),f("div",q8,[f("div",j8,[m[4]||(m[4]=f("span",{class:"text-retro-muted"},"worktree:",-1)),f("span",Y8,_(r.worktreeBranch),1)]),f("div",F8,[m[5]||(m[5]=f("span",{class:"text-retro-muted"},"target:",-1)),f("div",U8,[je(f("select",{"onUpdate:modelValue":m[1]||(m[1]=g=>o.value=g),disabled:i.value||l.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"},[l.value?(v(),y("option",{key:0,value:r.baseBranch},_(r.baseBranch),9,H8)):U("",!0),(v(!0),y(ke,null,Ne(a.value,g=>(v(),y("option",{key:g,value:g},_(g),9,K8))),128))],8,G8),[[gs,o.value]]),J(p(Au),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),f("div",J8,[m[6]||(m[6]=f("span",{class:"text-retro-muted"},"commits ahead:",-1)),f("span",eZ,_(s.value!==null?s.value:"..."),1)])]),f("div",tZ,[f("button",{type:"button",disabled:i.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:h},[J(p(Mu),{class:"w-3.5 h-3.5"}),Xe(" "+_(i.value?"Rebasing...":"Confirm"),1)],8,rZ),f("button",{type:"button",disabled:i.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:m[2]||(m[2]=g=>n("cancel"))}," Cancel ",8,nZ)])]))}}),iZ={class:"flex-1 flex flex-col overflow-hidden"},oZ={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},aZ={class:"text-xs font-mono text-retro-text truncate"},lZ={class:"flex items-center gap-2 flex-shrink-0"},cZ={key:0,class:"text-xs font-mono text-retro-green"},uZ={key:1,class:"text-[11px] font-mono text-retro-muted"},hZ={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},dZ=["innerHTML"],fZ={key:0,class:"flex-shrink-0 px-4 py-2 border-t border-retro-border bg-retro-yellow/10 text-retro-yellow text-xs font-mono"},mZ=Ie({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},isAiResolving:{type:Boolean},strategy:{}},emits:["resolve","aiResolve","retry"],setup(r,{emit:e}){const t=r;Q(t.file.content);const n=Q(""),s=Q(!1);Ve(()=>t.file.path,()=>{a()}),Ve(()=>t.file.content,()=>{a()});const i=K(()=>{const c=/^<{7}\s/gm;return(t.file.content.match(c)||[]).length});function o(c){const u=c.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"}[u]||"text"}async function a(){s.value=!0;try{const{codeToHtml:c}=await ls(async()=>{const{codeToHtml:x}=await import("./BouwExBZ.js");return{codeToHtml:x}},__vite__mapDeps([3,1,2]),import.meta.url),u=o(t.file.path),d=t.file.content.split(`
|
|
71
|
+
`)}function x1(r){return`${r.providerId}::${r.modelKey}`}function b7(r,e){const t=new Map;for(const s of r)for(const i of s.models)t.set(i.label,(t.get(i.label)??0)+1);return r.flatMap(s=>s.models.map(i=>{const o=s.capabilities.streaming&&(!e||s.capabilities.permissions),a=(t.get(i.label)??0)>1;return{key:`${s.id}::${i.key}`,providerId:s.id,providerName:s.name,modelKey:i.key,modelLabel:i.label,label:a?`${i.label} · ${s.name}`:i.label,compatible:o}})).sort((s,i)=>s.modelLabel.localeCompare(i.modelLabel,void 0,{sensitivity:"base"})||s.providerName.localeCompare(i.providerName,void 0,{sensitivity:"base"}))}function x7(r){const e=new Map;for(const s of r){const i=e.get(s.providerId);if(i){i.options.push(s);continue}e.set(s.providerId,{providerId:s.providerId,providerName:s.providerName,options:[s]})}const t=new Map([["codex",0],["claude",1]]),n=Array.from(e.values());return n.sort((s,i)=>{const o=t.get(s.providerId)??99,a=t.get(i.providerId)??99;return o!==a?o-a:s.providerName.localeCompare(i.providerName,void 0,{sensitivity:"base"})}),n}function y7(r,e){const t=x1(e);return r.find(n=>n.key===t)??null}const Lm=4,k7=5*1024*1024;function w7(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function S7(r,e=k7){return r.type.startsWith("image/")?r.size>e?{ok:!1,reason:"too-large"}:{ok:!0}:{ok:!1,reason:"not-image"}}function $7(r){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{typeof n.result=="string"?e(n.result):t(new Error("Failed to read image"))},n.onerror=()=>t(n.error||new Error("Failed to read image")),n.readAsDataURL(r)})}function C7(r=Date.now,e=Math.random){return`att-${r()}-${e().toString(36).slice(2,8)}`}function Q7(r=Date.now,e=Math.random){return`q-${r()}-${e().toString(36).slice(2,8)}`}function P7(r,e=Q7){const t=r.text.trim();return t.length===0&&r.attachments.length===0?null:{id:e(),text:t,attachments:[...r.attachments]}}function T7(r,e){return r.filter(t=>t.id!==e)}const M7={class:"flex-shrink-0 flex-grow-0 border-t border-retro-border bg-retro-dark p-3"},A7={class:"flex items-center gap-2 mb-2"},_7={class:"relative min-w-0 flex-1 max-w-[154px] model-selector"},R7=["disabled"],B7={class:"truncate text-left"},Z7={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]"},E7={key:0,class:"px-3 py-1.5 text-xs font-mono text-retro-muted"},D7={class:"px-3 py-1 text-[11px] font-mono uppercase tracking-wide text-retro-cyan/80 select-none"},L7=["disabled","onClick"],X7={class:"truncate"},I7={class:"relative mode-selector"},V7={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]"},z7=["onClick"],N7={class:"text-xs font-mono text-retro-muted"},W7={key:0,class:"mb-3 p-3 bg-retro-yellow/10 border border-retro-yellow/50 rounded"},q7={class:"flex items-center justify-between gap-3"},j7={class:"flex-1 min-w-0"},Y7={class:"text-xs font-mono text-retro-text truncate"},F7={class:"text-retro-cyan"},U7={key:0,class:"text-retro-muted"},G7={key:1,class:"text-retro-muted"},H7={key:1,class:"mb-3 p-3 bg-retro-cyan/10 border border-retro-cyan/50 rounded"},K7={key:2,class:"mb-2 flex flex-wrap gap-2"},J7=["src","alt"],e8={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},t8={class:"truncate text-[10px] font-mono text-retro-muted/80"},r8=["onClick"],n8={key:3,class:"mb-2"},s8={class:"text-[10px] font-mono text-retro-muted mb-1 uppercase tracking-wide"},i8={class:"space-y-1"},o8={class:"text-[10px] font-mono text-retro-yellow flex-shrink-0"},a8={class:"flex-1 text-xs font-mono text-retro-text truncate"},l8={key:0,class:"text-[10px] font-mono text-retro-muted flex-shrink-0"},c8=["onClick"],u8={class:"flex gap-2 items-start"},h8=["disabled"],d8={class:"flex-1 relative min-h-[40px]"},f8=["disabled","placeholder"],m8=["disabled","title"],p8=Ie({__name:"ChatInput",props:{disabled:{type:Boolean}},setup(r){const e=r,t=gr(),n=Oo(),{sendMessage:s,sendPermissionResponse:i,approvePlan:o,rejectPlan:a,abort:l,resetContext:c}=Pl(),u=Q(""),h=Q(null),d=Q(null),m=Q(!1),g=Q(!1),O=Q(!1),b=Q([]);let x=null;const w=Q(null),S=Q({}),C=K(()=>{const ce=t.activeConversationId;return ce?S.value[ce]??[]:[]});function M(ce,xe){if(xe.length===0){const{[ce]:_e,...qe}=S.value;S.value=qe}else S.value={...S.value,[ce]:xe}}const{data:X,pending:V}=wc("chat-input-ai-providers",()=>$fetch("/api/ai/providers"),{server:!1,default:()=>({providers:[]})}),se=K(()=>X.value?.providers??[]),le=K(()=>t.permissionMode==="ask"||t.permissionMode==="plan"),ue=K(()=>b7(se.value,le.value)),j=K(()=>x7(ue.value)),I=K(()=>{const ce=t.activeConversation;return ce?.providerId&&ce.providerModelKey?{providerId:ce.providerId,modelKey:ce.providerModelKey}:w.value?w.value:n.providerSelection}),Z=K(()=>x1(I.value)),F=K(()=>y7(ue.value,I.value)),W=K(()=>F.value?.label||"Select model");function N(ce,xe){t.setConversationProviderSelection(ce,xe.providerId,xe.modelKey),t.clearProviderSession(ce),t.saveConversation(ce,!0)}function L(ce){w.value&&(N(ce,w.value),w.value=null)}function z(ce){if(!ce||!ce.compatible)return;const xe={providerId:ce.providerId,modelKey:ce.modelKey},_e=t.activeConversationId;if(_e){N(_e,xe),w.value=null,O.value=!1;return}w.value=xe,O.value=!1}const ve={plan:_u,ask:Ru,auto:Hm,bypass:Bu},H={plan:"text-retro-cyan",ask:"text-retro-green",auto:"text-retro-yellow",bypass:"text-retro-red"};function G(ce){t.setPermissionMode(ce),g.value=!1}function te(ce){const xe=ce.target;xe.closest(".mode-selector")||(g.value=!1),xe.closest(".model-selector")||(O.value=!1)}pt(()=>{document.addEventListener("click",te),n.hydrate()}),kt(()=>{document.removeEventListener("click",te),x!==null&&typeof window<"u"&&typeof window.cancelAnimationFrame=="function"&&(window.cancelAnimationFrame(x),x=null)});const ge=K(()=>(u.value.trim().length>0||b.value.length>0)&&!m.value&&!t.pendingPermission&&!Qe.value),me=K(()=>t.isActiveConversationStreaming&&!t.pendingPermission),Se=K(()=>t.pendingPermission!==null),Qe=K(()=>t.pendingPlanApproval!==null);function Ye(){i(!0,t.activeConversationId)}function P(){i(!1,t.activeConversationId)}function T(){o(t.activeConversationId)}function E(){a(t.activeConversationId)}function B(){b.value=[],d.value&&(d.value.value="")}function be(ce){b.value=b.value.filter(xe=>xe.id!==ce)}async function Ae(ce){const xe=ce.target,_e=xe.files?Array.from(xe.files):[];if(_e.length===0)return;const{useToast:qe}=await ls(async()=>{const{useToast:it}=await import("./D_05ko21.js").then(Yt=>Yt.n);return{useToast:it}},__vite__mapDeps([0,1,2]),import.meta.url),Fe=qe();let $t=Lm-b.value.length;if($t<=0){Fe.warning(`You can attach up to ${Lm} images per message.`),xe.value="";return}for(const it of _e){if($t<=0)break;const Yt=S7(it);if(!Yt.ok){Yt.reason==="not-image"?Fe.warning(`Skipped "${it.name}": only image files are supported.`):Fe.warning(`Skipped "${it.name}": max size is 5 MB.`);continue}try{const sr=await $7(it);b.value.push({id:C7(),name:it.name,mimeType:it.type,size:it.size,dataUrl:sr}),$t--}catch{Fe.error(`Failed to attach "${it.name}".`)}}xe.value=""}const Te=K(()=>{if(t.isActiveConversationStreaming||m.value)return!1;const ce=t.lastMessage;return ce?.role==="assistant"&&ce?.status==="error"});async function ae(ce){const xe=t.activeConversationId??await t.createConversation(),_e=t.addAssistantMessage(xe);if(!ce.q){t.updateMessage(_e.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(`
|
|
72
|
+
`),status:"complete"},xe);return}const qe=t.activeConversation,Fe=f7(ce,{featureId:qe?.featureId});try{const $t=await $fetch("/api/specs/search",{query:Fe});t.updateMessage(_e.id,{content:v7({...ce,mode:Fe.mode,featureId:Fe.featureId},$t),status:"complete"},xe)}catch($t){const it=$t instanceof Error?$t.message:"Failed to run spec search";t.updateMessage(_e.id,{content:`Spec search failed: ${it}`,status:"error"},xe)}}async function re(){const ce=d7(t.activeConversation,t.permissionMode),xe=await $fetch("/api/chat/context",{query:ce}),_e=t.activeConversationId??await t.createConversation(),qe=t.addAssistantMessage(_e);t.updateMessage(qe.id,{content:m7(xe),status:"complete"},_e)}function $e(ce=[]){const xe=Ca(t.activeConversation,!0)??{};return ce.length>0?{...xe,attachments:ce}:Object.keys(xe).length>0?xe:void 0}function q(ce){const xe=t.addAssistantMessage(ce);return t.startSession(`session-${Date.now()}`,ce),t.startConversationStreaming(ce),t.saveConversation(ce,!0),xe}function Oe(ce,xe,_e,qe){const Fe=_e instanceof Error?_e.message:qe;t.setSessionError(Fe,ce),t.updateMessage(xe,{status:"error"},ce),t.endSession(ce),t.endConversationStreaming(ce)}async function Be(ce,xe){const _e=ce!==void 0,qe=(ce??u.value).trim(),Fe=xe??[...b.value];if(qe.length===0&&Fe.length===0||t.isActiveConversationStreaming||m.value||e.disabled)return;const $t=!!t.activeConversationId;let it=null,Yt=null;const sr=h7(qe);if(sr.kind!=="none"){if(sr.kind==="reset"){await qn();return}sr.kind==="context"?await re():sr.kind==="spec-search"&&await ae(sr.command),_e||(u.value="",B(),Zt());return}m.value=!0,_e||(u.value="",B(),Zt());try{if(await t.addUserMessageWithConversation(qe,Fe),it=t.activeConversationId,!it)throw new Error("Failed to create or select a conversation");$t||L(it);const br=q(it);Yt=br.id,await s(qe,br.id,it,$e(Fe))}catch(br){if(it&&Yt)Oe(it,Yt,br,"Failed to send message");else{const Yn=br instanceof Error?br.message:"Failed to send message";t.setSessionError(Yn)}}finally{m.value=!1}}async function st(){try{l(t.activeConversationId)}catch{}}function zt(){t.isActiveConversationStreaming?nr():Be()}function nr(){const ce=t.activeConversationId;if(!ce)return;const xe=P7({text:u.value,attachments:b.value});xe&&(M(ce,[...C.value,xe]),u.value="",B(),Zt(),Nt())}function nn(ce){const xe=t.activeConversationId;xe&&M(xe,T7(C.value,ce))}async function vr(){const ce=t.activeConversationId;if(!ce)return;const xe=S.value[ce]??[];if(xe.length===0||t.isActiveConversationStreaming||m.value)return;const[_e,...qe]=xe;M(ce,qe),await Be(_e.text,_e.attachments)}async function qn(){if(t.activeConversationId){u.value="",B(),Zt(),m.value=!0;try{await c(t.activeConversationId);const ce=t.addAssistantMessage(t.activeConversationId);t.updateMessage(ce.id,{content:"✨ **Context cleared** — The AI conversation context has been reset. Starting fresh from here.",status:"complete"},t.activeConversationId);const{useToast:xe}=await ls(async()=>{const{useToast:qe}=await import("./D_05ko21.js").then(Fe=>Fe.n);return{useToast:qe}},__vite__mapDeps([0,1,2]),import.meta.url);xe().success("AI context has been reset. The conversation will start fresh.")}catch(ce){console.error("Failed to reset context:",ce);const{useToast:xe}=await ls(async()=>{const{useToast:qe}=await import("./D_05ko21.js").then(Fe=>Fe.n);return{useToast:qe}},__vite__mapDeps([0,1,2]),import.meta.url);xe().error("Failed to reset context. Please try again.")}finally{m.value=!1}}}async function sn(){const ce=t.messages;let xe=null;for(let Fe=ce.length-1;Fe>=0;Fe--)if(ce[Fe].role==="user"){xe={content:ce[Fe].content,attachments:ce[Fe].attachments??[]};break}if(!xe||!t.activeConversationId)return;const _e=t.activeConversationId;t.clearError(),m.value=!0;let qe=null;try{const Fe=q(_e);qe=Fe.id,await s(xe.content,Fe.id,_e,$e(xe.attachments))}catch(Fe){if(qe)Oe(_e,qe,Fe,"Failed to retry message");else{const $t=Fe instanceof Error?Fe.message:"Failed to retry message";t.setSessionError($t,_e)}}finally{m.value=!1}}function jn(ce){ce.key==="Enter"&&!ce.shiftKey&&(ce.preventDefault(),zt())}function on(){const ce=h.value;if(ce){if(!u.value.trim()){ce.style.height="";return}ce.style.height="auto",ce.style.height=Math.min(ce.scrollHeight,200)+"px"}}function kn(){if(x!==null)return;x=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):xe=>setTimeout(()=>xe(Date.now()),16))(()=>{x=null,on()})}function Zt(){const ce=h.value;ce&&(ce.style.height="")}function Nt(){Xt(()=>{h.value?.focus()})}return Ve(u,kn),Ve(()=>t.isActiveConversationStreaming,(ce,xe)=>{xe&&!ce&&(C.value.length>0?Xt(()=>vr()):Nt())}),Ve(()=>t.activeConversationId,()=>{t.activeConversationId&&(w.value=null),B(),Nt(),!t.isActiveConversationStreaming&&C.value.length>0&&Xt(()=>vr())}),(ce,xe)=>(v(),y("div",M7,[f("div",A7,[f("div",_7,[f("button",{disabled:r.disabled||p(t).isActiveConversationStreaming||p(Se)||p(Qe)||p(V)||p(ue).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:xe[0]||(xe[0]=_e=>O.value=!p(O))},[f("span",B7,_(p(W)),1),J(p(Dm),{class:"w-3 h-3 flex-shrink-0"})],8,R7),p(O)?(v(),y("div",Z7,[p(ue).length===0?(v(),y("div",E7," Loading models... ")):U("",!0),(v(!0),y(ke,null,Ne(p(j),_e=>(v(),y("div",{key:_e.providerId,class:"py-0.5"},[f("div",D7,_(_e.providerName),1),(v(!0),y(ke,null,Ne(_e.options,qe=>(v(),y("button",{key:qe.key,disabled:!qe.compatible,class:Re(["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",p(Z)===qe.key?"bg-retro-panel text-retro-text":"text-retro-muted"]),onClick:Fe=>z(qe)},[f("span",X7,_(qe.modelLabel)+_(qe.compatible?"":" (unsupported for current permission mode)"),1)],10,L7))),128))]))),128))])):U("",!0)]),f("div",I7,[f("button",{class:Re(["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",H[p(t).permissionMode]]),onClick:xe[1]||(xe[1]=_e=>g.value=!p(g))},[(v(),pe(Vs(ve[p(t).permissionMode]),{class:"w-4 h-4"})),f("span",null,_(p(Ts)[p(t).permissionMode]),1),J(p(Dm),{class:"w-3 h-3"})],2),p(g)?(v(),y("div",V7,[(v(),y(ke,null,Ne(["plan","ask","auto","bypass"],_e=>f("button",{key:_e,class:Re(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors",[H[_e],p(t).permissionMode===_e?"bg-retro-panel":""]]),onClick:qe=>G(_e)},[(v(),pe(Vs(ve[_e]),{class:"w-4 h-4"})),f("span",null,_(p(Ts)[_e]),1)],10,z7)),64))])):U("",!0)]),f("span",N7,_(p(t).permissionMode==="plan"?"Plan only":p(t).permissionMode==="ask"?"Ask before actions":p(t).permissionMode==="auto"?"Auto approve":"All permissions"),1)]),p(Se)?(v(),y("div",W7,[f("div",q7,[f("div",j7,[xe[4]||(xe[4]=f("div",{class:"text-xs font-mono text-retro-yellow font-bold mb-1"}," Permission Required ",-1)),f("div",Y7,[f("span",F7,_(p(t).pendingPermission?.tool),1),p(t).pendingPermission?.filePath?(v(),y("span",U7," - "+_(p(t).pendingPermission.filePath),1)):p(t).pendingPermission?.command?(v(),y("span",G7," - "+_(p(t).pendingPermission.command),1)):U("",!0)])]),f("div",{class:"flex gap-2 flex-shrink-0"},[f("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:Ye}," Allow "),f("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:P}," Deny ")])])])):U("",!0),p(Qe)?(v(),y("div",H7,[f("div",{class:"flex items-center justify-between gap-3"},[xe[5]||(xe[5]=f("div",{class:"flex-1 min-w-0"},[f("div",{class:"text-xs font-mono text-retro-cyan font-bold mb-1"}," Plan Ready for Review "),f("div",{class:"text-xs font-mono text-retro-muted"}," Approve to switch to Auto mode and start implementation. ")],-1)),f("div",{class:"flex gap-2 flex-shrink-0"},[f("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:T}," Approve & Implement "),f("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:E}," Reject ")])])])):U("",!0),p(b).length>0?(v(),y("div",K7,[(v(!0),y(ke,null,Ne(p(b),_e=>(v(),y("div",{key:_e.id,class:"relative w-24 rounded border border-retro-border/70 bg-retro-black/80 p-1"},[f("img",{src:_e.dataUrl,alt:_e.name,class:"h-16 w-full rounded object-cover"},null,8,J7),f("div",e8,_(_e.name),1),f("div",t8,_(p(w7)(_e.size)),1),f("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:qe=>be(_e.id)},[J(p(wt),{class:"h-3 w-3"})],8,r8)]))),128))])):U("",!0),p(C).length>0?(v(),y("div",n8,[f("div",s8," Queued ("+_(p(C).length)+") ",1),f("div",i8,[(v(!0),y(ke,null,Ne(p(C),(_e,qe)=>(v(),y("div",{key:_e.id,class:"flex items-center gap-2 px-2.5 py-1.5 bg-retro-panel/50 border border-retro-border/30 rounded"},[f("span",o8,"#"+_(qe+1),1),f("span",a8,_(_e.text),1),_e.attachments.length>0?(v(),y("span",l8," +"+_(_e.attachments.length)+" img ",1)):U("",!0),f("button",{class:"flex-shrink-0 p-0.5 text-retro-muted hover:text-retro-red transition-colors",title:"Cancel queued message",onClick:Fe=>nn(_e.id)},[J(p(wt),{class:"w-3.5 h-3.5"})],8,c8)]))),128))])])):U("",!0),f("div",u8,[f("input",{ref_key:"fileInputRef",ref:d,type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:Ae},null,544),f("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:r.disabled||p(Se)||p(Qe),onClick:xe[2]||(xe[2]=_e=>p(d)?.click())},[J(p(wv),{class:"w-5 h-5"})],8,h8),f("div",d8,[je(f("textarea",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":xe[3]||(xe[3]=_e=>et(u)?u.value=_e:null),disabled:r.disabled||p(Se)||p(Qe),placeholder:r.disabled?"This conversation is finalized (read-only)":p(t).isActiveConversationStreaming?"Type to queue a message...":"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:jn},null,40,f8),[[_t,p(u)]])]),p(Te)?(v(),y("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:sn},[J(p(o7),{class:"w-5 h-5"})])):U("",!0),p(Se)?U("",!0):(v(),y("button",{key:1,disabled:!p(ge),title:p(t).isActiveConversationStreaming?"Queue message":"Send message",class:Re(["flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded disabled:opacity-50 disabled:cursor-not-allowed transition-colors",p(t).isActiveConversationStreaming?"bg-retro-yellow/20 text-retro-yellow hover:bg-retro-yellow/30":"bg-retro-cyan/20 text-retro-cyan hover:bg-retro-cyan/30"]),onClick:zt},[p(t).isActiveConversationStreaming?(v(),pe(p($v),{key:0,class:"w-5 h-5"})):(v(),pe(p(a7),{key:1,class:"w-5 h-5"}))],10,m8)),p(me)?(v(),y("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:st},[J(p(l7),{class:"w-5 h-5"})])):U("",!0)]),xe[6]||(xe[6]=f("div",{class:"mt-1 text-xs font-mono text-retro-muted"}," Press Enter to send (or queue while AI is responding), Shift+Enter for new line. Slash commands: `/context`, `/reset`, `/new`, `/clear`, `/spec-search`. ",-1))]))}}),g8={class:"h-64 border-t border-retro-border bg-retro-dark/50 flex flex-col"},O8={class:"h-9 flex items-center justify-between px-3 border-b border-retro-border/40"},v8={key:0,class:"flex-1 flex items-center justify-center text-xs font-mono text-retro-muted"},b8={key:1,class:"flex-1 overflow-y-auto scrollbar-custom"},x8={class:"flex items-center gap-2 text-[10px] font-mono"},y8={class:"text-retro-muted"},k8={class:"text-retro-muted"},w8={class:"text-retro-green truncate"},S8={class:"mt-1 text-[11px] font-mono text-retro-text whitespace-pre-wrap break-words"},$8=Ie({__name:"ChatDebugPanel",setup(r){const e=gr(),{debugEvents:t}=M1(e);function n(i){return new Date(i).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function s(i){return i==="in"?"text-retro-cyan":i==="out"?"text-retro-yellow":"text-retro-muted"}return(i,o)=>(v(),y("div",g8,[f("div",O8,[o[1]||(o[1]=f("div",{class:"text-[11px] font-mono text-retro-text"}," Debug Stream (CLI/Provider) ",-1)),f("button",{class:"p-1 rounded hover:bg-retro-panel transition-colors",title:"Clear debug events",onClick:o[0]||(o[0]=a=>p(e).clearDebugEvents())},[J(p(gn),{class:"w-3.5 h-3.5 text-retro-muted"})])]),p(t).length===0?(v(),y("div",v8," No debug events yet ")):(v(),y("div",b8,[(v(!0),y(ke,null,Ne(p(t),a=>(v(),y("div",{key:a.id,class:"px-3 py-2 border-b border-retro-border/20"},[f("div",x8,[f("span",y8,_(n(a.timestamp)),1),f("span",{class:Re(s(a.direction))},_(a.direction.toUpperCase()),3),f("span",k8,_(a.channel),1),f("span",w8,_(a.eventType),1)]),f("pre",S8,_(a.payload),1)]))),128))]))]))}}),C8={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},Q8={class:"flex items-center justify-between"},P8={class:"space-y-1 text-xs font-mono"},T8={class:"flex items-center gap-2"},M8={class:"relative"},A8=["disabled"],_8=["value"],R8=["value"],B8={class:"flex items-center gap-2"},Z8={class:"text-retro-text"},E8={class:"relative"},D8=["disabled"],L8=["disabled"],X8={class:"flex items-center gap-2"},I8=["disabled"],V8=["disabled"],z8=Ie({__name:"FinalizeConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=r,n=e,s=Q(""),i=Q(null),o=Q(!1),a=Q(!1),l=Q(t.baseBranch),c=Q([]),u=Q(!1),h=Pu(),d=Q(null);async function m(){a.value=!0;try{const O=await $fetch("/api/chat/generate-commit-message",{method:"POST",body:{conversationId:t.worktreePath.split("/").pop()?.replace("sc-","")||"",worktreePath:t.worktreePath}});O.success&&O.message&&(s.value=O.message)}catch{}finally{a.value=!1}}pt(async()=>{const O=(async()=>{try{const x=t.worktreePath.split("/").pop()||"",w=await $fetch(`/api/commits/${encodeURIComponent(x)}`,{params:{workingDirectory:t.worktreePath}});i.value=w.aheadCount}catch{i.value=null}})(),b=(async()=>{u.value=!0;try{await h.initialize();const x=await $fetch("/api/git/branches",{query:{workingDirectory:h.workingDirectory}});c.value=x.branches.filter(w=>!w.isRemote&&!w.name.startsWith("sc/")).map(w=>w.name),c.value.length>0&&!c.value.includes(l.value)&&(l.value=c.value.includes("main")?"main":c.value.includes("master")?"master":c.value[0])}catch{c.value=[]}finally{u.value=!1}})();await Promise.all([O,b]),Xt(()=>d.value?.focus())});function g(){s.value.trim()&&(o.value=!0,n("confirm",s.value.trim(),l.value))}return(O,b)=>(v(),y("div",C8,[f("div",Q8,[b[4]||(b[4]=f("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Finalize ",-1)),f("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:b[0]||(b[0]=x=>n("cancel"))},[J(p(wt),{class:"w-4 h-4"})])]),f("div",P8,[f("div",T8,[b[5]||(b[5]=f("span",{class:"text-retro-muted"},"target:",-1)),f("div",M8,[je(f("select",{"onUpdate:modelValue":b[1]||(b[1]=x=>l.value=x),disabled:o.value||u.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"},[u.value?(v(),y("option",{key:0,value:r.baseBranch},_(r.baseBranch),9,_8)):U("",!0),(v(!0),y(ke,null,Ne(c.value,x=>(v(),y("option",{key:x,value:x},_(x),9,R8))),128))],8,A8),[[gs,l.value]]),J(p(Au),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),f("div",B8,[b[6]||(b[6]=f("span",{class:"text-retro-muted"},"commits:",-1)),f("span",Z8,_(i.value!==null?i.value:"..."),1)])]),f("div",E8,[je(f("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":b[2]||(b[2]=x=>s.value=x),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:o.value||a.value},null,8,D8),[[_t,s.value]]),f("button",{type:"button",disabled:o.value||a.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:m},[J(p(Pa),{class:Re(["w-4 h-4",{"animate-spin":a.value}])},null,8,["class"])],8,L8)]),f("div",X8,[f("button",{type:"button",disabled:!s.value.trim()||o.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},[J(p(Mu),{class:"w-3.5 h-3.5"}),Xe(" "+_(o.value?"Finalizing...":"Confirm"),1)],8,I8),f("button",{type:"button",disabled:o.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:b[3]||(b[3]=x=>n("cancel"))}," Cancel ",8,V8)])]))}}),N8={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},W8={class:"flex items-center justify-between"},q8={class:"space-y-1 text-xs font-mono"},j8={class:"flex items-center gap-2"},Y8={class:"text-retro-cyan"},F8={class:"flex items-center gap-2"},U8={class:"relative"},G8=["disabled"],H8=["value"],K8=["value"],J8={class:"flex items-center gap-2"},eZ={class:"text-retro-text"},tZ={class:"flex items-center gap-2"},rZ=["disabled"],nZ=["disabled"],sZ=Ie({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=r,n=e,s=Q(null),i=Q(!1),o=Q(t.baseBranch),a=Q([]),l=Q(!1),c=Pu();async function u(d){try{const m=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:d}});s.value=m.ahead}catch{s.value=null}}pt(async()=>{const d=u(o.value),m=(async()=>{l.value=!0;try{await c.initialize();const g=await $fetch("/api/git/branches",{query:{workingDirectory:c.workingDirectory}});a.value=g.branches.filter(O=>!O.isRemote&&!O.name.startsWith("sc/")).map(O=>O.name),a.value.length>0&&!a.value.includes(o.value)&&(o.value=a.value.includes("main")?"main":a.value.includes("master")?"master":a.value[0])}catch{a.value=[]}finally{l.value=!1}})();await Promise.all([d,m])}),Ve(o,d=>{u(d)});function h(){i.value=!0,n("confirm",o.value)}return(d,m)=>(v(),y("div",N8,[f("div",W8,[m[3]||(m[3]=f("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Rebase Worktree ",-1)),f("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:m[0]||(m[0]=g=>n("cancel"))},[J(p(wt),{class:"w-4 h-4"})])]),f("div",q8,[f("div",j8,[m[4]||(m[4]=f("span",{class:"text-retro-muted"},"worktree:",-1)),f("span",Y8,_(r.worktreeBranch),1)]),f("div",F8,[m[5]||(m[5]=f("span",{class:"text-retro-muted"},"target:",-1)),f("div",U8,[je(f("select",{"onUpdate:modelValue":m[1]||(m[1]=g=>o.value=g),disabled:i.value||l.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"},[l.value?(v(),y("option",{key:0,value:r.baseBranch},_(r.baseBranch),9,H8)):U("",!0),(v(!0),y(ke,null,Ne(a.value,g=>(v(),y("option",{key:g,value:g},_(g),9,K8))),128))],8,G8),[[gs,o.value]]),J(p(Au),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),f("div",J8,[m[6]||(m[6]=f("span",{class:"text-retro-muted"},"commits ahead:",-1)),f("span",eZ,_(s.value!==null?s.value:"..."),1)])]),f("div",tZ,[f("button",{type:"button",disabled:i.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:h},[J(p(Mu),{class:"w-3.5 h-3.5"}),Xe(" "+_(i.value?"Rebasing...":"Confirm"),1)],8,rZ),f("button",{type:"button",disabled:i.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:m[2]||(m[2]=g=>n("cancel"))}," Cancel ",8,nZ)])]))}}),iZ={class:"flex-1 flex flex-col overflow-hidden"},oZ={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},aZ={class:"text-xs font-mono text-retro-text truncate"},lZ={class:"flex items-center gap-2 flex-shrink-0"},cZ={key:0,class:"text-xs font-mono text-retro-green"},uZ={key:1,class:"text-[11px] font-mono text-retro-muted"},hZ={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},dZ=["innerHTML"],fZ={key:0,class:"flex-shrink-0 px-4 py-2 border-t border-retro-border bg-retro-yellow/10 text-retro-yellow text-xs font-mono"},mZ=Ie({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},isAiResolving:{type:Boolean},strategy:{}},emits:["resolve","aiResolve","retry"],setup(r,{emit:e}){const t=r;Q(t.file.content);const n=Q(""),s=Q(!1);Ve(()=>t.file.path,()=>{a()}),Ve(()=>t.file.content,()=>{a()});const i=K(()=>{const c=/^<{7}\s/gm;return(t.file.content.match(c)||[]).length});function o(c){const u=c.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"}[u]||"text"}async function a(){s.value=!0;try{const{codeToHtml:c}=await ls(async()=>{const{codeToHtml:x}=await import("./BBA9sqLe.js");return{codeToHtml:x}},__vite__mapDeps([3,1,2]),import.meta.url),u=o(t.file.path),d=t.file.content.split(`
|
|
73
73
|
`);let m="",g=!1,O=!1,b=0;for(const x of d){b++;const w=/^<{7}\s/.test(x),S=/^={7}$/.test(x),C=/^>{7}\s/.test(x);if(w){g=!0,O=!1,m+=`<div class="conflict-line conflict-marker-line" data-line="${b}"><span class="line-number">${b}</span><span class="line-content conflict-marker">${l(x)}</span></div>
|
|
74
74
|
`;continue}if(S&&g){g=!1,O=!0,m+=`<div class="conflict-line conflict-marker-line" data-line="${b}"><span class="line-number">${b}</span><span class="line-content conflict-marker">${l(x)}</span></div>
|
|
75
75
|
`;continue}if(C){O=!1,m+=`<div class="conflict-line conflict-marker-line" data-line="${b}"><span class="line-number">${b}</span><span class="line-content conflict-marker">${l(x)}</span></div>
|