spec-cat 0.1.26 → 0.1.28

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.
Files changed (27) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{8_4qvbip.js → 2nXTHzKg.js} +1 -1
  3. package/.output/public/_nuxt/{BPrZX-_J.js → 80f7bXLB.js} +1 -1
  4. package/.output/public/_nuxt/{BzfYDrv2.js → BRd9HFwL.js} +2 -2
  5. package/.output/public/_nuxt/{O3PivLp-.js → BnjcVEL-.js} +1 -1
  6. package/.output/public/_nuxt/{Drn_WUL3.js → C6ilGlzF.js} +1 -1
  7. package/.output/public/_nuxt/{UOLai9rz.js → CoA0shxq.js} +6 -6
  8. package/.output/public/_nuxt/{ovAaTTn7.js → DJnEVOKq.js} +1 -1
  9. package/.output/public/_nuxt/{DIlI3WTI.js → DSUO3OjT.js} +1 -1
  10. package/.output/public/_nuxt/{_ZoYWOkW.js → DWeUOMg4.js} +1 -1
  11. package/.output/public/_nuxt/{Bze5ywup.js → DXzkgxwX.js} +1 -1
  12. package/.output/public/_nuxt/DykekIOz.js +64 -0
  13. package/.output/public/_nuxt/{B2xLiDuD.js → XuDblT7a.js} +1 -1
  14. package/.output/public/_nuxt/builds/latest.json +1 -1
  15. package/.output/public/_nuxt/builds/meta/28d9e18f-8df1-4f6c-a452-5573f8625b68.json +1 -0
  16. package/.output/public/_nuxt/entry.B1b8QW5b.css +1 -0
  17. package/.output/public/_nuxt/xtHaEzqj.js +1 -0
  18. package/.output/server/chunks/build/client.precomputed.mjs +1 -1
  19. package/.output/server/chunks/build/client.precomputed.mjs.map +1 -1
  20. package/.output/server/chunks/nitro/nitro.mjs +706 -706
  21. package/.output/server/node_modules/onnxruntime-node/bin/napi-v3/linux/x64/libonnxruntime.so.1.14.0 +0 -0
  22. package/.output/server/package.json +1 -1
  23. package/package.json +1 -1
  24. package/.output/public/_nuxt/CiXy_SW9.js +0 -64
  25. package/.output/public/_nuxt/builds/meta/0627033e-44b7-4d84-841a-c47017cd574d.json +0 -1
  26. package/.output/public/_nuxt/entry.mJra9RkV.css +0 -1
  27. package/.output/public/_nuxt/oZhDUS0h.js +0 -1
@@ -1,12 +1,12 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Bze5ywup.js","./BzfYDrv2.js","./entry.mJra9RkV.css","./ovAaTTn7.js"])))=>i.map(i=>d[i]);
2
- import{y as v,z as x,A as d,d as Ie,C as ee,G as m,Q as He,S as Xt,R as tt,I as we,E as Xe,B,K as U,g as _,J as Fe,U as os,k as J,V as Ut,L as Re,H as Oe,o as mt,W as St,X as Rp,N as ze,Y as br,T as xr,Z as Zs,O as dn,D as ct,P as fr,_ as Bp,$ as xu,a0 as Te,a1 as as,a2 as lr,a3 as ms,a4 as mc,a5 as f1,c as p1,a6 as _h,a7 as Zp,a8 as m1,q as g1,a9 as O1,x as v1}from"./BzfYDrv2.js";import{r as Pt,c as fn,b as sl,a as us,u as yu}from"./O3PivLp-.js";import{g as po,m as b1,p as x1,h as Rh,i as y1,j as Bh,k as k1,l as w1,n as S1,o as $1,q as Ep,s as Zh,C as C1,_ as Q1,t as ku,u as P1,r as T1,a as M1}from"./CiXy_SW9.js";import{_ as Gs}from"./DlAUqK2U.js";import{S as wa,i as A1,b as _1,P as R1,W as Eh,M as Dh,c as Lh,d as Xh,g as Ih,e as B1,D as Dp,f as Lp,h as Z1,a as mo,u as il,j as Tr,k as ws,l as _o}from"./Bze5ywup.js";import{u as gc,_ as E1}from"./B2xLiDuD.js";function D1(r,e){return v(),x("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"},[d("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 L1(r,e){return v(),x("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"},[d("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 X1(r,e){return v(),x("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"},[d("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 I1(r,e){return v(),x("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"},[d("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 V1(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function Xp(r,e){return v(),x("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"},[d("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 Ip(r,e){return v(),x("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"},[d("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 Vp(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function zp(r,e){return v(),x("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"},[d("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 Np(r,e){return v(),x("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"},[d("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 Wp(r,e){return v(),x("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"},[d("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 z1(r,e){return v(),x("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"},[d("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 jp(r,e){return v(),x("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"},[d("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 N1(r,e){return v(),x("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"},[d("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 W1(r,e){return v(),x("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"},[d("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 j1(r,e){return v(),x("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"},[d("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 q1(r,e){return v(),x("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"},[d("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 wu(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function Y1(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}function Su(r,e){return v(),x("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"},[d("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 F1(r,e){return v(),x("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"},[d("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(),x("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"},[d("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 Es(r,e){return v(),x("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"},[d("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 qp(r,e){return v(),x("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"},[d("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 Yp(r,e){return v(),x("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"},[d("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"}),d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function U1(r,e){return v(),x("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"},[d("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 G1(r,e){return v(),x("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"},[d("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 H1(r,e){return v(),x("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"},[d("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 K1(r,e){return v(),x("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"},[d("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 Ds(r,e){return v(),x("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"},[d("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 _n(r,e){return v(),x("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"},[d("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 J1(r,e){return v(),x("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"},[d("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 Fp(r,e){return v(),x("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"},[d("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"}),d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function ev(r,e){return v(),x("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"},[d("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 tv(r,e){return v(),x("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"},[d("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 rv(r,e){return v(),x("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"},[d("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 nv(r,e){return v(),x("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"},[d("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 sv(r,e){return v(),x("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"},[d("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 Up(r,e){return v(),x("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"},[d("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 ls(r,e){return v(),x("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"},[d("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 iv(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"})])}function ov(r,e){return v(),x("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"},[d("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 Cu(r,e){return v(),x("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"},[d("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 av(r,e){return v(),x("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"},[d("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 Vh(r,e){return v(),x("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"},[d("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 Qu(r,e){return v(),x("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"},[d("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 Gp(r,e){return v(),x("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"},[d("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 Pu(r,e){return v(),x("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"},[d("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 ol(r,e){return v(),x("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"},[d("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 Tu(r,e){return v(),x("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"},[d("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"}),d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 6h.008v.008H6V6Z"})])}function lv(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"})])}const cv={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},uv={class:"relative flex-1 min-w-0"},hv={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},dv=["disabled"],fv=["disabled"],pv=Ie({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(r,{expose:e,emit:t}){const n=t,s=_(""),i=_(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(),x("div",cv,[ee(m(ls),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("div",uv,[He(d("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":h[0]||(h[0]=p=>tt(s)?s.value=p: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),[[Xt,m(s)]])]),m(s)?(v(),x("span",hv,[r.resultCount>0?(v(),x(we,{key:0},[Xe(B(r.currentIndex+1)+" of "+B(r.resultCount),1)],64)):(v(),x(we,{key:1},[Xe(" No results ")],64))])):U("",!0),d("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]=p=>n("prev"))},[ee(m(F1),{class:"w-4 h-4"})],8,dv),d("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]=p=>n("next"))},[ee(m(Y1),{class:"w-4 h-4"})],8,fv),d("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]=p=>n("close"))},[ee(m(Pt),{class:"w-4 h-4"})])]))}}),mv={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},gv={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},Ov={class:"flex-1 overflow-auto max-h-[300px]"},vv={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},bv=["onKeyup"],xv=["onClick"],yv={class:"text-retro-muted truncate flex-1 font-mono"},kv=["onClick"],wv=["onClick"],Sv={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},$v={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},Cv={class:"flex gap-2 justify-end"},Qv=["disabled"],Pv={key:1,class:"px-3 py-2 border-t border-retro-border"},Tv=Ie({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(r,{emit:e}){const t=e,n=_(!1),s=_(""),i=_(""),o=_(null),a=_("");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(f){o.value=f.name,a.value=f.fetchUrl}function h(f){a.value.trim()&&(t("edit",{name:f,newUrl:a.value.trim()}),o.value=null)}function p(){o.value=null}return(f,g)=>(v(),x("div",mv,[d("div",gv,[g[5]||(g[5]=d("h3",{class:"text-sm font-semibold text-retro-text"},"Remote Repositories",-1)),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",onClick:g[0]||(g[0]=O=>t("close"))},[ee(m(Pt),{class:"w-4 h-4"})])]),d("div",Ov,[(v(!0),x(we,null,Fe(r.remotes,O=>(v(),x("div",{key:O.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[d("span",vv,B(O.name),1),m(o)===O.name?(v(),x(we,{key:0},[He(d("input",{"onUpdate:modelValue":g[1]||(g[1]=y=>tt(a)?a.value=y: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:[os(y=>h(O.name),["enter"]),os(p,["escape"])]},null,40,bv),[[Xt,m(a)]]),d("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:y=>h(O.name)},[ee(m(wu),{class:"w-3.5 h-3.5"})],8,xv),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:p},[ee(m(Pt),{class:"w-3.5 h-3.5"})])],64)):(v(),x(we,{key:1},[d("span",yv,B(O.fetchUrl),1),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:y=>u(O)},[ee(m(Cu),{class:"w-3.5 h-3.5"})],8,kv),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:y=>t("delete",O.name)},[ee(m(fn),{class:"w-3.5 h-3.5"})],8,wv)],64))]))),128)),r.remotes.length===0?(v(),x("div",Sv," No remotes configured ")):U("",!0)]),m(n)?(v(),x("div",$v,[He(d("input",{"onUpdate:modelValue":g[2]||(g[2]=O=>tt(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),[[Xt,m(s)]]),He(d("input",{"onUpdate:modelValue":g[3]||(g[3]=O=>tt(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:os(c,["enter"])},null,544),[[Xt,m(i)]]),d("div",Cv,[d("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 "),d("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:!m(s).trim()||!m(i).trim(),onClick:c}," Add Remote ",8,Qv)])])):U("",!0),m(n)?U("",!0):(v(),x("div",Pv,[d("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:l},[ee(m(sl),{class:"w-3.5 h-3.5"}),g[6]||(g[6]=Xe(" Add Remote ",-1))])]))]))}}),al={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},Ro=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Ls={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"}},Mv=["width","height"],Av=["d","stroke","stroke-dasharray"],_v={key:0},Rv=["cx","r"],Bv=["cx","r","fill"],Zv=["cx","r","stroke"],Ev=["cx","r","fill"],Dv=["cx","r","stroke"],Lv=["cx","r","fill"],Xv=["cx","r"],Iv=["cx","r","fill"],Hp=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}=al,o=J(()=>i*2+(e.maxLane+1)*t),a=n,l=n/2;function c(p){return i+p*t}function u(p){const f=c(p.fromLane),g=c(p.toLane);if(p.type==="vertical")return`M ${f} 0 L ${g} ${a}`;if(p.type==="vertical-top")return`M ${f} 0 L ${f} ${l}`;if(p.type==="vertical-bottom")return`M ${f} ${l} L ${f} ${a}`;if(p.style==="rounded")return`M ${f} ${l} C ${f} ${a}, ${g} ${a}, ${g} ${a}`;{const O=a*.75;return`M ${f} ${l} L ${f} ${O} L ${g} ${a}`}}const h=J(()=>e.rowData?c(e.rowData.lane):i);return(p,f)=>(v(),x("svg",{width:m(o),height:m(a),class:"block flex-shrink-0","aria-hidden":"true"},[r.rowData?(v(),x(we,{key:0},[(v(!0),x(we,null,Fe(r.rowData.connections,(g,O)=>(v(),x("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,Av))),128)),d("g",null,[r.tooltipText?(v(),x("title",_v,B(r.tooltipText),1)):U("",!0),r.rowData.nodeType==="head"?(v(),x(we,{key:1},[d("circle",{cx:m(h),cy:l,r:m(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,Rv),d("circle",{cx:m(h),cy:l,r:m(s),fill:r.rowData.color},null,8,Bv)],64)):r.rowData.nodeType==="merge"?(v(),x(we,{key:2},[d("circle",{cx:m(h),cy:l,r:m(s)+1,fill:"none",stroke:r.rowData.color,"stroke-width":"1.5"},null,8,Zv),d("circle",{cx:m(h),cy:l,r:m(s)-1,fill:r.rowData.color},null,8,Ev)],64)):r.rowData.nodeType==="stash"?(v(),x(we,{key:3},[d("circle",{cx:m(h),cy:l,r:m(s),fill:"none",stroke:r.rowData.color,"stroke-width":"2"},null,8,Dv),d("circle",{cx:m(h),cy:l,r:m(s)-2,fill:r.rowData.color},null,8,Lv)],64)):r.rowData.nodeType==="uncommitted"?(v(),x("circle",{key:4,cx:m(h),cy:l,r:m(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,Xv)):(v(),x("circle",{key:5,cx:m(h),cy:l,r:m(s),fill:r.rowData.color},null,8,Iv))])],64)):U("",!0)],8,Mv))}}),Vv=["aria-selected","aria-label"],zv={key:1,class:"flex gap-1 flex-shrink-0"},Nv=["title","onContextmenu"],Wv={key:2,class:"flex gap-1 flex-shrink-0"},jv=["onContextmenu"],qv={class:"text-retro-text text-xs truncate flex-1"},Yv={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},Fv={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},zh=72,Uv=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=J(()=>{const p=t.commit.branches;if(p.length===0)return[];const f=t.localBranchNames,g=[],O=[];for(const A of p)f.has(A)?g.push(A):O.push(A);const y=new Set(g),b=new Map,C=[];for(const A of O){const E=A.indexOf("/");if(E>0){const F=A.substring(E+1),I=A.substring(0,E);y.has(F)?(b.has(F)||b.set(F,[]),b.get(F).push(I)):C.push(A)}else C.push(A)}const P=[];for(const A of g){const E=b.get(A)||[];E.length>0?P.push({displayName:`${A}/${E.join(",")}`,originalBranches:[A,...E.map(F=>`${F}/${A}`)],isLocal:!0}):P.push({displayName:A,originalBranches:[A],isLocal:!0})}for(const A of C)P.push({displayName:A,originalBranches:[A],isLocal:!1});return P});function i(p,f){p.preventDefault(),p.stopPropagation();const g=f.originalBranches[0];n("branchContextMenu",{branch:g,x:p.clientX,y:p.clientY,isCurrentBranch:f.isLocal&&f.originalBranches.includes(t.currentBranchName??""),isLocal:f.isLocal})}function o(p,f){p.preventDefault(),p.stopPropagation(),n("tagContextMenu",{tag:f,x:p.clientX,y:p.clientY})}function a(p){p.preventDefault(),p.stopPropagation(),n("commitContextMenu",{x:p.clientX,y:p.clientY})}const{ROW_HEIGHT:l}=al,c=J(()=>{const p=[t.commit.shortHash];return t.commit.branches.length>0&&p.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&p.push(t.commit.tags.map(f=>`tag: ${f}`).join(", ")),p.join(" — ")});function u(p){const g=Date.now()/1e3-p;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(p*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function h(p){const f=p.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DXzkgxwX.js","./BRd9HFwL.js","./entry.B1b8QW5b.css","./DJnEVOKq.js"])))=>i.map(i=>d[i]);
2
+ import{y as v,z as x,A as d,d as Ie,C as ee,G as m,Q as He,S as Xt,R as tt,I as we,E as Xe,B,K as U,g as _,J as Fe,U as os,k as J,V as Ut,L as Re,H as Oe,o as mt,W as St,X as Rp,N as ze,Y as br,T as xr,Z as Zs,O as dn,D as ct,P as fr,_ as Bp,$ as xu,a0 as Te,a1 as as,a2 as lr,a3 as ms,a4 as mc,a5 as f1,c as p1,a6 as _h,a7 as Zp,a8 as m1,q as g1,a9 as O1,x as v1}from"./BRd9HFwL.js";import{r as Pt,c as fn,b as sl,a as us,u as yu}from"./BnjcVEL-.js";import{g as po,m as b1,p as x1,h as Rh,i as y1,j as Bh,k as k1,l as w1,n as S1,o as $1,q as Ep,s as Zh,C as C1,_ as Q1,t as ku,u as P1,r as T1,a as M1}from"./DykekIOz.js";import{_ as Gs}from"./DlAUqK2U.js";import{S as wa,i as A1,b as _1,P as R1,W as Eh,M as Dh,c as Lh,d as Xh,g as Ih,e as B1,D as Dp,f as Lp,h as Z1,a as mo,u as il,j as Tr,k as ws,l as _o}from"./DXzkgxwX.js";import{u as gc,_ as E1}from"./XuDblT7a.js";function D1(r,e){return v(),x("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"},[d("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 L1(r,e){return v(),x("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"},[d("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 X1(r,e){return v(),x("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"},[d("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 I1(r,e){return v(),x("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"},[d("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 V1(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function Xp(r,e){return v(),x("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"},[d("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 Ip(r,e){return v(),x("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"},[d("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 Vp(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function zp(r,e){return v(),x("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"},[d("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 Np(r,e){return v(),x("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"},[d("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 Wp(r,e){return v(),x("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"},[d("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 z1(r,e){return v(),x("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"},[d("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 jp(r,e){return v(),x("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"},[d("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 N1(r,e){return v(),x("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"},[d("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 W1(r,e){return v(),x("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"},[d("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 j1(r,e){return v(),x("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"},[d("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 q1(r,e){return v(),x("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"},[d("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 wu(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function Y1(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}function Su(r,e){return v(),x("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"},[d("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 F1(r,e){return v(),x("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"},[d("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(),x("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"},[d("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 Es(r,e){return v(),x("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"},[d("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 qp(r,e){return v(),x("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"},[d("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 Yp(r,e){return v(),x("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"},[d("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"}),d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function U1(r,e){return v(),x("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"},[d("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 G1(r,e){return v(),x("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"},[d("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 H1(r,e){return v(),x("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"},[d("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 K1(r,e){return v(),x("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"},[d("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 Ds(r,e){return v(),x("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"},[d("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 _n(r,e){return v(),x("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"},[d("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 J1(r,e){return v(),x("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"},[d("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 Fp(r,e){return v(),x("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"},[d("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"}),d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function ev(r,e){return v(),x("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"},[d("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 tv(r,e){return v(),x("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"},[d("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 rv(r,e){return v(),x("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"},[d("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 nv(r,e){return v(),x("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"},[d("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 sv(r,e){return v(),x("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"},[d("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 Up(r,e){return v(),x("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"},[d("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 ls(r,e){return v(),x("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"},[d("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 iv(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"})])}function ov(r,e){return v(),x("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"},[d("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 Cu(r,e){return v(),x("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"},[d("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 av(r,e){return v(),x("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"},[d("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 Vh(r,e){return v(),x("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"},[d("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 Qu(r,e){return v(),x("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"},[d("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 Gp(r,e){return v(),x("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"},[d("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 Pu(r,e){return v(),x("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"},[d("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 ol(r,e){return v(),x("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"},[d("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 Tu(r,e){return v(),x("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"},[d("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"}),d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 6h.008v.008H6V6Z"})])}function lv(r,e){return v(),x("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"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"})])}const cv={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},uv={class:"relative flex-1 min-w-0"},hv={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},dv=["disabled"],fv=["disabled"],pv=Ie({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(r,{expose:e,emit:t}){const n=t,s=_(""),i=_(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(),x("div",cv,[ee(m(ls),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("div",uv,[He(d("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":h[0]||(h[0]=p=>tt(s)?s.value=p: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),[[Xt,m(s)]])]),m(s)?(v(),x("span",hv,[r.resultCount>0?(v(),x(we,{key:0},[Xe(B(r.currentIndex+1)+" of "+B(r.resultCount),1)],64)):(v(),x(we,{key:1},[Xe(" No results ")],64))])):U("",!0),d("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]=p=>n("prev"))},[ee(m(F1),{class:"w-4 h-4"})],8,dv),d("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]=p=>n("next"))},[ee(m(Y1),{class:"w-4 h-4"})],8,fv),d("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]=p=>n("close"))},[ee(m(Pt),{class:"w-4 h-4"})])]))}}),mv={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},gv={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},Ov={class:"flex-1 overflow-auto max-h-[300px]"},vv={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},bv=["onKeyup"],xv=["onClick"],yv={class:"text-retro-muted truncate flex-1 font-mono"},kv=["onClick"],wv=["onClick"],Sv={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},$v={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},Cv={class:"flex gap-2 justify-end"},Qv=["disabled"],Pv={key:1,class:"px-3 py-2 border-t border-retro-border"},Tv=Ie({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(r,{emit:e}){const t=e,n=_(!1),s=_(""),i=_(""),o=_(null),a=_("");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(f){o.value=f.name,a.value=f.fetchUrl}function h(f){a.value.trim()&&(t("edit",{name:f,newUrl:a.value.trim()}),o.value=null)}function p(){o.value=null}return(f,g)=>(v(),x("div",mv,[d("div",gv,[g[5]||(g[5]=d("h3",{class:"text-sm font-semibold text-retro-text"},"Remote Repositories",-1)),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",onClick:g[0]||(g[0]=O=>t("close"))},[ee(m(Pt),{class:"w-4 h-4"})])]),d("div",Ov,[(v(!0),x(we,null,Fe(r.remotes,O=>(v(),x("div",{key:O.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[d("span",vv,B(O.name),1),m(o)===O.name?(v(),x(we,{key:0},[He(d("input",{"onUpdate:modelValue":g[1]||(g[1]=y=>tt(a)?a.value=y: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:[os(y=>h(O.name),["enter"]),os(p,["escape"])]},null,40,bv),[[Xt,m(a)]]),d("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:y=>h(O.name)},[ee(m(wu),{class:"w-3.5 h-3.5"})],8,xv),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:p},[ee(m(Pt),{class:"w-3.5 h-3.5"})])],64)):(v(),x(we,{key:1},[d("span",yv,B(O.fetchUrl),1),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:y=>u(O)},[ee(m(Cu),{class:"w-3.5 h-3.5"})],8,kv),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:y=>t("delete",O.name)},[ee(m(fn),{class:"w-3.5 h-3.5"})],8,wv)],64))]))),128)),r.remotes.length===0?(v(),x("div",Sv," No remotes configured ")):U("",!0)]),m(n)?(v(),x("div",$v,[He(d("input",{"onUpdate:modelValue":g[2]||(g[2]=O=>tt(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),[[Xt,m(s)]]),He(d("input",{"onUpdate:modelValue":g[3]||(g[3]=O=>tt(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:os(c,["enter"])},null,544),[[Xt,m(i)]]),d("div",Cv,[d("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 "),d("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:!m(s).trim()||!m(i).trim(),onClick:c}," Add Remote ",8,Qv)])])):U("",!0),m(n)?U("",!0):(v(),x("div",Pv,[d("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:l},[ee(m(sl),{class:"w-3.5 h-3.5"}),g[6]||(g[6]=Xe(" Add Remote ",-1))])]))]))}}),al={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},Ro=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Ls={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"}},Mv=["width","height"],Av=["d","stroke","stroke-dasharray"],_v={key:0},Rv=["cx","r"],Bv=["cx","r","fill"],Zv=["cx","r","stroke"],Ev=["cx","r","fill"],Dv=["cx","r","stroke"],Lv=["cx","r","fill"],Xv=["cx","r"],Iv=["cx","r","fill"],Hp=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}=al,o=J(()=>i*2+(e.maxLane+1)*t),a=n,l=n/2;function c(p){return i+p*t}function u(p){const f=c(p.fromLane),g=c(p.toLane);if(p.type==="vertical")return`M ${f} 0 L ${g} ${a}`;if(p.type==="vertical-top")return`M ${f} 0 L ${f} ${l}`;if(p.type==="vertical-bottom")return`M ${f} ${l} L ${f} ${a}`;if(p.style==="rounded")return`M ${f} ${l} C ${f} ${a}, ${g} ${a}, ${g} ${a}`;{const O=a*.75;return`M ${f} ${l} L ${f} ${O} L ${g} ${a}`}}const h=J(()=>e.rowData?c(e.rowData.lane):i);return(p,f)=>(v(),x("svg",{width:m(o),height:m(a),class:"block flex-shrink-0","aria-hidden":"true"},[r.rowData?(v(),x(we,{key:0},[(v(!0),x(we,null,Fe(r.rowData.connections,(g,O)=>(v(),x("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,Av))),128)),d("g",null,[r.tooltipText?(v(),x("title",_v,B(r.tooltipText),1)):U("",!0),r.rowData.nodeType==="head"?(v(),x(we,{key:1},[d("circle",{cx:m(h),cy:l,r:m(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,Rv),d("circle",{cx:m(h),cy:l,r:m(s),fill:r.rowData.color},null,8,Bv)],64)):r.rowData.nodeType==="merge"?(v(),x(we,{key:2},[d("circle",{cx:m(h),cy:l,r:m(s)+1,fill:"none",stroke:r.rowData.color,"stroke-width":"1.5"},null,8,Zv),d("circle",{cx:m(h),cy:l,r:m(s)-1,fill:r.rowData.color},null,8,Ev)],64)):r.rowData.nodeType==="stash"?(v(),x(we,{key:3},[d("circle",{cx:m(h),cy:l,r:m(s),fill:"none",stroke:r.rowData.color,"stroke-width":"2"},null,8,Dv),d("circle",{cx:m(h),cy:l,r:m(s)-2,fill:r.rowData.color},null,8,Lv)],64)):r.rowData.nodeType==="uncommitted"?(v(),x("circle",{key:4,cx:m(h),cy:l,r:m(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,Xv)):(v(),x("circle",{key:5,cx:m(h),cy:l,r:m(s),fill:r.rowData.color},null,8,Iv))])],64)):U("",!0)],8,Mv))}}),Vv=["aria-selected","aria-label"],zv={key:1,class:"flex gap-1 flex-shrink-0"},Nv=["title","onContextmenu"],Wv={key:2,class:"flex gap-1 flex-shrink-0"},jv=["onContextmenu"],qv={class:"text-retro-text text-xs truncate flex-1"},Yv={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},Fv={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},zh=72,Uv=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=J(()=>{const p=t.commit.branches;if(p.length===0)return[];const f=t.localBranchNames,g=[],O=[];for(const A of p)f.has(A)?g.push(A):O.push(A);const y=new Set(g),b=new Map,C=[];for(const A of O){const E=A.indexOf("/");if(E>0){const F=A.substring(E+1),I=A.substring(0,E);y.has(F)?(b.has(F)||b.set(F,[]),b.get(F).push(I)):C.push(A)}else C.push(A)}const P=[];for(const A of g){const E=b.get(A)||[];E.length>0?P.push({displayName:`${A}/${E.join(",")}`,originalBranches:[A,...E.map(F=>`${F}/${A}`)],isLocal:!0}):P.push({displayName:A,originalBranches:[A],isLocal:!0})}for(const A of C)P.push({displayName:A,originalBranches:[A],isLocal:!1});return P});function i(p,f){p.preventDefault(),p.stopPropagation();const g=f.originalBranches[0];n("branchContextMenu",{branch:g,x:p.clientX,y:p.clientY,isCurrentBranch:f.isLocal&&f.originalBranches.includes(t.currentBranchName??""),isLocal:f.isLocal})}function o(p,f){p.preventDefault(),p.stopPropagation(),n("tagContextMenu",{tag:f,x:p.clientX,y:p.clientY})}function a(p){p.preventDefault(),p.stopPropagation(),n("commitContextMenu",{x:p.clientX,y:p.clientY})}const{ROW_HEIGHT:l}=al,c=J(()=>{const p=[t.commit.shortHash];return t.commit.branches.length>0&&p.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&p.push(t.commit.tags.map(f=>`tag: ${f}`).join(", ")),p.join(" — ")});function u(p){const g=Date.now()/1e3-p;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(p*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function h(p){const f=p.split(`
3
3
  `)[0];return f.length>zh?f.substring(0,zh-3)+"...":f}return(p,f)=>{const g=Hp;return v(),x("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:Ut({height:`${m(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:f[0]||(f[0]=O=>n("click",O)),onKeydown:f[1]||(f[1]=O=>n("keydown",O)),onContextmenu:a},[ee(g,{rowData:r.graphRowData,maxLane:r.maxLane,tooltipText:m(c)},null,8,["rowData","maxLane","tooltipText"]),d("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:Ut({height:`${m(l)-4}px`})},[!r.columnVisibility||r.columnVisibility.commit!==!1?(v(),x("span",{key:0,class:Re(["flex-shrink-0 font-mono text-[11px]",r.commit.isHead?"text-retro-cyan font-semibold":"text-retro-muted"])},B(r.commit.shortHash),3)):U("",!0),m(s).length>0?(v(),x("div",zv,[(v(!0),x(we,null,Fe(m(s),O=>(v(),x("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:y=>i(y,O)},B(O.displayName),43,Nv))),128))])):U("",!0),r.commit.tags.length>0?(v(),x("div",Wv,[(v(!0),x(we,null,Fe(r.commit.tags,O=>(v(),x("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:y=>o(y,O)},[ee(m(Tu),{class:"w-2.5 h-2.5"}),Xe(" "+B(O),1)],40,jv))),128))])):U("",!0),d("span",qv,B(h(r.commit.message)),1),r.commit.signatureStatus==="good"?(v(),Oe(m(Gp),{key:3,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-green",title:"Verified signature"})):r.commit.signatureStatus==="bad"?(v(),Oe(m(Pu),{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(),x("span",Yv,B(r.commit.author),1)):U("",!0),!r.columnVisibility||r.columnVisibility.date!==!1?(v(),x("span",Fv,B(u(r.commit.timestamp)),1)):U("",!0)],6)],46,Vv)}}});function Gv(){const{COLUMN_WIDTH:r,ROW_HEIGHT:e,NODE_RADIUS:t,PADDING:n}=al;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)%Ro.length;return Ro[c]}function o(l,c="rounded"){const u=new Map;if(l.length===0)return u;const h=new Set,p=new Map;for(const P of l)p.set(P.hash,P);const f=l.find(P=>P.isHead)||l[0];if(f){let P=f;for(;P;){h.add(P.hash);const A=P.parents?.[0];P=A?p.get(A):void 0}}const g=new Map,O=new Map,y=new Map,b=new Map,C=new Map;for(let P=0;P<l.length;P++){const A=l[P];C.set(A.hash,P);const E=h.has(A.hash);let F,I;if(b.has(A.hash)){const D=b.get(A.hash);F=D.lane,I=D.color,b.delete(A.hash)}else if(E)F=0,I=Ro[0];else{for(F=1;y.has(F);)F++;I=i(A.hash.substring(0,7))}g.set(A.hash,F),O.set(A.hash,I),y.set(F,A.hash);const oe=A.isMerge||A.parents&&A.parents.length>1;let ie="regular";A.isHead?ie="head":oe&&(ie="merge"),u.set(A.hash,{commitHash:A.hash,lane:F,color:I,nodeType:ie,isMainline:h.has(A.hash),connections:[]});const ne=A.parents||[];for(let D=0;D<ne.length;D++){const Z=ne[D];if(g.has(Z)||b.has(Z))continue;const z=h.has(Z);let q,V;if(D===0)q=F,V=I;else if(z)q=0,V=Ro[0];else{for(q=1;y.has(q)||q===F;)q++;V=i(Z.substring(0,7))}b.set(Z,{lane:q,color:V,childHash:A.hash})}const L=ne[0];if(!L)y.delete(F);else{const D=g.get(L),Z=b.get(L),z=D??Z?.lane;z!==void 0&&z!==F&&y.delete(F)}}for(let P=0;P<l.length;P++){const A=l[P],E=u.get(A.hash);if(!E)continue;const F=A.parents||[];for(let I=0;I<F.length;I++){const oe=F[I],ie=g.get(oe),ne=C.get(oe);if(ie===void 0)continue;const L=E.lane,D=ie,Z=I===0?E.color:O.get(oe)||i(oe.substring(0,7));if(L===D?E.connections.push({type:"vertical-bottom",fromLane:L,toLane:D,color:Z,style:c}):I>0?E.connections.push({type:L<D?"merge-out":"merge-in",fromLane:L,toLane:D,color:Z,style:c}):E.connections.push({type:L<D?"branch-out":"branch-in",fromLane:L,toLane:D,color:Z,style:c}),ne!==void 0&&ne>P+1)for(let z=P+1;z<ne;z++){const q=l[z],V=u.get(q.hash);V&&V.connections.push({type:"vertical",fromLane:D,toLane:D,color:Z,style:c})}if(ne!==void 0){const z=u.get(oe);z&&z.connections.push({type:"vertical-top",fromLane:D,toLane:D,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 Hv=["aria-selected"],Kv={class:"text-retro-yellow text-xs font-medium"},Jv={key:1,class:"flex items-center justify-center gap-2 p-2 text-retro-muted text-sm"},eb={key:2,class:"p-2 text-center text-retro-muted/50 text-xs"},tb=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($){($.key==="Enter"||$.key===" ")&&($.preventDefault(),s("selectUncommittedChanges"))}const a=J(()=>n.searchQuery?.toLowerCase()??""),l=J(()=>new Set(n.highlightBranches??[])),c=J(()=>l.value.size>0),u=J(()=>{const $=a.value;if(!$)return new Set;const w=new Set;for(const M of n.commits)(M.message.toLowerCase().includes($)||M.author.toLowerCase().includes($)||M.shortHash.toLowerCase().includes($)||M.hash.toLowerCase().includes($)||M.branches.some(R=>R.toLowerCase().includes($))||M.tags.some(R=>R.toLowerCase().includes($)))&&w.add(M.hash);return w}),h=J(()=>{if(!c.value)return new Set;const $=new Set;for(const w of n.commits)w.branches.some(M=>l.value.has(M))&&$.add(w.hash);return $}),p=J(()=>{if(!n.featureHighlightBranches||n.featureHighlightBranches.length===0)return new Set;const $=n.featureMergeBases??{},w=new Map;for(const R of n.commits)w.set(R.hash,R);const M=new Set;for(const R of n.featureHighlightBranches){const G=n.commits.find(De=>De.branches.includes(R));if(!G)continue;const ae=$[R]??null;if(!ae)continue;let xe=G;for(;xe&&xe.hash!==ae;)M.add(xe.hash),xe=xe.parents?.[0]?w.get(xe.parents[0]):void 0}return M}),f=J(()=>{if(!n.previewHighlightBranches||n.previewHighlightBranches.length===0)return new Set;const $=n.previewMergeBases??{},w=new Map;for(const R of n.commits)w.set(R.hash,R);const M=new Set;for(const R of n.previewHighlightBranches){const G=n.commits.find(De=>De.branches.includes(R));if(!G)continue;const ae=$[R]??null;if(!ae)continue;let xe=G;for(;xe&&xe.hash!==ae;)M.add(xe.hash),xe=xe.parents?.[0]?w.get(xe.parents[0]):void 0}return M});function g($,w){s("branchContextMenu",{...w,commitHash:$.hash})}function O($,w){s("commitContextMenu",{commit:$,...w})}function y($,w){s("tagContextMenu",{...w,commitHash:$.hash})}const{ROW_HEIGHT:b,VISIBLE_BUFFER:C}=al,{computeGraphRows:P,computeMaxLane:A}=Gv(),E=J(()=>P([...n.commits],n.graphStyle)),F=J(()=>A(E.value)),I=J(()=>{const $=n.stashes||[];if($.length===0)return n.commits.map((G,ae)=>({type:"commit",commit:G,commitIndex:ae}));const w=[],M=[...$].sort((G,ae)=>new Date(ae.date).getTime()-new Date(G.date).getTime());let R=0;for(let G=0;G<n.commits.length;G++){const ae=n.commits[G],xe=ae.timestamp*1e3;for(;R<M.length&&new Date(M[R].date).getTime()>=xe;)w.push({type:"stash",stash:M[R]}),R++;w.push({type:"commit",commit:ae,commitIndex:G})}for(;R<M.length;)w.push({type:"stash",stash:M[R]}),R++;return w}),oe=_(null),ie=_(0),ne=_(400);let L=null;const D=J(()=>{const $=C,w=I.value.length,M=Math.max(0,Math.floor(ie.value/b)-$),R=Math.min(w,Math.ceil((ie.value+ne.value)/b)+$);return{startIndex:M,endIndex:R}}),Z=J(()=>{const{startIndex:$,endIndex:w}=D.value;return I.value.slice($,w).map((M,R)=>({row:M,index:$+R,graphRow:M.type==="commit"&&E.value.get(M.commit.hash)||null,isHighlighted:M.type==="commit"?u.value.has(M.commit.hash):!1,isBranchHighlighted:M.type==="commit"?h.value.has(M.commit.hash):!1,isFeatureHighlighted:M.type==="commit"?p.value.has(M.commit.hash):!1,isPreviewHighlighted:M.type==="commit"?f.value.has(M.commit.hash):!1,isMuted:M.type==="commit"&&n.muteNonAncestral?!(E.value.get(M.commit.hash)?.isMainline??!1):!1}))}),z=J(()=>I.value.length*b),q=J(()=>D.value.startIndex*b);function V($){const w=$.target;ie.value=w.scrollTop,L||s("scrollStart"),L&&clearTimeout(L),L=setTimeout(()=>{L=null,s("scrollEnd")},150),n.hasMore&&!n.loading&&!n.loadingMore&&w.scrollTop+w.clientHeight>=w.scrollHeight-200&&s("loadMore")}function X($,w){w.ctrlKey||w.metaKey?s("compareSelect",$):s("select",$)}function N($,w,M){if($.key==="Enter"||$.key===" ")$.preventDefault(),s("select",w);else if($.key==="ArrowDown"){$.preventDefault();for(let R=M+1;R<I.value.length;R++){const G=I.value[R];if(G.type==="commit"){s("select",G.commit),me(R);break}}}else if($.key==="ArrowUp"){$.preventDefault();for(let R=M-1;R>=0;R--){const G=I.value[R];if(G.type==="commit"){s("select",G.commit),me(R);break}}}}function me($){if(!oe.value)return;const w=$*b,M=oe.value.scrollTop,R=M+oe.value.clientHeight;w<M?oe.value.scrollTop=w:w+b>R&&(oe.value.scrollTop=w+b-oe.value.clientHeight)}mt(()=>{if(oe.value){ne.value=oe.value.clientHeight;const $=new ResizeObserver(w=>{for(const M of w)ne.value=M.contentRect.height});$.observe(oe.value),St(()=>$.disconnect())}});function K(){return oe.value?.scrollTop??0}function he($){oe.value&&(oe.value.scrollTop=$)}return e({getScrollPosition:K,setScrollPosition:he,scrollToIndex:me}),($,w)=>{const M=Hp,R=Uv;return v(),x("div",{ref_key:"containerRef",ref:oe,class:"h-full overflow-auto",role:"list","aria-label":"Commit history",onScroll:V},[r.uncommittedChangesCount&&r.uncommittedChangesCount>0?(v(),x("div",{key:0,class:"flex items-center cursor-pointer group sticky top-0 z-10 bg-retro-dark border-b border-retro-border",style:Ut({height:`${m(b)}px`}),role:"button",tabindex:"0","aria-selected":r.isUncommittedChangesSelected,onClick:i,onKeydown:o},[ee(M,{rowData:{commitHash:"uncommitted",lane:0,color:"#F59E0B",nodeType:"uncommitted",isMainline:!1,connections:[]},maxLane:m(F)},null,8,["maxLane"]),d("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:Ut({height:`${m(b)-4}px`})},[ee(m(po),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),d("span",Kv," Uncommitted Changes ("+B(r.uncommittedChangesCount)+") ",1),w[1]||(w[1]=d("span",{class:"flex-1"},null,-1)),w[2]||(w[2]=d("span",{class:"text-retro-muted text-[10px]"},"Working tree",-1))],6)],44,Hv)):U("",!0),d("div",{class:"relative",style:Ut({height:`${m(z)}px`})},[d("div",{class:"absolute left-0 right-0",style:Ut({transform:`translateY(${m(q)}px)`})},[(v(!0),x(we,null,Fe(m(Z),({row:G,index:ae,graphRow:xe,isHighlighted:De,isBranchHighlighted:Ae,isFeatureHighlighted:Ue,isPreviewHighlighted:Ye,isMuted:pe})=>(v(),x(we,{key:G.type==="commit"?G.commit.hash:`stash-${G.stash.index}`},[G.type==="commit"?Rp([G.commit.hash,G.commit.message,G.commit.timestamp,G.commit.branches.join("|"),G.commit.tags.join("|"),r.selectedCommit?.hash===G.commit.hash,De,Ae,Ue,Ye,pe,n.currentBranchName||"",n.columnVisibility?.date!==!1,n.columnVisibility?.author!==!1,n.columnVisibility?.commit!==!1],()=>(v(),Oe(R,{key:0,commit:G.commit,index:G.commitIndex,isSelected:r.selectedCommit?.hash===G.commit.hash,isHighlighted:De,isBranchHighlighted:Ae,isFeatureHighlighted:Ue,isPreviewHighlighted:Ye,isMuted:pe,currentBranchName:n.currentBranchName,localBranchNames:n.localBranchNames,graphRowData:xe,maxLane:m(F),columnVisibility:n.columnVisibility,onClick:Ce=>X(G.commit,Ce),onKeydown:Ce=>N(Ce,G.commit,ae),onBranchContextMenu:Ce=>g(G.commit,Ce),onCommitContextMenu:Ce=>O(G.commit,Ce),onTagContextMenu:Ce=>y(G.commit,Ce)},null,8,["commit","index","isSelected","isHighlighted","isBranchHighlighted","isFeatureHighlighted","isPreviewHighlighted","isMuted","currentBranchName","localBranchNames","graphRowData","maxLane","columnVisibility","onClick","onKeydown","onBranchContextMenu","onCommitContextMenu","onTagContextMenu"])),w,0):U("",!0)],64))),128))],4)],4),(r.loading||r.loadingMore)&&r.commits.length>0?(v(),x("div",Jv,[...w[3]||(w[3]=[d("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(),x("div",eb,B(r.commits.length)+" commits loaded ",1)):U("",!0)],544)}}});function rb(r){const e=r.charAt(0).toUpperCase();return e in Ls?e:"M"}function Bo(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 Nh(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 nb(r,e){return e.size===0?[...r]:r.filter(t=>t.branches.some(n=>e.has(n)))}const sb={class:"flex flex-col h-full border-t border-retro-border bg-retro-dark"},ib={class:"flex items-center justify-between p-2 border-b border-retro-border flex-shrink-0"},ob={class:"flex items-center gap-2 text-xs min-w-0"},ab={class:"font-mono text-retro-cyan"},lb={class:"font-mono text-retro-cyan"},cb={key:0,class:"px-3 py-1.5 text-xs text-retro-muted border-b border-retro-border flex-shrink-0"},ub={class:"text-retro-green"},hb={class:"text-retro-red"},db={key:1,class:"flex-1 flex items-center justify-center"},fb={key:2,class:"flex-1 overflow-auto"},pb={class:"text-retro-text truncate flex-1"},mb={class:"text-retro-muted"},gb={key:0,class:"flex-shrink-0 text-[10px] font-mono"},Ob={key:0,class:"text-retro-green"},vb={key:1,class:"text-retro-red ml-1"},bb={key:1,class:"flex-shrink-0 text-[10px] text-retro-muted italic"},xb={key:3,class:"flex-1 flex items-center justify-center text-retro-muted text-sm"},yb=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=rb(s);return Ls[i]||Ls.M}return(s,i)=>(v(),x("div",sb,[d("div",ib,[d("div",ob,[i[1]||(i[1]=d("span",{class:"text-retro-muted"},"Comparing",-1)),d("span",ab,B(r.fromCommit.shortHash),1),i[2]||(i[2]=d("span",{class:"text-retro-muted"},"→",-1)),d("span",lb,B(r.toCommit.shortHash),1)]),d("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"))},[ee(m(Pt),{class:"w-4 h-4"})])]),r.stats?(v(),x("div",cb,[Xe(B(r.stats.filesChanged)+" file"+B(r.stats.filesChanged!==1?"s":"")+" changed, ",1),d("span",ub,"+"+B(r.stats.additions),1),d("span",hb," -"+B(r.stats.deletions),1)])):U("",!0),r.loading?(v(),x("div",db,[...i[3]||(i[3]=[d("div",{class:"flex items-center gap-2 text-retro-muted text-sm"},[d("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(),x("div",fb,[(v(!0),x(we,null,Fe(r.files,o=>(v(),x("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"},[d("span",{class:Re(["flex-shrink-0 w-4 text-center font-semibold text-[10px]",n(o.status).colorClass])},B(o.status.charAt(0)),3),d("span",pb,[o.oldPath&&o.status.startsWith("R")?(v(),x(we,{key:0},[d("span",mb,B(o.oldPath),1),i[4]||(i[4]=d("span",{class:"text-retro-muted mx-1"},"→",-1))],64)):U("",!0),Xe(" "+B(o.path),1)]),o.binary?(v(),x("span",bb,"binary")):(v(),x("span",gb,[o.additions>0?(v(),x("span",Ob,"+"+B(o.additions),1)):U("",!0),o.deletions>0?(v(),x("span",vb,"-"+B(o.deletions),1)):U("",!0)]))]))),128))])):r.files&&r.files.length===0?(v(),x("div",xb," No differences between these commits ")):U("",!0)]))}}),kb={":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:":"🦺"},wb=/https?:\/\/[^\s<>)"']+/g;function Sb(r){return r.replace(wb,e=>`<a href="${e}" target="_blank" rel="noopener noreferrer" class="text-retro-blue hover:underline">${e}</a>`)}function $b(r){return r.replace(/:[a-z0-9_]+:/g,e=>kb[e]||e)}function Cb(r){if(!r)return"";let e=$b(r);return e=b1.parse(e),e=Sb(e),e=x1.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 Qb={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Pb={class:"flex items-center gap-2 min-w-0"},Tb={class:"text-retro-cyan font-mono text-sm"},Mb={class:"text-retro-muted text-sm truncate"},Ab={class:"flex items-center gap-1 flex-shrink-0"},_b=["aria-label","title"],Rb={class:"flex-1 overflow-auto p-4 space-y-4"},Bb={class:"space-y-2"},Zb={class:"flex items-center gap-2 text-sm"},Eb={class:"text-retro-text font-mono text-xs bg-retro-panel px-2 py-1 rounded"},Db={class:"flex items-center gap-2 text-sm"},Lb={class:"text-retro-text"},Xb={class:"text-retro-muted"},Ib={key:0,class:"flex items-center gap-2 text-sm"},Vb={class:"text-retro-text"},zb={class:"text-retro-muted"},Nb={class:"flex items-center gap-2 text-sm"},Wb={class:"text-retro-text"},jb={key:1,class:"flex items-start gap-2 text-sm"},qb={class:"flex flex-wrap gap-1"},Yb=["onClick","title"],Fb={key:2,class:"flex items-start gap-2 text-sm"},Ub={class:"flex flex-wrap gap-1"},Gb={key:3,class:"flex items-start gap-2 text-sm"},Hb={class:"flex flex-wrap gap-1"},Kb={class:"space-y-1"},Jb={class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded"},ex={key:0,class:"space-y-1"},tx=["innerHTML"],rx={key:1,class:"space-y-2"},nx={class:"flex items-center gap-2 text-sm"},sx={class:"text-retro-muted"},ix={key:0,class:"flex items-center gap-2"},ox={class:"text-retro-green text-xs font-mono"},ax={class:"flex-1 h-2 rounded overflow-hidden bg-retro-panel flex"},lx={class:"text-retro-red text-xs font-mono"},cx={key:2,class:"space-y-2"},ux={class:"flex items-center justify-between"},hx={class:"text-retro-muted text-xs uppercase tracking-wide"},dx={class:"flex items-center gap-1"},fx={key:0,class:"text-retro-muted text-sm py-2"},px={key:1,class:"space-y-0.5"},mx=["onClick"],gx=["title"],Ox={class:"text-retro-text font-mono text-xs truncate flex-1"},vx={class:"text-retro-muted"},bx={class:"text-retro-text"},xx={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},yx={key:0,class:"text-retro-green"},kx={key:1,class:"text-retro-red"},wx={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Sx={key:2,class:"space-y-0"},$x=["onClick"],Cx={class:"text-retro-text font-mono text-xs"},Qx=["title"],Px={class:"text-retro-text font-mono text-xs truncate flex-1"},Tx={class:"text-retro-muted"},Mx={class:"text-retro-text"},Ax={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},_x={key:0,class:"text-retro-green"},Rx={key:1,class:"text-retro-red"},Bx={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Zx={key:3,class:"flex items-center gap-2 text-retro-muted text-sm py-2"},Ex={key:4,class:"text-retro-muted text-sm py-2"},Dx=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=_(null),i=_("flat"),o=_(new Set),a=J(()=>!t.committer||!t.committerEmail?!1:t.committer!==t.commit.author||t.committerEmail!==t.commit.email),l=J(()=>{const L=t.commit.body;return L?Cb(L):""}),c=J(()=>{if(!t.stats)return"";const{filesChanged:L,additions:D,deletions:Z}=t.stats,q=[`${L} ${L===1?"file":"files"} changed`];return D>0&&q.push(`+${D} insertion${D===1?"":"s"}`),Z>0&&q.push(`-${Z} deletion${Z===1?"":"s"}`),q.join(", ")});function u(L){const D=[];for(const Z of L){const z=Z.path.split("/");let q=D;for(let V=0;V<z.length;V++){const X=z[V],N=V===z.length-1,me=z.slice(0,V+1).join("/");let K=q.find(he=>he.name===X&&he.isDirectory===!N);K||(K={name:X,fullPath:me,isDirectory:!N,children:[],file:N?Z:void 0},q.push(K)),N||(q=K.children)}}return h(D),D}function h(L){for(const D of L)if(D.isDirectory)for(h(D.children);D.children.length===1&&D.children[0].isDirectory;){const Z=D.children[0];D.name=`${D.name}/${Z.name}`,D.fullPath=Z.fullPath,D.children=Z.children}}function p(L){return[...L].sort((D,Z)=>D.isDirectory&&!Z.isDirectory?-1:!D.isDirectory&&Z.isDirectory?1:D.name.localeCompare(Z.name))}function f(L,D,Z){const z=[];for(const q of p(L)){const V=Z.size===0?!0:Z.has(q.fullPath);z.push({key:q.fullPath,depth:D,isDirectory:q.isDirectory,name:q.name,fullPath:q.fullPath,expanded:q.isDirectory?V:!1,file:q.file}),q.isDirectory&&V&&z.push(...f(q.children,D+1,Z))}return z}const g=J(()=>!t.files||t.files.length===0?[]:u(t.files)),O=J(()=>f(g.value,0,o.value));function y(L){o.value.has(L)?o.value.delete(L):o.value.add(L),o.value=new Set(o.value)}function b(){const L=D=>{const Z=[];for(const z of D)z.isDirectory&&(Z.push(z.fullPath),Z.push(...L(z.children)));return Z};o.value=new Set(L(g.value))}function C(){o.value=new Set}ze(i,L=>{L==="tree"&&b()});function P(L){return new Date(L*1e3).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}function A(L){return Ls[L]||{label:L,colorClass:"text-retro-muted"}}const E=J(()=>{if(!t.stats)return{addPct:0,delPct:0};const L=t.stats.additions+t.stats.deletions;return L===0?{addPct:50,delPct:50}:{addPct:Math.round(t.stats.additions/L*100),delPct:Math.round(t.stats.deletions/L*100)}});function F(L){L.key==="ArrowUp"?(L.preventDefault(),n("navigatePrev")):L.key==="ArrowDown"?(L.preventDefault(),n("navigateNext")):L.key==="Escape"&&(L.preventDefault(),n("close"))}mt(()=>{br(()=>{s.value?.focus()})}),ze(()=>t.commit.hash,()=>{br(()=>{s.value?.focus()})});function I(){n("close")}function oe(L){n("navigateToCommit",L)}function ie(){n("togglePosition")}function ne(L){n("openFileDiff",L)}return(L,D)=>(v(),x("section",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:F,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"},[d("div",Qb,[d("div",Pb,[d("span",Tb,B(r.commit.shortHash),1),d("span",Mb,B(r.commit.message.split(`
5
5
  `)[0]),1)]),d("div",Ab,[d("button",{onClick:ie,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(),Oe(m(Np),{key:0,class:"w-4 h-4 text-retro-muted hover:text-retro-text"})):(v(),Oe(m(zp),{key:1,class:"w-4 h-4 text-retro-muted hover:text-retro-text"}))],8,_b),d("button",{onClick:I,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"},[ee(m(Pt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])])]),d("div",Rb,[d("div",Bb,[d("div",Zb,[D[2]||(D[2]=d("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Hash:",-1)),d("code",Eb,B(r.commit.hash),1)]),d("div",Db,[ee(m(Rh),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("span",Lb,B(r.commit.author),1),d("span",Xb,"<"+B(r.commit.email)+">",1)]),a.value?(v(),x("div",Ib,[ee(m(Rh),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),D[3]||(D[3]=d("span",{class:"text-retro-muted text-xs uppercase mr-1"},"Committer:",-1)),d("span",Vb,B(r.committer),1),d("span",zb,"<"+B(r.committerEmail)+">",1)])):U("",!0),d("div",Nb,[ee(m(y1),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("span",Wb,B(P(r.commit.timestamp)),1)]),r.commit.parents?.length>0?(v(),x("div",jb,[D[4]||(D[4]=d("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Parents:",-1)),d("div",qb,[(v(!0),x(we,null,Fe(r.commit.parents,Z=>(v(),x("button",{key:Z,onClick:z=>oe(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)}`},B(Z.substring(0,7)),9,Yb))),128))])])):U("",!0),r.commit.branches?.length>0?(v(),x("div",Fb,[D[5]||(D[5]=d("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Branches:",-1)),d("div",Ub,[(v(!0),x(we,null,Fe(r.commit.branches,Z=>(v(),x("span",{key:Z,class:"text-retro-green font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},B(Z),1))),128))])])):U("",!0),r.commit.tags?.length>0?(v(),x("div",Gb,[D[6]||(D[6]=d("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Tags:",-1)),d("div",Hb,[(v(!0),x(we,null,Fe(r.commit.tags,Z=>(v(),x("span",{key:Z,class:"text-retro-yellow font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},B(Z),1))),128))])])):U("",!0)]),d("div",Kb,[D[7]||(D[7]=d("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Message ",-1)),d("div",Jb,B(r.commit.message.split(`
6
6
  `)[0]),1)]),r.commit.body?(v(),x("div",ex,[D[8]||(D[8]=d("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Body ",-1)),d("div",{class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded commit-body-rendered",innerHTML:l.value},null,8,tx)])):U("",!0),r.stats?(v(),x("div",rx,[d("div",nx,[d("span",sx,B(c.value),1)]),r.stats.additions>0||r.stats.deletions>0?(v(),x("div",ix,[d("span",ox,"+"+B(r.stats.additions),1),d("div",ax,[d("div",{class:"bg-retro-green h-full transition-all",style:Ut({width:E.value.addPct+"%"})},null,4),d("div",{class:"bg-retro-red h-full transition-all",style:Ut({width:E.value.delPct+"%"})},null,4)]),d("span",lx,"-"+B(r.stats.deletions),1)])):U("",!0)])):U("",!0),r.files?(v(),x("div",cx,[d("div",ux,[d("h4",hx," Files Changed ("+B(r.files.length)+") ",1),d("div",dx,[d("button",{onClick:D[0]||(D[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"},[ee(m(Up),{class:"w-4 h-4"})],2),d("button",{onClick:D[1]||(D[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"},[ee(m(Bh),{class:"w-4 h-4"})],2)])]),r.files.length===0?(v(),x("div",fx," No files changed in this commit. ")):i.value==="flat"?(v(),x("ul",px,[(v(!0),x(we,null,Fe(r.files,Z=>(v(),x("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:z=>ne(Z)},[d("span",{class:Re(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",A(Z.status).colorClass]),title:A(Z.status).label},B(Z.status),11,gx),ee(m(Ds),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("span",Ox,[Z.status==="R"&&Z.oldPath?(v(),x(we,{key:0},[d("span",vx,B(Z.oldPath),1),D[9]||(D[9]=d("span",{class:"text-retro-yellow mx-1"},"→",-1)),d("span",bx,B(Z.path),1)],64)):(v(),x(we,{key:1},[Xe(B(Z.path),1)],64))]),!Z.binary&&(Z.additions>0||Z.deletions>0)?(v(),x("span",xx,[Z.additions>0?(v(),x("span",yx,"+"+B(Z.additions),1)):U("",!0),Z.deletions>0?(v(),x("span",kx,"-"+B(Z.deletions),1)):U("",!0)])):Z.binary?(v(),x("span",wx,"binary")):U("",!0)],8,mx))),128))])):(v(),x("div",Sx,[d("div",{class:"flex items-center gap-2 mb-1"},[d("button",{onClick:b,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Expand all "),D[10]||(D[10]=d("span",{class:"text-retro-muted text-xs"},"|",-1)),d("button",{onClick:C,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Collapse all ")]),(v(!0),x(we,null,Fe(O.value,Z=>(v(),x("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:Ut({paddingLeft:Z.depth*16+4+"px"}),onClick:z=>Z.isDirectory?y(Z.fullPath):Z.file?ne(Z.file):void 0},[Z.isDirectory?(v(),x(we,{key:0},[ee(m(k1),{class:Re(["w-3 h-3 text-retro-muted transition-transform flex-shrink-0",{"rotate-90":Z.expanded}])},null,8,["class"]),ee(m(Bh),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),d("span",Cx,B(Z.name),1)],64)):Z.file?(v(),x(we,{key:1},[d("span",{class:Re(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",A(Z.file.status).colorClass]),title:A(Z.file.status).label},B(Z.file.status),11,Qx),ee(m(Ds),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("span",Px,[Z.file.status==="R"&&Z.file.oldPath?(v(),x(we,{key:0},[d("span",Tx,B(Z.file.oldPath.split("/").pop()),1),D[11]||(D[11]=d("span",{class:"text-retro-yellow mx-1"},"→",-1)),d("span",Mx,B(Z.name),1)],64)):(v(),x(we,{key:1},[Xe(B(Z.name),1)],64))]),!Z.file.binary&&(Z.file.additions>0||Z.file.deletions>0)?(v(),x("span",Ax,[Z.file.additions>0?(v(),x("span",_x,"+"+B(Z.file.additions),1)):U("",!0),Z.file.deletions>0?(v(),x("span",Rx,"-"+B(Z.file.deletions),1)):U("",!0)])):Z.file.binary?(v(),x("span",Bx,"binary")):U("",!0)],64)):U("",!0)],14,$x))),128))]))])):r.loading?(v(),x("div",Zx,[...D[12]||(D[12]=[d("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(),x("div",Ex," Failed to load file changes. "))])],544))}}),Lx=Gs(Dx,[["__scopeId","data-v-29f450ea"]]),Xx={class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark","aria-label":"Uncommitted changes details"},Ix={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Vx={class:"flex items-center gap-2 min-w-0"},zx={class:"text-retro-muted text-sm"},Nx={key:0,class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin",title:"Staging..."},Wx={class:"flex-1 overflow-auto p-4 space-y-3"},jx={class:"space-y-2"},qx=["disabled"],Yx={class:"space-y-1"},Fx={class:"flex items-center justify-between"},Ux={class:"text-retro-green text-xs uppercase tracking-wide font-semibold"},Gx={key:0,class:"text-retro-muted text-xs py-1"},Hx={key:1,class:"space-y-0.5"},Kx=["aria-label","onClick"],Jx={class:"text-retro-text font-mono text-xs truncate"},ey={class:"space-y-1"},ty={class:"flex items-center justify-between"},ry={class:"text-retro-yellow text-xs uppercase tracking-wide font-semibold"},ny={key:0,class:"text-retro-muted text-xs py-1"},sy={key:1,class:"space-y-0.5"},iy=["aria-label","onClick"],oy={class:"text-retro-text font-mono text-xs truncate"},ay=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=_(""),i=_(!1),o=J(()=>s.value.trim().length>0&&t.stagedFiles.length>0&&!i.value&&!t.isCommitting);function a(O){return Ls[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 p(){n("unstageAll")}async function f(){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(),f())}return(O,y)=>(v(),x("section",Xx,[d("div",Ix,[d("div",Vx,[ee(m(po),{class:"w-4 h-4 text-retro-yellow"}),y[1]||(y[1]=d("span",{class:"text-retro-yellow font-semibold text-sm"},"Uncommitted Changes",-1)),d("span",zx,"("+B(r.stagedFiles.length+r.unstagedFiles.length)+" files)",1),t.isStaging?(v(),x("div",Nx)):U("",!0)]),d("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"},[ee(m(Pt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])]),d("div",Wx,[d("div",jx,[He(d("textarea",{"onUpdate:modelValue":y[0]||(y[0]=b=>tt(s)?s.value=b:null),placeholder:"Commit message...",rows:"3",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none font-mono",onKeydown:g},null,544),[[Xt,m(s)]]),d("button",{disabled:!m(o),class:Re(["w-full px-3 py-1.5 text-sm font-semibold rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",m(o)?"bg-retro-green text-retro-dark hover:bg-retro-green/90":"bg-retro-green/30 text-retro-dark"]),onClick:f},B(m(i)||t.isCommitting?"Committing...":`Commit (${r.stagedFiles.length} staged)`),11,qx)]),d("div",Yx,[d("div",Fx,[d("h4",Ux," Staged Changes ("+B(r.stagedFiles.length)+") ",1),r.stagedFiles.length>0?(v(),x("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:p}," Unstage All ")):U("",!0)]),r.stagedFiles.length===0?(v(),x("div",Gx," No staged files. Stage files below to commit. ")):(v(),x("ul",Hx,[(v(!0),x(we,null,Fe(r.stagedFiles,b=>(v(),x("li",{key:"staged-"+b.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[d("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-red/20 transition-colors opacity-60 group-hover:opacity-100",title:"Unstage file","aria-label":`Unstage ${b.path}`,onClick:C=>u(b)},[ee(m(iv),{class:"w-3.5 h-3.5 text-retro-red"})],8,Kx),d("span",{class:Re(["flex-shrink-0 w-4 text-center text-xs font-bold",a(b.status).colorClass])},B(b.status),3),ee(m(Ds),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),d("span",Jx,B(b.oldPath?`${b.oldPath} → ${b.path}`:b.path),1)]))),128))]))]),d("div",ey,[d("div",ty,[d("h4",ry," Unstaged Changes ("+B(r.unstagedFiles.length)+") ",1),r.unstagedFiles.length>0?(v(),x("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(),x("div",ny," No unstaged changes. ")):(v(),x("ul",sy,[(v(!0),x(we,null,Fe(r.unstagedFiles,b=>(v(),x("li",{key:"unstaged-"+b.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[d("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-green/20 transition-colors opacity-60 group-hover:opacity-100",title:"Stage file","aria-label":`Stage ${b.path}`,onClick:C=>c(b)},[ee(m(sl),{class:"w-3.5 h-3.5 text-retro-green"})],8,iy),d("span",{class:Re(["flex-shrink-0 w-4 text-center text-xs font-bold",a(b.status).colorClass])},B(b.status),3),ee(m(Ds),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),d("span",oy,B(b.oldPath?`${b.oldPath} → ${b.path}`:b.path),1)]))),128))]))])])]))}}),ly=["aria-label"],cy={key:0,class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border truncate font-mono"},uy={key:0,class:"my-1 border-t border-retro-border",role:"separator"},hy=["aria-disabled","onClick","onMouseenter"],dy={key:1,class:"w-4 h-4 flex-shrink-0"},Wh=220,fy=36,py=9,my=29,on=8,go=Ie({__name:"GitContextMenu",props:{items:{},x:{},y:{},title:{}},emits:["close","action"],setup(r,{emit:e}){const t=r,n=e,s=_(null),i=_(-1),o=J(()=>t.items.map((f,g)=>({item:f,i:g})).filter(({item:f})=>!f.disabled).map(({i:f})=>f));let a=!1;function l(f){a&&s.value&&!s.value.contains(f.target)&&n("close")}mt(()=>{requestAnimationFrame(()=>{a=!0}),document.addEventListener("mousedown",l),document.addEventListener("contextmenu",l),br(()=>{s.value?.focus()})}),St(()=>{a=!1,document.removeEventListener("mousedown",l),document.removeEventListener("contextmenu",l)});function c(f){const g=o.value;if(g.length===0)return;if(i.value===-1){i.value=f===1?g[0]:g[g.length-1];return}const O=g.indexOf(i.value);if(O===-1){i.value=f===1?g[0]:g[g.length-1];return}const y=O+f;y>=0&&y<g.length&&(i.value=g[y])}function u(f){switch(f.key){case"Escape":f.preventDefault(),n("close");break;case"ArrowDown":f.preventDefault(),c(1);break;case"ArrowUp":f.preventDefault(),c(-1);break;case"Enter":{f.preventDefault();const g=t.items[i.value];g&&!g.disabled&&(n("action",g.key),n("close"));break}}}function h(f){f.disabled||(n("action",f.key),n("close"))}const p=J(()=>{const f=t.title?my:0,g=t.items.filter(P=>P.separator).length,O=t.items.length*fy+g*py+on,y=f+O;let b=t.x,C=t.y;return typeof window<"u"&&(b+Wh>window.innerWidth-on&&(b=window.innerWidth-Wh-on),b<on&&(b=on),C+y>window.innerHeight-on&&(C=window.innerHeight-y-on),C<on&&(C=on)),{left:`${b}px`,top:`${C}px`}});return(f,g)=>(v(),Oe(xr,{to:"body"},[d("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:Ut(m(p)),role:"menu","aria-label":r.title??"Context menu",tabindex:"-1",onKeydown:u},[r.title?(v(),x("div",cy,B(r.title),1)):U("",!0),(v(!0),x(we,null,Fe(r.items,(O,y)=>(v(),x(we,{key:O.key},[O.separator?(v(),x("div",uy)):U("",!0),d("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",m(i)===y?"bg-retro-red/10":""]:["text-retro-text hover:bg-retro-cyan/10 focus:bg-retro-cyan/10",m(i)===y?"bg-retro-cyan/10":""]]]),role:"menuitem","aria-disabled":O.disabled||void 0,tabindex:-1,onClick:b=>h(O),onMouseenter:b=>i.value=O.disabled?m(i):y,onMouseleave:g[0]||(g[0]=b=>i.value=-1)},[O.icon?(v(),Oe(Zs(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(),x("span",dy)),Xe(" "+B(O.label),1)],42,hy)],64))),128))],44,ly)]))}}),gy=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=J(()=>[{key:"checkout",label:"Checkout",icon:us,disabled:t.isCurrentBranch},{key:"rename",label:"Rename",icon:w1,separator:!0},{key:"deleteBranch",label:"Delete",icon:fn,danger:!0,disabled:t.isCurrentBranch},{key:"merge",label:"Merge into Current",icon:Wp,separator:!0,disabled:t.isCurrentBranch},{key:"rebase",label:"Rebase Current Onto",icon:Xp,disabled:t.isCurrentBranch},{key:"push",label:"Push",icon:Ip,separator:!0},{key:"copyName",label:"Copy Branch Name",icon:Es,separator:!0}]),i=J(()=>[{key:"checkout",label:"Checkout",icon:us},{key:"deleteBranch",label:"Delete Remote Branch",icon:fn,separator:!0,danger:!0},{key:"fetch",label:"Fetch",icon:qp,separator:!0},{key:"pull",label:"Pull into Current",icon:I1},{key:"copyName",label:"Copy Branch Name",icon:Es,separator:!0}]),o=J(()=>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=go;return v(),Oe(h,{items:m(o),x:r.x,y:r.y,title:r.branchName,onAction:l,onClose:u[0]||(u[0]=p=>n("close"))},null,8,["items","x","y","title"])}}}),Oy=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=J(()=>[{key:"addTag",label:"Add Tag",icon:Tu},{key:"createBranch",label:"Create Branch",icon:sl},{key:"checkout",label:"Checkout (detached HEAD)",icon:us,separator:!0},{key:"cherryPick",label:"Cherry Pick",icon:H1},{key:"revert",label:"Revert",icon:Vp},{key:"mergeInto",label:"Merge into Current",icon:Wp,separator:!0},{key:"reset",label:"Reset Current Branch to Here",icon:Xp,danger:!0},{key:"copyHash",label:"Copy Commit Hash",icon:Es,separator:!0},{key:"copySubject",label:"Copy Commit Subject",icon:Es}]),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=go;return v(),Oe(l,{items:m(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"])}}}),vy=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:Tu},{key:"deleteTag",label:"Delete Tag",icon:fn,separator:!0,danger:!0},{key:"pushTag",label:"Push Tag",icon:Ip},{key:"copyName",label:"Copy Tag Name",icon:Es,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=go;return v(),Oe(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"])}}}),by=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:X1},{key:"pop",label:"Pop Stash",icon:Vp},{key:"createBranch",label:"Create Branch from Stash",icon:S1,separator:!0},{key:"drop",label:"Drop Stash",icon:fn,separator:!0,danger:!0},{key:"copyName",label:"Copy Stash Reference",icon:Es,separator:!0},{key:"copyHash",label:"Copy Stash Hash",icon:rv}],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=go;return v(),Oe(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"])}}}),xy=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:L1},{key:"reset",label:"Reset Working Directory",icon:us,separator:!0,danger:!0},{key:"clean",label:"Clean Untracked Files",icon:fn,danger:!0}],s={stash:()=>t("stash"),reset:()=>t("reset"),clean:()=>t("clean")};function i(o){s[o]?.()}return(o,a)=>{const l=go;return v(),Oe(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"])}}}),yy={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},ky={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},wy={class:"text-sm font-mono text-retro-text"},Sy={class:"p-4"},$y={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Cy={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},Qy=["disabled"],Py=["disabled"],Wt=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 ze(()=>t.visible,i=>{i?document.addEventListener("keydown",s):document.removeEventListener("keydown",s)}),St(()=>{document.removeEventListener("keydown",s)}),(i,o)=>(v(),Oe(xr,{to:"body"},[ee(dn,{"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(),x("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]=fr(a=>n("close"),["self"]))},[d("div",yy,[d("div",ky,[d("h3",wy,B(r.title),1),d("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"))},[ee(m(Pt),{class:"h-4 w-4"})])]),d("div",Sy,[r.error?(v(),x("div",$y,B(r.error),1)):U("",!0),Bp(i.$slots,"default")]),d("div",Cy,[d("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"))},B(r.cancelLabel),9,Qy),d("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"))},B(r.loading?"Loading...":r.confirmLabel),11,Py)])])])):U("",!0)]),_:3})]))}}),ll=xu("gitGraph",()=>{const r=_([]),e=_([]),t=_([]),n=_(new Set),s=_([]),i=_([]),o=_(0),a=_(!1),l=_(null),c=_(null),u=_(null),h=_(!1),p=_(null),f=_(!1),g=_(0),O=_(""),y=_([]),b=_(null),C=_(!1),P=_(!1),A=_(!1),E=_(!1),F=8e3,I=_(null);let oe=null;function ie(j){I.value=j,oe&&clearTimeout(oe),oe=setTimeout(()=>{I.value=null},F)}function ne(){I.value=null,oe&&(clearTimeout(oe),oe=null)}async function L(j,re,Qe,kt){if(!b.value)return{success:!1,error:"No working directory set"};try{const Xr=await $fetch(j,{method:kt?.method??"POST",body:{workingDirectory:b.value,...re}});return(kt?.reloadGraph??!0)&&await Kt(b.value),{success:!0,data:Xr}}catch(Xr){const Ir=Bo(Xr,Qe);return ie(Ir),{success:!1,error:Ir}}}const D=_(null),Z=_(!1),z=_(!1),q=_(null),V=_([]),X=_([]),N=_(null),me=_(null),K=_(null),he=_("inline"),$=_("list"),w=_("rounded"),M=_(!1),R=_({date:!0,author:!0,commit:!0}),G=_(0),ae=_(0),xe=_(null),De=_(null),Ae=_(null),Ue=_(null),Ye=_(null),pe=_(null),Ce=_(null),ce=_(null),ue=_(null),Y=_(null),Me=_(null),Le=_(!1),Ve=new Map,Mt=10,Zt=J(()=>{if(!O.value&&y.value.length===0)return r.value;let j=r.value;if(O.value){const re=O.value.toLowerCase(),Qe=`${re}:${r.value.length}`;if(Ve.has(Qe))j=Ve.get(Qe);else{if(j=Nh(j,re),Ve.size>=Mt){const kt=Ve.keys().next().value;kt&&Ve.delete(kt)}Ve.set(Qe,j)}}if(y.value.length>0){const re=new Set(y.value);j=nb(j,re)}return j}),bn=J(()=>e.value.find(j=>j.isHead)||null);async function Kt(j){b.value=j,h.value=!0,p.value=null;try{const[re,Qe,kt,Xr,Ir]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:j}}),$fetch("/api/git/status",{query:{workingDirectory:j}}),$fetch("/api/git/stash",{query:{workingDirectory:j}}).then(Sn=>Sn.stashes).catch(()=>[]),$fetch("/api/git/remotes",{query:{workingDirectory:j}}).then(Sn=>Sn.remotes).catch(()=>[]),$fetch("/api/git/state",{query:{workingDirectory:j}}).then(Sn=>Sn.state).catch(()=>null)]);r.value=re.commits,e.value=re.branches,t.value=re.tags,n.value=new Set(re.localBranches??[]),f.value=re.hasMore,g.value=re.totalCount,s.value=Qe.stagedFiles??[],i.value=Qe.unstagedFiles??[],o.value=(Qe.stagedCount??0)+(Qe.unstagedCount??0),V.value=kt,X.value=Xr,q.value=Ir,D.value=Date.now(),await S()}catch(re){const Qe=re instanceof Error?re.message:"Failed to load git graph";p.value=Qe,r.value=[],e.value=[],t.value=[],s.value=[],i.value=[],o.value=0,V.value=[],X.value=[]}finally{h.value=!1}}async function Er(){if(b.value)try{const j=await $fetch("/api/git/status",{query:{workingDirectory:b.value}});s.value=j.stagedFiles??[],i.value=j.unstagedFiles??[],o.value=(j.stagedCount??0)+(j.unstagedCount??0)}catch(j){console.error("Failed to refresh uncommitted changes:",j)}}const $r=_(!1);async function zn(){if(!(!b.value||!f.value||h.value||$r.value)){$r.value=!0;try{const j=await $fetch("/api/git/log",{query:{workingDirectory:b.value,offset:r.value.length}});r.value=[...r.value,...j.commits],f.value=j.hasMore}catch(j){console.error("Failed to load more commits:",j)}finally{$r.value=!1}}}async function Cr(j){if(l.value=j,c.value=null,u.value=null,a.value=!1,C.value=!0,!b.value){C.value=!1;return}try{const re=await $fetch("/api/git/show",{query:{workingDirectory:b.value,hash:j.hash}});c.value=re.files,u.value=re.stats}catch(re){console.error("Failed to load commit details:",re),c.value=[],u.value={additions:0,deletions:0,filesChanged:0},ie("Failed to load commit details")}finally{C.value=!1}}function xn(){l.value=null,c.value=null,u.value=null,a.value=!1}function Nn(){l.value=null,u.value=null,c.value=null,a.value=!0}function yn(j){O.value=j,G.value=0,Qr()}const xt=J(()=>O.value?Nh(r.value,O.value).map(j=>j.hash):[]);function Qr(){ae.value=xt.value.length}function H(){xt.value.length!==0&&(G.value=(G.value+1)%xt.value.length,Qr(),se())}function fe(){xt.value.length!==0&&(G.value=G.value<=0?xt.value.length-1:G.value-1,Qr(),se())}function se(){const j=xt.value[G.value];if(j){const re=r.value.find(Qe=>Qe.hash===j);re&&Cr(re)}}function ve(j){const re=y.value.indexOf(j);re===-1?y.value.push(j):y.value.splice(re,1)}function _e(){O.value="",y.value=[]}async function We(j){if(!b.value)return{success:!1,error:"No working directory set"};E.value=!0;try{const re=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:b.value,branchName:j}});return re.success&&await Kt(b.value),{success:re.success,error:re.error}}catch(re){const Qe=re instanceof Error?re.message:"Failed to checkout branch";return ie(Qe),{success:!1,error:Qe}}finally{E.value=!1}}async function Ge(j,re){if(!b.value)return{success:!1,error:"No working directory set"};try{const Qe=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:b.value,branchName:j,createBranch:!0,fromCommit:re}});return Qe.success&&await Kt(b.value),{success:Qe.success,error:Qe.error}}catch(Qe){return{success:!1,error:Qe instanceof Error?Qe.message:"Failed to create branch"}}}async function it(j,re=!1){return L("/api/git/branch",{branchName:j,force:re},"Failed to delete branch",{method:"DELETE"})}async function ri(j){return L("/api/git/branch",{branchName:j,remote:!0},"Failed to delete remote branch",{method:"DELETE"})}async function ni(j){if(!b.value)return{success:!1,error:"No working directory set"};P.value=!0;try{return await $fetch("/api/git/stage",{method:"POST",body:{workingDirectory:b.value,files:j}}),await Er(),{success:!0}}catch(re){const Qe=re instanceof Error?re.message:"Failed to stage files";return ie(Qe),{success:!1,error:Qe}}finally{P.value=!1}}async function Dr(j){if(!b.value)return{success:!1,error:"No working directory set"};P.value=!0;try{return await $fetch("/api/git/unstage",{method:"POST",body:{workingDirectory:b.value,files:j}}),await Er(),{success:!0}}catch(re){const Qe=re instanceof Error?re.message:"Failed to unstage files";return ie(Qe),{success:!1,error:Qe}}finally{P.value=!1}}async function si(j){if(!b.value)return{success:!1,error:"No working directory set"};A.value=!0;try{return await $fetch("/api/git/commit",{method:"POST",body:{workingDirectory:b.value,message:j}}),await Kt(b.value),{success:!0}}catch(re){const Qe=re instanceof Error?re.message:"Failed to commit changes";return ie(Qe),{success:!1,error:Qe}}finally{A.value=!1}}async function ii(j,re){return L("/api/git/branch-rename",{oldName:j,newName:re},"Failed to rename branch")}async function oi(j,re){return L("/api/git/merge",{branch:j,...re},"Failed to merge branch")}async function ai(j){return L("/api/git/rebase",{onto:j},"Failed to rebase branch")}async function li(j,re,Qe,kt){return L("/api/git/push",{branch:j,remote:re,force:Qe,forceWithLease:kt},"Failed to push branch")}async function ci(j,re,Qe,kt){return L("/api/git/pull",{branch:j,remote:re,noFastForward:Qe,squash:kt},"Failed to pull branch")}async function ui(j,re,Qe){return L("/api/git/fetch",{branch:j,remote:re,...Qe},"Failed to fetch")}async function hi(j,re,Qe){return L("/api/git/cherry-pick",{hash:j,recordOrigin:re,noCommit:Qe},"Failed to cherry-pick commit")}async function di(j){return L("/api/git/revert",{hash:j},"Failed to revert commit")}async function fi(j,re){return L("/api/git/reset",{hash:j,mode:re},"Failed to reset to commit")}async function pi(j){if(!b.value)return{success:!1,error:"No working directory set"};try{return await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:b.value,branchName:j}}),await Kt(b.value),{success:!0}}catch(re){const Qe=re?.data?.message||re?.statusMessage||re?.message||"Failed to checkout commit";return ie(Qe),{success:!1,error:Qe}}}async function Et(j){try{const re=j.message.split(`
7
7
  `)[0];return await Un(re),{success:!0}}catch(re){const Qe=re?.message||"Failed to copy commit subject";return ie(Qe),{success:!1,error:Qe}}}async function Jt(j,re,Qe,kt,Xr){return L("/api/git/tag",{name:j,hash:re,annotated:Qe,message:kt,pushToRemote:Xr},"Failed to create tag")}async function rn(j,re){return L("/api/git/tag",{name:j,deleteFromRemote:re},"Failed to delete tag",{method:"DELETE"})}async function nn(j,re){return L("/api/git/tag-push",{name:j,remote:re},"Failed to push tag")}async function Wn(j){if(!b.value)return{success:!1,error:"No working directory set"};try{return{success:!0,data:await $fetch(`/api/git/tag/${encodeURIComponent(j)}`,{query:{workingDirectory:b.value}})}}catch(re){const Qe=Bo(re,"Failed to get tag detail");return ie(Qe),{success:!1,error:Qe}}}async function kn(j){try{return await Un(j),{success:!0}}catch(re){const Qe=re?.message||"Failed to copy tag name";return ie(Qe),{success:!1,error:Qe}}}async function Lr(){if(!b.value)return{success:!1,error:"No working directory set"};try{const j=await $fetch("/api/git/stash",{query:{workingDirectory:b.value}});return V.value=j.stashes,{success:!0}}catch(j){const re=Bo(j,"Failed to load stashes");return ie(re),{success:!1,error:re}}}async function mi(j,re){return L("/api/git/stash-apply",{index:j,reinstateIndex:re},"Failed to apply stash")}async function gs(j,re){return L("/api/git/stash-pop",{index:j,reinstateIndex:re},"Failed to pop stash")}async function Os(j){return L("/api/git/stash-drop",{index:j},"Failed to drop stash")}async function ur(j,re){return L("/api/git/stash-branch",{index:j,branchName:re},"Failed to create branch from stash")}async function hr(j,re){return L("/api/git/stash",{message:j,includeUntracked:re},"Failed to stash changes")}async function vs(){if(!b.value)return{success:!1,error:"No working directory set"};try{const j=await $fetch("/api/git/remotes",{query:{workingDirectory:b.value}});return X.value=j.remotes,{success:!0}}catch(j){const re=Bo(j,"Failed to load remotes");return ie(re),{success:!1,error:re}}}async function gi(j,re){return L("/api/git/remote",{name:j,url:re},"Failed to add remote")}async function wn(j,re){return L("/api/git/remote",{name:j,newUrl:re},"Failed to edit remote",{method:"PUT"})}async function Oi(j){return L("/api/git/remote",{name:j},"Failed to delete remote",{method:"DELETE"})}async function jn(j,re){return L("/api/git/fetch",{all:!0,prune:j,pruneTags:re},"Failed to fetch all")}function dr(){he.value=he.value==="inline"?"bottom":"inline"}function Pr(){$.value=$.value==="list"?"tree":"list"}function vi(j){w.value=j}function bi(){M.value=!M.value}function xi(j){R.value={...R.value,[j]:!R.value[j]}}async function qn(j){if(xe.value=j,De.value=null,j&&b.value)try{const re=await $fetch("/api/git/merge-base",{params:{workingDirectory:b.value,branch:j}});De.value=re.mergeBase}catch{De.value=null}}async function Yn(j,re){if(Ae.value=j,Ue.value=null,Ye.value=re??null,j&&b.value)try{const Qe=await $fetch("/api/git/merge-base",{params:{workingDirectory:b.value,branch:j,baseBranch:re??void 0}});Ue.value=Qe.mergeBase}catch{Ue.value=null}}async function yi(j,re){if(pe.value=j,Ce.value=null,ce.value=re??null,j&&b.value)try{const Qe=await $fetch("/api/git/merge-base",{params:{workingDirectory:b.value,branch:j,baseBranch:re??void 0}});Ce.value=Qe.mergeBase}catch{Ce.value=null}}async function Fn(j,re,Qe){try{const kt=await $fetch("/api/git/merge-base",{params:{workingDirectory:b.value,branch:j,baseBranch:re??void 0}});Qe.value=kt.mergeBase}catch{Qe.value=null}}async function S(){if(!b.value)return;const j=[];xe.value&&j.push(Fn(xe.value,void 0,De)),Ae.value&&j.push(Fn(Ae.value,Ye.value,Ue)),pe.value&&j.push(Fn(pe.value,ce.value,Ce)),j.length>0&&await Promise.all(j)}function k(j){const re=r.value.find(Qe=>Qe.hash===j||Qe.shortHash===j);re&&Cr(re)}async function T(j){return L("/api/git/reset",{hash:"HEAD",mode:j},"Failed to reset working directory")}async function W(){return L("/api/git/clean",{},"Failed to clean untracked files")}function le(j){me.value=j}function be(){me.value=null}function de(j){K.value=j}function Se(){K.value=null}const qe=_(null),ot=_(null),yt=_(!1),Mo=J(()=>!!N.value&&!!l.value);function sn(j){N.value=j,j&&l.value&&Ze()}function ki(){N.value=null,qe.value=null,ot.value=null,yt.value=!1}async function Ze(){if(!(!b.value||!l.value||!N.value)){yt.value=!0;try{const j=N.value.hash,re=l.value.hash,Qe=await $fetch("/api/git/diff",{query:{workingDirectory:b.value,from:j,to:re}});qe.value=Qe.files,ot.value=Qe.stats}catch(j){console.error("Failed to load comparison:",j),ie("Failed to load commit comparison"),qe.value=null,ot.value=null}finally{yt.value=!1}}}async function Un(j){navigator?.clipboard&&await navigator.clipboard.writeText(j)}async function bs(j,re){ue.value=re,Y.value=j,Me.value=null,Le.value=!0,await o1()}function Ah(){ue.value=null,Y.value=null,Me.value=null,Le.value=!1}async function o1(){if(!b.value||!Y.value||!ue.value){Le.value=!1;return}Le.value=!0;try{const j=await $fetch("/api/git/file-diff",{query:{workingDirectory:b.value,commitHash:Y.value,filePath:ue.value.path}});Me.value=j}catch(j){console.error("Failed to load file diff:",j),ie("Failed to load file diff"),Me.value=null}finally{Le.value=!1}}function a1(){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,p.value=null,f.value=!1,g.value=0,O.value="",y.value=[],b.value=null,D.value=null,Z.value=!1,z.value=!1,q.value=null,$r.value=!1,C.value=!1,P.value=!1,A.value=!1,E.value=!1,V.value=[],X.value=[],N.value=null,qe.value=null,ot.value=null,yt.value=!1,me.value=null,K.value=null,he.value="inline",$.value="list",w.value="rounded",M.value=!1,R.value={date:!0,author:!0,commit:!0},G.value=0,ae.value=0,xe.value=null,Ae.value=null,Ue.value=null,Ye.value=null,pe.value=null,Ce.value=null,ce.value=null,ue.value=null,Y.value=null,Me.value=null,Le.value=!1,ne(),Ve.clear()}async function l1(){if(!b.value||z.value||h.value)return!1;z.value=!0;try{const j=(await $fetch("/api/git/state",{query:{workingDirectory:b.value}})).state,re=q.value;if(q.value=j,D.value=Date.now(),!re)return!1;const Qe=re.headCommit!==j.headCommit||re.branchListHash!==j.branchListHash,kt=re.workingTreeHash!==j.workingTreeHash,Xr=re.stashListHash!==j.stashListHash;if(Qe){const[$n,Ao,h1]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:b.value}}),$fetch("/api/git/status",{query:{workingDirectory:b.value}}),$fetch("/api/git/stash",{query:{workingDirectory:b.value}}).then(d1=>d1.stashes).catch(()=>[])]);return r.value=$n.commits,e.value=$n.branches,t.value=$n.tags,n.value=new Set($n.localBranches??[]),f.value=$n.hasMore,g.value=$n.totalCount,s.value=Ao.stagedFiles??[],i.value=Ao.unstagedFiles??[],o.value=(Ao.stagedCount??0)+(Ao.unstagedCount??0),V.value=h1,await S(),!0}if(!kt&&!Xr)return!1;const[Ir,Sn]=await Promise.all([kt?$fetch("/api/git/status",{query:{workingDirectory:b.value}}):Promise.resolve(null),Xr?$fetch("/api/git/stash",{query:{workingDirectory:b.value}}).then($n=>$n.stashes).catch(()=>[]):Promise.resolve(null)]);return Ir&&(s.value=Ir.stagedFiles??[],i.value=Ir.unstagedFiles??[],o.value=(Ir.stagedCount??0)+(Ir.unstagedCount??0)),Sn&&(V.value=Sn),!0}catch(j){return console.error("Failed to refresh git graph:",j),!1}finally{z.value=!1}}function c1(){Z.value=!0}function u1(){Z.value=!1}return{commits:Te(r),branches:Te(e),tags:Te(t),localBranchNames:Te(n),stagedFiles:Te(s),unstagedFiles:Te(i),uncommittedChangesCount:Te(o),isUncommittedChangesSelected:Te(a),selectedCommit:Te(l),selectedCommitFiles:Te(c),selectedCommitStats:Te(u),loading:Te(h),loadingMore:Te($r),error:Te(p),hasMore:Te(f),totalCount:Te(g),searchQuery:Te(O),filteredBranches:Te(y),workingDirectory:Te(b),stashes:Te(V),remotes:Te(X),comparisonCommit:Te(N),comparisonFiles:Te(qe),comparisonStats:Te(ot),comparisonLoading:Te(yt),isComparing:Mo,activeDialog:Te(me),activeContextMenu:Te(K),detailViewPosition:Te(he),fileViewMode:Te($),graphStyle:Te(w),muteNonAncestral:Te(M),columnVisibility:Te(R),searchResultIndex:Te(G),searchResultCount:Te(ae),selectedFeatureId:Te(xe),featureMergeBase:Te(De),conversationBranch:Te(Ae),conversationMergeBase:Te(Ue),conversationBaseBranch:Te(Ye),previewBranch:Te(pe),previewMergeBase:Te(Ce),previewBaseBranch:Te(ce),diffViewerFile:Te(ue),diffViewerCommitHash:Te(Y),diffViewerContent:Te(Me),diffViewerLoading:Te(Le),lastRefreshTime:Te(D),isPollingActive:Te(Z),isRefreshing:Te(z),isLoadingDetails:Te(C),isStaging:Te(P),isCommitting:Te(A),isCheckingOut:Te(E),operationError:Te(I),filteredCommits:Zt,currentBranch:bn,searchResultHashes:xt,loadGitGraph:Kt,loadMoreCommits:zn,refreshUncommittedChanges:Er,selectCommit:Cr,selectUncommittedChanges:Nn,clearSelection:xn,setSearchQuery:yn,toggleBranchFilter:ve,clearFilters:_e,nextSearchResult:H,prevSearchResult:fe,checkoutBranch:We,createBranch:Ge,deleteLocalBranch:it,deleteRemoteBranch:ri,stageFiles:ni,unstageFiles:Dr,commitChanges:si,reset:a1,clearOperationError:ne,renameBranch:ii,mergeBranch:oi,rebaseBranch:ai,pushBranch:li,pullBranch:ci,fetchBranch:ui,cherryPickCommit:hi,revertCommit:di,resetToCommit:fi,checkoutCommit:pi,copyCommitSubject:Et,createTag:Jt,deleteTag:rn,pushTag:nn,getTagDetail:Wn,copyTagName:kn,loadStashes:Lr,applyStash:mi,popStash:gs,dropStash:Os,stashBranch:ur,stashChanges:hr,loadRemotes:vs,addRemote:gi,editRemote:wn,deleteRemote:Oi,fetchAll:jn,setActiveDialog:le,clearActiveDialog:be,setActiveContextMenu:de,clearActiveContextMenu:Se,selectComparisonCommit:sn,clearComparison:ki,loadComparisonData:Ze,copyToClipboard:Un,toggleDetailViewPosition:dr,toggleFileViewMode:Pr,setGraphStyle:vi,toggleMuteNonAncestral:bi,toggleColumnVisibility:xi,navigateToCommit:k,resetWorking:T,cleanUntracked:W,setSelectedFeatureId:qn,setConversationBranch:Yn,setPreviewBranch:yi,openFileDiff:bs,closeFileDiff:Ah,checkAndRefresh:l1,startPolling:c1,stopPolling:u1}});async function jh(){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!==wa&&console.warn(`[conversationStorage] Storage version mismatch: ${r.version} vs ${wa}`);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(A1),i=n.filter(_1),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 Ty(r,e=[]){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations",{method:"POST",body:{version:wa,conversations:r,archivedConversations:e}}),!0}catch(t){return console.error("Failed to save conversations:",t),!1}}async function qh(r){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations/update",{method:"POST",body:{version:wa,conversation:r}}),!0}catch(e){return console.error("Failed to save conversation:",e),!1}}function My(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
- `):""}const kr=xu("chat",()=>{const r=_(!1),e=_(R1),t=_("ask"),n=_(""),s=_([]),i=_([]),o=_(null),a=_("active"),l=_(new Set),c=new Map,u=_(!1),h=_(0),p=new Map,f=1200,g=_(null),O=_(null);function y(S){return S?c.get(S)??null:null}function b(S){let k=c.get(S);return k||(k={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},c.set(S,k)),k}const C=J(()=>s.value.find(S=>S.id===o.value)||null),P=J(()=>C.value?.messages??[]),A=J(()=>(h.value,y(o.value)?.session??null)),E=J(()=>(h.value,y(o.value)?.pendingPermission??null)),F=J(()=>(h.value,y(o.value)?.pendingPlanApproval??null)),I=J(()=>(h.value,y(o.value)?.lastError??null)),oe=J(()=>(h.value,y(o.value)?.debugEvents??[])),ie=J(()=>A.value?.status==="streaming"),ne=J(()=>C.value?.providerSessionId??""),L=J(()=>P.value.length>0),D=J(()=>P.value[P.value.length-1]||null);function Z(S){return l.value.has(S)}const z=J(()=>o.value?l.value.has(o.value):!1),q=J(()=>s.value.length>0),V=J(()=>i.value.length>0),X=J(()=>s.value.length),N=J(()=>X.value>=Eh),me=J(()=>s.value),K=J(()=>i.value),he=J(()=>g.value&&s.value.find(S=>S.id===g.value)||null);function $(S){return g.value===S}function w(S){a.value=S}async function M(S){if(!(!S?.previewBranch||!S.worktreePath))try{const k=await $fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:S.previewBranch,worktreePath:S.worktreePath}});if(!k.success)throw new Error(k.error||"Unknown preview sync failure")}catch(k){console.warn("[chat] Failed to sync preview branch after worktree update",{conversationId:S.id,previewBranch:S.previewBranch,worktreePath:S.worktreePath,error:k instanceof Error?k.message:String(k)})}}async function R(S){if(Z(S))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(T=>T.id===S)===-1)return{success:!1,error:"Conversation not found"};try{const T=await $fetch(`/api/conversations/${S}/archive`,{method:"POST"});if(T.success&&T.archived){const W=p.get(S);return W&&(clearTimeout(W),p.delete(S)),c.delete(S),s.value=Array.isArray(T.conversations)?T.conversations:s.value.filter(le=>le.id!==S),i.value=Array.isArray(T.archivedConversations)?T.archivedConversations:[T.archived,...i.value],Wn(),g.value===S&&(g.value=null),o.value===S&&(o.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:o.value}}).catch(le=>{console.error("Failed to save active conversation:",le)}),{success:!0}}return{success:!1,error:"Failed to archive conversation"}}catch(T){return{success:!1,error:T instanceof Error?T.message:"Failed to archive conversation"}}}async function G(S,k){if(qn().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${Dh}.`};if(!i.value.some(W=>W.id===S))return{success:!1,error:"Archived conversation not found"};try{const W=await $fetch(`/api/conversations/archives/${S}/restore`,{method:"POST",body:{baseBranch:k}});return W.success&&W.conversation?(s.value=Array.isArray(W.conversations)?W.conversations:[W.conversation,...s.value],Array.isArray(W.archivedConversations)?i.value=W.archivedConversations:i.value=i.value.filter(le=>le.id!==S),a.value="active",Lr(W.conversation.id),nn(),Et(),{success:!0,conversationId:W.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(W){return{success:!1,error:W instanceof Error?W.message:"Failed to restore archived conversation"}}}async function ae(S){const k=i.value.findIndex(T=>T.id===S);if(k===-1)return{success:!1,error:"Archived conversation not found"};try{const T=await $fetch(`/api/conversations/archives/${S}`,{method:"DELETE"});return T.success?(Array.isArray(T.archivedConversations)?i.value=T.archivedConversations:i.value.splice(k,1),Wn(),{success:!0}):{success:!1,error:"Failed to delete archived conversation"}}catch{return i.value.splice(k,1),Et(),{success:!0}}}async function xe(){if(!(typeof window>"u"))try{const S=await $fetch("/api/settings");if(S){if(typeof S.panelWidth=="number"){const W=S.panelWidth;W>=Lh&&W<=Xh&&(e.value=W)}typeof S.isPanelOpen=="boolean"&&(r.value=S.isPanelOpen),typeof S.activeConversationId=="string"&&(o.value=S.activeConversationId);const{useSettingsStore:k}=await as(async()=>{const{useSettingsStore:W}=await import("./Bze5ywup.js").then(le=>le.s);return{useSettingsStore:W}},__vite__mapDeps([0,1,2]),import.meta.url),T=k();await T.hydrate(),t.value=T.permissionMode}}catch(S){console.error("Failed to load chat settings:",S)}}function De(S){t.value=S,typeof window<"u"&&as(async()=>{const{useSettingsStore:k}=await import("./Bze5ywup.js").then(T=>T.s);return{useSettingsStore:k}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:k})=>{k().setPermissionMode(S)})}function Ae(S,k){const T=k??o.value;if(!T)return;const W=b(T);W.pendingPermission=S,h.value++}function Ue(S){const k=S??o.value;if(!k)return;const T=c.get(k);T&&(T.pendingPermission=null,h.value++)}function Ye(S,k){const T=k??o.value;if(!T)return;const W=b(T);W.pendingPlanApproval=S,h.value++}function pe(S){const k=S??o.value;if(!k)return;const T=c.get(k);T&&(T.pendingPlanApproval=null,h.value++)}function Ce(){r.value=!r.value,Y()}function ce(){r.value=!0,Y()}function ue(){r.value=!1,Y()}function Y(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:r.value}}).catch(S=>{console.error("Failed to save panel state:",S)})}function Me(S){const k=Math.max(Lh,Math.min(Xh,S));e.value=k,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:k}}).catch(T=>{console.error("Failed to save panel width:",T)})}function Le(S){n.value=S}function Ve(S,k){const T=k??o.value;if(!T)return;const W=s.value.find(le=>le.id===T);W&&(W.providerSessionId=S)}function Mt(S,k){const T=s.value.find(W=>W.id===S);T&&(T.worktreeBranch=k,T.lastCommitTime=new Date().toISOString())}async function Zt(S){const k=s.value.find(W=>W.id===S);if(!k?.worktreeBranch)return null;const T=k.worktreeBranch.trim();if(!T)return null;try{const le=(await $fetch("/api/specs/features")).features.find(be=>be.id===T);return le?(k.featureId!==le.id&&(k.featureId=le.id,k.updatedAt=new Date().toISOString(),Et()),le.id):null}catch(W){return console.warn("[chat] Failed to map branch to feature",{conversationId:S,branchName:T,error:W instanceof Error?W.message:String(W)}),null}}function bn(S,k,T){const W=s.value.find(le=>le.id===S);W&&(W.providerId=k,W.providerModelKey=T)}function Kt(S){const k=S??o.value;if(!k)return;const T=s.value.find(W=>W.id===k);T&&(T.providerSessionId="")}function Er(S){return s.value.find(T=>T.id===S)?.providerSessionId??""}function $r(S){l.value.add(S)}function zn(S){l.value.delete(S)}function Cr(S,k){const T=k??o.value;if(!T)return;const W=s.value.find(le=>le.id===T);W&&W.messages.push(S)}function xn(S,k,T){const W={id:Ih(),role:"user",content:S,attachments:T&&T.length>0?T:void 0,timestamp:new Date().toISOString()};return Cr(W,k),W}function Nn(S){const k={id:Ih(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return Cr(k,S),k}function yn(S,k,T){const W=T??o.value;if(!W)return;const le=s.value.find(de=>de.id===W);if(!le)return;const be=le.messages.findIndex(de=>de.id===S);be!==-1&&(le.messages[be]={...le.messages[be],...k})}function xt(S,k){const T=s.value.find(le=>le.id===k);if(!T)return;const W=T.messages.findIndex(le=>le.id===S);W!==-1&&(T.messages[W]={...T.messages[W],content:"",status:"streaming",contentBlocks:[]})}function Qr(S,k,T){const W=T??o.value;if(!W)return;const le=s.value.find(de=>de.id===W);if(!le)return;const be=le.messages.findIndex(de=>de.id===S);be!==-1&&(le.messages[be].content+=k)}function H(S,k,T){const W=T??o.value;if(!W)return;const le=s.value.find(de=>de.id===W);if(!le)return;const be=le.messages.findIndex(de=>de.id===S);if(be!==-1){const de=le.messages[be],Se=de.tools?[...de.tools,k]:[k];le.messages[be]={...de,tools:Se}}}function fe(S,k,T,W){const le=W??o.value;if(!le)return;const be=s.value.find(Se=>Se.id===le);if(!be)return;const de=be.messages.findIndex(Se=>Se.id===S);if(de!==-1){const Se=be.messages[de];if(Se.tools){const qe=Se.tools.findIndex(ot=>ot.id===k);if(qe!==-1){const ot=[...Se.tools];ot[qe]={...ot[qe],...T},be.messages[de]={...Se,tools:ot}}}}Jt(le,!1)}function se(S){S.contentBlocks&&(S.content=My(S.contentBlocks))}function ve(S,k){if(S.type!==k.type)return!0;switch(k.type){case"text":return S.text!==k.text;case"tool_use":{const T=S;return T.name!==k.name||T.inputSummary!==k.inputSummary}case"tool_result":{const T=S;return T.content!==k.content||T.isError!==k.isError}default:return!1}}function _e(S,k){const T=k??o.value;if(!T)return;const W=s.value.find(be=>be.id===T);if(!W)return;const le=W.messages.find(be=>be.id===S);le&&!le.contentBlocks&&(le.contentBlocks=[])}function We(S,k,T){const W=T??o.value;if(!W)return;const le=s.value.find(de=>de.id===W);if(!le)return;const be=le.messages.find(de=>de.id===S);be&&(be.contentBlocks||(be.contentBlocks=[]),be.contentBlocks.push(k),se(be))}function Ge(S,k,T,W){const le=W??o.value;if(!le)return;const be=s.value.find(yt=>yt.id===le);if(!be)return;const de=be.messages.find(yt=>yt.id===S);if(!de?.contentBlocks)return;const Se=de.contentBlocks.findIndex(yt=>yt.id===k);if(Se===-1)return;const ot={...de.contentBlocks[Se]};T(ot),de.contentBlocks[Se]=ot}function it(S,k,T,W,le){const be=W??o.value;if(!be)return;const de=s.value.find(sn=>sn.id===be);if(!de)return;const Se=de.messages.find(sn=>sn.id===S);if(!Se?.contentBlocks)return;const qe=Se.contentBlocks.findIndex(sn=>sn.id===k);if(qe===-1)return;const ot=Se.contentBlocks[qe],yt={...ot};T(yt),Se.contentBlocks[qe]=yt,le?.syncContent!==!1&&ve(ot,yt)&&se(Se),Jt(be,!1)}function ri(S,k,T){const W=T??o.value;if(!W)return;const le=s.value.find(de=>de.id===W);if(!le)return;const be=le.messages.find(de=>de.id===S);be&&(be.contentBlocks||(be.contentBlocks=[]),be.contentBlocks.push(k),se(be),Jt(W,!1))}function ni(S,k,T){const W=T??o.value;if(!W)return null;const le=s.value.find(de=>de.id===W);if(!le)return null;const be=le.messages.find(de=>de.id===S);return be?.contentBlocks?be.contentBlocks.find(de=>de.type==="tool_use"&&de.toolUseId===k)??null:null}function Dr(S,k,T,W,le){const be=s.value.find(Se=>Se.id===le);if(!be)return;const de=be.messages.findIndex(Se=>Se.id===S);de!==-1&&(be.messages[de]={...be.messages[de],content:T,contentBlocks:k,status:W},Jt(le,!0))}function si(S,k){const T=k??o.value;if(!T)return;const W=c.get(T);W?.session&&(W.session.status=S,h.value++)}function ii(S,k){const T=k??o.value;if(!T)return;const W=b(T);W.session={sessionId:S,cwd:n.value,status:"streaming",startedAt:new Date().toISOString()},W.lastError=null,h.value++}function oi(S){const k=S??o.value;if(!k)return;const T=c.get(k);T?.session&&(T.session.status="idle",h.value++)}function ai(S,k){const T=k??o.value;if(!T)return;const W=b(T);W.session&&(W.session.status="error",W.session.error=S),W.lastError=S,h.value++}function li(S,k){if(!u.value)return;const T=k??o.value;if(!T)return;const W=b(T),le=(()=>{if(typeof S.payload=="string")return S.payload;try{return JSON.stringify(S.payload,null,2)}catch{return String(S.payload)}})(),be=8e3,de=300,Se=le.length>be?`${le.slice(0,be)}
9
- ... (truncated)`:le;W.debugEvents.push({id:`dbg-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,timestamp:new Date().toISOString(),direction:S.direction,channel:S.channel,eventType:S.eventType||"unknown",payload:Se}),W.debugEvents.length>de&&W.debugEvents.splice(0,W.debugEvents.length-de),h.value++}function ci(S){u.value=S}function ui(S){const k=S??o.value;if(!k)return;const T=c.get(k);T&&(T.debugEvents=[],h.value++)}function hi(){if(!o.value)return;const S=s.value.find(T=>T.id===o.value);S&&(S.messages=[]);const k=o.value;c.delete(k),h.value++}function di(S){const k=S??o.value;if(!k)return;const T=c.get(k);T&&(T.lastError=null,T.session&&(T.session.error=void 0),h.value++)}async function fi(){const S=await jh();if(s.value=S.conversations,i.value=S.archivedConversations,S.discardedArchives>0&&console.warn(`[chat] Skipped ${S.discardedArchives} corrupted archived conversation(s)`),nn(),Wn(),!g.value){const k=s.value.find(T=>!!T.previewBranch&&!T.finalized);k&&(g.value=k.id)}if(o.value){const k=s.value.find(T=>T.id===o.value);k&&k.cwd?n.value=k.cwd:k||(o.value=null,r.value=!1)}}async function pi(){const S=await jh(),k=new Map(s.value.map(de=>[de.id,de])),T=new Set(S.conversations.map(de=>de.id));let W=0,le=0,be=0;for(const de of S.conversations){const Se=k.get(de.id);if(!Se)s.value.push(de),k.set(de.id,de),W++,console.log(`[chat] refresh: added new conversation ${de.id} (source=${de.source}, msgs=${de.messages.length})`);else if(de.source!=="user"&&(de.messages.length>Se.messages.length||de.updatedAt>(Se.updatedAt||""))){const qe=s.value.findIndex(ot=>ot.id===de.id);qe!==-1&&(s.value.splice(qe,1,de),console.log(`[chat] refresh: updated conversation ${de.id} (msgs: ${Se.messages.length} → ${de.messages.length}, updatedAt: ${Se.updatedAt} → ${de.updatedAt})`)),le++}else Se&&de.messages.length!==Se.messages.length&&console.log(`[chat] refresh: skipped update for ${de.id} (source=${de.source}, server msgs=${de.messages.length}, local msgs=${Se.messages.length})`)}for(let de=s.value.length-1;de>=0;de--){const Se=s.value[de];!T.has(Se.id)&&!l.value.has(Se.id)&&(console.log(`[chat] refresh: removed conversation ${Se.id} (no longer on server)`),o.value===Se.id&&(o.value=null),s.value.splice(de,1),be++)}return S.archivedConversations&&(i.value=S.archivedConversations),(W>0||le>0||be>0)&&nn(),console.log(`[chat] refreshServerConversations: loaded=${S.conversations.length}, added=${W}, updated=${le}, removed=${be}`),W+le+be}function Et(){Ty(s.value,i.value)}function Jt(S,k=!1){const T=s.value.find(W=>W.id===S);if(T)if(k){const W=p.get(S);W&&(clearTimeout(W),p.delete(S)),T.updatedAt=new Date().toISOString(),qh(T)}else{if(p.get(S))return;const le=setTimeout(()=>{T.updatedAt=new Date().toISOString(),qh(T),p.delete(S)},f);p.set(S,le)}}function rn(S=!1){o.value&&Jt(o.value,S)}function nn(){const S=k=>{const T=new Date(k.updatedAt).getTime();return Number.isFinite(T)&&T>0?T:new Date(k.createdAt).getTime()};s.value.sort((k,T)=>S(T)-S(k))}function Wn(){i.value.sort((S,k)=>new Date(k.archivedAt).getTime()-new Date(S.archivedAt).getTime())}async function kn(S){if(qn().atLimit)return"";const T=B1();let W=null;if(S?.featureId){const Se=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:T,featureId:S.featureId,baseBranch:S.baseBranch}});if(!Se.success&&Se.error)throw new Error(Se.error);W=Se}let le=null;if(typeof window<"u")try{const{useSettingsStore:Se}=await as(async()=>{const{useSettingsStore:ot}=await import("./Bze5ywup.js").then(yt=>yt.s);return{useSettingsStore:ot}},__vite__mapDeps([0,1,2]),import.meta.url),qe=Se();await qe.hydrate(),le=qe.providerSelection}catch(Se){console.warn("[chat] Failed to load provider selection for new conversation",Se)}const be=le||{providerId:Lp,modelKey:Dp},de={id:T,title:"New Conversation",messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:n.value||process.cwd?.()||"",featureId:S?.featureId,providerId:be.providerId,providerModelKey:be.modelKey};if(W?.success&&W.worktreePath&&W.branch&&(de.worktreePath=W.worktreePath,de.worktreeBranch=W.branch,de.cwd=W.worktreePath,de.hasWorktree=!0,W.baseBranch&&(de.baseBranch=W.baseBranch)),s.value.unshift(de),o.value=T,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:T}}).catch(Se=>{console.error("Failed to save active conversation:",Se)}),!S?.featureId)try{const Se=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:T,baseBranch:S?.baseBranch}});if(Se.success&&Se.worktreePath&&Se.branch){const qe=s.value.find(ot=>ot.id===T);qe&&(qe.worktreePath=Se.worktreePath,qe.worktreeBranch=Se.branch,qe.cwd=Se.worktreePath,qe.hasWorktree=!0,Se.baseBranch&&(qe.baseBranch=Se.baseBranch))}}catch(Se){console.warn("[chat] Failed to create worktree for conversation",T,Se)}return Jt(T,!0),T}function Lr(S){const k=s.value.find(T=>T.id===S);k&&(o.value=S,r.value=!0,k.cwd&&(n.value=k.cwd),!k.featureId&&k.worktreeBranch&&Zt(S),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:S,isPanelOpen:!0}}).catch(T=>{console.error("Failed to save active conversation:",T)}))}async function mi(S){const k=s.value.findIndex(le=>le.id===S);if(k===-1)return;const T=s.value[k];if(g.value===S&&(g.value=null),T.hasWorktree&&T.worktreePath&&T.worktreeBranch)try{await $fetch("/api/chat/worktree",{method:"DELETE",body:{worktreePath:T.worktreePath,branch:T.worktreeBranch}})}catch(le){console.warn("[chat] Failed to clean up worktree for conversation",S,le)}s.value.splice(k,1),c.delete(S);const W=p.get(S);W&&(clearTimeout(W),p.delete(S)),o.value===S&&(o.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(le=>{console.error("Failed to clear active conversation:",le)})),Et()}async function gs(S,k,T){const W=s.value.find(be=>be.id===S);if(!W)return{success:!1,error:"Conversation not found"};if(!W.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const le=T||W.baseBranch;try{const be=await $fetch("/api/chat/finalize",{method:"POST",body:{conversationId:S,commitMessage:k,baseBranch:le,worktreePath:W.worktreePath,worktreeBranch:W.worktreeBranch,previewBranch:W.previewBranch}});return be.success?(g.value===S&&(g.value=null),W.worktreePath=void 0,W.worktreeBranch=void 0,W.hasWorktree=!1,W.baseBranch=void 0,W.previewBranch=void 0,W.finalized=!0,W.updatedAt=new Date().toISOString(),Et()):be.rebaseInProgress&&await ur(S,W.worktreePath,le||"main",k),be}catch(be){return{success:!1,error:be instanceof Error?be.message:String(be)}}}async function Os(S,k){const T=s.value.find(le=>le.id===S);if(!T)return{success:!1,error:"Conversation not found"};if(!T.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const W=k||T.baseBranch;try{const le=await $fetch("/api/chat/rebase",{method:"POST",body:{conversationId:S,baseBranch:W,worktreePath:T.worktreePath}});return le.rebaseInProgress?await ur(S,T.worktreePath,W||"main","","sync"):le.success&&(await M(T),T.baseBranch=W,Et()),le}catch(le){return{success:!1,error:le instanceof Error?le.message:String(le)}}}async function ur(S,k,T,W,le="finalize"){O.value={conversationId:S,worktreePath:k,baseBranch:T,commitMessage:W,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:le};try{const be=await $fetch("/api/rebase/conflicts",{params:{worktreePath:k}});O.value&&(O.value.files=be.files,O.value.loading=!1)}catch(be){O.value&&(O.value.error=be instanceof Error?be.message:String(be),O.value.loading=!1)}}async function hr(S,k){if(!O.value)return!1;try{const T=await $fetch("/api/rebase/resolve",{method:"PUT",body:{worktreePath:O.value.worktreePath,filePath:S,content:k}});return T.success&&O.value&&O.value.resolvedFiles.add(S),T.success}catch{return!1}}async function vs(){if(!O.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:S,commitMessage:k,baseBranch:T,mode:W,worktreePath:le}=O.value,be=W==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue";try{const de=s.value.find(qe=>qe.id===S),Se=await $fetch(be,{method:"POST",body:{conversationId:S,commitMessage:k,baseBranch:T,worktreePath:le,worktreeBranch:de?.worktreeBranch,previewBranch:de?.previewBranch}});if(Se.success){if(W==="finalize"){g.value===S&&(g.value=null);const qe=s.value.find(ot=>ot.id===S);qe&&(qe.worktreePath=void 0,qe.worktreeBranch=void 0,qe.hasWorktree=!1,qe.baseBranch=void 0,qe.previewBranch=void 0,qe.finalized=!0,qe.updatedAt=new Date().toISOString(),Et())}else if(W==="sync"){const qe=s.value.find(ot=>ot.id===S);qe&&(await M(qe),qe.baseBranch=T,qe.updatedAt=new Date().toISOString(),Et())}O.value=null}else Se.rebaseInProgress&&await ur(S,le,T,k,W);return Se}catch(de){return{success:!1,error:de instanceof Error?de.message:String(de)}}}async function gi(){if(!O.value)return!1;try{const S=await $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:O.value.worktreePath}});return O.value=null,S.success}catch{return O.value=null,!1}}async function wn(S){if(!O.value)return!1;const k=O.value.files.find(T=>T.path===S);if(!k)return!1;try{const T=await $fetch("/api/rebase/ai-resolve",{method:"POST",body:{worktreePath:O.value.worktreePath,filePath:S,conflictContent:k.content}});return T.success&&T.resolvedContent!==void 0?(k.content=T.resolvedContent,await hr(S,T.resolvedContent)):!1}catch{return!1}}async function Oi(){if(!O.value)return;const S=O.value.files.filter(k=>!O.value.resolvedFiles.has(k.path));for(const k of S)await wn(k.path)}async function jn(S){const k=s.value.find(T=>T.id===S);if(!k)return{success:!1,error:"Conversation not found"};if(!k.hasWorktree||!k.worktreePath||!k.baseBranch)return{success:!1,error:"No worktree to preview"};try{const T=await $fetch("/api/chat/preview",{method:"POST",body:{conversationId:S,worktreePath:k.worktreePath,baseBranch:k.baseBranch}});return T.success&&T.previewBranch&&(k.previewBranch=T.previewBranch,g.value=S,k.updatedAt=new Date().toISOString(),Et()),{success:T.success,error:T.error}}catch(T){return{success:!1,error:T instanceof Error?T.message:String(T)}}}async function dr(S){const k=s.value.find(T=>T.id===S);if(!k)return{success:!1,error:"Conversation not found"};if(!k.previewBranch||!k.baseBranch)return g.value=null,{success:!1,error:"No active preview"};try{const T=await $fetch("/api/chat/preview",{method:"DELETE",body:{previewBranch:k.previewBranch,baseBranch:k.baseBranch}});return T.success&&(k.previewBranch=void 0,g.value=null,k.updatedAt=new Date().toISOString(),Et()),{success:T.success,error:T.error}}catch(T){return{success:!1,error:T instanceof Error?T.message:String(T)}}}async function Pr(S){if(g.value===S)return await dr(S);if(g.value){const k=await dr(g.value);if(!k.success)return{success:!1,error:`Failed to end previous preview: ${k.error}`}}return await jn(S)}function vi(S){const k=S.trim();if(!k)return null;const T=s.value.filter(W=>W.featureId===k?!0:W.worktreeBranch?.trim()===k);return T.length===0?null:T.sort((W,le)=>new Date(le.updatedAt).getTime()-new Date(W.updatedAt).getTime())[0]||null}function bi(S,k){const T=s.value.find(W=>W.id===S);T&&(T.title=k.trim(),T.updatedAt=new Date().toISOString(),nn(),Et())}function xi(S){const k=o.value;if(!k)return;const T=s.value.find(le=>le.id===k);if(!T||T.title!=="New Conversation")return;const W=T.messages.find(le=>le.role==="user");W&&(W.content.trim().length>0?T.title=Z1(W.content):W.attachments&&W.attachments.length>0&&(T.title=W.attachments.length===1?"[Image] New Conversation":`[${W.attachments.length} Images] New Conversation`))}function qn(){const S=s.value.length;return{atLimit:S>=Dh,nearLimit:S>=Eh,count:S}}async function Yn(S,k){o.value||await kn();const T=xn(S,void 0,k);return xi(),rn(!0),T}function yi(S,k,T){const W=T??o.value;Qr(S,k,W??void 0),W&&Jt(W,!1)}function Fn(S,k){const T=k??o.value;yn(S,{status:"complete"},T??void 0),T&&Jt(T,!0)}return{messages:P,session:A,isPanelOpen:r,panelWidth:Te(e),permissionMode:Te(t),pendingPermission:E,pendingPlanApproval:F,cwd:Te(n),lastError:I,debugEvents:oe,debugStreamEnabled:Te(u),providerSessionId:ne,conversations:Te(s),archivedConversations:Te(i),activeConversationId:Te(o),conversationViewMode:Te(a),conflictState:Te(O),previewingConversationId:Te(g),isStreaming:ie,hasMessages:L,lastMessage:D,isActiveConversationStreaming:z,hasConversations:q,hasArchivedConversations:V,activeConversation:C,conversationCount:X,isNearStorageLimit:N,sortedConversations:me,sortedArchivedConversations:K,previewingConversation:he,streamingConversations:Te(l),initialize:xe,togglePanel:Ce,openPanel:ce,closePanel:ue,setPanelWidth:Me,setPermissionMode:De,setPendingPermission:Ae,clearPendingPermission:Ue,setPendingPlanApproval:Ye,clearPendingPlanApproval:pe,setCwd:Le,setProviderSessionId:Ve,clearProviderSession:Kt,getProviderSessionId:Er,updateWorktreeBranch:Mt,setConversationProviderSelection:bn,startConversationStreaming:$r,endConversationStreaming:zn,isConversationStreaming:Z,addMessage:Cr,addUserMessage:xn,addAssistantMessage:Nn,updateMessage:yn,resetMessageForReplay:xt,appendToMessage:Qr,addToolToMessage:H,updateToolInMessage:fe,initContentBlocks:_e,appendContentBlock:We,appendContentBlockWithSave:ri,updateBlockById:Ge,updateBlockWithSave:it,findToolUseBlock:ni,batchSetMessageBlocks:Dr,syncContentFromBlocks:se,setSessionStatus:si,startSession:ii,endSession:oi,setSessionError:ai,setDebugStreamEnabled:ci,pushDebugEvent:li,clearDebugEvents:ui,clearMessages:hi,clearError:di,loadConversations:fi,refreshServerConversations:pi,saveAllConversations:Et,saveCurrentConversation:rn,saveConversation:Jt,createConversation:kn,selectConversation:Lr,deleteConversation:mi,archiveConversation:R,restoreArchivedConversation:G,deleteArchivedConversation:ae,setConversationViewMode:w,findConversationByFeature:vi,syncConversationFeatureFromBranch:Zt,renameConversation:bi,checkStorageLimits:qn,finalizeConversation:gs,rebaseConversation:Os,resolveConflictFile:hr,continueRebase:vs,abortRebase:gi,aiResolveConflictFile:wn,aiResolveAllConflicts:Oi,previewConversation:jn,unpreviewConversation:dr,togglePreview:Pr,isConversationPreviewing:$,addUserMessageWithConversation:Yn,appendToMessageWithSave:yi,completeMessageWithSave:Fn}});function Ay(r={}){const e=ll(),t=300,n=5e3,s=250;let i=null,o=null,a=null,l=null,c=null,u=!1,h=!1;const p=_(!1),f=_(!1);let g=r;function O(D){g=D}async function y(){const D=g.getScrollPosition?.()??0,Z=await e.checkAndRefresh();return Z&&g.setScrollPosition&&(await br(),g.setScrollPosition(D)),Z}function b(){return p.value||!!e.activeContextMenu||!!e.activeDialog}async function C(){if(b()){f.value=!0;return}A()}async function P(){if(u){h=!0;return}u=!0;try{await y()}finally{u=!1,h&&(h=!1,A())}}function A(){o&&clearTimeout(o),o=setTimeout(()=>{o=null,P()},s)}function E(D){if(typeof window>"u")return;if(a&&a.readyState===WebSocket.OPEN){a.send(JSON.stringify({type:"watch",workingDirectory:D}));return}l&&(clearTimeout(l),l=null);const z=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;a=new WebSocket(z),a.onopen=()=>{a.send(JSON.stringify({type:"watch",workingDirectory:D}))},a.onmessage=q=>{try{JSON.parse(q.data).type==="git_changed"&&C()}catch{}},a.onclose=()=>{a=null,e.isPollingActive&&c&&(l=setTimeout(()=>{c&&E(c)},n))},a.onerror=()=>{}}function F(){l&&(clearTimeout(l),l=null),a&&(a.close(),a=null)}function I(D){D&&(c=D),!e.isPollingActive&&(e.startPolling(),c&&E(c))}function oe(){F(),e.stopPolling()}function ie(){p.value=!0,i&&(clearTimeout(i),i=null)}function ne(){i&&clearTimeout(i),i=setTimeout(async()=>{p.value=!1,f.value&&(f.value=!1,A())},t)}function L(){oe(),i&&(clearTimeout(i),i=null),o&&(clearTimeout(o),o=null),u=!1,h=!1,c=null}return ze(()=>[e.activeContextMenu,e.activeDialog],()=>{!e.activeContextMenu&&!e.activeDialog&&f.value&&!p.value&&(f.value=!1,A())}),{isUserInteracting:Te(p),isDeferredRefresh:Te(f),startPolling:I,stopPolling:oe,startInteraction:ie,endInteraction:ne,cleanup:L,setScrollCallbacks:O}}function _y(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 Ry(r){const e=_({visible:!1,branchName:"",loading:!1,error:null});async function t(){e.value.loading=!0,e.value.error=null;const K=await r.checkoutBranch(e.value.branchName);e.value.loading=!1,K.success?e.value.visible=!1:e.value.error=K.error||"Unknown error"}const n=_({visible:!1,fromCommit:"",loading:!1,error:null});async function s(K){n.value.loading=!0,n.value.error=null;const he=await r.createBranch(K.name,n.value.fromCommit);n.value.loading=!1,he.success?(K.checkout&&await r.checkoutBranch(K.name),n.value.visible=!1):n.value.error=he.error||"Unknown error"}const i=_({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function o(K){i.value.loading=!0,i.value.error=null;const{branchName:he,isLocal:$}=i.value,w=K?.force??i.value.force,M=$?await r.deleteLocalBranch(he,w):await r.deleteRemoteBranch(he);i.value.loading=!1,M.success?i.value.visible=!1:i.value.error=M.error||"Unknown error"}const a=_({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 K=await r.renameBranch(a.value.branchName,a.value.newName.trim());a.value.loading=!1,K.success?a.value.visible=!1:a.value.error=K.error||"Unknown error"}const c=_({visible:!1,branchName:"",loading:!1,error:null});async function u(K){c.value.loading=!0,c.value.error=null;const he=await r.mergeBranch(c.value.branchName,K);c.value.loading=!1,he.success?c.value.visible=!1:c.value.error=he.error||"Unknown error"}const h=_({visible:!1,branchName:"",loading:!1,error:null});async function p(){h.value.loading=!0,h.value.error=null;const K=await r.rebaseBranch(h.value.branchName);h.value.loading=!1,K.success?h.value.visible=!1:h.value.error=K.error||"Unknown error"}const f=_({visible:!1,branchName:"",loading:!1,error:null});async function g(K){f.value.loading=!0,f.value.error=null;const he=await r.pushBranch(f.value.branchName,K.remote,K.force,K.forceWithLease);f.value.loading=!1,he.success?f.value.visible=!1:f.value.error=he.error||"Unknown error"}const O=_({visible:!1,branchName:"",loading:!1,error:null});async function y(K){O.value.loading=!0,O.value.error=null;const he=await r.pullBranch(O.value.branchName,K.remote,K.noFastForward,K.squash);O.value.loading=!1,he.success?O.value.visible=!1:O.value.error=he.error||"Unknown error"}const b=_({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function C(K){b.value.loading=!0,b.value.error=null;const he=await r.cherryPickCommit(b.value.commitHash,K.recordOrigin,K.noCommit);b.value.loading=!1,he.success?b.value.visible=!1:b.value.error=he.error||"Unknown error"}const P=_({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function A(K){P.value.loading=!0,P.value.error=null;const he=await r.resetToCommit(P.value.commitHash,K.mode);P.value.loading=!1,he.success?P.value.visible=!1:P.value.error=he.error||"Unknown error"}const E=_({visible:!1,commitHash:"",loading:!1,error:null});async function F(K){E.value.loading=!0,E.value.error=null;const he=await r.createTag(K.name,E.value.commitHash,K.annotated,K.message,K.pushToRemote);E.value.loading=!1,he.success?E.value.visible=!1:E.value.error=he.error||"Unknown error"}const I=_({visible:!1,tagName:"",loading:!1,error:null});async function oe(K){I.value.loading=!0,I.value.error=null;const he=await r.deleteTag(I.value.tagName,K.deleteFromRemote?K.remote||"origin":void 0);I.value.loading=!1,he.success?I.value.visible=!1:I.value.error=he.error||"Unknown error"}const ie=_({visible:!1,tagName:"",loading:!1,tagDetail:null}),ne=_({visible:!1,loading:!1,error:null});async function L(K){ne.value.loading=!0,ne.value.error=null;const he=await r.stashChanges(K.message,K.includeUntracked);ne.value.loading=!1,he.success?ne.value.visible=!1:ne.value.error=he.error||"Unknown error"}const D=_({visible:!1,stashIndex:0,loading:!1,error:null}),Z=_("");async function z(K){D.value.loading=!0,D.value.error=null;const he=await r.stashBranch(D.value.stashIndex,K);D.value.loading=!1,he.success?D.value.visible=!1:D.value.error=he.error||"Unknown error"}const q=_({visible:!1,loading:!1,error:null});async function V(K){q.value.loading=!0,q.value.error=null;const he=await r.resetWorking(K.mode);q.value.loading=!1,he.success?q.value.visible=!1:q.value.error=he.error||"Unknown error"}const X=_({visible:!1,loading:!1,error:null});async function N(){X.value.loading=!0,X.value.error=null;const K=await r.cleanUntracked();X.value.loading=!1,K.success?X.value.visible=!1:X.value.error=K.error||"Unknown error"}const me=J(()=>e.value.visible||n.value.visible||i.value.visible||a.value.visible||c.value.visible||h.value.visible||f.value.visible||O.value.visible||b.value.visible||P.value.visible||E.value.visible||I.value.visible||ie.value.visible||ne.value.visible||D.value.visible||q.value.visible||X.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:p,pushDialog:f,confirmPush:g,pullDialog:O,confirmPull:y,cherryPickDialog:b,confirmCherryPick:C,resetDialog:P,confirmReset:A,tagCreateDialog:E,confirmTagCreate:F,tagDeleteDialog:I,confirmTagDelete:oe,tagDetailDialog:ie,stashDialog:ne,confirmStash:L,stashBranchDialog:D,stashBranchInput:Z,confirmStashBranch:z,resetWorkingDialog:q,confirmResetWorking:V,cleanUntrackedDialog:X,confirmCleanUntracked:N,isAnyDialogOpen:me}}function By(r,e){const t=_({visible:!1,x:0,y:0});function n(Y,Me){t.value={visible:!0,x:Y,y:Me},setTimeout(()=>{t.value.visible=!1},1500)}const s=_({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function i(Y){s.value={visible:!0,...Y},r.setActiveContextMenu({type:"branch",props:Y,position:{x:Y.x,y:Y.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 Y=s.value.branch;o(),e.renameDialog.value={visible:!0,branchName:Y,newName:Y,loading:!1,error:null}}function c(){const{branch:Y,isLocal:Me}=s.value;o(),e.deleteBranchDialog.value={visible:!0,branchName:Y,isLocal:Me,force:!1,loading:!1,error:null}}function u(){const Y=s.value.branch;o(),e.mergeDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}function h(){const Y=s.value.branch;o(),e.rebaseDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}function p(){const Y=s.value.branch;o(),e.pushDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}function f(){const Y=s.value.branch;o(),e.pullDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}async function g(){const Y=s.value.branch;o(),await r.fetchBranch(Y)}async function O(){const Y=s.value.branch;o(),await r.copyToClipboard(Y),n(s.value.x,s.value.y)}function y(){o(),e.createBranchDialog.value={visible:!0,fromCommit:s.value.commitHash,loading:!1,error:null}}const b=_({visible:!1,commit:null,x:0,y:0});function C(Y){b.value={visible:!0,commit:Y.commit,x:Y.x,y:Y.y},r.setActiveContextMenu({type:"commit",props:Y,position:{x:Y.x,y:Y.y}})}function P(){b.value.visible=!1,r.clearActiveContextMenu()}function A(Y){const Me=b.value.commit;if(!Me)return!1;P();const Le=Y(Me);return Le&&typeof Le.then=="function"?Le.then(()=>!0):!0}function E(){A(Y=>{e.tagCreateDialog.value={visible:!0,commitHash:Y.hash,loading:!1,error:null}})}function F(){A(Y=>{e.createBranchDialog.value={visible:!0,fromCommit:Y.hash,loading:!1,error:null}})}function I(){A(Y=>{e.checkoutDialog.value={visible:!0,branchName:Y.hash,loading:!1,error:null}})}function oe(){A(Y=>{e.cherryPickDialog.value={visible:!0,commitHash:Y.hash,commitMessage:Y.message,loading:!1,error:null}})}async function ie(){await A(Y=>r.revertCommit(Y.hash))}function ne(){A(Y=>{e.mergeDialog.value={visible:!0,branchName:Y.shortHash,loading:!1,error:null}})}function L(){A(Y=>{e.resetDialog.value={visible:!0,commitHash:Y.hash,commitMessage:Y.message,loading:!1,error:null}})}async function D(){const{x:Y,y:Me}=b.value;await A(Ve=>r.copyToClipboard(Ve.hash))&&n(Y,Me)}async function Z(){await A(Y=>r.copyCommitSubject(Y))}const z=_({visible:!1,tag:"",x:0,y:0,commitHash:""});function q(Y){z.value={visible:!0,...Y},r.setActiveContextMenu({type:"tag",props:Y,position:{x:Y.x,y:Y.y}})}function V(){z.value.visible=!1,r.clearActiveContextMenu()}async function X(){const Y=z.value.tag;V(),e.tagDetailDialog.value={visible:!0,tagName:Y,loading:!0,tagDetail:null};const Me=await r.getTagDetail(Y);e.tagDetailDialog.value.loading=!1,Me.success&&Me.data&&(e.tagDetailDialog.value.tagDetail=Me.data)}function N(){const Y=z.value.tag;V(),e.tagDeleteDialog.value={visible:!0,tagName:Y,loading:!1,error:null}}async function me(){const Y=z.value.tag;V(),await r.pushTag(Y)}async function K(){const Y=z.value.tag;V(),await r.copyToClipboard(Y),n(z.value.x,z.value.y)}const he=_({visible:!1,x:0,y:0});function $(Y){he.value={visible:!0,...Y},r.setActiveContextMenu({type:"uncommitted",props:Y,position:{x:Y.x,y:Y.y}})}function w(){he.value.visible=!1,r.clearActiveContextMenu()}function M(){w(),e.stashDialog.value={visible:!0,loading:!1,error:null}}function R(){w(),e.resetWorkingDialog.value={visible:!0,loading:!1,error:null}}function G(){w(),e.cleanUntrackedDialog.value={visible:!0,loading:!1,error:null}}const ae=_({visible:!1,stash:null,x:0,y:0});function xe(Y){ae.value={visible:!0,stash:Y.stash,x:Y.x,y:Y.y},r.setActiveContextMenu({type:"stash",props:Y,position:{x:Y.x,y:Y.y}})}function De(){ae.value.visible=!1,r.clearActiveContextMenu()}function Ae(Y){const Me=ae.value.stash;if(!Me)return!1;De();const Le=Y(Me);return Le&&typeof Le.then=="function"?Le.then(()=>!0):!0}async function Ue(){await Ae(Y=>r.applyStash(Y.index))}async function Ye(){await Ae(Y=>r.popStash(Y.index))}async function pe(){await Ae(Y=>r.dropStash(Y.index))}function Ce(){Ae(Y=>{e.stashBranchDialog.value={visible:!0,stashIndex:Y.index,loading:!1,error:null}})}async function ce(){const{x:Y,y:Me}=ae.value;await Ae(Ve=>r.copyToClipboard(`stash@{${Ve.index}}`))&&n(Y,Me)}async function ue(){const{x:Y,y:Me}=ae.value;await Ae(Ve=>r.copyToClipboard(Ve.hash))&&n(Y,Me)}return{copyFeedback:t,showCopyFeedback:n,branchMenu:s,handleBranchContextMenu:i,closeBranchMenu:o,handleBranchCheckout:a,handleBranchRename:l,handleBranchDelete:c,handleBranchMerge:u,handleBranchRebase:h,handleBranchPush:p,handleBranchPull:f,handleBranchFetch:g,handleBranchCopyName:O,handleBranchCreateBranch:y,commitMenu:b,handleCommitContextMenu:C,closeCommitMenu:P,handleCommitAddTag:E,handleCommitCreateBranch:F,handleCommitCheckout:I,handleCommitCherryPick:oe,handleCommitRevert:ie,handleCommitMergeInto:ne,handleCommitReset:L,handleCommitCopyHash:D,handleCommitCopySubject:Z,tagMenu:z,handleTagContextMenu:q,closeTagMenu:V,handleTagViewDetails:X,handleTagDelete:N,handleTagPush:me,handleTagCopyName:K,uncommittedMenu:he,handleUncommittedContextMenu:$,closeUncommittedMenu:w,handleUncommittedStash:M,handleUncommittedReset:R,handleUncommittedClean:G,stashMenu:ae,handleStashContextMenu:xe,closeStashMenu:De,handleStashApply:Ue,handleStashPop:Ye,handleStashDrop:pe,handleStashCreateBranch:Ce,handleStashCopyName:ce,handleStashCopyHash:ue}}const Zy={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Ey={class:"text-sm font-mono text-retro-cyan"},Dy={class:"text-xs font-mono text-retro-text mt-1 truncate"},Ly={class:"space-y-3"},Xy={class:"flex items-start gap-2 cursor-pointer group"},Iy={class:"flex items-start gap-2 cursor-pointer group"},Vy=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=_(!1),s=_(!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(),Oe(Wt,{title:"Cherry-Pick Commit",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Cherry-Pick",onClose:o,onConfirm:i},{default:ct(()=>[d("div",Zy,[l[2]||(l[2]=d("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),d("div",Ey,B(r.commitHash.slice(0,7)),1),d("div",Dy,B(r.commitMessage.split(`
8
+ `):""}const kr=xu("chat",()=>{const r=_(!1),e=_(R1),t=_("ask"),n=_(""),s=_([]),i=_([]),o=_(null),a=_("active"),l=_(new Set),c=new Map,u=_(!1),h=_(0),p=new Map,f=1200,g=_(null),O=_(null);function y(S){return S?c.get(S)??null:null}function b(S){let k=c.get(S);return k||(k={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},c.set(S,k)),k}const C=J(()=>s.value.find(S=>S.id===o.value)||null),P=J(()=>C.value?.messages??[]),A=J(()=>(h.value,y(o.value)?.session??null)),E=J(()=>(h.value,y(o.value)?.pendingPermission??null)),F=J(()=>(h.value,y(o.value)?.pendingPlanApproval??null)),I=J(()=>(h.value,y(o.value)?.lastError??null)),oe=J(()=>(h.value,y(o.value)?.debugEvents??[])),ie=J(()=>A.value?.status==="streaming"),ne=J(()=>C.value?.providerSessionId??""),L=J(()=>P.value.length>0),D=J(()=>P.value[P.value.length-1]||null);function Z(S){return l.value.has(S)}const z=J(()=>o.value?l.value.has(o.value):!1),q=J(()=>s.value.length>0),V=J(()=>i.value.length>0),X=J(()=>s.value.length),N=J(()=>X.value>=Eh),me=J(()=>s.value),K=J(()=>i.value),he=J(()=>g.value&&s.value.find(S=>S.id===g.value)||null);function $(S){return g.value===S}function w(S){a.value=S}async function M(S){if(!(!S?.previewBranch||!S.worktreePath))try{const k=await $fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:S.previewBranch,worktreePath:S.worktreePath}});if(!k.success)throw new Error(k.error||"Unknown preview sync failure")}catch(k){console.warn("[chat] Failed to sync preview branch after worktree update",{conversationId:S.id,previewBranch:S.previewBranch,worktreePath:S.worktreePath,error:k instanceof Error?k.message:String(k)})}}async function R(S){if(Z(S))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(T=>T.id===S)===-1)return{success:!1,error:"Conversation not found"};try{const T=await $fetch(`/api/conversations/${S}/archive`,{method:"POST"});if(T.success&&T.archived){const W=p.get(S);return W&&(clearTimeout(W),p.delete(S)),c.delete(S),s.value=Array.isArray(T.conversations)?T.conversations:s.value.filter(le=>le.id!==S),i.value=Array.isArray(T.archivedConversations)?T.archivedConversations:[T.archived,...i.value],Wn(),g.value===S&&(g.value=null),o.value===S&&(o.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:o.value}}).catch(le=>{console.error("Failed to save active conversation:",le)}),{success:!0}}return{success:!1,error:"Failed to archive conversation"}}catch(T){return{success:!1,error:T instanceof Error?T.message:"Failed to archive conversation"}}}async function G(S,k){if(qn().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${Dh}.`};if(!i.value.some(W=>W.id===S))return{success:!1,error:"Archived conversation not found"};try{const W=await $fetch(`/api/conversations/archives/${S}/restore`,{method:"POST",body:{baseBranch:k}});return W.success&&W.conversation?(s.value=Array.isArray(W.conversations)?W.conversations:[W.conversation,...s.value],Array.isArray(W.archivedConversations)?i.value=W.archivedConversations:i.value=i.value.filter(le=>le.id!==S),a.value="active",Lr(W.conversation.id),nn(),Et(),{success:!0,conversationId:W.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(W){return{success:!1,error:W instanceof Error?W.message:"Failed to restore archived conversation"}}}async function ae(S){const k=i.value.findIndex(T=>T.id===S);if(k===-1)return{success:!1,error:"Archived conversation not found"};try{const T=await $fetch(`/api/conversations/archives/${S}`,{method:"DELETE"});return T.success?(Array.isArray(T.archivedConversations)?i.value=T.archivedConversations:i.value.splice(k,1),Wn(),{success:!0}):{success:!1,error:"Failed to delete archived conversation"}}catch{return i.value.splice(k,1),Et(),{success:!0}}}async function xe(){if(!(typeof window>"u"))try{const S=await $fetch("/api/settings");if(S){if(typeof S.panelWidth=="number"){const W=S.panelWidth;W>=Lh&&W<=Xh&&(e.value=W)}typeof S.isPanelOpen=="boolean"&&(r.value=S.isPanelOpen),typeof S.activeConversationId=="string"&&(o.value=S.activeConversationId);const{useSettingsStore:k}=await as(async()=>{const{useSettingsStore:W}=await import("./DXzkgxwX.js").then(le=>le.s);return{useSettingsStore:W}},__vite__mapDeps([0,1,2]),import.meta.url),T=k();await T.hydrate(),t.value=T.permissionMode}}catch(S){console.error("Failed to load chat settings:",S)}}function De(S){t.value=S,typeof window<"u"&&as(async()=>{const{useSettingsStore:k}=await import("./DXzkgxwX.js").then(T=>T.s);return{useSettingsStore:k}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:k})=>{k().setPermissionMode(S)})}function Ae(S,k){const T=k??o.value;if(!T)return;const W=b(T);W.pendingPermission=S,h.value++}function Ue(S){const k=S??o.value;if(!k)return;const T=c.get(k);T&&(T.pendingPermission=null,h.value++)}function Ye(S,k){const T=k??o.value;if(!T)return;const W=b(T);W.pendingPlanApproval=S,h.value++}function pe(S){const k=S??o.value;if(!k)return;const T=c.get(k);T&&(T.pendingPlanApproval=null,h.value++)}function Ce(){r.value=!r.value,Y()}function ce(){r.value=!0,Y()}function ue(){r.value=!1,Y()}function Y(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:r.value}}).catch(S=>{console.error("Failed to save panel state:",S)})}function Me(S){const k=Math.max(Lh,Math.min(Xh,S));e.value=k,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:k}}).catch(T=>{console.error("Failed to save panel width:",T)})}function Le(S){n.value=S}function Ve(S,k){const T=k??o.value;if(!T)return;const W=s.value.find(le=>le.id===T);W&&(W.providerSessionId=S)}function Mt(S,k){const T=s.value.find(W=>W.id===S);T&&(T.worktreeBranch=k,T.lastCommitTime=new Date().toISOString())}async function Zt(S){const k=s.value.find(W=>W.id===S);if(!k?.worktreeBranch)return null;const T=k.worktreeBranch.trim();if(!T)return null;try{const le=(await $fetch("/api/specs/features")).features.find(be=>be.id===T);return le?(k.featureId!==le.id&&(k.featureId=le.id,k.updatedAt=new Date().toISOString(),Et()),le.id):null}catch(W){return console.warn("[chat] Failed to map branch to feature",{conversationId:S,branchName:T,error:W instanceof Error?W.message:String(W)}),null}}function bn(S,k,T){const W=s.value.find(le=>le.id===S);W&&(W.providerId=k,W.providerModelKey=T)}function Kt(S){const k=S??o.value;if(!k)return;const T=s.value.find(W=>W.id===k);T&&(T.providerSessionId="")}function Er(S){return s.value.find(T=>T.id===S)?.providerSessionId??""}function $r(S){l.value.add(S)}function zn(S){l.value.delete(S)}function Cr(S,k){const T=k??o.value;if(!T)return;const W=s.value.find(le=>le.id===T);W&&W.messages.push(S)}function xn(S,k,T){const W={id:Ih(),role:"user",content:S,attachments:T&&T.length>0?T:void 0,timestamp:new Date().toISOString()};return Cr(W,k),W}function Nn(S){const k={id:Ih(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return Cr(k,S),k}function yn(S,k,T){const W=T??o.value;if(!W)return;const le=s.value.find(de=>de.id===W);if(!le)return;const be=le.messages.findIndex(de=>de.id===S);be!==-1&&(le.messages[be]={...le.messages[be],...k})}function xt(S,k){const T=s.value.find(le=>le.id===k);if(!T)return;const W=T.messages.findIndex(le=>le.id===S);W!==-1&&(T.messages[W]={...T.messages[W],content:"",status:"streaming",contentBlocks:[]})}function Qr(S,k,T){const W=T??o.value;if(!W)return;const le=s.value.find(de=>de.id===W);if(!le)return;const be=le.messages.findIndex(de=>de.id===S);be!==-1&&(le.messages[be].content+=k)}function H(S,k,T){const W=T??o.value;if(!W)return;const le=s.value.find(de=>de.id===W);if(!le)return;const be=le.messages.findIndex(de=>de.id===S);if(be!==-1){const de=le.messages[be],Se=de.tools?[...de.tools,k]:[k];le.messages[be]={...de,tools:Se}}}function fe(S,k,T,W){const le=W??o.value;if(!le)return;const be=s.value.find(Se=>Se.id===le);if(!be)return;const de=be.messages.findIndex(Se=>Se.id===S);if(de!==-1){const Se=be.messages[de];if(Se.tools){const qe=Se.tools.findIndex(ot=>ot.id===k);if(qe!==-1){const ot=[...Se.tools];ot[qe]={...ot[qe],...T},be.messages[de]={...Se,tools:ot}}}}Jt(le,!1)}function se(S){S.contentBlocks&&(S.content=My(S.contentBlocks))}function ve(S,k){if(S.type!==k.type)return!0;switch(k.type){case"text":return S.text!==k.text;case"tool_use":{const T=S;return T.name!==k.name||T.inputSummary!==k.inputSummary}case"tool_result":{const T=S;return T.content!==k.content||T.isError!==k.isError}default:return!1}}function _e(S,k){const T=k??o.value;if(!T)return;const W=s.value.find(be=>be.id===T);if(!W)return;const le=W.messages.find(be=>be.id===S);le&&!le.contentBlocks&&(le.contentBlocks=[])}function We(S,k,T){const W=T??o.value;if(!W)return;const le=s.value.find(de=>de.id===W);if(!le)return;const be=le.messages.find(de=>de.id===S);be&&(be.contentBlocks||(be.contentBlocks=[]),be.contentBlocks.push(k),se(be))}function Ge(S,k,T,W){const le=W??o.value;if(!le)return;const be=s.value.find(yt=>yt.id===le);if(!be)return;const de=be.messages.find(yt=>yt.id===S);if(!de?.contentBlocks)return;const Se=de.contentBlocks.findIndex(yt=>yt.id===k);if(Se===-1)return;const ot={...de.contentBlocks[Se]};T(ot),de.contentBlocks[Se]=ot}function it(S,k,T,W,le){const be=W??o.value;if(!be)return;const de=s.value.find(sn=>sn.id===be);if(!de)return;const Se=de.messages.find(sn=>sn.id===S);if(!Se?.contentBlocks)return;const qe=Se.contentBlocks.findIndex(sn=>sn.id===k);if(qe===-1)return;const ot=Se.contentBlocks[qe],yt={...ot};T(yt),Se.contentBlocks[qe]=yt,le?.syncContent!==!1&&ve(ot,yt)&&se(Se),Jt(be,!1)}function ri(S,k,T){const W=T??o.value;if(!W)return;const le=s.value.find(de=>de.id===W);if(!le)return;const be=le.messages.find(de=>de.id===S);be&&(be.contentBlocks||(be.contentBlocks=[]),be.contentBlocks.push(k),se(be),Jt(W,!1))}function ni(S,k,T){const W=T??o.value;if(!W)return null;const le=s.value.find(de=>de.id===W);if(!le)return null;const be=le.messages.find(de=>de.id===S);return be?.contentBlocks?be.contentBlocks.find(de=>de.type==="tool_use"&&de.toolUseId===k)??null:null}function Dr(S,k,T,W,le){const be=s.value.find(Se=>Se.id===le);if(!be)return;const de=be.messages.findIndex(Se=>Se.id===S);de!==-1&&(be.messages[de]={...be.messages[de],content:T,contentBlocks:k,status:W},Jt(le,!0))}function si(S,k){const T=k??o.value;if(!T)return;const W=c.get(T);W?.session&&(W.session.status=S,h.value++)}function ii(S,k){const T=k??o.value;if(!T)return;const W=b(T);W.session={sessionId:S,cwd:n.value,status:"streaming",startedAt:new Date().toISOString()},W.lastError=null,h.value++}function oi(S){const k=S??o.value;if(!k)return;const T=c.get(k);T?.session&&(T.session.status="idle",h.value++)}function ai(S,k){const T=k??o.value;if(!T)return;const W=b(T);W.session&&(W.session.status="error",W.session.error=S),W.lastError=S,h.value++}function li(S,k){if(!u.value)return;const T=k??o.value;if(!T)return;const W=b(T),le=(()=>{if(typeof S.payload=="string")return S.payload;try{return JSON.stringify(S.payload,null,2)}catch{return String(S.payload)}})(),be=8e3,de=300,Se=le.length>be?`${le.slice(0,be)}
9
+ ... (truncated)`:le;W.debugEvents.push({id:`dbg-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,timestamp:new Date().toISOString(),direction:S.direction,channel:S.channel,eventType:S.eventType||"unknown",payload:Se}),W.debugEvents.length>de&&W.debugEvents.splice(0,W.debugEvents.length-de),h.value++}function ci(S){u.value=S}function ui(S){const k=S??o.value;if(!k)return;const T=c.get(k);T&&(T.debugEvents=[],h.value++)}function hi(){if(!o.value)return;const S=s.value.find(T=>T.id===o.value);S&&(S.messages=[]);const k=o.value;c.delete(k),h.value++}function di(S){const k=S??o.value;if(!k)return;const T=c.get(k);T&&(T.lastError=null,T.session&&(T.session.error=void 0),h.value++)}async function fi(){const S=await jh();if(s.value=S.conversations,i.value=S.archivedConversations,S.discardedArchives>0&&console.warn(`[chat] Skipped ${S.discardedArchives} corrupted archived conversation(s)`),nn(),Wn(),!g.value){const k=s.value.find(T=>!!T.previewBranch&&!T.finalized);k&&(g.value=k.id)}if(o.value){const k=s.value.find(T=>T.id===o.value);k&&k.cwd?n.value=k.cwd:k||(o.value=null,r.value=!1)}}async function pi(){const S=await jh(),k=new Map(s.value.map(de=>[de.id,de])),T=new Set(S.conversations.map(de=>de.id));let W=0,le=0,be=0;for(const de of S.conversations){const Se=k.get(de.id);if(!Se)s.value.push(de),k.set(de.id,de),W++,console.log(`[chat] refresh: added new conversation ${de.id} (source=${de.source}, msgs=${de.messages.length})`);else if(de.source!=="user"&&(de.messages.length>Se.messages.length||de.updatedAt>(Se.updatedAt||""))){const qe=s.value.findIndex(ot=>ot.id===de.id);qe!==-1&&(s.value.splice(qe,1,de),console.log(`[chat] refresh: updated conversation ${de.id} (msgs: ${Se.messages.length} → ${de.messages.length}, updatedAt: ${Se.updatedAt} → ${de.updatedAt})`)),le++}else Se&&de.messages.length!==Se.messages.length&&console.log(`[chat] refresh: skipped update for ${de.id} (source=${de.source}, server msgs=${de.messages.length}, local msgs=${Se.messages.length})`)}for(let de=s.value.length-1;de>=0;de--){const Se=s.value[de];!T.has(Se.id)&&!l.value.has(Se.id)&&(console.log(`[chat] refresh: removed conversation ${Se.id} (no longer on server)`),o.value===Se.id&&(o.value=null),s.value.splice(de,1),be++)}return S.archivedConversations&&(i.value=S.archivedConversations),(W>0||le>0||be>0)&&nn(),console.log(`[chat] refreshServerConversations: loaded=${S.conversations.length}, added=${W}, updated=${le}, removed=${be}`),W+le+be}function Et(){Ty(s.value,i.value)}function Jt(S,k=!1){const T=s.value.find(W=>W.id===S);if(T)if(k){const W=p.get(S);W&&(clearTimeout(W),p.delete(S)),T.updatedAt=new Date().toISOString(),qh(T)}else{if(p.get(S))return;const le=setTimeout(()=>{T.updatedAt=new Date().toISOString(),qh(T),p.delete(S)},f);p.set(S,le)}}function rn(S=!1){o.value&&Jt(o.value,S)}function nn(){const S=k=>{const T=new Date(k.updatedAt).getTime();return Number.isFinite(T)&&T>0?T:new Date(k.createdAt).getTime()};s.value.sort((k,T)=>S(T)-S(k))}function Wn(){i.value.sort((S,k)=>new Date(k.archivedAt).getTime()-new Date(S.archivedAt).getTime())}async function kn(S){if(qn().atLimit)return"";const T=B1();let W=null;if(S?.featureId){const Se=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:T,featureId:S.featureId,baseBranch:S.baseBranch}});if(!Se.success&&Se.error)throw new Error(Se.error);W=Se}let le=null;if(typeof window<"u")try{const{useSettingsStore:Se}=await as(async()=>{const{useSettingsStore:ot}=await import("./DXzkgxwX.js").then(yt=>yt.s);return{useSettingsStore:ot}},__vite__mapDeps([0,1,2]),import.meta.url),qe=Se();await qe.hydrate(),le=qe.providerSelection}catch(Se){console.warn("[chat] Failed to load provider selection for new conversation",Se)}const be=le||{providerId:Lp,modelKey:Dp},de={id:T,title:"New Conversation",messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:n.value||process.cwd?.()||"",featureId:S?.featureId,providerId:be.providerId,providerModelKey:be.modelKey};if(W?.success&&W.worktreePath&&W.branch&&(de.worktreePath=W.worktreePath,de.worktreeBranch=W.branch,de.cwd=W.worktreePath,de.hasWorktree=!0,W.baseBranch&&(de.baseBranch=W.baseBranch)),s.value.unshift(de),o.value=T,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:T}}).catch(Se=>{console.error("Failed to save active conversation:",Se)}),!S?.featureId)try{const Se=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:T,baseBranch:S?.baseBranch}});if(Se.success&&Se.worktreePath&&Se.branch){const qe=s.value.find(ot=>ot.id===T);qe&&(qe.worktreePath=Se.worktreePath,qe.worktreeBranch=Se.branch,qe.cwd=Se.worktreePath,qe.hasWorktree=!0,Se.baseBranch&&(qe.baseBranch=Se.baseBranch))}}catch(Se){console.warn("[chat] Failed to create worktree for conversation",T,Se)}return Jt(T,!0),T}function Lr(S){const k=s.value.find(T=>T.id===S);k&&(o.value=S,r.value=!0,k.cwd&&(n.value=k.cwd),!k.featureId&&k.worktreeBranch&&Zt(S),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:S,isPanelOpen:!0}}).catch(T=>{console.error("Failed to save active conversation:",T)}))}async function mi(S){const k=s.value.findIndex(le=>le.id===S);if(k===-1)return;const T=s.value[k];if(g.value===S&&(g.value=null),T.hasWorktree&&T.worktreePath&&T.worktreeBranch)try{await $fetch("/api/chat/worktree",{method:"DELETE",body:{worktreePath:T.worktreePath,branch:T.worktreeBranch}})}catch(le){console.warn("[chat] Failed to clean up worktree for conversation",S,le)}s.value.splice(k,1),c.delete(S);const W=p.get(S);W&&(clearTimeout(W),p.delete(S)),o.value===S&&(o.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(le=>{console.error("Failed to clear active conversation:",le)})),Et()}async function gs(S,k,T){const W=s.value.find(be=>be.id===S);if(!W)return{success:!1,error:"Conversation not found"};if(!W.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const le=T||W.baseBranch;try{const be=await $fetch("/api/chat/finalize",{method:"POST",body:{conversationId:S,commitMessage:k,baseBranch:le,worktreePath:W.worktreePath,worktreeBranch:W.worktreeBranch,previewBranch:W.previewBranch}});return be.success?(g.value===S&&(g.value=null),W.worktreePath=void 0,W.worktreeBranch=void 0,W.hasWorktree=!1,W.baseBranch=void 0,W.previewBranch=void 0,W.finalized=!0,W.updatedAt=new Date().toISOString(),Et()):be.rebaseInProgress&&await ur(S,W.worktreePath,le||"main",k),be}catch(be){return{success:!1,error:be instanceof Error?be.message:String(be)}}}async function Os(S,k){const T=s.value.find(le=>le.id===S);if(!T)return{success:!1,error:"Conversation not found"};if(!T.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const W=k||T.baseBranch;try{const le=await $fetch("/api/chat/rebase",{method:"POST",body:{conversationId:S,baseBranch:W,worktreePath:T.worktreePath}});return le.rebaseInProgress?await ur(S,T.worktreePath,W||"main","","sync"):le.success&&(await M(T),T.baseBranch=W,Et()),le}catch(le){return{success:!1,error:le instanceof Error?le.message:String(le)}}}async function ur(S,k,T,W,le="finalize"){O.value={conversationId:S,worktreePath:k,baseBranch:T,commitMessage:W,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:le};try{const be=await $fetch("/api/rebase/conflicts",{params:{worktreePath:k}});O.value&&(O.value.files=be.files,O.value.loading=!1)}catch(be){O.value&&(O.value.error=be instanceof Error?be.message:String(be),O.value.loading=!1)}}async function hr(S,k){if(!O.value)return!1;try{const T=await $fetch("/api/rebase/resolve",{method:"PUT",body:{worktreePath:O.value.worktreePath,filePath:S,content:k}});return T.success&&O.value&&O.value.resolvedFiles.add(S),T.success}catch{return!1}}async function vs(){if(!O.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:S,commitMessage:k,baseBranch:T,mode:W,worktreePath:le}=O.value,be=W==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue";try{const de=s.value.find(qe=>qe.id===S),Se=await $fetch(be,{method:"POST",body:{conversationId:S,commitMessage:k,baseBranch:T,worktreePath:le,worktreeBranch:de?.worktreeBranch,previewBranch:de?.previewBranch}});if(Se.success){if(W==="finalize"){g.value===S&&(g.value=null);const qe=s.value.find(ot=>ot.id===S);qe&&(qe.worktreePath=void 0,qe.worktreeBranch=void 0,qe.hasWorktree=!1,qe.baseBranch=void 0,qe.previewBranch=void 0,qe.finalized=!0,qe.updatedAt=new Date().toISOString(),Et())}else if(W==="sync"){const qe=s.value.find(ot=>ot.id===S);qe&&(await M(qe),qe.baseBranch=T,qe.updatedAt=new Date().toISOString(),Et())}O.value=null}else Se.rebaseInProgress&&await ur(S,le,T,k,W);return Se}catch(de){return{success:!1,error:de instanceof Error?de.message:String(de)}}}async function gi(){if(!O.value)return!1;try{const S=await $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:O.value.worktreePath}});return O.value=null,S.success}catch{return O.value=null,!1}}async function wn(S){if(!O.value)return!1;const k=O.value.files.find(T=>T.path===S);if(!k)return!1;try{const T=await $fetch("/api/rebase/ai-resolve",{method:"POST",body:{worktreePath:O.value.worktreePath,filePath:S,conflictContent:k.content}});return T.success&&T.resolvedContent!==void 0?(k.content=T.resolvedContent,await hr(S,T.resolvedContent)):!1}catch{return!1}}async function Oi(){if(!O.value)return;const S=O.value.files.filter(k=>!O.value.resolvedFiles.has(k.path));for(const k of S)await wn(k.path)}async function jn(S){const k=s.value.find(T=>T.id===S);if(!k)return{success:!1,error:"Conversation not found"};if(!k.hasWorktree||!k.worktreePath||!k.baseBranch)return{success:!1,error:"No worktree to preview"};try{const T=await $fetch("/api/chat/preview",{method:"POST",body:{conversationId:S,worktreePath:k.worktreePath,baseBranch:k.baseBranch}});return T.success&&T.previewBranch&&(k.previewBranch=T.previewBranch,g.value=S,k.updatedAt=new Date().toISOString(),Et()),{success:T.success,error:T.error}}catch(T){return{success:!1,error:T instanceof Error?T.message:String(T)}}}async function dr(S){const k=s.value.find(T=>T.id===S);if(!k)return{success:!1,error:"Conversation not found"};if(!k.previewBranch||!k.baseBranch)return g.value=null,{success:!1,error:"No active preview"};try{const T=await $fetch("/api/chat/preview",{method:"DELETE",body:{previewBranch:k.previewBranch,baseBranch:k.baseBranch}});return T.success&&(k.previewBranch=void 0,g.value=null,k.updatedAt=new Date().toISOString(),Et()),{success:T.success,error:T.error}}catch(T){return{success:!1,error:T instanceof Error?T.message:String(T)}}}async function Pr(S){if(g.value===S)return await dr(S);if(g.value){const k=await dr(g.value);if(!k.success)return{success:!1,error:`Failed to end previous preview: ${k.error}`}}return await jn(S)}function vi(S){const k=S.trim();if(!k)return null;const T=s.value.filter(W=>W.featureId===k?!0:W.worktreeBranch?.trim()===k);return T.length===0?null:T.sort((W,le)=>new Date(le.updatedAt).getTime()-new Date(W.updatedAt).getTime())[0]||null}function bi(S,k){const T=s.value.find(W=>W.id===S);T&&(T.title=k.trim(),T.updatedAt=new Date().toISOString(),nn(),Et())}function xi(S){const k=o.value;if(!k)return;const T=s.value.find(le=>le.id===k);if(!T||T.title!=="New Conversation")return;const W=T.messages.find(le=>le.role==="user");W&&(W.content.trim().length>0?T.title=Z1(W.content):W.attachments&&W.attachments.length>0&&(T.title=W.attachments.length===1?"[Image] New Conversation":`[${W.attachments.length} Images] New Conversation`))}function qn(){const S=s.value.length;return{atLimit:S>=Dh,nearLimit:S>=Eh,count:S}}async function Yn(S,k){o.value||await kn();const T=xn(S,void 0,k);return xi(),rn(!0),T}function yi(S,k,T){const W=T??o.value;Qr(S,k,W??void 0),W&&Jt(W,!1)}function Fn(S,k){const T=k??o.value;yn(S,{status:"complete"},T??void 0),T&&Jt(T,!0)}return{messages:P,session:A,isPanelOpen:r,panelWidth:Te(e),permissionMode:Te(t),pendingPermission:E,pendingPlanApproval:F,cwd:Te(n),lastError:I,debugEvents:oe,debugStreamEnabled:Te(u),providerSessionId:ne,conversations:Te(s),archivedConversations:Te(i),activeConversationId:Te(o),conversationViewMode:Te(a),conflictState:Te(O),previewingConversationId:Te(g),isStreaming:ie,hasMessages:L,lastMessage:D,isActiveConversationStreaming:z,hasConversations:q,hasArchivedConversations:V,activeConversation:C,conversationCount:X,isNearStorageLimit:N,sortedConversations:me,sortedArchivedConversations:K,previewingConversation:he,streamingConversations:Te(l),initialize:xe,togglePanel:Ce,openPanel:ce,closePanel:ue,setPanelWidth:Me,setPermissionMode:De,setPendingPermission:Ae,clearPendingPermission:Ue,setPendingPlanApproval:Ye,clearPendingPlanApproval:pe,setCwd:Le,setProviderSessionId:Ve,clearProviderSession:Kt,getProviderSessionId:Er,updateWorktreeBranch:Mt,setConversationProviderSelection:bn,startConversationStreaming:$r,endConversationStreaming:zn,isConversationStreaming:Z,addMessage:Cr,addUserMessage:xn,addAssistantMessage:Nn,updateMessage:yn,resetMessageForReplay:xt,appendToMessage:Qr,addToolToMessage:H,updateToolInMessage:fe,initContentBlocks:_e,appendContentBlock:We,appendContentBlockWithSave:ri,updateBlockById:Ge,updateBlockWithSave:it,findToolUseBlock:ni,batchSetMessageBlocks:Dr,syncContentFromBlocks:se,setSessionStatus:si,startSession:ii,endSession:oi,setSessionError:ai,setDebugStreamEnabled:ci,pushDebugEvent:li,clearDebugEvents:ui,clearMessages:hi,clearError:di,loadConversations:fi,refreshServerConversations:pi,saveAllConversations:Et,saveCurrentConversation:rn,saveConversation:Jt,createConversation:kn,selectConversation:Lr,deleteConversation:mi,archiveConversation:R,restoreArchivedConversation:G,deleteArchivedConversation:ae,setConversationViewMode:w,findConversationByFeature:vi,syncConversationFeatureFromBranch:Zt,renameConversation:bi,checkStorageLimits:qn,finalizeConversation:gs,rebaseConversation:Os,resolveConflictFile:hr,continueRebase:vs,abortRebase:gi,aiResolveConflictFile:wn,aiResolveAllConflicts:Oi,previewConversation:jn,unpreviewConversation:dr,togglePreview:Pr,isConversationPreviewing:$,addUserMessageWithConversation:Yn,appendToMessageWithSave:yi,completeMessageWithSave:Fn}});function Ay(r={}){const e=ll(),t=300,n=5e3,s=250;let i=null,o=null,a=null,l=null,c=null,u=!1,h=!1;const p=_(!1),f=_(!1);let g=r;function O(D){g=D}async function y(){const D=g.getScrollPosition?.()??0,Z=await e.checkAndRefresh();return Z&&g.setScrollPosition&&(await br(),g.setScrollPosition(D)),Z}function b(){return p.value||!!e.activeContextMenu||!!e.activeDialog}async function C(){if(b()){f.value=!0;return}A()}async function P(){if(u){h=!0;return}u=!0;try{await y()}finally{u=!1,h&&(h=!1,A())}}function A(){o&&clearTimeout(o),o=setTimeout(()=>{o=null,P()},s)}function E(D){if(typeof window>"u")return;if(a&&a.readyState===WebSocket.OPEN){a.send(JSON.stringify({type:"watch",workingDirectory:D}));return}l&&(clearTimeout(l),l=null);const z=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;a=new WebSocket(z),a.onopen=()=>{a.send(JSON.stringify({type:"watch",workingDirectory:D}))},a.onmessage=q=>{try{JSON.parse(q.data).type==="git_changed"&&C()}catch{}},a.onclose=()=>{a=null,e.isPollingActive&&c&&(l=setTimeout(()=>{c&&E(c)},n))},a.onerror=()=>{}}function F(){l&&(clearTimeout(l),l=null),a&&(a.close(),a=null)}function I(D){D&&(c=D),!e.isPollingActive&&(e.startPolling(),c&&E(c))}function oe(){F(),e.stopPolling()}function ie(){p.value=!0,i&&(clearTimeout(i),i=null)}function ne(){i&&clearTimeout(i),i=setTimeout(async()=>{p.value=!1,f.value&&(f.value=!1,A())},t)}function L(){oe(),i&&(clearTimeout(i),i=null),o&&(clearTimeout(o),o=null),u=!1,h=!1,c=null}return ze(()=>[e.activeContextMenu,e.activeDialog],()=>{!e.activeContextMenu&&!e.activeDialog&&f.value&&!p.value&&(f.value=!1,A())}),{isUserInteracting:Te(p),isDeferredRefresh:Te(f),startPolling:I,stopPolling:oe,startInteraction:ie,endInteraction:ne,cleanup:L,setScrollCallbacks:O}}function _y(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 Ry(r){const e=_({visible:!1,branchName:"",loading:!1,error:null});async function t(){e.value.loading=!0,e.value.error=null;const K=await r.checkoutBranch(e.value.branchName);e.value.loading=!1,K.success?e.value.visible=!1:e.value.error=K.error||"Unknown error"}const n=_({visible:!1,fromCommit:"",loading:!1,error:null});async function s(K){n.value.loading=!0,n.value.error=null;const he=await r.createBranch(K.name,n.value.fromCommit);n.value.loading=!1,he.success?(K.checkout&&await r.checkoutBranch(K.name),n.value.visible=!1):n.value.error=he.error||"Unknown error"}const i=_({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function o(K){i.value.loading=!0,i.value.error=null;const{branchName:he,isLocal:$}=i.value,w=K?.force??i.value.force,M=$?await r.deleteLocalBranch(he,w):await r.deleteRemoteBranch(he);i.value.loading=!1,M.success?i.value.visible=!1:i.value.error=M.error||"Unknown error"}const a=_({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 K=await r.renameBranch(a.value.branchName,a.value.newName.trim());a.value.loading=!1,K.success?a.value.visible=!1:a.value.error=K.error||"Unknown error"}const c=_({visible:!1,branchName:"",loading:!1,error:null});async function u(K){c.value.loading=!0,c.value.error=null;const he=await r.mergeBranch(c.value.branchName,K);c.value.loading=!1,he.success?c.value.visible=!1:c.value.error=he.error||"Unknown error"}const h=_({visible:!1,branchName:"",loading:!1,error:null});async function p(){h.value.loading=!0,h.value.error=null;const K=await r.rebaseBranch(h.value.branchName);h.value.loading=!1,K.success?h.value.visible=!1:h.value.error=K.error||"Unknown error"}const f=_({visible:!1,branchName:"",loading:!1,error:null});async function g(K){f.value.loading=!0,f.value.error=null;const he=await r.pushBranch(f.value.branchName,K.remote,K.force,K.forceWithLease);f.value.loading=!1,he.success?f.value.visible=!1:f.value.error=he.error||"Unknown error"}const O=_({visible:!1,branchName:"",loading:!1,error:null});async function y(K){O.value.loading=!0,O.value.error=null;const he=await r.pullBranch(O.value.branchName,K.remote,K.noFastForward,K.squash);O.value.loading=!1,he.success?O.value.visible=!1:O.value.error=he.error||"Unknown error"}const b=_({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function C(K){b.value.loading=!0,b.value.error=null;const he=await r.cherryPickCommit(b.value.commitHash,K.recordOrigin,K.noCommit);b.value.loading=!1,he.success?b.value.visible=!1:b.value.error=he.error||"Unknown error"}const P=_({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function A(K){P.value.loading=!0,P.value.error=null;const he=await r.resetToCommit(P.value.commitHash,K.mode);P.value.loading=!1,he.success?P.value.visible=!1:P.value.error=he.error||"Unknown error"}const E=_({visible:!1,commitHash:"",loading:!1,error:null});async function F(K){E.value.loading=!0,E.value.error=null;const he=await r.createTag(K.name,E.value.commitHash,K.annotated,K.message,K.pushToRemote);E.value.loading=!1,he.success?E.value.visible=!1:E.value.error=he.error||"Unknown error"}const I=_({visible:!1,tagName:"",loading:!1,error:null});async function oe(K){I.value.loading=!0,I.value.error=null;const he=await r.deleteTag(I.value.tagName,K.deleteFromRemote?K.remote||"origin":void 0);I.value.loading=!1,he.success?I.value.visible=!1:I.value.error=he.error||"Unknown error"}const ie=_({visible:!1,tagName:"",loading:!1,tagDetail:null}),ne=_({visible:!1,loading:!1,error:null});async function L(K){ne.value.loading=!0,ne.value.error=null;const he=await r.stashChanges(K.message,K.includeUntracked);ne.value.loading=!1,he.success?ne.value.visible=!1:ne.value.error=he.error||"Unknown error"}const D=_({visible:!1,stashIndex:0,loading:!1,error:null}),Z=_("");async function z(K){D.value.loading=!0,D.value.error=null;const he=await r.stashBranch(D.value.stashIndex,K);D.value.loading=!1,he.success?D.value.visible=!1:D.value.error=he.error||"Unknown error"}const q=_({visible:!1,loading:!1,error:null});async function V(K){q.value.loading=!0,q.value.error=null;const he=await r.resetWorking(K.mode);q.value.loading=!1,he.success?q.value.visible=!1:q.value.error=he.error||"Unknown error"}const X=_({visible:!1,loading:!1,error:null});async function N(){X.value.loading=!0,X.value.error=null;const K=await r.cleanUntracked();X.value.loading=!1,K.success?X.value.visible=!1:X.value.error=K.error||"Unknown error"}const me=J(()=>e.value.visible||n.value.visible||i.value.visible||a.value.visible||c.value.visible||h.value.visible||f.value.visible||O.value.visible||b.value.visible||P.value.visible||E.value.visible||I.value.visible||ie.value.visible||ne.value.visible||D.value.visible||q.value.visible||X.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:p,pushDialog:f,confirmPush:g,pullDialog:O,confirmPull:y,cherryPickDialog:b,confirmCherryPick:C,resetDialog:P,confirmReset:A,tagCreateDialog:E,confirmTagCreate:F,tagDeleteDialog:I,confirmTagDelete:oe,tagDetailDialog:ie,stashDialog:ne,confirmStash:L,stashBranchDialog:D,stashBranchInput:Z,confirmStashBranch:z,resetWorkingDialog:q,confirmResetWorking:V,cleanUntrackedDialog:X,confirmCleanUntracked:N,isAnyDialogOpen:me}}function By(r,e){const t=_({visible:!1,x:0,y:0});function n(Y,Me){t.value={visible:!0,x:Y,y:Me},setTimeout(()=>{t.value.visible=!1},1500)}const s=_({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function i(Y){s.value={visible:!0,...Y},r.setActiveContextMenu({type:"branch",props:Y,position:{x:Y.x,y:Y.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 Y=s.value.branch;o(),e.renameDialog.value={visible:!0,branchName:Y,newName:Y,loading:!1,error:null}}function c(){const{branch:Y,isLocal:Me}=s.value;o(),e.deleteBranchDialog.value={visible:!0,branchName:Y,isLocal:Me,force:!1,loading:!1,error:null}}function u(){const Y=s.value.branch;o(),e.mergeDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}function h(){const Y=s.value.branch;o(),e.rebaseDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}function p(){const Y=s.value.branch;o(),e.pushDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}function f(){const Y=s.value.branch;o(),e.pullDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}async function g(){const Y=s.value.branch;o(),await r.fetchBranch(Y)}async function O(){const Y=s.value.branch;o(),await r.copyToClipboard(Y),n(s.value.x,s.value.y)}function y(){o(),e.createBranchDialog.value={visible:!0,fromCommit:s.value.commitHash,loading:!1,error:null}}const b=_({visible:!1,commit:null,x:0,y:0});function C(Y){b.value={visible:!0,commit:Y.commit,x:Y.x,y:Y.y},r.setActiveContextMenu({type:"commit",props:Y,position:{x:Y.x,y:Y.y}})}function P(){b.value.visible=!1,r.clearActiveContextMenu()}function A(Y){const Me=b.value.commit;if(!Me)return!1;P();const Le=Y(Me);return Le&&typeof Le.then=="function"?Le.then(()=>!0):!0}function E(){A(Y=>{e.tagCreateDialog.value={visible:!0,commitHash:Y.hash,loading:!1,error:null}})}function F(){A(Y=>{e.createBranchDialog.value={visible:!0,fromCommit:Y.hash,loading:!1,error:null}})}function I(){A(Y=>{e.checkoutDialog.value={visible:!0,branchName:Y.hash,loading:!1,error:null}})}function oe(){A(Y=>{e.cherryPickDialog.value={visible:!0,commitHash:Y.hash,commitMessage:Y.message,loading:!1,error:null}})}async function ie(){await A(Y=>r.revertCommit(Y.hash))}function ne(){A(Y=>{e.mergeDialog.value={visible:!0,branchName:Y.shortHash,loading:!1,error:null}})}function L(){A(Y=>{e.resetDialog.value={visible:!0,commitHash:Y.hash,commitMessage:Y.message,loading:!1,error:null}})}async function D(){const{x:Y,y:Me}=b.value;await A(Ve=>r.copyToClipboard(Ve.hash))&&n(Y,Me)}async function Z(){await A(Y=>r.copyCommitSubject(Y))}const z=_({visible:!1,tag:"",x:0,y:0,commitHash:""});function q(Y){z.value={visible:!0,...Y},r.setActiveContextMenu({type:"tag",props:Y,position:{x:Y.x,y:Y.y}})}function V(){z.value.visible=!1,r.clearActiveContextMenu()}async function X(){const Y=z.value.tag;V(),e.tagDetailDialog.value={visible:!0,tagName:Y,loading:!0,tagDetail:null};const Me=await r.getTagDetail(Y);e.tagDetailDialog.value.loading=!1,Me.success&&Me.data&&(e.tagDetailDialog.value.tagDetail=Me.data)}function N(){const Y=z.value.tag;V(),e.tagDeleteDialog.value={visible:!0,tagName:Y,loading:!1,error:null}}async function me(){const Y=z.value.tag;V(),await r.pushTag(Y)}async function K(){const Y=z.value.tag;V(),await r.copyToClipboard(Y),n(z.value.x,z.value.y)}const he=_({visible:!1,x:0,y:0});function $(Y){he.value={visible:!0,...Y},r.setActiveContextMenu({type:"uncommitted",props:Y,position:{x:Y.x,y:Y.y}})}function w(){he.value.visible=!1,r.clearActiveContextMenu()}function M(){w(),e.stashDialog.value={visible:!0,loading:!1,error:null}}function R(){w(),e.resetWorkingDialog.value={visible:!0,loading:!1,error:null}}function G(){w(),e.cleanUntrackedDialog.value={visible:!0,loading:!1,error:null}}const ae=_({visible:!1,stash:null,x:0,y:0});function xe(Y){ae.value={visible:!0,stash:Y.stash,x:Y.x,y:Y.y},r.setActiveContextMenu({type:"stash",props:Y,position:{x:Y.x,y:Y.y}})}function De(){ae.value.visible=!1,r.clearActiveContextMenu()}function Ae(Y){const Me=ae.value.stash;if(!Me)return!1;De();const Le=Y(Me);return Le&&typeof Le.then=="function"?Le.then(()=>!0):!0}async function Ue(){await Ae(Y=>r.applyStash(Y.index))}async function Ye(){await Ae(Y=>r.popStash(Y.index))}async function pe(){await Ae(Y=>r.dropStash(Y.index))}function Ce(){Ae(Y=>{e.stashBranchDialog.value={visible:!0,stashIndex:Y.index,loading:!1,error:null}})}async function ce(){const{x:Y,y:Me}=ae.value;await Ae(Ve=>r.copyToClipboard(`stash@{${Ve.index}}`))&&n(Y,Me)}async function ue(){const{x:Y,y:Me}=ae.value;await Ae(Ve=>r.copyToClipboard(Ve.hash))&&n(Y,Me)}return{copyFeedback:t,showCopyFeedback:n,branchMenu:s,handleBranchContextMenu:i,closeBranchMenu:o,handleBranchCheckout:a,handleBranchRename:l,handleBranchDelete:c,handleBranchMerge:u,handleBranchRebase:h,handleBranchPush:p,handleBranchPull:f,handleBranchFetch:g,handleBranchCopyName:O,handleBranchCreateBranch:y,commitMenu:b,handleCommitContextMenu:C,closeCommitMenu:P,handleCommitAddTag:E,handleCommitCreateBranch:F,handleCommitCheckout:I,handleCommitCherryPick:oe,handleCommitRevert:ie,handleCommitMergeInto:ne,handleCommitReset:L,handleCommitCopyHash:D,handleCommitCopySubject:Z,tagMenu:z,handleTagContextMenu:q,closeTagMenu:V,handleTagViewDetails:X,handleTagDelete:N,handleTagPush:me,handleTagCopyName:K,uncommittedMenu:he,handleUncommittedContextMenu:$,closeUncommittedMenu:w,handleUncommittedStash:M,handleUncommittedReset:R,handleUncommittedClean:G,stashMenu:ae,handleStashContextMenu:xe,closeStashMenu:De,handleStashApply:Ue,handleStashPop:Ye,handleStashDrop:pe,handleStashCreateBranch:Ce,handleStashCopyName:ce,handleStashCopyHash:ue}}const Zy={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Ey={class:"text-sm font-mono text-retro-cyan"},Dy={class:"text-xs font-mono text-retro-text mt-1 truncate"},Ly={class:"space-y-3"},Xy={class:"flex items-start gap-2 cursor-pointer group"},Iy={class:"flex items-start gap-2 cursor-pointer group"},Vy=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=_(!1),s=_(!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(),Oe(Wt,{title:"Cherry-Pick Commit",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Cherry-Pick",onClose:o,onConfirm:i},{default:ct(()=>[d("div",Zy,[l[2]||(l[2]=d("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),d("div",Ey,B(r.commitHash.slice(0,7)),1),d("div",Dy,B(r.commitMessage.split(`
10
10
  `)[0]),1)]),d("div",Ly,[d("label",Xy,[He(d("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>tt(n)?n.value=c:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[lr,m(n)]]),l[3]||(l[3]=d("div",null,[d("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Record origin (-x) "),d("p",{class:"text-xs font-mono text-retro-muted mt-0.5"},' Append "(cherry picked from commit ...)" to the commit message ')],-1))]),d("label",Iy,[He(d("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>tt(s)?s.value=c:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[lr,m(s)]]),l[4]||(l[4]=d("div",null,[d("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," No commit "),d("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"]))}}),zy={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Ny={class:"text-sm font-mono text-retro-cyan"},Wy={class:"mb-4"},jy={class:"flex items-start gap-2 cursor-pointer group"},qy=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=_(""),s=_(!0),i=J(()=>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(),Oe(Wt,{title:"Create Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Create Branch",onClose:a,onConfirm:o},{default:ct(()=>[d("div",zy,[c[2]||(c[2]=d("div",{class:"text-xs font-mono text-retro-muted mb-1"},"From",-1)),d("div",Ny,B(r.fromCommit.slice(0,7)),1)]),d("div",Wy,[c[3]||(c[3]=d("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Branch name",-1)),He(d("input",{"onUpdate:modelValue":c[0]||(c[0]=u=>tt(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),[[Xt,m(n)]])]),d("label",jy,[He(d("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>tt(s)?s.value=u:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[lr,m(s)]]),c[4]||(c[4]=d("div",null,[d("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Switch to new branch "),d("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Checkout the branch after creating it ")],-1))])]),_:1},8,["visible","loading","error"]))}}),Yy=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(),Oe(Wt,{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]=[d("div",{class:"space-y-3"},[d("p",{class:"text-retro-text text-sm font-mono"}," Remove all untracked files and directories from the working tree. "),d("p",{class:"text-retro-muted text-xs font-mono"},[Xe(" This runs "),d("code",null,"git clean -fd"),Xe(" and cannot be undone. ")])],-1)])]),_:1},8,["visible","loading","error"]))}}),Fy={class:"text-retro-text text-sm font-mono mb-2"},Uy={class:"text-retro-cyan"},Gy={class:"space-y-3 mt-4"},Hy={class:"flex items-center gap-2 cursor-pointer"},Ky=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=_(!1);function i(){n("confirm",{force:s.value})}return ze(()=>t.visible,o=>{o&&(s.value=!1)}),(o,a)=>(v(),Oe(Wt,{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]=d("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)),d("p",Fy,[Xe(" Delete "+B(r.isLocal?"local":"remote")+" branch ",1),d("span",Uy,B(r.branchName),1),a[2]||(a[2]=Xe("? ",-1))]),d("div",Gy,[d("label",Hy,[He(d("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>tt(s)?s.value=l:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[lr,m(s)]]),a[3]||(a[3]=d("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),Jy={class:"text-retro-text text-sm font-mono mb-4"},ek={class:"text-retro-cyan"},tk={class:"space-y-3"},rk={class:"flex items-center gap-2 cursor-pointer"},nk={class:"flex items-center gap-2 cursor-pointer"},sk={class:"flex items-center gap-2 cursor-pointer"},ik=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=_(!1),i=_(!1),o=_(!1);function a(){n("confirm",{noCommit:s.value,noFastForward:i.value,squash:o.value})}return ze(()=>t.visible,l=>{l&&(s.value=!1,i.value=!1,o.value=!1)}),(l,c)=>(v(),Oe(Wt,{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(()=>[d("p",Jy,[c[4]||(c[4]=Xe(" Merge ",-1)),d("span",ek,B(r.branchName),1),c[5]||(c[5]=Xe(" into current branch ",-1))]),d("div",tk,[d("label",rk,[He(d("input",{"onUpdate:modelValue":c[0]||(c[0]=u=>tt(s)?s.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[lr,m(s)]]),c[6]||(c[6]=d("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),d("label",nk,[He(d("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>tt(i)?i.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[lr,m(i)]]),c[7]||(c[7]=d("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),d("label",sk,[He(d("input",{"onUpdate:modelValue":c[2]||(c[2]=u=>tt(o)?o.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[lr,m(o)]]),c[8]||(c[8]=d("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),ok={class:"text-retro-text text-sm font-mono mb-4"},ak={class:"text-retro-cyan"},lk={class:"space-y-3"},ck=["value"],uk={class:"flex items-center gap-2 cursor-pointer"},hk={class:"flex items-center gap-2 cursor-pointer"},dk=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=_("origin"),i=_(!1),o=_(!1);function a(){n("confirm",{remote:s.value,noFastForward:i.value,squash:o.value})}return ze(()=>t.visible,l=>{l&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",i.value=!1,o.value=!1)}),(l,c)=>(v(),Oe(Wt,{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(()=>[d("p",ok,[c[4]||(c[4]=Xe(" Pull ",-1)),d("span",ak,B(r.branchName),1),c[5]||(c[5]=Xe(" from remote ",-1))]),d("div",lk,[d("div",null,[c[6]||(c[6]=d("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),He(d("select",{"onUpdate:modelValue":c[0]||(c[0]=u=>tt(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),x(we,null,Fe(r.remotes,u=>(v(),x("option",{key:u,value:u},B(u),9,ck))),128))],512),[[ms,m(s)]])]),d("label",uk,[He(d("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>tt(i)?i.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[lr,m(i)]]),c[7]||(c[7]=d("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),d("label",hk,[He(d("input",{"onUpdate:modelValue":c[2]||(c[2]=u=>tt(o)?o.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[lr,m(o)]]),c[8]||(c[8]=d("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),fk={class:"text-retro-text text-sm font-mono mb-4"},pk={class:"text-retro-cyan"},mk={class:"space-y-3"},gk=["value"],Ok={class:"flex items-center gap-2 cursor-pointer"},vk=["checked"],bk={class:"flex items-center gap-2 cursor-pointer"},xk=["checked"],yk={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},kk=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=_("origin"),i=_(!1),o=_(!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 ze(()=>t.visible,u=>{u&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",i.value=!1,o.value=!1)}),(u,h)=>(v(),Oe(Wt,{title:"Push Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Push",onClose:h[3]||(h[3]=p=>n("close")),onConfirm:c},{default:ct(()=>[d("p",fk,[h[4]||(h[4]=Xe(" Push ",-1)),d("span",pk,B(r.branchName),1),h[5]||(h[5]=Xe(" to remote ",-1))]),d("div",mk,[d("div",null,[h[6]||(h[6]=d("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),He(d("select",{"onUpdate:modelValue":h[0]||(h[0]=p=>tt(s)?s.value=p: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),x(we,null,Fe(r.remotes,p=>(v(),x("option",{key:p,value:p},B(p),9,gk))),128))],512),[[ms,m(s)]])]),d("label",Ok,[d("input",{checked:m(i),type:"checkbox",class:"accent-retro-cyan",onChange:h[1]||(h[1]=p=>a(p.target.checked))},null,40,vk),h[7]||(h[7]=d("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),d("label",bk,[d("input",{checked:m(o),type:"checkbox",class:"accent-retro-cyan",onChange:h[2]||(h[2]=p=>l(p.target.checked))},null,40,xk),h[8]||(h[8]=d("span",{class:"text-retro-muted text-sm"},"Force with lease (safer force push)",-1))]),m(i)||m(o)?(v(),x("div",yk,B(m(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"]))}}),wk={class:"text-retro-text text-sm font-mono mb-4"},Sk={class:"text-retro-cyan"},$k={class:"text-retro-cyan"},Ck={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},Qk={class:"text-retro-cyan"},Pk={class:"text-retro-cyan"},Tk=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(),Oe(Wt,{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(()=>[d("p",wk,[s[2]||(s[2]=Xe(" Rebase ",-1)),d("span",Sk,B(r.branchName),1),s[3]||(s[3]=Xe(" onto ",-1)),d("span",$k,B(r.ontoBranch),1)]),d("div",Ck,[s[4]||(s[4]=Xe(" This will rewrite commit history. Commits from ",-1)),d("span",Qk,B(r.branchName),1),s[5]||(s[5]=Xe(" will be replayed on top of ",-1)),d("span",Pk,B(r.ontoBranch),1),s[6]||(s[6]=Xe(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),Mk={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Ak={class:"text-sm font-mono text-retro-cyan"},_k={class:"text-xs font-mono text-retro-text mt-1 truncate"},Rk={class:"space-y-2"},Bk=["value"],Zk={key:0,class:"mt-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Ek=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=_("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(),Oe(Wt,{title:"Reset to Commit",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Reset","confirm-danger":m(n)==="hard",onClose:o,onConfirm:i},{default:ct(()=>[d("div",Mk,[l[1]||(l[1]=d("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Reset to",-1)),d("div",Ak,B(r.commitHash.slice(0,7)),1),d("div",_k,B(r.commitMessage.split(`
11
11
  `)[0]),1)]),d("div",Rk,[l[2]||(l[2]=d("div",{class:"text-xs font-mono text-retro-muted mb-2"},"Reset mode",-1)),(v(),x(we,null,Fe(s,c=>d("label",{key:c.value,class:Re(["flex items-start gap-2 p-2 rounded cursor-pointer group border transition-colors",[m(n)===c.value?"border-retro-cyan bg-retro-cyan/5":"border-transparent hover:bg-retro-panel"]])},[He(d("input",{"onUpdate:modelValue":l[0]||(l[0]=u=>tt(n)?n.value=u:null),type:"radio",name:"reset-mode",value:c.value,class:"mt-0.5 accent-retro-cyan"},null,8,Bk),[[mc,m(n)]]),d("div",null,[d("span",{class:Re(["text-sm font-mono transition-colors",[c.value==="hard"?"text-retro-red":"text-retro-text",m(n)===c.value?"text-retro-cyan":""]])},B(c.label),3),d("p",{class:Re(["text-xs font-mono mt-0.5",c.value==="hard"?"text-retro-red/70":"text-retro-muted"])},B(c.description),3)])],2)),64))]),m(n)==="hard"?(v(),x("div",Zk," 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"]))}}),Dk={class:"space-y-3"},Lk={class:"flex items-start gap-2 cursor-pointer"},Xk={class:"flex items-start gap-2 cursor-pointer"},Ik={key:0,class:"mt-4 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Vk=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=_("mixed"),i=J(()=>s.value==="hard");function o(){n("confirm",{mode:s.value})}return ze(()=>t.visible,a=>{a&&(s.value="mixed")}),(a,l)=>(v(),Oe(Wt,{title:"Reset Working Directory",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Reset","confirm-danger":m(i),onClose:l[2]||(l[2]=c=>n("close")),onConfirm:o},{default:ct(()=>[l[5]||(l[5]=d("p",{class:"text-retro-text text-sm font-mono mb-4"}," Reset the working directory to HEAD. ",-1)),d("div",Dk,[d("label",Lk,[He(d("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>tt(s)?s.value=c:null),type:"radio",value:"mixed",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[mc,m(s)]]),l[3]||(l[3]=d("div",null,[d("span",{class:"text-retro-text text-sm font-mono"},"Mixed"),d("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area, keep working directory ")],-1))]),d("label",Xk,[He(d("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>tt(s)?s.value=c:null),type:"radio",value:"hard",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[mc,m(s)]]),l[4]||(l[4]=d("div",null,[d("span",{class:"text-retro-text text-sm font-mono"},"Hard"),d("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area AND working directory (DESTRUCTIVE) ")],-1))])]),m(i)?(v(),x("div",Ik," WARNING: Hard reset will permanently discard all uncommitted changes. This cannot be undone. ")):U("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),zk={class:"space-y-4"},Nk={class:"flex items-center gap-2 cursor-pointer"},Wk=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=_(""),i=_(!1);function o(){n("confirm",{message:s.value.trim()||void 0,includeUntracked:i.value})}return ze(()=>t.visible,a=>{a&&(s.value="",i.value=!1)}),(a,l)=>(v(),Oe(Wt,{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]=d("p",{class:"text-retro-text text-sm font-mono mb-4"}," Save uncommitted changes to the stash. ",-1)),d("div",zk,[d("div",null,[l[3]||(l[3]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message (optional)",-1)),He(d("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>tt(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),[[Xt,m(s)]])]),d("label",Nk,[He(d("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>tt(i)?i.value=c:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[lr,m(i)]]),l[4]||(l[4]=d("span",{class:"text-retro-muted text-sm"},"Include untracked files",-1))])])]),_:1},8,["visible","loading","error"]))}}),jk={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},qk={class:"text-sm font-mono text-retro-cyan"},Yk={class:"mb-4"},Fk={class:"mb-3"},Uk={class:"flex items-start gap-2 cursor-pointer group"},Gk={key:0,class:"mb-4"},Hk={class:"space-y-2"},Kk={class:"flex items-start gap-2 cursor-pointer group"},Jk=["disabled"],ew={key:0,class:"ml-6"},tw=["value"],rw=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=_(""),s=_(!1),i=_(""),o=_(!1),a=_(""),l=J(()=>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 ze(()=>s.value,h=>{h||(i.value="")}),(h,p)=>(v(),Oe(Wt,{title:"Create Tag",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Create Tag",onClose:u,onConfirm:c},{default:ct(()=>[d("div",jk,[p[5]||(p[5]=d("div",{class:"text-xs font-mono text-retro-muted mb-1"},"At commit",-1)),d("div",qk,B(r.commitHash.slice(0,7)),1)]),d("div",Yk,[p[6]||(p[6]=d("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag name",-1)),He(d("input",{"onUpdate:modelValue":p[0]||(p[0]=f=>tt(n)?n.value=f: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),[[Xt,m(n)]])]),d("div",Fk,[d("label",Uk,[He(d("input",{"onUpdate:modelValue":p[1]||(p[1]=f=>tt(s)?s.value=f:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[lr,m(s)]]),p[7]||(p[7]=d("div",null,[d("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Annotated tag "),d("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Create a full tag object with message and tagger info ")],-1))])]),m(s)?(v(),x("div",Gk,[p[8]||(p[8]=d("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag message",-1)),He(d("textarea",{"onUpdate:modelValue":p[2]||(p[2]=f=>tt(i)?i.value=f: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),[[Xt,m(i)]])])):U("",!0),d("div",Hk,[d("label",Kk,[He(d("input",{"onUpdate:modelValue":p[3]||(p[3]=f=>tt(o)?o.value=f:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan",disabled:r.remotes.length===0},null,8,Jk),[[lr,m(o)]]),d("div",null,[d("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)])]),m(o)&&r.remotes.length>0?(v(),x("div",ew,[He(d("select",{"onUpdate:modelValue":p[4]||(p[4]=f=>tt(a)?a.value=f: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"},[p[9]||(p[9]=d("option",{value:"",disabled:"",class:"text-retro-muted"},"Select remote",-1)),(v(!0),x(we,null,Fe(r.remotes,f=>(v(),x("option",{key:f,value:f},B(f),9,tw))),128))],512),[[ms,m(a)]])])):U("",!0)])]),_:1},8,["visible","loading","error"]))}}),nw={class:"text-retro-text text-sm font-mono mb-2"},sw={class:"text-retro-cyan"},iw={class:"space-y-3 mt-4"},ow={class:"flex items-center gap-2 cursor-pointer"},aw={key:0,class:"ml-6"},lw=["value"],cw=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=_(!1),i=_("origin");function o(){n("confirm",{deleteFromRemote:s.value,remote:s.value?i.value:void 0})}return ze(()=>t.visible,a=>{a&&(s.value=!1,i.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin")}),(a,l)=>(v(),Oe(Wt,{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]=d("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)),d("p",nw,[l[3]||(l[3]=Xe(" Delete tag ",-1)),d("span",sw,B(r.tagName),1),l[4]||(l[4]=Xe("? ",-1))]),d("div",iw,[d("label",ow,[He(d("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>tt(s)?s.value=c:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[lr,m(s)]]),l[5]||(l[5]=d("span",{class:"text-retro-muted text-sm"},"Also delete from remote",-1))]),m(s)?(v(),x("div",aw,[l[6]||(l[6]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Remote",-1)),He(d("select",{"onUpdate:modelValue":l[1]||(l[1]=c=>tt(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),x(we,null,Fe(r.remotes,c=>(v(),x("option",{key:c,value:c},B(c),9,lw))),128))],512),[[ms,m(i)]])])):U("",!0)])]),_:1},8,["visible","loading","error"]))}}),uw={class:"mb-4"},hw={class:"text-retro-cyan text-sm font-mono"},dw={class:"mb-4"},fw={class:"text-retro-text text-sm font-mono"},pw={class:"mb-4"},mw={class:"text-retro-text text-sm font-mono break-all select-all"},gw={class:"mb-4"},Ow={class:"text-retro-text text-sm font-mono"},vw={class:"text-retro-muted"},bw={class:"mb-4"},xw={class:"text-retro-text text-sm font-mono"},yw={key:1,class:"mb-2"},kw={class:"p-2 text-sm font-mono text-retro-text bg-retro-panel border border-retro-border rounded whitespace-pre-wrap"},ww={key:1,class:"text-retro-muted text-sm font-mono text-center py-4"},Sw=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(),Oe(Wt,{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(()=>[d("div",uw,[s[2]||(s[2]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tag",-1)),d("p",hw,B(r.tagName),1)]),r.tagDetail?(v(),x(we,{key:0},[d("div",dw,[s[3]||(s[3]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Type",-1)),d("p",fw,B(r.tagDetail.isAnnotated?"Annotated":"Lightweight"),1)]),d("div",pw,[s[4]||(s[4]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Hash",-1)),d("p",mw,B(r.tagDetail.hash),1)]),r.tagDetail.tagger?(v(),x(we,{key:0},[d("div",gw,[s[5]||(s[5]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tagger",-1)),d("p",Ow,[Xe(B(r.tagDetail.tagger.name)+" ",1),d("span",vw,"<"+B(r.tagDetail.tagger.email)+">",1)])]),d("div",bw,[s[6]||(s[6]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Date",-1)),d("p",xw,B(r.tagDetail.tagger.date),1)])],64)):U("",!0),r.tagDetail.message?(v(),x("div",yw,[s[7]||(s[7]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message",-1)),d("div",kw,B(r.tagDetail.message),1)])):U("",!0)],64)):r.loading?(v(),x("div",ww," Loading tag details... ")):U("",!0)]),_:1},8,["visible","loading"]))}}),Mu=globalThis.setInterval,$w={class:"h-full flex flex-col bg-retro-dark",role:"region","aria-label":"Git Graph"},Cw={key:0,class:"flex-1 flex flex-col items-center justify-center gap-3"},Qw={key:1,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Pw={key:2,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Tw={class:"text-retro-red text-sm mb-4"},Mw={key:3,class:"flex-1 flex items-center justify-center p-4"},Aw={class:"flex-shrink-0 flex items-center gap-2 p-2 border-b border-retro-border"},_w={class:"relative"},Rw={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]"},Bw={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Zw=["checked"],Ew={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Dw=["checked"],Lw={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Xw=["checked"],Iw={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Vw=["checked"],zw={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Nw=["checked"],Ww={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},jw=["checked"],qw={class:"relative"},Yw=["aria-expanded"],Fw={key:0,class:"text-xs"},Uw={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"},Gw=["checked","onChange"],Hw={class:"text-sm text-retro-text truncate"},Kw={key:0,class:"text-[10px] text-retro-cyan"},Jw={class:"px-3 py-1 text-[10px] text-retro-orange font-semibold uppercase tracking-wider mt-1"},eS=["checked","onChange"],tS={class:"text-sm text-retro-text truncate"},rS={class:"relative"},nS={key:0,class:"absolute right-0 top-full mt-1 z-20"},sS=["title"],iS={class:"text-retro-muted text-sm"},oS={class:"text-retro-cyan font-mono"},aS={class:"space-y-3"},lS={class:"text-retro-muted text-sm"},cS={class:"text-retro-cyan font-mono"},uS={class:"space-y-3"},hS={class:"text-retro-muted text-sm"},dS={class:"text-retro-magenta font-mono"},fS={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"},pS={class:"flex-1"},mS=5e3,gS=Ie({__name:"GitGraph",props:{workingDirectory:{},isActive:{type:Boolean,default:!0}},setup(r){const e=r,t=ll(),n=kr(),s=Ay(),i=Ry(t),o=By(t,i),{checkoutDialog:a,confirmCheckout:l,createBranchDialog:c,confirmCreateBranch:u,deleteBranchDialog:h,confirmDeleteBranch:p,renameDialog:f,confirmRenameBranch:g,mergeDialog:O,confirmMerge:y,rebaseDialog:b,confirmRebase:C,pushDialog:P,confirmPush:A,pullDialog:E,confirmPull:F,cherryPickDialog:I,confirmCherryPick:oe,resetDialog:ie,confirmReset:ne,tagCreateDialog:L,confirmTagCreate:D,tagDeleteDialog:Z,confirmTagDelete:z,tagDetailDialog:q,stashDialog:V,confirmStash:X,stashBranchDialog:N,stashBranchInput:me,confirmStashBranch:K,resetWorkingDialog:he,confirmResetWorking:$,cleanUntrackedDialog:w,confirmCleanUntracked:M,isAnyDialogOpen:R}=i,{copyFeedback:G,branchMenu:ae,handleBranchContextMenu:xe,closeBranchMenu:De,handleBranchCheckout:Ae,handleBranchRename:Ue,handleBranchDelete:Ye,handleBranchMerge:pe,handleBranchRebase:Ce,handleBranchPush:ce,handleBranchPull:ue,handleBranchFetch:Y,handleBranchCopyName:Me,handleBranchCreateBranch:Le,commitMenu:Ve,handleCommitContextMenu:Mt,closeCommitMenu:Zt,handleCommitAddTag:bn,handleCommitCreateBranch:Kt,handleCommitCheckout:Er,handleCommitCherryPick:$r,handleCommitRevert:zn,handleCommitMergeInto:Cr,handleCommitReset:xn,handleCommitCopyHash:Nn,handleCommitCopySubject:yn,tagMenu:xt,handleTagContextMenu:Qr,closeTagMenu:H,handleTagViewDetails:fe,handleTagDelete:se,handleTagPush:ve,handleTagCopyName:_e,uncommittedMenu:We,closeUncommittedMenu:Ge,handleUncommittedStash:it,handleUncommittedReset:ri,handleUncommittedClean:ni,stashMenu:Dr,handleStashContextMenu:si,closeStashMenu:ii,handleStashApply:oi,handleStashPop:ai,handleStashDrop:li,handleStashCreateBranch:ci,handleStashCopyName:ui,handleStashCopyHash:hi}=o,di=J(()=>{const S=n.activeConversation?.worktreeBranch;return S?[S]:[]}),fi=J(()=>{const S=[],k=t.selectedFeatureId;k&&S.push(k);const T=t.conversationBranch;return T&&!S.includes(T)&&S.push(T),S});ze(()=>[n.activeConversation?.worktreeBranch,n.activeConversation?.baseBranch],([S,k])=>{t.setConversationBranch(S??null,k??null)},{immediate:!0});const pi=J(()=>{const S=t.previewBranch;return S?[S]:[]});ze(()=>[n.previewingConversation?.worktreeBranch,n.previewingConversation?.baseBranch],([S,k])=>{t.setPreviewBranch(S??null,k??null)},{immediate:!0});const Et=J(()=>{const S={};return t.previewBranch&&t.previewMergeBase&&(S[t.previewBranch]=t.previewMergeBase),S}),Jt=J(()=>{const S={};return t.selectedFeatureId&&t.featureMergeBase&&(S[t.selectedFeatureId]=t.featureMergeBase),t.conversationBranch&&t.conversationMergeBase&&(S[t.conversationBranch]=t.conversationMergeBase),S}),rn=J(()=>t.remotes.map(S=>S.name)),nn=_(null);ze(()=>e.workingDirectory,async S=>{if(S){await t.loadGitGraph(S);const k=n.previewingConversation?.worktreeBranch;k&&await t.setPreviewBranch(k,n.previewingConversation?.baseBranch??null);const T=n.activeConversation?.worktreeBranch;T&&await t.setConversationBranch(T,n.activeConversation?.baseBranch??null)}},{immediate:!0}),ze(()=>e.isActive,S=>{S&&t.commits.length>0&&!t.error?s.startPolling(e.workingDirectory):s.stopPolling()},{immediate:!0}),ze(()=>t.commits.length,S=>{S>0&&e.isActive&&!t.error&&s.startPolling(e.workingDirectory)}),ze(()=>nn.value,S=>{S&&s.setScrollCallbacks({getScrollPosition:()=>S.getScrollPosition(),setScrollPosition:k=>S.setScrollPosition(k)})}),St(()=>{s.cleanup(),t.reset()});const Wn=J(()=>t.error?.includes("Not a Git repository")),kn=_(Date.now());let Lr=null;const mi=()=>{Lr||(Lr=Mu(()=>{kn.value=Date.now()},mS))},gs=()=>{Lr&&(clearInterval(Lr),Lr=null)};mt(()=>{ze(()=>e.isActive,S=>{S?(kn.value=Date.now(),mi()):gs()},{immediate:!0})}),St(()=>{gs()});const Os=J(()=>{const S=t.lastRefreshTime;if(!S)return null;const k=Math.floor((kn.value-S)/1e3);return t.isRefreshing?"Syncing...":k<5?"Just now":k<60?`${k}s ago`:`${Math.floor(k/60)}m ago`}),ur=_(!1),hr=_(!1),vs=_(null);function gi(){ur.value=!0,br(()=>vs.value?.focus())}function wn(){ur.value=!1,t.setSearchQuery("")}function Oi(S){t.setSearchQuery(S)}const jn=_y({onScrollToHead:()=>{const S=t.commits.find(k=>k.isHead);S&&t.selectCommit(S)},onEscape:()=>{dr.value?dr.value=!1:hr.value?hr.value=!1:Pr.value?Pr.value=!1:ur.value?wn():t.isComparing?t.clearComparison():(t.selectedCommit||t.isUncommittedChangesSelected)&&t.clearSelection()}});mt(()=>{jn.start()}),St(()=>{jn.stop()});const dr=_(!1),Pr=_(!1);async function vi(){await t.fetchAll(!0)}async function bi(S){await t.addRemote(S.name,S.url)}async function xi(S){await t.editRemote(S.name,S.newUrl)}async function qn(S){await t.deleteRemote(S)}const Yn=J(()=>{const S=[],k={};for(const T of t.branches)if(t.localBranchNames.has(T.name))S.push(T);else{const W=T.name.indexOf("/");if(W>0){const le=T.name.substring(0,W);k[le]||(k[le]=[]),k[le].push(T)}else S.push(T)}return{local:S,remotes:k}});ze(R,S=>{S?t.setActiveDialog({type:"generic",props:{}}):t.clearActiveDialog()});function yi(S){t.selectedCommit?t.selectComparisonCommit(S):t.selectCommit(S)}function Fn(S){t.navigateToCommit(S)}return(S,k)=>{const T=pv,W=Tv,le=tb,be=yb,de=Lx,Se=ay,qe=gy,ot=Oy,yt=vy,Mo=by,sn=xy,ki=Wt;return v(),x("div",$w,[m(t).loading&&m(t).commits.length===0?(v(),x("div",Cw,[...k[43]||(k[43]=[d("div",{class:"w-6 h-6 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),d("div",{class:"text-retro-muted text-sm"},"Loading git history...",-1)])])):m(Wn)?(v(),x("div",Qw,[ee(m(_n),{class:"w-12 h-12 text-retro-yellow mb-4"}),k[44]||(k[44]=d("h3",{class:"text-retro-text font-semibold mb-2"},"Not a Git Repository",-1)),k[45]||(k[45]=d("p",{class:"text-retro-muted text-sm max-w-xs"},[Xe(" This directory is not initialized as a Git repository. Run "),d("code",{class:"text-retro-cyan"},"git init"),Xe(" to get started. ")],-1))])):m(t).error?(v(),x("div",Pw,[ee(m(_n),{class:"w-10 h-10 text-retro-red mb-3"}),d("p",Tw,B(m(t).error),1),d("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]=Ze=>m(t).loadGitGraph(e.workingDirectory))},[ee(m(us),{class:"w-4 h-4"}),k[46]||(k[46]=Xe(" Retry ",-1))])])):m(t).commits.length===0?(v(),x("div",Mw,[...k[47]||(k[47]=[d("div",{class:"text-retro-muted text-center"},[d("p",null,"No commits found in this repository.")],-1)])])):(v(),x(we,{key:4},[m(ur)?(v(),Oe(T,{key:0,ref_key:"findWidgetRef",ref:vs,resultCount:m(t).searchResultHashes.length,currentIndex:m(t).searchResultIndex,onSearch:Oi,onNext:m(t).nextSearchResult,onPrev:m(t).prevSearchResult,onClose:wn},null,8,["resultCount","currentIndex","onNext","onPrev"])):U("",!0),d("div",Aw,[d("button",{class:Re(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",m(ur)?"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]=Ze=>m(ur)?wn():gi())},[ee(m(ls),{class:"w-4 h-4"})],2),d("div",_w,[d("button",{class:Re(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",m(dr)?"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]=Ze=>dr.value=!m(dr))},[ee(m(D1),{class:"w-4 h-4"})],2),m(dr)?(v(),x("div",Rw,[k[54]||(k[54]=d("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mb-1"}," Graph Style ",-1)),d("label",Bw,[d("input",{type:"radio",name:"graphStyle",value:"rounded",checked:m(t).graphStyle==="rounded",class:"accent-retro-cyan",onChange:k[3]||(k[3]=Ze=>m(t).setGraphStyle("rounded"))},null,40,Zw),k[48]||(k[48]=d("span",{class:"text-sm text-retro-text"},"Rounded",-1))]),d("label",Ew,[d("input",{type:"radio",name:"graphStyle",value:"angular",checked:m(t).graphStyle==="angular",class:"accent-retro-cyan",onChange:k[4]||(k[4]=Ze=>m(t).setGraphStyle("angular"))},null,40,Dw),k[49]||(k[49]=d("span",{class:"text-sm text-retro-text"},"Angular",-1))]),k[55]||(k[55]=d("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Display ",-1)),d("label",Lw,[d("input",{type:"checkbox",checked:m(t).muteNonAncestral,class:"accent-retro-cyan",onChange:k[5]||(k[5]=Ze=>m(t).toggleMuteNonAncestral())},null,40,Xw),k[50]||(k[50]=d("span",{class:"text-sm text-retro-text"},"Mute non-ancestral",-1))]),k[56]||(k[56]=d("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Columns ",-1)),d("label",Iw,[d("input",{type:"checkbox",checked:m(t).columnVisibility.commit!==!1,class:"accent-retro-cyan",onChange:k[6]||(k[6]=Ze=>m(t).toggleColumnVisibility("commit"))},null,40,Vw),k[51]||(k[51]=d("span",{class:"text-sm text-retro-text"},"Hash",-1))]),d("label",zw,[d("input",{type:"checkbox",checked:m(t).columnVisibility.author!==!1,class:"accent-retro-cyan",onChange:k[7]||(k[7]=Ze=>m(t).toggleColumnVisibility("author"))},null,40,Nw),k[52]||(k[52]=d("span",{class:"text-sm text-retro-text"},"Author",-1))]),d("label",Ww,[d("input",{type:"checkbox",checked:m(t).columnVisibility.date!==!1,class:"accent-retro-cyan",onChange:k[8]||(k[8]=Ze=>m(t).toggleColumnVisibility("date"))},null,40,jw),k[53]||(k[53]=d("span",{class:"text-sm text-retro-text"},"Date",-1))])])):U("",!0)]),k[59]||(k[59]=d("span",{class:"flex-1"},null,-1)),d("div",qw,[d("button",{class:Re(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",m(hr)||m(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":m(hr),onClick:k[9]||(k[9]=Ze=>hr.value=!m(hr))},[ee(m(tv),{class:"w-4 h-4"}),m(t).filteredBranches.length>0?(v(),x("span",Fw," ("+B(m(t).filteredBranches.length)+") ",1)):U("",!0)],10,Yw),m(hr)?(v(),x("div",Uw,[k[58]||(k[58]=d("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border"}," Filter by Branch ",-1)),m(t).filteredBranches.length>0?(v(),x("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]=Ze=>m(t).clearFilters())}," Clear All Filters ")):U("",!0),m(Yn).local.length>0?(v(),x(we,{key:1},[k[57]||(k[57]=d("div",{class:"px-3 py-1 text-[10px] text-retro-green font-semibold uppercase tracking-wider mt-1"}," Local ",-1)),(v(!0),x(we,null,Fe(m(Yn).local,Ze=>(v(),x("label",{key:Ze.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[d("input",{type:"checkbox",checked:m(t).filteredBranches.includes(Ze.name),class:"accent-retro-cyan",onChange:Un=>m(t).toggleBranchFilter(Ze.name)},null,40,Gw),d("span",Hw,B(Ze.name),1),Ze.isHead?(v(),x("span",Kw,"(HEAD)")):U("",!0)]))),128))],64)):U("",!0),(v(!0),x(we,null,Fe(m(Yn).remotes,(Ze,Un)=>(v(),x(we,{key:Un},[d("div",Jw,B(Un),1),(v(!0),x(we,null,Fe(Ze,bs=>(v(),x("label",{key:bs.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[d("input",{type:"checkbox",checked:m(t).filteredBranches.includes(bs.name),class:"accent-retro-cyan",onChange:Ah=>m(t).toggleBranchFilter(bs.name)},null,40,eS),d("span",tS,B(bs.name),1)]))),128))],64))),128))])):U("",!0)]),d("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":m(t).isRefreshing}]),"aria-label":"Refresh",title:"Refresh",onClick:k[11]||(k[11]=Ze=>m(t).loadGitGraph(e.workingDirectory))},[ee(m(us),{class:"w-4 h-4"})],2),d("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:vi},[ee(m(qp),{class:"w-4 h-4"})]),d("div",rS,[d("button",{class:Re(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",m(Pr)?"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]=Ze=>Pr.value=!m(Pr))},[ee(m(Yp),{class:"w-4 h-4"})],2),m(Pr)?(v(),x("div",nS,[ee(W,{remotes:m(t).remotes,onAdd:bi,onEdit:xi,onDelete:qn,onClose:k[13]||(k[13]=Ze=>Pr.value=!1)},null,8,["remotes"])])):U("",!0)]),m(Os)&&e.isActive?(v(),x("div",{key:0,class:Re(["flex items-center text-[10px] text-retro-muted",{"text-retro-cyan":m(t).isRefreshing}]),title:m(t).lastRefreshTime?`Last checked: ${new Date(m(t).lastRefreshTime).toLocaleTimeString()}`:"","aria-live":"polite","aria-atomic":"true"},[d("span",{class:Re(["inline-block w-1.5 h-1.5 rounded-full mr-1",m(t).isRefreshing?"bg-retro-cyan animate-pulse":"bg-retro-muted/50"]),"aria-hidden":"true"},null,2),Xe(" "+B(m(Os)),1)],10,sS)):U("",!0)]),d("div",{class:Re(["flex-1 min-h-0 overflow-hidden",{"max-h-[50%]":m(t).selectedCommit||m(t).isUncommittedChangesSelected}])},[ee(le,{ref_key:"commitListRef",ref:nn,commits:m(t).filteredCommits,stashes:m(t).stashes,selectedCommit:m(t).selectedCommit,hasMore:m(t).hasMore,loading:m(t).loading,loadingMore:m(t).loadingMore,searchQuery:m(t).searchQuery,uncommittedChangesCount:m(t).uncommittedChangesCount,isUncommittedChangesSelected:m(t).isUncommittedChangesSelected,highlightBranches:m(di),featureHighlightBranches:m(fi),featureMergeBases:m(Jt),previewHighlightBranches:m(pi),previewMergeBases:m(Et),currentBranchName:m(t).currentBranch?.name,localBranchNames:m(t).localBranchNames,graphStyle:m(t).graphStyle,muteNonAncestral:m(t).muteNonAncestral,columnVisibility:m(t).columnVisibility,onSelect:m(t).selectCommit,onLoadMore:m(t).loadMoreCommits,onBranchContextMenu:m(xe),onCommitContextMenu:m(Mt),onTagContextMenu:m(Qr),onStashContextMenu:m(si),onCompareSelect:yi,onSelectUncommittedChanges:m(t).selectUncommittedChanges,onScrollStart:m(s).startInteraction,onScrollEnd:m(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),m(t).isComparing&&m(t).selectedCommit&&m(t).comparisonCommit?(v(),Oe(be,{key:1,fromCommit:m(t).comparisonCommit,toCommit:m(t).selectedCommit,files:m(t).comparisonFiles,stats:m(t).comparisonStats,loading:m(t).comparisonLoading,onClose:m(t).clearComparison},null,8,["fromCommit","toCommit","files","stats","loading","onClose"])):m(t).selectedCommit?(v(),Oe(de,{key:2,commit:m(t).selectedCommit,files:m(t).selectedCommitFiles,stats:m(t).selectedCommitStats,loading:m(t).isLoadingDetails,detailPosition:m(t).detailViewPosition,onClose:m(t).clearSelection,onNavigateToCommit:Fn,onTogglePosition:m(t).toggleDetailViewPosition,onOpenFileDiff:k[14]||(k[14]=Ze=>m(t).selectedCommit&&m(t).openFileDiff(m(t).selectedCommit.hash,Ze))},null,8,["commit","files","stats","loading","detailPosition","onClose","onTogglePosition"])):U("",!0),m(t).isUncommittedChangesSelected?(v(),Oe(Se,{key:3,stagedFiles:m(t).stagedFiles,unstagedFiles:m(t).unstagedFiles,isStaging:m(t).isStaging,isCommitting:m(t).isCommitting,onClose:m(t).clearSelection,onStageFiles:k[15]||(k[15]=Ze=>m(t).stageFiles(Ze)),onUnstageFiles:k[16]||(k[16]=Ze=>m(t).unstageFiles(Ze)),onStageAll:k[17]||(k[17]=()=>m(t).stageFiles([])),onUnstageAll:k[18]||(k[18]=()=>m(t).unstageFiles([])),onCommit:k[19]||(k[19]=Ze=>m(t).commitChanges(Ze))},null,8,["stagedFiles","unstagedFiles","isStaging","isCommitting","onClose"])):U("",!0)],64)),m(ae).visible?(v(),Oe(qe,{key:5,branchName:m(ae).branch,isCurrentBranch:m(ae).isCurrentBranch,isLocal:m(ae).isLocal,x:m(ae).x,y:m(ae).y,onClose:m(De),onCheckout:m(Ae),onCreateBranch:m(Le),onDeleteBranch:m(Ye),onRename:m(Ue),onMerge:m(pe),onRebase:m(Ce),onPush:m(ce),onPull:m(ue),onFetch:m(Y),onCopyName:m(Me)},null,8,["branchName","isCurrentBranch","isLocal","x","y","onClose","onCheckout","onCreateBranch","onDeleteBranch","onRename","onMerge","onRebase","onPush","onPull","onFetch","onCopyName"])):U("",!0),m(Ve).visible&&m(Ve).commit?(v(),Oe(ot,{key:6,commit:m(Ve).commit,x:m(Ve).x,y:m(Ve).y,onClose:m(Zt),onAddTag:m(bn),onCreateBranch:m(Kt),onCheckout:m(Er),onCherryPick:m($r),onRevert:m(zn),onMergeInto:m(Cr),onReset:m(xn),onCopyHash:m(Nn),onCopySubject:m(yn)},null,8,["commit","x","y","onClose","onAddTag","onCreateBranch","onCheckout","onCherryPick","onRevert","onMergeInto","onReset","onCopyHash","onCopySubject"])):U("",!0),m(xt).visible?(v(),Oe(yt,{key:7,tagName:m(xt).tag,x:m(xt).x,y:m(xt).y,onClose:m(H),onViewDetails:m(fe),onDeleteTag:m(se),onPushTag:m(ve),onCopyName:m(_e)},null,8,["tagName","x","y","onClose","onViewDetails","onDeleteTag","onPushTag","onCopyName"])):U("",!0),m(Dr).visible&&m(Dr).stash?(v(),Oe(Mo,{key:8,stashIndex:m(Dr).stash.index,stashMessage:m(Dr).stash.message,x:m(Dr).x,y:m(Dr).y,onClose:m(ii),onApply:m(oi),onPop:m(ai),onDrop:m(li),onCreateBranch:m(ci),onCopyName:m(ui),onCopyHash:m(hi)},null,8,["stashIndex","stashMessage","x","y","onClose","onApply","onPop","onDrop","onCreateBranch","onCopyName","onCopyHash"])):U("",!0),m(We).visible?(v(),Oe(sn,{key:9,x:m(We).x,y:m(We).y,onClose:m(Ge),onStash:m(it),onReset:m(ri),onClean:m(ni)},null,8,["x","y","onClose","onStash","onReset","onClean"])):U("",!0),m(a).visible?(v(),Oe(ki,{key:10,title:"Checkout",visible:m(a).visible,loading:m(a).loading,error:m(a).error,confirmLabel:"Checkout",onClose:k[20]||(k[20]=Ze=>m(a).visible=!1),onConfirm:m(l)},{default:ct(()=>[d("p",iS,[k[60]||(k[60]=Xe(" Are you sure you want to checkout ",-1)),d("span",oS,B(m(a).branchName),1),k[61]||(k[61]=Xe("? ",-1))])]),_:1},8,["visible","loading","error","onConfirm"])):U("",!0),m(f).visible?(v(),Oe(ki,{key:11,title:"Rename Branch",visible:m(f).visible,loading:m(f).loading,error:m(f).error,confirmLabel:"Rename",onClose:k[23]||(k[23]=Ze=>m(f).visible=!1),onConfirm:m(g)},{default:ct(()=>[d("div",aS,[d("p",lS,[k[62]||(k[62]=Xe(" Rename ",-1)),d("span",cS,B(m(f).branchName),1)]),He(d("input",{"onUpdate:modelValue":k[21]||(k[21]=Ze=>m(f).newName=Ze),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:k[22]||(k[22]=os((...Ze)=>m(g)&&m(g)(...Ze),["enter"]))},null,544),[[Xt,m(f).newName]])])]),_:1},8,["visible","loading","error","onConfirm"])):U("",!0),m(O).visible?(v(),Oe(ik,{key:12,visible:m(O).visible,branchName:m(O).branchName,loading:m(O).loading,error:m(O).error,onClose:k[24]||(k[24]=Ze=>m(O).visible=!1),onConfirm:m(y)},null,8,["visible","branchName","loading","error","onConfirm"])):U("",!0),m(h).visible?(v(),Oe(Ky,{key:13,visible:m(h).visible,branchName:m(h).branchName,isLocal:m(h).isLocal,loading:m(h).loading,error:m(h).error,onClose:k[25]||(k[25]=Ze=>m(h).visible=!1),onConfirm:m(p)},null,8,["visible","branchName","isLocal","loading","error","onConfirm"])):U("",!0),m(P).visible?(v(),Oe(kk,{key:14,visible:m(P).visible,branchName:m(P).branchName,remotes:m(rn),loading:m(P).loading,error:m(P).error,onClose:k[26]||(k[26]=Ze=>m(P).visible=!1),onConfirm:m(A)},null,8,["visible","branchName","remotes","loading","error","onConfirm"])):U("",!0),m(E).visible?(v(),Oe(dk,{key:15,visible:m(E).visible,branchName:m(E).branchName,remotes:m(rn),loading:m(E).loading,error:m(E).error,onClose:k[27]||(k[27]=Ze=>m(E).visible=!1),onConfirm:m(F)},null,8,["visible","branchName","remotes","loading","error","onConfirm"])):U("",!0),m(b).visible?(v(),Oe(Tk,{key:16,visible:m(b).visible,branchName:m(t).currentBranch?.name||"HEAD",ontoBranch:m(b).branchName,loading:m(b).loading,error:m(b).error,onClose:k[28]||(k[28]=Ze=>m(b).visible=!1),onConfirm:m(C)},null,8,["visible","branchName","ontoBranch","loading","error","onConfirm"])):U("",!0),m(I).visible?(v(),Oe(Vy,{key:17,visible:m(I).visible,commitHash:m(I).commitHash,commitMessage:m(I).commitMessage,loading:m(I).loading,error:m(I).error,onClose:k[29]||(k[29]=Ze=>m(I).visible=!1),onConfirm:m(oe)},null,8,["visible","commitHash","commitMessage","loading","error","onConfirm"])):U("",!0),m(ie).visible?(v(),Oe(Ek,{key:18,visible:m(ie).visible,commitHash:m(ie).commitHash,commitMessage:m(ie).commitMessage,loading:m(ie).loading,error:m(ie).error,onClose:k[30]||(k[30]=Ze=>m(ie).visible=!1),onConfirm:m(ne)},null,8,["visible","commitHash","commitMessage","loading","error","onConfirm"])):U("",!0),m(L).visible?(v(),Oe(rw,{key:19,visible:m(L).visible,commitHash:m(L).commitHash,remotes:m(rn),loading:m(L).loading,error:m(L).error,onClose:k[31]||(k[31]=Ze=>m(L).visible=!1),onConfirm:m(D)},null,8,["visible","commitHash","remotes","loading","error","onConfirm"])):U("",!0),m(Z).visible?(v(),Oe(cw,{key:20,visible:m(Z).visible,tagName:m(Z).tagName,remotes:m(rn),loading:m(Z).loading,error:m(Z).error,onClose:k[32]||(k[32]=Ze=>m(Z).visible=!1),onConfirm:m(z)},null,8,["visible","tagName","remotes","loading","error","onConfirm"])):U("",!0),m(q).visible?(v(),Oe(Sw,{key:21,visible:m(q).visible,tagName:m(q).tagName,tagDetail:m(q).tagDetail,loading:m(q).loading,onClose:k[33]||(k[33]=Ze=>m(q).visible=!1)},null,8,["visible","tagName","tagDetail","loading"])):U("",!0),m(c).visible?(v(),Oe(qy,{key:22,visible:m(c).visible,fromCommit:m(c).fromCommit,loading:m(c).loading,error:m(c).error,onClose:k[34]||(k[34]=Ze=>m(c).visible=!1),onConfirm:m(u)},null,8,["visible","fromCommit","loading","error","onConfirm"])):U("",!0),m(N).visible?(v(),Oe(ki,{key:23,title:"Create Branch from Stash",visible:m(N).visible,loading:m(N).loading,error:m(N).error,confirmLabel:"Create Branch",onClose:k[37]||(k[37]=Ze=>m(N).visible=!1),onConfirm:k[38]||(k[38]=Ze=>m(K)(m(me)))},{default:ct(()=>[d("div",uS,[d("p",hS,[k[63]||(k[63]=Xe(" Create a new branch from ",-1)),d("span",dS,"stash@"+B("{")+B(m(N).stashIndex)+B("}"),1)]),He(d("input",{"onUpdate:modelValue":k[35]||(k[35]=Ze=>tt(me)?me.value=Ze: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:k[36]||(k[36]=os(Ze=>m(K)(m(me)),["enter"]))},null,544),[[Xt,m(me)]])])]),_:1},8,["visible","loading","error"])):U("",!0),m(V).visible?(v(),Oe(Wk,{key:24,visible:m(V).visible,loading:m(V).loading,error:m(V).error,onClose:k[39]||(k[39]=Ze=>m(V).visible=!1),onConfirm:m(X)},null,8,["visible","loading","error","onConfirm"])):U("",!0),m(he).visible?(v(),Oe(Vk,{key:25,visible:m(he).visible,loading:m(he).loading,error:m(he).error,onClose:k[40]||(k[40]=Ze=>m(he).visible=!1),onConfirm:m($)},null,8,["visible","loading","error","onConfirm"])):U("",!0),m(w).visible?(v(),Oe(Yy,{key:26,visible:m(w).visible,loading:m(w).loading,error:m(w).error,onClose:k[41]||(k[41]=Ze=>m(w).visible=!1),onConfirm:m(M)},null,8,["visible","loading","error","onConfirm"])):U("",!0),(v(),Oe(xr,{to:"body"},[ee(dn,{name:"fade"},{default:ct(()=>[m(G).visible?(v(),x("div",{key:0,class:"fixed z-50 px-3 py-1.5 text-sm bg-retro-green text-retro-dark rounded shadow-lg",style:Ut({left:`${m(G).x}px`,top:`${m(G).y-40}px`})}," Copied! ",4)):U("",!0)]),_:1})])),(v(),Oe(xr,{to:"body"},[ee(dn,{name:"fade"},{default:ct(()=>[m(t).operationError?(v(),x("div",fS,[ee(m(_n),{class:"w-4 h-4 flex-shrink-0"}),d("span",pS,B(m(t).operationError),1),d("button",{class:"flex-shrink-0 p-0.5 hover:bg-white/20 rounded transition-colors",onClick:k[42]||(k[42]=Ze=>m(t).clearOperationError()),"aria-label":"Dismiss error"},[ee(m(Pt),{class:"w-3.5 h-3.5"})])])):U("",!0)]),_:1})]))])}}}),OS=Gs(gS,[["__scopeId","data-v-52ace892"]]),vS=f1("/app-logo.svg"),bS={class:"flex items-start justify-between gap-2"},xS={class:"flex-1 min-w-0"},yS={class:"flex items-center gap-2"},kS={class:"font-mono text-sm text-retro-text truncate"},wS={class:"text-xs font-mono text-retro-muted mt-1 truncate"},SS={class:"flex items-center gap-1 flex-shrink-0"},$S={key:0,class:"inline-flex items-center gap-1 text-[10px] font-mono text-retro-red",title:"Critical traceability gaps"},CS={key:1,class:"inline-flex items-center gap-1 text-[10px] font-mono text-retro-yellow",title:"Major traceability gaps"},QS={key:2,class:"text-[10px] font-mono text-retro-muted mr-1",title:"Completed tasks / total tasks"},PS={key:3,class:"w-2 h-2 rounded-full bg-retro-green",title:"spec"},TS={key:4,class:"w-2 h-2 rounded-full bg-retro-cyan",title:"plan"},MS={key:5,class:"w-2 h-2 rounded-full bg-retro-yellow",title:"tasks"},AS={class:"flex flex-wrap items-center justify-between gap-1 mt-2"},_S={key:0,class:"flex items-center gap-1"},RS=["title","disabled","onClick"],BS=Ie({__name:"FeatureCard",props:{feature:{},skills:{},isActive:{type:Boolean},criticalAlerts:{},majorAlerts:{}},emits:["select","cascade","openChat","skill"],setup(r,{emit:e}){const t={DocumentCheckIcon:G1,PuzzlePieceIcon:Vh,DocumentMagnifyingGlassIcon:K1,WrenchScrewdriverIcon:lv,SparklesIcon:ol,BeakerIcon:z1,ShieldCheckIcon:Gp,CommandLineIcon:U1,CpuChipIcon:$1,LightBulbIcon:sv},n=r,s=e,i=kr();function o(p){return t[p]||Vh}function a(p){return p.prerequisites.every(f=>n.feature.files.some(g=>g.filename===f))}function l(p){return p.prerequisites.filter(f=>!n.feature.files.some(g=>g.filename===f))}function c(p){return a(p)?`${p.name} (Shift+click: new conversation)`:`Requires: ${l(p).join(", ")}`}const u=J(()=>{const p=i.findConversationByFeature(n.feature.id);return p?i.isConversationStreaming(p.id):!1}),h=J(()=>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(p,f)=>(v(),x("button",{type:"button",class:Re(["w-full p-3 text-left rounded-lg border transition-all duration-200 group",m(h)]),onClick:f[5]||(f[5]=g=>s("select",r.feature.id))},[d("div",bS,[d("div",xS,[d("div",yS,[ee(m(Ds),{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"]),d("span",kS,B(r.feature.id),1)]),d("p",wS,B(r.feature.name),1)]),d("div",SS,[r.criticalAlerts>0?(v(),x("span",$S,[f[6]||(f[6]=d("span",{class:"w-1.5 h-1.5 rounded-full bg-retro-red"},null,-1)),Xe(" "+B(r.criticalAlerts),1)])):U("",!0),r.majorAlerts>0?(v(),x("span",CS,[f[7]||(f[7]=d("span",{class:"w-1.5 h-1.5 rounded-full bg-retro-yellow"},null,-1)),Xe(" "+B(r.majorAlerts),1)])):U("",!0),r.feature.hasTasks?(v(),x("span",QS,B(r.feature.completedTasks)+"/"+B(r.feature.totalTasks),1)):U("",!0),r.feature.hasSpec?(v(),x("span",PS)):U("",!0),r.feature.hasPlan?(v(),x("span",TS)):U("",!0),r.feature.hasTasks?(v(),x("span",MS)):U("",!0)])]),d("div",AS,[r.feature.hasSpec?(v(),x("div",_S,[d("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:f[0]||(f[0]=fr(g=>s("cascade",g,r.feature.id,"clarify"),["stop"]))},[ee(m(Qu),{class:"h-3.5 w-3.5"})]),d("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:f[1]||(f[1]=fr(g=>s("cascade",g,r.feature.id,"plan"),["stop"]))},[ee(m($u),{class:"h-3.5 w-3.5"})]),r.feature.hasPlan?(v(),x("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:f[2]||(f[2]=fr(g=>s("cascade",g,r.feature.id,"tasks"),["stop"]))},[ee(m(Up),{class:"h-3.5 w-3.5"})])):U("",!0),r.feature.hasTasks?(v(),x("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:f[3]||(f[3]=fr(g=>s("cascade",g,r.feature.id,"implement"),["stop"]))},[ee(m(av),{class:"h-3.5 w-3.5"})])):U("",!0),r.skills.length>0?(v(),x(we,{key:2},[f[8]||(f[8]=d("div",{class:"w-px h-4 bg-retro-border mx-0.5"},null,-1)),(v(!0),x(we,null,Fe(r.skills,g=>(v(),x("button",{key:g.id,type:"button",class:Re(["flex items-center justify-center p-1 rounded transition-colors",[a(g)&&!m(u)?"bg-retro-pink/20 text-retro-pink hover:bg-retro-pink/30":"bg-retro-subtle/10 text-retro-subtle cursor-not-allowed",m(u)?"animate-pulse":""]]),title:c(g),disabled:!a(g)||m(u),onClick:fr(O=>s("skill",O,r.feature.id,g.id),["stop"])},[(v(),Oe(Zs(o(g.icon)),{class:"h-3.5 w-3.5"}))],10,RS))),128))],64)):U("",!0)])):U("",!0),r.feature.hasSpec?(v(),x("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:f[4]||(f[4]=fr(g=>s("openChat",g,r.feature.id),["stop"]))},[ee(m(q1),{class:"h-3.5 w-3.5"})])):U("",!0)])],2))}});let Oc=[],Kp=[];(()=>{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?Kp:Oc).push(t=t+r[e])})();function ZS(r){if(r<768)return!1;for(let e=0,t=Oc.length;;){let n=e+t>>1;if(r<Oc[n])t=n;else if(r>=Kp[n])e=n+1;else return!0;if(e==t)return!1}}function Yh(r){return r>=127462&&r<=127487}const Fh=8205;function ES(r,e,t=!0,n=!0){return(t?Jp:DS)(r,e,n)}function Jp(r,e,t){if(e==r.length)return e;e&&em(r.charCodeAt(e))&&tm(r.charCodeAt(e-1))&&e--;let n=$l(r,e);for(e+=Uh(n);e<r.length;){let s=$l(r,e);if(n==Fh||s==Fh||t&&ZS(s))e+=Uh(s),n=s;else if(Yh(s)){let i=0,o=e-2;for(;o>=0&&Yh($l(r,o));)i++,o-=2;if(i%2==0)break;e+=2}else break}return e}function DS(r,e,t){for(;e>0;){let n=Jp(r,e-2,t);if(n<e)return n;e--}return 0}function $l(r,e){let t=r.charCodeAt(e);if(!tm(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return em(n)?(t-55296<<10)+(n-56320)+65536:t}function em(r){return r>=56320&&r<57344}function tm(r){return r>=55296&&r<56320}function Uh(r){return r<65536?1:2}class rt{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]=Xs(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]=Xs(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 Ei(this),i=new Ei(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 Ei(this,e)}iterRange(e,t=this.length){return new rm(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 nm(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]?rt.empty:e.length<=32?new gt(e):jr.from(gt.split(e,[]))}}class gt extends rt{constructor(e,t=LS(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 XS(s,a,n,o);s=a+1,n++}}decompose(e,t,n,s){let i=e<=0&&t>=this.length?this:new gt(Gh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=n.pop(),a=ca(i.text,o.text.slice(),0,i.length);if(a.length<=32)n.push(new gt(a,o.length+i.length));else{let l=a.length>>1;n.push(new gt(a.slice(0,l)),new gt(a.slice(l)))}}else n.push(i)}replace(e,t,n){if(!(n instanceof gt))return super.replace(e,t,n);[e,t]=Xs(this,e,t);let s=ca(this.text,ca(n.text,Gh(this.text,0,e)),t),i=this.length+n.length-(t-e);return s.length<=32?new gt(s,i):jr.from(gt.split(s,[]),i)}sliceString(e,t=this.length,n=`
12
12
  `){[e,t]=Xs(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 gt(n,s)),n=[],s=-1);return s>-1&&t.push(new gt(n,s)),t}}class jr extends rt{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]=Xs(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=`
@@ -64,12 +64,12 @@ import{y as v,z as x,A as d,d as Ie,C as ee,G as m,Q as He,S as Xt,R as tt,I as
64
64
  `,w);break}case"turn_result":{if($.subtype!=="success"&&(r.updateMessage(M.currentMessageId,{status:"error"},w),Z(w),$.subtype==="max_turns"?r.setSessionError("Maximum conversation turns reached. Please start a new conversation.",w):r.setSessionError("Provider reported an execution error.",w)),$.subtype==="success"&&$.usage){oe(M.currentMessageId,w);const R={id:Tr(),type:"result_summary",totalCostUsd:$.totalCostUsd??0,durationMs:$.durationMs??0,numTurns:$.numTurns??0,usage:$.usage};r.appendContentBlockWithSave(M.currentMessageId,R,w)}break}case"error":{r.updateMessage(M.currentMessageId,{status:"error"},w),r.setSessionError($.error,w);break}}}function F($,w){const M=$.replayBuffer;if(M.length===0)return;const R=[];let G="",ae=null,xe=null;const De=new Map;let Ae="streaming",Ue=!1;for(const Ye of M){if(Ye.type==="done"){Ye.denied?(I(R,"error"),Ae="stopped"):Ae==="error"||Ae==="stopped"?I(R,"error"):(I(R,"complete"),Ae="complete"),Ue=!0;continue}if(Ye.type==="error"){I(R,"error"),Ae="error";continue}if(Ye.type!=="ui_event"||!Ye.event)continue;const pe=Ye.event;switch(pe.sessionId&&r.setProviderSessionId(pe.sessionId,w),pe.type){case"session_init":{const Ce={id:Tr(),type:"session_init",model:pe.model,tools:pe.tools,permissionMode:pe.permissionMode,cwd:pe.cwd};R.push(Ce);break}case"block_start":{const Ce=pe.blockId||Tr();if(pe.blockType==="text"){const ce={id:Ce,type:"text",text:pe.text||""};R.push(ce),ae=Ce,pe.text&&(G+=pe.text)}else if(pe.blockType==="thinking"){const ce={id:Ce,type:"thinking",thinking:pe.thinking||""};R.push(ce),xe=Ce}else if(pe.blockType==="tool_use"&&pe.toolUseId&&pe.name){const ce={id:Ce,type:"tool_use",toolUseId:pe.toolUseId,name:pe.name,input:{},inputSummary:"",status:"running"};R.push(ce),De.set(pe.index??0,{blockId:Ce,toolUseId:pe.toolUseId,name:pe.name,inputJson:""})}break}case"block_delta":{if(pe.text&&ae){const Ce=R.find(ce=>ce.id===ae);Ce&&Ce.type==="text"&&(Ce.text+=pe.text,G+=pe.text)}if(pe.thinking&&xe){const Ce=R.find(ce=>ce.id===xe);Ce&&Ce.type==="thinking"&&(Ce.thinking+=pe.thinking)}if(pe.partialJson){let Ce;if(pe.index!==void 0&&(Ce=De.get(pe.index)),!Ce&&pe.blockId){for(const[,ce]of De)if(ce.blockId===pe.blockId){Ce=ce;break}}Ce&&(Ce.inputJson+=pe.partialJson)}break}case"block_end":{let Ce;if(pe.index!==void 0&&(Ce=De.get(pe.index)),!Ce&&pe.blockId){for(const[,ce]of De)if(ce.blockId===pe.blockId){Ce=ce;break}}if(Ce||(ae&&(ae=null),xe&&(xe=null)),Ce){let ce={};try{ce=JSON.parse(Ce.inputJson)}catch{}const ue=R.find(Y=>Y.id===Ce.blockId);if(ue&&ue.type==="tool_use"){const Y=ue;Y.input=ce,Y.inputSummary=Tp(ce),Y.status="pending"}}break}case"tool_result":{const Ce=R.find(ue=>ue.type==="tool_use"&&ue.toolUseId===pe.toolUseId);Ce&&Ce.type==="tool_use"&&(Ce.status=pe.isError?"error":"complete");const ce={id:Tr(),type:"tool_result",toolUseId:pe.toolUseId,content:pe.content||"",isError:!!pe.isError};R.push(ce);break}case"turn_result":{if(pe.subtype!=="success"&&(Ae="error"),pe.subtype==="success"&&pe.usage){const Ce={id:Tr(),type:"result_summary",totalCostUsd:pe.totalCostUsd??0,durationMs:pe.durationMs??0,numTurns:pe.numTurns??0,usage:pe.usage};R.push(Ce)}break}case"error":{Ae="error";break}}}r.batchSetMessageBlocks($.currentMessageId,R,G,Ae,w),$.currentTextBlockId=ae,$.currentThinkingBlockId=xe,$.activeTools=De,Ue&&(o($),r.endSession(w),r.endConversationStreaming(w),s(w)),console.log(`[useChatStream] Replay batch processed: ${M.length} events → ${R.length} blocks, status=${Ae}`)}function I($,w){for(const M of $)if(M.type==="tool_use"){const R=M;(R.status==="running"||R.status==="pending")&&(R.status=w)}}function oe($,w){r.initContentBlocks($,w)}function ie($,w,M){oe($,M);const R={id:Tr(),type:"text",text:w};r.appendContentBlockWithSave($,R,M)}async function ne($,w,M,R){if(typeof window>"u")return;const G=j_();try{const ae=await f(M),xe=pt.get(M);xe&&(xe.currentMessageId=w,xe.activeTools.clear(),xe.currentTextBlockId=null,xe.currentThinkingBlockId=null,a(xe)),W_($)&&r.setProviderSessionId("",M);const Ae=r.getProviderSessionId(M),Ue=r.conversations.find(ce=>ce.id===M),Ye=Ue?.providerId||e.providerSelection.providerId||Lp,pe=Ue?.providerModelKey||e.providerSelection.modelKey||Dp;Ue&&(!Ue.providerId||!Ue.providerModelKey)&&(r.setConversationProviderSelection(M,Ye,pe),r.saveConversation(M,!0));const Ce={type:"chat",message:$,attachments:R?.attachments,requestId:G,sessionId:Ae||void 0,permissionMode:r.permissionMode,conversationId:M,cwd:R?.cwd,worktreeBranch:R?.worktreeBranch,featureId:R?.featureId,providerId:Ye,providerModelKey:pe};r.pushDebugEvent({direction:"out",channel:"ws",eventType:"chat",payload:Ce},M),ae.send(JSON.stringify(Ce))}catch(ae){r.updateMessage(w,{status:"error"},M),r.setSessionError(ae.message||"Connection failed",M),r.endSession(M),r.endConversationStreaming(M),r.saveConversation(M,!0),c(M)}}function L($,w){const M=w??r.activeConversationId;if(!M)return;const R=pt.get(M);if(!R||R.ws.readyState!==WebSocket.OPEN)return;const G={type:"permission_response",allow:$};r.pushDebugEvent({direction:"out",channel:"ws",eventType:"permission_response",payload:G},M),R.ws.send(JSON.stringify(G)),$&&(r.startConversationStreaming(M),a(R));const ae=$?"Allowed":"Denied";ie(R.currentMessageId,`${ae}
65
65
  `,M),r.clearPendingPermission(M)}function D($,w,M){Qn.set(w,{featureId:$,queue:[...M]})}function Z($){$?Qn.delete($):Qn.clear()}async function z($,w,M){r.activeConversationId!==$&&r.selectConversation($);const R=r.conversations.find(De=>De.id===$);let G;if(M.startsWith("skill:")){const De=M.replace("skill:","");try{G=(await $fetch(`/api/skills/${De}/prompt`,{method:"POST",body:{featureId:w,cwd:R?.worktreePath}})).prompt}catch(Ae){console.error(`[useChatStream] Failed to render skill prompt for ${De}:`,Ae);return}}else G=`/speckit.${M} ${w}`;r.addUserMessage(G,$),r.saveConversation($,!0);const ae=r.addAssistantMessage($);r.startSession(Pp(),$),r.startConversationStreaming($);const xe=ka(R);await ne(G,ae.id,$,xe)}async function q($,w,M=0){if(!(typeof window>"u"))try{const R=await f($),G=pt.get($);G&&(G.currentMessageId=w,G.activeTools.clear(),G.currentTextBlockId=null,G.currentThinkingBlockId=null,a(G)),r.startConversationStreaming($);const ae={type:"subscribe",conversationId:$,cursor:M};r.pushDebugEvent({direction:"out",channel:"ws",eventType:"subscribe",payload:ae},$),R.send(JSON.stringify(ae))}catch(R){console.error(`[useChatStream] Failed to subscribe to ${$}:`,R),r.setSessionError(R.message||"Subscribe failed",$)}}function V($){const w=$??r.activeConversationId;if(!w)return;const M=pt.get(w);if(M){if(M.ws.readyState===WebSocket.OPEN){const R={type:"abort"};r.pushDebugEvent({direction:"out",channel:"ws",eventType:"abort",payload:R},w),M.ws.send(JSON.stringify(R)),M.ws.close()}M.currentMessageId&&(h(M.currentMessageId,w,"error"),r.updateMessage(M.currentMessageId,{status:"stopped"},w),r.endSession(w),r.saveConversation(w,!0)),pt.delete(w)}r.endConversationStreaming(w),r.clearPendingPermission(w),Z(w)}function X($){const w=pt.get($);w&&(o(w),w.ws.close(),pt.delete($)),Qn.delete($)}function N(){for(const[$,w]of pt)o(w),w.ws.close(),pt.delete($);Qn.clear()}async function me($){const w=$??r.activeConversationId;if(!w)return;r.clearPendingPlanApproval(w),r.setPermissionMode("auto");const M="Approved. Proceed with the implementation.";r.addUserMessage(M,w),r.saveConversation(w,!0);const R=r.addAssistantMessage(w);r.startSession(Pp(),w),r.startConversationStreaming(w);const G=r.conversations.find(xe=>xe.id===w),ae=ka(G,!0);await ne(M,R.id,w,ae)}function K($){const w=$??r.activeConversationId;w&&r.clearPendingPlanApproval(w)}async function he($){if(typeof window>"u")return!1;try{const w=await $fetch("/api/jobs",{params:{conversationId:$}}),R=w.find(xe=>xe.status==="running"||xe.status==="waiting_permission"||xe.status==="queued")||[...w].sort((xe,De)=>De.eventCount-xe.eventCount).find(xe=>xe.eventCount>0),G=r.conversations.find(xe=>xe.id===$);if(!G)return!1;const ae=[...G.messages].reverse().find(xe=>xe.role==="assistant");return R?!ae||ae.status!=="streaming"?!1:(console.log("[useChatStream] Resuming streaming for",$,"job:",R.id,"status:",R.status,"events:",R.eventCount),r.resetMessageForReplay(ae.id,$),r.startSession(`resume-${Date.now()}`,$),await q($,ae.id,0),!0):(ae&&ae.status==="streaming"&&(r.updateMessage(ae.id,{status:"error"},$),r.setSessionError("Streaming was interrupted (server job no longer active)",$)),!1)}catch(w){return console.error("[useChatStream] Failed to resume streaming:",w),!1}}return St(()=>{oa--,oa<=0&&(oa=0,N())}),{sendMessage:ne,sendPermissionResponse:L,subscribe:q,tryResumeStreaming:he,approvePlan:me,rejectPlan:K,abort:V,disconnect:N,disconnectConversation:X,enableCascade:D,disableCascade:Z,resetContext:p}}const G_={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},H_={class:"px-4 py-3 border-b border-retro-border flex items-center justify-between"},K_=["disabled"],J_={class:"px-4 py-4 space-y-3"},eR={class:"relative"},tR=["disabled"],rR={key:0,value:""},nR=["value"],sR={key:0,class:"text-xs font-mono text-retro-red"},iR={key:1,class:"text-xs font-mono text-retro-muted"},oR={class:"px-4 py-3 border-t border-retro-border flex items-center gap-2 justify-end"},aR=["disabled"],lR=["disabled"],bu=Ie({__name:"NewConversationModal",props:{show:{type:Boolean},creating:{type:Boolean}},emits:["close","create"],setup(r,{emit:e}){const t=yu(),n=r,s=e,i=_([]),o=_(""),a=_(!1),l=_(""),c=J(()=>!a.value&&!n.creating&&o.value.length>0&&i.value.length>0);async function u(){a.value=!0,l.value="";try{await t.initialize();const p=await $fetch("/api/git/branches",{query:{excludeSc:!0,workingDirectory:t.workingDirectory}}),f=p.branches.filter(O=>!O.isRemote).map(O=>O.name);if(i.value=f,!f.length){o.value="",l.value="No local branches available for chat creation.";return}const g=(p.current&&f.includes(p.current)?p.current:"")||(f.includes("main")?"main":"")||(f.includes("master")?"master":"")||f[0];o.value=g}catch(p){i.value=[],o.value="",l.value=p instanceof Error?p.message:"Failed to load branches"}finally{a.value=!1}}ze(()=>n.show,p=>{p&&u()});function h(){c.value&&s("create",o.value)}return(p,f)=>(v(),Oe(xr,{to:"body"},[ee(dn,{"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.show?(v(),x("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:f[3]||(f[3]=fr(g=>s("close"),["self"]))},[d("div",G_,[d("div",H_,[f[4]||(f[4]=d("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"New Conversation",-1)),d("button",{type:"button",class:"p-1 text-retro-muted hover:text-retro-text transition-colors",disabled:r.creating,onClick:f[0]||(f[0]=g=>s("close"))},[ee(m(Pt),{class:"w-4 h-4"})],8,K_)]),d("div",J_,[f[5]||(f[5]=d("label",{class:"block text-xs font-mono text-retro-muted"},"Base Branch",-1)),d("div",eR,[He(d("select",{"onUpdate:modelValue":f[1]||(f[1]=g=>o.value=g),disabled:a.value||r.creating||i.value.length===0,class:"w-full appearance-none bg-retro-black border border-retro-border rounded px-2 py-1.5 pr-7 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan disabled:opacity-40"},[a.value?(v(),x("option",rR,"Loading branches...")):U("",!0),(v(!0),x(we,null,Fe(i.value,g=>(v(),x("option",{key:g,value:g},B(g),9,nR))),128))],8,tR),[[ms,o.value]]),ee(m(Su),{class:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})]),l.value?(v(),x("p",sR,B(l.value),1)):(v(),x("p",iR," The conversation worktree will be created from the selected branch. "))]),d("div",oR,[d("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",disabled:r.creating,onClick:f[2]||(f[2]=g=>s("close"))}," Cancel ",8,aR),d("button",{type:"button",disabled:!c.value,class:"px-3 py-1.5 text-xs font-mono rounded border bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:h},B(r.creating?"Creating...":"Create"),9,lR)])])])):U("",!0)]),_:1})]))}}),cR={class:"h-full flex flex-col bg-retro-black"},uR={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border"},hR={class:"flex items-center gap-1"},dR={class:"flex-shrink-0 px-3 pt-3"},fR={class:"relative"},pR={class:"flex-1 overflow-y-auto p-3"},mR={class:"space-y-2"},gR={key:0,class:"flex items-center justify-center py-12"},OR={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},vR={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},bR=Ie({__name:"FeaturesPanel",setup(r){const e=kr(),t=ll(),{sendMessage:n,enableCascade:s}=Sl(),i=mo(),o=_("features"),a=_(null),l=_(null),c=_([]),u=_([]),h=_(!1),p=_({}),f=_(!1),g=_(null),O=_(!1),y=_(!1),b=_(!1),C=_(null),P=_(""),A=_("");let E=null;ze(P,ce=>{E&&clearTimeout(E),E=setTimeout(()=>{A.value=ce},300)});const F=J(()=>{const ce=A.value.trim().toLowerCase();return ce?c.value.filter(ue=>ue.name.toLowerCase().includes(ce)||ue.id.toLowerCase().includes(ce)):c.value}),I=_({}),oe=J(()=>{const ce=e.activeConversation;if(!ce)return null;if(ce.featureId)return ce.featureId;const ue=ce.worktreeBranch?.trim();return ue&&c.value.some(Y=>Y.id===ue)?ue:null}),ie=J(()=>oe.value||a.value);ze(()=>e.activeConversationId,()=>{a.value=null;const ce=oe.value;t.setSelectedFeatureId(ce),ce&&br(()=>{const ue=I.value[ce];ue&&ue.scrollIntoView({behavior:"auto",block:"nearest"})})}),ze(a,ce=>{ce&&br(()=>{const ue=I.value[ce];ue&&ue.scrollIntoView({behavior:"auto",block:"nearest"})})});async function ne(){h.value=!0;try{const ce=await $fetch("/api/specs/features");c.value=ce.features,L(ce.features)}catch{i.error("Failed to load features"),c.value=[],p.value={}}finally{h.value=!1}}async function L(ce){if(ce.length===0){p.value={};return}const ue=await Promise.allSettled(ce.map(async Me=>{const Le=await $fetch(`/api/specs/traceability/${Me.id}`),Ve=Le.alerts.filter(Zt=>Zt.severity==="critical").length,Mt=Le.alerts.filter(Zt=>Zt.severity==="major").length;return{featureId:Me.id,critical:Ve,major:Mt}})),Y={};for(const Me of ue)Me.status==="fulfilled"&&(Y[Me.value.featureId]={critical:Me.value.critical,major:Me.value.major});p.value=Y}async function D(){try{const ce=await $fetch("/api/skills");u.value=ce.skills}catch{u.value=[]}}mt(()=>{ne(),D(),window.addEventListener("keydown",q)}),St(()=>{window.removeEventListener("keydown",q)});function Z(ce,ue={}){if(a.value=ce,l.value=null,o.value="files",t.setSelectedFeatureId(ce),ue.openViewer!==!1){const Y=c.value.find(Me=>Me.id===ce);Y&&(g.value=Y,f.value=!0)}}function z(){f.value=!1,g.value=null}function q(ce){(ce.ctrlKey||ce.metaKey)&&ce.key.toLowerCase()==="k"&&(ce.preventDefault(),O.value||(O.value=!0))}function V(){O.value=!1}function X(ce){Z(ce,{openViewer:!1}),O.value=!1}function N(){O.value=!0}const me=J(()=>c.value.map(ce=>ce.id));function K(ce){return p.value[ce]??{critical:0,major:0}}const he={plan:["tasks","implement"],tasks:["implement"],implement:[],clarify:[],analyze:[]},$={analyze:["skill:better-spec"]};async function w(ce,ue,Y){if(ce.startsWith("skill:")){const Me=ce.replace("skill:",""),Le=Y?e.conversations.find(Mt=>Mt.id===Y):null;return(await $fetch(`/api/skills/${Me}/prompt`,{method:"POST",body:{featureId:ue,cwd:Le?.worktreePath}})).prompt}return`/speckit.${ce} ${ue}`}function M(ce,ue){if(ue)return null;const Y=e.findConversationByFeature(ce);return Y&&!e.isConversationStreaming(Y.id)&&!Y.finalized?(e.selectConversation(Y.id),Y.id):null}function R(ce){const ue=e.findConversationByFeature(ce);return ue&&ue.finalized?(i.error(`This feature has a finalized conversation "${ue.title}". Please archive it first to start a new conversation.`),e.selectConversation(ue.id),!0):!1}async function G(ce,ue,Y){const Me=await e.createConversation({featureId:ce,baseBranch:Y});if(!Me)throw new Error("Failed to create conversation");return e.renameConversation(Me,ue),e.selectConversation(Me),Me}async function ae(ce,ue){e.addUserMessage(ue,ce),e.saveConversation(ce,!0);const Y=e.conversations.find(Ve=>Ve.id===ce),Me=e.addAssistantMessage(ce);e.startSession(`session-${Date.now()}`,ce),e.startConversationStreaming(ce);const Le={};Y?.worktreePath&&(Le.cwd=Y.worktreePath,Le.worktreeBranch=Y.worktreeBranch),Y?.featureId&&(Le.featureId=Y.featureId),await n(ue,Me.id,ce,Object.keys(Le).length>0?Le:void 0)}async function xe(ce,ue,Y){const Me=$[ue];let Le;if(Me&&Me.length>0){const Ve=[...Me.slice(1),ue,...he[ue]||[]];s(ce,Y,Ve);const Mt=Me[0];try{Le=await w(Mt,ce,Y)}catch(Zt){i.error(Zt instanceof Error?Zt.message:"Failed to resolve prerequisite step");return}}else{const Ve=he[ue]||[];Ve.length>0&&s(ce,Y,Ve),Le=`/speckit.${ue} ${ce}`}await ae(Y,Le)}async function De(ce,ue,Y){const Me=ce.shiftKey;if(!Me&&R(ue))return;const Le=M(ue,Me);if(Le){try{await xe(ue,Y,Le)}catch(Ve){i.error(Ve instanceof Error?Ve.message:"Failed to run cascade action")}return}C.value={type:"cascade",featureId:ue,command:Y,title:`${Y}: ${ue}`},y.value=!0}async function Ae(ce,ue){R(ue)||(C.value={type:"open-chat",featureId:ue,title:`spec: ${ue}`},y.value=!0)}async function Ue(ce,ue,Y){let Me;try{const Le=e.conversations.find(Ve=>Ve.id===Y);Me=await $fetch(`/api/skills/${ue}/prompt`,{method:"POST",body:{featureId:ce,cwd:Le?.worktreePath}})}catch(Le){throw new Error(Le instanceof Error?Le.message:"Failed to render skill prompt")}await ae(Y,Me.prompt)}async function Ye(ce,ue,Y){const Me=ce.shiftKey;if(!Me&&R(ue))return;const Le=M(ue,Me);if(Le){try{await Ue(ue,Y,Le)}catch(Ve){i.error(Ve instanceof Error?Ve.message:"Failed to run skill")}return}C.value={type:"skill",featureId:ue,skillId:Y,title:`skill: ${Y} — ${ue}`},y.value=!0}function pe(){y.value=!1,C.value=null}async function Ce(ce){if(C.value){b.value=!0;try{const ue=C.value,Y=await G(ue.featureId,ue.title,ce);ue.type==="cascade"?await xe(ue.featureId,ue.command,Y):ue.type==="skill"&&await Ue(ue.featureId,ue.skillId,Y),y.value=!1,C.value=null}catch(ue){i.error(ue instanceof Error?ue.message:"Failed to create conversation")}finally{b.value=!1}}}return(ce,ue)=>{const Y=BS,Me=O_,Le=N_;return v(),x("div",cR,[d("div",uR,[ue[2]||(ue[2]=d("div",{class:"flex items-center gap-2 min-w-0"},null,-1)),d("div",hR,[d("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Search (Ctrl/Cmd+K)",onClick:N},[ee(m(ls),{class:"h-4 w-4"})]),d("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Refresh",onClick:ne},[ee(m(us),{class:Re(["h-4 w-4",{"animate-spin":m(h)}])},null,8,["class"])])])]),d("div",dR,[d("div",fR,[ee(m(ls),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-retro-subtle"}),He(d("input",{"onUpdate:modelValue":ue[0]||(ue[0]=Ve=>tt(P)?P.value=Ve:null),type:"text",placeholder:"Search features...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono rounded border border-retro-border bg-retro-panel text-retro-text placeholder:text-retro-subtle focus:outline-none focus:border-retro-cyan transition-colors"},null,512),[[Xt,m(P)]])])]),d("div",pR,[d("div",mR,[(v(!0),x(we,null,Fe(m(F),Ve=>(v(),x("div",{key:Ve.id,ref_for:!0,ref:Mt=>{m(I)[Ve.id]=Mt}},[ee(Y,{feature:Ve,skills:m(u),"is-active":m(ie)===Ve.id,"critical-alerts":K(Ve.id).critical,"major-alerts":K(Ve.id).major,onSelect:ue[1]||(ue[1]=Mt=>Z(Mt,{openViewer:!0})),onCascade:De,onOpenChat:Ae,onSkill:Ye},null,8,["feature","skills","is-active","critical-alerts","major-alerts"])]))),128))]),m(h)&&m(c).length===0?(v(),x("div",gR,[...ue[3]||(ue[3]=[d("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading features...",-1)])])):U("",!0),!m(h)&&m(c).length>0&&m(F).length===0?(v(),x("div",OR,[ee(m(ls),{class:"h-10 w-10 text-retro-subtle mb-3"}),ue[4]||(ue[4]=d("p",{class:"text-sm font-mono text-retro-muted"},"No matching features",-1)),ue[5]||(ue[5]=d("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Try a different search term ",-1))])):U("",!0),!m(h)&&m(c).length===0?(v(),x("div",vR,[ee(m(ev),{class:"h-10 w-10 text-retro-subtle mb-3"}),ue[6]||(ue[6]=d("p",{class:"text-sm font-mono text-retro-muted"},"No features found",-1)),ue[7]||(ue[7]=d("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Create a feature in specs/ to get started ",-1))])):U("",!0)]),m(f)&&m(g)?(v(),Oe(Me,{key:0,feature:m(g),onClose:z},null,8,["feature"])):U("",!0),m(O)?(v(),Oe(Le,{key:1,"available-feature-ids":m(me),onClose:V,onSelect:X},null,8,["available-feature-ids"])):U("",!0),ee(bu,{show:m(y),creating:m(b),onClose:pe,onCreate:Ce},null,8,["show","creating"])])}}}),xR={class:"h-full flex flex-col bg-retro-black"},yR={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border space-y-2"},kR={class:"flex items-center justify-between gap-2"},wR={class:"flex items-center gap-1"},SR={class:"relative"},$R=["placeholder"],CR={key:0,class:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-retro-yellow/10 border-b border-retro-yellow/30 text-xs"},QR={class:"text-retro-yellow font-mono"},PR={class:"flex-1 overflow-y-auto p-2"},TR={key:0,class:"space-y-1"},MR={key:1,class:"text-center py-6 text-retro-muted"},AR={class:"font-mono text-xs"},_R={key:1,class:"text-center py-8 text-retro-muted"},RR={key:0,class:"space-y-2"},BR={class:"flex items-start justify-between gap-2"},ZR={class:"min-w-0"},ER={class:"text-sm font-mono text-retro-text truncate"},DR={class:"text-xs text-retro-muted mt-1 truncate"},LR={class:"text-xs text-retro-muted/70 mt-1"},XR={class:"text-xs text-retro-muted/70"},IR={class:"flex items-center gap-1 flex-shrink-0"},VR=["onClick"],zR=["onClick"],NR={key:1,class:"text-center py-6 text-retro-muted"},WR={class:"font-mono text-xs"},jR={key:1,class:"text-center py-8 text-retro-muted"},qR=Ie({__name:"ConversationsPanel",setup(r){const e=kr(),t=mo(),n=_(""),s=_(""),i=_(!1),o=_(!1),a=_(!1),l=_(!1),c=_(null);let u=null;ze(n,V=>{u&&clearTimeout(u),u=setTimeout(()=>{s.value=V},180)},{immediate:!0}),St(()=>{u&&(clearTimeout(u),u=null)});const h=new Map,p=new Map;ze(()=>e.sortedConversations.map(V=>V.id),V=>{const X=new Set(V);for(const N of h.keys())X.has(N)||h.delete(N)},{immediate:!0}),ze(()=>e.sortedArchivedConversations.map(V=>V.id),V=>{const X=new Set(V);for(const N of p.keys())X.has(N)||p.delete(N)},{immediate:!0});function f(V){const X=V.messages[V.messages.length-1];return[V.updatedAt,V.title,V.messages.length,X?.id||"",X?.content?.length||0].join("|")}function g(V){const X=V.messages[V.messages.length-1];return[V.updatedAt,V.archivedAt,V.title,V.messages.length,X?.id||"",X?.content?.length||0].join("|")}function O(V){const X=f(V),N=h.get(V.id);if(N&&N.signature===X)return N.text;const me=[V.title,...V.messages.map(K=>K.content||"")].join(`
66
66
  `).toLowerCase();return h.set(V.id,{signature:X,text:me}),me}function y(V){const X=g(V),N=p.get(V.id);if(N&&N.signature===X)return N.text;const me=[V.title,...V.messages.map(K=>K.content||"")].join(`
67
- `).toLowerCase();return p.set(V.id,{signature:X,text:me}),me}const b=J(()=>e.conversationViewMode==="archive"),C=J(()=>{const V=e.sortedConversations;if(!s.value.trim())return V;const X=s.value.toLowerCase().trim();return V.filter(N=>O(N).includes(X))}),P=J(()=>{const V=e.sortedArchivedConversations;if(!s.value.trim())return V;const X=s.value.toLowerCase().trim();return V.filter(N=>y(N).includes(X))}),A=J(()=>e.previewingConversationId);async function E(){if(e.checkStorageLimits().atLimit){t.error("Delete or archive a conversation first (limit: 100).");return}i.value=!0}async function F(V){o.value=!0;try{if(!await e.createConversation({baseBranch:V})){t.error("Failed to create conversation");return}i.value=!1}catch(X){t.error(X instanceof Error?X.message:"Failed to create conversation")}finally{o.value=!1}}function I(V){e.selectConversation(V),e.setConversationViewMode("active")}async function oe(V){const X=await e.archiveConversation(V);if(!X.success){t.error(X.error||"Failed to archive conversation");return}t.success("Conversation archived")}async function ie(V){c.value=V,a.value=!0}function ne(){a.value=!1,c.value=null}async function L(V){if(c.value){l.value=!0;try{const X=await e.restoreArchivedConversation(c.value,V);if(!X.success){t.error(X.error||"Failed to restore archived conversation");return}t.success("Archived conversation restored"),a.value=!1,c.value=null}finally{l.value=!1}}}async function D(V){const X=await e.deleteArchivedConversation(V);if(!X.success){t.error(X.error||"Failed to delete archived conversation");return}t.success("Archived conversation deleted")}function Z(V,X){e.renameConversation(V,X)}function z(V){return new Date(V).toLocaleString()}function q(V){if(!V.length)return"No messages";const N=(V[V.length-1].content||"").trim();return N?N.length>80?`${N.slice(0,80)}...`:N:"No messages"}return(V,X)=>(v(),x("div",xR,[d("div",yR,[d("div",kR,[d("button",{onClick:E,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"New conversation","aria-label":"New conversation"},[ee(m(sl),{class:"w-4 h-4"})]),d("div",wR,[d("button",{onClick:X[0]||(X[0]=N=>m(e).setConversationViewMode("active")),class:Re(["p-1.5 rounded transition-colors",b.value?"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel":"text-retro-cyan bg-retro-cyan/10"]),title:"Active conversations","aria-label":"Active conversations"},[ee(m(j1),{class:"w-4 h-4"})],2),d("button",{onClick:X[1]||(X[1]=N=>m(e).setConversationViewMode("archive")),class:Re(["p-1.5 rounded transition-colors",b.value?"text-retro-cyan bg-retro-cyan/10":"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel"]),title:"Archived conversations","aria-label":"Archived conversations"},[ee(m(Zh),{class:"w-4 h-4"})],2)])]),d("div",SR,[ee(m(ls),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted"}),He(d("input",{"onUpdate:modelValue":X[2]||(X[2]=N=>n.value=N),type:"text",placeholder:b.value?"Search archive...":"Search conversations...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono bg-retro-black border border-retro-border rounded focus:border-retro-cyan focus:outline-none focus:ring-1 focus:ring-retro-cyan text-retro-text placeholder-retro-muted"},null,8,$R),[[Xt,n.value]])])]),m(e).isNearStorageLimit?(v(),x("div",CR,[ee(m(_n),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),d("p",QR,B(m(e).conversationCount)+" active conversations. Limit is 100. ",1)])):U("",!0),d("div",PR,[b.value?(v(),x(we,{key:1},[m(e).hasArchivedConversations?(v(),x("div",RR,[P.value.length>0?(v(!0),x(we,{key:0},Fe(P.value,(N,me,K,he)=>{const $=[N.id,N.title,N.updatedAt,N.archivedAt,N.messages.length];if(he&&he.key===N.id&&_h(he,$))return he;const w=(v(),x("div",{key:N.id,onClick:M=>ie(N.id),onKeydown:[os(fr(M=>ie(N.id),["prevent"]),["enter"]),os(fr(M=>ie(N.id),["prevent"]),["space"])],class:"w-full text-left p-3 rounded border border-retro-border hover:border-retro-cyan/50 hover:bg-retro-cyan/5 transition-colors",role:"button",tabindex:"0"},[d("div",BR,[d("div",ZR,[d("h3",ER,B(N.title),1),d("p",DR,B(q(N.messages)),1),d("p",LR," Archived: "+B(z(N.archivedAt)),1),d("p",XR," Updated: "+B(z(N.updatedAt)),1)]),d("div",IR,[d("button",{onClick:fr(M=>ie(N.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-retro-cyan/40 text-retro-cyan rounded hover:bg-retro-cyan/10 transition-colors",title:"Restore archived conversation"},[ee(m(Zh),{class:"w-3.5 h-3.5"}),X[9]||(X[9]=Xe(" Restore ",-1))],8,VR),d("button",{onClick:fr(M=>D(N.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-red-400/40 text-red-300 rounded hover:bg-red-500/10 transition-colors",title:"Delete archived conversation"},[ee(m(fn),{class:"w-3.5 h-3.5"}),X[10]||(X[10]=Xe(" Delete ",-1))],8,zR)])])],40,["onClick","onKeydown"]));return w.memo=$,w},X,5),128)):(v(),x("div",NR,[d("p",WR,'No archived results for "'+B(n.value)+'"',1)]))])):(v(),x("div",jR,[...X[11]||(X[11]=[d("p",{class:"font-mono text-sm"},"No archived conversations",-1),d("p",{class:"text-xs mt-1"},"Archived conversations will appear here",-1)])]))],64)):(v(),x(we,{key:0},[m(e).hasConversations?(v(),x("div",TR,[C.value.length>0?(v(!0),x(we,{key:0},Fe(C.value,(N,me,K,he)=>{const $=[N.id,N.title,N.updatedAt,N.messages.length,N.finalized,N.id===m(e).activeConversationId,m(e).isConversationStreaming(N.id),A.value===N.id];if(he&&he.key===N.id&&_h(he,$))return he;const w=(v(),x("div",{key:N.id},[ee(C1,{conversation:N,"is-active":N.id===m(e).activeConversationId,"is-streaming":m(e).isConversationStreaming(N.id),"is-previewing":A.value===N.id,onSelect:M=>I(N.id),onArchive:M=>oe(N.id),onRename:M=>Z(N.id,M)},null,8,["conversation","is-active","is-streaming","is-previewing","onSelect","onArchive","onRename"])]));return w.memo=$,w},X,3),128)):(v(),x("div",MR,[d("p",AR,'No results for "'+B(n.value)+'"',1)]))])):(v(),x("div",_R,[...X[8]||(X[8]=[d("p",{class:"font-mono text-sm"},"No conversations",-1),d("p",{class:"text-xs mt-1"},'Click "New" to start',-1)])]))],64))]),ee(bu,{show:i.value,creating:o.value,onClose:X[7]||(X[7]=N=>i.value=!1),onCreate:F},null,8,["show","creating"]),ee(bu,{show:a.value,creating:l.value,onClose:ne,onCreate:L},null,8,["show","creating"])]))}}),YR={mobile:768,tablet:1024};function FR(r,e){return r<e.mobile?"mobile":r<e.tablet?"tablet":"desktop"}const i1=xu("layout",{state:()=>({currentViewport:"desktop",chatFullscreen:!1}),getters:{isMobile:r=>r.currentViewport==="mobile",isTablet:r=>r.currentViewport==="tablet",isDesktop:r=>r.currentViewport==="desktop",isChatFullscreen:r=>r.chatFullscreen},actions:{updateViewport(r){this.currentViewport=FR(r,YR)},toggleChatFullscreen(){this.chatFullscreen=!this.chatFullscreen},setChatFullscreen(r){this.chatFullscreen=r}}});function UR(){const r=_(null),e=_(!0);let t=null,n="smooth";const s=50;function i(){const p=r.value;return p?p.scrollHeight-p.scrollTop-p.clientHeight<s:!0}function o(){e.value=i()}function a(p="smooth"){if(n=p,t!==null)return;t=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):g=>setTimeout(()=>g(Date.now()),16))(()=>{t=null,br(()=>{const g=r.value;g&&g.scrollTo({top:g.scrollHeight,behavior:n})})})}function l(p="smooth"){a(p),e.value=!0}function c(p="smooth"){e.value&&a(p)}function u(){e.value=!0}function h(){e.value=!1}return{containerRef:r,shouldAutoScroll:Te(e),onScroll:o,scrollToBottom:a,forceScrollToBottom:l,maybeScrollToBottom:c,enableAutoScroll:u,disableAutoScroll:h}}function GR(r){if(!r)return null;if(r instanceof HTMLElement)return r;if(typeof r=="object"&&"$el"in r){const e=r.$el;return e instanceof HTMLElement?e:null}return null}function HR(r){const{allMessages:e,containerRef:t,estimateItemHeight:n=120,overscan:s=6}=r,i=_(0),o=_(0),a=_(new Map),l=new Map;let c=null;function u(C,P){if(!Number.isFinite(P)||P<=0)return;const A=Math.ceil(P);if(a.value.get(C)===A)return;const E=new Map(a.value);E.set(C,A),a.value=E}function h(C,P){u(C,P.getBoundingClientRect().height)}function p(C,P){const A=l.get(C);A&&c&&c.unobserve(A),A&&delete A.dataset.virtualMessageId,l.delete(C);const E=GR(P);E&&(E.dataset.virtualMessageId=C,l.set(C,E),h(C,E),c&&c.observe(E))}function f(){const C=t.value;C&&(i.value=C.scrollTop)}const g=J(()=>{const C=e.value,P=new Array(C.length);let A=0;for(let E=0;E<C.length;E++)P[E]=A,A+=a.value.get(C[E].id)??n;return{offsets:P,totalHeight:A}});function O(C,P){let A=0,E=C.length-1,F=C.length;for(;A<=E;){const I=Math.floor((A+E)/2);C[I]>=P?(F=I,E=I-1):A=I+1}return F===C.length?Math.max(0,C.length-1):F}const y=J(()=>{const C=e.value;if(C.length===0)return[];const{offsets:P}=g.value,A=i.value,E=A+Math.max(o.value,1),F=O(P,Math.max(0,A-n));let I=F;for(;I<C.length&&P[I]<E;)I++;const oe=Math.max(0,F-s),ie=Math.min(C.length,I+s),ne=[];for(let L=oe;L<ie;L++)ne.push({message:C[L],index:L,top:P[L]});return ne}),b=J(()=>g.value.totalHeight);return mt(()=>{const C=t.value;C&&(o.value=C.clientHeight,i.value=C.scrollTop),c=new ResizeObserver(P=>{for(const A of P){const E=A.target;if(t.value&&E===t.value){o.value=A.contentRect.height;continue}const F=E.dataset.virtualMessageId;F&&u(F,A.contentRect.height)}}),t.value&&c.observe(t.value);for(const[P,A]of l)A.dataset.virtualMessageId=P,c.observe(A),h(P,A)}),St(()=>{c&&(c.disconnect(),c=null),l.clear()}),{visibleItems:y,totalHeight:b,onVirtualScroll:f,setItemRef:p}}const KR={key:0,class:"flex flex-col items-center justify-center h-full p-8 text-center"},JR={key:1,class:"relative"},eB={class:"sticky bottom-0"},tB={key:0,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50 backdrop-blur-sm"},rB={key:1,class:"px-4 py-2.5 bg-retro-red/20 border-t border-retro-red/50"},nB={class:"flex items-start gap-2"},sB={class:"flex-1 min-w-0"},iB={class:"flex items-center justify-between gap-2 mb-0.5"},oB={class:"text-xs font-mono text-retro-red/80 break-words whitespace-pre-wrap"},aB={key:2,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50"},lB=Ie({__name:"ChatMessages",setup(r){const e=kr(),{containerRef:t,onScroll:n,maybeScrollToBottom:s,scrollToBottom:i,forceScrollToBottom:o}=UR(),{visibleItems:a,totalHeight:l,onVirtualScroll:c,setItemRef:u}=HR({allMessages:J(()=>e.messages),containerRef:t});function h(){n(),c()}const p=J(()=>e.isActiveConversationStreaming),f=J(()=>{const C=e.lastMessage;return!C||C.role!=="assistant"?null:C.status}),g=_(!1);function O(C){const P=C.contentBlocks;return!P||P.length===0?"":P.map(A=>{switch(A.type){case"tool_use":return`u:${A.id}:${A.status}:${A.inputSummary}`;case"tool_result":return`r:${A.id}:${A.toolUseId}:${A.isError?1:0}:${A.content.length}`;case"text":return`t:${A.id}:${A.text.length}`;case"thinking":return`k:${A.id}:${A.thinking.length}`;case"result_summary":return`s:${A.id}:${A.numTurns}:${A.durationMs}`;case"session_init":return`i:${A.id}:${A.model}:${A.tools.length}`;default:return""}}).join("|")}const y=_(null);function b(){if(y.value&&(y.value(),y.value=null),!t.value||typeof ResizeObserver>"u")return;const C=new ResizeObserver(()=>{s("instant")});C.observe(t.value),y.value=()=>{C.disconnect()}}return mt(()=>{i("instant"),b()}),St(()=>{y.value&&y.value()}),ze(()=>e.activeConversationId,()=>{g.value=!1,i("instant")}),ze(t,()=>{b()}),ze(()=>[e.activeConversationId,e.messages.length],([C,P])=>{!C||P===0||g.value||(g.value=!0,o("instant"))},{immediate:!0}),ze(()=>e.messages.length,()=>{s("instant")}),ze(()=>e.lastMessage?.content,()=>{s("instant")}),ze([p,()=>e.lastError],()=>{s("instant")}),ze(l,()=>{s("instant")}),(C,P)=>(v(),x("div",{ref_key:"containerRef",ref:t,class:"flex-1 overflow-y-auto",onScroll:h},[m(e).hasMessages?(v(),x("div",JR,[d("div",{class:"relative",style:Ut({height:`${m(l)}px`})},[(v(!0),x(we,null,Fe(m(a),A=>(v(),x("div",{key:A.message.id,class:"absolute left-0 right-0 border-b border-retro-border/30",style:Ut({transform:`translateY(${A.top}px)`})},[d("div",{ref_for:!0,ref:E=>m(u)(A.message.id,E)},[Rp([A.message.id,A.message.status,A.message.content,A.message.contentBlocks?.length||0,O(A.message),A.message.tools?.length||0],()=>ee(Q1,{message:A.message},null,8,["message"]),P,0)],512)],4))),128))],4)])):(v(),x("div",KR,[...P[2]||(P[2]=[d("div",{class:"text-retro-muted text-sm font-mono mb-2"}," No messages yet ",-1),d("div",{class:"text-retro-muted text-xs font-mono"}," Send a message to start chatting ",-1)])])),d("div",eB,[m(p)&&!m(e).lastError?(v(),x("div",tB,[...P[3]||(P[3]=[Zp('<div class="flex items-center gap-2"><div class="flex gap-1"><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:0ms;"></span><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:150ms;"></span><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:300ms;"></span></div><span class="text-xs font-mono text-retro-muted">Processing...</span></div>',1)])])):U("",!0),m(e).lastError?(v(),x("div",rB,[d("div",nB,[ee(m(po),{class:"w-4 h-4 text-retro-red flex-shrink-0 mt-0.5"}),d("div",sB,[d("div",iB,[P[4]||(P[4]=d("p",{class:"text-xs font-mono font-semibold text-retro-red"},"Error",-1)),d("button",{class:"text-xs font-mono text-retro-red/60 hover:text-retro-red underline",onClick:P[1]||(P[1]=A=>m(e).clearError())}," Dismiss ")]),d("p",oB,B(m(e).lastError),1),P[5]||(P[5]=d("p",{class:"text-xs font-mono text-retro-muted mt-1"}," Check browser console (F12) for more details ",-1))])])])):m(f)==="stopped"?(v(),x("div",aB,[...P[6]||(P[6]=[d("div",{class:"flex items-center gap-2"},[d("span",{class:"w-2 h-2 rounded-full bg-retro-muted"}),d("span",{class:"text-xs font-mono text-retro-muted"},"Stopped")],-1)])])):U("",!0)])],544))}});function cB(r,e){return v(),x("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"fill-rule":"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z","clip-rule":"evenodd"})])}function Ap(r,e){return v(),x("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"fill-rule":"evenodd",d:"M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z","clip-rule":"evenodd"})])}function uB(r,e){return v(),x("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})])}function hB(r,e){return v(),x("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"fill-rule":"evenodd",d:"M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z","clip-rule":"evenodd"})])}const dB={class:"flex-shrink-0 flex-grow-0 border-t border-retro-border bg-retro-dark p-3"},fB={class:"flex items-center gap-2 mb-2"},pB={class:"relative min-w-0 flex-1 max-w-[154px] model-selector"},mB=["disabled"],gB={class:"truncate text-left"},OB={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]"},vB={key:0,class:"px-3 py-1.5 text-xs font-mono text-retro-muted"},bB={class:"px-3 py-1 text-[11px] font-mono uppercase tracking-wide text-retro-cyan/80 select-none"},xB=["disabled","onClick"],yB={class:"truncate"},kB={class:"relative mode-selector"},wB={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]"},SB=["onClick"],$B={class:"text-xs font-mono text-retro-muted"},CB={key:0,class:"mb-3 p-3 bg-retro-yellow/10 border border-retro-yellow/50 rounded"},QB={class:"flex items-center justify-between gap-3"},PB={class:"flex-1 min-w-0"},TB={class:"text-xs font-mono text-retro-text truncate"},MB={class:"text-retro-cyan"},AB={key:0,class:"text-retro-muted"},_B={key:1,class:"text-retro-muted"},RB={key:1,class:"mb-3 p-3 bg-retro-cyan/10 border border-retro-cyan/50 rounded"},BB={key:2,class:"mb-2 flex flex-wrap gap-2"},ZB=["src","alt"],EB={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},DB={class:"truncate text-[10px] font-mono text-retro-muted/80"},LB=["onClick"],XB={class:"flex gap-2 items-start"},IB=["disabled"],VB={class:"flex-1 relative min-h-[40px]"},zB=["disabled","placeholder"],NB=["disabled"],_p=4,WB=5*1024*1024,jB=Ie({__name:"ChatInput",props:{disabled:{type:Boolean}},setup(r){const e=r,t=kr(),n=il(),{sendMessage:s,sendPermissionResponse:i,approvePlan:o,rejectPlan:a,abort:l,resetContext:c}=Sl(),u=_(""),h=_(null),p=_(null),f=_(!1),g=_(!1),O=_(!1),y=_([]);let b=null;const C=_(null),{data:P,pending:A}=gc("chat-input-ai-providers",()=>$fetch("/api/ai/providers"),{server:!1,default:()=>({providers:[]})}),E=J(()=>P.value?.providers??[]),F=J(()=>t.permissionMode==="ask"||t.permissionMode==="plan"),I=J(()=>{const H=new Map;for(const se of E.value)for(const ve of se.models)H.set(ve.label,(H.get(ve.label)??0)+1);return E.value.flatMap(se=>se.models.map(ve=>{const _e=se.capabilities.streaming&&(!F.value||se.capabilities.permissions),We=(H.get(ve.label)??0)>1;return{key:`${se.id}::${ve.key}`,providerId:se.id,providerName:se.name,modelKey:ve.key,modelLabel:ve.label,label:We?`${ve.label} · ${se.name}`:ve.label,compatible:_e}})).sort((se,ve)=>se.modelLabel.localeCompare(ve.modelLabel,void 0,{sensitivity:"base"})||se.providerName.localeCompare(ve.providerName,void 0,{sensitivity:"base"}))}),oe=J(()=>{const H=new Map;for(const ve of I.value){const _e=H.get(ve.providerId);if(_e){_e.options.push(ve);continue}H.set(ve.providerId,{providerId:ve.providerId,providerName:ve.providerName,options:[ve]})}const fe=new Map([["codex",0],["claude",1]]),se=Array.from(H.values());return se.sort((ve,_e)=>{const We=fe.get(ve.providerId)??99,Ge=fe.get(_e.providerId)??99;return We!==Ge?We-Ge:ve.providerName.localeCompare(_e.providerName,void 0,{sensitivity:"base"})}),se});function ie(H){return`${H.providerId}::${H.modelKey}`}const ne=J(()=>{const H=t.activeConversation;return H?.providerId&&H.providerModelKey?{providerId:H.providerId,modelKey:H.providerModelKey}:C.value?C.value:n.providerSelection}),L=J(()=>ie(ne.value)),D=J(()=>I.value.find(H=>H.key===L.value)||null),Z=J(()=>D.value?.label||"Select model");function z(H,fe){t.setConversationProviderSelection(H,fe.providerId,fe.modelKey),t.clearProviderSession(H),t.saveConversation(H,!0)}function q(H){C.value&&(z(H,C.value),C.value=null)}function V(H){if(!H||!H.compatible)return;const fe={providerId:H.providerId,modelKey:H.modelKey},se=t.activeConversationId;if(se){z(se,fe),C.value=null,O.value=!1;return}C.value=fe,O.value=!1}const X={plan:$u,ask:Qu,auto:jp,bypass:Pu},N={plan:"text-retro-cyan",ask:"text-retro-green",auto:"text-retro-yellow",bypass:"text-retro-red"};function me(H){t.setPermissionMode(H),g.value=!1}function K(H){const fe=H.target;fe.closest(".mode-selector")||(g.value=!1),fe.closest(".model-selector")||(O.value=!1)}mt(()=>{document.addEventListener("click",K),n.hydrate()}),St(()=>{document.removeEventListener("click",K),b!==null&&typeof window<"u"&&typeof window.cancelAnimationFrame=="function"&&(window.cancelAnimationFrame(b),b=null)});const he=J(()=>(u.value.trim().length>0||y.value.length>0)&&!t.isActiveConversationStreaming&&!f.value&&!t.pendingPermission&&!M.value),$=J(()=>t.isActiveConversationStreaming&&!t.pendingPermission),w=J(()=>t.pendingPermission!==null),M=J(()=>t.pendingPlanApproval!==null);function R(){i(!0,t.activeConversationId)}function G(){i(!1,t.activeConversationId)}function ae(){o(t.activeConversationId)}function xe(){a(t.activeConversationId)}function De(){y.value=[],p.value&&(p.value.value="")}function Ae(H){y.value=y.value.filter(fe=>fe.id!==H)}function Ue(H){return H<1024?`${H} B`:H<1024*1024?`${(H/1024).toFixed(1)} KB`:`${(H/(1024*1024)).toFixed(1)} MB`}function Ye(H){return new Promise((fe,se)=>{const ve=new FileReader;ve.onload=()=>{typeof ve.result=="string"?fe(ve.result):se(new Error("Failed to read image"))},ve.onerror=()=>se(ve.error||new Error("Failed to read image")),ve.readAsDataURL(H)})}async function pe(H){const fe=H.target,se=fe.files?Array.from(fe.files):[];if(se.length===0)return;const{useToast:ve}=await as(async()=>{const{useToast:Ge}=await import("./Bze5ywup.js").then(it=>it.n);return{useToast:Ge}},__vite__mapDeps([0,1,2]),import.meta.url),_e=ve();let We=_p-y.value.length;if(We<=0){_e.warning(`You can attach up to ${_p} images per message.`),fe.value="";return}for(const Ge of se){if(We<=0)break;if(!Ge.type.startsWith("image/")){_e.warning(`Skipped "${Ge.name}": only image files are supported.`);continue}if(Ge.size>WB){_e.warning(`Skipped "${Ge.name}": max size is 5 MB.`);continue}try{const it=await Ye(Ge);y.value.push({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:Ge.name,mimeType:Ge.type,size:Ge.size,dataUrl:it}),We--}catch{_e.error(`Failed to attach "${Ge.name}".`)}}fe.value=""}const Ce=J(()=>{if(t.isActiveConversationStreaming||f.value)return!1;const H=t.lastMessage;return H?.role==="assistant"&&H?.status==="error"});function ce(H){const fe=H.instructionFiles.length>0?H.instructionFiles.map(ve=>{const _e=ve.source==="cwd"?"cwd":"ancestor",We=ve.mtime?` (mtime: ${ve.mtime})`:"";return`- \`${ve.path}\` [${_e}] - ${ve.hint}${We}`}):["- (none detected from current cwd ancestry)"],se=H.specContext.files.length>0?H.specContext.files.map(ve=>`- \`${ve}\``):["- (none)"];return["## Context Snapshot","",`- Time: ${H.generatedAt}`,`- Session state: **${H.sessionState}**`,`- Provider session ID: \`${H.providerSessionId??"(empty)"}\``,`- Provider: \`${H.providerId}\` / \`${H.providerModelKey}\``,`- Permission mode: \`${H.permissionMode}\``,`- CWD (requested): \`${H.requestedCwd}\``,`- CWD (effective): \`${H.effectiveCwd}\``,`- Feature: \`${H.featureId??"(none)"}\``,"","### Spec Context Injection",`- Active on next turn: **${H.specContext.active?"yes":"no"}**`,`- Reason: ${H.specContext.reason}`,...se,"","### Detected Instruction Files",...fe].join(`
67
+ `).toLowerCase();return p.set(V.id,{signature:X,text:me}),me}const b=J(()=>e.conversationViewMode==="archive"),C=J(()=>{const V=e.sortedConversations;if(!s.value.trim())return V;const X=s.value.toLowerCase().trim();return V.filter(N=>O(N).includes(X))}),P=J(()=>{const V=e.sortedArchivedConversations;if(!s.value.trim())return V;const X=s.value.toLowerCase().trim();return V.filter(N=>y(N).includes(X))}),A=J(()=>e.previewingConversationId);async function E(){if(e.checkStorageLimits().atLimit){t.error("Delete or archive a conversation first (limit: 100).");return}i.value=!0}async function F(V){o.value=!0;try{if(!await e.createConversation({baseBranch:V})){t.error("Failed to create conversation");return}i.value=!1}catch(X){t.error(X instanceof Error?X.message:"Failed to create conversation")}finally{o.value=!1}}function I(V){e.selectConversation(V),e.setConversationViewMode("active")}async function oe(V){const X=await e.archiveConversation(V);if(!X.success){t.error(X.error||"Failed to archive conversation");return}t.success("Conversation archived")}async function ie(V){c.value=V,a.value=!0}function ne(){a.value=!1,c.value=null}async function L(V){if(c.value){l.value=!0;try{const X=await e.restoreArchivedConversation(c.value,V);if(!X.success){t.error(X.error||"Failed to restore archived conversation");return}t.success("Archived conversation restored"),a.value=!1,c.value=null}finally{l.value=!1}}}async function D(V){const X=await e.deleteArchivedConversation(V);if(!X.success){t.error(X.error||"Failed to delete archived conversation");return}t.success("Archived conversation deleted")}function Z(V,X){e.renameConversation(V,X)}function z(V){return new Date(V).toLocaleString()}function q(V){if(!V.length)return"No messages";const N=(V[V.length-1].content||"").trim();return N?N.length>80?`${N.slice(0,80)}...`:N:"No messages"}return(V,X)=>(v(),x("div",xR,[d("div",yR,[d("div",kR,[d("button",{onClick:E,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"New conversation","aria-label":"New conversation"},[ee(m(sl),{class:"w-4 h-4"})]),d("div",wR,[d("button",{onClick:X[0]||(X[0]=N=>m(e).setConversationViewMode("active")),class:Re(["p-1.5 rounded transition-colors",b.value?"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel":"text-retro-cyan bg-retro-cyan/10"]),title:"Active conversations","aria-label":"Active conversations"},[ee(m(j1),{class:"w-4 h-4"})],2),d("button",{onClick:X[1]||(X[1]=N=>m(e).setConversationViewMode("archive")),class:Re(["p-1.5 rounded transition-colors",b.value?"text-retro-cyan bg-retro-cyan/10":"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel"]),title:"Archived conversations","aria-label":"Archived conversations"},[ee(m(Zh),{class:"w-4 h-4"})],2)])]),d("div",SR,[ee(m(ls),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted"}),He(d("input",{"onUpdate:modelValue":X[2]||(X[2]=N=>n.value=N),type:"text",placeholder:b.value?"Search archive...":"Search conversations...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono bg-retro-black border border-retro-border rounded focus:border-retro-cyan focus:outline-none focus:ring-1 focus:ring-retro-cyan text-retro-text placeholder-retro-muted"},null,8,$R),[[Xt,n.value]])])]),m(e).isNearStorageLimit?(v(),x("div",CR,[ee(m(_n),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),d("p",QR,B(m(e).conversationCount)+" active conversations. Limit is 100. ",1)])):U("",!0),d("div",PR,[b.value?(v(),x(we,{key:1},[m(e).hasArchivedConversations?(v(),x("div",RR,[P.value.length>0?(v(!0),x(we,{key:0},Fe(P.value,(N,me,K,he)=>{const $=[N.id,N.title,N.updatedAt,N.archivedAt,N.messages.length];if(he&&he.key===N.id&&_h(he,$))return he;const w=(v(),x("div",{key:N.id,onClick:M=>ie(N.id),onKeydown:[os(fr(M=>ie(N.id),["prevent"]),["enter"]),os(fr(M=>ie(N.id),["prevent"]),["space"])],class:"w-full text-left p-3 rounded border border-retro-border hover:border-retro-cyan/50 hover:bg-retro-cyan/5 transition-colors",role:"button",tabindex:"0"},[d("div",BR,[d("div",ZR,[d("h3",ER,B(N.title),1),d("p",DR,B(q(N.messages)),1),d("p",LR," Archived: "+B(z(N.archivedAt)),1),d("p",XR," Updated: "+B(z(N.updatedAt)),1)]),d("div",IR,[d("button",{onClick:fr(M=>ie(N.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-retro-cyan/40 text-retro-cyan rounded hover:bg-retro-cyan/10 transition-colors",title:"Restore archived conversation"},[ee(m(Zh),{class:"w-3.5 h-3.5"}),X[9]||(X[9]=Xe(" Restore ",-1))],8,VR),d("button",{onClick:fr(M=>D(N.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-red-400/40 text-red-300 rounded hover:bg-red-500/10 transition-colors",title:"Delete archived conversation"},[ee(m(fn),{class:"w-3.5 h-3.5"}),X[10]||(X[10]=Xe(" Delete ",-1))],8,zR)])])],40,["onClick","onKeydown"]));return w.memo=$,w},X,5),128)):(v(),x("div",NR,[d("p",WR,'No archived results for "'+B(n.value)+'"',1)]))])):(v(),x("div",jR,[...X[11]||(X[11]=[d("p",{class:"font-mono text-sm"},"No archived conversations",-1),d("p",{class:"text-xs mt-1"},"Archived conversations will appear here",-1)])]))],64)):(v(),x(we,{key:0},[m(e).hasConversations?(v(),x("div",TR,[C.value.length>0?(v(!0),x(we,{key:0},Fe(C.value,(N,me,K,he)=>{const $=[N.id,N.title,N.updatedAt,N.messages.length,N.finalized,N.id===m(e).activeConversationId,m(e).isConversationStreaming(N.id),A.value===N.id];if(he&&he.key===N.id&&_h(he,$))return he;const w=(v(),x("div",{key:N.id},[ee(C1,{conversation:N,"is-active":N.id===m(e).activeConversationId,"is-streaming":m(e).isConversationStreaming(N.id),"is-previewing":A.value===N.id,onSelect:M=>I(N.id),onArchive:M=>oe(N.id),onRename:M=>Z(N.id,M)},null,8,["conversation","is-active","is-streaming","is-previewing","onSelect","onArchive","onRename"])]));return w.memo=$,w},X,3),128)):(v(),x("div",MR,[d("p",AR,'No results for "'+B(n.value)+'"',1)]))])):(v(),x("div",_R,[...X[8]||(X[8]=[d("p",{class:"font-mono text-sm"},"No conversations",-1),d("p",{class:"text-xs mt-1"},'Click "New" to start',-1)])]))],64))]),ee(bu,{show:i.value,creating:o.value,onClose:X[7]||(X[7]=N=>i.value=!1),onCreate:F},null,8,["show","creating"]),ee(bu,{show:a.value,creating:l.value,onClose:ne,onCreate:L},null,8,["show","creating"])]))}}),YR={mobile:768,tablet:1024};function FR(r,e){return r<e.mobile?"mobile":r<e.tablet?"tablet":"desktop"}const i1=xu("layout",{state:()=>({currentViewport:"desktop",chatFullscreen:!1}),getters:{isMobile:r=>r.currentViewport==="mobile",isTablet:r=>r.currentViewport==="tablet",isDesktop:r=>r.currentViewport==="desktop",isChatFullscreen:r=>r.chatFullscreen},actions:{updateViewport(r){this.currentViewport=FR(r,YR)},toggleChatFullscreen(){this.chatFullscreen=!this.chatFullscreen},setChatFullscreen(r){this.chatFullscreen=r}}});function UR(){const r=_(null),e=_(!0);let t=null,n="smooth";const s=50;function i(){const p=r.value;return p?p.scrollHeight-p.scrollTop-p.clientHeight<s:!0}function o(){e.value=i()}function a(p="smooth"){if(n=p,t!==null)return;t=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):g=>setTimeout(()=>g(Date.now()),16))(()=>{t=null,br(()=>{const g=r.value;g&&g.scrollTo({top:g.scrollHeight,behavior:n})})})}function l(p="smooth"){a(p),e.value=!0}function c(p="smooth"){e.value&&a(p)}function u(){e.value=!0}function h(){e.value=!1}return{containerRef:r,shouldAutoScroll:Te(e),onScroll:o,scrollToBottom:a,forceScrollToBottom:l,maybeScrollToBottom:c,enableAutoScroll:u,disableAutoScroll:h}}function GR(r){if(!r)return null;if(r instanceof HTMLElement)return r;if(typeof r=="object"&&"$el"in r){const e=r.$el;return e instanceof HTMLElement?e:null}return null}function HR(r){const{allMessages:e,containerRef:t,estimateItemHeight:n=120,overscan:s=6}=r,i=_(0),o=_(0),a=_(new Map),l=new Map;let c=null;function u(C,P){if(!Number.isFinite(P)||P<=0)return;const A=Math.ceil(P);if(a.value.get(C)===A)return;const E=new Map(a.value);E.set(C,A),a.value=E}function h(C,P){u(C,P.getBoundingClientRect().height)}function p(C,P){const A=l.get(C);A&&c&&c.unobserve(A),A&&delete A.dataset.virtualMessageId,l.delete(C);const E=GR(P);E&&(E.dataset.virtualMessageId=C,l.set(C,E),h(C,E),c&&c.observe(E))}function f(){const C=t.value;C&&(i.value=C.scrollTop)}const g=J(()=>{const C=e.value,P=new Array(C.length);let A=0;for(let E=0;E<C.length;E++)P[E]=A,A+=a.value.get(C[E].id)??n;return{offsets:P,totalHeight:A}});function O(C,P){let A=0,E=C.length-1,F=C.length;for(;A<=E;){const I=Math.floor((A+E)/2);C[I]>=P?(F=I,E=I-1):A=I+1}return F===C.length?Math.max(0,C.length-1):F}const y=J(()=>{const C=e.value;if(C.length===0)return[];const{offsets:P}=g.value,A=i.value,E=A+Math.max(o.value,1),F=O(P,Math.max(0,A-n));let I=F;for(;I<C.length&&P[I]<E;)I++;const oe=Math.max(0,F-s),ie=Math.min(C.length,I+s),ne=[];for(let L=oe;L<ie;L++)ne.push({message:C[L],index:L,top:P[L]});return ne}),b=J(()=>g.value.totalHeight);return mt(()=>{const C=t.value;C&&(o.value=C.clientHeight,i.value=C.scrollTop),c=new ResizeObserver(P=>{for(const A of P){const E=A.target;if(t.value&&E===t.value){o.value=A.contentRect.height;continue}const F=E.dataset.virtualMessageId;F&&u(F,A.contentRect.height)}}),t.value&&c.observe(t.value);for(const[P,A]of l)A.dataset.virtualMessageId=P,c.observe(A),h(P,A)}),St(()=>{c&&(c.disconnect(),c=null),l.clear()}),{visibleItems:y,totalHeight:b,onVirtualScroll:f,setItemRef:p}}const KR={key:0,class:"flex flex-col items-center justify-center h-full p-8 text-center"},JR={key:1,class:"relative"},eB={class:"sticky bottom-0"},tB={key:0,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50 backdrop-blur-sm"},rB={key:1,class:"px-4 py-2.5 bg-retro-red/20 border-t border-retro-red/50"},nB={class:"flex items-start gap-2"},sB={class:"flex-1 min-w-0"},iB={class:"flex items-center justify-between gap-2 mb-0.5"},oB={class:"text-xs font-mono text-retro-red/80 break-words whitespace-pre-wrap"},aB={key:2,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50"},lB=Ie({__name:"ChatMessages",setup(r){const e=kr(),{containerRef:t,onScroll:n,maybeScrollToBottom:s,scrollToBottom:i,forceScrollToBottom:o}=UR(),{visibleItems:a,totalHeight:l,onVirtualScroll:c,setItemRef:u}=HR({allMessages:J(()=>e.messages),containerRef:t});function h(){n(),c()}const p=J(()=>e.isActiveConversationStreaming),f=J(()=>{const C=e.lastMessage;return!C||C.role!=="assistant"?null:C.status}),g=_(!1);function O(C){const P=C.contentBlocks;return!P||P.length===0?"":P.map(A=>{switch(A.type){case"tool_use":return`u:${A.id}:${A.status}:${A.inputSummary}`;case"tool_result":return`r:${A.id}:${A.toolUseId}:${A.isError?1:0}:${A.content.length}`;case"text":return`t:${A.id}:${A.text.length}`;case"thinking":return`k:${A.id}:${A.thinking.length}`;case"result_summary":return`s:${A.id}:${A.numTurns}:${A.durationMs}`;case"session_init":return`i:${A.id}:${A.model}:${A.tools.length}`;default:return""}}).join("|")}const y=_(null);function b(){if(y.value&&(y.value(),y.value=null),!t.value||typeof ResizeObserver>"u")return;const C=new ResizeObserver(()=>{s("instant")});C.observe(t.value),y.value=()=>{C.disconnect()}}return mt(()=>{i("instant"),b()}),St(()=>{y.value&&y.value()}),ze(()=>e.activeConversationId,()=>{g.value=!1,i("instant")}),ze(t,()=>{b()}),ze(()=>[e.activeConversationId,e.messages.length],([C,P])=>{!C||P===0||g.value||(g.value=!0,o("instant"))},{immediate:!0}),ze(()=>e.messages.length,()=>{s("instant")}),ze(()=>e.lastMessage?.content,()=>{s("instant")}),ze([p,()=>e.lastError],()=>{s("instant")}),ze(l,()=>{s("instant")}),(C,P)=>(v(),x("div",{ref_key:"containerRef",ref:t,class:"flex-1 overflow-y-auto",onScroll:h},[m(e).hasMessages?(v(),x("div",JR,[d("div",{class:"relative",style:Ut({height:`${m(l)}px`})},[(v(!0),x(we,null,Fe(m(a),A=>(v(),x("div",{key:A.message.id,class:"absolute left-0 right-0 border-b border-retro-border/30",style:Ut({transform:`translateY(${A.top}px)`})},[d("div",{ref_for:!0,ref:E=>m(u)(A.message.id,E)},[Rp([A.message.id,A.message.status,A.message.content,A.message.contentBlocks?.length||0,O(A.message),A.message.tools?.length||0],()=>ee(Q1,{message:A.message},null,8,["message"]),P,0)],512)],4))),128))],4)])):(v(),x("div",KR,[...P[2]||(P[2]=[d("div",{class:"text-retro-muted text-sm font-mono mb-2"}," No messages yet ",-1),d("div",{class:"text-retro-muted text-xs font-mono"}," Send a message to start chatting ",-1)])])),d("div",eB,[m(p)&&!m(e).lastError?(v(),x("div",tB,[...P[3]||(P[3]=[Zp('<div class="flex items-center gap-2"><div class="flex gap-1"><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:0ms;"></span><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:150ms;"></span><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:300ms;"></span></div><span class="text-xs font-mono text-retro-muted">Processing...</span></div>',1)])])):U("",!0),m(e).lastError?(v(),x("div",rB,[d("div",nB,[ee(m(po),{class:"w-4 h-4 text-retro-red flex-shrink-0 mt-0.5"}),d("div",sB,[d("div",iB,[P[4]||(P[4]=d("p",{class:"text-xs font-mono font-semibold text-retro-red"},"Error",-1)),d("button",{class:"text-xs font-mono text-retro-red/60 hover:text-retro-red underline",onClick:P[1]||(P[1]=A=>m(e).clearError())}," Dismiss ")]),d("p",oB,B(m(e).lastError),1),P[5]||(P[5]=d("p",{class:"text-xs font-mono text-retro-muted mt-1"}," Check browser console (F12) for more details ",-1))])])])):m(f)==="stopped"?(v(),x("div",aB,[...P[6]||(P[6]=[d("div",{class:"flex items-center gap-2"},[d("span",{class:"w-2 h-2 rounded-full bg-retro-muted"}),d("span",{class:"text-xs font-mono text-retro-muted"},"Stopped")],-1)])])):U("",!0)])],544))}});function cB(r,e){return v(),x("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"fill-rule":"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z","clip-rule":"evenodd"})])}function Ap(r,e){return v(),x("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"fill-rule":"evenodd",d:"M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z","clip-rule":"evenodd"})])}function uB(r,e){return v(),x("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})])}function hB(r,e){return v(),x("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"fill-rule":"evenodd",d:"M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z","clip-rule":"evenodd"})])}const dB={class:"flex-shrink-0 flex-grow-0 border-t border-retro-border bg-retro-dark p-3"},fB={class:"flex items-center gap-2 mb-2"},pB={class:"relative min-w-0 flex-1 max-w-[154px] model-selector"},mB=["disabled"],gB={class:"truncate text-left"},OB={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]"},vB={key:0,class:"px-3 py-1.5 text-xs font-mono text-retro-muted"},bB={class:"px-3 py-1 text-[11px] font-mono uppercase tracking-wide text-retro-cyan/80 select-none"},xB=["disabled","onClick"],yB={class:"truncate"},kB={class:"relative mode-selector"},wB={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]"},SB=["onClick"],$B={class:"text-xs font-mono text-retro-muted"},CB={key:0,class:"mb-3 p-3 bg-retro-yellow/10 border border-retro-yellow/50 rounded"},QB={class:"flex items-center justify-between gap-3"},PB={class:"flex-1 min-w-0"},TB={class:"text-xs font-mono text-retro-text truncate"},MB={class:"text-retro-cyan"},AB={key:0,class:"text-retro-muted"},_B={key:1,class:"text-retro-muted"},RB={key:1,class:"mb-3 p-3 bg-retro-cyan/10 border border-retro-cyan/50 rounded"},BB={key:2,class:"mb-2 flex flex-wrap gap-2"},ZB=["src","alt"],EB={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},DB={class:"truncate text-[10px] font-mono text-retro-muted/80"},LB=["onClick"],XB={class:"flex gap-2 items-start"},IB=["disabled"],VB={class:"flex-1 relative min-h-[40px]"},zB=["disabled","placeholder"],NB=["disabled"],_p=4,WB=5*1024*1024,jB=Ie({__name:"ChatInput",props:{disabled:{type:Boolean}},setup(r){const e=r,t=kr(),n=il(),{sendMessage:s,sendPermissionResponse:i,approvePlan:o,rejectPlan:a,abort:l,resetContext:c}=Sl(),u=_(""),h=_(null),p=_(null),f=_(!1),g=_(!1),O=_(!1),y=_([]);let b=null;const C=_(null),{data:P,pending:A}=gc("chat-input-ai-providers",()=>$fetch("/api/ai/providers"),{server:!1,default:()=>({providers:[]})}),E=J(()=>P.value?.providers??[]),F=J(()=>t.permissionMode==="ask"||t.permissionMode==="plan"),I=J(()=>{const H=new Map;for(const se of E.value)for(const ve of se.models)H.set(ve.label,(H.get(ve.label)??0)+1);return E.value.flatMap(se=>se.models.map(ve=>{const _e=se.capabilities.streaming&&(!F.value||se.capabilities.permissions),We=(H.get(ve.label)??0)>1;return{key:`${se.id}::${ve.key}`,providerId:se.id,providerName:se.name,modelKey:ve.key,modelLabel:ve.label,label:We?`${ve.label} · ${se.name}`:ve.label,compatible:_e}})).sort((se,ve)=>se.modelLabel.localeCompare(ve.modelLabel,void 0,{sensitivity:"base"})||se.providerName.localeCompare(ve.providerName,void 0,{sensitivity:"base"}))}),oe=J(()=>{const H=new Map;for(const ve of I.value){const _e=H.get(ve.providerId);if(_e){_e.options.push(ve);continue}H.set(ve.providerId,{providerId:ve.providerId,providerName:ve.providerName,options:[ve]})}const fe=new Map([["codex",0],["claude",1]]),se=Array.from(H.values());return se.sort((ve,_e)=>{const We=fe.get(ve.providerId)??99,Ge=fe.get(_e.providerId)??99;return We!==Ge?We-Ge:ve.providerName.localeCompare(_e.providerName,void 0,{sensitivity:"base"})}),se});function ie(H){return`${H.providerId}::${H.modelKey}`}const ne=J(()=>{const H=t.activeConversation;return H?.providerId&&H.providerModelKey?{providerId:H.providerId,modelKey:H.providerModelKey}:C.value?C.value:n.providerSelection}),L=J(()=>ie(ne.value)),D=J(()=>I.value.find(H=>H.key===L.value)||null),Z=J(()=>D.value?.label||"Select model");function z(H,fe){t.setConversationProviderSelection(H,fe.providerId,fe.modelKey),t.clearProviderSession(H),t.saveConversation(H,!0)}function q(H){C.value&&(z(H,C.value),C.value=null)}function V(H){if(!H||!H.compatible)return;const fe={providerId:H.providerId,modelKey:H.modelKey},se=t.activeConversationId;if(se){z(se,fe),C.value=null,O.value=!1;return}C.value=fe,O.value=!1}const X={plan:$u,ask:Qu,auto:jp,bypass:Pu},N={plan:"text-retro-cyan",ask:"text-retro-green",auto:"text-retro-yellow",bypass:"text-retro-red"};function me(H){t.setPermissionMode(H),g.value=!1}function K(H){const fe=H.target;fe.closest(".mode-selector")||(g.value=!1),fe.closest(".model-selector")||(O.value=!1)}mt(()=>{document.addEventListener("click",K),n.hydrate()}),St(()=>{document.removeEventListener("click",K),b!==null&&typeof window<"u"&&typeof window.cancelAnimationFrame=="function"&&(window.cancelAnimationFrame(b),b=null)});const he=J(()=>(u.value.trim().length>0||y.value.length>0)&&!t.isActiveConversationStreaming&&!f.value&&!t.pendingPermission&&!M.value),$=J(()=>t.isActiveConversationStreaming&&!t.pendingPermission),w=J(()=>t.pendingPermission!==null),M=J(()=>t.pendingPlanApproval!==null);function R(){i(!0,t.activeConversationId)}function G(){i(!1,t.activeConversationId)}function ae(){o(t.activeConversationId)}function xe(){a(t.activeConversationId)}function De(){y.value=[],p.value&&(p.value.value="")}function Ae(H){y.value=y.value.filter(fe=>fe.id!==H)}function Ue(H){return H<1024?`${H} B`:H<1024*1024?`${(H/1024).toFixed(1)} KB`:`${(H/(1024*1024)).toFixed(1)} MB`}function Ye(H){return new Promise((fe,se)=>{const ve=new FileReader;ve.onload=()=>{typeof ve.result=="string"?fe(ve.result):se(new Error("Failed to read image"))},ve.onerror=()=>se(ve.error||new Error("Failed to read image")),ve.readAsDataURL(H)})}async function pe(H){const fe=H.target,se=fe.files?Array.from(fe.files):[];if(se.length===0)return;const{useToast:ve}=await as(async()=>{const{useToast:Ge}=await import("./DXzkgxwX.js").then(it=>it.n);return{useToast:Ge}},__vite__mapDeps([0,1,2]),import.meta.url),_e=ve();let We=_p-y.value.length;if(We<=0){_e.warning(`You can attach up to ${_p} images per message.`),fe.value="";return}for(const Ge of se){if(We<=0)break;if(!Ge.type.startsWith("image/")){_e.warning(`Skipped "${Ge.name}": only image files are supported.`);continue}if(Ge.size>WB){_e.warning(`Skipped "${Ge.name}": max size is 5 MB.`);continue}try{const it=await Ye(Ge);y.value.push({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:Ge.name,mimeType:Ge.type,size:Ge.size,dataUrl:it}),We--}catch{_e.error(`Failed to attach "${Ge.name}".`)}}fe.value=""}const Ce=J(()=>{if(t.isActiveConversationStreaming||f.value)return!1;const H=t.lastMessage;return H?.role==="assistant"&&H?.status==="error"});function ce(H){const fe=H.instructionFiles.length>0?H.instructionFiles.map(ve=>{const _e=ve.source==="cwd"?"cwd":"ancestor",We=ve.mtime?` (mtime: ${ve.mtime})`:"";return`- \`${ve.path}\` [${_e}] - ${ve.hint}${We}`}):["- (none detected from current cwd ancestry)"],se=H.specContext.files.length>0?H.specContext.files.map(ve=>`- \`${ve}\``):["- (none)"];return["## Context Snapshot","",`- Time: ${H.generatedAt}`,`- Session state: **${H.sessionState}**`,`- Provider session ID: \`${H.providerSessionId??"(empty)"}\``,`- Provider: \`${H.providerId}\` / \`${H.providerModelKey}\``,`- Permission mode: \`${H.permissionMode}\``,`- CWD (requested): \`${H.requestedCwd}\``,`- CWD (effective): \`${H.effectiveCwd}\``,`- Feature: \`${H.featureId??"(none)"}\``,"","### Spec Context Injection",`- Active on next turn: **${H.specContext.active?"yes":"no"}**`,`- Reason: ${H.specContext.reason}`,...se,"","### Detected Instruction Files",...fe].join(`
68
68
  `)}function ue(H){return(H.match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(se=>se.startsWith('"')&&se.endsWith('"')||se.startsWith("'")&&se.endsWith("'")?se.slice(1,-1):se)}function Y(H){const fe=H.match(/^\/(?:spec-search|specsearch)\b(.*)$/i);if(!fe)return null;const se=ue(fe[1]?.trim()??""),ve=[],_e={q:""};for(let We=0;We<se.length;We++){const Ge=se[We];if(Ge==="--mode"&&se[We+1]){const it=se[++We];(it==="keyword"||it==="semantic"||it==="hybrid")&&(_e.mode=it);continue}if(Ge.startsWith("--mode=")){const it=Ge.slice(7);(it==="keyword"||it==="semantic"||it==="hybrid")&&(_e.mode=it);continue}if(Ge==="--feature"&&se[We+1]){_e.featureId=se[++We];continue}if(Ge.startsWith("--feature=")){_e.featureId=Ge.slice(10);continue}if(Ge==="--file-type"&&se[We+1]){_e.fileType=se[++We];continue}if(Ge.startsWith("--file-type=")){_e.fileType=Ge.slice(12);continue}if(Ge==="--limit"&&se[We+1]){const it=Number.parseInt(se[++We],10);Number.isFinite(it)&&it>0&&(_e.limit=it);continue}if(Ge.startsWith("--limit=")){const it=Number.parseInt(Ge.slice(8),10);Number.isFinite(it)&&it>0&&(_e.limit=it);continue}ve.push(Ge)}return _e.q=ve.join(" ").trim(),_e}function Me(H,fe=1400){const se=H.trim();return se.length<=fe?se:`${se.slice(0,fe)}
69
69
  ...`}function Le(H,fe){const se=[];if(se.push("## Spec Search Results"),se.push(""),se.push(`- Query: \`${H.q}\``),se.push(`- Mode: \`${fe.mode}\``),H.featureId&&se.push(`- Feature filter: \`${H.featureId}\``),H.fileType&&se.push(`- File type filter: \`${H.fileType}\``),se.push(`- Hits: **${fe.totalCount}** (${fe.searchTime}ms)`),fe.warning&&se.push(`- Warning: ${fe.warning}`),fe.results.length===0)return se.push(""),se.push("No matching indexed chunks were found."),se.join(`
70
70
  `);se.push("");for(const[ve,_e]of fe.results.entries()){const We=_e.chunk;se.push(`### ${ve+1}. \`${We.sourcePath}:${We.lineStart}\``),se.push(`- Match: \`${_e.matchType}\` (score: ${_e.score.toFixed(3)})`),We.headingHierarchy.length>0&&se.push(`- Headings: ${We.headingHierarchy.join(" > ")}`),se.push(""),se.push(Me(We.content)),se.push("")}return se.join(`
71
71
  `)}async function Ve(H){const fe=t.activeConversationId??await t.createConversation(),se=t.addAssistantMessage(fe);if(!H.q){t.updateMessage(se.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"},fe);return}const ve=t.activeConversation,_e={q:H.q,mode:H.mode??"hybrid",featureId:H.featureId??ve?.featureId,fileType:H.fileType,limit:String(H.limit??5)};try{const We=await $fetch("/api/specs/search",{query:_e});t.updateMessage(se.id,{content:Le({...H,mode:_e.mode,featureId:_e.featureId},We),status:"complete"},fe)}catch(We){const Ge=We instanceof Error?We.message:"Failed to run spec search";t.updateMessage(se.id,{content:`Spec search failed: ${Ge}`,status:"error"},fe)}}async function Mt(){const H=t.activeConversation,fe={permissionMode:t.permissionMode};H?.hasWorktree&&H.worktreePath?fe.cwd=H.worktreePath:H?.cwd&&(fe.cwd=H.cwd),H?.featureId&&(fe.featureId=H.featureId),H?.providerId&&(fe.providerId=H.providerId),H?.providerModelKey&&(fe.providerModelKey=H.providerModelKey),H?.providerSessionId&&(fe.providerSessionId=H.providerSessionId);const se=await $fetch("/api/chat/context",{query:fe}),ve=t.activeConversationId??await t.createConversation(),_e=t.addAssistantMessage(ve);t.updateMessage(_e.id,{content:ce(se),status:"complete"},ve)}function Zt(H=[]){const fe=ka(t.activeConversation,!0)??{};return H.length>0?{...fe,attachments:H}:Object.keys(fe).length>0?fe:void 0}function bn(H){const fe=t.addAssistantMessage(H);return t.startSession(`session-${Date.now()}`,H),t.startConversationStreaming(H),t.saveConversation(H,!0),fe}function Kt(H,fe,se,ve){const _e=se instanceof Error?se.message:ve;t.setSessionError(_e,H),t.updateMessage(fe,{status:"error"},H),t.endSession(H),t.endConversationStreaming(H)}async function Er(){const H=u.value.trim(),fe=[...y.value];if(H.length===0&&fe.length===0||t.isActiveConversationStreaming||f.value||e.disabled)return;const se=!!t.activeConversationId;let ve=null,_e=null;if(H==="/reset"||H==="/reset-context"||H==="/new"||H==="/clear"){await zn();return}if(H==="/context"||H==="/ctx"){await Mt(),u.value="",De(),xt();return}const We=Y(H);if(We){await Ve(We),u.value="",De(),xt();return}f.value=!0,u.value="",De(),xt();try{if(await t.addUserMessageWithConversation(H,fe),ve=t.activeConversationId,!ve)throw new Error("Failed to create or select a conversation");se||q(ve);const Ge=bn(ve);_e=Ge.id,await s(H,Ge.id,ve,Zt(fe))}catch(Ge){if(ve&&_e)Kt(ve,_e,Ge,"Failed to send message");else{const it=Ge instanceof Error?Ge.message:"Failed to send message";t.setSessionError(it)}}finally{f.value=!1}}async function $r(){try{l(t.activeConversationId)}catch{}}async function zn(){if(t.activeConversationId){u.value="",De(),xt(),f.value=!0;try{await c(t.activeConversationId);const H=t.addAssistantMessage(t.activeConversationId);t.updateMessage(H.id,{content:"✨ **Context cleared** — The AI conversation context has been reset. Starting fresh from here.",status:"complete"},t.activeConversationId);const{useToast:fe}=await as(async()=>{const{useToast:ve}=await import("./Bze5ywup.js").then(_e=>_e.n);return{useToast:ve}},__vite__mapDeps([0,1,2]),import.meta.url);fe().success("AI context has been reset. The conversation will start fresh.")}catch(H){console.error("Failed to reset context:",H);const{useToast:fe}=await as(async()=>{const{useToast:ve}=await import("./Bze5ywup.js").then(_e=>_e.n);return{useToast:ve}},__vite__mapDeps([0,1,2]),import.meta.url);fe().error("Failed to reset context. Please try again.")}finally{f.value=!1}}}async function Cr(){const H=t.messages;let fe=null;for(let _e=H.length-1;_e>=0;_e--)if(H[_e].role==="user"){fe={content:H[_e].content,attachments:H[_e].attachments??[]};break}if(!fe||!t.activeConversationId)return;const se=t.activeConversationId;t.clearError(),f.value=!0;let ve=null;try{const _e=bn(se);ve=_e.id,await s(fe.content,_e.id,se,Zt(fe.attachments))}catch(_e){if(ve)Kt(se,ve,_e,"Failed to retry message");else{const We=_e instanceof Error?_e.message:"Failed to retry message";t.setSessionError(We,se)}}finally{f.value=!1}}function xn(H){H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),Er())}function Nn(){const H=h.value;if(H){if(!u.value.trim()){H.style.height="";return}H.style.height="auto",H.style.height=Math.min(H.scrollHeight,200)+"px"}}function yn(){if(b!==null)return;b=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):fe=>setTimeout(()=>fe(Date.now()),16))(()=>{b=null,Nn()})}function xt(){const H=h.value;H&&(H.style.height="")}function Qr(){br(()=>{h.value?.focus()})}return ze(u,yn),ze(()=>t.isActiveConversationStreaming,(H,fe)=>{fe&&!H&&Qr()}),ze(()=>t.activeConversationId,()=>{t.activeConversationId&&(C.value=null),De(),Qr()}),(H,fe)=>(v(),x("div",dB,[d("div",fB,[d("div",pB,[d("button",{disabled:r.disabled||m(t).isActiveConversationStreaming||m(w)||m(M)||m(A)||m(I).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:fe[0]||(fe[0]=se=>O.value=!m(O))},[d("span",gB,B(m(Z)),1),ee(m(Ap),{class:"w-3 h-3 flex-shrink-0"})],8,mB),m(O)?(v(),x("div",OB,[m(I).length===0?(v(),x("div",vB," Loading models... ")):U("",!0),(v(!0),x(we,null,Fe(m(oe),se=>(v(),x("div",{key:se.providerId,class:"py-0.5"},[d("div",bB,B(se.providerName),1),(v(!0),x(we,null,Fe(se.options,ve=>(v(),x("button",{key:ve.key,disabled:!ve.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",m(L)===ve.key?"bg-retro-panel text-retro-text":"text-retro-muted"]),onClick:_e=>V(ve)},[d("span",yB,B(ve.modelLabel)+B(ve.compatible?"":" (unsupported for current permission mode)"),1)],10,xB))),128))]))),128))])):U("",!0)]),d("div",kB,[d("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",N[m(t).permissionMode]]),onClick:fe[1]||(fe[1]=se=>g.value=!m(g))},[(v(),Oe(Zs(X[m(t).permissionMode]),{class:"w-4 h-4"})),d("span",null,B(m(ws)[m(t).permissionMode]),1),ee(m(Ap),{class:"w-3 h-3"})],2),m(g)?(v(),x("div",wB,[(v(),x(we,null,Fe(["plan","ask","auto","bypass"],se=>d("button",{key:se,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",[N[se],m(t).permissionMode===se?"bg-retro-panel":""]]),onClick:ve=>me(se)},[(v(),Oe(Zs(X[se]),{class:"w-4 h-4"})),d("span",null,B(m(ws)[se]),1)],10,SB)),64))])):U("",!0)]),d("span",$B,B(m(t).permissionMode==="plan"?"Plan only":m(t).permissionMode==="ask"?"Ask before actions":m(t).permissionMode==="auto"?"Auto approve":"All permissions"),1)]),m(w)?(v(),x("div",CB,[d("div",QB,[d("div",PB,[fe[4]||(fe[4]=d("div",{class:"text-xs font-mono text-retro-yellow font-bold mb-1"}," Permission Required ",-1)),d("div",TB,[d("span",MB,B(m(t).pendingPermission?.tool),1),m(t).pendingPermission?.filePath?(v(),x("span",AB," - "+B(m(t).pendingPermission.filePath),1)):m(t).pendingPermission?.command?(v(),x("span",_B," - "+B(m(t).pendingPermission.command),1)):U("",!0)])]),d("div",{class:"flex gap-2 flex-shrink-0"},[d("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:R}," Allow "),d("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:G}," Deny ")])])])):U("",!0),m(M)?(v(),x("div",RB,[d("div",{class:"flex items-center justify-between gap-3"},[fe[5]||(fe[5]=d("div",{class:"flex-1 min-w-0"},[d("div",{class:"text-xs font-mono text-retro-cyan font-bold mb-1"}," Plan Ready for Review "),d("div",{class:"text-xs font-mono text-retro-muted"}," Approve to switch to Auto mode and start implementation. ")],-1)),d("div",{class:"flex gap-2 flex-shrink-0"},[d("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-green/20 text-retro-green border border-retro-green/50 hover:bg-retro-green/30 transition-colors",onClick:ae}," Approve & Implement "),d("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:xe}," Reject ")])])])):U("",!0),m(y).length>0?(v(),x("div",BB,[(v(!0),x(we,null,Fe(m(y),se=>(v(),x("div",{key:se.id,class:"relative w-24 rounded border border-retro-border/70 bg-retro-black/80 p-1"},[d("img",{src:se.dataUrl,alt:se.name,class:"h-16 w-full rounded object-cover"},null,8,ZB),d("div",EB,B(se.name),1),d("div",DB,B(Ue(se.size)),1),d("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:ve=>Ae(se.id)},[ee(m(Pt),{class:"h-3 w-3"})],8,LB)]))),128))])):U("",!0),d("div",XB,[d("input",{ref_key:"fileInputRef",ref:p,type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:pe},null,544),d("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||m(t).isActiveConversationStreaming||m(w)||m(M),onClick:fe[2]||(fe[2]=se=>m(p)?.click())},[ee(m(ov),{class:"w-5 h-5"})],8,IB),d("div",VB,[He(d("textarea",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":fe[3]||(fe[3]=se=>tt(u)?u.value=se:null),disabled:r.disabled||m(t).isActiveConversationStreaming||m(w)||m(M),placeholder:r.disabled?"This conversation is finalized (read-only)":"Type a message...",rows:"1",class:"w-full h-full min-h-[40px] px-3 py-2 bg-retro-black border border-retro-border rounded text-sm font-mono text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan disabled:opacity-50 disabled:cursor-not-allowed resize-none overflow-hidden",onKeydown:xn},null,40,zB),[[Xt,m(u)]])]),m(Ce)?(v(),x("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:Cr},[ee(m(cB),{class:"w-5 h-5"})])):U("",!0),!m($)&&!m(w)?(v(),x("button",{key:1,disabled:!m(he),class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-cyan/20 text-retro-cyan hover:bg-retro-cyan/30 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",onClick:Er},[ee(m(uB),{class:"w-5 h-5"})],8,NB)):m($)?(v(),x("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:$r},[ee(m(hB),{class:"w-5 h-5"})])):U("",!0)]),fe[6]||(fe[6]=d("div",{class:"mt-1 text-xs font-mono text-retro-muted"}," Press Enter to send, Shift+Enter for new line. Slash commands: `/context`, `/reset`, `/new`, `/clear`, `/spec-search`. You can attach up to 4 images (5 MB each). ",-1))]))}}),qB={class:"h-64 border-t border-retro-border bg-retro-dark/50 flex flex-col"},YB={class:"h-9 flex items-center justify-between px-3 border-b border-retro-border/40"},FB={key:0,class:"flex-1 flex items-center justify-center text-xs font-mono text-retro-muted"},UB={key:1,class:"flex-1 overflow-y-auto scrollbar-custom"},GB={class:"flex items-center gap-2 text-[10px] font-mono"},HB={class:"text-retro-muted"},KB={class:"text-retro-muted"},JB={class:"text-retro-green truncate"},e7={class:"mt-1 text-[11px] font-mono text-retro-text whitespace-pre-wrap break-words"},t7=Ie({__name:"ChatDebugPanel",setup(r){const e=kr(),{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(),x("div",qB,[d("div",YB,[o[1]||(o[1]=d("div",{class:"text-[11px] font-mono text-retro-text"}," Debug Stream (CLI/Provider) ",-1)),d("button",{class:"p-1 rounded hover:bg-retro-panel transition-colors",title:"Clear debug events",onClick:o[0]||(o[0]=a=>m(e).clearDebugEvents())},[ee(m(fn),{class:"w-3.5 h-3.5 text-retro-muted"})])]),m(t).length===0?(v(),x("div",FB," No debug events yet ")):(v(),x("div",UB,[(v(!0),x(we,null,Fe(m(t),a=>(v(),x("div",{key:a.id,class:"px-3 py-2 border-b border-retro-border/20"},[d("div",GB,[d("span",HB,B(n(a.timestamp)),1),d("span",{class:Re(s(a.direction))},B(a.direction.toUpperCase()),3),d("span",KB,B(a.channel),1),d("span",JB,B(a.eventType),1)]),d("pre",e7,B(a.payload),1)]))),128))]))]))}}),r7={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},n7={class:"flex items-center justify-between"},s7={class:"space-y-1 text-xs font-mono"},i7={class:"flex items-center gap-2"},o7={class:"relative"},a7=["disabled"],l7=["value"],c7=["value"],u7={class:"flex items-center gap-2"},h7={class:"text-retro-text"},d7={class:"relative"},f7=["disabled"],p7=["disabled"],m7={class:"flex items-center gap-2"},g7=["disabled"],O7=["disabled"],v7=Ie({__name:"FinalizeConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=r,n=e,s=_(""),i=_(null),o=_(!1),a=_(!1),l=_(t.baseBranch),c=_([]),u=_(!1),h=yu();async function p(){a.value=!0;try{const g=await $fetch("/api/chat/generate-commit-message",{method:"POST",body:{conversationId:t.worktreePath.split("/").pop()?.replace("sc-","")||"",worktreePath:t.worktreePath}});g.success&&g.message&&(s.value=g.message)}catch{}finally{a.value=!1}}mt(async()=>{const g=(async()=>{try{const y=t.worktreePath.split("/").pop()||"",b=await $fetch(`/api/commits/${encodeURIComponent(y)}`,{params:{workingDirectory:t.worktreePath}});i.value=b.aheadCount}catch{i.value=null}})(),O=(async()=>{u.value=!0;try{await h.initialize();const y=await $fetch("/api/git/branches",{query:{workingDirectory:h.workingDirectory}});c.value=y.branches.filter(b=>!b.isRemote&&!b.name.startsWith("sc/")).map(b=>b.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([g,O])});function f(){s.value.trim()&&(o.value=!0,n("confirm",s.value.trim(),l.value))}return(g,O)=>(v(),x("div",r7,[d("div",n7,[O[4]||(O[4]=d("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Finalize ",-1)),d("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:O[0]||(O[0]=y=>n("cancel"))},[ee(m(Pt),{class:"w-4 h-4"})])]),d("div",s7,[d("div",i7,[O[5]||(O[5]=d("span",{class:"text-retro-muted"},"target:",-1)),d("div",o7,[He(d("select",{"onUpdate:modelValue":O[1]||(O[1]=y=>l.value=y),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(),x("option",{key:0,value:r.baseBranch},B(r.baseBranch),9,l7)):U("",!0),(v(!0),x(we,null,Fe(c.value,y=>(v(),x("option",{key:y,value:y},B(y),9,c7))),128))],8,a7),[[ms,l.value]]),ee(m(Su),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),d("div",u7,[O[6]||(O[6]=d("span",{class:"text-retro-muted"},"commits:",-1)),d("span",h7,B(i.value!==null?i.value:"..."),1)])]),d("div",d7,[He(d("textarea",{"onUpdate:modelValue":O[2]||(O[2]=y=>s.value=y),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,f7),[[Xt,s.value]]),d("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:p},[ee(m(ol),{class:Re(["w-4 h-4",{"animate-spin":a.value}])},null,8,["class"])],8,p7)]),d("div",m7,[d("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:f},[ee(m(wu),{class:"w-3.5 h-3.5"}),Xe(" "+B(o.value?"Finalizing...":"Confirm"),1)],8,g7),d("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:O[3]||(O[3]=y=>n("cancel"))}," Cancel ",8,O7)])]))}}),b7={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},x7={class:"flex items-center justify-between"},y7={class:"space-y-1 text-xs font-mono"},k7={class:"flex items-center gap-2"},w7={class:"text-retro-cyan"},S7={class:"flex items-center gap-2"},$7={class:"relative"},C7=["disabled"],Q7=["value"],P7=["value"],T7={class:"flex items-center gap-2"},M7={class:"text-retro-text"},A7={class:"flex items-center gap-2"},_7=["disabled"],R7=["disabled"],B7=Ie({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=r,n=e,s=_(null),i=_(!1),o=_(t.baseBranch),a=_([]),l=_(!1),c=yu();async function u(p){try{const f=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:p}});s.value=f.ahead}catch{s.value=null}}mt(async()=>{const p=u(o.value),f=(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([p,f])}),ze(o,p=>{u(p)});function h(){i.value=!0,n("confirm",o.value)}return(p,f)=>(v(),x("div",b7,[d("div",x7,[f[3]||(f[3]=d("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Rebase Worktree ",-1)),d("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:f[0]||(f[0]=g=>n("cancel"))},[ee(m(Pt),{class:"w-4 h-4"})])]),d("div",y7,[d("div",k7,[f[4]||(f[4]=d("span",{class:"text-retro-muted"},"worktree:",-1)),d("span",w7,B(r.worktreeBranch),1)]),d("div",S7,[f[5]||(f[5]=d("span",{class:"text-retro-muted"},"target:",-1)),d("div",$7,[He(d("select",{"onUpdate:modelValue":f[1]||(f[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(),x("option",{key:0,value:r.baseBranch},B(r.baseBranch),9,Q7)):U("",!0),(v(!0),x(we,null,Fe(a.value,g=>(v(),x("option",{key:g,value:g},B(g),9,P7))),128))],8,C7),[[ms,o.value]]),ee(m(Su),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),d("div",T7,[f[6]||(f[6]=d("span",{class:"text-retro-muted"},"commits ahead:",-1)),d("span",M7,B(s.value!==null?s.value:"..."),1)])]),d("div",A7,[d("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},[ee(m(wu),{class:"w-3.5 h-3.5"}),Xe(" "+B(i.value?"Rebasing...":"Confirm"),1)],8,_7),d("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:f[2]||(f[2]=g=>n("cancel"))}," Cancel ",8,R7)])]))}}),Z7={class:"flex-1 flex flex-col overflow-hidden"},E7={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},D7={class:"text-xs font-mono text-retro-text truncate"},L7={class:"flex items-center gap-2 flex-shrink-0"},X7=["title"],I7=["disabled"],V7=["disabled"],z7={key:5,class:"text-xs font-mono text-retro-green"},N7={key:6,class:"text-[11px] font-mono text-retro-muted"},W7={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},j7=["innerHTML"],q7=["value","readonly"],Y7={key:2,class:"flex-shrink-0 px-4 py-2 border-t border-retro-border bg-retro-yellow/10 text-retro-yellow text-xs font-mono"},F7=Ie({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},aiResolving:{type:Boolean}},emits:["resolve","aiResolve"],setup(r,{emit:e}){const t=r,n=e,s=_(t.file.content),i=_(!1),o=_(""),a=_(!1);ze(()=>t.file.path,()=>{s.value=t.file.content,i.value=!1,f()}),ze(()=>t.file.content,()=>{i.value||(s.value=t.file.content,f())});const l=/^<{7}\s.*\n([\s\S]*?)^={7}\n([\s\S]*?)^>{7}\s.*\n/gm,c=/^<{7}[^\n]*\n([\s\S]*?)^={7}[^\n]*\n([\s\S]*?)^>{7}[^\n]*\n?/gm,u=J(()=>/^<{7}\s/m.test(s.value)),h=J(()=>b(s.value).length);function p(ne){const L=ne.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"}[L]||"text"}async function f(){a.value=!0;try{const{codeToHtml:ne}=await as(async()=>{const{codeToHtml:me}=await import("./ovAaTTn7.js");return{codeToHtml:me}},__vite__mapDeps([3,1,2]),import.meta.url),L=p(t.file.path),Z=s.value.split(`
72
+ `),status:"complete"},fe);return}const ve=t.activeConversation,_e={q:H.q,mode:H.mode??"hybrid",featureId:H.featureId??ve?.featureId,fileType:H.fileType,limit:String(H.limit??5)};try{const We=await $fetch("/api/specs/search",{query:_e});t.updateMessage(se.id,{content:Le({...H,mode:_e.mode,featureId:_e.featureId},We),status:"complete"},fe)}catch(We){const Ge=We instanceof Error?We.message:"Failed to run spec search";t.updateMessage(se.id,{content:`Spec search failed: ${Ge}`,status:"error"},fe)}}async function Mt(){const H=t.activeConversation,fe={permissionMode:t.permissionMode};H?.hasWorktree&&H.worktreePath?fe.cwd=H.worktreePath:H?.cwd&&(fe.cwd=H.cwd),H?.featureId&&(fe.featureId=H.featureId),H?.providerId&&(fe.providerId=H.providerId),H?.providerModelKey&&(fe.providerModelKey=H.providerModelKey),H?.providerSessionId&&(fe.providerSessionId=H.providerSessionId);const se=await $fetch("/api/chat/context",{query:fe}),ve=t.activeConversationId??await t.createConversation(),_e=t.addAssistantMessage(ve);t.updateMessage(_e.id,{content:ce(se),status:"complete"},ve)}function Zt(H=[]){const fe=ka(t.activeConversation,!0)??{};return H.length>0?{...fe,attachments:H}:Object.keys(fe).length>0?fe:void 0}function bn(H){const fe=t.addAssistantMessage(H);return t.startSession(`session-${Date.now()}`,H),t.startConversationStreaming(H),t.saveConversation(H,!0),fe}function Kt(H,fe,se,ve){const _e=se instanceof Error?se.message:ve;t.setSessionError(_e,H),t.updateMessage(fe,{status:"error"},H),t.endSession(H),t.endConversationStreaming(H)}async function Er(){const H=u.value.trim(),fe=[...y.value];if(H.length===0&&fe.length===0||t.isActiveConversationStreaming||f.value||e.disabled)return;const se=!!t.activeConversationId;let ve=null,_e=null;if(H==="/reset"||H==="/reset-context"||H==="/new"||H==="/clear"){await zn();return}if(H==="/context"||H==="/ctx"){await Mt(),u.value="",De(),xt();return}const We=Y(H);if(We){await Ve(We),u.value="",De(),xt();return}f.value=!0,u.value="",De(),xt();try{if(await t.addUserMessageWithConversation(H,fe),ve=t.activeConversationId,!ve)throw new Error("Failed to create or select a conversation");se||q(ve);const Ge=bn(ve);_e=Ge.id,await s(H,Ge.id,ve,Zt(fe))}catch(Ge){if(ve&&_e)Kt(ve,_e,Ge,"Failed to send message");else{const it=Ge instanceof Error?Ge.message:"Failed to send message";t.setSessionError(it)}}finally{f.value=!1}}async function $r(){try{l(t.activeConversationId)}catch{}}async function zn(){if(t.activeConversationId){u.value="",De(),xt(),f.value=!0;try{await c(t.activeConversationId);const H=t.addAssistantMessage(t.activeConversationId);t.updateMessage(H.id,{content:"✨ **Context cleared** — The AI conversation context has been reset. Starting fresh from here.",status:"complete"},t.activeConversationId);const{useToast:fe}=await as(async()=>{const{useToast:ve}=await import("./DXzkgxwX.js").then(_e=>_e.n);return{useToast:ve}},__vite__mapDeps([0,1,2]),import.meta.url);fe().success("AI context has been reset. The conversation will start fresh.")}catch(H){console.error("Failed to reset context:",H);const{useToast:fe}=await as(async()=>{const{useToast:ve}=await import("./DXzkgxwX.js").then(_e=>_e.n);return{useToast:ve}},__vite__mapDeps([0,1,2]),import.meta.url);fe().error("Failed to reset context. Please try again.")}finally{f.value=!1}}}async function Cr(){const H=t.messages;let fe=null;for(let _e=H.length-1;_e>=0;_e--)if(H[_e].role==="user"){fe={content:H[_e].content,attachments:H[_e].attachments??[]};break}if(!fe||!t.activeConversationId)return;const se=t.activeConversationId;t.clearError(),f.value=!0;let ve=null;try{const _e=bn(se);ve=_e.id,await s(fe.content,_e.id,se,Zt(fe.attachments))}catch(_e){if(ve)Kt(se,ve,_e,"Failed to retry message");else{const We=_e instanceof Error?_e.message:"Failed to retry message";t.setSessionError(We,se)}}finally{f.value=!1}}function xn(H){H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),Er())}function Nn(){const H=h.value;if(H){if(!u.value.trim()){H.style.height="";return}H.style.height="auto",H.style.height=Math.min(H.scrollHeight,200)+"px"}}function yn(){if(b!==null)return;b=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):fe=>setTimeout(()=>fe(Date.now()),16))(()=>{b=null,Nn()})}function xt(){const H=h.value;H&&(H.style.height="")}function Qr(){br(()=>{h.value?.focus()})}return ze(u,yn),ze(()=>t.isActiveConversationStreaming,(H,fe)=>{fe&&!H&&Qr()}),ze(()=>t.activeConversationId,()=>{t.activeConversationId&&(C.value=null),De(),Qr()}),(H,fe)=>(v(),x("div",dB,[d("div",fB,[d("div",pB,[d("button",{disabled:r.disabled||m(t).isActiveConversationStreaming||m(w)||m(M)||m(A)||m(I).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:fe[0]||(fe[0]=se=>O.value=!m(O))},[d("span",gB,B(m(Z)),1),ee(m(Ap),{class:"w-3 h-3 flex-shrink-0"})],8,mB),m(O)?(v(),x("div",OB,[m(I).length===0?(v(),x("div",vB," Loading models... ")):U("",!0),(v(!0),x(we,null,Fe(m(oe),se=>(v(),x("div",{key:se.providerId,class:"py-0.5"},[d("div",bB,B(se.providerName),1),(v(!0),x(we,null,Fe(se.options,ve=>(v(),x("button",{key:ve.key,disabled:!ve.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",m(L)===ve.key?"bg-retro-panel text-retro-text":"text-retro-muted"]),onClick:_e=>V(ve)},[d("span",yB,B(ve.modelLabel)+B(ve.compatible?"":" (unsupported for current permission mode)"),1)],10,xB))),128))]))),128))])):U("",!0)]),d("div",kB,[d("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",N[m(t).permissionMode]]),onClick:fe[1]||(fe[1]=se=>g.value=!m(g))},[(v(),Oe(Zs(X[m(t).permissionMode]),{class:"w-4 h-4"})),d("span",null,B(m(ws)[m(t).permissionMode]),1),ee(m(Ap),{class:"w-3 h-3"})],2),m(g)?(v(),x("div",wB,[(v(),x(we,null,Fe(["plan","ask","auto","bypass"],se=>d("button",{key:se,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",[N[se],m(t).permissionMode===se?"bg-retro-panel":""]]),onClick:ve=>me(se)},[(v(),Oe(Zs(X[se]),{class:"w-4 h-4"})),d("span",null,B(m(ws)[se]),1)],10,SB)),64))])):U("",!0)]),d("span",$B,B(m(t).permissionMode==="plan"?"Plan only":m(t).permissionMode==="ask"?"Ask before actions":m(t).permissionMode==="auto"?"Auto approve":"All permissions"),1)]),m(w)?(v(),x("div",CB,[d("div",QB,[d("div",PB,[fe[4]||(fe[4]=d("div",{class:"text-xs font-mono text-retro-yellow font-bold mb-1"}," Permission Required ",-1)),d("div",TB,[d("span",MB,B(m(t).pendingPermission?.tool),1),m(t).pendingPermission?.filePath?(v(),x("span",AB," - "+B(m(t).pendingPermission.filePath),1)):m(t).pendingPermission?.command?(v(),x("span",_B," - "+B(m(t).pendingPermission.command),1)):U("",!0)])]),d("div",{class:"flex gap-2 flex-shrink-0"},[d("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:R}," Allow "),d("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:G}," Deny ")])])])):U("",!0),m(M)?(v(),x("div",RB,[d("div",{class:"flex items-center justify-between gap-3"},[fe[5]||(fe[5]=d("div",{class:"flex-1 min-w-0"},[d("div",{class:"text-xs font-mono text-retro-cyan font-bold mb-1"}," Plan Ready for Review "),d("div",{class:"text-xs font-mono text-retro-muted"}," Approve to switch to Auto mode and start implementation. ")],-1)),d("div",{class:"flex gap-2 flex-shrink-0"},[d("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-green/20 text-retro-green border border-retro-green/50 hover:bg-retro-green/30 transition-colors",onClick:ae}," Approve & Implement "),d("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:xe}," Reject ")])])])):U("",!0),m(y).length>0?(v(),x("div",BB,[(v(!0),x(we,null,Fe(m(y),se=>(v(),x("div",{key:se.id,class:"relative w-24 rounded border border-retro-border/70 bg-retro-black/80 p-1"},[d("img",{src:se.dataUrl,alt:se.name,class:"h-16 w-full rounded object-cover"},null,8,ZB),d("div",EB,B(se.name),1),d("div",DB,B(Ue(se.size)),1),d("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:ve=>Ae(se.id)},[ee(m(Pt),{class:"h-3 w-3"})],8,LB)]))),128))])):U("",!0),d("div",XB,[d("input",{ref_key:"fileInputRef",ref:p,type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:pe},null,544),d("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||m(t).isActiveConversationStreaming||m(w)||m(M),onClick:fe[2]||(fe[2]=se=>m(p)?.click())},[ee(m(ov),{class:"w-5 h-5"})],8,IB),d("div",VB,[He(d("textarea",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":fe[3]||(fe[3]=se=>tt(u)?u.value=se:null),disabled:r.disabled||m(t).isActiveConversationStreaming||m(w)||m(M),placeholder:r.disabled?"This conversation is finalized (read-only)":"Type a message...",rows:"1",class:"w-full h-full min-h-[40px] px-3 py-2 bg-retro-black border border-retro-border rounded text-sm font-mono text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan disabled:opacity-50 disabled:cursor-not-allowed resize-none overflow-hidden",onKeydown:xn},null,40,zB),[[Xt,m(u)]])]),m(Ce)?(v(),x("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:Cr},[ee(m(cB),{class:"w-5 h-5"})])):U("",!0),!m($)&&!m(w)?(v(),x("button",{key:1,disabled:!m(he),class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-cyan/20 text-retro-cyan hover:bg-retro-cyan/30 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",onClick:Er},[ee(m(uB),{class:"w-5 h-5"})],8,NB)):m($)?(v(),x("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:$r},[ee(m(hB),{class:"w-5 h-5"})])):U("",!0)]),fe[6]||(fe[6]=d("div",{class:"mt-1 text-xs font-mono text-retro-muted"}," Press Enter to send, Shift+Enter for new line. Slash commands: `/context`, `/reset`, `/new`, `/clear`, `/spec-search`. You can attach up to 4 images (5 MB each). ",-1))]))}}),qB={class:"h-64 border-t border-retro-border bg-retro-dark/50 flex flex-col"},YB={class:"h-9 flex items-center justify-between px-3 border-b border-retro-border/40"},FB={key:0,class:"flex-1 flex items-center justify-center text-xs font-mono text-retro-muted"},UB={key:1,class:"flex-1 overflow-y-auto scrollbar-custom"},GB={class:"flex items-center gap-2 text-[10px] font-mono"},HB={class:"text-retro-muted"},KB={class:"text-retro-muted"},JB={class:"text-retro-green truncate"},e7={class:"mt-1 text-[11px] font-mono text-retro-text whitespace-pre-wrap break-words"},t7=Ie({__name:"ChatDebugPanel",setup(r){const e=kr(),{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(),x("div",qB,[d("div",YB,[o[1]||(o[1]=d("div",{class:"text-[11px] font-mono text-retro-text"}," Debug Stream (CLI/Provider) ",-1)),d("button",{class:"p-1 rounded hover:bg-retro-panel transition-colors",title:"Clear debug events",onClick:o[0]||(o[0]=a=>m(e).clearDebugEvents())},[ee(m(fn),{class:"w-3.5 h-3.5 text-retro-muted"})])]),m(t).length===0?(v(),x("div",FB," No debug events yet ")):(v(),x("div",UB,[(v(!0),x(we,null,Fe(m(t),a=>(v(),x("div",{key:a.id,class:"px-3 py-2 border-b border-retro-border/20"},[d("div",GB,[d("span",HB,B(n(a.timestamp)),1),d("span",{class:Re(s(a.direction))},B(a.direction.toUpperCase()),3),d("span",KB,B(a.channel),1),d("span",JB,B(a.eventType),1)]),d("pre",e7,B(a.payload),1)]))),128))]))]))}}),r7={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},n7={class:"flex items-center justify-between"},s7={class:"space-y-1 text-xs font-mono"},i7={class:"flex items-center gap-2"},o7={class:"relative"},a7=["disabled"],l7=["value"],c7=["value"],u7={class:"flex items-center gap-2"},h7={class:"text-retro-text"},d7={class:"relative"},f7=["disabled"],p7=["disabled"],m7={class:"flex items-center gap-2"},g7=["disabled"],O7=["disabled"],v7=Ie({__name:"FinalizeConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=r,n=e,s=_(""),i=_(null),o=_(!1),a=_(!1),l=_(t.baseBranch),c=_([]),u=_(!1),h=yu();async function p(){a.value=!0;try{const g=await $fetch("/api/chat/generate-commit-message",{method:"POST",body:{conversationId:t.worktreePath.split("/").pop()?.replace("sc-","")||"",worktreePath:t.worktreePath}});g.success&&g.message&&(s.value=g.message)}catch{}finally{a.value=!1}}mt(async()=>{const g=(async()=>{try{const y=t.worktreePath.split("/").pop()||"",b=await $fetch(`/api/commits/${encodeURIComponent(y)}`,{params:{workingDirectory:t.worktreePath}});i.value=b.aheadCount}catch{i.value=null}})(),O=(async()=>{u.value=!0;try{await h.initialize();const y=await $fetch("/api/git/branches",{query:{workingDirectory:h.workingDirectory}});c.value=y.branches.filter(b=>!b.isRemote&&!b.name.startsWith("sc/")).map(b=>b.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([g,O])});function f(){s.value.trim()&&(o.value=!0,n("confirm",s.value.trim(),l.value))}return(g,O)=>(v(),x("div",r7,[d("div",n7,[O[4]||(O[4]=d("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Finalize ",-1)),d("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:O[0]||(O[0]=y=>n("cancel"))},[ee(m(Pt),{class:"w-4 h-4"})])]),d("div",s7,[d("div",i7,[O[5]||(O[5]=d("span",{class:"text-retro-muted"},"target:",-1)),d("div",o7,[He(d("select",{"onUpdate:modelValue":O[1]||(O[1]=y=>l.value=y),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(),x("option",{key:0,value:r.baseBranch},B(r.baseBranch),9,l7)):U("",!0),(v(!0),x(we,null,Fe(c.value,y=>(v(),x("option",{key:y,value:y},B(y),9,c7))),128))],8,a7),[[ms,l.value]]),ee(m(Su),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),d("div",u7,[O[6]||(O[6]=d("span",{class:"text-retro-muted"},"commits:",-1)),d("span",h7,B(i.value!==null?i.value:"..."),1)])]),d("div",d7,[He(d("textarea",{"onUpdate:modelValue":O[2]||(O[2]=y=>s.value=y),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,f7),[[Xt,s.value]]),d("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:p},[ee(m(ol),{class:Re(["w-4 h-4",{"animate-spin":a.value}])},null,8,["class"])],8,p7)]),d("div",m7,[d("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:f},[ee(m(wu),{class:"w-3.5 h-3.5"}),Xe(" "+B(o.value?"Finalizing...":"Confirm"),1)],8,g7),d("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:O[3]||(O[3]=y=>n("cancel"))}," Cancel ",8,O7)])]))}}),b7={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},x7={class:"flex items-center justify-between"},y7={class:"space-y-1 text-xs font-mono"},k7={class:"flex items-center gap-2"},w7={class:"text-retro-cyan"},S7={class:"flex items-center gap-2"},$7={class:"relative"},C7=["disabled"],Q7=["value"],P7=["value"],T7={class:"flex items-center gap-2"},M7={class:"text-retro-text"},A7={class:"flex items-center gap-2"},_7=["disabled"],R7=["disabled"],B7=Ie({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=r,n=e,s=_(null),i=_(!1),o=_(t.baseBranch),a=_([]),l=_(!1),c=yu();async function u(p){try{const f=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:p}});s.value=f.ahead}catch{s.value=null}}mt(async()=>{const p=u(o.value),f=(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([p,f])}),ze(o,p=>{u(p)});function h(){i.value=!0,n("confirm",o.value)}return(p,f)=>(v(),x("div",b7,[d("div",x7,[f[3]||(f[3]=d("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Rebase Worktree ",-1)),d("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:f[0]||(f[0]=g=>n("cancel"))},[ee(m(Pt),{class:"w-4 h-4"})])]),d("div",y7,[d("div",k7,[f[4]||(f[4]=d("span",{class:"text-retro-muted"},"worktree:",-1)),d("span",w7,B(r.worktreeBranch),1)]),d("div",S7,[f[5]||(f[5]=d("span",{class:"text-retro-muted"},"target:",-1)),d("div",$7,[He(d("select",{"onUpdate:modelValue":f[1]||(f[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(),x("option",{key:0,value:r.baseBranch},B(r.baseBranch),9,Q7)):U("",!0),(v(!0),x(we,null,Fe(a.value,g=>(v(),x("option",{key:g,value:g},B(g),9,P7))),128))],8,C7),[[ms,o.value]]),ee(m(Su),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),d("div",T7,[f[6]||(f[6]=d("span",{class:"text-retro-muted"},"commits ahead:",-1)),d("span",M7,B(s.value!==null?s.value:"..."),1)])]),d("div",A7,[d("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},[ee(m(wu),{class:"w-3.5 h-3.5"}),Xe(" "+B(i.value?"Rebasing...":"Confirm"),1)],8,_7),d("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:f[2]||(f[2]=g=>n("cancel"))}," Cancel ",8,R7)])]))}}),Z7={class:"flex-1 flex flex-col overflow-hidden"},E7={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},D7={class:"text-xs font-mono text-retro-text truncate"},L7={class:"flex items-center gap-2 flex-shrink-0"},X7=["title"],I7=["disabled"],V7=["disabled"],z7={key:5,class:"text-xs font-mono text-retro-green"},N7={key:6,class:"text-[11px] font-mono text-retro-muted"},W7={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},j7=["innerHTML"],q7=["value","readonly"],Y7={key:2,class:"flex-shrink-0 px-4 py-2 border-t border-retro-border bg-retro-yellow/10 text-retro-yellow text-xs font-mono"},F7=Ie({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},aiResolving:{type:Boolean}},emits:["resolve","aiResolve"],setup(r,{emit:e}){const t=r,n=e,s=_(t.file.content),i=_(!1),o=_(""),a=_(!1);ze(()=>t.file.path,()=>{s.value=t.file.content,i.value=!1,f()}),ze(()=>t.file.content,()=>{i.value||(s.value=t.file.content,f())});const l=/^<{7}\s.*\n([\s\S]*?)^={7}\n([\s\S]*?)^>{7}\s.*\n/gm,c=/^<{7}[^\n]*\n([\s\S]*?)^={7}[^\n]*\n([\s\S]*?)^>{7}[^\n]*\n?/gm,u=J(()=>/^<{7}\s/m.test(s.value)),h=J(()=>b(s.value).length);function p(ne){const L=ne.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"}[L]||"text"}async function f(){a.value=!0;try{const{codeToHtml:ne}=await as(async()=>{const{codeToHtml:me}=await import("./DJnEVOKq.js");return{codeToHtml:me}},__vite__mapDeps([3,1,2]),import.meta.url),L=p(t.file.path),Z=s.value.split(`
73
73
  `);let z="",q=!1,V=!1,X=0,N=-1;for(const me of Z){X++;const K=/^<{7}\s/.test(me),he=/^={7}$/.test(me),$=/^>{7}\s/.test(me);if(K){N++,q=!0,V=!1,z+=`<div class="conflict-line conflict-marker-line" data-line="${X}"><span class="line-number">${X}</span><span class="line-content conflict-marker">${g(me)}</span></div>
74
74
  `,t.resolved||(z+=A(N));continue}if(he&&q){q=!1,V=!0,z+=`<div class="conflict-line conflict-marker-line" data-line="${X}"><span class="line-number">${X}</span><span class="line-content conflict-marker">${g(me)}</span></div>
75
75
  `;continue}if($){V=!1,z+=`<div class="conflict-line conflict-marker-line" data-line="${X}"><span class="line-number">${X}</span><span class="line-content conflict-marker">${g(me)}</span></div>