spec-cat 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/1XtI-90W.js +1 -0
- package/.output/public/_nuxt/{CagHV4Oi.js → BAm7cJoI.js} +2 -2
- package/.output/public/_nuxt/{BqGF4xj0.js → BjfxbyhV.js} +1 -1
- package/.output/public/_nuxt/{Craz1Yql.js → C8lJXn2B.js} +1 -1
- package/.output/public/_nuxt/{BQ5uCGly.js → CObKakIs.js} +1 -1
- package/.output/public/_nuxt/{DUhfwlFz.js → ChhNAy6p.js} +1 -1
- package/.output/public/_nuxt/{DGRa9Fmp.js → DNqICsON.js} +1 -1
- package/.output/public/_nuxt/{DEk1NNC6.js → DrYa9eDS.js} +1 -1
- package/.output/public/_nuxt/{CNV4uQF5.js → SpUrQtl1.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/e126c3b8-8ec1-4c8c-817f-9aa31d467e1b.json +1 -0
- package/.output/public/_nuxt/d5fpdBZE.js +126 -0
- package/.output/server/chunks/_/codexProvider.mjs +10 -0
- package/.output/server/chunks/_/codexProvider.mjs.map +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs.map +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +644 -633
- package/.output/server/chunks/routes/_ws.mjs +122 -12
- package/.output/server/chunks/routes/_ws.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat.post.mjs +32 -0
- package/.output/server/chunks/routes/api/chat.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/rebase/ai-resolve.post.mjs +4 -10
- package/.output/server/chunks/routes/api/rebase/ai-resolve.post.mjs.map +1 -1
- package/.output/server/package.json +1 -1
- package/package.json +1 -1
- package/.output/public/_nuxt/BmA6LmfO.js +0 -1
- package/.output/public/_nuxt/builds/meta/17d92f2c-b959-4d9d-b5d8-9871aa90e6a8.json +0 -1
- package/.output/public/_nuxt/vlI4SkjN.js +0 -126
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ChhNAy6p.js","./BAm7cJoI.js","./entry.B5Gpnt5-.css","./CObKakIs.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{y as i,z as u,A as r,d as Ce,C as Y,G as s,P as Te,R as ft,Q as Ie,S as he,E as we,B as _,O as H,g as S,U as Be,V as ln,k as j,W as At,H as ve,L as ce,o as st,X as bt,Y as Oo,K as Me,Z as gn,T as Qt,_ as En,M as $n,D as We,N as lt,$ as Ts,I as hr,a0 as be,a1 as Bn,a2 as Dt,a3 as _n,a4 as Dr,a5 as As,a6 as vo,a7 as Bs,a8 as Es,a9 as Rs,x as Ps}from"./BAm7cJoI.js";import{r as pt,c as cn,b as pr,a as xn}from"./SpUrQtl1.js";import{_ as qr}from"./DlAUqK2U.js";import{S as Ir,i as Ds,c as Is,P as Ls,W as go,M as xo,d as bo,e as yo,g as ur,f as Uo,D as jo,h as zo,j as Ns,u as Kn,b as Dn,k as vn,l as Fs,m as An,n as tr,a as wo,_ as Hs}from"./ChhNAy6p.js";function Os(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 Us(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m8.25 3v6.75m0 0-3-3m3 3 3-3M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})])}function Lr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})])}function js(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 zs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 Vs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function Vo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3"})])}function Wo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})])}function Go(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function qo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 Zo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 Ko(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})])}function Ws(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 Zr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z"})])}function Gs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"})])}function qs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z"})])}function Zs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 Yo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 vr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})])}function Kr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function Ks(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}function Yr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"})])}function Xr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9"})])}function Ys(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"})])}function Qr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 Rn(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 7.5V6.108c0-1.135.845-2.098 1.976-2.192.373-.03.748-.057 1.123-.08M15.75 18H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08M15.75 18.75v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5A3.375 3.375 0 0 0 6.375 7.5H5.25m11.9-3.664A2.251 2.251 0 0 0 15 2.25h-1.5a2.251 2.251 0 0 0-2.15 1.586m5.8 0c.065.21.1.433.1.664v.75h-6V4.5c0-.231.035-.454.1-.664M6.75 7.5H4.875c-.621 0-1.125.504-1.125 1.125v12c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V16.5a9 9 0 0 0-9-9Z"})])}function Xo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})])}function Qo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9.75v6.75m0 0-3-3m3 3 3-3m-8.25 6a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"})])}function Nr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5"})])}function Jo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function Xs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 es(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 0 0 2.25-2.25V6.75a2.25 2.25 0 0 0-2.25-2.25H6.75A2.25 2.25 0 0 0 4.5 6.75v10.5a2.25 2.25 0 0 0 2.25 2.25Zm.75-12h9v9h-9v-9Z"})])}function Qs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 Js(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 ea(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 qn(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})])}function In(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"})])}function Cn(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})])}function ta(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 ts(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function na(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776"})])}function Fr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z"})])}function ra(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 oa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 sa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 aa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 ns(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 Zn(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])}function ia(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"})])}function la(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"})])}function Jr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 rs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"})])}function ca(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})])}function ko(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z"})])}function eo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 os(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 to(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 gr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"})])}function ua(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"})])}function no(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 6h.008v.008H6V6Z"})])}function Hr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"})])}function da(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"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 fa={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},ma={class:"relative flex-1 min-w-0"},ha={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},pa=["disabled"],va=["disabled"],ga=Ce({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(e,{expose:n,emit:t}){const a=t,o=S(""),l=S(null);let c=null;function f(){c&&clearTimeout(c),c=setTimeout(()=>{a("search",o.value)},200)}function m(b){b.key==="Escape"?(b.preventDefault(),a("close")):b.key==="Enter"&&(b.preventDefault(),b.shiftKey?a("prev"):a("next"))}function d(){l.value?.focus(),l.value?.select()}return n({focus:d}),(b,C)=>(i(),u("div",fa,[Y(s(Zn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("div",ma,[Te(r("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":C[0]||(C[0]=g=>Ie(o)?o.value=g:null),type:"text",placeholder:"Find in commits... (Ctrl+F)","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:f,onKeydown:m},null,544),[[ft,s(o)]])]),s(o)?(i(),u("span",ha,[e.resultCount>0?(i(),u(he,{key:0},[we(_(e.currentIndex+1)+" of "+_(e.resultCount),1)],64)):(i(),u(he,{key:1},[we(" No results ")],64))])):H("",!0),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:e.resultCount===0,"aria-label":"Previous result",title:"Previous (Shift+Enter)",onClick:C[1]||(C[1]=g=>a("prev"))},[Y(s(Ys),{class:"w-4 h-4"})],8,pa),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:e.resultCount===0,"aria-label":"Next result",title:"Next (Enter)",onClick:C[2]||(C[2]=g=>a("next"))},[Y(s(Ks),{class:"w-4 h-4"})],8,va),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors","aria-label":"Close find widget",title:"Close (Escape)",onClick:C[3]||(C[3]=g=>a("close"))},[Y(s(pt),{class:"w-4 h-4"})])]))}}),xa={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},ba={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},ya={class:"flex-1 overflow-auto max-h-[300px]"},wa={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},ka=["onKeyup"],Ca=["onClick"],$a={class:"text-retro-muted truncate flex-1 font-mono"},Sa=["onClick"],_a=["onClick"],Ma={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},Ta={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},Aa={class:"flex gap-2 justify-end"},Ba=["disabled"],Ea={key:1,class:"px-3 py-2 border-t border-retro-border"},Ra=Ce({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(e,{emit:n}){const t=n,a=S(!1),o=S(""),l=S(""),c=S(null),f=S("");function m(){a.value=!0,o.value="",l.value=""}function d(){!o.value.trim()||!l.value.trim()||(t("add",{name:o.value.trim(),url:l.value.trim()}),a.value=!1)}function b(v){c.value=v.name,f.value=v.fetchUrl}function C(v){f.value.trim()&&(t("edit",{name:v,newUrl:f.value.trim()}),c.value=null)}function g(){c.value=null}return(v,h)=>(i(),u("div",xa,[r("div",ba,[h[5]||(h[5]=r("h3",{class:"text-sm font-semibold text-retro-text"},"Remote Repositories",-1)),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",onClick:h[0]||(h[0]=R=>t("close"))},[Y(s(pt),{class:"w-4 h-4"})])]),r("div",ya,[(i(!0),u(he,null,Be(e.remotes,R=>(i(),u("div",{key:R.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[r("span",wa,_(R.name),1),s(c)===R.name?(i(),u(he,{key:0},[Te(r("input",{"onUpdate:modelValue":h[1]||(h[1]=G=>Ie(f)?f.value=G: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:[ln(G=>C(R.name),["enter"]),ln(g,["escape"])]},null,40,ka),[[ft,s(f)]]),r("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:G=>C(R.name)},[Y(s(Kr),{class:"w-3.5 h-3.5"})],8,Ca),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:g},[Y(s(pt),{class:"w-3.5 h-3.5"})])],64)):(i(),u(he,{key:1},[r("span",$a,_(R.fetchUrl),1),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:G=>b(R)},[Y(s(Jr),{class:"w-3.5 h-3.5"})],8,Sa),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:G=>t("delete",R.name)},[Y(s(cn),{class:"w-3.5 h-3.5"})],8,_a)],64))]))),128)),e.remotes.length===0?(i(),u("div",Ma," No remotes configured ")):H("",!0)]),s(a)?(i(),u("div",Ta,[Te(r("input",{"onUpdate:modelValue":h[2]||(h[2]=R=>Ie(o)?o.value=R: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),[[ft,s(o)]]),Te(r("input",{"onUpdate:modelValue":h[3]||(h[3]=R=>Ie(l)?l.value=R: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:ln(d,["enter"])},null,544),[[ft,s(l)]]),r("div",Aa,[r("button",{class:"px-2 py-1 text-xs text-retro-muted hover:text-retro-text transition-colors",onClick:h[4]||(h[4]=R=>a.value=!1)}," Cancel "),r("button",{class:"px-2 py-1 text-xs bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40 rounded hover:bg-retro-cyan/30 transition-colors",disabled:!s(o).trim()||!s(l).trim(),onClick:d}," Add Remote ",8,Ba)])])):H("",!0),s(a)?H("",!0):(i(),u("div",Ea,[r("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:m},[Y(s(pr),{class:"w-3.5 h-3.5"}),h[6]||(h[6]=we(" Add Remote ",-1))])]))]))}}),xr={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},nr=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Pn={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"}},Pa=["width","height"],Da=["d","stroke","stroke-dasharray"],Ia={key:0},La=["cx","r"],Na=["cx","r","fill"],Fa=["cx","r","stroke"],Ha=["cx","r","fill"],Oa=["cx","r","stroke"],Ua=["cx","r","fill"],ja=["cx","r"],za=["cx","r","fill"],ss=Ce({__name:"GitGraphSvg",props:{rowData:{},maxLane:{default:4},highlightBranches:{},tooltipText:{}},setup(e){const n=e,{COLUMN_WIDTH:t,ROW_HEIGHT:a,NODE_RADIUS:o,PADDING:l}=xr,c=j(()=>l*2+(n.maxLane+1)*t),f=a,m=a/2;function d(g){return l+g*t}function b(g){const v=d(g.fromLane),h=d(g.toLane);if(g.type==="vertical")return`M ${v} 0 L ${h} ${f}`;if(g.type==="vertical-top")return`M ${v} 0 L ${v} ${m}`;if(g.type==="vertical-bottom")return`M ${v} ${m} L ${v} ${f}`;if(g.style==="rounded")return`M ${v} ${m} C ${v} ${f}, ${h} ${f}, ${h} ${f}`;{const R=f*.75;return`M ${v} ${m} L ${v} ${R} L ${h} ${f}`}}const C=j(()=>n.rowData?d(n.rowData.lane):l);return(g,v)=>(i(),u("svg",{width:s(c),height:s(f),class:"block flex-shrink-0","aria-hidden":"true"},[e.rowData?(i(),u(he,{key:0},[(i(!0),u(he,null,Be(e.rowData.connections,(h,R)=>(i(),u("path",{key:R,d:b(h),stroke:h.color,"stroke-width":"2",fill:"none","stroke-dasharray":h.type.startsWith("merge")?"4 3":"none"},null,8,Da))),128)),r("g",null,[e.tooltipText?(i(),u("title",Ia,_(e.tooltipText),1)):H("",!0),e.rowData.nodeType==="head"?(i(),u(he,{key:1},[r("circle",{cx:s(C),cy:m,r:s(o)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,La),r("circle",{cx:s(C),cy:m,r:s(o),fill:e.rowData.color},null,8,Na)],64)):e.rowData.nodeType==="merge"?(i(),u(he,{key:2},[r("circle",{cx:s(C),cy:m,r:s(o)+1,fill:"none",stroke:e.rowData.color,"stroke-width":"1.5"},null,8,Fa),r("circle",{cx:s(C),cy:m,r:s(o)-1,fill:e.rowData.color},null,8,Ha)],64)):e.rowData.nodeType==="stash"?(i(),u(he,{key:3},[r("circle",{cx:s(C),cy:m,r:s(o),fill:"none",stroke:e.rowData.color,"stroke-width":"2"},null,8,Oa),r("circle",{cx:s(C),cy:m,r:s(o)-2,fill:e.rowData.color},null,8,Ua)],64)):e.rowData.nodeType==="uncommitted"?(i(),u("circle",{key:4,cx:s(C),cy:m,r:s(o),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,ja)):(i(),u("circle",{key:5,cx:s(C),cy:m,r:s(o),fill:e.rowData.color},null,8,za))])],64)):H("",!0)],8,Pa))}}),Va=["aria-selected","aria-label"],Wa={key:1,class:"flex gap-1 flex-shrink-0"},Ga=["title","onContextmenu"],qa={key:2,class:"flex gap-1 flex-shrink-0"},Za=["onContextmenu"],Ka={class:"text-retro-text text-xs truncate flex-1"},Ya={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},Xa={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},Qa=Ce({__name:"GitCommitRow",props:{commit:{},index:{},isSelected:{type:Boolean},isHighlighted:{type:Boolean},isBranchHighlighted:{type:Boolean},isFeatureHighlighted:{type:Boolean},isPreviewHighlighted:{type:Boolean},isMuted:{type:Boolean},currentBranchName:{},localBranchNames:{},graphRowData:{},maxLane:{},columnVisibility:{}},emits:["click","keydown","branchContextMenu","commitContextMenu","tagContextMenu"],setup(e,{emit:n}){const t=e,a=n,o=j(()=>{const g=t.commit.branches;if(g.length===0)return[];const v=t.localBranchNames,h=[],R=[];for(const V of g)v.has(V)?h.push(V):R.push(V);const G=new Set(h),I=new Map,ee=[];for(const V of R){const re=V.indexOf("/");if(re>0){const ue=V.substring(re+1),se=V.substring(0,re);G.has(ue)?(I.has(ue)||I.set(ue,[]),I.get(ue).push(se)):ee.push(V)}else ee.push(V)}const te=[];for(const V of h){const re=I.get(V)||[];re.length>0?te.push({displayName:`${V}/${re.join(",")}`,originalBranches:[V,...re.map(ue=>`${ue}/${V}`)],isLocal:!0}):te.push({displayName:V,originalBranches:[V],isLocal:!0})}for(const V of ee)te.push({displayName:V,originalBranches:[V],isLocal:!1});return te});function l(g,v){g.preventDefault(),g.stopPropagation();const h=v.originalBranches[0];a("branchContextMenu",{branch:h,x:g.clientX,y:g.clientY,isCurrentBranch:v.isLocal&&v.originalBranches.includes(t.currentBranchName??""),isLocal:v.isLocal})}function c(g,v){g.preventDefault(),g.stopPropagation(),a("tagContextMenu",{tag:v,x:g.clientX,y:g.clientY})}function f(g){g.preventDefault(),g.stopPropagation(),a("commitContextMenu",{x:g.clientX,y:g.clientY})}const{ROW_HEIGHT:m}=xr,d=j(()=>{const g=[t.commit.shortHash];return t.commit.branches.length>0&&g.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&g.push(t.commit.tags.map(v=>`tag: ${v}`).join(", ")),g.join(" — ")});function b(g){const h=Date.now()/1e3-g;return h<60?"just now":h<3600?`${Math.floor(h/60)}m ago`:h<86400?`${Math.floor(h/3600)}h ago`:h<604800?`${Math.floor(h/86400)}d ago`:h<2592e3?`${Math.floor(h/604800)}w ago`:new Date(g*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function C(g){const v=g.split(`
|
|
3
|
+
`)[0];return v.length>72?v.substring(0,69)+"...":v}return(g,v)=>{const h=ss;return i(),u("div",{class:ve(["flex items-center cursor-pointer group focus:outline-none focus:ring-1 focus:ring-retro-cyan/50 focus:ring-inset",{"opacity-40":e.isMuted,"bg-retro-red/10":e.isPreviewHighlighted,"bg-retro-yellow/20":e.isFeatureHighlighted&&!e.isPreviewHighlighted}]),style:At({height:`${s(m)}px`}),role:"row",tabindex:"0","aria-selected":e.isSelected,"aria-label":`Commit ${e.commit.shortHash} by ${e.commit.author}: ${e.commit.message.split(`
|
|
4
|
+
`)[0]}`,onClick:v[0]||(v[0]=R=>a("click",R)),onKeydown:v[1]||(v[1]=R=>a("keydown",R)),onContextmenu:f},[Y(h,{rowData:e.graphRowData,maxLane:e.maxLane,tooltipText:s(d)},null,8,["rowData","maxLane","tooltipText"]),r("div",{class:ve(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-red/10 border-l-2 border-retro-red/40":e.isPreviewHighlighted,"bg-retro-yellow/30 border-l-2 border-retro-yellow":e.isFeatureHighlighted&&!e.isPreviewHighlighted,"bg-retro-cyan/15":e.isSelected&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted,"bg-retro-yellow/10":e.isHighlighted&&!e.isSelected&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted,"bg-retro-cyan/5":e.isBranchHighlighted&&!e.isSelected&&!e.isHighlighted&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted,"group-hover:bg-retro-panel/50":!e.isSelected&&!e.isHighlighted&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted&&!e.isBranchHighlighted}]),style:At({height:`${s(m)-4}px`})},[!e.columnVisibility||e.columnVisibility.commit!==!1?(i(),u("span",{key:0,class:ve(["flex-shrink-0 font-mono text-[11px]",e.commit.isHead?"text-retro-cyan font-semibold":"text-retro-muted"])},_(e.commit.shortHash),3)):H("",!0),s(o).length>0?(i(),u("div",Wa,[(i(!0),u(he,null,Be(s(o),R=>(i(),u("span",{key:R.displayName,class:ve(["px-1.5 py-0.5 text-[10px] rounded font-semibold leading-none cursor-context-menu hover:ring-1 hover:ring-retro-cyan/50",e.commit.isHead&&R.isLocal?"bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40":e.isPreviewHighlighted?"bg-retro-red/10 text-retro-red border border-retro-red/40":e.isFeatureHighlighted?"bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/30":e.isBranchHighlighted?"bg-retro-cyan/15 text-retro-cyan/80 border border-retro-cyan/30":R.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:R.originalBranches.join(", "),onContextmenu:G=>l(G,R)},_(R.displayName),43,Ga))),128))])):H("",!0),e.commit.tags.length>0?(i(),u("div",qa,[(i(!0),u(he,null,Be(e.commit.tags,R=>(i(),u("span",{key:R,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:G=>c(G,R)},[Y(s(no),{class:"w-2.5 h-2.5"}),we(" "+_(R),1)],40,Za))),128))])):H("",!0),r("span",Ka,_(C(e.commit.message)),1),e.commit.signatureStatus==="good"?(i(),ce(s(os),{key:3,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-green",title:"Verified signature"})):e.commit.signatureStatus==="bad"?(i(),ce(s(to),{key:4,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-red",title:"Bad signature"})):H("",!0),!e.columnVisibility||e.columnVisibility.author!==!1?(i(),u("span",Ya,_(e.commit.author),1)):H("",!0),!e.columnVisibility||e.columnVisibility.date!==!1?(i(),u("span",Xa,_(b(e.commit.timestamp)),1)):H("",!0)],6)],46,Va)}}});function Ja(){const{COLUMN_WIDTH:e,ROW_HEIGHT:n,NODE_RADIUS:t,PADDING:a}=xr;function o(m){let d=0;for(let b=0;b<m.length;b++){const C=m.charCodeAt(b);d=(d<<5)-d+C,d=d&d}return Math.abs(d)}function l(m){const d=o(m)%nr.length;return nr[d]}function c(m,d="rounded"){const b=new Map;if(m.length===0)return b;const C=new Set,g=new Map;for(const te of m)g.set(te.hash,te);const v=m.find(te=>te.isHead)||m[0];if(v){let te=v;for(;te;){C.add(te.hash);const V=te.parents?.[0];te=V?g.get(V):void 0}}const h=new Map,R=new Map,G=new Map,I=new Map,ee=new Map;for(let te=0;te<m.length;te++){const V=m[te];ee.set(V.hash,te);const re=C.has(V.hash);let ue,se;if(I.has(V.hash)){const F=I.get(V.hash);ue=F.lane,se=F.color,I.delete(V.hash)}else if(re)ue=0,se=nr[0];else{for(ue=1;G.has(ue);)ue++;se=l(V.hash.substring(0,7))}h.set(V.hash,ue),R.set(V.hash,se),G.set(ue,V.hash);const ne=V.isMerge||V.parents&&V.parents.length>1;let K="regular";V.isHead?K="head":ne&&(K="merge"),b.set(V.hash,{commitHash:V.hash,lane:ue,color:se,nodeType:K,isMainline:C.has(V.hash),connections:[]});const W=V.parents||[];for(let F=0;F<W.length;F++){const B=W[F];if(h.has(B)||I.has(B))continue;const X=C.has(B);let M,p;if(F===0)M=ue,p=se;else if(X)M=0,p=nr[0];else{for(M=1;G.has(M)||M===ue;)M++;p=l(B.substring(0,7))}I.set(B,{lane:M,color:p,childHash:V.hash})}const U=W[0];if(!U)G.delete(ue);else{const F=h.get(U),B=I.get(U),X=F??B?.lane;X!==void 0&&X!==ue&&G.delete(ue)}}for(let te=0;te<m.length;te++){const V=m[te],re=b.get(V.hash);if(!re)continue;const ue=V.parents||[];for(let se=0;se<ue.length;se++){const ne=ue[se],K=h.get(ne),W=ee.get(ne);if(K===void 0)continue;const U=re.lane,F=K,B=se===0?re.color:R.get(ne)||l(ne.substring(0,7));if(U===F?re.connections.push({type:"vertical-bottom",fromLane:U,toLane:F,color:B,style:d}):se>0?re.connections.push({type:U<F?"merge-out":"merge-in",fromLane:U,toLane:F,color:B,style:d}):re.connections.push({type:U<F?"branch-out":"branch-in",fromLane:U,toLane:F,color:B,style:d}),W!==void 0&&W>te+1)for(let X=te+1;X<W;X++){const M=m[X],p=b.get(M.hash);p&&p.connections.push({type:"vertical",fromLane:F,toLane:F,color:B,style:d})}if(W!==void 0){const X=b.get(ne);X&&X.connections.push({type:"vertical-top",fromLane:F,toLane:F,color:B,style:d})}}}return b}function f(m){let d=0;for(const b of m.values()){b.lane>d&&(d=b.lane);for(const C of b.connections)C.fromLane>d&&(d=C.fromLane),C.toLane>d&&(d=C.toLane)}return d}return{computeGraphRows:c,computeMaxLane:f,getBranchColor:l,COLUMN_WIDTH:e,ROW_HEIGHT:n,NODE_RADIUS:t,PADDING:a}}const ei=["aria-selected"],ti={class:"text-retro-yellow text-xs font-medium"},ni={key:1,class:"flex items-center justify-center gap-2 p-2 text-retro-muted text-sm"},ri={key:2,class:"p-2 text-center text-retro-muted/50 text-xs"},oi=Ce({__name:"GitCommitList",props:{commits:{},stashes:{},selectedCommit:{},hasMore:{type:Boolean},loading:{type:Boolean},loadingMore:{type:Boolean},searchQuery:{},uncommittedChangesCount:{},isUncommittedChangesSelected:{type:Boolean},highlightBranches:{},featureHighlightBranches:{},featureMergeBases:{},previewHighlightBranches:{},previewMergeBases:{},currentBranchName:{},localBranchNames:{},graphStyle:{default:"rounded"},muteNonAncestral:{type:Boolean},columnVisibility:{}},emits:["select","compareSelect","loadMore","branchContextMenu","commitContextMenu","tagContextMenu","stashContextMenu","selectUncommittedChanges","scrollStart","scrollEnd"],setup(e,{expose:n,emit:t}){const a=e,o=t;function l(){o("selectUncommittedChanges")}function c(P){(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),o("selectUncommittedChanges"))}const f=j(()=>a.searchQuery?.toLowerCase()??""),m=j(()=>new Set(a.highlightBranches??[])),d=j(()=>m.value.size>0),b=j(()=>{const P=f.value;if(!P)return new Set;const $=new Set;for(const L of a.commits)(L.message.toLowerCase().includes(P)||L.author.toLowerCase().includes(P)||L.shortHash.toLowerCase().includes(P)||L.hash.toLowerCase().includes(P)||L.branches.some(x=>x.toLowerCase().includes(P))||L.tags.some(x=>x.toLowerCase().includes(P)))&&$.add(L.hash);return $}),C=j(()=>{if(!d.value)return new Set;const P=new Set;for(const $ of a.commits)$.branches.some(L=>m.value.has(L))&&P.add($.hash);return P}),g=j(()=>{if(!a.featureHighlightBranches||a.featureHighlightBranches.length===0)return new Set;const P=a.featureMergeBases??{},$=new Map;for(const x of a.commits)$.set(x.hash,x);const L=new Set;for(const x of a.featureHighlightBranches){const N=a.commits.find(ae=>ae.branches.includes(x));if(!N)continue;const q=P[x]??null;if(!q)continue;let ie=N;for(;ie&&ie.hash!==q;)L.add(ie.hash),ie=ie.parents?.[0]?$.get(ie.parents[0]):void 0}return L}),v=j(()=>{if(!a.previewHighlightBranches||a.previewHighlightBranches.length===0)return new Set;const P=a.previewMergeBases??{},$=new Map;for(const x of a.commits)$.set(x.hash,x);const L=new Set;for(const x of a.previewHighlightBranches){const N=a.commits.find(ae=>ae.branches.includes(x));if(!N)continue;const q=P[x]??null;if(!q)continue;let ie=N;for(;ie&&ie.hash!==q;)L.add(ie.hash),ie=ie.parents?.[0]?$.get(ie.parents[0]):void 0}return L});function h(P,$){o("branchContextMenu",{...$,commitHash:P.hash})}function R(P,$){o("commitContextMenu",{commit:P,...$})}function G(P,$){o("tagContextMenu",{...$,commitHash:P.hash})}const{ROW_HEIGHT:I,VISIBLE_BUFFER:ee}=xr,{computeGraphRows:te,computeMaxLane:V}=Ja(),re=j(()=>te([...a.commits],a.graphStyle)),ue=j(()=>V(re.value)),se=j(()=>{const P=a.stashes||[];if(P.length===0)return a.commits.map((N,q)=>({type:"commit",commit:N,commitIndex:q}));const $=[],L=[...P].sort((N,q)=>new Date(q.date).getTime()-new Date(N.date).getTime());let x=0;for(let N=0;N<a.commits.length;N++){const q=a.commits[N],ie=q.timestamp*1e3;for(;x<L.length&&new Date(L[x].date).getTime()>=ie;)$.push({type:"stash",stash:L[x]}),x++;$.push({type:"commit",commit:q,commitIndex:N})}for(;x<L.length;)$.push({type:"stash",stash:L[x]}),x++;return $}),ne=S(null),K=S(0),W=S(400);let U=null;const F=j(()=>{const P=ee,$=se.value.length,L=Math.max(0,Math.floor(K.value/I)-P),x=Math.min($,Math.ceil((K.value+W.value)/I)+P);return{startIndex:L,endIndex:x}}),B=j(()=>{const{startIndex:P,endIndex:$}=F.value;return se.value.slice(P,$).map((L,x)=>({row:L,index:P+x,graphRow:L.type==="commit"&&re.value.get(L.commit.hash)||null,isHighlighted:L.type==="commit"?b.value.has(L.commit.hash):!1,isBranchHighlighted:L.type==="commit"?C.value.has(L.commit.hash):!1,isFeatureHighlighted:L.type==="commit"?g.value.has(L.commit.hash):!1,isPreviewHighlighted:L.type==="commit"?v.value.has(L.commit.hash):!1,isMuted:L.type==="commit"&&a.muteNonAncestral?!(re.value.get(L.commit.hash)?.isMainline??!1):!1}))}),X=j(()=>se.value.length*I),M=j(()=>F.value.startIndex*I);function p(P){const $=P.target;K.value=$.scrollTop,U||o("scrollStart"),U&&clearTimeout(U),U=setTimeout(()=>{U=null,o("scrollEnd")},150),a.hasMore&&!a.loading&&!a.loadingMore&&$.scrollTop+$.clientHeight>=$.scrollHeight-200&&o("loadMore")}function E(P,$){$.ctrlKey||$.metaKey?o("compareSelect",P):o("select",P)}function Q(P,$,L){if(P.key==="Enter"||P.key===" ")P.preventDefault(),o("select",$);else if(P.key==="ArrowDown"){P.preventDefault();for(let x=L+1;x<se.value.length;x++){const N=se.value[x];if(N.type==="commit"){o("select",N.commit),le(x);break}}}else if(P.key==="ArrowUp"){P.preventDefault();for(let x=L-1;x>=0;x--){const N=se.value[x];if(N.type==="commit"){o("select",N.commit),le(x);break}}}}function le(P){if(!ne.value)return;const $=P*I,L=ne.value.scrollTop,x=L+ne.value.clientHeight;$<L?ne.value.scrollTop=$:$+I>x&&(ne.value.scrollTop=$+I-ne.value.clientHeight)}st(()=>{if(ne.value){W.value=ne.value.clientHeight;const P=new ResizeObserver($=>{for(const L of $)W.value=L.contentRect.height});P.observe(ne.value),bt(()=>P.disconnect())}});function fe(){return ne.value?.scrollTop??0}function Z(P){ne.value&&(ne.value.scrollTop=P)}return n({getScrollPosition:fe,setScrollPosition:Z,scrollToIndex:le}),(P,$)=>{const L=ss,x=Qa;return i(),u("div",{ref_key:"containerRef",ref:ne,class:"h-full overflow-auto",role:"list","aria-label":"Commit history",onScroll:p},[e.uncommittedChangesCount&&e.uncommittedChangesCount>0?(i(),u("div",{key:0,class:"flex items-center cursor-pointer group sticky top-0 z-10 bg-retro-dark border-b border-retro-border",style:At({height:`${s(I)}px`}),role:"button",tabindex:"0","aria-selected":e.isUncommittedChangesSelected,onClick:l,onKeydown:c},[Y(L,{rowData:{commitHash:"uncommitted",lane:0,color:"#F59E0B",nodeType:"uncommitted",isMainline:!1,connections:[]},maxLane:s(ue)},null,8,["maxLane"]),r("div",{class:ve(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-yellow/15":e.isUncommittedChangesSelected,"group-hover:bg-retro-panel/50":!e.isUncommittedChangesSelected}]),style:At({height:`${s(I)-4}px`})},[Y(s(In),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("span",ti," Uncommitted Changes ("+_(e.uncommittedChangesCount)+") ",1),$[1]||($[1]=r("span",{class:"flex-1"},null,-1)),$[2]||($[2]=r("span",{class:"text-retro-muted text-[10px]"},"Working tree",-1))],6)],44,ei)):H("",!0),r("div",{class:"relative",style:At({height:`${s(X)}px`})},[r("div",{class:"absolute left-0 right-0",style:At({transform:`translateY(${s(M)}px)`})},[(i(!0),u(he,null,Be(s(B),({row:N,index:q,graphRow:ie,isHighlighted:ae,isBranchHighlighted:xe,isFeatureHighlighted:Re,isPreviewHighlighted:Se,isMuted:nt})=>(i(),u(he,{key:N.type==="commit"?N.commit.hash:`stash-${N.stash.index}`},[N.type==="commit"?Oo([N.commit.hash,N.commit.message,N.commit.timestamp,N.commit.branches.join("|"),N.commit.tags.join("|"),e.selectedCommit?.hash===N.commit.hash,ae,xe,Re,Se,nt,a.currentBranchName||"",a.columnVisibility?.date!==!1,a.columnVisibility?.author!==!1,a.columnVisibility?.commit!==!1],()=>(i(),ce(x,{key:0,commit:N.commit,index:N.commitIndex,isSelected:e.selectedCommit?.hash===N.commit.hash,isHighlighted:ae,isBranchHighlighted:xe,isFeatureHighlighted:Re,isPreviewHighlighted:Se,isMuted:nt,currentBranchName:a.currentBranchName,localBranchNames:a.localBranchNames,graphRowData:ie,maxLane:s(ue),columnVisibility:a.columnVisibility,onClick:ze=>E(N.commit,ze),onKeydown:ze=>Q(ze,N.commit,q),onBranchContextMenu:ze=>h(N.commit,ze),onCommitContextMenu:ze=>R(N.commit,ze),onTagContextMenu:ze=>G(N.commit,ze)},null,8,["commit","index","isSelected","isHighlighted","isBranchHighlighted","isFeatureHighlighted","isPreviewHighlighted","isMuted","currentBranchName","localBranchNames","graphRowData","maxLane","columnVisibility","onClick","onKeydown","onBranchContextMenu","onCommitContextMenu","onTagContextMenu"])),$,0):H("",!0)],64))),128))],4)],4),(e.loading||e.loadingMore)&&e.commits.length>0?(i(),u("div",ni,[...$[3]||($[3]=[r("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),we(" Loading more commits... ",-1)])])):H("",!0),!e.hasMore&&e.commits.length>0&&!e.loading?(i(),u("div",ri,_(e.commits.length)+" commits loaded ",1)):H("",!0)],544)}}});function si(e){const n=e.charAt(0).toUpperCase();return n in Pn?n:"M"}function rr(e,n){if(e&&typeof e=="object"){const t=e;if(typeof t.data?.message=="string"&&t.data.message.trim())return t.data.message;if(typeof t.statusMessage=="string"&&t.statusMessage.trim())return t.statusMessage;if(typeof t.message=="string"&&t.message.trim())return t.message}return e instanceof Error&&e.message?e.message:n}function Co(e,n){const t=n.trim().toLowerCase();return t?e.filter(a=>a.message.toLowerCase().includes(t)||a.author.toLowerCase().includes(t)||a.shortHash.includes(t)||a.hash.includes(t)||a.branches.some(o=>o.toLowerCase().includes(t))||a.tags.some(o=>o.toLowerCase().includes(t))):[...e]}function ai(e,n){return n.size===0?[...e]:e.filter(t=>t.branches.some(a=>n.has(a)))}const ii={class:"flex flex-col h-full border-t border-retro-border bg-retro-dark"},li={class:"flex items-center justify-between p-2 border-b border-retro-border flex-shrink-0"},ci={class:"flex items-center gap-2 text-xs min-w-0"},ui={class:"font-mono text-retro-cyan"},di={class:"font-mono text-retro-cyan"},fi={key:0,class:"px-3 py-1.5 text-xs text-retro-muted border-b border-retro-border flex-shrink-0"},mi={class:"text-retro-green"},hi={class:"text-retro-red"},pi={key:1,class:"flex-1 flex items-center justify-center"},vi={key:2,class:"flex-1 overflow-auto"},gi={class:"text-retro-text truncate flex-1"},xi={class:"text-retro-muted"},bi={key:0,class:"flex-shrink-0 text-[10px] font-mono"},yi={key:0,class:"text-retro-green"},wi={key:1,class:"text-retro-red ml-1"},ki={key:1,class:"flex-shrink-0 text-[10px] text-retro-muted italic"},Ci={key:3,class:"flex-1 flex items-center justify-center text-retro-muted text-sm"},$i=Ce({__name:"GitComparisonView",props:{fromCommit:{},toCommit:{},files:{},stats:{},loading:{type:Boolean}},emits:["close"],setup(e,{emit:n}){const t=n;function a(o){const l=si(o);return Pn[l]||Pn.M}return(o,l)=>(i(),u("div",ii,[r("div",li,[r("div",ci,[l[1]||(l[1]=r("span",{class:"text-retro-muted"},"Comparing",-1)),r("span",ui,_(e.fromCommit.shortHash),1),l[2]||(l[2]=r("span",{class:"text-retro-muted"},"→",-1)),r("span",di,_(e.toCommit.shortHash),1)]),r("button",{class:"p-1 text-retro-muted hover:text-retro-text transition-colors flex-shrink-0","aria-label":"Close comparison",onClick:l[0]||(l[0]=c=>t("close"))},[Y(s(pt),{class:"w-4 h-4"})])]),e.stats?(i(),u("div",fi,[we(_(e.stats.filesChanged)+" file"+_(e.stats.filesChanged!==1?"s":"")+" changed, ",1),r("span",mi,"+"+_(e.stats.additions),1),r("span",hi," -"+_(e.stats.deletions),1)])):H("",!0),e.loading?(i(),u("div",pi,[...l[3]||(l[3]=[r("div",{class:"flex items-center gap-2 text-retro-muted text-sm"},[r("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"}),we(" Loading comparison... ")],-1)])])):e.files&&e.files.length>0?(i(),u("div",vi,[(i(!0),u(he,null,Be(e.files,c=>(i(),u("div",{key:c.path,class:"flex items-center gap-2 px-3 py-1.5 hover:bg-retro-panel/50 text-xs border-b border-retro-border/50"},[r("span",{class:ve(["flex-shrink-0 w-4 text-center font-semibold text-[10px]",a(c.status).colorClass])},_(c.status.charAt(0)),3),r("span",gi,[c.oldPath&&c.status.startsWith("R")?(i(),u(he,{key:0},[r("span",xi,_(c.oldPath),1),l[4]||(l[4]=r("span",{class:"text-retro-muted mx-1"},"→",-1))],64)):H("",!0),we(" "+_(c.path),1)]),c.binary?(i(),u("span",ki,"binary")):(i(),u("span",bi,[c.additions>0?(i(),u("span",yi,"+"+_(c.additions),1)):H("",!0),c.deletions>0?(i(),u("span",wi,"-"+_(c.deletions),1)):H("",!0)]))]))),128))])):e.files&&e.files.length===0?(i(),u("div",Ci," No differences between these commits ")):H("",!0)]))}});function ro(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Mn=ro();function as(e){Mn=e}var Gn={exec:()=>null};function Ue(e,n=""){let t=typeof e=="string"?e:e.source;const a={replace:(o,l)=>{let c=typeof l=="string"?l:l.source;return c=c.replace(xt.caret,"$1"),t=t.replace(o,c),a},getRegex:()=>new RegExp(t,n)};return a}var xt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Si=/^(?:[ \t]*(?:\n|$))+/,_i=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Mi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Yn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ti=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,oo=/(?:[*+-]|\d{1,9}[.)])/,is=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ls=Ue(is).replace(/bull/g,oo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ai=Ue(is).replace(/bull/g,oo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),so=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Bi=/^[^\n]+/,ao=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ei=Ue(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ao).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ri=Ue(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,oo).getRegex(),br="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",io=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Pi=Ue("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",io).replace("tag",br).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),cs=Ue(so).replace("hr",Yn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",br).getRegex(),Di=Ue(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",cs).getRegex(),lo={blockquote:Di,code:_i,def:Ei,fences:Mi,heading:Ti,hr:Yn,html:Pi,lheading:ls,list:Ri,newline:Si,paragraph:cs,table:Gn,text:Bi},$o=Ue("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",br).getRegex(),Ii={...lo,lheading:Ai,table:$o,paragraph:Ue(so).replace("hr",Yn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",$o).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",br).getRegex()},Li={...lo,html:Ue(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",io).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Gn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ue(so).replace("hr",Yn).replace("heading",` *#{1,6} *[^
|
|
5
|
+
]`).replace("lheading",ls).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ni=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Fi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,us=/^( {2,}|\\)\n(?!\s*$)/,Hi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,yr=/[\p{P}\p{S}]/u,co=/[\s\p{P}\p{S}]/u,ds=/[^\s\p{P}\p{S}]/u,Oi=Ue(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,co).getRegex(),fs=/(?!~)[\p{P}\p{S}]/u,Ui=/(?!~)[\s\p{P}\p{S}]/u,ji=/(?:[^\s\p{P}\p{S}]|~)/u,zi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,ms=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Vi=Ue(ms,"u").replace(/punct/g,yr).getRegex(),Wi=Ue(ms,"u").replace(/punct/g,fs).getRegex(),hs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Gi=Ue(hs,"gu").replace(/notPunctSpace/g,ds).replace(/punctSpace/g,co).replace(/punct/g,yr).getRegex(),qi=Ue(hs,"gu").replace(/notPunctSpace/g,ji).replace(/punctSpace/g,Ui).replace(/punct/g,fs).getRegex(),Zi=Ue("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ds).replace(/punctSpace/g,co).replace(/punct/g,yr).getRegex(),Ki=Ue(/\\(punct)/,"gu").replace(/punct/g,yr).getRegex(),Yi=Ue(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Xi=Ue(io).replace("(?:-->|$)","-->").getRegex(),Qi=Ue("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Xi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),dr=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ji=Ue(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",dr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ps=Ue(/^!?\[(label)\]\[(ref)\]/).replace("label",dr).replace("ref",ao).getRegex(),vs=Ue(/^!?\[(ref)\](?:\[\])?/).replace("ref",ao).getRegex(),el=Ue("reflink|nolink(?!\\()","g").replace("reflink",ps).replace("nolink",vs).getRegex(),uo={_backpedal:Gn,anyPunctuation:Ki,autolink:Yi,blockSkip:zi,br:us,code:Fi,del:Gn,emStrongLDelim:Vi,emStrongRDelimAst:Gi,emStrongRDelimUnd:Zi,escape:Ni,link:Ji,nolink:vs,punctuation:Oi,reflink:ps,reflinkSearch:el,tag:Qi,text:Hi,url:Gn},tl={...uo,link:Ue(/^!?\[(label)\]\((.*?)\)/).replace("label",dr).getRegex(),reflink:Ue(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",dr).getRegex()},Or={...uo,emStrongRDelimAst:qi,emStrongLDelim:Wi,url:Ue(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},nl={...Or,br:Ue(us).replace("{2,}","*").getRegex(),text:Ue(Or.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},or={normal:lo,gfm:Ii,pedantic:Li},Hn={normal:uo,gfm:Or,breaks:nl,pedantic:tl},rl={"&":"&","<":"<",">":">",'"':""","'":"'"},So=e=>rl[e];function Yt(e,n){if(n){if(xt.escapeTest.test(e))return e.replace(xt.escapeReplace,So)}else if(xt.escapeTestNoEncode.test(e))return e.replace(xt.escapeReplaceNoEncode,So);return e}function _o(e){try{e=encodeURI(e).replace(xt.percentDecode,"%")}catch{return null}return e}function Mo(e,n){const t=e.replace(xt.findPipe,(l,c,f)=>{let m=!1,d=c;for(;--d>=0&&f[d]==="\\";)m=!m;return m?"|":" |"}),a=t.split(xt.splitPipe);let o=0;if(a[0].trim()||a.shift(),a.length>0&&!a.at(-1)?.trim()&&a.pop(),n)if(a.length>n)a.splice(n);else for(;a.length<n;)a.push("");for(;o<a.length;o++)a[o]=a[o].trim().replace(xt.slashPipe,"|");return a}function On(e,n,t){const a=e.length;if(a===0)return"";let o=0;for(;o<a&&e.charAt(a-o-1)===n;)o++;return e.slice(0,a-o)}function ol(e,n){if(e.indexOf(n[1])===-1)return-1;let t=0;for(let a=0;a<e.length;a++)if(e[a]==="\\")a++;else if(e[a]===n[0])t++;else if(e[a]===n[1]&&(t--,t<0))return a;return t>0?-2:-1}function To(e,n,t,a,o){const l=n.href,c=n.title||null,f=e[1].replace(o.other.outputLinkReplace,"$1");a.state.inLink=!0;const m={type:e[0].charAt(0)==="!"?"image":"link",raw:t,href:l,title:c,text:f,tokens:a.inlineTokens(f)};return a.state.inLink=!1,m}function sl(e,n,t){const a=e.match(t.other.indentCodeCompensation);if(a===null)return n;const o=a[1];return n.split(`
|
|
6
|
+
`).map(l=>{const c=l.match(t.other.beginningSpace);if(c===null)return l;const[f]=c;return f.length>=o.length?l.slice(o.length):l}).join(`
|
|
7
|
+
`)}var fr=class{options;rules;lexer;constructor(e){this.options=e||Mn}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const t=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?t:On(t,`
|
|
8
|
+
`)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const t=n[0],a=sl(t,n[3]||"",this.rules);return{type:"code",raw:t,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:a}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let t=n[2].trim();if(this.rules.other.endingHash.test(t)){const a=On(t,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(t=a.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:On(n[0],`
|
|
9
|
+
`)}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let t=On(n[0],`
|
|
10
|
+
`).split(`
|
|
11
|
+
`),a="",o="";const l=[];for(;t.length>0;){let c=!1;const f=[];let m;for(m=0;m<t.length;m++)if(this.rules.other.blockquoteStart.test(t[m]))f.push(t[m]),c=!0;else if(!c)f.push(t[m]);else break;t=t.slice(m);const d=f.join(`
|
|
12
|
+
`),b=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
13
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
|
|
14
|
+
${d}`:d,o=o?`${o}
|
|
15
|
+
${b}`:b;const C=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(b,l,!0),this.lexer.state.top=C,t.length===0)break;const g=l.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){const v=g,h=v.raw+`
|
|
16
|
+
`+t.join(`
|
|
17
|
+
`),R=this.blockquote(h);l[l.length-1]=R,a=a.substring(0,a.length-v.raw.length)+R.raw,o=o.substring(0,o.length-v.text.length)+R.text;break}else if(g?.type==="list"){const v=g,h=v.raw+`
|
|
18
|
+
`+t.join(`
|
|
19
|
+
`),R=this.list(h);l[l.length-1]=R,a=a.substring(0,a.length-g.raw.length)+R.raw,o=o.substring(0,o.length-v.raw.length)+R.raw,t=h.substring(l.at(-1).raw.length).split(`
|
|
20
|
+
`);continue}}return{type:"blockquote",raw:a,tokens:l,text:o}}}list(e){let n=this.rules.block.list.exec(e);if(n){let t=n[1].trim();const a=t.length>1,o={type:"list",raw:"",ordered:a,start:a?+t.slice(0,-1):"",loose:!1,items:[]};t=a?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=a?t:"[*+-]");const l=this.rules.other.listItemRegex(t);let c=!1;for(;e;){let m=!1,d="",b="";if(!(n=l.exec(e))||this.rules.block.hr.test(e))break;d=n[0],e=e.substring(d.length);let C=n[2].split(`
|
|
21
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,I=>" ".repeat(3*I.length)),g=e.split(`
|
|
22
|
+
`,1)[0],v=!C.trim(),h=0;if(this.options.pedantic?(h=2,b=C.trimStart()):v?h=n[1].length+1:(h=n[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,b=C.slice(h),h+=n[1].length),v&&this.rules.other.blankLine.test(g)&&(d+=g+`
|
|
23
|
+
`,e=e.substring(g.length+1),m=!0),!m){const I=this.rules.other.nextBulletRegex(h),ee=this.rules.other.hrRegex(h),te=this.rules.other.fencesBeginRegex(h),V=this.rules.other.headingBeginRegex(h),re=this.rules.other.htmlBeginRegex(h);for(;e;){const ue=e.split(`
|
|
24
|
+
`,1)[0];let se;if(g=ue,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),se=g):se=g.replace(this.rules.other.tabCharGlobal," "),te.test(g)||V.test(g)||re.test(g)||I.test(g)||ee.test(g))break;if(se.search(this.rules.other.nonSpaceChar)>=h||!g.trim())b+=`
|
|
25
|
+
`+se.slice(h);else{if(v||C.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||te.test(C)||V.test(C)||ee.test(C))break;b+=`
|
|
26
|
+
`+g}!v&&!g.trim()&&(v=!0),d+=ue+`
|
|
27
|
+
`,e=e.substring(ue.length+1),C=se.slice(h)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(c=!0));let R=null,G;this.options.gfm&&(R=this.rules.other.listIsTask.exec(b),R&&(G=R[0]!=="[ ] ",b=b.replace(this.rules.other.listReplaceTask,""))),o.items.push({type:"list_item",raw:d,task:!!R,checked:G,loose:!1,text:b,tokens:[]}),o.raw+=d}const f=o.items.at(-1);if(f)f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let m=0;m<o.items.length;m++)if(this.lexer.state.top=!1,o.items[m].tokens=this.lexer.blockTokens(o.items[m].text,[]),!o.loose){const d=o.items[m].tokens.filter(C=>C.type==="space"),b=d.length>0&&d.some(C=>this.rules.other.anyLine.test(C.raw));o.loose=b}if(o.loose)for(let m=0;m<o.items.length;m++)o.items[m].loose=!0;return o}}html(e){const n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(e){const n=this.rules.block.def.exec(e);if(n){const t=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:t,raw:n[0],href:a,title:o}}}table(e){const n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;const t=Mo(n[1]),a=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=n[3]?.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
28
|
+
`):[],l={type:"table",raw:n[0],header:[],align:[],rows:[]};if(t.length===a.length){for(const c of a)this.rules.other.tableAlignRight.test(c)?l.align.push("right"):this.rules.other.tableAlignCenter.test(c)?l.align.push("center"):this.rules.other.tableAlignLeft.test(c)?l.align.push("left"):l.align.push(null);for(let c=0;c<t.length;c++)l.header.push({text:t[c],tokens:this.lexer.inline(t[c]),header:!0,align:l.align[c]});for(const c of o)l.rows.push(Mo(c,l.header.length).map((f,m)=>({text:f,tokens:this.lexer.inline(f),header:!1,align:l.align[m]})));return l}}lheading(e){const n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){const n=this.rules.block.paragraph.exec(e);if(n){const t=n[1].charAt(n[1].length-1)===`
|
|
29
|
+
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:t,tokens:this.lexer.inline(t)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){const n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const t=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const l=On(t.slice(0,-1),"\\");if((t.length-l.length)%2===0)return}else{const l=ol(n[2],"()");if(l===-2)return;if(l>-1){const f=(n[0].indexOf("!")===0?5:4)+n[1].length+l;n[2]=n[2].substring(0,l),n[0]=n[0].substring(0,f).trim(),n[3]=""}}let a=n[2],o="";if(this.options.pedantic){const l=this.rules.other.pedanticHrefTitle.exec(a);l&&(a=l[1],o=l[3])}else o=n[3]?n[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?a=a.slice(1):a=a.slice(1,-1)),To(n,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let t;if((t=this.rules.inline.reflink.exec(e))||(t=this.rules.inline.nolink.exec(e))){const a=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=n[a.toLowerCase()];if(!o){const l=t[0].charAt(0);return{type:"text",raw:l,text:l}}return To(t,o,t[0],this.lexer,this.rules)}}emStrong(e,n,t=""){let a=this.rules.inline.emStrongLDelim.exec(e);if(!a||a[3]&&t.match(this.rules.other.unicodeAlphaNumeric))return;if(!(a[1]||a[2]||"")||!t||this.rules.inline.punctuation.exec(t)){const l=[...a[0]].length-1;let c,f,m=l,d=0;const b=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,n=n.slice(-1*e.length+l);(a=b.exec(n))!=null;){if(c=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!c)continue;if(f=[...c].length,a[3]||a[4]){m+=f;continue}else if((a[5]||a[6])&&l%3&&!((l+f)%3)){d+=f;continue}if(m-=f,m>0)continue;f=Math.min(f,f+m+d);const C=[...a[0]][0].length,g=e.slice(0,l+a.index+C+f);if(Math.min(l,f)%2){const h=g.slice(1,-1);return{type:"em",raw:g,text:h,tokens:this.lexer.inlineTokens(h)}}const v=g.slice(2,-2);return{type:"strong",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let t=n[2].replace(this.rules.other.newLineCharGlobal," ");const a=this.rules.other.nonSpaceChar.test(t),o=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return a&&o&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:n[0],text:t}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){const n=this.rules.inline.autolink.exec(e);if(n){let t,a;return n[2]==="@"?(t=n[1],a="mailto:"+t):(t=n[1],a=t),{type:"link",raw:n[0],text:t,href:a,tokens:[{type:"text",raw:t,text:t}]}}}url(e){let n;if(n=this.rules.inline.url.exec(e)){let t,a;if(n[2]==="@")t=n[0],a="mailto:"+t;else{let o;do o=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(o!==n[0]);t=n[0],n[1]==="www."?a="http://"+n[0]:a=n[0]}return{type:"link",raw:n[0],text:t,href:a,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){const t=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:t}}}},sn=class Ur{tokens;options;state;tokenizer;inlineQueue;constructor(n){this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Mn,this.options.tokenizer=this.options.tokenizer||new fr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:xt,block:or.normal,inline:Hn.normal};this.options.pedantic?(t.block=or.pedantic,t.inline=Hn.pedantic):this.options.gfm&&(t.block=or.gfm,this.options.breaks?t.inline=Hn.breaks:t.inline=Hn.gfm),this.tokenizer.rules=t}static get rules(){return{block:or,inline:Hn}}static lex(n,t){return new Ur(t).lex(n)}static lexInline(n,t){return new Ur(t).inlineTokens(n)}lex(n){n=n.replace(xt.carriageReturn,`
|
|
30
|
+
`),this.blockTokens(n,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const a=this.inlineQueue[t];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,t=[],a=!1){for(this.options.pedantic&&(n=n.replace(xt.tabCharGlobal," ").replace(xt.spaceLine,""));n;){let o;if(this.options.extensions?.block?.some(c=>(o=c.call({lexer:this},n,t))?(n=n.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.space(n)){n=n.substring(o.raw.length);const c=t.at(-1);o.raw.length===1&&c!==void 0?c.raw+=`
|
|
31
|
+
`:t.push(o);continue}if(o=this.tokenizer.code(n)){n=n.substring(o.raw.length);const c=t.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=`
|
|
32
|
+
`+o.raw,c.text+=`
|
|
33
|
+
`+o.text,this.inlineQueue.at(-1).src=c.text):t.push(o);continue}if(o=this.tokenizer.fences(n)){n=n.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.heading(n)){n=n.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.hr(n)){n=n.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.blockquote(n)){n=n.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.list(n)){n=n.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.html(n)){n=n.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.def(n)){n=n.substring(o.raw.length);const c=t.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=`
|
|
34
|
+
`+o.raw,c.text+=`
|
|
35
|
+
`+o.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(n)){n=n.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.lheading(n)){n=n.substring(o.raw.length),t.push(o);continue}let l=n;if(this.options.extensions?.startBlock){let c=1/0;const f=n.slice(1);let m;this.options.extensions.startBlock.forEach(d=>{m=d.call({lexer:this},f),typeof m=="number"&&m>=0&&(c=Math.min(c,m))}),c<1/0&&c>=0&&(l=n.substring(0,c+1))}if(this.state.top&&(o=this.tokenizer.paragraph(l))){const c=t.at(-1);a&&c?.type==="paragraph"?(c.raw+=`
|
|
36
|
+
`+o.raw,c.text+=`
|
|
37
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(o),a=l.length!==n.length,n=n.substring(o.raw.length);continue}if(o=this.tokenizer.text(n)){n=n.substring(o.raw.length);const c=t.at(-1);c?.type==="text"?(c.raw+=`
|
|
38
|
+
`+o.raw,c.text+=`
|
|
39
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(o);continue}if(n){const c="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,t}inline(n,t=[]){return this.inlineQueue.push({src:n,tokens:t}),t}inlineTokens(n,t=[]){let a=n,o=null;if(this.tokens.links){const f=Object.keys(this.tokens.links);if(f.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)f.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,o.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let l=!1,c="";for(;n;){l||(c=""),l=!1;let f;if(this.options.extensions?.inline?.some(d=>(f=d.call({lexer:this},n,t))?(n=n.substring(f.raw.length),t.push(f),!0):!1))continue;if(f=this.tokenizer.escape(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.tag(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.link(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(f.raw.length);const d=t.at(-1);f.type==="text"&&d?.type==="text"?(d.raw+=f.raw,d.text+=f.text):t.push(f);continue}if(f=this.tokenizer.emStrong(n,a,c)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.codespan(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.br(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.del(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.autolink(n)){n=n.substring(f.raw.length),t.push(f);continue}if(!this.state.inLink&&(f=this.tokenizer.url(n))){n=n.substring(f.raw.length),t.push(f);continue}let m=n;if(this.options.extensions?.startInline){let d=1/0;const b=n.slice(1);let C;this.options.extensions.startInline.forEach(g=>{C=g.call({lexer:this},b),typeof C=="number"&&C>=0&&(d=Math.min(d,C))}),d<1/0&&d>=0&&(m=n.substring(0,d+1))}if(f=this.tokenizer.inlineText(m)){n=n.substring(f.raw.length),f.raw.slice(-1)!=="_"&&(c=f.raw.slice(-1)),l=!0;const d=t.at(-1);d?.type==="text"?(d.raw+=f.raw,d.text+=f.text):t.push(f);continue}if(n){const d="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}},mr=class{options;parser;constructor(e){this.options=e||Mn}space(e){return""}code({text:e,lang:n,escaped:t}){const a=(n||"").match(xt.notSpaceStart)?.[0],o=e.replace(xt.endingNewline,"")+`
|
|
40
|
+
`;return a?'<pre><code class="language-'+Yt(a)+'">'+(t?o:Yt(o,!0))+`</code></pre>
|
|
41
|
+
`:"<pre><code>"+(t?o:Yt(o,!0))+`</code></pre>
|
|
42
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
43
|
+
${this.parser.parse(e)}</blockquote>
|
|
44
|
+
`}html({text:e}){return e}heading({tokens:e,depth:n}){return`<h${n}>${this.parser.parseInline(e)}</h${n}>
|
|
45
|
+
`}hr(e){return`<hr>
|
|
46
|
+
`}list(e){const n=e.ordered,t=e.start;let a="";for(let c=0;c<e.items.length;c++){const f=e.items[c];a+=this.listitem(f)}const o=n?"ol":"ul",l=n&&t!==1?' start="'+t+'"':"";return"<"+o+l+`>
|
|
47
|
+
`+a+"</"+o+`>
|
|
48
|
+
`}listitem(e){let n="";if(e.task){const t=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=t+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=t+" "+Yt(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:t+" ",text:t+" ",escaped:!0}):n+=t+" "}return n+=this.parser.parse(e.tokens,!!e.loose),`<li>${n}</li>
|
|
49
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
50
|
+
`}table(e){let n="",t="";for(let o=0;o<e.header.length;o++)t+=this.tablecell(e.header[o]);n+=this.tablerow({text:t});let a="";for(let o=0;o<e.rows.length;o++){const l=e.rows[o];t="";for(let c=0;c<l.length;c++)t+=this.tablecell(l[c]);a+=this.tablerow({text:t})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
|
|
51
|
+
<thead>
|
|
52
|
+
`+n+`</thead>
|
|
53
|
+
`+a+`</table>
|
|
54
|
+
`}tablerow({text:e}){return`<tr>
|
|
55
|
+
${e}</tr>
|
|
56
|
+
`}tablecell(e){const n=this.parser.parseInline(e.tokens),t=e.header?"th":"td";return(e.align?`<${t} align="${e.align}">`:`<${t}>`)+n+`</${t}>
|
|
57
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Yt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:t}){const a=this.parser.parseInline(t),o=_o(e);if(o===null)return a;e=o;let l='<a href="'+e+'"';return n&&(l+=' title="'+Yt(n)+'"'),l+=">"+a+"</a>",l}image({href:e,title:n,text:t,tokens:a}){a&&(t=this.parser.parseInline(a,this.parser.textRenderer));const o=_o(e);if(o===null)return Yt(t);e=o;let l=`<img src="${e}" alt="${t}"`;return n&&(l+=` title="${Yt(n)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Yt(e.text)}},fo=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},an=class jr{options;renderer;textRenderer;constructor(n){this.options=n||Mn,this.options.renderer=this.options.renderer||new mr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new fo}static parse(n,t){return new jr(t).parse(n)}static parseInline(n,t){return new jr(t).parseInline(n)}parse(n,t=!0){let a="";for(let o=0;o<n.length;o++){const l=n[o];if(this.options.extensions?.renderers?.[l.type]){const f=l,m=this.options.extensions.renderers[f.type].call({parser:this},f);if(m!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(f.type)){a+=m||"";continue}}const c=l;switch(c.type){case"space":{a+=this.renderer.space(c);continue}case"hr":{a+=this.renderer.hr(c);continue}case"heading":{a+=this.renderer.heading(c);continue}case"code":{a+=this.renderer.code(c);continue}case"table":{a+=this.renderer.table(c);continue}case"blockquote":{a+=this.renderer.blockquote(c);continue}case"list":{a+=this.renderer.list(c);continue}case"html":{a+=this.renderer.html(c);continue}case"paragraph":{a+=this.renderer.paragraph(c);continue}case"text":{let f=c,m=this.renderer.text(f);for(;o+1<n.length&&n[o+1].type==="text";)f=n[++o],m+=`
|
|
58
|
+
`+this.renderer.text(f);t?a+=this.renderer.paragraph({type:"paragraph",raw:m,text:m,tokens:[{type:"text",raw:m,text:m,escaped:!0}]}):a+=m;continue}default:{const f='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(f),"";throw new Error(f)}}}return a}parseInline(n,t=this.renderer){let a="";for(let o=0;o<n.length;o++){const l=n[o];if(this.options.extensions?.renderers?.[l.type]){const f=this.options.extensions.renderers[l.type].call({parser:this},l);if(f!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){a+=f||"";continue}}const c=l;switch(c.type){case"escape":{a+=t.text(c);break}case"html":{a+=t.html(c);break}case"link":{a+=t.link(c);break}case"image":{a+=t.image(c);break}case"strong":{a+=t.strong(c);break}case"em":{a+=t.em(c);break}case"codespan":{a+=t.codespan(c);break}case"br":{a+=t.br(c);break}case"del":{a+=t.del(c);break}case"text":{a+=t.text(c);break}default:{const f='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(f),"";throw new Error(f)}}}return a}},lr=class{options;block;constructor(e){this.options=e||Mn}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?sn.lex:sn.lexInline}provideParser(){return this.block?an.parse:an.parseInline}},al=class{defaults=ro();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=an;Renderer=mr;TextRenderer=fo;Lexer=sn;Tokenizer=fr;Hooks=lr;constructor(...e){this.use(...e)}walkTokens(e,n){let t=[];for(const a of e)switch(t=t.concat(n.call(this,a)),a.type){case"table":{const o=a;for(const l of o.header)t=t.concat(this.walkTokens(l.tokens,n));for(const l of o.rows)for(const c of l)t=t.concat(this.walkTokens(c.tokens,n));break}case"list":{const o=a;t=t.concat(this.walkTokens(o.items,n));break}default:{const o=a;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{const c=o[l].flat(1/0);t=t.concat(this.walkTokens(c,n))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,n)))}}return t}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(t=>{const a={...t};if(a.async=this.defaults.async||a.async||!1,t.extensions&&(t.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const l=n.renderers[o.name];l?n.renderers[o.name]=function(...c){let f=o.renderer.apply(this,c);return f===!1&&(f=l.apply(this,c)),f}:n.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=n[o.level];l?l.unshift(o.tokenizer):n[o.level]=[o.tokenizer],o.start&&(o.level==="block"?n.startBlock?n.startBlock.push(o.start):n.startBlock=[o.start]:o.level==="inline"&&(n.startInline?n.startInline.push(o.start):n.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(n.childTokens[o.name]=o.childTokens)}),a.extensions=n),t.renderer){const o=this.defaults.renderer||new mr(this.defaults);for(const l in t.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;const c=l,f=t.renderer[c],m=o[c];o[c]=(...d)=>{let b=f.apply(o,d);return b===!1&&(b=m.apply(o,d)),b||""}}a.renderer=o}if(t.tokenizer){const o=this.defaults.tokenizer||new fr(this.defaults);for(const l in t.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const c=l,f=t.tokenizer[c],m=o[c];o[c]=(...d)=>{let b=f.apply(o,d);return b===!1&&(b=m.apply(o,d)),b}}a.tokenizer=o}if(t.hooks){const o=this.defaults.hooks||new lr;for(const l in t.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;const c=l,f=t.hooks[c],m=o[c];lr.passThroughHooks.has(l)?o[c]=d=>{if(this.defaults.async)return Promise.resolve(f.call(o,d)).then(C=>m.call(o,C));const b=f.call(o,d);return m.call(o,b)}:o[c]=(...d)=>{let b=f.apply(o,d);return b===!1&&(b=m.apply(o,d)),b}}a.hooks=o}if(t.walkTokens){const o=this.defaults.walkTokens,l=t.walkTokens;a.walkTokens=function(c){let f=[];return f.push(l.call(this,c)),o&&(f=f.concat(o.call(this,c))),f}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return sn.lex(e,n??this.defaults)}parser(e,n){return an.parse(e,n??this.defaults)}parseMarkdown(e){return(t,a)=>{const o={...a},l={...this.defaults,...o},c=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&o.async===!1)return c(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));l.hooks&&(l.hooks.options=l,l.hooks.block=e);const f=l.hooks?l.hooks.provideLexer():e?sn.lex:sn.lexInline,m=l.hooks?l.hooks.provideParser():e?an.parse:an.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(t):t).then(d=>f(d,l)).then(d=>l.hooks?l.hooks.processAllTokens(d):d).then(d=>l.walkTokens?Promise.all(this.walkTokens(d,l.walkTokens)).then(()=>d):d).then(d=>m(d,l)).then(d=>l.hooks?l.hooks.postprocess(d):d).catch(c);try{l.hooks&&(t=l.hooks.preprocess(t));let d=f(t,l);l.hooks&&(d=l.hooks.processAllTokens(d)),l.walkTokens&&this.walkTokens(d,l.walkTokens);let b=m(d,l);return l.hooks&&(b=l.hooks.postprocess(b)),b}catch(d){return c(d)}}}onError(e,n){return t=>{if(t.message+=`
|
|
59
|
+
Please report this to https://github.com/markedjs/marked.`,e){const a="<p>An error occurred:</p><pre>"+Yt(t.message+"",!0)+"</pre>";return n?Promise.resolve(a):a}if(n)return Promise.reject(t);throw t}}},Sn=new al;function Oe(e,n){return Sn.parse(e,n)}Oe.options=Oe.setOptions=function(e){return Sn.setOptions(e),Oe.defaults=Sn.defaults,as(Oe.defaults),Oe};Oe.getDefaults=ro;Oe.defaults=Mn;Oe.use=function(...e){return Sn.use(...e),Oe.defaults=Sn.defaults,as(Oe.defaults),Oe};Oe.walkTokens=function(e,n){return Sn.walkTokens(e,n)};Oe.parseInline=Sn.parseInline;Oe.Parser=an;Oe.parser=an.parse;Oe.Renderer=mr;Oe.TextRenderer=fo;Oe.Lexer=sn;Oe.lexer=sn.lex;Oe.Tokenizer=fr;Oe.Hooks=lr;Oe.parse=Oe;Oe.options;Oe.setOptions;Oe.use;Oe.walkTokens;Oe.parseInline;an.parse;sn.lex;const{entries:gs,setPrototypeOf:Ao,isFrozen:il,getPrototypeOf:ll,getOwnPropertyDescriptor:cl}=Object;let{freeze:yt,seal:Ft,create:zr}=Object,{apply:Vr,construct:Wr}=typeof Reflect<"u"&&Reflect;yt||(yt=function(n){return n});Ft||(Ft=function(n){return n});Vr||(Vr=function(n,t){for(var a=arguments.length,o=new Array(a>2?a-2:0),l=2;l<a;l++)o[l-2]=arguments[l];return n.apply(t,o)});Wr||(Wr=function(n){for(var t=arguments.length,a=new Array(t>1?t-1:0),o=1;o<t;o++)a[o-1]=arguments[o];return new n(...a)});const sr=wt(Array.prototype.forEach),ul=wt(Array.prototype.lastIndexOf),Bo=wt(Array.prototype.pop),Un=wt(Array.prototype.push),dl=wt(Array.prototype.splice),cr=wt(String.prototype.toLowerCase),_r=wt(String.prototype.toString),Mr=wt(String.prototype.match),jn=wt(String.prototype.replace),fl=wt(String.prototype.indexOf),ml=wt(String.prototype.trim),Ut=wt(Object.prototype.hasOwnProperty),gt=wt(RegExp.prototype.test),zn=hl(TypeError);function wt(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var t=arguments.length,a=new Array(t>1?t-1:0),o=1;o<t;o++)a[o-1]=arguments[o];return Vr(e,n,a)}}function hl(e){return function(){for(var n=arguments.length,t=new Array(n),a=0;a<n;a++)t[a]=arguments[a];return Wr(e,t)}}function Ee(e,n){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:cr;Ao&&Ao(e,null);let a=n.length;for(;a--;){let o=n[a];if(typeof o=="string"){const l=t(o);l!==o&&(il(n)||(n[a]=l),o=l)}e[o]=!0}return e}function pl(e){for(let n=0;n<e.length;n++)Ut(e,n)||(e[n]=null);return e}function Xt(e){const n=zr(null);for(const[t,a]of gs(e))Ut(e,t)&&(Array.isArray(a)?n[t]=pl(a):a&&typeof a=="object"&&a.constructor===Object?n[t]=Xt(a):n[t]=a);return n}function Vn(e,n){for(;e!==null;){const a=cl(e,n);if(a){if(a.get)return wt(a.get);if(typeof a.value=="function")return wt(a.value)}e=ll(e)}function t(){return null}return t}const Eo=yt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Tr=yt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ar=yt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),vl=yt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Br=yt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),gl=yt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ro=yt(["#text"]),Po=yt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Er=yt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Do=yt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ar=yt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xl=Ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),bl=Ft(/<%[\w\W]*|[\w\W]*%>/gm),yl=Ft(/\$\{[\w\W]*/gm),wl=Ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),kl=Ft(/^aria-[\-\w]+$/),xs=Ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Cl=Ft(/^(?:\w+script|data):/i),$l=Ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bs=Ft(/^html$/i),Sl=Ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var Io=Object.freeze({__proto__:null,ARIA_ATTR:kl,ATTR_WHITESPACE:$l,CUSTOM_ELEMENT:Sl,DATA_ATTR:wl,DOCTYPE_NAME:bs,ERB_EXPR:bl,IS_ALLOWED_URI:xs,IS_SCRIPT_OR_DATA:Cl,MUSTACHE_EXPR:xl,TMPLIT_EXPR:yl});const Wn={element:1,text:3,progressingInstruction:7,comment:8,document:9},_l=function(){return typeof window>"u"?null:window},Ml=function(n,t){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let a=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(a=t.getAttribute(o));const l="dompurify"+(a?"#"+a:"");try{return n.createPolicy(l,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},Lo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ys(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_l();const n=pe=>ys(pe);if(n.version="3.3.1",n.removed=[],!e||!e.document||e.document.nodeType!==Wn.document||!e.Element)return n.isSupported=!1,n;let{document:t}=e;const a=t,o=a.currentScript,{DocumentFragment:l,HTMLTemplateElement:c,Node:f,Element:m,NodeFilter:d,NamedNodeMap:b=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:C,DOMParser:g,trustedTypes:v}=e,h=m.prototype,R=Vn(h,"cloneNode"),G=Vn(h,"remove"),I=Vn(h,"nextSibling"),ee=Vn(h,"childNodes"),te=Vn(h,"parentNode");if(typeof c=="function"){const pe=t.createElement("template");pe.content&&pe.content.ownerDocument&&(t=pe.content.ownerDocument)}let V,re="";const{implementation:ue,createNodeIterator:se,createDocumentFragment:ne,getElementsByTagName:K}=t,{importNode:W}=a;let U=Lo();n.isSupported=typeof gs=="function"&&typeof te=="function"&&ue&&ue.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:F,ERB_EXPR:B,TMPLIT_EXPR:X,DATA_ATTR:M,ARIA_ATTR:p,IS_SCRIPT_OR_DATA:E,ATTR_WHITESPACE:Q,CUSTOM_ELEMENT:le}=Io;let{IS_ALLOWED_URI:fe}=Io,Z=null;const P=Ee({},[...Eo,...Tr,...Ar,...Br,...Ro]);let $=null;const L=Ee({},[...Po,...Er,...Do,...ar]);let x=Object.seal(zr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),N=null,q=null;const ie=Object.seal(zr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ae=!0,xe=!0,Re=!1,Se=!0,nt=!1,ze=!0,at=!1,ct=!1,vt=!1,It=!1,jt=!1,zt=!1,Bt=!0,Ye=!1;const Ht="user-content-";let Et=!0,Rt=!1,Ct={},ut=null;const Jt=Ee({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let it=null;const $t=Ee({},["audio","video","img","source","image","track"]);let en=null;const un=Ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Pt="http://www.w3.org/1998/Math/MathML",rt="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let St=mt,_t=!1,tn=null;const bn=Ee({},[Pt,rt,mt],_r);let Vt=Ee({},["mi","mo","mn","ms","mtext"]),Wt=Ee({},["annotation-xml"]);const yn=Ee({},["title","style","font","a","script"]);let Ot=null;const Xe=["application/xhtml+xml","text/html"],wn="text/html";let Ae=null,Lt=null;const Ge=t.createElement("form"),qe=function(A){return A instanceof RegExp||A instanceof Function},De=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Lt&&Lt===A)){if((!A||typeof A!="object")&&(A={}),A=Xt(A),Ot=Xe.indexOf(A.PARSER_MEDIA_TYPE)===-1?wn:A.PARSER_MEDIA_TYPE,Ae=Ot==="application/xhtml+xml"?_r:cr,Z=Ut(A,"ALLOWED_TAGS")?Ee({},A.ALLOWED_TAGS,Ae):P,$=Ut(A,"ALLOWED_ATTR")?Ee({},A.ALLOWED_ATTR,Ae):L,tn=Ut(A,"ALLOWED_NAMESPACES")?Ee({},A.ALLOWED_NAMESPACES,_r):bn,en=Ut(A,"ADD_URI_SAFE_ATTR")?Ee(Xt(un),A.ADD_URI_SAFE_ATTR,Ae):un,it=Ut(A,"ADD_DATA_URI_TAGS")?Ee(Xt($t),A.ADD_DATA_URI_TAGS,Ae):$t,ut=Ut(A,"FORBID_CONTENTS")?Ee({},A.FORBID_CONTENTS,Ae):Jt,N=Ut(A,"FORBID_TAGS")?Ee({},A.FORBID_TAGS,Ae):Xt({}),q=Ut(A,"FORBID_ATTR")?Ee({},A.FORBID_ATTR,Ae):Xt({}),Ct=Ut(A,"USE_PROFILES")?A.USE_PROFILES:!1,ae=A.ALLOW_ARIA_ATTR!==!1,xe=A.ALLOW_DATA_ATTR!==!1,Re=A.ALLOW_UNKNOWN_PROTOCOLS||!1,Se=A.ALLOW_SELF_CLOSE_IN_ATTR!==!1,nt=A.SAFE_FOR_TEMPLATES||!1,ze=A.SAFE_FOR_XML!==!1,at=A.WHOLE_DOCUMENT||!1,It=A.RETURN_DOM||!1,jt=A.RETURN_DOM_FRAGMENT||!1,zt=A.RETURN_TRUSTED_TYPE||!1,vt=A.FORCE_BODY||!1,Bt=A.SANITIZE_DOM!==!1,Ye=A.SANITIZE_NAMED_PROPS||!1,Et=A.KEEP_CONTENT!==!1,Rt=A.IN_PLACE||!1,fe=A.ALLOWED_URI_REGEXP||xs,St=A.NAMESPACE||mt,Vt=A.MATHML_TEXT_INTEGRATION_POINTS||Vt,Wt=A.HTML_INTEGRATION_POINTS||Wt,x=A.CUSTOM_ELEMENT_HANDLING||{},A.CUSTOM_ELEMENT_HANDLING&&qe(A.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(x.tagNameCheck=A.CUSTOM_ELEMENT_HANDLING.tagNameCheck),A.CUSTOM_ELEMENT_HANDLING&&qe(A.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(x.attributeNameCheck=A.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),A.CUSTOM_ELEMENT_HANDLING&&typeof A.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(x.allowCustomizedBuiltInElements=A.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),nt&&(xe=!1),jt&&(It=!0),Ct&&(Z=Ee({},Ro),$=[],Ct.html===!0&&(Ee(Z,Eo),Ee($,Po)),Ct.svg===!0&&(Ee(Z,Tr),Ee($,Er),Ee($,ar)),Ct.svgFilters===!0&&(Ee(Z,Ar),Ee($,Er),Ee($,ar)),Ct.mathMl===!0&&(Ee(Z,Br),Ee($,Do),Ee($,ar))),A.ADD_TAGS&&(typeof A.ADD_TAGS=="function"?ie.tagCheck=A.ADD_TAGS:(Z===P&&(Z=Xt(Z)),Ee(Z,A.ADD_TAGS,Ae))),A.ADD_ATTR&&(typeof A.ADD_ATTR=="function"?ie.attributeCheck=A.ADD_ATTR:($===L&&($=Xt($)),Ee($,A.ADD_ATTR,Ae))),A.ADD_URI_SAFE_ATTR&&Ee(en,A.ADD_URI_SAFE_ATTR,Ae),A.FORBID_CONTENTS&&(ut===Jt&&(ut=Xt(ut)),Ee(ut,A.FORBID_CONTENTS,Ae)),A.ADD_FORBID_CONTENTS&&(ut===Jt&&(ut=Xt(ut)),Ee(ut,A.ADD_FORBID_CONTENTS,Ae)),Et&&(Z["#text"]=!0),at&&Ee(Z,["html","head","body"]),Z.table&&(Ee(Z,["tbody"]),delete N.tbody),A.TRUSTED_TYPES_POLICY){if(typeof A.TRUSTED_TYPES_POLICY.createHTML!="function")throw zn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof A.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw zn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');V=A.TRUSTED_TYPES_POLICY,re=V.createHTML("")}else V===void 0&&(V=Ml(v,o)),V!==null&&typeof re=="string"&&(re=V.createHTML(""));yt&&yt(A),Lt=A}},Gt=Ee({},[...Tr,...Ar,...vl]),Ve=Ee({},[...Br,...gl]),nn=function(A){let oe=te(A);(!oe||!oe.tagName)&&(oe={namespaceURI:St,tagName:"template"});const me=cr(A.tagName),He=cr(oe.tagName);return tn[A.namespaceURI]?A.namespaceURI===rt?oe.namespaceURI===mt?me==="svg":oe.namespaceURI===Pt?me==="svg"&&(He==="annotation-xml"||Vt[He]):!!Gt[me]:A.namespaceURI===Pt?oe.namespaceURI===mt?me==="math":oe.namespaceURI===rt?me==="math"&&Wt[He]:!!Ve[me]:A.namespaceURI===mt?oe.namespaceURI===rt&&!Wt[He]||oe.namespaceURI===Pt&&!Vt[He]?!1:!Ve[me]&&(yn[me]||!Gt[me]):!!(Ot==="application/xhtml+xml"&&tn[A.namespaceURI]):!1},Ne=function(A){Un(n.removed,{element:A});try{te(A).removeChild(A)}catch{G(A)}},Mt=function(A,oe){try{Un(n.removed,{attribute:oe.getAttributeNode(A),from:oe})}catch{Un(n.removed,{attribute:null,from:oe})}if(oe.removeAttribute(A),A==="is")if(It||jt)try{Ne(oe)}catch{}else try{oe.setAttribute(A,"")}catch{}},Qe=function(A){let oe=null,me=null;if(vt)A="<remove></remove>"+A;else{const Le=Mr(A,/^[\r\n\t ]+/);me=Le&&Le[0]}Ot==="application/xhtml+xml"&&St===mt&&(A='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+A+"</body></html>");const He=V?V.createHTML(A):A;if(St===mt)try{oe=new g().parseFromString(He,Ot)}catch{}if(!oe||!oe.documentElement){oe=ue.createDocument(St,"template",null);try{oe.documentElement.innerHTML=_t?re:He}catch{}}const Pe=oe.body||oe.documentElement;return A&&me&&Pe.insertBefore(t.createTextNode(me),Pe.childNodes[0]||null),St===mt?K.call(oe,at?"html":"body")[0]:at?oe.documentElement:Pe},dn=function(A){return se.call(A.ownerDocument||A,A,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Ze=function(A){return A instanceof C&&(typeof A.nodeName!="string"||typeof A.textContent!="string"||typeof A.removeChild!="function"||!(A.attributes instanceof b)||typeof A.removeAttribute!="function"||typeof A.setAttribute!="function"||typeof A.namespaceURI!="string"||typeof A.insertBefore!="function"||typeof A.hasChildNodes!="function")},qt=function(A){return typeof f=="function"&&A instanceof f};function Fe(pe,A,oe){sr(pe,me=>{me.call(n,A,oe,Lt)})}const fn=function(A){let oe=null;if(Fe(U.beforeSanitizeElements,A,null),Ze(A))return Ne(A),!0;const me=Ae(A.nodeName);if(Fe(U.uponSanitizeElement,A,{tagName:me,allowedTags:Z}),ze&&A.hasChildNodes()&&!qt(A.firstElementChild)&>(/<[/\w!]/g,A.innerHTML)&>(/<[/\w!]/g,A.textContent)||A.nodeType===Wn.progressingInstruction||ze&&A.nodeType===Wn.comment&>(/<[/\w]/g,A.data))return Ne(A),!0;if(!(ie.tagCheck instanceof Function&&ie.tagCheck(me))&&(!Z[me]||N[me])){if(!N[me]&&rn(me)&&(x.tagNameCheck instanceof RegExp&>(x.tagNameCheck,me)||x.tagNameCheck instanceof Function&&x.tagNameCheck(me)))return!1;if(Et&&!ut[me]){const He=te(A)||A.parentNode,Pe=ee(A)||A.childNodes;if(Pe&&He){const Le=Pe.length;for(let et=Le-1;et>=0;--et){const je=R(Pe[et],!0);je.__removalCount=(A.__removalCount||0)+1,He.insertBefore(je,I(A))}}}return Ne(A),!0}return A instanceof m&&!nn(A)||(me==="noscript"||me==="noembed"||me==="noframes")&>(/<\/no(script|embed|frames)/i,A.innerHTML)?(Ne(A),!0):(nt&&A.nodeType===Wn.text&&(oe=A.textContent,sr([F,B,X],He=>{oe=jn(oe,He," ")}),A.textContent!==oe&&(Un(n.removed,{element:A.cloneNode()}),A.textContent=oe)),Fe(U.afterSanitizeElements,A,null),!1)},Ke=function(A,oe,me){if(Bt&&(oe==="id"||oe==="name")&&(me in t||me in Ge))return!1;if(!(xe&&!q[oe]&>(M,oe))){if(!(ae&>(p,oe))){if(!(ie.attributeCheck instanceof Function&&ie.attributeCheck(oe,A))){if(!$[oe]||q[oe]){if(!(rn(A)&&(x.tagNameCheck instanceof RegExp&>(x.tagNameCheck,A)||x.tagNameCheck instanceof Function&&x.tagNameCheck(A))&&(x.attributeNameCheck instanceof RegExp&>(x.attributeNameCheck,oe)||x.attributeNameCheck instanceof Function&&x.attributeNameCheck(oe,A))||oe==="is"&&x.allowCustomizedBuiltInElements&&(x.tagNameCheck instanceof RegExp&>(x.tagNameCheck,me)||x.tagNameCheck instanceof Function&&x.tagNameCheck(me))))return!1}else if(!en[oe]){if(!gt(fe,jn(me,Q,""))){if(!((oe==="src"||oe==="xlink:href"||oe==="href")&&A!=="script"&&fl(me,"data:")===0&&it[A])){if(!(Re&&!gt(E,jn(me,Q,"")))){if(me)return!1}}}}}}}return!0},rn=function(A){return A!=="annotation-xml"&&Mr(A,le)},Je=function(A){Fe(U.beforeSanitizeAttributes,A,null);const{attributes:oe}=A;if(!oe||Ze(A))return;const me={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$,forceKeepAttr:void 0};let He=oe.length;for(;He--;){const Pe=oe[He],{name:Le,namespaceURI:et,value:je}=Pe,Nt=Ae(Le),w=je;let D=Le==="value"?w:ml(w);if(me.attrName=Nt,me.attrValue=D,me.keepAttr=!0,me.forceKeepAttr=void 0,Fe(U.uponSanitizeAttribute,A,me),D=me.attrValue,Ye&&(Nt==="id"||Nt==="name")&&(Mt(Le,A),D=Ht+D),ze&>(/((--!?|])>)|<\/(style|title|textarea)/i,D)){Mt(Le,A);continue}if(Nt==="attributename"&&Mr(D,"href")){Mt(Le,A);continue}if(me.forceKeepAttr)continue;if(!me.keepAttr){Mt(Le,A);continue}if(!Se&>(/\/>/i,D)){Mt(Le,A);continue}nt&&sr([F,B,X],z=>{D=jn(D,z," ")});const T=Ae(A.nodeName);if(!Ke(T,Nt,D)){Mt(Le,A);continue}if(V&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!et)switch(v.getAttributeType(T,Nt)){case"TrustedHTML":{D=V.createHTML(D);break}case"TrustedScriptURL":{D=V.createScriptURL(D);break}}if(D!==w)try{et?A.setAttributeNS(et,Le,D):A.setAttribute(Le,D),Ze(A)?Ne(A):Bo(n.removed)}catch{Mt(Le,A)}}Fe(U.afterSanitizeAttributes,A,null)},mn=function pe(A){let oe=null;const me=dn(A);for(Fe(U.beforeSanitizeShadowDOM,A,null);oe=me.nextNode();)Fe(U.uponSanitizeShadowNode,oe,null),fn(oe),Je(oe),oe.content instanceof l&&pe(oe.content);Fe(U.afterSanitizeShadowDOM,A,null)};return n.sanitize=function(pe){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},oe=null,me=null,He=null,Pe=null;if(_t=!pe,_t&&(pe="<!-->"),typeof pe!="string"&&!qt(pe))if(typeof pe.toString=="function"){if(pe=pe.toString(),typeof pe!="string")throw zn("dirty is not a string, aborting")}else throw zn("toString is not a function");if(!n.isSupported)return pe;if(ct||De(A),n.removed=[],typeof pe=="string"&&(Rt=!1),Rt){if(pe.nodeName){const je=Ae(pe.nodeName);if(!Z[je]||N[je])throw zn("root node is forbidden and cannot be sanitized in-place")}}else if(pe instanceof f)oe=Qe("<!---->"),me=oe.ownerDocument.importNode(pe,!0),me.nodeType===Wn.element&&me.nodeName==="BODY"||me.nodeName==="HTML"?oe=me:oe.appendChild(me);else{if(!It&&!nt&&!at&&pe.indexOf("<")===-1)return V&&zt?V.createHTML(pe):pe;if(oe=Qe(pe),!oe)return It?null:zt?re:""}oe&&vt&&Ne(oe.firstChild);const Le=dn(Rt?pe:oe);for(;He=Le.nextNode();)fn(He),Je(He),He.content instanceof l&&mn(He.content);if(Rt)return pe;if(It){if(jt)for(Pe=ne.call(oe.ownerDocument);oe.firstChild;)Pe.appendChild(oe.firstChild);else Pe=oe;return($.shadowroot||$.shadowrootmode)&&(Pe=W.call(a,Pe,!0)),Pe}let et=at?oe.outerHTML:oe.innerHTML;return at&&Z["!doctype"]&&oe.ownerDocument&&oe.ownerDocument.doctype&&oe.ownerDocument.doctype.name&>(bs,oe.ownerDocument.doctype.name)&&(et="<!DOCTYPE "+oe.ownerDocument.doctype.name+`>
|
|
60
|
+
`+et),nt&&sr([F,B,X],je=>{et=jn(et,je," ")}),V&&zt?V.createHTML(et):et},n.setConfig=function(){let pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};De(pe),ct=!0},n.clearConfig=function(){Lt=null,ct=!1},n.isValidAttribute=function(pe,A,oe){Lt||De({});const me=Ae(pe),He=Ae(A);return Ke(me,He,oe)},n.addHook=function(pe,A){typeof A=="function"&&Un(U[pe],A)},n.removeHook=function(pe,A){if(A!==void 0){const oe=ul(U[pe],A);return oe===-1?void 0:dl(U[pe],oe,1)[0]}return Bo(U[pe])},n.removeHooks=function(pe){U[pe]=[]},n.removeAllHooks=function(){U=Lo()},n}var ws=ys();const Tl={":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:":"🦺"},Al=/https?:\/\/[^\s<>)"']+/g;function Bl(e){return e.replace(Al,n=>`<a href="${n}" target="_blank" rel="noopener noreferrer" class="text-retro-blue hover:underline">${n}</a>`)}function El(e){return e.replace(/:[a-z0-9_]+:/g,n=>Tl[n]||n)}function Rl(e){if(!e)return"";let n=El(e);return n=Oe.parse(n),n=Bl(n),n=ws.sanitize(n,{ALLOWED_TAGS:["a","strong","em","code","b","i","br","p","ul","ol","li","pre","blockquote","h1","h2","h3"],ALLOWED_ATTR:["href","target","rel","class"]}),n}const Pl={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Dl={class:"flex items-center gap-2 min-w-0"},Il={class:"text-retro-cyan font-mono text-sm"},Ll={class:"text-retro-muted text-sm truncate"},Nl={class:"flex items-center gap-1 flex-shrink-0"},Fl=["aria-label","title"],Hl={class:"flex-1 overflow-auto p-4 space-y-4"},Ol={class:"space-y-2"},Ul={class:"flex items-center gap-2 text-sm"},jl={class:"text-retro-text font-mono text-xs bg-retro-panel px-2 py-1 rounded"},zl={class:"flex items-center gap-2 text-sm"},Vl={class:"text-retro-text"},Wl={class:"text-retro-muted"},Gl={key:0,class:"flex items-center gap-2 text-sm"},ql={class:"text-retro-text"},Zl={class:"text-retro-muted"},Kl={class:"flex items-center gap-2 text-sm"},Yl={class:"text-retro-text"},Xl={key:1,class:"flex items-start gap-2 text-sm"},Ql={class:"flex flex-wrap gap-1"},Jl=["onClick","title"],ec={key:2,class:"flex items-start gap-2 text-sm"},tc={class:"flex flex-wrap gap-1"},nc={key:3,class:"flex items-start gap-2 text-sm"},rc={class:"flex flex-wrap gap-1"},oc={class:"space-y-1"},sc={class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded"},ac={key:0,class:"space-y-1"},ic=["innerHTML"],lc={key:1,class:"space-y-2"},cc={class:"flex items-center gap-2 text-sm"},uc={class:"text-retro-muted"},dc={key:0,class:"flex items-center gap-2"},fc={class:"text-retro-green text-xs font-mono"},mc={class:"flex-1 h-2 rounded overflow-hidden bg-retro-panel flex"},hc={class:"text-retro-red text-xs font-mono"},pc={key:2,class:"space-y-2"},vc={class:"flex items-center justify-between"},gc={class:"text-retro-muted text-xs uppercase tracking-wide"},xc={class:"flex items-center gap-1"},bc={key:0,class:"text-retro-muted text-sm py-2"},yc={key:1,class:"space-y-0.5"},wc=["onClick"],kc=["title"],Cc={class:"text-retro-text font-mono text-xs truncate flex-1"},$c={class:"text-retro-muted"},Sc={class:"text-retro-text"},_c={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Mc={key:0,class:"text-retro-green"},Tc={key:1,class:"text-retro-red"},Ac={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Bc={key:2,class:"space-y-0"},Ec=["onClick"],Rc={class:"text-retro-text font-mono text-xs"},Pc=["title"],Dc={class:"text-retro-text font-mono text-xs truncate flex-1"},Ic={class:"text-retro-muted"},Lc={class:"text-retro-text"},Nc={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Fc={key:0,class:"text-retro-green"},Hc={key:1,class:"text-retro-red"},Oc={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Uc={key:3,class:"flex items-center gap-2 text-retro-muted text-sm py-2"},jc={key:4,class:"text-retro-muted text-sm py-2"},zc=Ce({__name:"GitCommitDetail",props:{commit:{},files:{},stats:{},loading:{type:Boolean,default:!1},committer:{},committerEmail:{},detailPosition:{default:"inline"}},emits:["close","navigateToCommit","togglePosition","navigatePrev","navigateNext","openFileDiff"],setup(e,{emit:n}){const t=e,a=n,o=S(null),l=S("flat"),c=S(new Set),f=j(()=>!t.committer||!t.committerEmail?!1:t.committer!==t.commit.author||t.committerEmail!==t.commit.email),m=j(()=>{const U=t.commit.body;return U?Rl(U):""}),d=j(()=>{if(!t.stats)return"";const{filesChanged:U,additions:F,deletions:B}=t.stats,M=[`${U} ${U===1?"file":"files"} changed`];return F>0&&M.push(`+${F} insertion${F===1?"":"s"}`),B>0&&M.push(`-${B} deletion${B===1?"":"s"}`),M.join(", ")});function b(U){const F=[];for(const B of U){const X=B.path.split("/");let M=F;for(let p=0;p<X.length;p++){const E=X[p],Q=p===X.length-1,le=X.slice(0,p+1).join("/");let fe=M.find(Z=>Z.name===E&&Z.isDirectory===!Q);fe||(fe={name:E,fullPath:le,isDirectory:!Q,children:[],file:Q?B:void 0},M.push(fe)),Q||(M=fe.children)}}return C(F),F}function C(U){for(const F of U)if(F.isDirectory)for(C(F.children);F.children.length===1&&F.children[0].isDirectory;){const B=F.children[0];F.name=`${F.name}/${B.name}`,F.fullPath=B.fullPath,F.children=B.children}}function g(U){return[...U].sort((F,B)=>F.isDirectory&&!B.isDirectory?-1:!F.isDirectory&&B.isDirectory?1:F.name.localeCompare(B.name))}function v(U,F,B){const X=[];for(const M of g(U)){const p=B.size===0?!0:B.has(M.fullPath);X.push({key:M.fullPath,depth:F,isDirectory:M.isDirectory,name:M.name,fullPath:M.fullPath,expanded:M.isDirectory?p:!1,file:M.file}),M.isDirectory&&p&&X.push(...v(M.children,F+1,B))}return X}const h=j(()=>!t.files||t.files.length===0?[]:b(t.files)),R=j(()=>v(h.value,0,c.value));function G(U){c.value.has(U)?c.value.delete(U):c.value.add(U),c.value=new Set(c.value)}function I(){const U=F=>{const B=[];for(const X of F)X.isDirectory&&(B.push(X.fullPath),B.push(...U(X.children)));return B};c.value=new Set(U(h.value))}function ee(){c.value=new Set}Me(l,U=>{U==="tree"&&I()});function te(U){return new Date(U*1e3).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}function V(U){return Pn[U]||{label:U,colorClass:"text-retro-muted"}}const re=j(()=>{if(!t.stats)return{addPct:0,delPct:0};const U=t.stats.additions+t.stats.deletions;return U===0?{addPct:50,delPct:50}:{addPct:Math.round(t.stats.additions/U*100),delPct:Math.round(t.stats.deletions/U*100)}});function ue(U){U.key==="ArrowUp"?(U.preventDefault(),a("navigatePrev")):U.key==="ArrowDown"?(U.preventDefault(),a("navigateNext")):U.key==="Escape"&&(U.preventDefault(),a("close"))}st(()=>{gn(()=>{o.value?.focus()})}),Me(()=>t.commit.hash,()=>{gn(()=>{o.value?.focus()})});function se(){a("close")}function ne(U){a("navigateToCommit",U)}function K(){a("togglePosition")}function W(U){a("openFileDiff",U)}return(U,F)=>(i(),u("section",{ref_key:"containerRef",ref:o,tabindex:0,onKeydown:ue,class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark focus:outline-none","aria-label":"Commit details",role:"region"},[r("div",Pl,[r("div",Dl,[r("span",Il,_(e.commit.shortHash),1),r("span",Ll,_(e.commit.message.split(`
|
|
61
|
+
`)[0]),1)]),r("div",Nl,[r("button",{onClick:K,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":e.detailPosition==="inline"?"Dock detail to bottom":"Show detail inline",title:e.detailPosition==="inline"?"Dock to bottom":"Show inline"},[e.detailPosition==="inline"?(i(),ce(s(Zo),{key:0,class:"w-4 h-4 text-retro-muted hover:text-retro-text"})):(i(),ce(s(qo),{key:1,class:"w-4 h-4 text-retro-muted hover:text-retro-text"}))],8,Fl),r("button",{onClick:se,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"},[Y(s(pt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])])]),r("div",Hl,[r("div",Ol,[r("div",Ul,[F[2]||(F[2]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Hash:",-1)),r("code",jl,_(e.commit.hash),1)]),r("div",zl,[Y(s(Hr),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Vl,_(e.commit.author),1),r("span",Wl,"<"+_(e.commit.email)+">",1)]),f.value?(i(),u("div",Gl,[Y(s(Hr),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),F[3]||(F[3]=r("span",{class:"text-retro-muted text-xs uppercase mr-1"},"Committer:",-1)),r("span",ql,_(e.committer),1),r("span",Zl,"<"+_(e.committerEmail)+">",1)])):H("",!0),r("div",Kl,[Y(s(Xo),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Yl,_(te(e.commit.timestamp)),1)]),e.commit.parents?.length>0?(i(),u("div",Xl,[F[4]||(F[4]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Parents:",-1)),r("div",Ql,[(i(!0),u(he,null,Be(e.commit.parents,B=>(i(),u("button",{key:B,onClick:X=>ne(B),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 ${B.substring(0,7)}`},_(B.substring(0,7)),9,Jl))),128))])])):H("",!0),e.commit.branches?.length>0?(i(),u("div",ec,[F[5]||(F[5]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Branches:",-1)),r("div",tc,[(i(!0),u(he,null,Be(e.commit.branches,B=>(i(),u("span",{key:B,class:"text-retro-green font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},_(B),1))),128))])])):H("",!0),e.commit.tags?.length>0?(i(),u("div",nc,[F[6]||(F[6]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Tags:",-1)),r("div",rc,[(i(!0),u(he,null,Be(e.commit.tags,B=>(i(),u("span",{key:B,class:"text-retro-yellow font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},_(B),1))),128))])])):H("",!0)]),r("div",oc,[F[7]||(F[7]=r("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Message ",-1)),r("div",sc,_(e.commit.message.split(`
|
|
62
|
+
`)[0]),1)]),e.commit.body?(i(),u("div",ac,[F[8]||(F[8]=r("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Body ",-1)),r("div",{class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded commit-body-rendered",innerHTML:m.value},null,8,ic)])):H("",!0),e.stats?(i(),u("div",lc,[r("div",cc,[r("span",uc,_(d.value),1)]),e.stats.additions>0||e.stats.deletions>0?(i(),u("div",dc,[r("span",fc,"+"+_(e.stats.additions),1),r("div",mc,[r("div",{class:"bg-retro-green h-full transition-all",style:At({width:re.value.addPct+"%"})},null,4),r("div",{class:"bg-retro-red h-full transition-all",style:At({width:re.value.delPct+"%"})},null,4)]),r("span",hc,"-"+_(e.stats.deletions),1)])):H("",!0)])):H("",!0),e.files?(i(),u("div",pc,[r("div",vc,[r("h4",gc," Files Changed ("+_(e.files.length)+") ",1),r("div",xc,[r("button",{onClick:F[0]||(F[0]=B=>l.value="flat"),class:ve(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",l.value==="flat"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Flat file list",title:"Flat file list"},[Y(s(ns),{class:"w-4 h-4"})],2),r("button",{onClick:F[1]||(F[1]=B=>l.value="tree"),class:ve(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",l.value==="tree"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Tree file view",title:"Tree file view"},[Y(s(Fr),{class:"w-4 h-4"})],2)])]),e.files.length===0?(i(),u("div",bc," No files changed in this commit. ")):l.value==="flat"?(i(),u("ul",yc,[(i(!0),u(he,null,Be(e.files,B=>(i(),u("li",{key:B.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group cursor-pointer",onClick:X=>W(B)},[r("span",{class:ve(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",V(B.status).colorClass]),title:V(B.status).label},_(B.status),11,kc),Y(s(qn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Cc,[B.status==="R"&&B.oldPath?(i(),u(he,{key:0},[r("span",$c,_(B.oldPath),1),F[9]||(F[9]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Sc,_(B.path),1)],64)):(i(),u(he,{key:1},[we(_(B.path),1)],64))]),!B.binary&&(B.additions>0||B.deletions>0)?(i(),u("span",_c,[B.additions>0?(i(),u("span",Mc,"+"+_(B.additions),1)):H("",!0),B.deletions>0?(i(),u("span",Tc,"-"+_(B.deletions),1)):H("",!0)])):B.binary?(i(),u("span",Ac,"binary")):H("",!0)],8,wc))),128))])):(i(),u("div",Bc,[r("div",{class:"flex items-center gap-2 mb-1"},[r("button",{onClick:I,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Expand all "),F[10]||(F[10]=r("span",{class:"text-retro-muted text-xs"},"|",-1)),r("button",{onClick:ee,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Collapse all ")]),(i(!0),u(he,null,Be(R.value,B=>(i(),u("div",{key:B.key,class:ve(["flex items-center gap-1 py-0.5 px-1 hover:bg-retro-panel rounded text-sm cursor-pointer",{"select-none":B.isDirectory}]),style:At({paddingLeft:B.depth*16+4+"px"}),onClick:X=>B.isDirectory?G(B.fullPath):B.file?W(B.file):void 0},[B.isDirectory?(i(),u(he,{key:0},[Y(s(Yr),{class:ve(["w-3 h-3 text-retro-muted transition-transform flex-shrink-0",{"rotate-90":B.expanded}])},null,8,["class"]),Y(s(Fr),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("span",Rc,_(B.name),1)],64)):B.file?(i(),u(he,{key:1},[r("span",{class:ve(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",V(B.file.status).colorClass]),title:V(B.file.status).label},_(B.file.status),11,Pc),Y(s(qn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Dc,[B.file.status==="R"&&B.file.oldPath?(i(),u(he,{key:0},[r("span",Ic,_(B.file.oldPath.split("/").pop()),1),F[11]||(F[11]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Lc,_(B.name),1)],64)):(i(),u(he,{key:1},[we(_(B.name),1)],64))]),!B.file.binary&&(B.file.additions>0||B.file.deletions>0)?(i(),u("span",Nc,[B.file.additions>0?(i(),u("span",Fc,"+"+_(B.file.additions),1)):H("",!0),B.file.deletions>0?(i(),u("span",Hc,"-"+_(B.file.deletions),1)):H("",!0)])):B.file.binary?(i(),u("span",Oc,"binary")):H("",!0)],64)):H("",!0)],14,Ec))),128))]))])):e.loading?(i(),u("div",Uc,[...F[12]||(F[12]=[r("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),we(" Loading file changes... ",-1)])])):(i(),u("div",jc," Failed to load file changes. "))])],544))}}),Vc=qr(zc,[["__scopeId","data-v-29f450ea"]]),Wc={class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark","aria-label":"Uncommitted changes details"},Gc={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},qc={class:"flex items-center gap-2 min-w-0"},Zc={class:"text-retro-muted text-sm"},Kc={key:0,class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin",title:"Staging..."},Yc={class:"flex-1 overflow-auto p-4 space-y-3"},Xc={class:"space-y-2"},Qc=["disabled"],Jc={class:"space-y-1"},eu={class:"flex items-center justify-between"},tu={class:"text-retro-green text-xs uppercase tracking-wide font-semibold"},nu={key:0,class:"text-retro-muted text-xs py-1"},ru={key:1,class:"space-y-0.5"},ou=["aria-label","onClick"],su={class:"text-retro-text font-mono text-xs truncate"},au={class:"space-y-1"},iu={class:"flex items-center justify-between"},lu={class:"text-retro-yellow text-xs uppercase tracking-wide font-semibold"},cu={key:0,class:"text-retro-muted text-xs py-1"},uu={key:1,class:"space-y-0.5"},du=["aria-label","onClick"],fu={class:"text-retro-text font-mono text-xs truncate"},mu=Ce({__name:"GitUncommittedDetail",props:{stagedFiles:{default:()=>[]},unstagedFiles:{default:()=>[]},isStaging:{type:Boolean,default:!1},isCommitting:{type:Boolean,default:!1}},emits:["close","stageFiles","unstageFiles","stageAll","unstageAll","commit"],setup(e,{emit:n}){const t=e,a=n,o=S(""),l=S(!1),c=j(()=>o.value.trim().length>0&&t.stagedFiles.length>0&&!l.value&&!t.isCommitting);function f(R){return Pn[R]||{label:R,colorClass:"text-retro-muted"}}function m(){a("close")}function d(R){a("stageFiles",[R.path])}function b(R){a("unstageFiles",[R.path])}function C(){a("stageAll")}function g(){a("unstageAll")}async function v(){c.value&&(l.value=!0,a("commit",o.value.trim()),o.value="",l.value=!1)}function h(R){(R.metaKey||R.ctrlKey)&&R.key==="Enter"&&(R.preventDefault(),v())}return(R,G)=>(i(),u("section",Wc,[r("div",Gc,[r("div",qc,[Y(s(In),{class:"w-4 h-4 text-retro-yellow"}),G[1]||(G[1]=r("span",{class:"text-retro-yellow font-semibold text-sm"},"Uncommitted Changes",-1)),r("span",Zc,"("+_(e.stagedFiles.length+e.unstagedFiles.length)+" files)",1),t.isStaging?(i(),u("div",Kc)):H("",!0)]),r("button",{onClick:m,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"},[Y(s(pt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])]),r("div",Yc,[r("div",Xc,[Te(r("textarea",{"onUpdate:modelValue":G[0]||(G[0]=I=>Ie(o)?o.value=I: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:h},null,544),[[ft,s(o)]]),r("button",{disabled:!s(c),class:ve(["w-full px-3 py-1.5 text-sm font-semibold rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",s(c)?"bg-retro-green text-retro-dark hover:bg-retro-green/90":"bg-retro-green/30 text-retro-dark"]),onClick:v},_(s(l)||t.isCommitting?"Committing...":`Commit (${e.stagedFiles.length} staged)`),11,Qc)]),r("div",Jc,[r("div",eu,[r("h4",tu," Staged Changes ("+_(e.stagedFiles.length)+") ",1),e.stagedFiles.length>0?(i(),u("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:g}," Unstage All ")):H("",!0)]),e.stagedFiles.length===0?(i(),u("div",nu," No staged files. Stage files below to commit. ")):(i(),u("ul",ru,[(i(!0),u(he,null,Be(e.stagedFiles,I=>(i(),u("li",{key:"staged-"+I.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[r("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-red/20 transition-colors opacity-60 group-hover:opacity-100",title:"Unstage file","aria-label":`Unstage ${I.path}`,onClick:ee=>b(I)},[Y(s(ia),{class:"w-3.5 h-3.5 text-retro-red"})],8,ou),r("span",{class:ve(["flex-shrink-0 w-4 text-center text-xs font-bold",f(I.status).colorClass])},_(I.status),3),Y(s(qn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),r("span",su,_(I.oldPath?`${I.oldPath} → ${I.path}`:I.path),1)]))),128))]))]),r("div",au,[r("div",iu,[r("h4",lu," Unstaged Changes ("+_(e.unstagedFiles.length)+") ",1),e.unstagedFiles.length>0?(i(),u("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:C}," Stage All ")):H("",!0)]),e.unstagedFiles.length===0?(i(),u("div",cu," No unstaged changes. ")):(i(),u("ul",uu,[(i(!0),u(he,null,Be(e.unstagedFiles,I=>(i(),u("li",{key:"unstaged-"+I.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[r("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-green/20 transition-colors opacity-60 group-hover:opacity-100",title:"Stage file","aria-label":`Stage ${I.path}`,onClick:ee=>d(I)},[Y(s(pr),{class:"w-3.5 h-3.5 text-retro-green"})],8,du),r("span",{class:ve(["flex-shrink-0 w-4 text-center text-xs font-bold",f(I.status).colorClass])},_(I.status),3),Y(s(qn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),r("span",fu,_(I.oldPath?`${I.oldPath} → ${I.path}`:I.path),1)]))),128))]))])])]))}}),hu=["aria-label"],pu={key:0,class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border truncate font-mono"},vu={key:0,class:"my-1 border-t border-retro-border",role:"separator"},gu=["aria-disabled","onClick","onMouseenter"],xu={key:1,class:"w-4 h-4 flex-shrink-0"},Xn=Ce({__name:"GitContextMenu",props:{items:{},x:{},y:{},title:{}},emits:["close","action"],setup(e,{emit:n}){const t=e,a=n,o=S(null),l=S(-1),c=j(()=>t.items.map((v,h)=>({item:v,i:h})).filter(({item:v})=>!v.disabled).map(({i:v})=>v));let f=!1;function m(v){f&&o.value&&!o.value.contains(v.target)&&a("close")}st(()=>{requestAnimationFrame(()=>{f=!0}),document.addEventListener("mousedown",m),document.addEventListener("contextmenu",m),gn(()=>{o.value?.focus()})}),bt(()=>{f=!1,document.removeEventListener("mousedown",m),document.removeEventListener("contextmenu",m)});function d(v){const h=c.value;if(h.length===0)return;if(l.value===-1){l.value=v===1?h[0]:h[h.length-1];return}const R=h.indexOf(l.value);if(R===-1){l.value=v===1?h[0]:h[h.length-1];return}const G=R+v;G>=0&&G<h.length&&(l.value=h[G])}function b(v){switch(v.key){case"Escape":v.preventDefault(),a("close");break;case"ArrowDown":v.preventDefault(),d(1);break;case"ArrowUp":v.preventDefault(),d(-1);break;case"Enter":{v.preventDefault();const h=t.items[l.value];h&&!h.disabled&&(a("action",h.key),a("close"));break}}}function C(v){v.disabled||(a("action",v.key),a("close"))}const g=j(()=>{const h=t.title?29:0,R=t.items.filter(re=>re.separator).length,G=t.items.length*36+R*9+8,I=h+G,ee=8;let te=t.x,V=t.y;return typeof window<"u"&&(te+220>window.innerWidth-ee&&(te=window.innerWidth-220-ee),te<ee&&(te=ee),V+I>window.innerHeight-ee&&(V=window.innerHeight-I-ee),V<ee&&(V=ee)),{left:`${te}px`,top:`${V}px`}});return(v,h)=>(i(),ce(Qt,{to:"body"},[r("div",{ref_key:"menuRef",ref:o,class:"fixed z-50 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px]",style:At(s(g)),role:"menu","aria-label":e.title??"Context menu",tabindex:"-1",onKeydown:b},[e.title?(i(),u("div",pu,_(e.title),1)):H("",!0),(i(!0),u(he,null,Be(e.items,(R,G)=>(i(),u(he,{key:R.key},[R.separator?(i(),u("div",vu)):H("",!0),r("button",{class:ve(["w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors focus:outline-none",[R.disabled?"text-retro-muted/50 cursor-not-allowed":R.danger?["text-retro-red hover:bg-retro-red/10 focus:bg-retro-red/10",s(l)===G?"bg-retro-red/10":""]:["text-retro-text hover:bg-retro-cyan/10 focus:bg-retro-cyan/10",s(l)===G?"bg-retro-cyan/10":""]]]),role:"menuitem","aria-disabled":R.disabled||void 0,tabindex:-1,onClick:I=>C(R),onMouseenter:I=>l.value=R.disabled?s(l):G,onMouseleave:h[0]||(h[0]=I=>l.value=-1)},[R.icon?(i(),ce(En(R.icon),{key:0,class:ve(["w-4 h-4 flex-shrink-0",R.disabled?"opacity-50":R.danger?"":"text-retro-muted"])},null,8,["class"])):(i(),u("span",xu)),we(" "+_(R.label),1)],42,gu)],64))),128))],44,hu)]))}}),bu=Ce({__name:"GitBranchMenu",props:{branchName:{},isCurrentBranch:{type:Boolean},isLocal:{type:Boolean},x:{},y:{}},emits:["close","checkout","createBranch","deleteBranch","rename","merge","rebase","push","pull","fetch","copyName"],setup(e,{emit:n}){const t=e,a=n,o=j(()=>[{key:"checkout",label:"Checkout",icon:xn,disabled:t.isCurrentBranch},{key:"rename",label:"Rename",icon:rs,separator:!0},{key:"deleteBranch",label:"Delete",icon:cn,danger:!0,disabled:t.isCurrentBranch},{key:"merge",label:"Merge into Current",icon:Ko,separator:!0,disabled:t.isCurrentBranch},{key:"rebase",label:"Rebase Current Onto",icon:Vo,disabled:t.isCurrentBranch},{key:"push",label:"Push",icon:Wo,separator:!0},{key:"copyName",label:"Copy Branch Name",icon:Rn,separator:!0}]),l=j(()=>[{key:"checkout",label:"Checkout",icon:xn},{key:"deleteBranch",label:"Delete Remote Branch",icon:cn,separator:!0,danger:!0},{key:"fetch",label:"Fetch",icon:Qo,separator:!0},{key:"pull",label:"Pull into Current",icon:zs},{key:"copyName",label:"Copy Branch Name",icon:Rn,separator:!0}]),c=j(()=>t.isLocal?o.value:l.value),f={checkout:()=>a("checkout"),createBranch:()=>a("createBranch"),deleteBranch:()=>a("deleteBranch"),rename:()=>a("rename"),merge:()=>a("merge"),rebase:()=>a("rebase"),push:()=>a("push"),pull:()=>a("pull"),fetch:()=>a("fetch"),copyName:()=>a("copyName")};function m(d){const b=f[d];b&&b(),a("close")}return(d,b)=>{const C=Xn;return i(),ce(C,{items:s(c),x:e.x,y:e.y,title:e.branchName,onAction:m,onClose:b[0]||(b[0]=g=>a("close"))},null,8,["items","x","y","title"])}}}),yu=Ce({__name:"GitCommitMenu",props:{commit:{},x:{},y:{}},emits:["close","addTag","createBranch","checkout","cherryPick","revert","mergeInto","reset","copyHash","copySubject"],setup(e,{emit:n}){const t=n,a=j(()=>[{key:"addTag",label:"Add Tag",icon:no},{key:"createBranch",label:"Create Branch",icon:pr},{key:"checkout",label:"Checkout (detached HEAD)",icon:xn,separator:!0},{key:"cherryPick",label:"Cherry Pick",icon:Js},{key:"revert",label:"Revert",icon:Go},{key:"mergeInto",label:"Merge into Current",icon:Ko,separator:!0},{key:"reset",label:"Reset Current Branch to Here",icon:Vo,danger:!0},{key:"copyHash",label:"Copy Commit Hash",icon:Rn,separator:!0},{key:"copySubject",label:"Copy Commit Subject",icon:Rn}]),o={addTag:()=>t("addTag"),createBranch:()=>t("createBranch"),checkout:()=>t("checkout"),cherryPick:()=>t("cherryPick"),revert:()=>t("revert"),mergeInto:()=>t("mergeInto"),reset:()=>t("reset"),copyHash:()=>t("copyHash"),copySubject:()=>t("copySubject")};function l(c){const f=o[c];f&&f(),t("close")}return(c,f)=>{const m=Xn;return i(),ce(m,{items:s(a),x:e.x,y:e.y,title:e.commit.shortHash,onAction:l,onClose:f[0]||(f[0]=d=>t("close"))},null,8,["items","x","y","title"])}}}),wu=Ce({__name:"GitTagMenu",props:{tagName:{},x:{},y:{}},emits:["close","viewDetails","deleteTag","pushTag","copyName"],setup(e,{emit:n}){const t=n,a=[{key:"viewDetails",label:"View Details",icon:no},{key:"deleteTag",label:"Delete Tag",icon:cn,separator:!0,danger:!0},{key:"pushTag",label:"Push Tag",icon:Wo},{key:"copyName",label:"Copy Tag Name",icon:Rn,separator:!0}];function o(l){switch(l){case"viewDetails":t("viewDetails");break;case"deleteTag":t("deleteTag");break;case"pushTag":t("pushTag");break;case"copyName":t("copyName");break}}return(l,c)=>{const f=Xn;return i(),ce(f,{items:a,x:e.x,y:e.y,title:e.tagName,onClose:c[0]||(c[0]=m=>t("close")),onAction:o},null,8,["x","y","title"])}}}),ku=Ce({__name:"GitStashMenu",props:{stashIndex:{},stashMessage:{},x:{},y:{}},emits:["close","apply","pop","drop","createBranch","copyName","copyHash"],setup(e,{emit:n}){const t=n,a=[{key:"apply",label:"Apply Stash",icon:js},{key:"pop",label:"Pop Stash",icon:Go},{key:"createBranch",label:"Create Branch from Stash",icon:Nr,separator:!0},{key:"drop",label:"Drop Stash",icon:cn,separator:!0,danger:!0},{key:"copyName",label:"Copy Stash Reference",icon:Rn,separator:!0},{key:"copyHash",label:"Copy Stash Hash",icon:oa}];function o(l){switch(l){case"apply":t("apply");break;case"pop":t("pop");break;case"drop":t("drop");break;case"createBranch":t("createBranch");break;case"copyName":t("copyName");break;case"copyHash":t("copyHash");break}}return(l,c)=>{const f=Xn;return i(),ce(f,{items:a,x:e.x,y:e.y,title:e.stashMessage,onClose:c[0]||(c[0]=m=>t("close")),onAction:o},null,8,["x","y","title"])}}}),Cu=Ce({__name:"GitUncommittedMenu",props:{x:{},y:{}},emits:["close","stash","reset","clean"],setup(e,{emit:n}){const t=n,a=[{key:"stash",label:"Stash Uncommitted Changes",icon:Us},{key:"reset",label:"Reset Working Directory",icon:xn,separator:!0,danger:!0},{key:"clean",label:"Clean Untracked Files",icon:cn,danger:!0}];function o(l){switch(l){case"stash":t("stash");break;case"reset":t("reset");break;case"clean":t("clean");break}}return(l,c)=>{const f=Xn;return i(),ce(f,{items:a,x:e.x,y:e.y,title:"Uncommitted Changes",onClose:c[0]||(c[0]=m=>t("close")),onAction:o},null,8,["x","y"])}}}),$u={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Su={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},_u={class:"text-sm font-mono text-retro-text"},Mu={class:"p-4"},Tu={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Au={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},Bu=["disabled"],Eu=["disabled"],kt=Ce({__name:"GitDialog",props:{title:{},visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null},confirmLabel:{default:"Confirm"},confirmDanger:{type:Boolean,default:!1},cancelLabel:{default:"Cancel"}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n;function o(l){l.key==="Escape"&&a("close"),l.key==="Enter"&&!t.loading&&(l.preventDefault(),a("confirm"))}return Me(()=>t.visible,l=>{l?document.addEventListener("keydown",o):document.removeEventListener("keydown",o)}),bt(()=>{document.removeEventListener("keydown",o)}),(l,c)=>(i(),ce(Qt,{to:"body"},[Y($n,{"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:We(()=>[e.visible?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:c[3]||(c[3]=lt(f=>a("close"),["self"]))},[r("div",$u,[r("div",Su,[r("h3",_u,_(e.title),1),r("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:c[0]||(c[0]=f=>a("close"))},[Y(s(pt),{class:"h-4 w-4"})])]),r("div",Mu,[e.error?(i(),u("div",Tu,_(e.error),1)):H("",!0),Ts(l.$slots,"default")]),r("div",Au,[r("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono text-retro-muted hover:text-retro-text bg-retro-panel hover:bg-retro-border rounded transition-colors",disabled:e.loading,onClick:c[1]||(c[1]=f=>a("close"))},_(e.cancelLabel),9,Bu),r("button",{type:"button",class:ve(["px-3 py-1.5 text-xs font-mono rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",[e.confirmDanger?"text-retro-red bg-retro-red/10 border border-retro-red/30 hover:bg-retro-red/20":"text-retro-black bg-retro-cyan hover:bg-retro-cyan/80"]]),disabled:e.loading,onClick:c[2]||(c[2]=f=>a("confirm"))},_(e.loading?"Loading...":e.confirmLabel),11,Eu)])])])):H("",!0)]),_:3})]))}}),Qn=hr("gitGraph",()=>{const e=S([]),n=S([]),t=S([]),a=S(new Set),o=S([]),l=S([]),c=S(0),f=S(!1),m=S(null),d=S(null),b=S(null),C=S(!1),g=S(null),v=S(!1),h=S(0),R=S(""),G=S([]),I=S(null),ee=S(!1),te=S(!1),V=S(!1),re=S(!1),ue=S(null);let se=null;function ne(O){ue.value=O,se&&clearTimeout(se),se=setTimeout(()=>{ue.value=null},8e3)}function K(){ue.value=null,se&&(clearTimeout(se),se=null)}async function W(O,J,ye,dt){if(!I.value)return{success:!1,error:"No working directory set"};try{const Zt=await $fetch(O,{method:dt?.method??"POST",body:{workingDirectory:I.value,...J}});return(dt?.reloadGraph??!0)&&await Bt(I.value),{success:!0,data:Zt}}catch(Zt){const Kt=rr(Zt,ye);return ne(Kt),{success:!1,error:Kt}}}const U=S(null),F=S(!1),B=S(!1),X=S(null),M=S([]),p=S([]),E=S(null),Q=S(null),le=S(null),fe=S("inline"),Z=S("list"),P=S("rounded"),$=S(!1),L=S({date:!0,author:!0,commit:!0}),x=S(0),N=S(0),q=S(null),ie=S(null),ae=S(null),xe=S(null),Re=S(null),Se=S(null),nt=S(null),ze=S(null),at=S(null),ct=S(!1),vt=new Map,It=10,jt=j(()=>{if(!R.value&&G.value.length===0)return e.value;let O=e.value;if(R.value){const J=R.value.toLowerCase(),ye=`${J}:${e.value.length}`;if(vt.has(ye))O=vt.get(ye);else{if(O=Co(O,J),vt.size>=It){const dt=vt.keys().next().value;dt&&vt.delete(dt)}vt.set(ye,O)}}if(G.value.length>0){const J=new Set(G.value);O=ai(O,J)}return O}),zt=j(()=>n.value.find(O=>O.isHead)||null);async function Bt(O){I.value=O,C.value=!0,g.value=null;try{const[J,ye,dt,Zt,Kt]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:O}}),$fetch("/api/git/status",{query:{workingDirectory:O}}),$fetch("/api/git/stash",{query:{workingDirectory:O}}).then(hn=>hn.stashes).catch(()=>[]),$fetch("/api/git/remotes",{query:{workingDirectory:O}}).then(hn=>hn.remotes).catch(()=>[]),$fetch("/api/git/state",{query:{workingDirectory:O}}).then(hn=>hn.state).catch(()=>null)]);e.value=J.commits,n.value=J.branches,t.value=J.tags,a.value=new Set(J.localBranches??[]),v.value=J.hasMore,h.value=J.totalCount,o.value=ye.stagedFiles??[],l.value=ye.unstagedFiles??[],c.value=(ye.stagedCount??0)+(ye.unstagedCount??0),M.value=dt,p.value=Zt,X.value=Kt,U.value=Date.now(),await T()}catch(J){const ye=J instanceof Error?J.message:"Failed to load git graph";g.value=ye,e.value=[],n.value=[],t.value=[],o.value=[],l.value=[],c.value=0,M.value=[],p.value=[]}finally{C.value=!1}}async function Ye(){if(I.value)try{const O=await $fetch("/api/git/status",{query:{workingDirectory:I.value}});o.value=O.stagedFiles??[],l.value=O.unstagedFiles??[],c.value=(O.stagedCount??0)+(O.unstagedCount??0)}catch(O){console.error("Failed to refresh uncommitted changes:",O)}}const Ht=S(!1);async function Et(){if(!(!I.value||!v.value||C.value||Ht.value)){Ht.value=!0;try{const O=await $fetch("/api/git/log",{query:{workingDirectory:I.value,offset:e.value.length}});e.value=[...e.value,...O.commits],v.value=O.hasMore}catch(O){console.error("Failed to load more commits:",O)}finally{Ht.value=!1}}}async function Rt(O){if(m.value=O,d.value=null,b.value=null,f.value=!1,ee.value=!0,!I.value){ee.value=!1;return}try{const J=await $fetch("/api/git/show",{query:{workingDirectory:I.value,hash:O.hash}});d.value=J.files,b.value=J.stats}catch(J){console.error("Failed to load commit details:",J),d.value=[],b.value={additions:0,deletions:0,filesChanged:0},ne("Failed to load commit details")}finally{ee.value=!1}}function Ct(){m.value=null,d.value=null,b.value=null,f.value=!1}function ut(){m.value=null,b.value=null,d.value=null,f.value=!0}function Jt(O){R.value=O,x.value=0,$t()}const it=j(()=>R.value?Co(e.value,R.value).map(O=>O.hash):[]);function $t(){N.value=it.value.length}function en(){it.value.length!==0&&(x.value=(x.value+1)%it.value.length,$t(),Pt())}function un(){it.value.length!==0&&(x.value=x.value<=0?it.value.length-1:x.value-1,$t(),Pt())}function Pt(){const O=it.value[x.value];if(O){const J=e.value.find(ye=>ye.hash===O);J&&Rt(J)}}function rt(O){const J=G.value.indexOf(O);J===-1?G.value.push(O):G.value.splice(J,1)}function mt(){R.value="",G.value=[]}async function St(O){if(!I.value)return{success:!1,error:"No working directory set"};re.value=!0;try{const J=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:I.value,branchName:O}});return J.success&&await Bt(I.value),{success:J.success,error:J.error}}catch(J){const ye=J instanceof Error?J.message:"Failed to checkout branch";return ne(ye),{success:!1,error:ye}}finally{re.value=!1}}async function _t(O,J){if(!I.value)return{success:!1,error:"No working directory set"};try{const ye=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:I.value,branchName:O,createBranch:!0,fromCommit:J}});return ye.success&&await Bt(I.value),{success:ye.success,error:ye.error}}catch(ye){return{success:!1,error:ye instanceof Error?ye.message:"Failed to create branch"}}}async function tn(O,J=!1){return W("/api/git/branch",{branchName:O,force:J},"Failed to delete branch",{method:"DELETE"})}async function bn(O){return W("/api/git/branch",{branchName:O,remote:!0},"Failed to delete remote branch",{method:"DELETE"})}async function Vt(O){if(!I.value)return{success:!1,error:"No working directory set"};te.value=!0;try{return await $fetch("/api/git/stage",{method:"POST",body:{workingDirectory:I.value,files:O}}),await Ye(),{success:!0}}catch(J){const ye=J instanceof Error?J.message:"Failed to stage files";return ne(ye),{success:!1,error:ye}}finally{te.value=!1}}async function Wt(O){if(!I.value)return{success:!1,error:"No working directory set"};te.value=!0;try{return await $fetch("/api/git/unstage",{method:"POST",body:{workingDirectory:I.value,files:O}}),await Ye(),{success:!0}}catch(J){const ye=J instanceof Error?J.message:"Failed to unstage files";return ne(ye),{success:!1,error:ye}}finally{te.value=!1}}async function yn(O){if(!I.value)return{success:!1,error:"No working directory set"};V.value=!0;try{return await $fetch("/api/git/commit",{method:"POST",body:{workingDirectory:I.value,message:O}}),await Bt(I.value),{success:!0}}catch(J){const ye=J instanceof Error?J.message:"Failed to commit changes";return ne(ye),{success:!1,error:ye}}finally{V.value=!1}}async function Ot(O,J){return W("/api/git/branch-rename",{oldName:O,newName:J},"Failed to rename branch")}async function Xe(O,J){return W("/api/git/merge",{branch:O,...J},"Failed to merge branch")}async function wn(O){return W("/api/git/rebase",{onto:O},"Failed to rebase branch")}async function Ae(O,J,ye,dt){return W("/api/git/push",{branch:O,remote:J,force:ye,forceWithLease:dt},"Failed to push branch")}async function Lt(O,J,ye,dt){return W("/api/git/pull",{branch:O,remote:J,noFastForward:ye,squash:dt},"Failed to pull branch")}async function Ge(O,J,ye){return W("/api/git/fetch",{branch:O,remote:J,...ye},"Failed to fetch")}async function qe(O,J,ye){return W("/api/git/cherry-pick",{hash:O,recordOrigin:J,noCommit:ye},"Failed to cherry-pick commit")}async function De(O){return W("/api/git/revert",{hash:O},"Failed to revert commit")}async function Gt(O,J){return W("/api/git/reset",{hash:O,mode:J},"Failed to reset to commit")}async function Ve(O){if(!I.value)return{success:!1,error:"No working directory set"};try{return await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:I.value,branchName:O}}),await Bt(I.value),{success:!0}}catch(J){const ye=J?.data?.message||J?.statusMessage||J?.message||"Failed to checkout commit";return ne(ye),{success:!1,error:ye}}}async function nn(O){try{const J=O.message.split(`
|
|
63
|
+
`)[0];return await Ln(J),{success:!0}}catch(J){const ye=J?.message||"Failed to copy commit subject";return ne(ye),{success:!1,error:ye}}}async function Ne(O,J,ye,dt,Zt){return W("/api/git/tag",{name:O,hash:J,annotated:ye,message:dt,pushToRemote:Zt},"Failed to create tag")}async function Mt(O,J){return W("/api/git/tag",{name:O,deleteFromRemote:J},"Failed to delete tag",{method:"DELETE"})}async function Qe(O,J){return W("/api/git/tag-push",{name:O,remote:J},"Failed to push tag")}async function dn(O){if(!I.value)return{success:!1,error:"No working directory set"};try{return{success:!0,data:await $fetch(`/api/git/tag/${encodeURIComponent(O)}`,{query:{workingDirectory:I.value}})}}catch(J){const ye=rr(J,"Failed to get tag detail");return ne(ye),{success:!1,error:ye}}}async function Ze(O){try{return await Ln(O),{success:!0}}catch(J){const ye=J?.message||"Failed to copy tag name";return ne(ye),{success:!1,error:ye}}}async function qt(){if(!I.value)return{success:!1,error:"No working directory set"};try{const O=await $fetch("/api/git/stash",{query:{workingDirectory:I.value}});return M.value=O.stashes,{success:!0}}catch(O){const J=rr(O,"Failed to load stashes");return ne(J),{success:!1,error:J}}}async function Fe(O,J){return W("/api/git/stash-apply",{index:O,reinstateIndex:J},"Failed to apply stash")}async function fn(O,J){return W("/api/git/stash-pop",{index:O,reinstateIndex:J},"Failed to pop stash")}async function Ke(O){return W("/api/git/stash-drop",{index:O},"Failed to drop stash")}async function rn(O,J){return W("/api/git/stash-branch",{index:O,branchName:J},"Failed to create branch from stash")}async function Je(O,J){return W("/api/git/stash",{message:O,includeUntracked:J},"Failed to stash changes")}async function mn(){if(!I.value)return{success:!1,error:"No working directory set"};try{const O=await $fetch("/api/git/remotes",{query:{workingDirectory:I.value}});return p.value=O.remotes,{success:!0}}catch(O){const J=rr(O,"Failed to load remotes");return ne(J),{success:!1,error:J}}}async function pe(O,J){return W("/api/git/remote",{name:O,url:J},"Failed to add remote")}async function A(O,J){return W("/api/git/remote",{name:O,newUrl:J},"Failed to edit remote",{method:"PUT"})}async function oe(O){return W("/api/git/remote",{name:O},"Failed to delete remote",{method:"DELETE"})}async function me(O,J){return W("/api/git/fetch",{all:!0,prune:O,pruneTags:J},"Failed to fetch all")}function He(){fe.value=fe.value==="inline"?"bottom":"inline"}function Pe(){Z.value=Z.value==="list"?"tree":"list"}function Le(O){P.value=O}function et(){$.value=!$.value}function je(O){L.value={...L.value,[O]:!L.value[O]}}async function Nt(O){if(q.value=O,ie.value=null,O&&I.value)try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:I.value,branch:O}});ie.value=J.mergeBase}catch{ie.value=null}}async function w(O){if(ae.value=O,xe.value=null,O&&I.value)try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:I.value,branch:O}});xe.value=J.mergeBase}catch{xe.value=null}}async function D(O){if(Re.value=O,Se.value=null,O&&I.value)try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:I.value,branch:O}});Se.value=J.mergeBase}catch{Se.value=null}}async function T(){if(!I.value)return;const O=[];q.value&&O.push((async()=>{try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:I.value,branch:q.value}});ie.value=J.mergeBase}catch{ie.value=null}})()),ae.value&&O.push((async()=>{try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:I.value,branch:ae.value}});xe.value=J.mergeBase}catch{xe.value=null}})()),Re.value&&O.push((async()=>{try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:I.value,branch:Re.value}});Se.value=J.mergeBase}catch{Se.value=null}})()),O.length>0&&await Promise.all(O)}function z(O){const J=e.value.find(ye=>ye.hash===O||ye.shortHash===O);J&&Rt(J)}async function de(O){return W("/api/git/reset",{hash:"HEAD",mode:O},"Failed to reset working directory")}async function ge(){return W("/api/git/clean",{},"Failed to clean untracked files")}function ke(O){Q.value=O}function y(){Q.value=null}function k(O){le.value=O}function _e(){le.value=null}const ot=S(null),Tt=S(null),kn=S(!1),wr=j(()=>!!E.value&&!!m.value);function kr(O){E.value=O,O&&m.value&&Jn()}function Cr(){E.value=null,ot.value=null,Tt.value=null,kn.value=!1}async function Jn(){if(!(!I.value||!m.value||!E.value)){kn.value=!0;try{const O=E.value.hash,J=m.value.hash,ye=await $fetch("/api/git/diff",{query:{workingDirectory:I.value,from:O,to:J}});ot.value=ye.files,Tt.value=ye.stats}catch(O){console.error("Failed to load comparison:",O),ne("Failed to load commit comparison"),ot.value=null,Tt.value=null}finally{kn.value=!1}}}async function Ln(O){navigator?.clipboard&&await navigator.clipboard.writeText(O)}async function $r(O,J){nt.value=J,ze.value=O,at.value=null,ct.value=!0,await Nn()}function Sr(){nt.value=null,ze.value=null,at.value=null,ct.value=!1}async function Nn(){if(!I.value||!ze.value||!nt.value){ct.value=!1;return}ct.value=!0;try{const O=await $fetch("/api/git/file-diff",{query:{workingDirectory:I.value,commitHash:ze.value,filePath:nt.value.path}});at.value=O}catch(O){console.error("Failed to load file diff:",O),ne("Failed to load file diff"),at.value=null}finally{ct.value=!1}}function $e(){e.value=[],n.value=[],t.value=[],a.value=new Set,o.value=[],l.value=[],c.value=0,f.value=!1,m.value=null,d.value=null,b.value=null,C.value=!1,g.value=null,v.value=!1,h.value=0,R.value="",G.value=[],I.value=null,U.value=null,F.value=!1,B.value=!1,X.value=null,Ht.value=!1,ee.value=!1,te.value=!1,V.value=!1,re.value=!1,M.value=[],p.value=[],E.value=null,ot.value=null,Tt.value=null,kn.value=!1,Q.value=null,le.value=null,fe.value="inline",Z.value="list",P.value="rounded",$.value=!1,L.value={date:!0,author:!0,commit:!0},x.value=0,N.value=0,q.value=null,ae.value=null,xe.value=null,Re.value=null,Se.value=null,nt.value=null,ze.value=null,at.value=null,ct.value=!1,K(),vt.clear()}async function Fn(){if(!I.value||B.value||C.value)return!1;B.value=!0;try{const O=(await $fetch("/api/git/state",{query:{workingDirectory:I.value}})).state,J=X.value;if(X.value=O,U.value=Date.now(),!J)return!1;const ye=J.headCommit!==O.headCommit||J.branchListHash!==O.branchListHash,dt=J.workingTreeHash!==O.workingTreeHash,Zt=J.stashListHash!==O.stashListHash;if(ye){const[pn,er,_s]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:I.value}}),$fetch("/api/git/status",{query:{workingDirectory:I.value}}),$fetch("/api/git/stash",{query:{workingDirectory:I.value}}).then(Ms=>Ms.stashes).catch(()=>[])]);return e.value=pn.commits,n.value=pn.branches,t.value=pn.tags,a.value=new Set(pn.localBranches??[]),v.value=pn.hasMore,h.value=pn.totalCount,o.value=er.stagedFiles??[],l.value=er.unstagedFiles??[],c.value=(er.stagedCount??0)+(er.unstagedCount??0),M.value=_s,await T(),!0}if(!dt&&!Zt)return!1;const[Kt,hn]=await Promise.all([dt?$fetch("/api/git/status",{query:{workingDirectory:I.value}}):Promise.resolve(null),Zt?$fetch("/api/git/stash",{query:{workingDirectory:I.value}}).then(pn=>pn.stashes).catch(()=>[]):Promise.resolve(null)]);return Kt&&(o.value=Kt.stagedFiles??[],l.value=Kt.unstagedFiles??[],c.value=(Kt.stagedCount??0)+(Kt.unstagedCount??0)),hn&&(M.value=hn),!0}catch(O){return console.error("Failed to refresh git graph:",O),!1}finally{B.value=!1}}function Tn(){F.value=!0}function po(){F.value=!1}return{commits:be(e),branches:be(n),tags:be(t),localBranchNames:be(a),stagedFiles:be(o),unstagedFiles:be(l),uncommittedChangesCount:be(c),isUncommittedChangesSelected:be(f),selectedCommit:be(m),selectedCommitFiles:be(d),selectedCommitStats:be(b),loading:be(C),loadingMore:be(Ht),error:be(g),hasMore:be(v),totalCount:be(h),searchQuery:be(R),filteredBranches:be(G),workingDirectory:be(I),stashes:be(M),remotes:be(p),comparisonCommit:be(E),comparisonFiles:be(ot),comparisonStats:be(Tt),comparisonLoading:be(kn),isComparing:wr,activeDialog:be(Q),activeContextMenu:be(le),detailViewPosition:be(fe),fileViewMode:be(Z),graphStyle:be(P),muteNonAncestral:be($),columnVisibility:be(L),searchResultIndex:be(x),searchResultCount:be(N),selectedFeatureId:be(q),featureMergeBase:be(ie),conversationBranch:be(ae),conversationMergeBase:be(xe),previewBranch:be(Re),previewMergeBase:be(Se),diffViewerFile:be(nt),diffViewerCommitHash:be(ze),diffViewerContent:be(at),diffViewerLoading:be(ct),lastRefreshTime:be(U),isPollingActive:be(F),isRefreshing:be(B),isLoadingDetails:be(ee),isStaging:be(te),isCommitting:be(V),isCheckingOut:be(re),operationError:be(ue),filteredCommits:jt,currentBranch:zt,searchResultHashes:it,loadGitGraph:Bt,loadMoreCommits:Et,refreshUncommittedChanges:Ye,selectCommit:Rt,selectUncommittedChanges:ut,clearSelection:Ct,setSearchQuery:Jt,toggleBranchFilter:rt,clearFilters:mt,nextSearchResult:en,prevSearchResult:un,checkoutBranch:St,createBranch:_t,deleteLocalBranch:tn,deleteRemoteBranch:bn,stageFiles:Vt,unstageFiles:Wt,commitChanges:yn,reset:$e,clearOperationError:K,renameBranch:Ot,mergeBranch:Xe,rebaseBranch:wn,pushBranch:Ae,pullBranch:Lt,fetchBranch:Ge,cherryPickCommit:qe,revertCommit:De,resetToCommit:Gt,checkoutCommit:Ve,copyCommitSubject:nn,createTag:Ne,deleteTag:Mt,pushTag:Qe,getTagDetail:dn,copyTagName:Ze,loadStashes:qt,applyStash:Fe,popStash:fn,dropStash:Ke,stashBranch:rn,stashChanges:Je,loadRemotes:mn,addRemote:pe,editRemote:A,deleteRemote:oe,fetchAll:me,setActiveDialog:ke,clearActiveDialog:y,setActiveContextMenu:k,clearActiveContextMenu:_e,selectComparisonCommit:kr,clearComparison:Cr,loadComparisonData:Jn,copyToClipboard:Ln,toggleDetailViewPosition:He,toggleFileViewMode:Pe,setGraphStyle:Le,toggleMuteNonAncestral:et,toggleColumnVisibility:je,navigateToCommit:z,resetWorking:de,cleanUntracked:ge,setSelectedFeatureId:Nt,setConversationBranch:w,setPreviewBranch:D,openFileDiff:$r,closeFileDiff:Sr,checkAndRefresh:Fn,startPolling:Tn,stopPolling:po}});async function Ru(){if(typeof window>"u")return{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};try{const e=await $fetch("/api/conversations");if(!e||!Array.isArray(e.conversations))return console.warn("[conversationStorage] Invalid data structure from server"),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};e.version!==Ir&&console.warn(`[conversationStorage] Storage version mismatch: ${e.version} vs ${Ir}`);const n=e.conversations.map(m=>{if(!m||typeof m!="object")return m;const d=m;return"claudeSessionId"in d&&!("providerSessionId"in d)?{...d,providerSessionId:d.claudeSessionId}:m}),a=(Array.isArray(e.archivedConversations)?e.archivedConversations:[]).map(m=>{if(!m||typeof m!="object")return m;const d=m;return"claudeSessionId"in d&&!("providerSessionId"in d)?{...d,providerSessionId:d.claudeSessionId}:m}),o=n.filter(Ds),l=a.filter(Is),c=n.length-o.length,f=a.length-l.length;return c>0&&console.warn(`[conversationStorage] Discarded ${c} corrupted active conversation(s)`),f>0&&console.warn(`[conversationStorage] Discarded ${f} corrupted archive conversation(s)`),{conversations:o,archivedConversations:l,discardedConversations:c,discardedArchives:f}}catch(e){return console.error("[conversationStorage] Failed to load conversations:",e),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0}}}async function Pu(e,n=[]){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations",{method:"POST",body:{version:Ir,conversations:e,archivedConversations:n}}),!0}catch(t){return console.error("Failed to save conversations:",t),!1}}function Du(e){return e?e.map(n=>{switch(n.type){case"text":return n.text;case"tool_use":return`[${n.name}] ${n.inputSummary}`;case"tool_result":return n.isError?`Error: ${n.content.slice(0,100)}`:"";case"thinking":case"result_summary":case"session_init":return"";default:return""}}).filter(Boolean).join(`
|
|
64
|
+
`):""}const ht=hr("chat",()=>{const e=S(!1),n=S(Ls),t=S("ask"),a=S(""),o=S([]),l=S([]),c=S(null),f=S("active"),m=S(new Set),d=new Map,b=S(0),C=new Map,g=1200,v=S(null),h=S(null);function R(w){return w?d.get(w)??null:null}function G(w){let D=d.get(w);return D||(D={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},d.set(w,D)),D}const I=j(()=>o.value.find(w=>w.id===c.value)||null),ee=j(()=>I.value?.messages??[]),te=j(()=>(b.value,R(c.value)?.session??null)),V=j(()=>(b.value,R(c.value)?.pendingPermission??null)),re=j(()=>(b.value,R(c.value)?.pendingPlanApproval??null)),ue=j(()=>(b.value,R(c.value)?.lastError??null)),se=j(()=>(b.value,R(c.value)?.debugEvents??[])),ne=j(()=>te.value?.status==="streaming"),K=j(()=>I.value?.providerSessionId??""),W=j(()=>ee.value.length>0),U=j(()=>ee.value[ee.value.length-1]||null);function F(w){return m.value.has(w)}const B=j(()=>c.value?m.value.has(c.value):!1),X=j(()=>o.value.length>0),M=j(()=>l.value.length>0),p=j(()=>o.value.length),E=j(()=>p.value>=go),Q=j(()=>o.value),le=j(()=>l.value),fe=j(()=>v.value&&o.value.find(w=>w.id===v.value)||null);function Z(w){return v.value===w}function P(w){f.value=w}async function $(w){if(!(!w?.previewBranch||!w.worktreePath))try{const D=await $fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:w.previewBranch,worktreePath:w.worktreePath}});if(!D.success)throw new Error(D.error||"Unknown preview sync failure")}catch(D){console.warn("[chat] Failed to sync preview branch after worktree update",{conversationId:w.id,previewBranch:w.previewBranch,worktreePath:w.worktreePath,error:D instanceof Error?D.message:String(D)})}}async function L(w){if(F(w))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(o.value.findIndex(T=>T.id===w)===-1)return{success:!1,error:"Conversation not found"};try{const T=await $fetch(`/api/conversations/${w}/archive`,{method:"POST"});if(T.success&&T.archived){const z=C.get(w);return z&&(clearTimeout(z),C.delete(w)),d.delete(w),o.value=Array.isArray(T.conversations)?T.conversations:o.value.filter(de=>de.id!==w),l.value=Array.isArray(T.archivedConversations)?T.archivedConversations:[T.archived,...l.value],nn(),v.value===w&&(v.value=null),c.value===w&&(c.value=o.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:c.value}}).catch(de=>{console.error("Failed to save active conversation:",de)}),{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 x(w,D){if(Le().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${xo}.`};if(!l.value.some(z=>z.id===w))return{success:!1,error:"Archived conversation not found"};try{const z=await $fetch(`/api/conversations/archives/${w}/restore`,{method:"POST",body:{baseBranch:D}});return z.success&&z.conversation?(o.value=Array.isArray(z.conversations)?z.conversations:[z.conversation,...o.value],Array.isArray(z.archivedConversations)?l.value=z.archivedConversations:l.value=l.value.filter(de=>de.id!==w),f.value="active",Mt(z.conversation.id),Ve(),qe(),{success:!0,conversationId:z.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(z){return{success:!1,error:z instanceof Error?z.message:"Failed to restore archived conversation"}}}async function N(w){const D=l.value.findIndex(T=>T.id===w);if(D===-1)return{success:!1,error:"Archived conversation not found"};try{const T=await $fetch(`/api/conversations/archives/${w}`,{method:"DELETE"});return T.success?(Array.isArray(T.archivedConversations)?l.value=T.archivedConversations:l.value.splice(D,1),nn(),{success:!0}):{success:!1,error:"Failed to delete archived conversation"}}catch{return l.value.splice(D,1),qe(),{success:!0}}}async function q(){if(!(typeof window>"u"))try{const w=await $fetch("/api/settings");if(w){if(typeof w.panelWidth=="number"){const z=w.panelWidth;z>=bo&&z<=yo&&(n.value=z)}typeof w.isPanelOpen=="boolean"&&(e.value=w.isPanelOpen),typeof w.activeConversationId=="string"&&(c.value=w.activeConversationId);const{useSettingsStore:D}=await Bn(async()=>{const{useSettingsStore:z}=await import("./ChhNAy6p.js").then(de=>de.s);return{useSettingsStore:z}},__vite__mapDeps([0,1,2]),import.meta.url),T=D();await T.hydrate(),t.value=T.permissionMode}}catch(w){console.error("Failed to load chat settings:",w)}}function ie(w){t.value=w,typeof window<"u"&&Bn(async()=>{const{useSettingsStore:D}=await import("./ChhNAy6p.js").then(T=>T.s);return{useSettingsStore:D}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:D})=>{D().setPermissionMode(w)})}function ae(w,D){const T=D??c.value;if(!T)return;const z=G(T);z.pendingPermission=w,b.value++}function xe(w){const D=w??c.value;if(!D)return;const T=d.get(D);T&&(T.pendingPermission=null,b.value++)}function Re(w,D){const T=D??c.value;if(!T)return;const z=G(T);z.pendingPlanApproval=w,b.value++}function Se(w){const D=w??c.value;if(!D)return;const T=d.get(D);T&&(T.pendingPlanApproval=null,b.value++)}function nt(){e.value=!e.value,ct()}function ze(){e.value=!0,ct()}function at(){e.value=!1,ct()}function ct(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:e.value}}).catch(w=>{console.error("Failed to save panel state:",w)})}function vt(w){const D=Math.max(bo,Math.min(yo,w));n.value=D,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:D}}).catch(T=>{console.error("Failed to save panel width:",T)})}function It(w){a.value=w}function jt(w,D){const T=D??c.value;if(!T)return;const z=o.value.find(de=>de.id===T);z&&(z.providerSessionId=w)}function zt(w,D){const T=o.value.find(z=>z.id===w);T&&(T.worktreeBranch=D,T.lastCommitTime=new Date().toISOString())}function Bt(w,D,T){const z=o.value.find(de=>de.id===w);z&&(z.providerId=D,z.providerModelKey=T)}function Ye(w){const D=w??c.value;if(!D)return;const T=o.value.find(z=>z.id===D);T&&(T.providerSessionId="")}function Ht(w){return o.value.find(T=>T.id===w)?.providerSessionId??""}function Et(w){m.value.add(w)}function Rt(w){m.value.delete(w)}function Ct(w,D){const T=D??c.value;if(!T)return;const z=o.value.find(de=>de.id===T);z&&z.messages.push(w)}function ut(w,D){const T={id:ur(),role:"user",content:w,timestamp:new Date().toISOString()};return Ct(T,D),T}function Jt(w){const D={id:ur(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return Ct(D,w),D}function it(w,D,T){const z=T??c.value;if(!z)return;const de=o.value.find(ke=>ke.id===z);if(!de)return;const ge=de.messages.findIndex(ke=>ke.id===w);ge!==-1&&(de.messages[ge]={...de.messages[ge],...D})}function $t(w,D,T){const z=T??c.value;if(!z)return;const de=o.value.find(ke=>ke.id===z);if(!de)return;const ge=de.messages.findIndex(ke=>ke.id===w);ge!==-1&&(de.messages[ge].content+=D)}function en(w,D,T){const z=T??c.value;if(!z)return;const de=o.value.find(ke=>ke.id===z);if(!de)return;const ge=de.messages.findIndex(ke=>ke.id===w);if(ge!==-1){const ke=de.messages[ge],y=ke.tools?[...ke.tools,D]:[D];de.messages[ge]={...ke,tools:y}}}function un(w,D,T,z){const de=z??c.value;if(!de)return;const ge=o.value.find(y=>y.id===de);if(!ge)return;const ke=ge.messages.findIndex(y=>y.id===w);if(ke!==-1){const y=ge.messages[ke];if(y.tools){const k=y.tools.findIndex(_e=>_e.id===D);if(k!==-1){const _e=[...y.tools];_e[k]={..._e[k],...T},ge.messages[ke]={...y,tools:_e}}}}De(de,!1)}function Pt(w){w.contentBlocks&&(w.content=Du(w.contentBlocks))}function rt(w,D){const T=D??c.value;if(!T)return;const z=o.value.find(ge=>ge.id===T);if(!z)return;const de=z.messages.find(ge=>ge.id===w);de&&!de.contentBlocks&&(de.contentBlocks=[])}function mt(w,D,T){const z=T??c.value;if(!z)return;const de=o.value.find(ke=>ke.id===z);if(!de)return;const ge=de.messages.find(ke=>ke.id===w);ge&&(ge.contentBlocks||(ge.contentBlocks=[]),ge.contentBlocks.push(D),Pt(ge))}function St(w,D,T,z){const de=z??c.value;if(!de)return;const ge=o.value.find(k=>k.id===de);if(!ge)return;const ke=ge.messages.find(k=>k.id===w);if(!ke?.contentBlocks)return;const y=ke.contentBlocks.find(k=>k.id===D);y&&T(y)}function _t(w,D,T,z,de){const ge=z??c.value;if(!ge)return;const ke=o.value.find(k=>k.id===ge);if(!ke)return;const y=ke.messages.find(k=>k.id===w);y&&(St(w,D,T,ge),de?.syncContent!==!1&&Pt(y),De(ge,!1))}function tn(w,D,T){const z=T??c.value;z&&(mt(w,D,z),De(z,!1))}function bn(w,D,T){const z=T??c.value;if(!z)return null;const de=o.value.find(ke=>ke.id===z);if(!de)return null;const ge=de.messages.find(ke=>ke.id===w);return ge?.contentBlocks?ge.contentBlocks.find(ke=>ke.type==="tool_use"&&ke.toolUseId===D)??null:null}function Vt(w,D){const T=D??c.value;if(!T)return;const z=d.get(T);z?.session&&(z.session.status=w,b.value++)}function Wt(w,D){const T=D??c.value;if(!T)return;const z=G(T);z.session={sessionId:w,cwd:a.value,status:"streaming",startedAt:new Date().toISOString()},z.lastError=null,b.value++}function yn(w){const D=w??c.value;if(!D)return;const T=d.get(D);T?.session&&(T.session.status="idle",b.value++)}function Ot(w,D){const T=D??c.value;if(!T)return;const z=G(T);z.session&&(z.session.status="error",z.session.error=w),z.lastError=w,b.value++}function Xe(w,D){const T=D??c.value;if(!T)return;const z=G(T),de=(()=>{if(typeof w.payload=="string")return w.payload;try{return JSON.stringify(w.payload,null,2)}catch{return String(w.payload)}})(),ge=8e3,ke=300,y=de.length>ge?`${de.slice(0,ge)}
|
|
65
|
+
... (truncated)`:de;z.debugEvents.push({id:`dbg-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,timestamp:new Date().toISOString(),direction:w.direction,channel:w.channel,eventType:w.eventType||"unknown",payload:y}),z.debugEvents.length>ke&&z.debugEvents.splice(0,z.debugEvents.length-ke),b.value++}function wn(w){const D=w??c.value;if(!D)return;const T=d.get(D);T&&(T.debugEvents=[],b.value++)}function Ae(){if(!c.value)return;const w=o.value.find(T=>T.id===c.value);w&&(w.messages=[]);const D=c.value;d.delete(D),b.value++}function Lt(w){const D=w??c.value;if(!D)return;const T=d.get(D);T&&(T.lastError=null,T.session&&(T.session.error=void 0),b.value++)}async function Ge(){const w=await Ru();if(o.value=w.conversations,l.value=w.archivedConversations,w.discardedArchives>0&&console.warn(`[chat] Skipped ${w.discardedArchives} corrupted archived conversation(s)`),Ve(),nn(),!v.value){const D=o.value.find(T=>!!T.previewBranch&&!T.finalized);D&&(v.value=D.id)}if(c.value){const D=o.value.find(T=>T.id===c.value);D&&D.cwd?a.value=D.cwd:D||(c.value=null,e.value=!1)}}function qe(){Pu(o.value,l.value)}function De(w,D=!1){const T=o.value.find(z=>z.id===w);if(T)if(D){const z=C.get(w);z&&(clearTimeout(z),C.delete(w)),T.updatedAt=new Date().toISOString(),qe()}else{const z=C.get(w);z&&clearTimeout(z);const de=setTimeout(()=>{T.updatedAt=new Date().toISOString(),qe(),C.delete(w)},g);C.set(w,de)}}function Gt(w=!1){c.value&&De(c.value,w)}function Ve(){o.value.sort((w,D)=>new Date(D.createdAt).getTime()-new Date(w.createdAt).getTime())}function nn(){l.value.sort((w,D)=>new Date(D.archivedAt).getTime()-new Date(w.archivedAt).getTime())}async function Ne(w){if(Le().atLimit)return"";const T=Uo();let z=null;if(w?.featureId){const y=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:T,featureId:w.featureId,baseBranch:w.baseBranch}});if(!y.success&&y.error)throw new Error(y.error);z=y}let de=null;if(typeof window<"u")try{const{useSettingsStore:y}=await Bn(async()=>{const{useSettingsStore:_e}=await import("./ChhNAy6p.js").then(ot=>ot.s);return{useSettingsStore:_e}},__vite__mapDeps([0,1,2]),import.meta.url),k=y();await k.hydrate(),de=k.providerSelection}catch(y){console.warn("[chat] Failed to load provider selection for new conversation",y)}const ge=de||{providerId:zo,modelKey:jo},ke={id:T,title:"New Conversation",messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:a.value||process.cwd?.()||"",featureId:w?.featureId,providerId:ge.providerId,providerModelKey:ge.modelKey};if(z?.success&&z.worktreePath&&z.branch&&(ke.worktreePath=z.worktreePath,ke.worktreeBranch=z.branch,ke.cwd=z.worktreePath,ke.hasWorktree=!0,z.baseBranch&&(ke.baseBranch=z.baseBranch),z.providerSessionId&&(ke.providerSessionId=z.providerSessionId)),o.value.unshift(ke),c.value=T,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:T}}).catch(y=>{console.error("Failed to save active conversation:",y)}),!w?.featureId)try{const y=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:T,baseBranch:w?.baseBranch}});if(y.success&&y.worktreePath&&y.branch){const k=o.value.find(_e=>_e.id===T);k&&(k.worktreePath=y.worktreePath,k.worktreeBranch=y.branch,k.cwd=y.worktreePath,k.hasWorktree=!0,y.baseBranch&&(k.baseBranch=y.baseBranch))}}catch(y){console.warn("[chat] Failed to create worktree for conversation",T,y)}return qe(),T}function Mt(w){const D=o.value.find(T=>T.id===w);D&&(c.value=w,e.value=!0,D.cwd&&(a.value=D.cwd),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:w,isPanelOpen:!0}}).catch(T=>{console.error("Failed to save active conversation:",T)}))}async function Qe(w){const D=o.value.findIndex(de=>de.id===w);if(D===-1)return;const T=o.value[D];if(v.value===w&&(v.value=null),T.hasWorktree&&T.worktreePath&&T.worktreeBranch)try{await $fetch("/api/chat/worktree",{method:"DELETE",body:{worktreePath:T.worktreePath,branch:T.worktreeBranch}})}catch(de){console.warn("[chat] Failed to clean up worktree for conversation",w,de)}o.value.splice(D,1),d.delete(w);const z=C.get(w);z&&(clearTimeout(z),C.delete(w)),c.value===w&&(c.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(de=>{console.error("Failed to clear active conversation:",de)})),qe()}async function dn(w,D,T){const z=o.value.find(ge=>ge.id===w);if(!z)return{success:!1,error:"Conversation not found"};if(!z.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const de=T||z.baseBranch;try{const ge=await $fetch("/api/chat/finalize",{method:"POST",body:{conversationId:w,commitMessage:D,baseBranch:de,worktreePath:z.worktreePath,worktreeBranch:z.worktreeBranch}});return ge.success?(v.value===w&&(v.value=null),z.worktreePath=void 0,z.worktreeBranch=void 0,z.hasWorktree=!1,z.baseBranch=void 0,z.previewBranch=void 0,z.finalized=!0,z.updatedAt=new Date().toISOString(),qe()):ge.rebaseInProgress&&ge.conflictFiles?.length&&await qt(w,z.worktreePath,de||"main",D),ge}catch(ge){return{success:!1,error:ge instanceof Error?ge.message:String(ge)}}}async function Ze(w,D){const T=o.value.find(de=>de.id===w);if(!T)return{success:!1,error:"Conversation not found"};if(!T.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const z=D||T.baseBranch;try{const de=await $fetch("/api/chat/rebase",{method:"POST",body:{conversationId:w,baseBranch:z,worktreePath:T.worktreePath}});return de.rebaseInProgress&&de.conflictFiles?.length?await qt(w,T.worktreePath,z||"main","","sync"):de.success&&(await $(T),T.baseBranch=z,qe()),de}catch(de){return{success:!1,error:de instanceof Error?de.message:String(de)}}}async function qt(w,D,T,z,de="finalize"){h.value={conversationId:w,worktreePath:D,baseBranch:T,commitMessage:z,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:de};try{const ge=await $fetch("/api/rebase/conflicts",{params:{worktreePath:D}});h.value&&(h.value.files=ge.files,h.value.loading=!1)}catch(ge){h.value&&(h.value.error=ge instanceof Error?ge.message:String(ge),h.value.loading=!1)}}async function Fe(w,D){if(!h.value)return!1;try{const T=await $fetch("/api/rebase/resolve",{method:"PUT",body:{worktreePath:h.value.worktreePath,filePath:w,content:D}});return T.success&&h.value&&h.value.resolvedFiles.add(w),T.success}catch{return!1}}async function fn(){if(!h.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:w,commitMessage:D,baseBranch:T,mode:z,worktreePath:de}=h.value,ge=z==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue";try{const ke=o.value.find(k=>k.id===w),y=await $fetch(ge,{method:"POST",body:{conversationId:w,commitMessage:D,baseBranch:T,worktreePath:de,worktreeBranch:ke?.worktreeBranch}});if(y.success){if(z==="finalize"){v.value===w&&(v.value=null);const k=o.value.find(_e=>_e.id===w);k&&(k.worktreePath=void 0,k.worktreeBranch=void 0,k.hasWorktree=!1,k.baseBranch=void 0,k.previewBranch=void 0,k.finalized=!0,k.updatedAt=new Date().toISOString(),qe())}else if(z==="sync"){const k=o.value.find(_e=>_e.id===w);k&&(await $(k),k.baseBranch=T,k.updatedAt=new Date().toISOString(),qe())}h.value=null}else y.rebaseInProgress&&y.conflictFiles?.length&&await qt(w,de,T,D,z);return y}catch(ke){return{success:!1,error:ke instanceof Error?ke.message:String(ke)}}}async function Ke(){if(!h.value)return!1;try{const w=await $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:h.value.worktreePath}});return h.value=null,w.success}catch{return h.value=null,!1}}async function rn(w){if(!h.value)return!1;const D=h.value.files.find(T=>T.path===w);if(!D)return!1;try{const T=await $fetch("/api/rebase/ai-resolve",{method:"POST",body:{worktreePath:h.value.worktreePath,filePath:w,conflictContent:D.content}});return T.success&&T.resolvedContent!==void 0?(D.content=T.resolvedContent,await Fe(w,T.resolvedContent)):!1}catch{return!1}}async function Je(){if(!h.value)return;const w=h.value.files.filter(D=>!h.value.resolvedFiles.has(D.path));for(const D of w)await rn(D.path)}async function mn(w){const D=o.value.find(T=>T.id===w);if(!D)return{success:!1,error:"Conversation not found"};if(!D.hasWorktree||!D.worktreePath||!D.baseBranch)return{success:!1,error:"No worktree to preview"};try{const T=await $fetch("/api/chat/preview",{method:"POST",body:{conversationId:w,worktreePath:D.worktreePath,baseBranch:D.baseBranch}});return T.success&&T.previewBranch&&(D.previewBranch=T.previewBranch,v.value=w,D.updatedAt=new Date().toISOString(),qe()),{success:T.success,error:T.error}}catch(T){return{success:!1,error:T instanceof Error?T.message:String(T)}}}async function pe(w){const D=o.value.find(T=>T.id===w);if(!D)return{success:!1,error:"Conversation not found"};if(!D.previewBranch||!D.baseBranch)return v.value=null,{success:!1,error:"No active preview"};try{const T=await $fetch("/api/chat/preview",{method:"DELETE",body:{previewBranch:D.previewBranch,baseBranch:D.baseBranch}});return T.success&&(D.previewBranch=void 0,v.value=null,D.updatedAt=new Date().toISOString(),qe()),{success:T.success,error:T.error}}catch(T){return{success:!1,error:T instanceof Error?T.message:String(T)}}}async function A(w){if(v.value===w)return await pe(w);if(v.value){const D=await pe(v.value);if(!D.success)return{success:!1,error:`Failed to end previous preview: ${D.error}`}}return await mn(w)}function oe(w){return o.value.find(D=>D.featureId===w)||null}function me(w){o.value.unshift(w),Ve(),qe()}function He(w,D){const T=o.value.find(z=>z.id===w);T&&(T.title=D.trim(),T.updatedAt=new Date().toISOString(),Ve(),qe())}function Pe(w){const D=c.value;if(!D)return;const T=o.value.find(de=>de.id===D);if(!T||T.title!=="New Conversation")return;const z=T.messages.find(de=>de.role==="user");z&&(T.title=Ns(z.content))}function Le(){const w=o.value.length;return{atLimit:w>=xo,nearLimit:w>=go,count:w}}async function et(w){c.value||await Ne();const D=ut(w);return Pe(),Gt(!0),D}function je(w,D,T){const z=T??c.value;$t(w,D,z??void 0),z&&De(z,!1)}function Nt(w,D){const T=D??c.value;it(w,{status:"complete"},T??void 0),T&&De(T,!0)}return{messages:ee,session:te,isPanelOpen:e,panelWidth:be(n),permissionMode:be(t),pendingPermission:V,pendingPlanApproval:re,cwd:be(a),lastError:ue,debugEvents:se,providerSessionId:K,conversations:be(o),archivedConversations:be(l),activeConversationId:be(c),conversationViewMode:be(f),conflictState:be(h),previewingConversationId:be(v),isStreaming:ne,hasMessages:W,lastMessage:U,isActiveConversationStreaming:B,hasConversations:X,hasArchivedConversations:M,activeConversation:I,conversationCount:p,isNearStorageLimit:E,sortedConversations:Q,sortedArchivedConversations:le,previewingConversation:fe,streamingConversations:be(m),initialize:q,togglePanel:nt,openPanel:ze,closePanel:at,setPanelWidth:vt,setPermissionMode:ie,setPendingPermission:ae,clearPendingPermission:xe,setPendingPlanApproval:Re,clearPendingPlanApproval:Se,setCwd:It,setProviderSessionId:jt,clearProviderSession:Ye,getProviderSessionId:Ht,updateWorktreeBranch:zt,setConversationProviderSelection:Bt,startConversationStreaming:Et,endConversationStreaming:Rt,isConversationStreaming:F,addMessage:Ct,addUserMessage:ut,addAssistantMessage:Jt,updateMessage:it,appendToMessage:$t,addToolToMessage:en,updateToolInMessage:un,initContentBlocks:rt,appendContentBlock:mt,appendContentBlockWithSave:tn,updateBlockById:St,updateBlockWithSave:_t,findToolUseBlock:bn,syncContentFromBlocks:Pt,setSessionStatus:Vt,startSession:Wt,endSession:yn,setSessionError:Ot,pushDebugEvent:Xe,clearDebugEvents:wn,clearMessages:Ae,clearError:Lt,loadConversations:Ge,saveAllConversations:qe,saveCurrentConversation:Gt,saveConversation:De,createConversation:Ne,selectConversation:Mt,deleteConversation:Qe,archiveConversation:L,restoreArchivedConversation:x,deleteArchivedConversation:N,setConversationViewMode:P,findConversationByFeature:oe,addAutoModeConversation:me,renameConversation:He,checkStorageLimits:Le,finalizeConversation:dn,rebaseConversation:Ze,resolveConflictFile:Fe,continueRebase:fn,abortRebase:Ke,aiResolveConflictFile:rn,aiResolveAllConflicts:Je,previewConversation:mn,unpreviewConversation:pe,togglePreview:A,isConversationPreviewing:Z,addUserMessageWithConversation:et,appendToMessageWithSave:je,completeMessageWithSave:Nt}});function Iu(e={}){const n=Qn(),t=300,a=5e3,o=250;let l=null,c=null,f=null,m=null,d=null,b=!1,C=!1;const g=S(!1),v=S(!1);let h=e;function R(F){h=F}async function G(){const F=h.getScrollPosition?.()??0,B=await n.checkAndRefresh();return B&&h.setScrollPosition&&(await gn(),h.setScrollPosition(F)),B}function I(){return g.value||!!n.activeContextMenu||!!n.activeDialog}async function ee(){if(I()){v.value=!0;return}V()}async function te(){if(b){C=!0;return}b=!0;try{await G()}finally{b=!1,C&&(C=!1,V())}}function V(){c&&clearTimeout(c),c=setTimeout(()=>{c=null,te()},o)}function re(F){if(typeof window>"u")return;if(f&&f.readyState===WebSocket.OPEN){f.send(JSON.stringify({type:"watch",workingDirectory:F}));return}m&&(clearTimeout(m),m=null);const X=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;f=new WebSocket(X),f.onopen=()=>{f.send(JSON.stringify({type:"watch",workingDirectory:F}))},f.onmessage=M=>{try{JSON.parse(M.data).type==="git_changed"&&ee()}catch{}},f.onclose=()=>{f=null,n.isPollingActive&&d&&(m=setTimeout(()=>{d&&re(d)},a))},f.onerror=()=>{}}function ue(){m&&(clearTimeout(m),m=null),f&&(f.close(),f=null)}function se(F){F&&(d=F),!n.isPollingActive&&(n.startPolling(),d&&re(d))}function ne(){ue(),n.stopPolling()}function K(){g.value=!0,l&&(clearTimeout(l),l=null)}function W(){l&&clearTimeout(l),l=setTimeout(async()=>{g.value=!1,v.value&&(v.value=!1,V())},t)}function U(){ne(),l&&(clearTimeout(l),l=null),c&&(clearTimeout(c),c=null),b=!1,C=!1,d=null}return Me(()=>[n.activeContextMenu,n.activeDialog],()=>{!n.activeContextMenu&&!n.activeDialog&&v.value&&!g.value&&(v.value=!1,V())}),{isUserInteracting:be(g),isDeferredRefresh:be(v),startPolling:se,stopPolling:ne,startInteraction:K,endInteraction:W,cleanup:U,setScrollCallbacks:R}}function Lu(e){Qn();function n(o){const l=o.ctrlKey||o.metaKey;if(l&&o.key==="f"){o.preventDefault(),e.onFind();return}if(l&&o.key==="r"){o.preventDefault(),e.onRefresh();return}if(l&&o.key==="h"){o.preventDefault(),e.onScrollToHead();return}if(o.key==="Escape"){o.preventDefault(),e.onEscape();return}}function t(){document.addEventListener("keydown",n)}function a(){document.removeEventListener("keydown",n)}return{start:t,stop:a}}const Nu={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Fu={class:"text-sm font-mono text-retro-cyan"},Hu={class:"text-xs font-mono text-retro-text mt-1 truncate"},Ou={class:"space-y-3"},Uu={class:"flex items-start gap-2 cursor-pointer group"},ju={class:"flex items-start gap-2 cursor-pointer group"},zu=Ce({__name:"CherryPickDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=S(!1),o=S(!1);function l(){t("confirm",{recordOrigin:a.value,noCommit:o.value})}function c(){a.value=!1,o.value=!1,t("close")}return(f,m)=>(i(),ce(kt,{title:"Cherry-Pick Commit",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Cherry-Pick",onClose:c,onConfirm:l},{default:We(()=>[r("div",Nu,[m[2]||(m[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),r("div",Fu,_(e.commitHash.slice(0,7)),1),r("div",Hu,_(e.commitMessage.split(`
|
|
66
|
+
`)[0]),1)]),r("div",Ou,[r("label",Uu,[Te(r("input",{"onUpdate:modelValue":m[0]||(m[0]=d=>Ie(a)?a.value=d:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Dt,s(a)]]),m[3]||(m[3]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Record origin (-x) "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"},' Append "(cherry picked from commit ...)" to the commit message ')],-1))]),r("label",ju,[Te(r("input",{"onUpdate:modelValue":m[1]||(m[1]=d=>Ie(o)?o.value=d:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Dt,s(o)]]),m[4]||(m[4]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," No commit "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Apply changes to the working directory without committing ")],-1))])])]),_:1},8,["visible","loading","error"]))}}),Vu={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Wu={class:"text-sm font-mono text-retro-cyan"},Gu={class:"mb-4"},qu={class:"flex items-start gap-2 cursor-pointer group"},Zu=Ce({__name:"CreateBranchDialog",props:{visible:{type:Boolean},fromCommit:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=S(""),o=S(!0),l=j(()=>a.value.trim().length>0);function c(){l.value&&t("confirm",{name:a.value.trim(),checkout:o.value})}function f(){a.value="",o.value=!0,t("close")}return(m,d)=>(i(),ce(kt,{title:"Create Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Create Branch",onClose:f,onConfirm:c},{default:We(()=>[r("div",Vu,[d[2]||(d[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"From",-1)),r("div",Wu,_(e.fromCommit.slice(0,7)),1)]),r("div",Gu,[d[3]||(d[3]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Branch name",-1)),Te(r("input",{"onUpdate:modelValue":d[0]||(d[0]=b=>Ie(a)?a.value=b: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),[[ft,s(a)]])]),r("label",qu,[Te(r("input",{"onUpdate:modelValue":d[1]||(d[1]=b=>Ie(o)?o.value=b:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Dt,s(o)]]),d[4]||(d[4]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Switch to new branch "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Checkout the branch after creating it ")],-1))])]),_:1},8,["visible","loading","error"]))}}),Ku=Ce({__name:"CleanUntrackedDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n;return(a,o)=>(i(),ce(kt,{title:"Clean Untracked Files",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Clean","confirm-danger":"",onClose:o[0]||(o[0]=l=>t("close")),onConfirm:o[1]||(o[1]=l=>t("confirm"))},{default:We(()=>[...o[2]||(o[2]=[r("div",{class:"space-y-3"},[r("p",{class:"text-retro-text text-sm font-mono"}," Remove all untracked files and directories from the working tree. "),r("p",{class:"text-retro-muted text-xs font-mono"},[we(" This runs "),r("code",null,"git clean -fd"),we(" and cannot be undone. ")])],-1)])]),_:1},8,["visible","loading","error"]))}}),Yu={class:"text-retro-text text-sm font-mono mb-2"},Xu={class:"text-retro-cyan"},Qu={class:"space-y-3 mt-4"},Ju={class:"flex items-center gap-2 cursor-pointer"},ed=Ce({__name:"DeleteBranchDialog",props:{visible:{type:Boolean},branchName:{},isLocal:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,o=S(!1);function l(){a("confirm",{force:o.value})}return Me(()=>t.visible,c=>{c&&(o.value=!1)}),(c,f)=>(i(),ce(kt,{title:"Delete Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Delete","confirm-danger":!0,onClose:f[1]||(f[1]=m=>a("close")),onConfirm:l},{default:We(()=>[f[4]||(f[4]=r("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),r("p",Yu,[we(" Delete "+_(e.isLocal?"local":"remote")+" branch ",1),r("span",Xu,_(e.branchName),1),f[2]||(f[2]=we("? ",-1))]),r("div",Qu,[r("label",Ju,[Te(r("input",{"onUpdate:modelValue":f[0]||(f[0]=m=>Ie(o)?o.value=m:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,s(o)]]),f[3]||(f[3]=r("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),td={class:"text-retro-text text-sm font-mono mb-4"},nd={class:"text-retro-cyan"},rd={class:"space-y-3"},od={class:"flex items-center gap-2 cursor-pointer"},sd={class:"flex items-center gap-2 cursor-pointer"},ad={class:"flex items-center gap-2 cursor-pointer"},id=Ce({__name:"MergeDialog",props:{visible:{type:Boolean},branchName:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,o=S(!1),l=S(!1),c=S(!1);function f(){a("confirm",{noCommit:o.value,noFastForward:l.value,squash:c.value})}return Me(()=>t.visible,m=>{m&&(o.value=!1,l.value=!1,c.value=!1)}),(m,d)=>(i(),ce(kt,{title:"Merge Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Merge",onClose:d[3]||(d[3]=b=>a("close")),onConfirm:f},{default:We(()=>[r("p",td,[d[4]||(d[4]=we(" Merge ",-1)),r("span",nd,_(e.branchName),1),d[5]||(d[5]=we(" into current branch ",-1))]),r("div",rd,[r("label",od,[Te(r("input",{"onUpdate:modelValue":d[0]||(d[0]=b=>Ie(o)?o.value=b:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,s(o)]]),d[6]||(d[6]=r("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),r("label",sd,[Te(r("input",{"onUpdate:modelValue":d[1]||(d[1]=b=>Ie(l)?l.value=b:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,s(l)]]),d[7]||(d[7]=r("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),r("label",ad,[Te(r("input",{"onUpdate:modelValue":d[2]||(d[2]=b=>Ie(c)?c.value=b:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,s(c)]]),d[8]||(d[8]=r("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),ld={class:"text-retro-text text-sm font-mono mb-4"},cd={class:"text-retro-cyan"},ud={class:"space-y-3"},dd=["value"],fd={class:"flex items-center gap-2 cursor-pointer"},md={class:"flex items-center gap-2 cursor-pointer"},hd=Ce({__name:"PullDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,o=S("origin"),l=S(!1),c=S(!1);function f(){a("confirm",{remote:o.value,noFastForward:l.value,squash:c.value})}return Me(()=>t.visible,m=>{m&&(o.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",l.value=!1,c.value=!1)}),(m,d)=>(i(),ce(kt,{title:"Pull Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Pull",onClose:d[3]||(d[3]=b=>a("close")),onConfirm:f},{default:We(()=>[r("p",ld,[d[4]||(d[4]=we(" Pull ",-1)),r("span",cd,_(e.branchName),1),d[5]||(d[5]=we(" from remote ",-1))]),r("div",ud,[r("div",null,[d[6]||(d[6]=r("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),Te(r("select",{"onUpdate:modelValue":d[0]||(d[0]=b=>Ie(o)?o.value=b:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(i(!0),u(he,null,Be(e.remotes,b=>(i(),u("option",{key:b,value:b},_(b),9,dd))),128))],512),[[_n,s(o)]])]),r("label",fd,[Te(r("input",{"onUpdate:modelValue":d[1]||(d[1]=b=>Ie(l)?l.value=b:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,s(l)]]),d[7]||(d[7]=r("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),r("label",md,[Te(r("input",{"onUpdate:modelValue":d[2]||(d[2]=b=>Ie(c)?c.value=b:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,s(c)]]),d[8]||(d[8]=r("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),pd={class:"text-retro-text text-sm font-mono mb-4"},vd={class:"text-retro-cyan"},gd={class:"space-y-3"},xd=["value"],bd={class:"flex items-center gap-2 cursor-pointer"},yd=["checked"],wd={class:"flex items-center gap-2 cursor-pointer"},kd=["checked"],Cd={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},$d=Ce({__name:"PushDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,o=S("origin"),l=S(!1),c=S(!1);function f(b){l.value=b,b&&(c.value=!1)}function m(b){c.value=b,b&&(l.value=!1)}function d(){a("confirm",{remote:o.value,force:l.value,forceWithLease:c.value})}return Me(()=>t.visible,b=>{b&&(o.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",l.value=!1,c.value=!1)}),(b,C)=>(i(),ce(kt,{title:"Push Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Push",onClose:C[3]||(C[3]=g=>a("close")),onConfirm:d},{default:We(()=>[r("p",pd,[C[4]||(C[4]=we(" Push ",-1)),r("span",vd,_(e.branchName),1),C[5]||(C[5]=we(" to remote ",-1))]),r("div",gd,[r("div",null,[C[6]||(C[6]=r("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),Te(r("select",{"onUpdate:modelValue":C[0]||(C[0]=g=>Ie(o)?o.value=g:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(i(!0),u(he,null,Be(e.remotes,g=>(i(),u("option",{key:g,value:g},_(g),9,xd))),128))],512),[[_n,s(o)]])]),r("label",bd,[r("input",{checked:s(l),type:"checkbox",class:"accent-retro-cyan",onChange:C[1]||(C[1]=g=>f(g.target.checked))},null,40,yd),C[7]||(C[7]=r("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),r("label",wd,[r("input",{checked:s(c),type:"checkbox",class:"accent-retro-cyan",onChange:C[2]||(C[2]=g=>m(g.target.checked))},null,40,kd),C[8]||(C[8]=r("span",{class:"text-retro-muted text-sm"},"Force with lease (safer force push)",-1))]),s(l)||s(c)?(i(),u("div",Cd,_(s(l)?"Force push will overwrite remote history. Use with caution.":"Force with lease will reject the push if the remote has been updated since your last fetch."),1)):H("",!0)])]),_:1},8,["visible","loading","error"]))}}),Sd={class:"text-retro-text text-sm font-mono mb-4"},_d={class:"text-retro-cyan"},Md={class:"text-retro-cyan"},Td={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},Ad={class:"text-retro-cyan"},Bd={class:"text-retro-cyan"},Ed=Ce({__name:"RebaseDialog",props:{visible:{type:Boolean},branchName:{},ontoBranch:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n;return(a,o)=>(i(),ce(kt,{title:"Rebase Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Rebase",onClose:o[0]||(o[0]=l=>t("close")),onConfirm:o[1]||(o[1]=l=>t("confirm"))},{default:We(()=>[r("p",Sd,[o[2]||(o[2]=we(" Rebase ",-1)),r("span",_d,_(e.branchName),1),o[3]||(o[3]=we(" onto ",-1)),r("span",Md,_(e.ontoBranch),1)]),r("div",Td,[o[4]||(o[4]=we(" This will rewrite commit history. Commits from ",-1)),r("span",Ad,_(e.branchName),1),o[5]||(o[5]=we(" will be replayed on top of ",-1)),r("span",Bd,_(e.ontoBranch),1),o[6]||(o[6]=we(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),Rd={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Pd={class:"text-sm font-mono text-retro-cyan"},Dd={class:"text-xs font-mono text-retro-text mt-1 truncate"},Id={class:"space-y-2"},Ld=["value"],Nd={key:0,class:"mt-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Fd=Ce({__name:"ResetDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=S("mixed"),o=[{value:"soft",label:"Soft",description:"Move HEAD, keep staged changes and working directory"},{value:"mixed",label:"Mixed",description:"Move HEAD, reset staging area, keep working directory"},{value:"hard",label:"Hard",description:"Move HEAD, reset staging area and working directory (DESTRUCTIVE)"}];function l(){t("confirm",{mode:a.value})}function c(){a.value="mixed",t("close")}return(f,m)=>(i(),ce(kt,{title:"Reset to Commit",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Reset","confirm-danger":s(a)==="hard",onClose:c,onConfirm:l},{default:We(()=>[r("div",Rd,[m[1]||(m[1]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Reset to",-1)),r("div",Pd,_(e.commitHash.slice(0,7)),1),r("div",Dd,_(e.commitMessage.split(`
|
|
67
|
+
`)[0]),1)]),r("div",Id,[m[2]||(m[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-2"},"Reset mode",-1)),(i(),u(he,null,Be(o,d=>r("label",{key:d.value,class:ve(["flex items-start gap-2 p-2 rounded cursor-pointer group border transition-colors",[s(a)===d.value?"border-retro-cyan bg-retro-cyan/5":"border-transparent hover:bg-retro-panel"]])},[Te(r("input",{"onUpdate:modelValue":m[0]||(m[0]=b=>Ie(a)?a.value=b:null),type:"radio",name:"reset-mode",value:d.value,class:"mt-0.5 accent-retro-cyan"},null,8,Ld),[[Dr,s(a)]]),r("div",null,[r("span",{class:ve(["text-sm font-mono transition-colors",[d.value==="hard"?"text-retro-red":"text-retro-text",s(a)===d.value?"text-retro-cyan":""]])},_(d.label),3),r("p",{class:ve(["text-xs font-mono mt-0.5",d.value==="hard"?"text-retro-red/70":"text-retro-muted"])},_(d.description),3)])],2)),64))]),s(a)==="hard"?(i(),u("div",Nd," Warning: Hard reset will permanently discard all uncommitted changes in your working directory and staging area. This action cannot be undone. ")):H("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Hd={class:"space-y-3"},Od={class:"flex items-start gap-2 cursor-pointer"},Ud={class:"flex items-start gap-2 cursor-pointer"},jd={key:0,class:"mt-4 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},zd=Ce({__name:"ResetWorkingDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,o=S("mixed"),l=j(()=>o.value==="hard");function c(){a("confirm",{mode:o.value})}return Me(()=>t.visible,f=>{f&&(o.value="mixed")}),(f,m)=>(i(),ce(kt,{title:"Reset Working Directory",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Reset","confirm-danger":s(l),onClose:m[2]||(m[2]=d=>a("close")),onConfirm:c},{default:We(()=>[m[5]||(m[5]=r("p",{class:"text-retro-text text-sm font-mono mb-4"}," Reset the working directory to HEAD. ",-1)),r("div",Hd,[r("label",Od,[Te(r("input",{"onUpdate:modelValue":m[0]||(m[0]=d=>Ie(o)?o.value=d:null),type:"radio",value:"mixed",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Dr,s(o)]]),m[3]||(m[3]=r("div",null,[r("span",{class:"text-retro-text text-sm font-mono"},"Mixed"),r("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area, keep working directory ")],-1))]),r("label",Ud,[Te(r("input",{"onUpdate:modelValue":m[1]||(m[1]=d=>Ie(o)?o.value=d:null),type:"radio",value:"hard",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Dr,s(o)]]),m[4]||(m[4]=r("div",null,[r("span",{class:"text-retro-text text-sm font-mono"},"Hard"),r("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area AND working directory (DESTRUCTIVE) ")],-1))])]),s(l)?(i(),u("div",jd," WARNING: Hard reset will permanently discard all uncommitted changes. This cannot be undone. ")):H("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Vd={class:"space-y-4"},Wd={class:"flex items-center gap-2 cursor-pointer"},Gd=Ce({__name:"StashDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,o=S(""),l=S(!1);function c(){a("confirm",{message:o.value.trim()||void 0,includeUntracked:l.value})}return Me(()=>t.visible,f=>{f&&(o.value="",l.value=!1)}),(f,m)=>(i(),ce(kt,{title:"Stash Changes",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Stash",onClose:m[2]||(m[2]=d=>a("close")),onConfirm:c},{default:We(()=>[m[5]||(m[5]=r("p",{class:"text-retro-text text-sm font-mono mb-4"}," Save uncommitted changes to the stash. ",-1)),r("div",Vd,[r("div",null,[m[3]||(m[3]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message (optional)",-1)),Te(r("input",{"onUpdate:modelValue":m[0]||(m[0]=d=>Ie(o)?o.value=d: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),[[ft,s(o)]])]),r("label",Wd,[Te(r("input",{"onUpdate:modelValue":m[1]||(m[1]=d=>Ie(l)?l.value=d:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,s(l)]]),m[4]||(m[4]=r("span",{class:"text-retro-muted text-sm"},"Include untracked files",-1))])])]),_:1},8,["visible","loading","error"]))}}),qd={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Zd={class:"text-sm font-mono text-retro-cyan"},Kd={class:"mb-4"},Yd={class:"mb-3"},Xd={class:"flex items-start gap-2 cursor-pointer group"},Qd={key:0,class:"mb-4"},Jd={class:"space-y-2"},ef={class:"flex items-start gap-2 cursor-pointer group"},tf=["disabled"],nf={key:0,class:"ml-6"},rf=["value"],of=Ce({__name:"TagCreateDialog",props:{visible:{type:Boolean},commitHash:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=S(""),o=S(!1),l=S(""),c=S(!1),f=S(""),m=j(()=>a.value.trim().length>0);function d(){if(!m.value)return;const C={name:a.value.trim(),annotated:o.value};o.value&&l.value.trim()&&(C.message=l.value.trim()),c.value&&f.value&&(C.pushToRemote=f.value),t("confirm",C)}function b(){a.value="",o.value=!1,l.value="",c.value=!1,f.value="",t("close")}return Me(()=>o.value,C=>{C||(l.value="")}),(C,g)=>(i(),ce(kt,{title:"Create Tag",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Create Tag",onClose:b,onConfirm:d},{default:We(()=>[r("div",qd,[g[5]||(g[5]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"At commit",-1)),r("div",Zd,_(e.commitHash.slice(0,7)),1)]),r("div",Kd,[g[6]||(g[6]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag name",-1)),Te(r("input",{"onUpdate:modelValue":g[0]||(g[0]=v=>Ie(a)?a.value=v: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),[[ft,s(a)]])]),r("div",Yd,[r("label",Xd,[Te(r("input",{"onUpdate:modelValue":g[1]||(g[1]=v=>Ie(o)?o.value=v:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Dt,s(o)]]),g[7]||(g[7]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Annotated tag "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Create a full tag object with message and tagger info ")],-1))])]),s(o)?(i(),u("div",Qd,[g[8]||(g[8]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag message",-1)),Te(r("textarea",{"onUpdate:modelValue":g[2]||(g[2]=v=>Ie(l)?l.value=v: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),[[ft,s(l)]])])):H("",!0),r("div",Jd,[r("label",ef,[Te(r("input",{"onUpdate:modelValue":g[3]||(g[3]=v=>Ie(c)?c.value=v:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan",disabled:e.remotes.length===0},null,8,tf),[[Dt,s(c)]]),r("div",null,[r("span",{class:ve(["text-sm font-mono transition-colors",e.remotes.length===0?"text-retro-muted":"text-retro-text group-hover:text-retro-cyan"])}," Push to remote ",2)])]),s(c)&&e.remotes.length>0?(i(),u("div",nf,[Te(r("select",{"onUpdate:modelValue":g[4]||(g[4]=v=>Ie(f)?f.value=v:null),class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[g[9]||(g[9]=r("option",{value:"",disabled:"",class:"text-retro-muted"},"Select remote",-1)),(i(!0),u(he,null,Be(e.remotes,v=>(i(),u("option",{key:v,value:v},_(v),9,rf))),128))],512),[[_n,s(f)]])])):H("",!0)])]),_:1},8,["visible","loading","error"]))}}),sf={class:"text-retro-text text-sm font-mono mb-2"},af={class:"text-retro-cyan"},lf={class:"space-y-3 mt-4"},cf={class:"flex items-center gap-2 cursor-pointer"},uf={key:0,class:"ml-6"},df=["value"],ff=Ce({__name:"TagDeleteDialog",props:{visible:{type:Boolean},tagName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,o=S(!1),l=S("origin");function c(){a("confirm",{deleteFromRemote:o.value,remote:o.value?l.value:void 0})}return Me(()=>t.visible,f=>{f&&(o.value=!1,l.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin")}),(f,m)=>(i(),ce(kt,{title:"Delete Tag",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Delete","confirm-danger":!0,onClose:m[2]||(m[2]=d=>a("close")),onConfirm:c},{default:We(()=>[m[7]||(m[7]=r("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),r("p",sf,[m[3]||(m[3]=we(" Delete tag ",-1)),r("span",af,_(e.tagName),1),m[4]||(m[4]=we("? ",-1))]),r("div",lf,[r("label",cf,[Te(r("input",{"onUpdate:modelValue":m[0]||(m[0]=d=>Ie(o)?o.value=d:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,s(o)]]),m[5]||(m[5]=r("span",{class:"text-retro-muted text-sm"},"Also delete from remote",-1))]),s(o)?(i(),u("div",uf,[m[6]||(m[6]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Remote",-1)),Te(r("select",{"onUpdate:modelValue":m[1]||(m[1]=d=>Ie(l)?l.value=d:null),class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[(i(!0),u(he,null,Be(e.remotes,d=>(i(),u("option",{key:d,value:d},_(d),9,df))),128))],512),[[_n,s(l)]])])):H("",!0)])]),_:1},8,["visible","loading","error"]))}}),mf={class:"mb-4"},hf={class:"text-retro-cyan text-sm font-mono"},pf={class:"mb-4"},vf={class:"text-retro-text text-sm font-mono"},gf={class:"mb-4"},xf={class:"text-retro-text text-sm font-mono break-all select-all"},bf={class:"mb-4"},yf={class:"text-retro-text text-sm font-mono"},wf={class:"text-retro-muted"},kf={class:"mb-4"},Cf={class:"text-retro-text text-sm font-mono"},$f={key:1,class:"mb-2"},Sf={class:"p-2 text-sm font-mono text-retro-text bg-retro-panel border border-retro-border rounded whitespace-pre-wrap"},_f={key:1,class:"text-retro-muted text-sm font-mono text-center py-4"},Mf=Ce({__name:"TagDetailDialog",props:{visible:{type:Boolean},tagName:{},tagDetail:{},loading:{type:Boolean,default:!1}},emits:["close"],setup(e,{emit:n}){const t=n;return(a,o)=>(i(),ce(kt,{title:"Tag Details",visible:e.visible,loading:e.loading,"confirm-label":"Close","cancel-label":"Close",onClose:o[0]||(o[0]=l=>t("close")),onConfirm:o[1]||(o[1]=l=>t("close"))},{default:We(()=>[r("div",mf,[o[2]||(o[2]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tag",-1)),r("p",hf,_(e.tagName),1)]),e.tagDetail?(i(),u(he,{key:0},[r("div",pf,[o[3]||(o[3]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Type",-1)),r("p",vf,_(e.tagDetail.isAnnotated?"Annotated":"Lightweight"),1)]),r("div",gf,[o[4]||(o[4]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Hash",-1)),r("p",xf,_(e.tagDetail.hash),1)]),e.tagDetail.tagger?(i(),u(he,{key:0},[r("div",bf,[o[5]||(o[5]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tagger",-1)),r("p",yf,[we(_(e.tagDetail.tagger.name)+" ",1),r("span",wf,"<"+_(e.tagDetail.tagger.email)+">",1)])]),r("div",kf,[o[6]||(o[6]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Date",-1)),r("p",Cf,_(e.tagDetail.tagger.date),1)])],64)):H("",!0),e.tagDetail.message?(i(),u("div",$f,[o[7]||(o[7]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message",-1)),r("div",Sf,_(e.tagDetail.message),1)])):H("",!0)],64)):e.loading?(i(),u("div",_f," Loading tag details... ")):H("",!0)]),_:1},8,["visible","loading"]))}}),mo=globalThis.setInterval,Tf={class:"h-full flex flex-col bg-retro-dark",role:"region","aria-label":"Git Graph"},Af={key:0,class:"flex-1 flex flex-col items-center justify-center gap-3"},Bf={key:1,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Ef={key:2,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Rf={class:"text-retro-red text-sm mb-4"},Pf={key:3,class:"flex-1 flex items-center justify-center p-4"},Df={class:"flex-shrink-0 flex items-center gap-2 p-2 border-b border-retro-border"},If={class:"relative"},Lf={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]"},Nf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Ff=["checked"],Hf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Of=["checked"],Uf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},jf=["checked"],zf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Vf=["checked"],Wf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Gf=["checked"],qf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Zf=["checked"],Kf={class:"relative"},Yf=["aria-expanded"],Xf={key:0,class:"text-xs"},Qf={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"},Jf=["checked","onChange"],em={class:"text-sm text-retro-text truncate"},tm={key:0,class:"text-[10px] text-retro-cyan"},nm={class:"px-3 py-1 text-[10px] text-retro-orange font-semibold uppercase tracking-wider mt-1"},rm=["checked","onChange"],om={class:"text-sm text-retro-text truncate"},sm={class:"relative"},am={key:0,class:"absolute right-0 top-full mt-1 z-20"},im=["title"],lm={class:"text-retro-muted text-sm"},cm={class:"text-retro-cyan font-mono"},um={class:"space-y-3"},dm={class:"text-retro-muted text-sm"},fm={class:"text-retro-cyan font-mono"},mm={class:"space-y-3"},hm={class:"text-retro-muted text-sm"},pm={class:"text-retro-magenta font-mono"},vm={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"},gm={class:"flex-1"},xm=Ce({__name:"GitGraph",props:{workingDirectory:{},isActive:{type:Boolean,default:!0}},setup(e){const n=e,t=Qn(),a=ht(),o=Iu(),l=j(()=>{const y=a.activeConversation?.worktreeBranch;return y?[y]:[]}),c=j(()=>{const y=[],k=t.selectedFeatureId;k&&y.push(k);const _e=t.conversationBranch;return _e&&!y.includes(_e)&&y.push(_e),y});Me(()=>a.activeConversation?.worktreeBranch,y=>{t.setConversationBranch(y??null)},{immediate:!0});const f=j(()=>{const y=t.previewBranch;return y?[y]:[]});Me(()=>a.previewingConversation?.worktreeBranch,y=>{t.setPreviewBranch(y??null)},{immediate:!0});const m=j(()=>{const y={};return t.previewBranch&&t.previewMergeBase&&(y[t.previewBranch]=t.previewMergeBase),y}),d=j(()=>{const y={};return t.selectedFeatureId&&t.featureMergeBase&&(y[t.selectedFeatureId]=t.featureMergeBase),t.conversationBranch&&t.conversationMergeBase&&(y[t.conversationBranch]=t.conversationMergeBase),y}),b=j(()=>t.remotes.map(y=>y.name)),C=S(null);Me(()=>n.workingDirectory,async y=>{if(y){await t.loadGitGraph(y);const k=a.previewingConversation?.worktreeBranch;k&&await t.setPreviewBranch(k);const _e=a.activeConversation?.worktreeBranch;_e&&await t.setConversationBranch(_e)}},{immediate:!0}),Me(()=>n.isActive,y=>{y&&t.commits.length>0&&!t.error?o.startPolling(n.workingDirectory):o.stopPolling()},{immediate:!0}),Me(()=>t.commits.length,y=>{y>0&&n.isActive&&!t.error&&o.startPolling(n.workingDirectory)}),Me(()=>C.value,y=>{y&&o.setScrollCallbacks({getScrollPosition:()=>y.getScrollPosition(),setScrollPosition:k=>y.setScrollPosition(k)})}),bt(()=>{o.cleanup(),t.reset()});const g=j(()=>t.error?.includes("Not a Git repository")),v=S(Date.now());let h=null;const R=()=>{h||(h=mo(()=>{v.value=Date.now()},5e3))},G=()=>{h&&(clearInterval(h),h=null)};st(()=>{Me(()=>n.isActive,y=>{y?(v.value=Date.now(),R()):G()},{immediate:!0})}),bt(()=>{G()});const I=j(()=>{const y=t.lastRefreshTime;if(!y)return null;const k=Math.floor((v.value-y)/1e3);return t.isRefreshing?"Syncing...":k<5?"Just now":k<60?`${k}s ago`:`${Math.floor(k/60)}m ago`}),ee=S(!1),te=S(!1),V=S(null);function re(){ee.value=!0,gn(()=>V.value?.focus())}function ue(){ee.value=!1,t.setSearchQuery("")}function se(y){t.setSearchQuery(y)}const ne=Lu({onFind:()=>re(),onRefresh:async()=>{n.workingDirectory&&await t.loadGitGraph(n.workingDirectory)},onScrollToHead:()=>{const y=t.commits.find(k=>k.isHead);y&&t.selectCommit(y)},onEscape:()=>{K.value?K.value=!1:te.value?te.value=!1:W.value?W.value=!1:ee.value?ue():t.isComparing?t.clearComparison():(t.selectedCommit||t.isUncommittedChangesSelected)&&t.clearSelection()}});st(()=>{ne.start()}),bt(()=>{ne.stop()});const K=S(!1),W=S(!1);async function U(){await t.fetchAll(!0)}async function F(y){await t.addRemote(y.name,y.url)}async function B(y){await t.editRemote(y.name,y.newUrl)}async function X(y){await t.deleteRemote(y)}const M=j(()=>{const y=[],k={};for(const _e of t.branches)if(t.localBranchNames.has(_e.name))y.push(_e);else{const ot=_e.name.indexOf("/");if(ot>0){const Tt=_e.name.substring(0,ot);k[Tt]||(k[Tt]=[]),k[Tt].push(_e)}else y.push(_e)}return{local:y,remotes:k}}),p=S({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function E(y){p.value={visible:!0,...y},t.setActiveContextMenu({type:"branch",props:y,position:{x:y.x,y:y.y}})}function Q(){p.value.visible=!1,t.clearActiveContextMenu()}function le(){Q(),Xe.value={visible:!0,branchName:p.value.branch,loading:!1,error:null}}function fe(){const y=p.value.branch;Q(),De.value={visible:!0,branchName:y,newName:y,loading:!1,error:null}}function Z(){const{branch:y,isLocal:k}=p.value;Q(),Ge.value={visible:!0,branchName:y,isLocal:k,force:!1,loading:!1,error:null}}function P(){const y=p.value.branch;Q(),Ve.value={visible:!0,branchName:y,loading:!1,error:null}}function $(){const y=p.value.branch;Q(),Ne.value={visible:!0,branchName:y,loading:!1,error:null}}function L(){const y=p.value.branch;Q(),Qe.value={visible:!0,branchName:y,loading:!1,error:null}}function x(){const y=p.value.branch;Q(),Ze.value={visible:!0,branchName:y,loading:!1,error:null}}async function N(){const y=p.value.branch;Q(),await t.fetchBranch(y)}async function q(){const y=p.value.branch;Q(),await t.copyToClipboard(y),z(p.value.x,p.value.y)}function ie(){Q(),Ae.value={visible:!0,fromCommit:p.value.commitHash,loading:!1,error:null}}const ae=S({visible:!1,commit:null,x:0,y:0});function xe(y){ae.value={visible:!0,commit:y.commit,x:y.x,y:y.y},t.setActiveContextMenu({type:"commit",props:y,position:{x:y.x,y:y.y}})}function Re(){ae.value.visible=!1,t.clearActiveContextMenu()}function Se(y){const k=ae.value.commit;if(!k)return!1;Re();const _e=y(k);return _e&&typeof _e.then=="function"?_e.then(()=>!0):!0}function nt(){Se(y=>{Je.value={visible:!0,commitHash:y.hash,loading:!1,error:null}})}function ze(){Se(y=>{Ae.value={visible:!0,fromCommit:y.hash,loading:!1,error:null}})}function at(){Se(y=>{Xe.value={visible:!0,branchName:y.hash,loading:!1,error:null}})}function ct(){Se(y=>{Fe.value={visible:!0,commitHash:y.hash,commitMessage:y.message,loading:!1,error:null}})}async function vt(){await Se(y=>t.revertCommit(y.hash))}function It(){Se(y=>{Ve.value={visible:!0,branchName:y.shortHash,loading:!1,error:null}})}function jt(){Se(y=>{Ke.value={visible:!0,commitHash:y.hash,commitMessage:y.message,loading:!1,error:null}})}async function zt(){const{x:y,y:k}=ae.value;await Se(ot=>t.copyToClipboard(ot.hash))&&z(y,k)}async function Bt(){await Se(y=>t.copyCommitSubject(y))}const Ye=S({visible:!1,tag:"",x:0,y:0,commitHash:""});function Ht(y){Ye.value={visible:!0,...y},t.setActiveContextMenu({type:"tag",props:y,position:{x:y.x,y:y.y}})}function Et(){Ye.value.visible=!1,t.clearActiveContextMenu()}async function Rt(){const y=Ye.value.tag;Et(),oe.value={visible:!0,tagName:y,loading:!0,tagDetail:null};const k=await t.getTagDetail(y);oe.value.loading=!1,k.success&&k.data&&(oe.value.tagDetail=k.data)}function Ct(){const y=Ye.value.tag;Et(),pe.value={visible:!0,tagName:y,loading:!1,error:null}}async function ut(){const y=Ye.value.tag;Et(),await t.pushTag(y)}async function Jt(){const y=Ye.value.tag;Et(),await t.copyToClipboard(y),z(Ye.value.x,Ye.value.y)}const it=S({visible:!1,x:0,y:0});function $t(){it.value.visible=!1,t.clearActiveContextMenu()}function en(){$t(),me.value={visible:!0,loading:!1,error:null}}function un(){$t(),je.value={visible:!0,loading:!1,error:null}}async function Pt(){$t(),w.value={visible:!0,loading:!1,error:null}}const rt=S({visible:!1,stash:null,x:0,y:0});function mt(y){rt.value={visible:!0,stash:y.stash,x:y.x,y:y.y},t.setActiveContextMenu({type:"stash",props:y,position:{x:y.x,y:y.y}})}function St(){rt.value.visible=!1,t.clearActiveContextMenu()}function _t(y){const k=rt.value.stash;if(!k)return!1;St();const _e=y(k);return _e&&typeof _e.then=="function"?_e.then(()=>!0):!0}async function tn(){await _t(y=>t.applyStash(y.index))}async function bn(){await _t(y=>t.popStash(y.index))}async function Vt(){await _t(y=>t.dropStash(y.index))}function Wt(){_t(y=>{Pe.value={visible:!0,stashIndex:y.index,loading:!1,error:null}})}async function yn(){const{x:y,y:k}=rt.value;await _t(ot=>t.copyToClipboard(`stash@{${ot.index}}`))&&z(y,k)}async function Ot(){const{x:y,y:k}=rt.value;await _t(ot=>t.copyToClipboard(ot.hash))&&z(y,k)}const Xe=S({visible:!1,branchName:"",loading:!1,error:null});async function wn(){Xe.value.loading=!0,Xe.value.error=null;const y=await t.checkoutBranch(Xe.value.branchName);Xe.value.loading=!1,y.success?Xe.value.visible=!1:Xe.value.error=y.error||"Unknown error"}const Ae=S({visible:!1,fromCommit:"",loading:!1,error:null});async function Lt(y){Ae.value.loading=!0,Ae.value.error=null;const k=await t.createBranch(y.name,Ae.value.fromCommit);Ae.value.loading=!1,k.success?(y.checkout&&await t.checkoutBranch(y.name),Ae.value.visible=!1):Ae.value.error=k.error||"Unknown error"}const Ge=S({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function qe(y){Ge.value.loading=!0,Ge.value.error=null;const{branchName:k,isLocal:_e}=Ge.value,ot=y?.force??Ge.value.force,Tt=_e?await t.deleteLocalBranch(k,ot):await t.deleteRemoteBranch(k);Ge.value.loading=!1,Tt.success?Ge.value.visible=!1:Ge.value.error=Tt.error||"Unknown error"}const De=S({visible:!1,branchName:"",newName:"",loading:!1,error:null});async function Gt(){if(!De.value.newName.trim()){De.value.error="Branch name is required";return}De.value.loading=!0,De.value.error=null;const y=await t.renameBranch(De.value.branchName,De.value.newName.trim());De.value.loading=!1,y.success?De.value.visible=!1:De.value.error=y.error||"Unknown error"}const Ve=S({visible:!1,branchName:"",loading:!1,error:null});async function nn(y){Ve.value.loading=!0,Ve.value.error=null;const k=await t.mergeBranch(Ve.value.branchName,y);Ve.value.loading=!1,k.success?Ve.value.visible=!1:Ve.value.error=k.error||"Unknown error"}const Ne=S({visible:!1,branchName:"",loading:!1,error:null});async function Mt(){Ne.value.loading=!0,Ne.value.error=null;const y=await t.rebaseBranch(Ne.value.branchName);Ne.value.loading=!1,y.success?Ne.value.visible=!1:Ne.value.error=y.error||"Unknown error"}const Qe=S({visible:!1,branchName:"",loading:!1,error:null});async function dn(y){Qe.value.loading=!0,Qe.value.error=null;const k=await t.pushBranch(Qe.value.branchName,y.remote,y.force,y.forceWithLease);Qe.value.loading=!1,k.success?Qe.value.visible=!1:Qe.value.error=k.error||"Unknown error"}const Ze=S({visible:!1,branchName:"",loading:!1,error:null});async function qt(y){Ze.value.loading=!0,Ze.value.error=null;const k=await t.pullBranch(Ze.value.branchName,y.remote,y.noFastForward,y.squash);Ze.value.loading=!1,k.success?Ze.value.visible=!1:Ze.value.error=k.error||"Unknown error"}const Fe=S({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function fn(y){Fe.value.loading=!0,Fe.value.error=null;const k=await t.cherryPickCommit(Fe.value.commitHash,y.recordOrigin,y.noCommit);Fe.value.loading=!1,k.success?Fe.value.visible=!1:Fe.value.error=k.error||"Unknown error"}const Ke=S({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function rn(y){Ke.value.loading=!0,Ke.value.error=null;const k=await t.resetToCommit(Ke.value.commitHash,y.mode);Ke.value.loading=!1,k.success?Ke.value.visible=!1:Ke.value.error=k.error||"Unknown error"}const Je=S({visible:!1,commitHash:"",loading:!1,error:null});async function mn(y){Je.value.loading=!0,Je.value.error=null;const k=await t.createTag(y.name,Je.value.commitHash,y.annotated,y.message,y.pushToRemote);Je.value.loading=!1,k.success?Je.value.visible=!1:Je.value.error=k.error||"Unknown error"}const pe=S({visible:!1,tagName:"",loading:!1,error:null});async function A(y){pe.value.loading=!0,pe.value.error=null;const k=await t.deleteTag(pe.value.tagName,y.deleteFromRemote?y.remote||"origin":void 0);pe.value.loading=!1,k.success?pe.value.visible=!1:pe.value.error=k.error||"Unknown error"}const oe=S({visible:!1,tagName:"",loading:!1,tagDetail:null}),me=S({visible:!1,loading:!1,error:null});async function He(y){me.value.loading=!0,me.value.error=null;const k=await t.stashChanges(y.message,y.includeUntracked);me.value.loading=!1,k.success?me.value.visible=!1:me.value.error=k.error||"Unknown error"}const Pe=S({visible:!1,stashIndex:0,loading:!1,error:null}),Le=S("");async function et(y){Pe.value.loading=!0,Pe.value.error=null;const k=await t.stashBranch(Pe.value.stashIndex,y);Pe.value.loading=!1,k.success?Pe.value.visible=!1:Pe.value.error=k.error||"Unknown error"}const je=S({visible:!1,loading:!1,error:null});async function Nt(y){je.value.loading=!0,je.value.error=null;const k=await t.resetWorking(y.mode);je.value.loading=!1,k.success?je.value.visible=!1:je.value.error=k.error||"Unknown error"}const w=S({visible:!1,loading:!1,error:null});async function D(){w.value.loading=!0,w.value.error=null;const y=await t.cleanUntracked();w.value.loading=!1,y.success?w.value.visible=!1:w.value.error=y.error||"Unknown error"}const T=S({visible:!1,x:0,y:0});function z(y,k){T.value={visible:!0,x:y,y:k},setTimeout(()=>{T.value.visible=!1},1500)}const de=j(()=>Xe.value.visible||Ae.value.visible||Ge.value.visible||De.value.visible||Ve.value.visible||Ne.value.visible||Qe.value.visible||Ze.value.visible||Fe.value.visible||Ke.value.visible||Je.value.visible||pe.value.visible||oe.value.visible||me.value.visible||Pe.value.visible||je.value.visible||w.value.visible);Me(de,y=>{y?t.setActiveDialog({type:"generic",props:{}}):t.clearActiveDialog()});function ge(y){t.selectedCommit?t.selectComparisonCommit(y):t.selectCommit(y)}function ke(y){t.navigateToCommit(y)}return(y,k)=>{const _e=ga,ot=Ra,Tt=oi,kn=$i,wr=Vc,kr=mu,Cr=bu,Jn=yu,Ln=wu,$r=ku,Sr=Cu,Nn=kt;return i(),u("div",Tf,[s(t).loading&&s(t).commits.length===0?(i(),u("div",Af,[...k[42]||(k[42]=[r("div",{class:"w-6 h-6 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),r("div",{class:"text-retro-muted text-sm"},"Loading git history...",-1)])])):s(g)?(i(),u("div",Bf,[Y(s(Cn),{class:"w-12 h-12 text-retro-yellow mb-4"}),k[43]||(k[43]=r("h3",{class:"text-retro-text font-semibold mb-2"},"Not a Git Repository",-1)),k[44]||(k[44]=r("p",{class:"text-retro-muted text-sm max-w-xs"},[we(" This directory is not initialized as a Git repository. Run "),r("code",{class:"text-retro-cyan"},"git init"),we(" to get started. ")],-1))])):s(t).error?(i(),u("div",Ef,[Y(s(Cn),{class:"w-10 h-10 text-retro-red mb-3"}),r("p",Rf,_(s(t).error),1),r("button",{class:"flex items-center gap-2 px-3 py-1.5 text-sm text-retro-text border border-retro-border rounded hover:border-retro-cyan hover:text-retro-cyan transition-colors",onClick:k[0]||(k[0]=$e=>s(t).loadGitGraph(n.workingDirectory))},[Y(s(xn),{class:"w-4 h-4"}),k[45]||(k[45]=we(" Retry ",-1))])])):s(t).commits.length===0?(i(),u("div",Pf,[...k[46]||(k[46]=[r("div",{class:"text-retro-muted text-center"},[r("p",null,"No commits found in this repository.")],-1)])])):(i(),u(he,{key:4},[s(ee)?(i(),ce(_e,{key:0,ref_key:"findWidgetRef",ref:V,resultCount:s(t).searchResultHashes.length,currentIndex:s(t).searchResultIndex,onSearch:se,onNext:s(t).nextSearchResult,onPrev:s(t).prevSearchResult,onClose:ue},null,8,["resultCount","currentIndex","onNext","onPrev"])):H("",!0),r("div",Df,[r("button",{class:ve(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",s(ee)?"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 (Ctrl+F)",title:"Find (Ctrl+F)",onClick:k[1]||(k[1]=$e=>s(ee)?ue():re())},[Y(s(Zn),{class:"w-4 h-4"})],2),r("div",If,[r("button",{class:ve(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",s(K)?"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]=$e=>K.value=!s(K))},[Y(s(Os),{class:"w-4 h-4"})],2),s(K)?(i(),u("div",Lf,[k[53]||(k[53]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mb-1"}," Graph Style ",-1)),r("label",Nf,[r("input",{type:"radio",name:"graphStyle",value:"rounded",checked:s(t).graphStyle==="rounded",class:"accent-retro-cyan",onChange:k[3]||(k[3]=$e=>s(t).setGraphStyle("rounded"))},null,40,Ff),k[47]||(k[47]=r("span",{class:"text-sm text-retro-text"},"Rounded",-1))]),r("label",Hf,[r("input",{type:"radio",name:"graphStyle",value:"angular",checked:s(t).graphStyle==="angular",class:"accent-retro-cyan",onChange:k[4]||(k[4]=$e=>s(t).setGraphStyle("angular"))},null,40,Of),k[48]||(k[48]=r("span",{class:"text-sm text-retro-text"},"Angular",-1))]),k[54]||(k[54]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Display ",-1)),r("label",Uf,[r("input",{type:"checkbox",checked:s(t).muteNonAncestral,class:"accent-retro-cyan",onChange:k[5]||(k[5]=$e=>s(t).toggleMuteNonAncestral())},null,40,jf),k[49]||(k[49]=r("span",{class:"text-sm text-retro-text"},"Mute non-ancestral",-1))]),k[55]||(k[55]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Columns ",-1)),r("label",zf,[r("input",{type:"checkbox",checked:s(t).columnVisibility.commit!==!1,class:"accent-retro-cyan",onChange:k[6]||(k[6]=$e=>s(t).toggleColumnVisibility("commit"))},null,40,Vf),k[50]||(k[50]=r("span",{class:"text-sm text-retro-text"},"Hash",-1))]),r("label",Wf,[r("input",{type:"checkbox",checked:s(t).columnVisibility.author!==!1,class:"accent-retro-cyan",onChange:k[7]||(k[7]=$e=>s(t).toggleColumnVisibility("author"))},null,40,Gf),k[51]||(k[51]=r("span",{class:"text-sm text-retro-text"},"Author",-1))]),r("label",qf,[r("input",{type:"checkbox",checked:s(t).columnVisibility.date!==!1,class:"accent-retro-cyan",onChange:k[8]||(k[8]=$e=>s(t).toggleColumnVisibility("date"))},null,40,Zf),k[52]||(k[52]=r("span",{class:"text-sm text-retro-text"},"Date",-1))])])):H("",!0)]),k[58]||(k[58]=r("span",{class:"flex-1"},null,-1)),r("div",Kf,[r("button",{class:ve(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",s(te)||s(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":s(te),onClick:k[9]||(k[9]=$e=>te.value=!s(te))},[Y(s(ra),{class:"w-4 h-4"}),s(t).filteredBranches.length>0?(i(),u("span",Xf," ("+_(s(t).filteredBranches.length)+") ",1)):H("",!0)],10,Yf),s(te)?(i(),u("div",Qf,[k[57]||(k[57]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border"}," Filter by Branch ",-1)),s(t).filteredBranches.length>0?(i(),u("button",{key:0,class:"w-full text-left px-3 py-1.5 text-sm text-retro-cyan hover:bg-retro-cyan/10",onClick:k[10]||(k[10]=$e=>s(t).clearFilters())}," Clear All Filters ")):H("",!0),s(M).local.length>0?(i(),u(he,{key:1},[k[56]||(k[56]=r("div",{class:"px-3 py-1 text-[10px] text-retro-green font-semibold uppercase tracking-wider mt-1"}," Local ",-1)),(i(!0),u(he,null,Be(s(M).local,$e=>(i(),u("label",{key:$e.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[r("input",{type:"checkbox",checked:s(t).filteredBranches.includes($e.name),class:"accent-retro-cyan",onChange:Fn=>s(t).toggleBranchFilter($e.name)},null,40,Jf),r("span",em,_($e.name),1),$e.isHead?(i(),u("span",tm,"(HEAD)")):H("",!0)]))),128))],64)):H("",!0),(i(!0),u(he,null,Be(s(M).remotes,($e,Fn)=>(i(),u(he,{key:Fn},[r("div",nm,_(Fn),1),(i(!0),u(he,null,Be($e,Tn=>(i(),u("label",{key:Tn.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[r("input",{type:"checkbox",checked:s(t).filteredBranches.includes(Tn.name),class:"accent-retro-cyan",onChange:po=>s(t).toggleBranchFilter(Tn.name)},null,40,rm),r("span",om,_(Tn.name),1)]))),128))],64))),128))])):H("",!0)]),r("button",{class:ve(["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":s(t).isRefreshing}]),"aria-label":"Refresh (Ctrl+R)",title:"Refresh (Ctrl+R)",onClick:k[11]||(k[11]=$e=>s(t).loadGitGraph(n.workingDirectory))},[Y(s(xn),{class:"w-4 h-4"})],2),r("button",{class:"flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors","aria-label":"Fetch all remotes",title:"Fetch All",onClick:U},[Y(s(Qo),{class:"w-4 h-4"})]),r("div",sm,[r("button",{class:ve(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",s(W)?"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]=$e=>W.value=!s(W))},[Y(s(Jo),{class:"w-4 h-4"})],2),s(W)?(i(),u("div",am,[Y(ot,{remotes:s(t).remotes,onAdd:F,onEdit:B,onDelete:X,onClose:k[13]||(k[13]=$e=>W.value=!1)},null,8,["remotes"])])):H("",!0)]),s(I)&&n.isActive?(i(),u("div",{key:0,class:ve(["flex items-center text-[10px] text-retro-muted",{"text-retro-cyan":s(t).isRefreshing}]),title:s(t).lastRefreshTime?`Last checked: ${new Date(s(t).lastRefreshTime).toLocaleTimeString()}`:"","aria-live":"polite","aria-atomic":"true"},[r("span",{class:ve(["inline-block w-1.5 h-1.5 rounded-full mr-1",s(t).isRefreshing?"bg-retro-cyan animate-pulse":"bg-retro-muted/50"]),"aria-hidden":"true"},null,2),we(" "+_(s(I)),1)],10,im)):H("",!0)]),r("div",{class:ve(["flex-1 min-h-0 overflow-hidden",{"max-h-[50%]":s(t).selectedCommit||s(t).isUncommittedChangesSelected}])},[Y(Tt,{ref_key:"commitListRef",ref:C,commits:s(t).filteredCommits,stashes:s(t).stashes,selectedCommit:s(t).selectedCommit,hasMore:s(t).hasMore,loading:s(t).loading,loadingMore:s(t).loadingMore,searchQuery:s(t).searchQuery,uncommittedChangesCount:s(t).uncommittedChangesCount,isUncommittedChangesSelected:s(t).isUncommittedChangesSelected,highlightBranches:s(l),featureHighlightBranches:s(c),featureMergeBases:s(d),previewHighlightBranches:s(f),previewMergeBases:s(m),currentBranchName:s(t).currentBranch?.name,localBranchNames:s(t).localBranchNames,graphStyle:s(t).graphStyle,muteNonAncestral:s(t).muteNonAncestral,columnVisibility:s(t).columnVisibility,onSelect:s(t).selectCommit,onLoadMore:s(t).loadMoreCommits,onBranchContextMenu:E,onCommitContextMenu:xe,onTagContextMenu:Ht,onStashContextMenu:mt,onCompareSelect:ge,onSelectUncommittedChanges:s(t).selectUncommittedChanges,onScrollStart:s(o).startInteraction,onScrollEnd:s(o).endInteraction},null,8,["commits","stashes","selectedCommit","hasMore","loading","loadingMore","searchQuery","uncommittedChangesCount","isUncommittedChangesSelected","highlightBranches","featureHighlightBranches","featureMergeBases","previewHighlightBranches","previewMergeBases","currentBranchName","localBranchNames","graphStyle","muteNonAncestral","columnVisibility","onSelect","onLoadMore","onSelectUncommittedChanges","onScrollStart","onScrollEnd"])],2),s(t).isComparing&&s(t).selectedCommit&&s(t).comparisonCommit?(i(),ce(kn,{key:1,fromCommit:s(t).comparisonCommit,toCommit:s(t).selectedCommit,files:s(t).comparisonFiles,stats:s(t).comparisonStats,loading:s(t).comparisonLoading,onClose:s(t).clearComparison},null,8,["fromCommit","toCommit","files","stats","loading","onClose"])):s(t).selectedCommit?(i(),ce(wr,{key:2,commit:s(t).selectedCommit,files:s(t).selectedCommitFiles,stats:s(t).selectedCommitStats,loading:s(t).isLoadingDetails,detailPosition:s(t).detailViewPosition,onClose:s(t).clearSelection,onNavigateToCommit:ke,onTogglePosition:s(t).toggleDetailViewPosition,onOpenFileDiff:k[14]||(k[14]=$e=>s(t).selectedCommit&&s(t).openFileDiff(s(t).selectedCommit.hash,$e))},null,8,["commit","files","stats","loading","detailPosition","onClose","onTogglePosition"])):H("",!0),s(t).isUncommittedChangesSelected?(i(),ce(kr,{key:3,stagedFiles:s(t).stagedFiles,unstagedFiles:s(t).unstagedFiles,isStaging:s(t).isStaging,isCommitting:s(t).isCommitting,onClose:s(t).clearSelection,onStageFiles:k[15]||(k[15]=$e=>s(t).stageFiles($e)),onUnstageFiles:k[16]||(k[16]=$e=>s(t).unstageFiles($e)),onStageAll:k[17]||(k[17]=()=>s(t).stageFiles([])),onUnstageAll:k[18]||(k[18]=()=>s(t).unstageFiles([])),onCommit:k[19]||(k[19]=$e=>s(t).commitChanges($e))},null,8,["stagedFiles","unstagedFiles","isStaging","isCommitting","onClose"])):H("",!0)],64)),s(p).visible?(i(),ce(Cr,{key:5,branchName:s(p).branch,isCurrentBranch:s(p).isCurrentBranch,isLocal:s(p).isLocal,x:s(p).x,y:s(p).y,onClose:Q,onCheckout:le,onCreateBranch:ie,onDeleteBranch:Z,onRename:fe,onMerge:P,onRebase:$,onPush:L,onPull:x,onFetch:N,onCopyName:q},null,8,["branchName","isCurrentBranch","isLocal","x","y"])):H("",!0),s(ae).visible&&s(ae).commit?(i(),ce(Jn,{key:6,commit:s(ae).commit,x:s(ae).x,y:s(ae).y,onClose:Re,onAddTag:nt,onCreateBranch:ze,onCheckout:at,onCherryPick:ct,onRevert:vt,onMergeInto:It,onReset:jt,onCopyHash:zt,onCopySubject:Bt},null,8,["commit","x","y"])):H("",!0),s(Ye).visible?(i(),ce(Ln,{key:7,tagName:s(Ye).tag,x:s(Ye).x,y:s(Ye).y,onClose:Et,onViewDetails:Rt,onDeleteTag:Ct,onPushTag:ut,onCopyName:Jt},null,8,["tagName","x","y"])):H("",!0),s(rt).visible&&s(rt).stash?(i(),ce($r,{key:8,stashIndex:s(rt).stash.index,stashMessage:s(rt).stash.message,x:s(rt).x,y:s(rt).y,onClose:St,onApply:tn,onPop:bn,onDrop:Vt,onCreateBranch:Wt,onCopyName:yn,onCopyHash:Ot},null,8,["stashIndex","stashMessage","x","y"])):H("",!0),s(it).visible?(i(),ce(Sr,{key:9,x:s(it).x,y:s(it).y,onClose:$t,onStash:en,onReset:un,onClean:Pt},null,8,["x","y"])):H("",!0),s(Xe).visible?(i(),ce(Nn,{key:10,title:"Checkout",visible:s(Xe).visible,loading:s(Xe).loading,error:s(Xe).error,confirmLabel:"Checkout",onClose:k[20]||(k[20]=$e=>s(Xe).visible=!1),onConfirm:wn},{default:We(()=>[r("p",lm,[k[59]||(k[59]=we(" Are you sure you want to checkout ",-1)),r("span",cm,_(s(Xe).branchName),1),k[60]||(k[60]=we("? ",-1))])]),_:1},8,["visible","loading","error"])):H("",!0),s(De).visible?(i(),ce(Nn,{key:11,title:"Rename Branch",visible:s(De).visible,loading:s(De).loading,error:s(De).error,confirmLabel:"Rename",onClose:k[22]||(k[22]=$e=>s(De).visible=!1),onConfirm:Gt},{default:We(()=>[r("div",um,[r("p",dm,[k[61]||(k[61]=we(" Rename ",-1)),r("span",fm,_(s(De).branchName),1)]),Te(r("input",{"onUpdate:modelValue":k[21]||(k[21]=$e=>s(De).newName=$e),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:ln(Gt,["enter"])},null,544),[[ft,s(De).newName]])])]),_:1},8,["visible","loading","error"])):H("",!0),s(Ve).visible?(i(),ce(id,{key:12,visible:s(Ve).visible,branchName:s(Ve).branchName,loading:s(Ve).loading,error:s(Ve).error,onClose:k[23]||(k[23]=$e=>s(Ve).visible=!1),onConfirm:nn},null,8,["visible","branchName","loading","error"])):H("",!0),s(Ge).visible?(i(),ce(ed,{key:13,visible:s(Ge).visible,branchName:s(Ge).branchName,isLocal:s(Ge).isLocal,loading:s(Ge).loading,error:s(Ge).error,onClose:k[24]||(k[24]=$e=>s(Ge).visible=!1),onConfirm:qe},null,8,["visible","branchName","isLocal","loading","error"])):H("",!0),s(Qe).visible?(i(),ce($d,{key:14,visible:s(Qe).visible,branchName:s(Qe).branchName,remotes:s(b),loading:s(Qe).loading,error:s(Qe).error,onClose:k[25]||(k[25]=$e=>s(Qe).visible=!1),onConfirm:dn},null,8,["visible","branchName","remotes","loading","error"])):H("",!0),s(Ze).visible?(i(),ce(hd,{key:15,visible:s(Ze).visible,branchName:s(Ze).branchName,remotes:s(b),loading:s(Ze).loading,error:s(Ze).error,onClose:k[26]||(k[26]=$e=>s(Ze).visible=!1),onConfirm:qt},null,8,["visible","branchName","remotes","loading","error"])):H("",!0),s(Ne).visible?(i(),ce(Ed,{key:16,visible:s(Ne).visible,branchName:s(t).currentBranch?.name||"HEAD",ontoBranch:s(Ne).branchName,loading:s(Ne).loading,error:s(Ne).error,onClose:k[27]||(k[27]=$e=>s(Ne).visible=!1),onConfirm:Mt},null,8,["visible","branchName","ontoBranch","loading","error"])):H("",!0),s(Fe).visible?(i(),ce(zu,{key:17,visible:s(Fe).visible,commitHash:s(Fe).commitHash,commitMessage:s(Fe).commitMessage,loading:s(Fe).loading,error:s(Fe).error,onClose:k[28]||(k[28]=$e=>s(Fe).visible=!1),onConfirm:fn},null,8,["visible","commitHash","commitMessage","loading","error"])):H("",!0),s(Ke).visible?(i(),ce(Fd,{key:18,visible:s(Ke).visible,commitHash:s(Ke).commitHash,commitMessage:s(Ke).commitMessage,loading:s(Ke).loading,error:s(Ke).error,onClose:k[29]||(k[29]=$e=>s(Ke).visible=!1),onConfirm:rn},null,8,["visible","commitHash","commitMessage","loading","error"])):H("",!0),s(Je).visible?(i(),ce(of,{key:19,visible:s(Je).visible,commitHash:s(Je).commitHash,remotes:s(b),loading:s(Je).loading,error:s(Je).error,onClose:k[30]||(k[30]=$e=>s(Je).visible=!1),onConfirm:mn},null,8,["visible","commitHash","remotes","loading","error"])):H("",!0),s(pe).visible?(i(),ce(ff,{key:20,visible:s(pe).visible,tagName:s(pe).tagName,remotes:s(b),loading:s(pe).loading,error:s(pe).error,onClose:k[31]||(k[31]=$e=>s(pe).visible=!1),onConfirm:A},null,8,["visible","tagName","remotes","loading","error"])):H("",!0),s(oe).visible?(i(),ce(Mf,{key:21,visible:s(oe).visible,tagName:s(oe).tagName,tagDetail:s(oe).tagDetail,loading:s(oe).loading,onClose:k[32]||(k[32]=$e=>s(oe).visible=!1)},null,8,["visible","tagName","tagDetail","loading"])):H("",!0),s(Ae).visible?(i(),ce(Zu,{key:22,visible:s(Ae).visible,fromCommit:s(Ae).fromCommit,loading:s(Ae).loading,error:s(Ae).error,onClose:k[33]||(k[33]=$e=>s(Ae).visible=!1),onConfirm:Lt},null,8,["visible","fromCommit","loading","error"])):H("",!0),s(Pe).visible?(i(),ce(Nn,{key:23,title:"Create Branch from Stash",visible:s(Pe).visible,loading:s(Pe).loading,error:s(Pe).error,confirmLabel:"Create Branch",onClose:k[36]||(k[36]=$e=>s(Pe).visible=!1),onConfirm:k[37]||(k[37]=$e=>et(s(Le)))},{default:We(()=>[r("div",mm,[r("p",hm,[k[62]||(k[62]=we(" Create a new branch from ",-1)),r("span",pm,"stash@"+_("{")+_(s(Pe).stashIndex)+_("}"),1)]),Te(r("input",{"onUpdate:modelValue":k[34]||(k[34]=$e=>Ie(Le)?Le.value=$e: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[35]||(k[35]=ln($e=>et(s(Le)),["enter"]))},null,544),[[ft,s(Le)]])])]),_:1},8,["visible","loading","error"])):H("",!0),s(me).visible?(i(),ce(Gd,{key:24,visible:s(me).visible,loading:s(me).loading,error:s(me).error,onClose:k[38]||(k[38]=$e=>s(me).visible=!1),onConfirm:He},null,8,["visible","loading","error"])):H("",!0),s(je).visible?(i(),ce(zd,{key:25,visible:s(je).visible,loading:s(je).loading,error:s(je).error,onClose:k[39]||(k[39]=$e=>s(je).visible=!1),onConfirm:Nt},null,8,["visible","loading","error"])):H("",!0),s(w).visible?(i(),ce(Ku,{key:26,visible:s(w).visible,loading:s(w).loading,error:s(w).error,onClose:k[40]||(k[40]=$e=>s(w).visible=!1),onConfirm:D},null,8,["visible","loading","error"])):H("",!0),(i(),ce(Qt,{to:"body"},[Y($n,{name:"fade"},{default:We(()=>[s(T).visible?(i(),u("div",{key:0,class:"fixed z-50 px-3 py-1.5 text-sm bg-retro-green text-retro-dark rounded shadow-lg",style:At({left:`${s(T).x}px`,top:`${s(T).y-40}px`})}," Copied! ",4)):H("",!0)]),_:1})])),(i(),ce(Qt,{to:"body"},[Y($n,{name:"fade"},{default:We(()=>[s(t).operationError?(i(),u("div",vm,[Y(s(Cn),{class:"w-4 h-4 flex-shrink-0"}),r("span",gm,_(s(t).operationError),1),r("button",{class:"flex-shrink-0 p-0.5 hover:bg-white/20 rounded transition-colors",onClick:k[41]||(k[41]=$e=>s(t).clearOperationError()),"aria-label":"Dismiss error"},[Y(s(pt),{class:"w-3.5 h-3.5"})])])):H("",!0)]),_:1})]))])}}}),bm=qr(xm,[["__scopeId","data-v-100753e7"]]),ym=As("/app-logo.svg");function wm(e){return/^\/speckit\.(clarify|plan|tasks|implement)(\s|$)/.test(e)}function km(e=Date.now,n=Math.random){return`req-${e()}-${n().toString(36).slice(2,8)}`}function No(e=Date.now){return`session-${e()}`}function Rr(e,n=!1){const t={};return(!n||e?.hasWorktree)&&e?.worktreePath&&(t.cwd=e.worktreePath,t.worktreeBranch=e.worktreeBranch),e?.featureId&&(t.featureId=e.featureId),Object.keys(t).length>0?t:void 0}function ks(e){if(e.file_path)return String(e.file_path);if(e.path)return String(e.path);if(e.command)return String(e.command).slice(0,50);if(e.pattern)return String(e.pattern);for(const n of Object.values(e))if(typeof n=="string"&&n.length<100)return n;return""}function Pr(e,n="Permission"){const t=e||"",a=t.match(/write to (.+?)(?:[\s,?]|$)/i),o=t.match(/read (.+?)(?:[\s,?]|$)/i),l=t.match(/run (.+?)(?:[?,]|$)/i);return a?.[1]?{tool:"Write",description:t,filePath:a[1].trim()}:o?.[1]?{tool:"Read",description:t,filePath:o[1].trim()}:l?.[1]?{tool:"Bash",description:t,command:l[1].trim()}:{tool:n,description:t}}const Cs=hr("autoMode",()=>{const e=S(!1),n=S(null),t=S(!1),a=S(null);let o=null,l=null;const c=new Map,f=j(()=>n.value?.state==="active"),m=j(()=>n.value?.tasks??[]),d=j(()=>m.value.filter(K=>K.state==="queued").length),b=j(()=>m.value.find(K=>K.state==="running")??null),C=j(()=>m.value.filter(K=>K.state==="completed").length),g=j(()=>m.value.filter(K=>K.state==="failed").length),v=j(()=>m.value.length);async function h(){if(typeof window<"u")try{(await $fetch("/api/settings"))?.autoModeEnabled===!0&&(e.value=!0)}catch{}try{const K=await $fetch("/api/auto-mode/status");e.value=K.enabled,n.value=K.session}catch{}ue()}async function R(){t.value=!0,a.value=null;try{const W=Kn().autoModeConcurrency,U=await $fetch("/api/auto-mode/toggle",{method:"POST",body:{enabled:!e.value,concurrency:W}});U.success?(e.value=U.enabled,ne(U.enabled)):a.value=U.error||"Toggle failed"}catch(K){a.value=K instanceof Error?K.message:String(K)}finally{t.value=!1}}function G(K){switch(K.type){case"auto_mode_status":e.value=K.enabled,n.value=K.session,ne(K.enabled);break;case"auto_mode_task_update":if(n.value){const W=n.value.tasks.findIndex(U=>U.featureId===K.task.featureId);W>=0&&(n.value.tasks[W]=K.task)}K.task.state==="running"&&K.task.worktreePath&&K.task.worktreeBranch&&re(K.task);break;case"auto_mode_error":a.value=K.error;break;case"auto_mode_step_start":ee(K.featureId,K.step);break;case"auto_mode_step_complete":te(K.featureId);break;case"auto_mode_message":V(K.featureId,K.sdkMessage);break}}function I(K){return ht().findConversationByFeature(K)}function ee(K,W){if(typeof window>"u")return;const U=ht(),F=I(K);if(!F)return;const B={id:ur(),role:"user",content:`/speckit.${W} ${K}`,timestamp:new Date().toISOString()};U.addMessage(B,F.id);const X={id:ur(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};U.addMessage(X,F.id),c.set(K,X.id),U.startConversationStreaming(F.id),U.saveConversation(F.id,!1)}function te(K){if(typeof window>"u")return;const W=ht(),U=I(K);if(!U)return;const F=c.get(K);F&&(W.updateMessage(F,{status:"complete"},U.id),c.delete(K)),W.endConversationStreaming(U.id),W.saveConversation(U.id,!0)}function V(K,W){if(typeof window>"u")return;const U=ht(),F=I(K);if(!F)return;const B=c.get(K);if(B){if(W.type==="assistant"&&W.message?.content){for(const X of W.message.content)if(X.type==="text"&&X.text)U.appendToMessageWithSave(B,X.text,F.id);else if(X.type==="tool_use"&&X.name){const M=X.input?ks(X.input):"",p=`
|
|
68
|
+
|
|
69
|
+
▶ **${X.name}** ${M}
|
|
70
|
+
`;U.appendToMessageWithSave(B,p,F.id)}}if(W.type==="tool_result"||W.type==="user"){const X=W.message?.content||W.content;if(Array.isArray(X)){for(const M of X)if(M.type==="tool_result"&&M.content){const p=typeof M.content=="string"?M.content:Array.isArray(M.content)?M.content.filter(E=>E.type==="text").map(E=>E.text).join(""):"";if(p){const E=p.slice(0,300),Q=p.length>300?"...":"",le=M.is_error?"✗ Error:":"✓";U.appendToMessageWithSave(B,`${le} ${E}${Q}
|
|
71
|
+
`,F.id)}}}}}}function re(K){if(typeof window>"u")return;const W=ht(),U=W.findConversationByFeature(K.featureId);if(U){const X=W.conversations.find(M=>M.id===U.id);X&&(X.autoMode||(X.autoMode=!0),K.worktreePath&&!X.worktreePath&&(X.worktreePath=K.worktreePath,X.worktreeBranch=K.worktreeBranch,X.baseBranch=K.baseBranch,X.cwd=K.worktreePath,X.hasWorktree=!0),W.saveAllConversations());return}const B={id:Uo(),title:`Auto: ${K.featureId}`,messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:K.worktreePath||"",featureId:K.featureId,autoMode:!0,worktreePath:K.worktreePath,worktreeBranch:K.worktreeBranch,baseBranch:K.baseBranch,hasWorktree:!0};W.addAutoModeConversation(B)}function ue(){if(typeof window>"u"||o&&o.readyState===WebSocket.OPEN)return;l&&(clearTimeout(l),l=null);const W=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/auto-mode-ws`;o=new WebSocket(W),o.onmessage=U=>{try{const F=JSON.parse(U.data);G(F)}catch{}},o.onclose=()=>{o=null,l=setTimeout(()=>ue(),5e3)},o.onerror=()=>{}}function se(){l&&(clearTimeout(l),l=null),o&&(o.close(),o=null)}function ne(K){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{autoModeEnabled:K}}).catch(W=>{console.error("Failed to persist autoModeEnabled:",W)})}return{enabled:e,session:n,loading:t,error:a,isActive:f,tasks:m,queuedCount:d,runningTask:b,completedCount:C,failedCount:g,totalCount:v,initialize:h,toggle:R,disconnectWebSocket:se}}),Cm=["disabled"],$m=Ce({__name:"AutoModeToggle",setup(e){const n=Cs();return st(()=>{n.initialize()}),(t,a)=>(i(),u("button",{type:"button",class:ve(["flex items-center gap-1.5 px-2 py-1 rounded text-xs font-mono transition-colors",s(n).enabled?"bg-retro-yellow/20 text-retro-yellow hover:bg-retro-yellow/30":"text-retro-muted hover:text-retro-text hover:bg-retro-panel"]),disabled:s(n).loading,title:"Toggle Auto Mode — background spec processing",onClick:a[0]||(a[0]=o=>s(n).toggle())},[Y(s(Zr),{class:ve(["h-4 w-4",{"animate-pulse":s(n).isActive}])},null,8,["class"]),a[1]||(a[1]=r("span",null,"Auto",-1)),s(n).enabled?(i(),u("span",{key:0,class:ve(["inline-block w-1.5 h-1.5 rounded-full bg-retro-yellow",{"animate-pulse":s(n).isActive}])},null,2)):H("",!0)],10,Cm))}}),Sm={class:"flex items-start justify-between gap-2"},_m={class:"flex-1 min-w-0"},Mm={class:"flex items-center gap-2"},Tm={class:"font-mono text-sm text-retro-text truncate"},Am={class:"text-sm font-mono text-retro-muted mt-1 truncate"},Bm={class:"flex items-center gap-1 flex-shrink-0"},Em={key:0,class:"text-[11px] font-mono text-retro-muted mr-1",title:"Completed tasks / total tasks"},Rm={key:1,class:"w-2 h-2 rounded-full bg-retro-green",title:"spec"},Pm={key:2,class:"w-2 h-2 rounded-full bg-retro-cyan",title:"plan"},Dm={key:3,class:"w-2 h-2 rounded-full bg-retro-yellow",title:"tasks"},Im={class:"flex flex-wrap items-center justify-between gap-1 mt-2"},Lm={key:0,class:"flex items-center gap-1"},Nm=["title","disabled","onClick"],Fm=Ce({__name:"FeatureCard",props:{feature:{},skills:{},isActive:{type:Boolean}},emits:["select","cascade","openChat","skill"],setup(e,{emit:n}){const t={DocumentCheckIcon:Qs,PuzzlePieceIcon:ko,DocumentMagnifyingGlassIcon:ea,WrenchScrewdriverIcon:da,SparklesIcon:gr,BeakerIcon:Ws,ShieldCheckIcon:os,CommandLineIcon:Xs,CpuChipIcon:es,LightBulbIcon:aa},a=e,o=n,l=ht();function c(g){return t[g]||ko}function f(g){return g.prerequisites.every(v=>a.feature.files.some(h=>h.filename===v))}function m(g){return g.prerequisites.filter(v=>!a.feature.files.some(h=>h.filename===v))}function d(g){return f(g)?`${g.name} (Shift+click: new conversation)`:`Requires: ${m(g).join(", ")}`}const b=j(()=>{const g=l.findConversationByFeature(a.feature.id);return g?l.isConversationStreaming(g.id):!1}),C=j(()=>a.isActive?["border-retro-cyan shadow-retro","feature-card-active","dark:bg-gradient-to-br dark:from-retro-cyan/10 dark:via-retro-panel dark:to-retro-magenta/5"]:["border-retro-border","feature-card-light","hover:border-retro-muted","dark:bg-gradient-to-br","dark:from-retro-panel dark:via-retro-panel dark:to-retro-cyan/5","dark:hover:from-retro-cyan/5 dark:hover:via-retro-panel dark:hover:to-retro-magenta/5"]);return(g,v)=>(i(),u("button",{type:"button",class:ve(["w-full p-3 text-left rounded-lg border transition-all duration-200 group",s(C)]),onClick:v[6]||(v[6]=h=>o("select",e.feature.id))},[r("div",Sm,[r("div",_m,[r("div",Mm,[Y(s(qn),{class:ve(["h-4 w-4 flex-shrink-0 transition-colors duration-200",e.isActive?"text-retro-cyan":"text-retro-muted group-hover:text-retro-cyan"])},null,8,["class"]),r("span",Tm,_(e.feature.id),1)]),r("p",Am,_(e.feature.name),1)]),r("div",Bm,[e.feature.hasTasks?(i(),u("span",Em,_(e.feature.completedTasks)+"/"+_(e.feature.totalTasks),1)):H("",!0),e.feature.hasSpec?(i(),u("span",Rm)):H("",!0),e.feature.hasPlan?(i(),u("span",Pm)):H("",!0),e.feature.hasTasks?(i(),u("span",Dm)):H("",!0)])]),r("div",Im,[e.feature.hasSpec?(i(),u("div",Lm,[r("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Clarify spec (Shift+click: new conversation)",onClick:v[0]||(v[0]=lt(h=>o("cascade",h,e.feature.id,"clarify"),["stop"]))},[Y(s(eo),{class:"h-3.5 w-3.5"})]),r("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Plan → Tasks → Implement (Shift+click: new conversation)",onClick:v[1]||(v[1]=lt(h=>o("cascade",h,e.feature.id,"plan"),["stop"]))},[Y(s(Qr),{class:"h-3.5 w-3.5"})]),e.feature.hasPlan?(i(),u("button",{key:0,type:"button",class:"flex items-center justify-center p-1 bg-retro-yellow/20 text-retro-yellow rounded hover:bg-retro-yellow/30 transition-colors",title:"Tasks → Implement (Shift+click: new conversation)",onClick:v[2]||(v[2]=lt(h=>o("cascade",h,e.feature.id,"tasks"),["stop"]))},[Y(s(ns),{class:"h-3.5 w-3.5"})])):H("",!0),e.feature.hasTasks?(i(),u("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-magenta/20 text-retro-magenta rounded hover:bg-retro-magenta/30 transition-colors",title:"Implement (Shift+click: new conversation)",onClick:v[3]||(v[3]=lt(h=>o("cascade",h,e.feature.id,"implement"),["stop"]))},[Y(s(ca),{class:"h-3.5 w-3.5"})])):H("",!0),e.feature.hasTasks?(i(),u("button",{key:2,type:"button",class:"flex items-center justify-center p-1 bg-retro-orange/20 text-retro-orange rounded hover:bg-retro-orange/30 transition-colors",title:"Analyze spec/plan/tasks consistency (Shift+click: new conversation)",onClick:v[4]||(v[4]=lt(h=>o("cascade",h,e.feature.id,"analyze"),["stop"]))},[Y(s(qs),{class:"h-3.5 w-3.5"})])):H("",!0),e.skills.length>0?(i(),u(he,{key:3},[v[7]||(v[7]=r("div",{class:"w-px h-4 bg-retro-border mx-0.5"},null,-1)),(i(!0),u(he,null,Be(e.skills,h=>(i(),u("button",{key:h.id,type:"button",class:ve(["flex items-center justify-center p-1 rounded transition-colors",[f(h)&&!s(b)?"bg-retro-pink/20 text-retro-pink hover:bg-retro-pink/30":"bg-retro-subtle/10 text-retro-subtle cursor-not-allowed",s(b)?"animate-pulse":""]]),title:d(h),disabled:!f(h)||s(b),onClick:lt(R=>o("skill",R,e.feature.id,h.id),["stop"])},[(i(),ce(En(c(h.icon)),{class:"h-3.5 w-3.5"}))],10,Nm))),128))],64)):H("",!0)])):H("",!0),e.feature.hasSpec?(i(),u("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-green/20 text-retro-green rounded hover:bg-retro-green/30 transition-colors",title:"Open new chat linked to this spec",onClick:v[5]||(v[5]=lt(h=>o("openChat",h,e.feature.id),["stop"]))},[Y(s(Yo),{class:"h-3.5 w-3.5"})])):H("",!0)])],2))}});function $s(){function e(n){const t=Oe.parse(n);return ws.sanitize(t)}return{renderMarkdown:e}}const Hm={class:"fixed inset-0 z-50 flex items-center justify-center"},Om={class:"relative w-[96vw] h-[94vh] bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},Um={class:"flex-shrink-0 flex items-center justify-between px-4 h-12 border-b border-retro-border bg-retro-dark"},jm={class:"flex items-center gap-3 min-w-0"},zm={class:"text-sm font-mono font-bold text-retro-cyan truncate"},Vm={class:"text-xs font-mono text-retro-subtle"},Wm={class:"flex items-center gap-2"},Gm=["disabled"],qm={key:0,class:"flex-shrink-0 flex items-center gap-0 border-b border-retro-border bg-retro-dark overflow-x-auto"},Zm=["onClick"],Km={class:"flex-1 min-h-0 overflow-y-auto"},Ym={key:0,class:"flex items-center justify-center py-12"},Xm={key:1,class:"flex flex-col items-center justify-center py-12 text-center px-4"},Qm={class:"text-sm font-mono text-retro-red"},Jm={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},eh={key:3,class:"h-full flex flex-col"},th=["innerHTML"],nh=Ce({__name:"SpecViewerModal",props:{feature:{}},emits:["close"],setup(e,{emit:n}){const t=e,a=n,o=Dn(),{renderMarkdown:l}=$s(),c=S(t.feature.files[0]?.filename||""),f=S(""),m=S(!1),d=S(null),b=S(!1),C=S(""),g=S(!1);async function v(){if(c.value){m.value=!0,d.value=null;try{const V=`/api/specs/${t.feature.id}/${c.value}`,re=await $fetch(V);f.value=re.content}catch{d.value="Failed to load file",f.value=""}finally{m.value=!1}}}const h=j(()=>f.value?l(f.value):"");function R(V){b.value&&(b.value=!1),c.value=V,v()}function G(){C.value=f.value,b.value=!0}function I(){b.value=!1,C.value=""}async function ee(){g.value=!0;try{const V=`/api/specs/${t.feature.id}/${c.value}`;await $fetch(V,{method:"PUT",body:{content:C.value}}),f.value=C.value,b.value=!1,o.success("Saved")}catch{o.error("Failed to save")}finally{g.value=!1}}function te(V){V.key==="Escape"&&(b.value?I():a("close"))}return st(()=>{window.addEventListener("keydown",te),v()}),bt(()=>{window.removeEventListener("keydown",te)}),(V,re)=>(i(),ce(Qt,{to:"body"},[r("div",Hm,[r("div",{class:"absolute inset-0 bg-black/80",onClick:re[0]||(re[0]=ue=>a("close"))}),r("div",Om,[r("div",Um,[r("div",jm,[r("span",zm,_(e.feature.name),1),r("span",Vm,_(e.feature.id),1)]),r("div",Wm,[s(b)?(i(),u(he,{key:0},[r("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-muted transition-colors",onClick:I}," Cancel "),r("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-cyan text-retro-cyan hover:bg-retro-cyan/10 transition-colors disabled:opacity-50",disabled:s(g),onClick:ee},_(s(g)?"Saving...":"Save"),9,Gm)],64)):s(f)&&!s(m)&&!s(d)?(i(),u("button",{key:1,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Edit",onClick:G},[Y(s(Jr),{class:"h-4 w-4"})])):H("",!0),r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (ESC)",onClick:re[1]||(re[1]=ue=>a("close"))},[Y(s(pt),{class:"h-4 w-4"})])])]),e.feature.files.length>0?(i(),u("div",qm,[(i(!0),u(he,null,Be(e.feature.files,ue=>(i(),u("button",{key:ue.filename,type:"button",class:ve(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap",[s(c)===ue.filename?"border-retro-cyan text-retro-cyan bg-retro-black":"border-transparent text-retro-muted hover:text-retro-text hover:bg-retro-panel"]]),onClick:se=>R(ue.filename)},_(ue.label),11,Zm))),128))])):H("",!0),r("div",Km,[s(m)?(i(),u("div",Ym,[...re[3]||(re[3]=[r("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading...",-1)])])):s(d)?(i(),u("div",Xm,[r("p",Qm,_(s(d)),1),r("button",{type:"button",class:"mt-3 px-3 py-1.5 text-xs font-mono bg-retro-panel border border-retro-border rounded text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:v}," Retry ")])):e.feature.files.length===0?(i(),u("div",Jm,[...re[4]||(re[4]=[r("p",{class:"text-sm font-mono text-retro-muted"},"No spec files found",-1),r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," This feature directory has no .md files ",-1)])])):s(b)?(i(),u("div",eh,[Te(r("textarea",{"onUpdate:modelValue":re[2]||(re[2]=ue=>Ie(C)?C.value=ue:null),class:"flex-1 w-full p-4 bg-retro-black text-sm font-mono text-retro-text resize-none focus:outline-none",spellcheck:"false"},null,512),[[ft,s(C)]])])):(i(),u("div",{key:4,class:"spec-markdown p-6 text-sm font-mono text-retro-text max-w-4xl mx-auto",innerHTML:s(h)},null,8,th))])])])]))}});function rh(e){if(!e||typeof e!="object")return null;const n=e,t=["session_id","sessionId","conversation_id","conversationId","thread_id","threadId"];for(const o of t){const l=n[o];if(typeof l=="string"&&l.length>0)return l}const a=n.response;if(a&&typeof a=="object"&&!Array.isArray(a)){const o=a;for(const l of t){const c=o[l];if(typeof c=="string"&&c.length>0)return c}}return null}const tt=new Map,on=new Map,ir=new Set,oh=3e4,sh=18e4;function ah(e){switch(e){case 1e3:return"Normal closure";case 1001:return"Endpoint is going away (server shutdown or page navigation)";case 1002:return"Protocol error";case 1003:return"Unsupported data";case 1005:return"No status code received from peer (close frame had no code)";case 1006:return"Abnormal closure (connection dropped without close frame)";case 1007:return"Invalid payload data";case 1008:return"Policy violation";case 1009:return"Message too big";case 1010:return"Missing required extension";case 1011:return"Internal server error";case 1012:return"Service restart";case 1013:return"Try again later (temporary overload)";case 1015:return"TLS handshake failure";default:return e>=4e3&&e<=4999?"Application-specific close code":"Unknown close code"}}function ih(e,n){const t=[];return e.reason?t.push(e.reason):t.push(ah(e.code)),n?.lastServerError?t.push(`Last server error: ${n.lastServerError}`):n?.lastSocketError&&t.push(`Last socket error: ${n.lastSocketError}`),t.push(`wasClean: ${e.wasClean?"yes":"no"}`),t.join(" | ")}function ho(){const e=ht(),n=Kn();function t(){return typeof document>"u"||typeof document.hasFocus!="function"?!1:document.visibilityState==="visible"&&document.hasFocus()}function a(M){const E=e.conversations.find(Q=>Q.id===M)?.title?.trim()||"Chat";return new Notification("Spec Cat",{body:`${E} response completed.`,tag:`chat-complete-${M}`})}async function o(M){if(!(typeof window>"u"||typeof Notification>"u")&&!t()){if(Notification.permission==="granted"){a(M);return}if(Notification.permission==="default")try{await Notification.requestPermission()==="granted"&&a(M)}catch(p){console.warn("[useChatStream] Failed to request browser notification permission:",p)}}}function l(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`}function c(M){M.healthCheckInterval&&(clearInterval(M.healthCheckInterval),M.healthCheckInterval=null)}function f(M){c(M),M.lastMessageTime=Date.now(),M.healthCheckInterval=mo(()=>{const p=M.conversationId;if(M.ws.readyState!==WebSocket.OPEN){console.warn(`[useChatStream] Health check: WebSocket not open for ${p}`),c(M),e.isConversationStreaming(p)&&(b(M.currentMessageId,p,"error"),e.updateMessage(M.currentMessageId,{status:"error"},p),e.setSessionError("Connection lost during streaming",p),e.endSession(p),e.endConversationStreaming(p)),tt.delete(p);return}if(e.isConversationStreaming(p)){const E=Date.now()-M.lastMessageTime;E>sh&&(console.warn(`[useChatStream] Health check: streaming timeout for ${p} (${Math.round(E/1e3)}s)`),c(M),b(M.currentMessageId,p,"error"),e.updateMessage(M.currentMessageId,{status:"error"},p),e.setSessionError("Streaming timed out — no response from server for 3 minutes",p),e.endSession(p),e.endConversationStreaming(p),M.ws.close(),tt.delete(p))}},oh)}function m(M,p){return e.conversations.find(Q=>Q.id===M)?.messages.find(Q=>Q.id===p)?.status}function d(M,p=!0){const E=tt.get(M);E&&(c(E),p&&E.ws.readyState===WebSocket.OPEN&&E.ws.close(),tt.delete(M))}function b(M,p,E){const le=e.conversations.find(fe=>fe.id===p)?.messages.find(fe=>fe.id===M);if(le?.contentBlocks)for(const fe of le.contentBlocks)fe.type==="tool_use"&&(fe.status==="running"||fe.status==="pending")&&e.updateBlockById(M,fe.id,Z=>{Z.type==="tool_use"&&(Z.status=E)},p)}async function C(M){try{(await g(M)).send(JSON.stringify({type:"reset_context"})),e.clearProviderSession(M),console.log("[useChatStream] Context reset requested for conversation:",M)}catch(p){throw console.error("[useChatStream] Failed to reset context:",p),p}}function g(M){return new Promise((p,E)=>{const Q=tt.get(M);if(Q&&Q.ws.readyState===WebSocket.OPEN){p(Q.ws);return}Q&&(Q.ws.close(),tt.delete(M));const le=l(),fe=new WebSocket(le),Z={ws:fe,currentMessageId:"",conversationId:M,activeTools:new Map,currentTextBlockId:null,currentThinkingBlockId:null,healthCheckInterval:null,lastMessageTime:Date.now(),lastServerError:null,lastSocketError:null};tt.set(M,Z),fe.onopen=()=>{p(fe)},fe.onerror=P=>{console.error(`[useChatStream] WebSocket error for conversation ${M}:`,P);const $=tt.get(M);$&&($.lastSocketError="Browser reported a WebSocket transport error (network/proxy/server)"),e.isConversationStreaming(M)&&($?.currentMessageId&&(b($.currentMessageId,M,"error"),e.updateMessage($.currentMessageId,{status:"error"},M)),e.setSessionError("Connection error during streaming",M),e.endSession(M),e.endConversationStreaming(M)),tt.delete(M),E(new Error("WebSocket connection failed. Server may be unavailable."))},fe.onclose=P=>{const $=tt.get(M);if($&&c($),tt.delete(M),on.delete(M),e.isConversationStreaming(M)){$?.currentMessageId&&(b($.currentMessageId,M,"error"),e.updateMessage($.currentMessageId,{status:"error"},M));const L=ih(P,$);e.setSessionError(`Connection closed: ${L} (code: ${P.code})`,M),e.endSession(M),e.endConversationStreaming(M)}},fe.onmessage=P=>{G(P.data,M)}})}async function v(M,p=3){for(let E=0;E<p;E++){const Q=e.conversations.find(le=>le.id===M);if(Q)return Q;E<p-1&&await new Promise(le=>setTimeout(le,100))}console.error("[useChatStream] Conversation not found after retries:",M)}function h(M,p){return`${M}:${p}`}function R(M,p){const E=e.conversations.find(le=>le.id===M);if(!E)return null;const Q=E.messages.findIndex(le=>le.id===p);if(Q<=0)return null;for(let le=Q-1;le>=0;le--){const fe=E.messages[le];if(fe.role==="user"&&fe.content.trim().length>0)return fe.content}return null}async function G(M,p){const E=tt.get(p);if(E){E.lastMessageTime=Date.now();try{e.pushDebugEvent({direction:"in",channel:"ws",eventType:"ws.raw",payload:M},p);const Q=JSON.parse(M);if(e.pushDebugEvent({direction:"in",channel:"ws",eventType:Q.type,payload:Q},p),Q.type==="error"){console.error(`[useChatStream] Server error for ${p}:`,Q.error);const le=Q.error||"Unknown server error";E.lastServerError=le;const fe=/codex cannot access session files|failed to clean up stale arg0 temp dirs: Permission denied|failed to initialize rollout recorder: Permission denied|failed to create session: Permission denied|\/\.codex\/.*permission denied/i.test(le);if(/state db missing rollout path for thread/i.test(le)&&!fe){const P=h(p,E.currentMessageId);if(!ir.has(P)){const $=R(p,E.currentMessageId);if($){ir.add(P),e.setProviderSessionId("",p),ee(E.currentMessageId,`
|
|
72
|
+
|
|
73
|
+
> **Session Reset**: Codex resume state was corrupted. Retrying once with a fresh session...
|
|
74
|
+
|
|
75
|
+
`,p);try{const L=e.conversations.find(N=>N.id===p),x=Rr(L);await re($,E.currentMessageId,p,x);return}catch(L){console.error(`[useChatStream] Rollout-path recovery retry failed for ${p}:`,L)}}}}c(E),b(E.currentMessageId,p,"error"),e.updateMessage(E.currentMessageId,{status:"error"},p),/state db missing rollout path for thread/i.test(le)&&e.setProviderSessionId("",p),ir.delete(h(p,E.currentMessageId)),e.setSessionError(le,p),e.endSession(p),e.endConversationStreaming(p),ne(p),e.saveConversation(p,!0),d(p);return}if(Q.type==="done"){c(E);const le=m(p,E.currentMessageId);if(ir.delete(h(p,E.currentMessageId)),Q.denied){b(E.currentMessageId,p,"error"),e.updateMessage(E.currentMessageId,{status:"stopped"},p),e.endSession(p),e.endConversationStreaming(p),ne(p),e.clearPendingPermission(p),E.activeTools.clear(),e.saveConversation(p,!0),d(p);return}if(le==="error"||le==="stopped"){b(E.currentMessageId,p,"error"),e.endSession(p),e.endConversationStreaming(p),ne(p),e.clearPendingPermission(p),E.activeTools.clear(),e.saveConversation(p,!0),d(p);return}b(E.currentMessageId,p,"complete"),e.completeMessageWithSave(E.currentMessageId,p),e.endSession(p),e.endConversationStreaming(p),o(p);const fe=await v(p),Z=fe?.hasWorktree&&fe.worktreePath?$fetch("/api/chat/worktree-commit",{method:"POST",body:{worktreePath:fe.worktreePath,conversationId:p}}).then($=>fe.previewBranch&&fe.worktreePath?$fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:fe.previewBranch,worktreePath:fe.worktreePath}}).then(L=>{if(!L.success)throw new Error(L.error||"Unknown preview sync failure");return $}):$).then($=>{if($?.success&&$.currentBranch!==fe.worktreeBranch){const L=fe.worktreeBranch;e.updateWorktreeBranch(p,$.currentBranch),ee(E.currentMessageId,`
|
|
76
|
+
|
|
77
|
+
> **Branch changed**: AI switched from \`${L}\` to \`${$.currentBranch}\`
|
|
78
|
+
|
|
79
|
+
`,p)}else $?.success&&fe.worktreeBranch&&e.updateWorktreeBranch(p,fe.worktreeBranch);return e.saveConversation(p,!1),$}).catch($=>{console.warn("[useChatStream] Auto-commit/preview-sync failed:",$)}):Promise.resolve(),P=on.get(p);if(P&&P.queue.length>0){const $=P.queue.shift(),L=P.featureId;Z.then(()=>{setTimeout(()=>{K(p,L,$)},1500)}),P.queue.length===0&&on.delete(p)}e.clearPendingPermission(p),e.saveConversation(p,!0),E.activeTools.clear(),d(p),on.delete(p);return}if(Q.type==="pong")return;if(Q.type==="session_reset"){console.warn(`[useChatStream] Session reset for ${p}:`,Q.reason),e.setProviderSessionId("",p),ee(E.currentMessageId,`
|
|
80
|
+
|
|
81
|
+
> **Session Reset**: Previous session could not be resumed. Retrying with a fresh session...
|
|
82
|
+
|
|
83
|
+
`,p);return}if(Q.type==="worktree_recovered"){console.log(`[useChatStream] Worktree recovered for ${p}`),ee(E.currentMessageId,`
|
|
84
|
+
|
|
85
|
+
> **Worktree recovered**: The work directory was restored after a system restart.
|
|
86
|
+
|
|
87
|
+
`,p);return}if(Q.type==="context_reset"){console.log(`[useChatStream] Context reset confirmed for ${p}`);return}if(Q.type==="aborted"){console.log(`[useChatStream] Abort confirmed for ${p}`);return}if(Q.type==="permission_request"){c(E),e.endConversationStreaming(p);const le=Pr(Q.description||"",Q.tool||"Permission");e.setPendingPermission(le,p);let fe=`
|
|
88
|
+
|
|
89
|
+
**Permission Required**: ${le.tool}`;le.filePath&&(fe+=` - ${le.filePath}`),ee(E.currentMessageId,fe+`
|
|
90
|
+
`,p);return}if(Q.type==="permission_prompt"&&Q.text){c(E),e.endConversationStreaming(p);const le=Pr(Q.text,"Permission");e.setPendingPermission(le,p);const fe=`
|
|
91
|
+
|
|
92
|
+
**${le.tool}**: ${le.filePath||le.command||le.description}
|
|
93
|
+
`;ee(E.currentMessageId,fe,p);return}Q.type==="provider_json"&&Q.data&&V(Q.data,p)}catch(Q){console.error(`[useChatStream] Failed to parse WebSocket message for ${p}:`,Q,"Raw data:",M?.slice(0,200)),b(E.currentMessageId,p,"error"),e.updateMessage(E.currentMessageId,{status:"error"},p),e.setSessionError(`Failed to parse server response: ${Q instanceof Error?Q.message:"Invalid JSON"}`,p),e.endSession(p),e.endConversationStreaming(p),ne(p),e.saveConversation(p,!0),d(p)}}}function I(M,p){e.initContentBlocks(M,p)}function ee(M,p,E){I(M,E);const Q={id:vn(),type:"text",text:p};e.appendContentBlockWithSave(M,Q,E)}function te(M,p){return!!e.conversations.find(le=>le.id===p)?.messages.find(le=>le.id===M)?.contentBlocks?.some(le=>le.type==="session_init")}function V(M,p){const E=tt.get(p);if(!E)return;e.pushDebugEvent({direction:"in",channel:"provider",eventType:M.type,payload:M},p);const Q=typeof M.type=="string"?M.type.toLowerCase():"",le="subtype"in M&&typeof M.subtype=="string"?String(M.subtype).toLowerCase():"",Z=Q.includes("error")||Q.includes("failed")||le.startsWith("error")?null:rh(M);if(Z&&e.setProviderSessionId(Z,p),M.type==="permission_request"){const $=M.permission,L={tool:$.tool,filePath:$.file_path||$.path,command:$.command,description:$.description,input:$};e.setPendingPermission(L,p);let x=`
|
|
94
|
+
|
|
95
|
+
**Permission Required**: ${$.tool}`;L.filePath?x+=` - ${L.filePath}`:L.command&&(x+=` - \`${L.command}\``),ee(E.currentMessageId,x+`
|
|
96
|
+
`,p);return}if(M.type==="user"){const P=M,$=P.message?.content||P.content;if($){for(const L of $)if(L.type==="tool_result"&&L.is_error&&L.content){const x=L.content;if(x.includes("requested permissions")||x.includes("haven't granted")){const N=Pr(x,"Permission");e.setPendingPermission(N,p);let q=`
|
|
97
|
+
|
|
98
|
+
**Permission Required**: ${N.tool}`;N.filePath?q+=` - ${N.filePath}`:N.command&&(q+=` - \`${N.command}\``),ee(E.currentMessageId,q+`
|
|
99
|
+
`,p);return}}}}if(M.type==="system"){const P=M;if(P.subtype==="init"&&P.model){I(E.currentMessageId,p);const $={id:vn(),type:"session_init",model:P.model,tools:P.tools||[],permissionMode:P.permissionMode||"",cwd:P.cwd||""};e.appendContentBlockWithSave(E.currentMessageId,$,p)}return}if(M.type==="stream_event"){const $=M.event;if($.type==="content_block_start"&&$.content_block){const L=$.content_block;if(L.type==="text"){I(E.currentMessageId,p);const x=vn(),N={id:x,type:"text",text:L.text||""};e.appendContentBlockWithSave(E.currentMessageId,N,p),E.currentTextBlockId=x}if(L.type==="thinking"){I(E.currentMessageId,p);const x=vn(),N={id:x,type:"thinking",thinking:L.thinking||""};e.appendContentBlockWithSave(E.currentMessageId,N,p),E.currentThinkingBlockId=x}if((L.type==="tool_use"||L.type==="server_tool_use")&&L.id&&L.name){I(E.currentMessageId,p);const x=vn(),N={id:x,type:"tool_use",toolUseId:L.id,name:L.name,input:{},inputSummary:"",status:"running"};e.appendContentBlockWithSave(E.currentMessageId,N,p),E.activeTools.set($.index??0,{blockId:x,toolUseId:L.id,name:L.name,inputJson:""})}}if($.type==="content_block_delta"&&$.delta&&($.delta.text&&E.currentTextBlockId&&(e.updateBlockWithSave(E.currentMessageId,E.currentTextBlockId,L=>{L.type==="text"&&(L.text+=$.delta.text)},p,{syncContent:!1}),e.appendToMessage(E.currentMessageId,$.delta.text,p)),$.delta.thinking&&E.currentThinkingBlockId&&e.updateBlockWithSave(E.currentMessageId,E.currentThinkingBlockId,L=>{L.type==="thinking"&&(L.thinking+=$.delta.thinking)},p,{syncContent:!1}),$.delta.partial_json&&$.index!==void 0)){const L=E.activeTools.get($.index);L&&(L.inputJson+=$.delta.partial_json)}if($.type==="content_block_stop"&&(E.currentTextBlockId&&(E.currentTextBlockId=null),E.currentThinkingBlockId&&(E.currentThinkingBlockId=null),$.index!==void 0)){const L=E.activeTools.get($.index);if(L){let x={};try{x=JSON.parse(L.inputJson)}catch{}if(L.name==="ExitPlanMode"){const N={allowedPrompts:x.allowedPrompts};e.setPendingPlanApproval(N,p)}e.updateBlockWithSave(E.currentMessageId,L.blockId,N=>{if(N.type==="tool_use"){const q=N;q.input=x,q.inputSummary=ks(x),q.status="pending"}},p)}}return}if(M.type==="tool_result"){const P=M;I(E.currentMessageId,p);const $=e.findToolUseBlock(E.currentMessageId,P.tool_use_id,p);$&&$.type==="tool_use"&&e.updateBlockById(E.currentMessageId,$.id,x=>{x.type==="tool_use"&&(x.status=P.is_error?"error":"complete")},p);const L={id:vn(),type:"tool_result",toolUseId:P.tool_use_id,content:P.content||"",isError:!!P.is_error};e.appendContentBlockWithSave(E.currentMessageId,L,p),P.is_error&&console.warn("[useChatStream] Tool error:",P.content?.slice(0,500));return}if(M.type==="result"){const P=M;if((P.is_error||P.subtype==="error_max_turns"||P.subtype==="error_during_execution")&&(e.updateMessage(E.currentMessageId,{status:"error"},p),ne(p),P.subtype==="error_max_turns"?e.setSessionError("Maximum conversation turns reached. Please start a new conversation.",p):P.subtype==="error_during_execution"&&e.setSessionError("An error occurred during provider execution.",p),console.error("[useChatStream] Result error:",P.subtype)),P.subtype==="success"&&P.usage){I(E.currentMessageId,p);const $={id:vn(),type:"result_summary",totalCostUsd:P.total_cost_usd??0,durationMs:P.duration_ms??0,numTurns:P.num_turns??0,usage:{inputTokens:P.usage.input_tokens??0,outputTokens:P.usage.output_tokens??0,cacheCreationInputTokens:P.usage.cache_creation_input_tokens??0,cacheReadInputTokens:P.usage.cache_read_input_tokens??0}};e.appendContentBlockWithSave(E.currentMessageId,$,p)}}}async function re(M,p,E,Q){if(typeof window>"u")return;const le=km();try{const fe=await g(E),Z=tt.get(E);Z&&(Z.currentMessageId=p,Z.activeTools.clear(),Z.currentTextBlockId=null,Z.currentThinkingBlockId=null,f(Z)),wm(M)&&e.setProviderSessionId("",E);const $=e.getProviderSessionId(E),L=e.conversations.find(ie=>ie.id===E),x=L?.providerId||n.providerSelection.providerId||zo,N=L?.providerModelKey||n.providerSelection.modelKey||jo;L&&(!L.providerId||!L.providerModelKey)&&(e.setConversationProviderSelection(E,x,N),e.saveConversation(E,!0));const q={type:"chat",message:M,requestId:le,sessionId:$||void 0,permissionMode:e.permissionMode,conversationId:E,cwd:Q?.cwd,worktreeBranch:Q?.worktreeBranch,featureId:Q?.featureId,providerId:x,providerModelKey:N};if(x==="codex"&&!te(p,E)){I(p,E);const ie=e.permissionMode==="bypass"||e.permissionMode==="auto",xe={id:vn(),type:"session_init",model:N,tools:Array.from({length:32},(Re,Se)=>`tool-${Se+1}`),permissionMode:ie?"bypassPermissions":e.permissionMode,cwd:Q?.cwd||L?.cwd||""};e.appendContentBlockWithSave(p,xe,E)}e.pushDebugEvent({direction:"out",channel:"ws",eventType:"chat",payload:q},E),fe.send(JSON.stringify(q))}catch(fe){e.updateMessage(p,{status:"error"},E),e.setSessionError(fe.message||"Connection failed",E),e.endSession(E),e.endConversationStreaming(E),e.saveConversation(E,!0),d(E)}}function ue(M,p){const E=p??e.activeConversationId;if(!E)return;const Q=tt.get(E);if(!Q||Q.ws.readyState!==WebSocket.OPEN)return;const le={type:"permission_response",allow:M};e.pushDebugEvent({direction:"out",channel:"ws",eventType:"permission_response",payload:le},E),Q.ws.send(JSON.stringify(le)),M&&(e.startConversationStreaming(E),f(Q));const fe=M?"Allowed":"Denied";ee(Q.currentMessageId,`${fe}
|
|
100
|
+
`,E),e.clearPendingPermission(E)}function se(M,p,E){on.set(p,{featureId:M,queue:[...E]})}function ne(M){M?on.delete(M):on.clear()}async function K(M,p,E){e.activeConversationId!==M&&e.selectConversation(M);let Q;if(E.startsWith("skill:")){const P=E.replace("skill:","");try{Q=(await $fetch(`/api/skills/${P}/prompt`,{method:"POST",body:{featureId:p}})).prompt}catch($){console.error(`[useChatStream] Failed to render skill prompt for ${P}:`,$);return}}else Q=`/speckit.${E} ${p}`;e.addUserMessage(Q,M),e.saveConversation(M,!0);const le=e.conversations.find(P=>P.id===M),fe=e.addAssistantMessage(M);e.startSession(No(),M),e.startConversationStreaming(M);const Z=Rr(le);await re(Q,fe.id,M,Z)}function W(M){const p=M??e.activeConversationId;if(!p)return;const E=tt.get(p);if(E){if(E.ws.readyState===WebSocket.OPEN){const Q={type:"abort"};e.pushDebugEvent({direction:"out",channel:"ws",eventType:"abort",payload:Q},p),E.ws.send(JSON.stringify(Q)),E.ws.close()}E.currentMessageId&&(b(E.currentMessageId,p,"error"),e.updateMessage(E.currentMessageId,{status:"stopped"},p),e.endSession(p),e.saveConversation(p,!0)),tt.delete(p)}e.endConversationStreaming(p),e.clearPendingPermission(p),ne(p)}function U(M){const p=tt.get(M);p&&(c(p),p.ws.close(),tt.delete(M)),on.delete(M)}function F(){for(const[M,p]of tt)c(p),p.ws.close(),tt.delete(M);on.clear()}async function B(M){const p=M??e.activeConversationId;if(!p)return;e.clearPendingPlanApproval(p),e.setPermissionMode("auto");const E="Approved. Proceed with the implementation.";e.addUserMessage(E,p),e.saveConversation(p,!0);const Q=e.addAssistantMessage(p);e.startSession(No(),p),e.startConversationStreaming(p);const le=e.conversations.find(Z=>Z.id===p),fe=Rr(le,!0);await re(E,Q.id,p,fe)}function X(M){const p=M??e.activeConversationId;p&&e.clearPendingPlanApproval(p)}return bt(()=>{F()}),{sendMessage:re,sendPermissionResponse:ue,approvePlan:B,rejectPlan:X,abort:W,disconnect:F,disconnectConversation:U,enableCascade:se,disableCascade:ne,resetContext:C}}const lh={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},ch={class:"px-4 py-3 border-b border-retro-border flex items-center justify-between"},uh=["disabled"],dh={class:"px-4 py-4 space-y-3"},fh={class:"relative"},mh=["disabled"],hh={key:0,value:""},ph=["value"],vh={key:0,class:"text-xs font-mono text-retro-red"},gh={key:1,class:"text-xs font-mono text-retro-muted"},xh={class:"px-4 py-3 border-t border-retro-border flex items-center gap-2 justify-end"},bh=["disabled"],yh=["disabled"],Gr=Ce({__name:"NewConversationModal",props:{show:{type:Boolean},creating:{type:Boolean}},emits:["close","create"],setup(e,{emit:n}){const t=e,a=n,o=S([]),l=S(""),c=S(!1),f=S(""),m=j(()=>!c.value&&!t.creating&&l.value.length>0&&o.value.length>0);async function d(){c.value=!0,f.value="";try{const C=await $fetch("/api/git/branches"),g=C.branches.filter(h=>!h.isRemote&&!h.name.startsWith("br/")&&!h.name.startsWith("br/p-")).map(h=>h.name);if(o.value=g,!g.length){l.value="",f.value="No local branches available for chat creation.";return}const v=(C.current&&g.includes(C.current)?C.current:"")||(g.includes("main")?"main":"")||(g.includes("master")?"master":"")||g[0];l.value=v}catch(C){o.value=[],l.value="",f.value=C instanceof Error?C.message:"Failed to load branches"}finally{c.value=!1}}Me(()=>t.show,C=>{C&&d()});function b(){m.value&&a("create",l.value)}return(C,g)=>(i(),ce(Qt,{to:"body"},[Y($n,{"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:We(()=>[e.show?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:g[3]||(g[3]=lt(v=>a("close"),["self"]))},[r("div",lh,[r("div",ch,[g[4]||(g[4]=r("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"New Conversation",-1)),r("button",{type:"button",class:"p-1 text-retro-muted hover:text-retro-text transition-colors",disabled:e.creating,onClick:g[0]||(g[0]=v=>a("close"))},[Y(s(pt),{class:"w-4 h-4"})],8,uh)]),r("div",dh,[g[5]||(g[5]=r("label",{class:"block text-xs font-mono text-retro-muted"},"Base Branch",-1)),r("div",fh,[Te(r("select",{"onUpdate:modelValue":g[1]||(g[1]=v=>l.value=v),disabled:c.value||e.creating||o.value.length===0,class:"w-full appearance-none bg-retro-black border border-retro-border rounded px-2 py-1.5 pr-7 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan disabled:opacity-40"},[c.value?(i(),u("option",hh,"Loading branches...")):H("",!0),(i(!0),u(he,null,Be(o.value,v=>(i(),u("option",{key:v,value:v},_(v),9,ph))),128))],8,mh),[[_n,l.value]]),Y(s(Xr),{class:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})]),f.value?(i(),u("p",vh,_(f.value),1)):(i(),u("p",gh," The conversation worktree will be created from the selected branch. "))]),r("div",xh,[r("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",disabled:e.creating,onClick:g[2]||(g[2]=v=>a("close"))}," Cancel ",8,bh),r("button",{type:"button",disabled:!m.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:b},_(e.creating?"Creating...":"Create"),9,yh)])])])):H("",!0)]),_:1})]))}}),wh={class:"h-full flex flex-col bg-retro-black"},kh={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border"},Ch={class:"flex items-center gap-2 min-w-0"},$h={class:"flex-shrink-0 px-3 pt-3"},Sh={class:"relative"},_h={class:"flex-1 overflow-y-auto p-3"},Mh={class:"space-y-2"},Th={key:0,class:"flex items-center justify-center py-12"},Ah={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},Bh={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},Eh=Ce({__name:"FeaturesPanel",setup(e){const n=ht(),t=Qn(),{sendMessage:a,enableCascade:o}=ho(),l=Dn(),c=S("features"),f=S(null),m=S(null),d=S([]),b=S([]),C=S(!1),g=S(!1),v=S(null),h=S(!1),R=S(!1),G=S(null),I=S(""),ee=S("");let te=null;Me(I,L=>{te&&clearTimeout(te),te=setTimeout(()=>{ee.value=L},300)});const V=j(()=>{const L=ee.value.trim().toLowerCase();return L?d.value.filter(x=>x.name.toLowerCase().includes(L)||x.id.toLowerCase().includes(L)):d.value}),re=S({}),ue=j(()=>n.activeConversation?.featureId||null);Me(()=>n.activeConversationId,()=>{const L=ue.value;L&&gn(()=>{const x=re.value[L];x&&x.scrollIntoView({behavior:"auto",block:"nearest"})})});async function se(){C.value=!0;try{const L=await $fetch("/api/specs/features");d.value=L.features}catch{l.error("Failed to load features"),d.value=[]}finally{C.value=!1}}async function ne(){try{const L=await $fetch("/api/skills");b.value=L.skills}catch{b.value=[]}}st(()=>{se(),ne()});function K(L){f.value=L,m.value=null,c.value="files",t.setSelectedFeatureId(L);const x=d.value.find(N=>N.id===L);x&&(v.value=x,g.value=!0)}function W(){g.value=!1,v.value=null}const U={plan:["tasks","implement"],tasks:["implement"],implement:[],clarify:[],analyze:[]},F={analyze:["skill:better-spec"]};async function B(L,x){if(L.startsWith("skill:")){const N=L.replace("skill:","");return(await $fetch(`/api/skills/${N}/prompt`,{method:"POST",body:{featureId:x}})).prompt}return`/speckit.${L} ${x}`}function X(L,x){if(x)return null;const N=n.findConversationByFeature(L);return N&&!n.isConversationStreaming(N.id)?(n.selectConversation(N.id),N.id):null}async function M(L,x,N){const q=await n.createConversation({featureId:L,baseBranch:N});if(!q)throw new Error("Failed to create conversation");return n.renameConversation(q,x),n.selectConversation(q),q}async function p(L,x){n.addUserMessage(x,L),n.saveConversation(L,!0);const N=n.conversations.find(ae=>ae.id===L),q=n.addAssistantMessage(L);n.startSession(`session-${Date.now()}`,L),n.startConversationStreaming(L);const ie={};N?.worktreePath&&(ie.cwd=N.worktreePath,ie.worktreeBranch=N.worktreeBranch),N?.featureId&&(ie.featureId=N.featureId),await a(x,q.id,L,Object.keys(ie).length>0?ie:void 0)}async function E(L,x,N){const q=F[x];let ie;if(q&&q.length>0){const ae=[...q.slice(1),x,...U[x]||[]];o(L,N,ae);const xe=q[0];try{ie=await B(xe,L)}catch(Re){l.error(Re instanceof Error?Re.message:"Failed to resolve prerequisite step");return}}else{const ae=U[x]||[];ae.length>0&&o(L,N,ae),ie=`/speckit.${x} ${L}`}await p(N,ie)}async function Q(L,x,N){const q=L.shiftKey,ie=X(x,q);if(ie){try{await E(x,N,ie)}catch(ae){l.error(ae instanceof Error?ae.message:"Failed to run cascade action")}return}G.value={type:"cascade",featureId:x,command:N,title:`${N}: ${x}`},h.value=!0}async function le(L,x){G.value={type:"open-chat",featureId:x,title:`spec: ${x}`},h.value=!0}async function fe(L,x,N){let q;try{q=await $fetch(`/api/skills/${x}/prompt`,{method:"POST",body:{featureId:L}})}catch(ie){throw new Error(ie instanceof Error?ie.message:"Failed to render skill prompt")}await p(N,q.prompt)}async function Z(L,x,N){const q=L.shiftKey,ie=X(x,q);if(ie){try{await fe(x,N,ie)}catch(ae){l.error(ae instanceof Error?ae.message:"Failed to run skill")}return}G.value={type:"skill",featureId:x,skillId:N,title:`skill: ${N} — ${x}`},h.value=!0}function P(){h.value=!1,G.value=null}async function $(L){if(G.value){R.value=!0;try{const x=G.value,N=await M(x.featureId,x.title,L);x.type==="cascade"?await E(x.featureId,x.command,N):x.type==="skill"&&await fe(x.featureId,x.skillId,N),h.value=!1,G.value=null}catch(x){l.error(x instanceof Error?x.message:"Failed to create conversation")}finally{R.value=!1}}}return(L,x)=>{const N=$m,q=Fm,ie=nh;return i(),u("div",wh,[r("div",kh,[r("div",Ch,[Y(N)]),r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Refresh",onClick:se},[Y(s(xn),{class:ve(["h-4 w-4",{"animate-spin":s(C)}])},null,8,["class"])])]),r("div",$h,[r("div",Sh,[Y(s(Zn),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-retro-subtle"}),Te(r("input",{"onUpdate:modelValue":x[0]||(x[0]=ae=>Ie(I)?I.value=ae: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),[[ft,s(I)]])])]),r("div",_h,[r("div",Mh,[(i(!0),u(he,null,Be(s(V),ae=>(i(),u("div",{key:ae.id,ref_for:!0,ref:xe=>{s(re)[ae.id]=xe}},[Y(q,{feature:ae,skills:s(b),"is-active":s(ue)===ae.id,onSelect:K,onCascade:Q,onOpenChat:le,onSkill:Z},null,8,["feature","skills","is-active"])]))),128))]),s(C)&&s(d).length===0?(i(),u("div",Th,[...x[1]||(x[1]=[r("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading features...",-1)])])):H("",!0),!s(C)&&s(d).length>0&&s(V).length===0?(i(),u("div",Ah,[Y(s(Zn),{class:"h-10 w-10 text-retro-subtle mb-3"}),x[2]||(x[2]=r("p",{class:"text-sm font-mono text-retro-muted"},"No matching features",-1)),x[3]||(x[3]=r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Try a different search term ",-1))])):H("",!0),!s(C)&&s(d).length===0?(i(),u("div",Bh,[Y(s(na),{class:"h-10 w-10 text-retro-subtle mb-3"}),x[4]||(x[4]=r("p",{class:"text-sm font-mono text-retro-muted"},"No features found",-1)),x[5]||(x[5]=r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Create a feature in specs/ to get started ",-1))])):H("",!0)]),s(g)&&s(v)?(i(),ce(ie,{key:0,feature:s(v),onClose:W},null,8,["feature"])):H("",!0),Y(Gr,{show:s(h),creating:s(R),onClose:P,onCreate:$},null,8,["show","creating"])])}}}),Rh={class:"flex items-start justify-between gap-2"},Ph={class:"flex-1 min-w-0"},Dh={key:1,class:"flex items-center gap-2"},Ih={key:0,class:"flex-shrink-0 relative"},Lh={class:"text-sm font-mono text-retro-text truncate"},Nh={key:2,class:"text-xs font-mono text-retro-green bg-retro-green/10 px-1.5 py-0.5 rounded flex-shrink-0"},Fh={key:5,class:"text-xs font-mono text-retro-yellow bg-retro-yellow/10 px-1.5 py-0.5 rounded flex-shrink-0"},Hh={key:6,class:"text-xs font-mono text-retro-cyan bg-retro-cyan/10 px-1.5 py-0.5 rounded flex-shrink-0"},Oh=["title"],Uh={class:"text-xs text-retro-muted mt-1 truncate pl-6"},jh={class:"text-xs text-retro-muted/60 mt-1 pl-6"},zh={class:"truncate"},Vh={class:"truncate"},Wh={class:"truncate"},Gh=Ce({__name:"ConversationItem",props:{conversation:{},isActive:{type:Boolean},isStreaming:{type:Boolean},isPreviewing:{type:Boolean},autoModeTask:{}},emits:["select","archive","rename"],setup(e,{emit:n}){const t=e,a=n,o=S(!1),l=S("");function c(){l.value=t.conversation.title,o.value=!0}function f(){const v=l.value.trim();v&&v!==t.conversation.title&&a("rename",v),o.value=!1}function m(){o.value=!1}const d=Dn();async function b(v){try{await navigator.clipboard.writeText(v),d.success("Copied to clipboard",1500)}catch{d.error("Failed to copy")}}const C=j(()=>{const v=t.conversation.messages;if(!v.length)return"No messages";const h=v[v.length-1],R=h.content.slice(0,60);return R.length<h.content.length?R+"...":R}),g=j(()=>{const v=new Date(t.conversation.updatedAt),R=new Date().getTime()-v.getTime(),G=Math.floor(R/(1e3*60*60*24));return G===0?v.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):G===1?"Yesterday":G<7?`${G} days ago`:v.toLocaleDateString()});return(v,h)=>(i(),u("div",{class:ve(["p-3 rounded border cursor-pointer transition-colors",[e.isPreviewing&&e.isActive?"border-retro-red bg-retro-red/20 ring-1 ring-retro-red/60 shadow-[0_0_0_1px_rgba(248,113,113,0.35)]":e.isPreviewing?"border-retro-red/40 bg-retro-red/10":e.isActive?"border-retro-cyan bg-retro-cyan/10":"border-retro-border hover:border-retro-cyan/50"]]),onClick:h[8]||(h[8]=R=>a("select"))},[r("div",Rh,[r("div",Ph,[o.value?(i(),u("div",{key:0,class:"flex gap-2",onClick:h[1]||(h[1]=lt(()=>{},["stop"]))},[Te(r("input",{"onUpdate:modelValue":h[0]||(h[0]=R=>l.value=R),onKeyup:[ln(f,["enter"]),ln(m,["escape"])],onBlur:f,class:"flex-1 px-2 py-1 text-sm font-mono bg-retro-black border border-retro-cyan rounded text-retro-text focus:outline-none focus:ring-1 focus:ring-retro-cyan",autofocus:""},null,544),[[ft,l.value]])])):(i(),u("div",Dh,[e.isStreaming?(i(),u("div",Ih,[...h[9]||(h[9]=[r("div",{class:"w-4 h-4 rounded-full bg-retro-cyan/30 animate-pulse"},null,-1),r("div",{class:"absolute inset-0 flex items-center justify-center"},[r("div",{class:"w-2 h-2 rounded-full bg-retro-cyan animate-ping"})],-1)])])):(i(),ce(s(Yo),{key:1,class:"w-4 h-4 text-retro-muted flex-shrink-0 -translate-y-px"})),r("h3",Lh,_(e.conversation.title),1),e.conversation.finalized?(i(),u("span",Nh," finalized ")):e.isPreviewing?(i(),u("span",{key:3,class:ve(["text-xs font-mono px-1.5 py-0.5 rounded flex-shrink-0",e.isActive?"text-retro-red bg-retro-red/20 border border-retro-red/40":"text-retro-red bg-retro-red/10"])}," previewing ",2)):H("",!0),e.conversation.autoMode&&e.autoModeTask?(i(),u("span",{key:4,class:ve(["text-xs font-mono px-1.5 py-0.5 rounded flex-shrink-0",{"text-retro-yellow bg-retro-yellow/10":e.autoModeTask.state==="running"||e.autoModeTask.state==="queued","text-retro-green bg-retro-green/10":e.autoModeTask.state==="completed","text-retro-red bg-retro-red/10":e.autoModeTask.state==="failed","text-retro-muted bg-retro-muted/10":e.autoModeTask.state==="skipped"}])},[e.autoModeTask.state==="running"&&e.autoModeTask.currentStep?(i(),u(he,{key:0},[we(_(e.autoModeTask.currentStep),1)],64)):e.autoModeTask.state==="queued"?(i(),u(he,{key:1},[we("queued")],64)):e.autoModeTask.state==="completed"?(i(),u(he,{key:2},[we("done")],64)):e.autoModeTask.state==="failed"?(i(),u(he,{key:3},[we("failed")],64)):e.autoModeTask.state==="skipped"?(i(),u(he,{key:4},[we("skipped")],64)):(i(),u(he,{key:5},[we("auto")],64))],2)):e.conversation.autoMode?(i(),u("span",Fh," auto ")):H("",!0),e.isStreaming?(i(),u("span",Hh," streaming ")):H("",!0)])),e.autoModeTask?.state==="failed"&&e.autoModeTask.error?(i(),u("p",{key:2,class:"text-xs text-retro-red mt-1 truncate pl-6",title:e.autoModeTask.error},_(e.autoModeTask.error),9,Oh)):H("",!0),r("p",Uh,_(C.value),1),r("p",jh,_(g.value),1),e.conversation.worktreeBranch||e.conversation.baseBranch?(i(),u("div",{key:3,class:"mt-1.5 pl-6 flex flex-wrap gap-1",onClick:h[5]||(h[5]=lt(()=>{},["stop"]))},[e.conversation.baseBranch?(i(),u("button",{key:0,onClick:h[2]||(h[2]=R=>b(e.conversation.baseBranch)),class:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs font-mono rounded border border-retro-cyan/30 text-retro-cyan hover:border-retro-cyan hover:bg-retro-cyan/10 transition-colors max-w-full",title:"Click to copy base branch"},[Y(s(Nr),{class:"w-3 h-3 flex-shrink-0"}),r("span",zh,"base: "+_(e.conversation.baseBranch),1)])):H("",!0),r("button",{onClick:h[3]||(h[3]=R=>b(e.conversation.worktreeBranch)),class:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs font-mono rounded border border-retro-green/30 text-retro-green hover:border-retro-green hover:bg-retro-green/10 transition-colors max-w-full",title:"Click to copy branch"},[Y(s(Nr),{class:"w-3 h-3 flex-shrink-0"}),r("span",Vh,_(e.conversation.worktreeBranch),1)]),e.conversation.worktreePath?(i(),u("button",{key:1,onClick:h[4]||(h[4]=R=>b(e.conversation.worktreePath)),class:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs font-mono rounded border border-retro-muted/30 text-retro-muted hover:border-retro-muted hover:bg-retro-muted/10 transition-colors max-w-full",title:"Click to copy path"},[Y(s(Fr),{class:"w-3 h-3 flex-shrink-0"}),r("span",Wh,_(e.conversation.worktreePath),1)])):H("",!0)])):H("",!0)]),r("div",{class:"flex gap-1 flex-shrink-0",onClick:h[7]||(h[7]=lt(()=>{},["stop"]))},[r("button",{onClick:c,class:"p-1 hover:bg-retro-panel rounded transition-colors",title:"Rename conversation"},[Y(s(rs),{class:"w-4 h-4 text-retro-muted hover:text-retro-cyan"})]),r("button",{onClick:h[6]||(h[6]=R=>a("archive")),class:"p-1 hover:bg-retro-cyan/20 rounded transition-colors",title:"Archive conversation"},[Y(s(Lr),{class:"w-4 h-4 text-retro-muted hover:text-retro-cyan"})])])])],2))}}),qh={class:"h-full flex flex-col bg-retro-black"},Zh={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border space-y-2"},Kh={class:"flex items-center justify-between gap-2"},Yh={class:"flex items-center gap-1"},Xh={class:"inline-flex items-center gap-1"},Qh={class:"inline-flex items-center gap-1"},Jh={class:"relative"},ep=["placeholder"],tp={key:0,class:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-retro-yellow/10 border-b border-retro-yellow/30 text-xs"},np={class:"text-retro-yellow font-mono"},rp={class:"flex-1 overflow-y-auto p-2"},op={key:0,class:"space-y-1"},sp={key:1,class:"text-center py-6 text-retro-muted"},ap={class:"font-mono text-xs"},ip={key:1,class:"text-center py-8 text-retro-muted"},lp={key:0,class:"space-y-2"},cp={class:"flex items-start justify-between gap-2"},up={class:"min-w-0"},dp={class:"text-sm font-mono text-retro-text truncate"},fp={class:"text-xs text-retro-muted mt-1 truncate"},mp={class:"text-xs text-retro-muted/70 mt-1"},hp={class:"text-xs text-retro-muted/70"},pp={class:"flex items-center gap-1 flex-shrink-0"},vp=["onClick"],gp=["onClick"],xp={key:1,class:"text-center py-6 text-retro-muted"},bp={class:"font-mono text-xs"},yp={key:1,class:"text-center py-8 text-retro-muted"},wp=Ce({__name:"ConversationsPanel",setup(e){const n=ht(),t=Cs(),a=Dn(),o=j(()=>{const Z=new Map;for(const P of t.tasks)Z.set(P.featureId,P);return Z}),l=j(()=>{const Z=new Map;for(const P of t.tasks)Z.set(P.featureId,`${P.state}|${P.currentStep||""}|${P.error||""}`);return Z});function c(Z){if(Z)return o.value.get(Z)}function f(Z){return Z&&l.value.get(Z)||""}const m=S(""),d=S(""),b=S(!1),C=S(!1),g=S(!1),v=S(!1),h=S(null);let R=null;Me(m,Z=>{R&&clearTimeout(R),R=setTimeout(()=>{d.value=Z},180)},{immediate:!0}),bt(()=>{R&&(clearTimeout(R),R=null)});const G=new Map,I=new Map;Me(()=>n.sortedConversations.map(Z=>Z.id),Z=>{const P=new Set(Z);for(const $ of G.keys())P.has($)||G.delete($)},{immediate:!0}),Me(()=>n.sortedArchivedConversations.map(Z=>Z.id),Z=>{const P=new Set(Z);for(const $ of I.keys())P.has($)||I.delete($)},{immediate:!0});function ee(Z){const P=Z.messages[Z.messages.length-1];return[Z.updatedAt,Z.title,Z.messages.length,P?.id||"",P?.content?.length||0].join("|")}function te(Z){const P=Z.messages[Z.messages.length-1];return[Z.updatedAt,Z.archivedAt,Z.title,Z.messages.length,P?.id||"",P?.content?.length||0].join("|")}function V(Z){const P=ee(Z),$=G.get(Z.id);if($&&$.signature===P)return $.text;const L=[Z.title,...Z.messages.map(x=>x.content||"")].join(`
|
|
101
|
+
`).toLowerCase();return G.set(Z.id,{signature:P,text:L}),L}function re(Z){const P=te(Z),$=I.get(Z.id);if($&&$.signature===P)return $.text;const L=[Z.title,...Z.messages.map(x=>x.content||"")].join(`
|
|
102
|
+
`).toLowerCase();return I.set(Z.id,{signature:P,text:L}),L}const ue=j(()=>n.conversationViewMode==="archive"),se=j(()=>{const Z=n.sortedConversations;if(!d.value.trim())return Z;const P=d.value.toLowerCase().trim();return Z.filter($=>V($).includes(P))}),ne=j(()=>{const Z=n.sortedArchivedConversations;if(!d.value.trim())return Z;const P=d.value.toLowerCase().trim();return Z.filter($=>re($).includes(P))}),K=j(()=>n.previewingConversationId);async function W(){if(n.checkStorageLimits().atLimit){a.error("Delete or archive a conversation first (limit: 100).");return}b.value=!0}async function U(Z){C.value=!0;try{if(!await n.createConversation({baseBranch:Z})){a.error("Failed to create conversation");return}b.value=!1}catch(P){a.error(P instanceof Error?P.message:"Failed to create conversation")}finally{C.value=!1}}function F(Z){n.selectConversation(Z),n.setConversationViewMode("active")}async function B(Z){const P=await n.archiveConversation(Z);if(!P.success){a.error(P.error||"Failed to archive conversation");return}a.success("Conversation archived")}async function X(Z){h.value=Z,g.value=!0}function M(){g.value=!1,h.value=null}async function p(Z){if(h.value){v.value=!0;try{const P=await n.restoreArchivedConversation(h.value,Z);if(!P.success){a.error(P.error||"Failed to restore archived conversation");return}a.success("Archived conversation restored"),g.value=!1,h.value=null}finally{v.value=!1}}}async function E(Z){const P=await n.deleteArchivedConversation(Z);if(!P.success){a.error(P.error||"Failed to delete archived conversation");return}a.success("Archived conversation deleted")}function Q(Z,P){n.renameConversation(Z,P)}function le(Z){return new Date(Z).toLocaleString()}function fe(Z){if(!Z.length)return"No messages";const $=(Z[Z.length-1].content||"").trim();return $?$.length>80?`${$.slice(0,80)}...`:$:"No messages"}return(Z,P)=>(i(),u("div",qh,[r("div",Zh,[r("div",Kh,[r("button",{onClick:W,class:"flex items-center gap-1 px-2 py-1 text-xs font-mono bg-retro-cyan/10 text-retro-cyan border border-retro-cyan/30 rounded hover:bg-retro-cyan/20 transition-colors"},[Y(s(pr),{class:"w-3.5 h-3.5"}),P[8]||(P[8]=we(" New ",-1))]),r("div",Yh,[r("button",{onClick:P[0]||(P[0]=$=>s(n).setConversationViewMode("active")),class:ve(["px-2 py-1 text-xs font-mono rounded border transition-colors",ue.value?"border-retro-border text-retro-muted hover:text-retro-cyan":"border-retro-cyan text-retro-cyan bg-retro-cyan/10"]),title:"Active conversations"},[r("span",Xh,[Y(s(Zs),{class:"w-3.5 h-3.5"}),P[9]||(P[9]=we(" Active ",-1))])],2),r("button",{onClick:P[1]||(P[1]=$=>s(n).setConversationViewMode("archive")),class:ve(["px-2 py-1 text-xs font-mono rounded border transition-colors",ue.value?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-cyan"]),title:"Archived conversations"},[r("span",Qh,[Y(s(Lr),{class:"w-3.5 h-3.5"}),P[10]||(P[10]=we(" Archive ",-1))])],2)])]),r("div",Jh,[Y(s(Zn),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted"}),Te(r("input",{"onUpdate:modelValue":P[2]||(P[2]=$=>m.value=$),type:"text",placeholder:ue.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,ep),[[ft,m.value]])])]),s(n).isNearStorageLimit?(i(),u("div",tp,[Y(s(Cn),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("p",np,_(s(n).conversationCount)+" active conversations. Limit is 100. ",1)])):H("",!0),r("div",rp,[ue.value?(i(),u(he,{key:1},[s(n).hasArchivedConversations?(i(),u("div",lp,[ne.value.length>0?(i(!0),u(he,{key:0},Be(ne.value,($,L,x,N)=>{const q=[$.id,$.title,$.updatedAt,$.archivedAt,$.messages.length];if(N&&N.key===$.id&&vo(N,q))return N;const ie=(i(),u("div",{key:$.id,onClick:ae=>X($.id),onKeydown:[ln(lt(ae=>X($.id),["prevent"]),["enter"]),ln(lt(ae=>X($.id),["prevent"]),["space"])],class:"w-full text-left p-3 rounded border border-retro-border hover:border-retro-cyan/50 hover:bg-retro-cyan/5 transition-colors",role:"button",tabindex:"0"},[r("div",cp,[r("div",up,[r("h3",dp,_($.title),1),r("p",fp,_(fe($.messages)),1),r("p",mp," Archived: "+_(le($.archivedAt)),1),r("p",hp," Updated: "+_(le($.updatedAt)),1)]),r("div",pp,[r("button",{onClick:lt(ae=>X($.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"},[Y(s(Lr),{class:"w-3.5 h-3.5"}),P[12]||(P[12]=we(" Restore ",-1))],8,vp),r("button",{onClick:lt(ae=>E($.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"},[Y(s(cn),{class:"w-3.5 h-3.5"}),P[13]||(P[13]=we(" Delete ",-1))],8,gp)])])],40,["onClick","onKeydown"]));return ie.memo=q,ie},P,5),128)):(i(),u("div",xp,[r("p",bp,'No archived results for "'+_(m.value)+'"',1)]))])):(i(),u("div",yp,[...P[14]||(P[14]=[r("p",{class:"font-mono text-sm"},"No archived conversations",-1),r("p",{class:"text-xs mt-1"},"Archived conversations will appear here",-1)])]))],64)):(i(),u(he,{key:0},[s(n).hasConversations?(i(),u("div",op,[se.value.length>0?(i(!0),u(he,{key:0},Be(se.value,($,L,x,N)=>{const q=[$.id,$.title,$.updatedAt,$.messages.length,$.finalized,$.id===s(n).activeConversationId,s(n).isConversationStreaming($.id),K.value===$.id,f($.featureId)];if(N&&N.key===$.id&&vo(N,q))return N;const ie=(i(),u("div",{key:$.id},[Y(Gh,{conversation:$,"is-active":$.id===s(n).activeConversationId,"is-streaming":s(n).isConversationStreaming($.id),"is-previewing":K.value===$.id,"auto-mode-task":$.autoMode?c($.featureId):void 0,onSelect:ae=>F($.id),onArchive:ae=>B($.id),onRename:ae=>Q($.id,ae)},null,8,["conversation","is-active","is-streaming","is-previewing","auto-mode-task","onSelect","onArchive","onRename"])]));return ie.memo=q,ie},P,3),128)):(i(),u("div",sp,[r("p",ap,'No results for "'+_(m.value)+'"',1)]))])):(i(),u("div",ip,[...P[11]||(P[11]=[r("p",{class:"font-mono text-sm"},"No conversations",-1),r("p",{class:"text-xs mt-1"},'Click "New" to start',-1)])]))],64))]),Y(Gr,{show:b.value,creating:C.value,onClose:P[7]||(P[7]=$=>b.value=!1),onCreate:U},null,8,["show","creating"]),Y(Gr,{show:g.value,creating:v.value,onClose:M,onCreate:p},null,8,["show","creating"])]))}}),kp={mobile:768,tablet:1024};function Cp(e,n){return e<n.mobile?"mobile":e<n.tablet?"tablet":"desktop"}const Ss=hr("layout",{state:()=>({currentViewport:"desktop",chatFullscreen:!1}),getters:{isMobile:e=>e.currentViewport==="mobile",isTablet:e=>e.currentViewport==="tablet",isDesktop:e=>e.currentViewport==="desktop",isChatFullscreen:e=>e.chatFullscreen},actions:{updateViewport(e){this.currentViewport=Cp(e,kp)},toggleChatFullscreen(){this.chatFullscreen=!this.chatFullscreen},setChatFullscreen(e){this.chatFullscreen=e}}});function $p(){const e=S(null),n=S(!0);let t=null,a="smooth";const o=50;function l(){const g=e.value;return g?g.scrollHeight-g.scrollTop-g.clientHeight<o:!0}function c(){n.value=l()}function f(g="smooth"){if(a=g,t!==null)return;t=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):h=>setTimeout(()=>h(Date.now()),16))(()=>{t=null,gn(()=>{const h=e.value;h&&h.scrollTo({top:h.scrollHeight,behavior:a})})})}function m(g="smooth"){f(g),n.value=!0}function d(g="smooth"){n.value&&f(g)}function b(){n.value=!0}function C(){n.value=!1}return{containerRef:e,shouldAutoScroll:be(n),onScroll:c,scrollToBottom:f,forceScrollToBottom:m,maybeScrollToBottom:d,enableAutoScroll:b,disableAutoScroll:C}}function Sp(e){if(!e)return null;if(e instanceof HTMLElement)return e;if(typeof e=="object"&&"$el"in e){const n=e.$el;return n instanceof HTMLElement?n:null}return null}function _p(e){const{allMessages:n,containerRef:t,estimateItemHeight:a=120,overscan:o=6}=e,l=S(0),c=S(0),f=S(new Map),m=new Map;let d=null;function b(ee,te){if(!Number.isFinite(te)||te<=0)return;const V=Math.ceil(te);if(f.value.get(ee)===V)return;const re=new Map(f.value);re.set(ee,V),f.value=re}function C(ee,te){b(ee,te.getBoundingClientRect().height)}function g(ee,te){const V=m.get(ee);V&&d&&d.unobserve(V),V&&delete V.dataset.virtualMessageId,m.delete(ee);const re=Sp(te);re&&(re.dataset.virtualMessageId=ee,m.set(ee,re),C(ee,re),d&&d.observe(re))}function v(){const ee=t.value;ee&&(l.value=ee.scrollTop)}const h=j(()=>{const ee=n.value,te=new Array(ee.length);let V=0;for(let re=0;re<ee.length;re++)te[re]=V,V+=f.value.get(ee[re].id)??a;return{offsets:te,totalHeight:V}});function R(ee,te){let V=0,re=ee.length-1,ue=ee.length;for(;V<=re;){const se=Math.floor((V+re)/2);ee[se]>=te?(ue=se,re=se-1):V=se+1}return ue===ee.length?Math.max(0,ee.length-1):ue}const G=j(()=>{const ee=n.value;if(ee.length===0)return[];const{offsets:te}=h.value,V=l.value,re=V+Math.max(c.value,1),ue=R(te,Math.max(0,V-a));let se=ue;for(;se<ee.length&&te[se]<re;)se++;const ne=Math.max(0,ue-o),K=Math.min(ee.length,se+o),W=[];for(let U=ne;U<K;U++)W.push({message:ee[U],index:U,top:te[U]});return W}),I=j(()=>h.value.totalHeight);return st(()=>{const ee=t.value;ee&&(c.value=ee.clientHeight,l.value=ee.scrollTop),d=new ResizeObserver(te=>{for(const V of te){const re=V.target;if(t.value&&re===t.value){c.value=V.contentRect.height;continue}const ue=re.dataset.virtualMessageId;ue&&b(ue,V.contentRect.height)}}),t.value&&d.observe(t.value);for(const[te,V]of m)V.dataset.virtualMessageId=te,d.observe(V),C(te,V)}),bt(()=>{d&&(d.disconnect(),d=null),m.clear()}),{visibleItems:G,totalHeight:I,onVirtualScroll:v,setItemRef:g}}const Mp=["innerHTML"],Tp=Ce({__name:"ChatTextBlock",props:{block:{}},setup(e){const n=e,{renderMarkdown:t}=$s(),a=j(()=>t(n.block.text));return(o,l)=>e.block.text.trim()?(i(),u("div",{key:0,class:"text-sm font-mono text-retro-text break-words chat-markdown",innerHTML:s(a)},null,8,Mp)):H("",!0)}}),Ap={class:"my-1 border border-retro-border/30 rounded bg-retro-dark/30"},Bp={class:"ml-auto text-retro-muted/60 text-[10px]"},Ep={key:0,class:"px-3 pb-2 text-xs font-mono text-retro-muted whitespace-pre-wrap max-h-60 overflow-y-auto scrollbar-custom border-t border-retro-border/20"},Rp=Ce({__name:"ChatThinkingBlock",props:{block:{}},setup(e){const n=S(!1);return(t,a)=>(i(),u("div",Ap,[r("button",{class:"flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-retro-muted hover:text-retro-yellow transition-colors",onClick:a[0]||(a[0]=o=>n.value=!s(n))},[Y(s(Yr),{class:ve(["w-3 h-3 transition-transform flex-shrink-0",{"rotate-90":s(n)}])},null,8,["class"]),a[1]||(a[1]=r("span",{class:"text-retro-yellow"},"Thinking",-1)),r("span",Bp,_(e.block.thinking.length)+" chars ",1)]),s(n)?(i(),u("div",Ep,_(e.block.thinking),1)):H("",!0)]))}}),Pp={class:"my-2 border border-retro-border/30 rounded"},Dp={key:0,class:"w-3 h-3 border-2 border-retro-yellow border-t-transparent rounded-full animate-spin flex-shrink-0"},Ip={class:"text-retro-cyan font-bold"},Lp={class:"text-retro-muted truncate"},Np={key:0,class:"px-3 pb-2 border-t border-retro-border/20"},Fp={class:"text-xs font-mono text-retro-muted space-y-2 mt-2"},Hp={key:0,class:"flex items-start gap-2"},Op={class:"text-retro-cyan break-all"},Up={key:1,class:"flex items-start gap-2"},jp={key:0,class:"mt-2"},zp={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-52 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},Vp={key:0,class:"text-[10px] text-retro-muted mt-1"},Wp={key:1,class:"mt-2"},Gp={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-40 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},qp={key:0,class:"text-[10px] text-retro-muted mt-1"},Zp={key:2,class:"mt-2"},Kp={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-40 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},Yp={key:0,class:"text-[10px] text-retro-muted mt-1"},Xp={class:"mt-2"},Qp={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded mt-1 overflow-x-auto max-h-40 overflow-y-auto scrollbar-custom"},Jp={key:1,class:"px-3 pb-2 border-t border-retro-border/20"},ev={class:"whitespace-pre-wrap"},tv={class:"whitespace-pre-wrap"},nv=Ce({__name:"ChatToolBlock",props:{block:{},result:{}},setup(e){const n=e,t=S(!1),a=S(!1);function o(se,ne){for(const K of ne){const W=se[K];if(typeof W=="string"&&W.trim())return W}return""}function l(se,ne){for(const K of ne){const W=se[K];if(typeof W=="number"&&Number.isFinite(W))return W;if(typeof W=="string"&&W.trim()){const U=Number(W);if(Number.isFinite(U))return U}}return null}function c(se,ne=14,K=1400){if(!se)return{text:"",truncated:!1};const W=se.split(`
|
|
103
|
+
`);let U=W.slice(0,ne).join(`
|
|
104
|
+
`),F=W.length>ne;return U.length>K&&(U=U.slice(0,K),F=!0),{text:U,truncated:F}}const f=j(()=>n.block.name.toLowerCase()),m=j(()=>f.value==="read"),d=j(()=>f.value==="write"),b=j(()=>f.value==="edit"||f.value==="multiedit"),C=j(()=>o(n.block.input,["file_path","path","file","filepath","target_file"])),g=j(()=>{const se=l(n.block.input,["offset","start_line","line"]),ne=l(n.block.input,["limit","lines","line_count"]),K=l(n.block.input,["end_line"]);return se!==null&&ne!==null?`from line ${se}, ${ne} lines`:se!==null&&K!==null?`lines ${se}-${K}`:se!==null?`from line ${se}`:ne!==null?`${ne} lines`:""}),v=j(()=>o(n.block.input,["content","text","new_content"])),h=j(()=>o(n.block.input,["old_string","oldText","old"])),R=j(()=>o(n.block.input,["new_string","newText","new","replacement"])),G=j(()=>c(v.value)),I=j(()=>c(h.value,10,1e3)),ee=j(()=>c(R.value,10,1e3)),te=j(()=>{if(m.value){if(C.value&&g.value)return`Read ${C.value} (${g.value})`;if(C.value)return`Read ${C.value}`}return d.value&&C.value?`Write ${C.value}`:b.value&&C.value?`Edit ${C.value}`:n.block.inputSummary}),V=j(()=>{switch(n.block.status){case"running":return"text-retro-yellow";case"pending":return"text-retro-muted";case"complete":return"text-retro-green";case"error":return"text-retro-red"}}),re=j(()=>n.result?n.result.content.split(`
|
|
105
|
+
`).slice(0,3).join(`
|
|
106
|
+
`):""),ue=j(()=>n.result?n.result.content.split(`
|
|
107
|
+
`).length>3||n.result.content.length>300:!1);return(se,ne)=>(i(),u("div",Pp,[r("button",{class:"flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono hover:bg-retro-dark/30 transition-colors",onClick:ne[0]||(ne[0]=K=>t.value=!s(t))},[e.block.status==="running"?(i(),u("span",Dp)):e.block.status==="pending"?(i(),ce(s(Xo),{key:1,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-muted animate-pulse"})):e.block.status==="complete"?(i(),ce(s(vr),{key:2,class:ve(["w-3.5 h-3.5 flex-shrink-0",s(V)])},null,8,["class"])):(i(),ce(s(In),{key:3,class:ve(["w-3.5 h-3.5 flex-shrink-0",s(V)])},null,8,["class"])),r("span",Ip,_(e.block.name),1),r("span",Lp,_(s(te)||e.block.inputSummary),1),Y(s(Yr),{class:ve(["w-3 h-3 ml-auto transition-transform text-retro-muted flex-shrink-0",{"rotate-90":s(t)}])},null,8,["class"])]),s(t)?(i(),u("div",Np,[r("div",Fp,[s(C)?(i(),u("div",Hp,[ne[3]||(ne[3]=r("span",{class:"text-retro-muted/80 min-w-12"},"File",-1)),r("code",Op,_(s(C)),1)])):H("",!0),s(m)&&s(g)?(i(),u("div",Up,[ne[4]||(ne[4]=r("span",{class:"text-retro-muted/80 min-w-12"},"Range",-1)),r("span",null,_(s(g)),1)])):H("",!0)]),s(d)&&s(G).text?(i(),u("div",jp,[ne[5]||(ne[5]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"New Content",-1)),r("pre",zp,_(s(G).text),1),s(G).truncated?(i(),u("div",Vp,"Truncated preview")):H("",!0)])):H("",!0),s(b)&&s(I).text?(i(),u("div",Wp,[ne[6]||(ne[6]=r("div",{class:"text-[11px] font-mono text-retro-yellow mb-1"},"Before",-1)),r("pre",Gp,_(s(I).text),1),s(I).truncated?(i(),u("div",qp,"Truncated preview")):H("",!0)])):H("",!0),s(b)&&s(ee).text?(i(),u("div",Zp,[ne[7]||(ne[7]=r("div",{class:"text-[11px] font-mono text-retro-green mb-1"},"After",-1)),r("pre",Kp,_(s(ee).text),1),s(ee).truncated?(i(),u("div",Yp,"Truncated preview")):H("",!0)])):H("",!0),r("details",Xp,[ne[8]||(ne[8]=r("summary",{class:"text-[11px] font-mono text-retro-muted cursor-pointer hover:text-retro-cyan"},"Raw input JSON",-1)),r("pre",Qp,_(JSON.stringify(e.block.input,null,2)),1)])])):H("",!0),e.result?(i(),u("div",Jp,[r("div",{class:ve(["text-xs font-mono rounded p-2 mt-1 overflow-y-auto scrollbar-custom",e.result.isError?"text-retro-red bg-retro-red/5":"text-retro-muted bg-retro-panel/50"]),style:At(s(a)?"max-height: 20rem":"")},[!s(a)&&s(ue)?(i(),u(he,{key:0},[r("pre",ev,_(s(re)),1),r("button",{class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:ne[1]||(ne[1]=lt(K=>a.value=!0,["stop"]))}," Show full ("+_(e.result.content.length)+" chars) ",1)],64)):(i(),u(he,{key:1},[r("pre",tv,_(e.result.content),1),s(ue)?(i(),u("button",{key:0,class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:ne[2]||(ne[2]=lt(K=>a.value=!1,["stop"]))}," Collapse ")):H("",!0)],64))],6)])):H("",!0)]))}}),rv={class:"mt-2 pt-2 border-t border-retro-border/20 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] font-mono text-retro-muted"},ov={class:"flex items-center gap-1"},sv={class:"flex items-center gap-1"},av=Ce({__name:"ChatResultSummary",props:{block:{}},setup(e){const n=e,t=j(()=>{const l=Math.round(n.block.durationMs/1e3);return l<60?`${l}s`:`${Math.floor(l/60)}m ${l%60}s`}),a=j(()=>`$${n.block.totalCostUsd.toFixed(4)}`),o=j(()=>{const{inputTokens:l,outputTokens:c}=n.block.usage;return`${l.toLocaleString()} in / ${c.toLocaleString()} out`});return(l,c)=>(i(),u("div",rv,[r("span",ov,[c[0]||(c[0]=r("span",{class:"text-retro-muted/60"},"time",-1)),we(" "+_(s(t)),1)]),r("span",sv,[c[1]||(c[1]=r("span",{class:"text-retro-muted/60"},"cost",-1)),we(" "+_(s(a)),1)]),r("span",null,_(s(o)),1),r("span",null,_(e.block.numTurns)+" turn"+_(e.block.numTurns!==1?"s":""),1)]))}}),iv={class:"px-2 py-1 text-[10px] font-mono text-retro-muted border-b border-retro-border/20 mb-1 flex items-center gap-2"},lv={class:"text-retro-cyan"},cv={key:0,class:"text-retro-border"},uv={key:1},dv=Ce({__name:"ChatSessionInit",props:{block:{}},setup(e){return(n,t)=>(i(),u("div",iv,[r("span",lv,_(e.block.model),1),t[0]||(t[0]=r("span",{class:"text-retro-border"},"|",-1)),r("span",null,_(e.block.tools.length)+" tools",1),e.block.permissionMode?(i(),u("span",cv,"|")):H("",!0),e.block.permissionMode?(i(),u("span",uv,_(e.block.permissionMode),1)):H("",!0)]))}}),fv=Ce({__name:"ChatContentBlock",props:{block:{},allBlocks:{}},setup(e){const n=e,t=j(()=>{if(n.block.type!=="tool_use")return;const a=n.block.toolUseId;return n.allBlocks.find(o=>o.type==="tool_result"&&o.toolUseId===a)});return(a,o)=>{const l=Tp,c=Rp,f=nv,m=av,d=dv;return e.block.type==="text"?(i(),ce(l,{key:0,block:e.block},null,8,["block"])):e.block.type==="thinking"?(i(),ce(c,{key:1,block:e.block},null,8,["block"])):e.block.type==="tool_use"?(i(),ce(f,{key:2,block:e.block,result:s(t)},null,8,["block","result"])):e.block.type==="result_summary"?(i(),ce(m,{key:3,block:e.block},null,8,["block"])):e.block.type==="session_init"?(i(),ce(d,{key:4,block:e.block},null,8,["block"])):H("",!0)}}}),mv={class:"flex-1 min-w-0"},hv={class:"flex items-center gap-2 mb-1"},pv={class:"text-xs font-mono text-retro-muted"},vv={key:0,class:"text-xs font-mono text-retro-yellow animate-pulse"},gv={key:1,class:"text-xs font-mono text-retro-muted"},xv={key:2,class:"text-xs font-mono text-retro-red"},bv=["innerHTML"],yv={key:2,class:"text-xs font-mono text-retro-muted italic"},wv={key:3,class:"inline-block w-2 h-4 bg-retro-cyan animate-pulse ml-0.5"},kv=Ce({__name:"ChatMessage",props:{message:{}},setup(e){const n=e,t=j(()=>n.message.role==="user"),a=j(()=>n.message.status==="streaming"),o=j(()=>n.message.status==="error"),l=j(()=>n.message.status==="stopped"),c=j(()=>Fs(n.message)),f=j(()=>n.message.contentBlocks?n.message.contentBlocks.filter(g=>g.type!=="tool_result"):[]),m=j(()=>c.value&&f.value.length>0),d=j(()=>n.message.content.trim().length>0),b=g=>new Date(g).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),C=j(()=>{let g=n.message.content;return g=g.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),g=g.replace(/```(\w*)\n?([\s\S]*?)```/g,'<pre class="bg-retro-panel p-3 rounded my-2 overflow-x-auto"><code class="text-retro-cyan">$2</code></pre>'),g=g.replace(/`([^`]+)`/g,'<code class="bg-retro-panel px-1 rounded text-retro-cyan">$1</code>'),g=g.replace(/\*\*([^*]+)\*\*/g,'<strong class="text-retro-text font-bold">$1</strong>'),g=g.replace(/\n/g,"<br>"),g});return(g,v)=>{const h=fv;return i(),u("div",{class:ve(["flex gap-3 p-3",[s(t)?"bg-retro-dark/50":"bg-transparent",s(o)?"border-l-2 border-retro-red":""]])},[r("div",{class:ve(["flex-shrink-0 w-6 h-6 rounded flex items-center justify-center",s(t)?"bg-retro-cyan/20":"bg-retro-green/20"])},[s(t)?(i(),ce(s(Hr),{key:0,class:"w-4 h-4 text-retro-cyan"})):(i(),ce(s(es),{key:1,class:"w-4 h-4 text-retro-green"}))],2),r("div",mv,[r("div",hv,[r("span",{class:ve(["text-xs font-mono",s(t)?"text-retro-cyan":"text-retro-green"])},_(s(t)?"You":"Assistant"),3),r("span",pv,_(b(e.message.timestamp)),1),s(a)?(i(),u("span",vv," typing... ")):H("",!0),s(l)?(i(),u("span",gv," (stopped) ")):H("",!0),s(o)?(i(),u("span",xv," (error) ")):H("",!0)]),s(m)?(i(!0),u(he,{key:0},Be(s(f),R=>(i(),ce(h,{key:R.id,block:R,"all-blocks":e.message.contentBlocks},null,8,["block","all-blocks"]))),128)):s(d)?(i(),u("div",{key:1,class:"text-sm font-mono text-retro-text break-words",innerHTML:s(C)},null,8,bv)):!s(t)&&!s(a)?(i(),u("div",yv," (no visible response content) ")):H("",!0),s(a)?(i(),u("span",wv)):H("",!0)])],2)}}}),Cv={key:0,class:"flex flex-col items-center justify-center h-full p-8 text-center"},$v={key:1,class:"relative"},Sv={class:"sticky bottom-0"},_v={key:0,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50 backdrop-blur-sm"},Mv={key:1,class:"px-4 py-2.5 bg-retro-red/20 border-t border-retro-red/50"},Tv={class:"flex items-start gap-2"},Av={class:"flex-1 min-w-0"},Bv={class:"flex items-center justify-between gap-2 mb-0.5"},Ev={class:"text-xs font-mono text-retro-red/80 break-words whitespace-pre-wrap"},Rv={key:2,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50"},Pv=Ce({__name:"ChatMessages",setup(e){const n=ht(),{containerRef:t,onScroll:a,maybeScrollToBottom:o,scrollToBottom:l,forceScrollToBottom:c}=$p(),{visibleItems:f,totalHeight:m,onVirtualScroll:d,setItemRef:b}=_p({allMessages:j(()=>n.messages),containerRef:t});function C(){a(),d()}const g=j(()=>n.isActiveConversationStreaming),v=j(()=>{const R=n.lastMessage;return!R||R.role!=="assistant"?null:R.status}),h=S(!1);return st(()=>{l("instant")}),Me(()=>n.activeConversationId,()=>{h.value=!1,l("instant")}),Me(()=>[n.activeConversationId,n.messages.length],([R,G])=>{!R||G===0||h.value||(h.value=!0,c("instant"))},{immediate:!0}),Me(()=>n.messages.length,()=>{o("instant")}),Me(()=>n.lastMessage?.content,()=>{o("instant")}),Me([g,()=>n.lastError],()=>{o("instant")}),Me(m,()=>{o("instant")}),(R,G)=>(i(),u("div",{ref_key:"containerRef",ref:t,class:"flex-1 overflow-y-auto",onScroll:C},[s(n).hasMessages?(i(),u("div",$v,[r("div",{class:"relative",style:At({height:`${s(m)}px`})},[(i(!0),u(he,null,Be(s(f),I=>(i(),u("div",{key:I.message.id,class:"absolute left-0 right-0 border-b border-retro-border/30",style:At({transform:`translateY(${I.top}px)`})},[r("div",{ref_for:!0,ref:ee=>s(b)(I.message.id,ee)},[Oo([I.message.id,I.message.status,I.message.content,I.message.contentBlocks?.length||0,I.message.tools?.length||0],()=>Y(kv,{message:I.message},null,8,["message"]),G,0)],512)],4))),128))],4)])):(i(),u("div",Cv,[...G[2]||(G[2]=[r("div",{class:"text-retro-muted text-sm font-mono mb-2"}," No messages yet ",-1),r("div",{class:"text-retro-muted text-xs font-mono"}," Send a message to start chatting ",-1)])])),r("div",Sv,[s(g)&&!s(n).lastError?(i(),u("div",_v,[...G[3]||(G[3]=[Bs('<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)])])):H("",!0),s(n).lastError?(i(),u("div",Mv,[r("div",Tv,[Y(s(In),{class:"w-4 h-4 text-retro-red flex-shrink-0 mt-0.5"}),r("div",Av,[r("div",Bv,[G[4]||(G[4]=r("p",{class:"text-xs font-mono font-semibold text-retro-red"},"Error",-1)),r("button",{class:"text-xs font-mono text-retro-red/60 hover:text-retro-red underline",onClick:G[1]||(G[1]=I=>s(n).clearError())}," Dismiss ")]),r("p",Ev,_(s(n).lastError),1),G[5]||(G[5]=r("p",{class:"text-xs font-mono text-retro-muted mt-1"}," Check browser console (F12) for more details ",-1))])])])):s(v)==="stopped"?(i(),u("div",Rv,[...G[6]||(G[6]=[r("div",{class:"flex items-center gap-2"},[r("span",{class:"w-2 h-2 rounded-full bg-retro-muted"}),r("span",{class:"text-xs font-mono text-retro-muted"},"Stopped")],-1)])])):H("",!0)])],544))}});function Dv(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"fill-rule":"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z","clip-rule":"evenodd"})])}function Iv(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"fill-rule":"evenodd",d:"M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z","clip-rule":"evenodd"})])}function Lv(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})])}function Nv(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"fill-rule":"evenodd",d:"M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z","clip-rule":"evenodd"})])}const Fv={class:"flex-shrink-0 border-t border-retro-border bg-retro-dark p-3"},Hv={class:"flex items-center gap-2 mb-2"},Ov={class:"relative mode-selector"},Uv={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]"},jv=["onClick"],zv={class:"text-xs font-mono text-retro-muted"},Vv={key:0,class:"mb-3 p-3 bg-retro-yellow/10 border border-retro-yellow/50 rounded"},Wv={class:"flex items-center justify-between gap-3"},Gv={class:"flex-1 min-w-0"},qv={class:"text-xs font-mono text-retro-text truncate"},Zv={class:"text-retro-cyan"},Kv={key:0,class:"text-retro-muted"},Yv={key:1,class:"text-retro-muted"},Xv={key:1,class:"mb-3 p-3 bg-retro-cyan/10 border border-retro-cyan/50 rounded"},Qv={class:"flex gap-2 items-end"},Jv={class:"flex-1 relative"},eg=["disabled","placeholder"],tg=["disabled"],ng=Ce({__name:"ChatInput",props:{disabled:{type:Boolean}},setup(e){const n=e,t=ht(),{sendMessage:a,sendPermissionResponse:o,approvePlan:l,rejectPlan:c,abort:f,resetContext:m}=ho(),d=S(""),b=S(null),C=S(!1),g=S(!1),v={plan:Qr,ask:eo,auto:Zr,bypass:to},h={plan:"text-retro-cyan",ask:"text-retro-green",auto:"text-retro-yellow",bypass:"text-retro-red"};function R(x){t.setPermissionMode(x),g.value=!1}function G(x){x.target.closest(".mode-selector")||(g.value=!1)}st(()=>{document.addEventListener("click",G)}),bt(()=>{document.removeEventListener("click",G)});const I=j(()=>d.value.trim().length>0&&!t.isActiveConversationStreaming&&!C.value&&!t.pendingPermission&&!V.value),ee=j(()=>t.isActiveConversationStreaming&&!t.pendingPermission),te=j(()=>t.pendingPermission!==null),V=j(()=>t.pendingPlanApproval!==null);function re(){o(!0,t.activeConversationId)}function ue(){o(!1,t.activeConversationId)}function se(){l(t.activeConversationId)}function ne(){c(t.activeConversationId)}const K=j(()=>{if(t.isActiveConversationStreaming||C.value)return!1;const x=t.lastMessage;return x?.role==="assistant"&&x?.status==="error"});function W(x){const N=x.instructionFiles.length>0?x.instructionFiles.map(ie=>{const ae=ie.source==="cwd"?"cwd":"ancestor",xe=ie.mtime?` (mtime: ${ie.mtime})`:"";return`- \`${ie.path}\` [${ae}] - ${ie.hint}${xe}`}):["- (none detected from current cwd ancestry)"],q=x.specContext.files.length>0?x.specContext.files.map(ie=>`- \`${ie}\``):["- (none)"];return["## Context Snapshot","",`- Time: ${x.generatedAt}`,`- Session state: **${x.sessionState}**`,`- Provider session ID: \`${x.providerSessionId??"(empty)"}\``,`- Provider: \`${x.providerId}\` / \`${x.providerModelKey}\``,`- Permission mode: \`${x.permissionMode}\``,`- CWD (requested): \`${x.requestedCwd}\``,`- CWD (effective): \`${x.effectiveCwd}\``,`- Feature: \`${x.featureId??"(none)"}\``,"","### Spec Context Injection",`- Active on next turn: **${x.specContext.active?"yes":"no"}**`,`- Reason: ${x.specContext.reason}`,...q,"","### Detected Instruction Files",...N].join(`
|
|
108
|
+
`)}function U(x){return(x.match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(q=>q.startsWith('"')&&q.endsWith('"')||q.startsWith("'")&&q.endsWith("'")?q.slice(1,-1):q)}function F(x){const N=x.match(/^\/(?:spec-search|specsearch)\b(.*)$/i);if(!N)return null;const q=U(N[1]?.trim()??""),ie=[],ae={q:""};for(let xe=0;xe<q.length;xe++){const Re=q[xe];if(Re==="--mode"&&q[xe+1]){const Se=q[++xe];(Se==="keyword"||Se==="semantic"||Se==="hybrid")&&(ae.mode=Se);continue}if(Re.startsWith("--mode=")){const Se=Re.slice(7);(Se==="keyword"||Se==="semantic"||Se==="hybrid")&&(ae.mode=Se);continue}if(Re==="--feature"&&q[xe+1]){ae.featureId=q[++xe];continue}if(Re.startsWith("--feature=")){ae.featureId=Re.slice(10);continue}if(Re==="--file-type"&&q[xe+1]){ae.fileType=q[++xe];continue}if(Re.startsWith("--file-type=")){ae.fileType=Re.slice(12);continue}if(Re==="--limit"&&q[xe+1]){const Se=Number.parseInt(q[++xe],10);Number.isFinite(Se)&&Se>0&&(ae.limit=Se);continue}if(Re.startsWith("--limit=")){const Se=Number.parseInt(Re.slice(8),10);Number.isFinite(Se)&&Se>0&&(ae.limit=Se);continue}ie.push(Re)}return ae.q=ie.join(" ").trim(),ae}function B(x,N=260){const q=x.replace(/\s+/g," ").trim();return q.length<=N?q:`${q.slice(0,N)}...`}function X(x,N){const q=[];if(q.push("## Spec Search Results"),q.push(""),q.push(`- Query: \`${x.q}\``),q.push(`- Mode: \`${N.mode}\``),x.featureId&&q.push(`- Feature filter: \`${x.featureId}\``),x.fileType&&q.push(`- File type filter: \`${x.fileType}\``),q.push(`- Hits: **${N.totalCount}** (${N.searchTime}ms)`),N.warning&&q.push(`- Warning: ${N.warning}`),N.results.length===0)return q.push(""),q.push("No matching indexed chunks were found."),q.join(`
|
|
109
|
+
`);q.push("");for(const[ie,ae]of N.results.entries()){const xe=ae.chunk;q.push(`${ie+1}. \`${xe.sourcePath}:${xe.lineStart}\` (${ae.matchType}, score: ${ae.score.toFixed(3)})`),xe.headingHierarchy.length>0&&q.push(` Headings: ${xe.headingHierarchy.join(" > ")}`),q.push(` ${B(xe.content)}`)}return q.join(`
|
|
110
|
+
`)}async function M(x){const N=t.activeConversationId??await t.createConversation(),q=t.addAssistantMessage(N);if(!x.q){t.updateMessage(q.id,{content:["Usage: `/spec-search <query> [--mode keyword|semantic|hybrid] [--feature <feature-id>] [--file-type <type>] [--limit <n>]`","","Examples:","- `/spec-search FR-001`",'- `/spec-search "indexing indicator" --mode hybrid --feature 008-spec-search --limit 5`'].join(`
|
|
111
|
+
`),status:"complete"},N);return}const ie=t.activeConversation,ae={q:x.q,mode:x.mode??"hybrid",featureId:x.featureId??ie?.featureId,fileType:x.fileType,limit:String(x.limit??5)};try{const xe=await $fetch("/api/specs/search",{query:ae});t.updateMessage(q.id,{content:X({...x,mode:ae.mode,featureId:ae.featureId},xe),status:"complete"},N)}catch(xe){const Re=xe instanceof Error?xe.message:"Failed to run spec search";t.updateMessage(q.id,{content:`Spec search failed: ${Re}`,status:"error"},N)}}async function p(){const x=t.activeConversation,N={permissionMode:t.permissionMode};x?.hasWorktree&&x.worktreePath?N.cwd=x.worktreePath:x?.cwd&&(N.cwd=x.cwd),x?.featureId&&(N.featureId=x.featureId),x?.providerId&&(N.providerId=x.providerId),x?.providerModelKey&&(N.providerModelKey=x.providerModelKey),x?.providerSessionId&&(N.providerSessionId=x.providerSessionId);const q=await $fetch("/api/chat/context",{query:N}),ie=t.activeConversationId??await t.createConversation(),ae=t.addAssistantMessage(ie);t.updateMessage(ae.id,{content:W(q),status:"complete"},ie)}async function E(){const x=d.value.trim();if(!x||t.isActiveConversationStreaming||C.value||n.disabled)return;if(x==="/reset"||x==="/reset-context"){await le();return}if(x==="/context"||x==="/ctx"){await p(),d.value="",$();return}const N=F(x);if(N){await M(N),d.value="",$();return}C.value=!0,d.value="",$();try{await t.addUserMessageWithConversation(x);const q=t.activeConversationId,ie=t.addAssistantMessage();t.startSession(`session-${Date.now()}`),t.startConversationStreaming(q);const ae=t.activeConversation,xe={};ae?.hasWorktree&&ae.worktreePath&&(xe.cwd=ae.worktreePath,xe.worktreeBranch=ae.worktreeBranch),ae?.featureId&&(xe.featureId=ae.featureId),await a(x,ie.id,q,Object.keys(xe).length>0?xe:void 0)}catch(q){const ie=q instanceof Error?q.message:"Failed to send message";t.setSessionError(ie);const ae=t.lastMessage;ae&&ae.role==="assistant"&&t.updateMessage(ae.id,{status:"error"}),t.activeConversationId&&(t.endSession(t.activeConversationId),t.endConversationStreaming(t.activeConversationId))}finally{C.value=!1}}async function Q(){try{f(t.activeConversationId)}catch{}}async function le(){if(t.activeConversationId){d.value="",$(),C.value=!0;try{await m(t.activeConversationId);const x=t.addAssistantMessage(t.activeConversationId);t.updateMessage(x.id,{content:"✨ **Context cleared** — The AI conversation context has been reset. Starting fresh from here.",status:"complete"},t.activeConversationId);const{useToast:N}=await Bn(async()=>{const{useToast:ie}=await import("./ChhNAy6p.js").then(ae=>ae.o);return{useToast:ie}},__vite__mapDeps([0,1,2]),import.meta.url);N().success("AI context has been reset. The conversation will start fresh.")}catch(x){console.error("Failed to reset context:",x);const{useToast:N}=await Bn(async()=>{const{useToast:ie}=await import("./ChhNAy6p.js").then(ae=>ae.o);return{useToast:ie}},__vite__mapDeps([0,1,2]),import.meta.url);N().error("Failed to reset context. Please try again.")}finally{C.value=!1}}}async function fe(){const x=t.messages;let N=null;for(let ie=x.length-1;ie>=0;ie--)if(x[ie].role==="user"){N=x[ie].content;break}if(!N||!t.activeConversationId)return;const q=t.activeConversationId;t.clearError(),C.value=!0;try{const ie=t.addAssistantMessage();t.startSession(`session-${Date.now()}`),t.startConversationStreaming(q);const ae=t.activeConversation,xe={};ae?.hasWorktree&&ae.worktreePath&&(xe.cwd=ae.worktreePath,xe.worktreeBranch=ae.worktreeBranch),ae?.featureId&&(xe.featureId=ae.featureId),await a(N,ie.id,q,Object.keys(xe).length>0?xe:void 0)}catch(ie){const ae=ie instanceof Error?ie.message:"Failed to retry message";t.setSessionError(ae);const xe=t.lastMessage;xe&&xe.role==="assistant"&&t.updateMessage(xe.id,{status:"error"}),t.endSession(q),t.endConversationStreaming(q)}finally{C.value=!1}}function Z(x){x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),E())}function P(){const x=b.value;if(x){if(!d.value.trim()){x.style.height="";return}x.style.height="auto",x.style.height=Math.min(x.scrollHeight,200)+"px"}}function $(){const x=b.value;x&&(x.style.height="")}function L(){gn(()=>{b.value?.focus()})}return Me(d,P),Me(()=>t.isActiveConversationStreaming,(x,N)=>{N&&!x&&L()}),Me(()=>t.activeConversationId,()=>{L()}),(x,N)=>(i(),u("div",Fv,[r("div",Hv,[r("div",Ov,[r("button",{class:ve(["flex items-center gap-1.5 px-2 py-1 rounded border border-retro-border/50 hover:border-retro-border text-xs font-mono transition-colors",h[s(t).permissionMode]]),onClick:N[0]||(N[0]=q=>g.value=!s(g))},[(i(),ce(En(v[s(t).permissionMode]),{class:"w-4 h-4"})),r("span",null,_(s(An)[s(t).permissionMode]),1),Y(s(Iv),{class:"w-3 h-3"})],2),s(g)?(i(),u("div",Uv,[(i(),u(he,null,Be(["plan","ask","auto","bypass"],q=>r("button",{key:q,class:ve(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors",[h[q],s(t).permissionMode===q?"bg-retro-panel":""]]),onClick:ie=>R(q)},[(i(),ce(En(v[q]),{class:"w-4 h-4"})),r("span",null,_(s(An)[q]),1)],10,jv)),64))])):H("",!0)]),r("span",zv,_(s(t).permissionMode==="plan"?"Plan only":s(t).permissionMode==="ask"?"Ask before actions":s(t).permissionMode==="auto"?"Auto approve":"All permissions"),1)]),s(te)?(i(),u("div",Vv,[r("div",Wv,[r("div",Gv,[N[2]||(N[2]=r("div",{class:"text-xs font-mono text-retro-yellow font-bold mb-1"}," Permission Required ",-1)),r("div",qv,[r("span",Zv,_(s(t).pendingPermission?.tool),1),s(t).pendingPermission?.filePath?(i(),u("span",Kv," - "+_(s(t).pendingPermission.filePath),1)):s(t).pendingPermission?.command?(i(),u("span",Yv," - "+_(s(t).pendingPermission.command),1)):H("",!0)])]),r("div",{class:"flex gap-2 flex-shrink-0"},[r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-green/20 text-retro-green border border-retro-green/50 hover:bg-retro-green/30 transition-colors",onClick:re}," Allow "),r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-red/20 text-retro-red border border-retro-red/50 hover:bg-retro-red/30 transition-colors",onClick:ue}," Deny ")])])])):H("",!0),s(V)?(i(),u("div",Xv,[r("div",{class:"flex items-center justify-between gap-3"},[N[3]||(N[3]=r("div",{class:"flex-1 min-w-0"},[r("div",{class:"text-xs font-mono text-retro-cyan font-bold mb-1"}," Plan Ready for Review "),r("div",{class:"text-xs font-mono text-retro-muted"}," Approve to switch to Auto mode and start implementation. ")],-1)),r("div",{class:"flex gap-2 flex-shrink-0"},[r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-green/20 text-retro-green border border-retro-green/50 hover:bg-retro-green/30 transition-colors",onClick:se}," Approve & Implement "),r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-red/20 text-retro-red border border-retro-red/50 hover:bg-retro-red/30 transition-colors",onClick:ne}," Reject ")])])])):H("",!0),r("div",Qv,[r("div",Jv,[Te(r("textarea",{ref_key:"inputRef",ref:b,"onUpdate:modelValue":N[1]||(N[1]=q=>Ie(d)?d.value=q:null),disabled:e.disabled||s(t).isActiveConversationStreaming||s(te)||s(V),placeholder:e.disabled?"This conversation is finalized (read-only)":"Type a message...",rows:"1",class:"w-full 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:Z},null,40,eg),[[ft,s(d)]])]),s(K)?(i(),u("button",{key:0,class:"flex-shrink-0 p-2 rounded bg-retro-yellow/20 text-retro-yellow hover:bg-retro-yellow/30 transition-colors",title:"Retry last message",onClick:fe},[Y(s(Dv),{class:"w-5 h-5"})])):H("",!0),!s(ee)&&!s(te)?(i(),u("button",{key:1,disabled:!s(I),class:"flex-shrink-0 p-2 rounded bg-retro-cyan/20 text-retro-cyan hover:bg-retro-cyan/30 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",onClick:E},[Y(s(Lv),{class:"w-5 h-5"})],8,tg)):s(ee)?(i(),u("button",{key:2,class:"flex-shrink-0 p-2 rounded bg-retro-red/20 text-retro-red hover:bg-retro-red/30 transition-colors",onClick:Q},[Y(s(Nv),{class:"w-5 h-5"})])):H("",!0)]),N[4]||(N[4]=r("div",{class:"mt-1 text-xs font-mono text-retro-muted"}," Press Enter to send, Shift+Enter for new line. Slash commands: `/context`, `/reset`, `/spec-search`. ",-1))]))}}),rg={class:"h-64 border-t border-retro-border bg-retro-dark/50 flex flex-col"},og={class:"h-9 flex items-center justify-between px-3 border-b border-retro-border/40"},sg={key:0,class:"flex-1 flex items-center justify-center text-xs font-mono text-retro-muted"},ag={key:1,class:"flex-1 overflow-y-auto scrollbar-custom"},ig={class:"flex items-center gap-2 text-[10px] font-mono"},lg={class:"text-retro-muted"},cg={class:"text-retro-muted"},ug={class:"text-retro-green truncate"},dg={class:"mt-1 text-[11px] font-mono text-retro-text whitespace-pre-wrap break-words"},fg=Ce({__name:"ChatDebugPanel",setup(e){const n=ht(),{debugEvents:t}=Es(n);function a(l){return new Date(l).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function o(l){return l==="in"?"text-retro-cyan":l==="out"?"text-retro-yellow":"text-retro-muted"}return(l,c)=>(i(),u("div",rg,[r("div",og,[c[1]||(c[1]=r("div",{class:"text-[11px] font-mono text-retro-text"}," Debug Stream (CLI/Provider) ",-1)),r("button",{class:"p-1 rounded hover:bg-retro-panel transition-colors",title:"Clear debug events",onClick:c[0]||(c[0]=f=>s(n).clearDebugEvents())},[Y(s(cn),{class:"w-3.5 h-3.5 text-retro-muted"})])]),s(t).length===0?(i(),u("div",sg," No debug events yet ")):(i(),u("div",ag,[(i(!0),u(he,null,Be(s(t),f=>(i(),u("div",{key:f.id,class:"px-3 py-2 border-b border-retro-border/20"},[r("div",ig,[r("span",lg,_(a(f.timestamp)),1),r("span",{class:ve(o(f.direction))},_(f.direction.toUpperCase()),3),r("span",cg,_(f.channel),1),r("span",ug,_(f.eventType),1)]),r("pre",dg,_(f.payload),1)]))),128))]))]))}}),mg={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},hg={class:"flex items-center justify-between"},pg={class:"space-y-1 text-xs font-mono"},vg={class:"flex items-center gap-2"},gg={class:"relative"},xg=["disabled"],bg=["value"],yg=["value"],wg={class:"flex items-center gap-2"},kg={class:"text-retro-text"},Cg={class:"relative"},$g=["disabled"],Sg=["disabled"],_g={class:"flex items-center gap-2"},Mg=["disabled"],Tg=["disabled"],Ag=Ce({__name:"FinalizeConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=e,a=n,o=S(""),l=S(null),c=S(!1),f=S(!1),m=S(t.baseBranch),d=S([]),b=S(!1);async function C(){f.value=!0;try{const v=await $fetch("/api/chat/generate-commit-message",{method:"POST",body:{conversationId:t.worktreePath.split("/").pop()?.replace("br-","")||"",worktreePath:t.worktreePath}});v.success&&v.message&&(o.value=v.message)}catch{}finally{f.value=!1}}st(async()=>{const v=(async()=>{try{const R=t.worktreePath.split("/").pop()||"",G=await $fetch(`/api/commits/${encodeURIComponent(R)}`,{params:{workingDirectory:t.worktreePath}});l.value=G.aheadCount}catch{l.value=null}})(),h=(async()=>{b.value=!0;try{const R=await $fetch("/api/git/branches");d.value=R.branches.filter(G=>!G.isRemote&&!G.name.startsWith("br/")&&!G.name.startsWith("br/p-")).map(G=>G.name),d.value.length>0&&!d.value.includes(m.value)&&(m.value=d.value.includes("main")?"main":d.value.includes("master")?"master":d.value[0])}catch{d.value=[]}finally{b.value=!1}})();await Promise.all([v,h])});function g(){o.value.trim()&&(c.value=!0,a("confirm",o.value.trim(),m.value))}return(v,h)=>(i(),u("div",mg,[r("div",hg,[h[4]||(h[4]=r("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Finalize ",-1)),r("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:h[0]||(h[0]=R=>a("cancel"))},[Y(s(pt),{class:"w-4 h-4"})])]),r("div",pg,[r("div",vg,[h[5]||(h[5]=r("span",{class:"text-retro-muted"},"target:",-1)),r("div",gg,[Te(r("select",{"onUpdate:modelValue":h[1]||(h[1]=R=>m.value=R),disabled:c.value||b.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"},[b.value?(i(),u("option",{key:0,value:e.baseBranch},_(e.baseBranch),9,bg)):H("",!0),(i(!0),u(he,null,Be(d.value,R=>(i(),u("option",{key:R,value:R},_(R),9,yg))),128))],8,xg),[[_n,m.value]]),Y(s(Xr),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),r("div",wg,[h[6]||(h[6]=r("span",{class:"text-retro-muted"},"commits:",-1)),r("span",kg,_(l.value!==null?l.value:"..."),1)])]),r("div",Cg,[Te(r("textarea",{"onUpdate:modelValue":h[2]||(h[2]=R=>o.value=R),placeholder:"Squash commit message...",rows:"2",class:"w-full px-2 py-1.5 pr-8 text-xs font-mono bg-retro-black border border-retro-border rounded text-retro-text placeholder-retro-subtle focus:outline-none focus:border-retro-cyan resize-none",disabled:c.value||f.value},null,8,$g),[[ft,o.value]]),r("button",{type:"button",disabled:c.value||f.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:C},[Y(s(gr),{class:ve(["w-4 h-4",{"animate-spin":f.value}])},null,8,["class"])],8,Sg)]),r("div",_g,[r("button",{type:"button",disabled:!o.value.trim()||c.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:g},[Y(s(Kr),{class:"w-3.5 h-3.5"}),we(" "+_(c.value?"Finalizing...":"Confirm"),1)],8,Mg),r("button",{type:"button",disabled:c.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:h[3]||(h[3]=R=>a("cancel"))}," Cancel ",8,Tg)])]))}}),Bg={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},Eg={class:"flex items-center justify-between"},Rg={class:"space-y-1 text-xs font-mono"},Pg={class:"flex items-center gap-2"},Dg={class:"text-retro-cyan"},Ig={class:"flex items-center gap-2"},Lg={class:"relative"},Ng=["disabled"],Fg=["value"],Hg=["value"],Og={class:"flex items-center gap-2"},Ug={class:"text-retro-text"},jg={class:"flex items-center gap-2"},zg=["disabled"],Vg=["disabled"],Wg=Ce({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=e,a=n,o=S(null),l=S(!1),c=S(t.baseBranch),f=S([]),m=S(!1);async function d(C){try{const g=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:C}});o.value=g.ahead}catch{o.value=null}}st(async()=>{const C=d(c.value),g=(async()=>{m.value=!0;try{const v=await $fetch("/api/git/branches");f.value=v.branches.filter(h=>!h.isRemote&&!h.name.startsWith("br/")&&!h.name.startsWith("br/p-")).map(h=>h.name),f.value.length>0&&!f.value.includes(c.value)&&(c.value=f.value.includes("main")?"main":f.value.includes("master")?"master":f.value[0])}catch{f.value=[]}finally{m.value=!1}})();await Promise.all([C,g])}),Me(c,C=>{d(C)});function b(){l.value=!0,a("confirm",c.value)}return(C,g)=>(i(),u("div",Bg,[r("div",Eg,[g[3]||(g[3]=r("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Rebase Worktree ",-1)),r("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:g[0]||(g[0]=v=>a("cancel"))},[Y(s(pt),{class:"w-4 h-4"})])]),r("div",Rg,[r("div",Pg,[g[4]||(g[4]=r("span",{class:"text-retro-muted"},"worktree:",-1)),r("span",Dg,_(e.worktreeBranch),1)]),r("div",Ig,[g[5]||(g[5]=r("span",{class:"text-retro-muted"},"target:",-1)),r("div",Lg,[Te(r("select",{"onUpdate:modelValue":g[1]||(g[1]=v=>c.value=v),disabled:l.value||m.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"},[m.value?(i(),u("option",{key:0,value:e.baseBranch},_(e.baseBranch),9,Fg)):H("",!0),(i(!0),u(he,null,Be(f.value,v=>(i(),u("option",{key:v,value:v},_(v),9,Hg))),128))],8,Ng),[[_n,c.value]]),Y(s(Xr),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),r("div",Og,[g[6]||(g[6]=r("span",{class:"text-retro-muted"},"commits ahead:",-1)),r("span",Ug,_(o.value!==null?o.value:"..."),1)])]),r("div",jg,[r("button",{type:"button",disabled:l.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:b},[Y(s(Kr),{class:"w-3.5 h-3.5"}),we(" "+_(l.value?"Rebasing...":"Confirm"),1)],8,zg),r("button",{type:"button",disabled:l.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:g[2]||(g[2]=v=>a("cancel"))}," Cancel ",8,Vg)])]))}}),Gg={class:"flex-1 flex flex-col overflow-hidden"},qg={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},Zg={class:"text-xs font-mono text-retro-text truncate"},Kg={class:"flex items-center gap-2 flex-shrink-0"},Yg=["title"],Xg=["disabled"],Qg=["disabled"],Jg={key:5,class:"text-xs font-mono text-retro-green"},e1={key:6,class:"text-[11px] font-mono text-retro-muted"},t1={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},n1=["innerHTML"],r1=["value","readonly"],o1={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"},s1=Ce({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},aiResolving:{type:Boolean}},emits:["resolve","aiResolve"],setup(e,{emit:n}){const t=e,a=n,o=S(t.file.content),l=S(!1),c=S(""),f=S(!1);Me(()=>t.file.path,()=>{o.value=t.file.content,l.value=!1,v()}),Me(()=>t.file.content,()=>{l.value||(o.value=t.file.content,v())});const m=/^<{7}\s.*\n([\s\S]*?)^={7}\n([\s\S]*?)^>{7}\s.*\n/gm,d=/^<{7}[^\n]*\n([\s\S]*?)^={7}[^\n]*\n([\s\S]*?)^>{7}[^\n]*\n?/gm,b=j(()=>/^<{7}\s/m.test(o.value)),C=j(()=>I(o.value).length);function g(W){const U=W.split(".").pop()?.toLowerCase()||"";return{ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",vue:"vue",html:"html",css:"css",scss:"scss",less:"less",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",sh:"bash",zsh:"bash",sql:"sql",graphql:"graphql",xml:"xml",svg:"xml",toml:"toml",ini:"ini",dockerfile:"dockerfile"}[U]||"text"}async function v(){f.value=!0;try{const{codeToHtml:W}=await Bn(async()=>{const{codeToHtml:le}=await import("./CObKakIs.js");return{codeToHtml:le}},__vite__mapDeps([3,1,2]),import.meta.url),U=g(t.file.path),B=o.value.split(`
|
|
112
|
+
`);let X="",M=!1,p=!1,E=0,Q=-1;for(const le of B){E++;const fe=/^<{7}\s/.test(le),Z=/^={7}$/.test(le),P=/^>{7}\s/.test(le);if(fe){Q++,M=!0,p=!1,X+=`<div class="conflict-line conflict-marker-line" data-line="${E}"><span class="line-number">${E}</span><span class="line-content conflict-marker">${h(le)}</span></div>
|
|
113
|
+
`,t.resolved||(X+=V(Q));continue}if(Z&&M){M=!1,p=!0,X+=`<div class="conflict-line conflict-marker-line" data-line="${E}"><span class="line-number">${E}</span><span class="line-content conflict-marker">${h(le)}</span></div>
|
|
114
|
+
`;continue}if(P){p=!1,X+=`<div class="conflict-line conflict-marker-line" data-line="${E}"><span class="line-number">${E}</span><span class="line-content conflict-marker">${h(le)}</span></div>
|
|
115
|
+
`;continue}let $=h(le);try{const N=(await W(le||" ",{lang:U,theme:"vitesse-dark"})).match(/<code[^>]*><span class="line">(.*?)<\/span><\/code>/s);N&&($=N[1])}catch{}let L="";M?L="conflict-ours":p&&(L="conflict-theirs"),X+=`<div class="conflict-line ${L}" data-line="${E}"><span class="line-number">${E}</span><span class="line-content">${$}</span></div>
|
|
116
|
+
`}c.value=X}catch{const W=o.value.split(`
|
|
117
|
+
`);c.value=W.map((U,F)=>{const B=F+1;return`<div class="conflict-line" data-line="${B}"><span class="line-number">${B}</span><span class="line-content">${h(U)}</span></div>`}).join(`
|
|
118
|
+
`)}finally{f.value=!1}}function h(W){return W.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function R(){te("ours")}function G(){te("theirs")}function I(W){const U=[],F=new RegExp(d.source,d.flags);let B=null,X=0;for(;(B=F.exec(W))!==null;)U.push({index:X,start:B.index,end:F.lastIndex,ours:B[1]??"",theirs:B[2]??""}),X++;return U}function ee(W,U){return W?U?W.endsWith(`
|
|
119
|
+
`)||U.startsWith(`
|
|
120
|
+
`)?`${W}${U}`:`${W}
|
|
121
|
+
${U}`:W:U}function te(W,U){const F=o.value,B=I(F);if(B.length){if(typeof U=="number"){const X=B.find(p=>p.index===U);if(!X)return;const M=W==="ours"?X.ours:W==="theirs"?X.theirs:ee(X.ours,X.theirs);o.value=F.slice(0,X.start)+M+F.slice(X.end)}else o.value=F.replace(m,(X,M,p)=>W==="ours"?M:W==="theirs"?p:ee(M,p));v()}}function V(W){return`<div class="conflict-inline-actions" data-conflict-controls="${W}">
|
|
122
|
+
<button type="button" class="conflict-inline-button conflict-inline-button-ours" data-conflict-index="${W}" data-conflict-action="ours">Accept Ours</button>
|
|
123
|
+
<button type="button" class="conflict-inline-button conflict-inline-button-theirs" data-conflict-index="${W}" data-conflict-action="theirs">Accept Theirs</button>
|
|
124
|
+
<button type="button" class="conflict-inline-button conflict-inline-button-both" data-conflict-index="${W}" data-conflict-action="both">Accept Both</button>
|
|
125
|
+
</div>
|
|
126
|
+
`}function re(W){const U=W.target?.closest("button[data-conflict-action]");if(!U||t.resolved)return;const F=U.dataset.conflictAction,B=U.dataset.conflictIndex;if(!F||B===void 0)return;const X=Number.parseInt(B,10);Number.isNaN(X)||te(F,X)}function ue(){b.value||a("resolve",t.file.path,o.value)}function se(){a("aiResolve",t.file.path)}function ne(){l.value=!l.value,l.value||v()}function K(W){const U=W.target;o.value=U.value}return st(()=>{v()}),(W,U)=>(i(),u("div",Gg,[r("div",qg,[r("span",Zg,_(e.file.path),1),r("div",Kg,[e.resolved?H("",!0):(i(),u("button",{key:0,type:"button",class:ve(["px-2 py-0.5 text-xs font-mono rounded border transition-colors",l.value?"border-retro-yellow/50 text-retro-yellow hover:bg-retro-yellow/10":"border-retro-subtle/50 text-retro-muted hover:bg-retro-subtle/10"]),title:l.value?"Switch to highlighted view":"Switch to edit mode",onClick:ne},[l.value?(i(),ce(s(ts),{key:0,class:"w-3.5 h-3.5 inline-block"})):(i(),ce(s(Jr),{key:1,class:"w-3.5 h-3.5 inline-block"}))],10,Yg)),!e.resolved&&b.value?(i(),u("button",{key:1,type:"button",disabled:e.aiResolving,class:"flex items-center gap-1 px-2 py-0.5 text-xs font-mono rounded border border-retro-orange/50 text-retro-orange hover:bg-retro-orange/10 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:se},[Y(s(gr),{class:"w-3.5 h-3.5"}),we(" "+_(e.aiResolving?"Resolving...":"AI Resolve"),1)],8,Xg)):H("",!0),!e.resolved&&b.value?(i(),u("button",{key:2,type:"button",class:"px-2 py-0.5 text-xs font-mono rounded border border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/10 transition-colors",onClick:R}," Accept All Ours ")):H("",!0),!e.resolved&&b.value?(i(),u("button",{key:3,type:"button",class:"px-2 py-0.5 text-xs font-mono rounded border border-retro-magenta/50 text-retro-magenta hover:bg-retro-magenta/10 transition-colors",onClick:G}," Accept All Theirs ")):H("",!0),e.resolved?H("",!0):(i(),u("button",{key:4,type:"button",disabled:b.value,class:"px-2 py-0.5 text-xs font-mono rounded border border-retro-green/50 text-retro-green hover:bg-retro-green/10 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:ue}," Mark Resolved ",8,Qg)),e.resolved?(i(),u("span",Jg," Resolved ")):C.value>0?(i(),u("span",e1,_(C.value)+" conflict "+_(C.value===1?"block":"blocks"),1)):H("",!0)])]),l.value?H("",!0):(i(),u("div",{key:0,class:ve(["flex-1 overflow-auto bg-retro-black conflict-viewer",{"opacity-60":e.resolved}]),onClick:re},[f.value?(i(),u("div",t1," Highlighting... ")):(i(),u("div",{key:1,class:"conflict-code",innerHTML:c.value},null,8,n1))],2)),l.value?(i(),u("textarea",{key:1,value:o.value,readonly:e.resolved,class:ve(["flex-1 w-full p-4 font-mono text-xs bg-retro-black text-retro-text resize-none focus:outline-none leading-relaxed",{"opacity-60":e.resolved}]),spellcheck:"false",onInput:K},null,42,r1)):H("",!0),b.value&&!e.resolved?(i(),u("div",o1," File still contains conflict markers. Remove all <<<<<<<, =======, >>>>>>> markers to resolve. ")):H("",!0)]))}}),a1={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60"},i1={class:"w-full max-w-5xl mx-4 my-8 h-[80vh] bg-retro-dark border border-retro-border rounded-lg shadow-xl flex flex-col overflow-hidden"},l1={class:"flex-shrink-0 px-4 py-3 border-b border-retro-border flex items-center justify-between"},c1={class:"flex items-center gap-3"},u1={class:"text-xs font-mono text-retro-muted"},d1={class:"flex items-center gap-2"},f1=["disabled"],m1=["disabled"],h1=["disabled"],p1={key:0,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},v1={key:1,class:"flex-1 flex items-center justify-center text-retro-red text-sm font-mono"},g1={key:2,class:"flex-1 flex overflow-hidden"},x1={class:"w-64 flex-shrink-0 border-r border-retro-border overflow-y-auto bg-retro-dark"},b1={class:"py-1"},y1=["onClick"],w1={key:1,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},k1=Ce({__name:"ConflictResolutionModal",emits:["close"],setup(e,{emit:n}){const t=n,a=ht(),o=S(null),l=S(!1),c=S(!1),f=S(null),m=S(!1),d=j(()=>a.conflictState?.files??[]),b=j(()=>a.conflictState?.resolvedFiles??new Set),C=j(()=>d.value.length),g=j(()=>b.value.size),v=j(()=>C.value>0&&g.value>=C.value),h=j(()=>C.value-g.value),R=j(()=>o.value?d.value.find(se=>se.path===o.value)??null:null);function G(se){return b.value.has(se)}function I(se){o.value=se}async function ee(se,ne){await a.resolveConflictFile(se,ne)}async function te(se){f.value=se,await a.aiResolveConflictFile(se),f.value=null}async function V(){m.value=!0,await a.aiResolveAllConflicts(),m.value=!1}async function re(){l.value=!0;const se=await a.continueRebase();l.value=!1,se.success&&t("close")}async function ue(){c.value=!0,await a.abortRebase(),c.value=!1,t("close")}return(se,ne)=>(i(),ce(Qt,{to:"body"},[Y($n,{"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:We(()=>[s(a).conflictState?(i(),u("div",a1,[r("div",i1,[r("div",l1,[r("div",c1,[Y(s(Cn),{class:"w-5 h-5 text-retro-yellow"}),ne[0]||(ne[0]=r("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"Resolve Rebase Conflicts",-1)),r("span",u1,_(g.value)+"/"+_(C.value)+" resolved ",1)]),r("div",d1,[h.value>0?(i(),u("button",{key:0,type:"button",disabled:m.value||l.value||c.value,class:"flex items-center gap-1 px-3 py-1.5 text-xs font-mono rounded border transition-colors bg-retro-orange/10 border-retro-orange/50 text-retro-orange hover:bg-retro-orange/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:V},[Y(s(gr),{class:"w-3.5 h-3.5"}),we(" "+_(m.value?"AI Resolving...":`AI Resolve All (${h.value})`),1)],8,f1)):H("",!0),r("button",{type:"button",disabled:!v.value||l.value||c.value,class:"flex items-center gap-1 px-3 py-1.5 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:re},_(l.value?"Continuing...":"Continue Rebase"),9,m1),r("button",{type:"button",disabled:l.value||c.value,class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-red/50 text-retro-red hover:bg-retro-red/10 transition-colors disabled:opacity-40",onClick:ue},_(c.value?"Aborting...":"Abort"),9,h1)])]),s(a).conflictState?.loading?(i(),u("div",p1," Loading conflict files... ")):s(a).conflictState?.error?(i(),u("div",v1,_(s(a).conflictState.error),1)):(i(),u("div",g1,[r("div",x1,[r("div",b1,[(i(!0),u(he,null,Be(d.value,K=>(i(),u("button",{key:K.path,type:"button",class:ve(["w-full text-left px-3 py-2 text-xs font-mono flex items-center gap-2 transition-colors hover:bg-retro-panel",{"bg-retro-panel":o.value===K.path}]),onClick:W=>I(K.path)},[G(K.path)?(i(),ce(s(vr),{key:0,class:"w-3.5 h-3.5 text-retro-green flex-shrink-0"})):(i(),ce(s(In),{key:1,class:"w-3.5 h-3.5 text-retro-yellow flex-shrink-0"})),r("span",{class:ve(["truncate",G(K.path)?"text-retro-green":"text-retro-yellow"])},_(K.path),3)],10,y1))),128))])]),R.value?(i(),ce(s1,{key:0,file:R.value,resolved:G(R.value.path),"ai-resolving":f.value===R.value.path||m.value,onResolve:ee,onAiResolve:te},null,8,["file","resolved","ai-resolving"])):(i(),u("div",w1," Select a file to resolve "))]))])])):H("",!0)]),_:1})]))}}),C1={key:0,class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},$1={class:"flex items-center justify-between p-4 border-b border-retro-border"},S1={class:"flex items-center gap-2"},_1={class:"p-4"},M1={class:"mt-2 text-sm text-retro-text font-mono truncate"},T1={class:"flex justify-end gap-3 p-4 border-t border-retro-border"},A1=Ce({__name:"DeleteConfirmModal",props:{show:{type:Boolean},title:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=n;function a(o){o.target===o.currentTarget&&t("cancel")}return(o,l)=>(i(),ce(Qt,{to:"body"},[Y($n,{"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:We(()=>[e.show?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:a},[Y($n,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:We(()=>[e.show?(i(),u("div",C1,[r("div",$1,[r("div",S1,[Y(s(Cn),{class:"w-5 h-5 text-retro-red"}),l[3]||(l[3]=r("h3",{class:"text-lg font-mono text-retro-text"},"Delete Conversation",-1))]),r("button",{onClick:l[0]||(l[0]=c=>t("cancel")),class:"p-1 hover:bg-retro-panel rounded transition-colors"},[Y(s(pt),{class:"w-5 h-5 text-retro-muted"})])]),r("div",_1,[l[4]||(l[4]=r("p",{class:"text-sm text-retro-muted font-mono"}," Are you sure you want to delete this conversation? ",-1)),r("p",M1,' "'+_(e.title)+'" ',1),l[5]||(l[5]=r("p",{class:"mt-3 text-xs text-retro-muted"}," This action cannot be undone. ",-1))]),r("div",T1,[r("button",{onClick:l[1]||(l[1]=c=>t("cancel")),class:"px-4 py-2 text-sm font-mono text-retro-muted border border-retro-border rounded hover:bg-retro-panel transition-colors"}," Cancel "),r("button",{onClick:l[2]||(l[2]=c=>t("confirm")),class:"px-4 py-2 text-sm font-mono text-white bg-retro-red/80 border border-retro-red rounded hover:bg-retro-red transition-colors"}," Delete ")])])):H("",!0)]),_:1})])):H("",!0)]),_:1})]))}}),B1={class:"h-full flex flex-col bg-retro-black"},E1={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},R1={class:"flex items-center gap-2 min-w-0"},P1={class:"text-xs font-mono text-retro-text truncate"},D1={class:"flex items-center gap-1"},I1=["disabled","title"],L1=["title"],N1=["title"],F1=["disabled"],H1={key:4,class:"flex-shrink-0 px-4 py-2 border-b border-retro-border bg-retro-green/10 text-retro-green text-xs font-mono text-center"},O1={class:"flex-1 min-h-0 flex flex-col"},Fo=Ce({__name:"ChatPanel",setup(e){const n=ht(),t=Ss(),{disconnectConversation:a}=ho();st(async()=>{try{const E=await $fetch("/api/cwd");n.setCwd(E.cwd)}catch{}});const o=j(()=>n.activeConversation?.title||"New Chat"),l=S(!1),c=j(()=>t.isChatFullscreen),f=S(!1);function m(){t.toggleChatFullscreen()}async function d(){l.value=!1;const E=n.activeConversationId;E&&(a(E),await n.deleteConversation(E)),n.clearMessages()}function b(){n.hasMessages&&(l.value=!0)}function C(){l.value=!1}const g=S(!1),v=S(null),h=j(()=>n.activeConversation?.finalized===!0),R=j(()=>h.value),G=S(null),I=S(!1);async function ee(){const E=n.activeConversation;if(!E?.worktreePath||!E?.baseBranch){G.value=null;return}I.value=!0;try{const Q=await $fetch("/api/chat/compare",{params:{worktreePath:E.worktreePath,baseBranch:E.baseBranch}});G.value=Q}catch{G.value=null}finally{I.value=!1}}Me(()=>[n.activeConversationId,n.activeConversation?.worktreePath,n.activeConversation?.baseBranch,n.activeConversation?.lastCommitTime],()=>{ee()},{immediate:!0});const te=j(()=>G.value?G.value.ahead===0&&G.value.behind===0:!1),V=j(()=>{const E=n.activeConversation;return E?.hasWorktree&&!E?.finalized&&!n.isActiveConversationStreaming}),re=j(()=>V.value&&!te.value);function ue(){g.value=!0,v.value=null}async function se(E,Q){const le=n.activeConversationId;if(!le)return;const fe=await n.finalizeConversation(le,E,Q);if(g.value=!1,fe.success)v.value={type:"success",message:`Merged to ${Q}`},setTimeout(()=>{v.value=null},5e3);else if(fe.rebaseInProgress)v.value=null;else{const Z=fe.conflictFiles?.length?`Conflict in: ${fe.conflictFiles.join(", ")}`:fe.error||"Finalize failed";v.value={type:"error",message:Z}}}function ne(){g.value=!1}function K(){if(!n.conflictState&&n.activeConversation?.hasWorktree){const E=n.activeConversation?.baseBranch||"main";v.value={type:"success",message:`Rebased onto ${E}`},setTimeout(()=>{v.value=null},5e3)}else v.value=null}const W=S(!1),U=j(()=>!!n.activeConversation?.previewBranch);async function F(){const E=n.activeConversationId;if(!E)return;W.value=!0,v.value=null;const Q=U.value,le=await n.togglePreview(E);if(le.success){const fe=Q?`Switched back to ${n.activeConversation?.baseBranch}`:"Preview active — main worktree updated";v.value={type:"success",message:fe},setTimeout(()=>{v.value=null},3e3)}else v.value={type:"error",message:le.error||"Preview toggle failed"};W.value=!1}const B=S(!1);function X(){B.value=!0,v.value=null}async function M(E){const Q=n.activeConversationId;if(!Q)return;const le=await n.rebaseConversation(Q,E);B.value=!1,le.success?(v.value={type:"success",message:`Rebased onto ${E}`},setTimeout(()=>{v.value=null},5e3)):le.rebaseInProgress?v.value=null:v.value={type:"error",message:le.error||"Rebase failed"}}function p(){B.value=!1}return(E,Q)=>(i(),u("div",B1,[r("div",E1,[r("div",R1,[r("span",P1,_(s(o)),1)]),r("div",D1,[s(V)?(i(),u("button",{key:0,disabled:s(W),class:"p-1.5 rounded hover:bg-retro-panel transition-colors disabled:opacity-40",title:s(U)?"End preview: switch back to base branch":"Preview: test worktree changes in main worktree",onClick:F},[s(U)?(i(),ce(s(ta),{key:0,class:"w-4 h-4 text-retro-orange"})):(i(),ce(s(ts),{key:1,class:"w-4 h-4 text-retro-cyan"}))],8,I1)):H("",!0),s(re)?(i(),u("button",{key:1,class:"p-1.5 rounded hover:bg-retro-panel transition-colors",title:"Rebase: sync worktree onto target base branch",onClick:X},[Y(s(xn),{class:"w-4 h-4 text-retro-purple"})])):H("",!0),s(re)?(i(),u("button",{key:2,class:"p-1.5 rounded hover:bg-retro-panel transition-colors",title:"Finalize: squash & merge to base branch",onClick:ue},[Y(s(vr),{class:"w-4 h-4 text-retro-green"})])):H("",!0),r("button",{class:"p-1.5 rounded hover:bg-retro-panel transition-colors",title:s(c)?"Exit fullscreen chat":"Fullscreen chat",onClick:m},[s(c)?(i(),ce(s(qo),{key:0,class:"w-4 h-4 text-retro-muted"})):(i(),ce(s(Zo),{key:1,class:"w-4 h-4 text-retro-muted"}))],8,L1),r("button",{class:"p-1.5 rounded hover:bg-retro-panel transition-colors",title:s(f)?"Hide debug stream":"Show debug stream",onClick:Q[0]||(Q[0]=le=>f.value=!s(f))},[Y(s(Gs),{class:ve(["w-4 h-4",s(f)?"text-retro-yellow":"text-retro-muted"])},null,8,["class"])],8,N1),r("button",{disabled:!s(n).hasMessages,class:"p-1.5 rounded hover:bg-retro-panel disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"New conversation",onClick:b},[Y(s(cn),{class:"w-4 h-4 text-retro-muted"})],8,F1)])]),Y(A1,{show:s(l),title:s(o),onConfirm:d,onCancel:C},null,8,["show","title"]),s(g)&&s(n).activeConversation?.hasWorktree?(i(),ce(Ag,{key:0,"base-branch":s(n).activeConversation.baseBranch||"main","worktree-branch":s(n).activeConversation.worktreeBranch||"","worktree-path":s(n).activeConversation.worktreePath||"",onConfirm:se,onCancel:ne},null,8,["base-branch","worktree-branch","worktree-path"])):H("",!0),s(B)&&s(n).activeConversation?.hasWorktree?(i(),ce(Wg,{key:1,"base-branch":s(n).activeConversation.baseBranch||"main","worktree-branch":s(n).activeConversation.worktreeBranch||"","worktree-path":s(n).activeConversation.worktreePath||"",onConfirm:M,onCancel:p},null,8,["base-branch","worktree-branch","worktree-path"])):H("",!0),s(n).conflictState?(i(),ce(k1,{key:2,onClose:K})):H("",!0),s(v)?(i(),u("div",{key:3,class:ve(["flex-shrink-0 px-4 py-2 border-b border-retro-border text-xs font-mono",s(v).type==="success"?"bg-retro-green/10 text-retro-green":"bg-retro-red/10 text-retro-red"])},[we(_(s(v).message)+" ",1),s(v).type==="error"?(i(),u("button",{key:0,class:"ml-2 underline hover:no-underline",onClick:Q[1]||(Q[1]=le=>v.value=null)}," dismiss ")):H("",!0)],2)):H("",!0),s(h)?(i(),u("div",H1," This conversation has been finalized and is read-only. ")):H("",!0),r("div",O1,[Y(Pv,{class:"flex-1 overflow-hidden"}),s(f)?(i(),ce(fg,{key:0})):H("",!0)]),Y(ng,{disabled:s(R)},null,8,["disabled"])]))}}),U1={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},j1={class:"flex items-center gap-2 min-w-0"},z1=["title"],V1={class:"text-retro-text font-mono text-sm truncate"},W1={class:"text-retro-muted"},G1={class:"text-retro-text"},q1={class:"text-retro-muted font-mono text-xs flex-shrink-0"},Z1={class:"flex-1 overflow-auto"},K1={key:0,class:"flex items-center justify-center gap-2 text-retro-muted text-sm py-8"},Y1={key:1,class:"flex items-center justify-center text-retro-muted text-sm py-8"},X1={key:2,class:"flex items-center justify-center text-retro-muted text-sm py-8"},Q1={key:3,class:"w-full text-xs font-mono border-collapse diff-table"},J1={key:0,class:"diff-warning"},ex={key:0,colspan:"3",class:"diff-hunk-header px-4 py-1"},tx={class:"diff-line-num select-none text-right px-2 w-12"},nx={class:"diff-line-num select-none text-right px-2 w-12 border-r border-retro-border"},rx={class:"diff-line-content px-3 whitespace-pre-wrap break-all"},ox={key:0,class:"diff-sign"},sx={key:1,class:"diff-sign"},ax={key:2,class:"diff-sign"},ix={key:4,class:"flex items-center justify-center text-retro-muted text-sm py-8"},lx=Ce({__name:"GitFileDiffViewer",props:{file:{},commitHash:{},content:{},loading:{type:Boolean}},emits:["close"],setup(e,{emit:n}){const t=e,a=n,o=S(null),l=j(()=>t.commitHash.substring(0,7)),c=j(()=>Pn[t.file.status]||{label:t.file.status,colorClass:"text-retro-muted"}),f=j(()=>t.file.status==="R"&&t.file.oldPath);function m(d){d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a("close"))}return st(()=>{o.value?.focus()}),bt(()=>{}),(d,b)=>(i(),u("div",{ref_key:"containerRef",ref:o,tabindex:0,onKeydown:m,class:"flex flex-col h-full bg-retro-dark focus:outline-none","aria-label":"File diff viewer",role:"region"},[r("div",U1,[r("div",j1,[r("span",{class:ve(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",c.value.colorClass]),title:c.value.label},_(e.file.status),11,z1),r("span",V1,[f.value&&e.file.oldPath?(i(),u(he,{key:0},[r("span",W1,_(e.file.oldPath),1),b[1]||(b[1]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",G1,_(e.file.path),1)],64)):(i(),u(he,{key:1},[we(_(e.file.path),1)],64))]),r("span",q1," @ "+_(l.value),1)]),r("button",{onClick:b[0]||(b[0]=C=>a("close")),class:"p-1 hover:bg-retro-dark rounded transition-colors flex-shrink-0 focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close diff viewer",title:"Close (Esc)"},[Y(s(pt),{class:"w-5 h-5 text-retro-muted hover:text-retro-text"})])]),r("div",Z1,[e.loading?(i(),u("div",K1,[...b[2]||(b[2]=[r("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),we(" Loading diff... ",-1)])])):e.content&&e.content.binary?(i(),u("div",Y1,[...b[3]||(b[3]=[r("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," Binary file — cannot display diff ",-1)])])):e.content&&e.content.lines.length===0?(i(),u("div",X1,[...b[4]||(b[4]=[r("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," No changes in this file ",-1)])])):e.content?(i(),u("table",Q1,[r("tbody",null,[e.content.truncated?(i(),u("tr",J1,[...b[5]||(b[5]=[r("td",{colspan:"3",class:"px-4 py-2 text-retro-yellow bg-retro-panel text-center"}," Diff truncated — file has more than 10,000 lines ",-1)])])):H("",!0),(i(!0),u(he,null,Be(e.content.lines,(C,g)=>(i(),u("tr",{key:g,class:ve({"diff-add":C.type==="add","diff-delete":C.type==="delete","diff-context":C.type==="context","diff-header":C.type==="header"})},[C.type==="header"?(i(),u("td",ex,_(C.content),1)):(i(),u(he,{key:1},[r("td",tx,_(C.oldLineNumber??""),1),r("td",nx,_(C.newLineNumber??""),1),r("td",rx,[C.type==="add"?(i(),u("span",ox,"+")):C.type==="delete"?(i(),u("span",sx,"-")):(i(),u("span",ax," ")),we(" "+_(C.content),1)])],64))],2))),128))])])):(i(),u("div",ix," Failed to load diff content. "))])],544))}}),cx=qr(lx,[["__scopeId","data-v-c726b0c5"]]),ux={class:"fixed inset-0 z-50 flex items-center justify-center"},dx={class:"relative w-[90vw] max-w-lg bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},fx={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},mx={class:"flex items-center gap-2"},hx={class:"text-sm font-mono text-retro-text"},px={class:"p-6 overflow-y-auto max-h-[70vh] space-y-6"},vx={key:0},gx={class:"space-y-6"},xx={class:"space-y-1.5"},bx=["value","checked","onChange"],yx={class:"flex-1"},wx={class:"text-sm font-mono text-retro-text"},kx={class:"text-xs text-retro-muted leading-tight"},Cx={class:"text-xs font-mono text-retro-muted"},$x={class:"text-xs text-retro-muted mb-3"},Sx=["disabled"],_x={class:"space-y-1.5"},Mx=["value","checked","onChange"],Tx={class:"flex-1"},Ax={class:"text-sm font-mono text-retro-text"},Bx={class:"text-xs text-retro-muted leading-tight"},Ex={class:"flex items-center gap-4 px-3 py-2 rounded border border-retro-border bg-retro-panel"},Rx=["value"],Px={class:"font-mono text-retro-cyan text-sm w-6 text-center"},Dx={key:1,class:"space-y-4"},Ix={class:"space-y-1.5"},Lx=["checked"],Nx=["checked"],Fx=Ce({__name:"SettingsModal",emits:["close"],setup(e,{emit:n}){const t=n,a=Kn(),o=Dn(),l=S("main"),c=S(!1),f=[{value:"dark",label:"Dark",description:"Retro terminal theme with dark backgrounds"},{value:"light",label:"Light",description:"Bright theme for well-lit environments"}],m=[{value:"plan",label:An.plan,description:tr.plan,icon:Qr,color:"text-retro-cyan"},{value:"ask",label:An.ask,description:tr.ask,icon:eo,color:"text-retro-green"},{value:"auto",label:An.auto,description:tr.auto,icon:Zr,color:"text-retro-yellow"},{value:"bypass",label:An.bypass,description:tr.bypass,icon:to,color:"text-retro-red"}],{data:d,pending:b,error:C}=wo("ai-providers",()=>$fetch("/api/ai/providers"),{server:!1}),g=j(()=>d.value?.providers??[]),v=j(()=>{const F=C.value;return F?F instanceof Error?F.message:String(F):null}),{data:h,refresh:R}=wo("spec-search-status",()=>$fetch("/api/specs/status"),{server:!1,default:()=>null}),G=j(()=>{const F=h.value;return F?F.isIndexing?`Indexing (${F.currentJob||"running"})`:F.schedulerActive?`Indexed ${F.fileCount} files / ${F.chunkCount} chunks`:"Scheduler inactive":"Status unavailable"});st(()=>{a.hydrate()});const I=F=>{a.setProviderSelection(F),o.success("Settings saved")},ee=()=>{l.value="provider"},te=()=>{l.value="main"},V=F=>{a.setTheme(F),o.success("Settings saved")},re=F=>{a.setPermissionMode(F),o.success("Settings saved")},ue=F=>{const B=parseInt(F.target.value,10);isNaN(B)||(a.setAutoModeConcurrency(B),o.success("Settings saved"))},se=F=>{a.setAutoGenerateCommitMessages(F),o.success("Settings saved")},ne=()=>{t("close")},K=async()=>{if(!c.value){c.value=!0;try{const F=await $fetch("/api/specs/reindex",{method:"POST",body:{}});!F.success&&F.status==="already-indexing"?o.info("Spec index is already running"):o.success("Spec reindex started"),await R()}catch(F){o.error(F instanceof Error?F.message:"Failed to start spec reindex")}finally{c.value=!1}}},W=F=>{F.key==="Escape"&&t("close")};st(()=>{window.addEventListener("keydown",W)}),bt(()=>{window.removeEventListener("keydown",W)});let U=null;return st(()=>{U=mo(()=>{R()},5e3)}),bt(()=>{U&&clearInterval(U)}),(F,B)=>(i(),ce(Qt,{to:"body"},[r("div",ux,[r("div",{class:"absolute inset-0 bg-black/70",onClick:ne}),r("div",dx,[r("div",fx,[r("div",mx,[l.value==="provider"?(i(),u("button",{key:0,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Back",onClick:te},[Y(s(Vs),{class:"h-4 w-4"})])):H("",!0),r("h2",hx,_(l.value==="provider"?"AI Provider Settings":"Settings"),1)]),r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:B[0]||(B[0]=X=>t("close"))},[Y(s(pt),{class:"h-4 w-4"})])]),r("div",px,[l.value==="main"?(i(),u("section",vx,[r("div",gx,[r("section",null,[B[3]||(B[3]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Theme",-1)),B[4]||(B[4]=r("p",{class:"text-xs text-retro-muted mb-3"}," Choose between dark and light appearance. ",-1)),r("div",xx,[(i(),u(he,null,Be(f,X=>r("label",{key:X.value,class:ve(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[s(a).theme===X.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[r("input",{type:"radio",name:"theme",value:X.value,checked:s(a).theme===X.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:M=>V(X.value)},null,40,bx),r("div",yx,[r("div",wx,_(X.label),1),r("div",kx,_(X.description),1)])],2)),64))])]),B[14]||(B[14]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[B[6]||(B[6]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider",-1)),B[7]||(B[7]=r("p",{class:"text-xs text-retro-muted mb-3"}," Configure provider and model settings for new conversations. ",-1)),r("button",{type:"button",class:"w-full flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel hover:border-retro-muted transition-colors",onClick:ee},[B[5]||(B[5]=r("span",{class:"text-sm font-mono text-retro-text"},"Provider Settings",-1)),r("span",Cx,_(s(a).providerSelection.providerId)+" / "+_(s(a).providerSelection.modelKey),1)])]),B[15]||(B[15]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[B[8]||(B[8]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec Search Index",-1)),r("p",$x,_(G.value),1),r("button",{type:"button",class:"w-full flex items-center justify-center px-3 py-2 rounded border border-retro-border bg-retro-panel text-retro-text hover:border-retro-muted transition-colors disabled:opacity-60",disabled:c.value||s(h)?.isIndexing,onClick:K},_(c.value?"Starting reindex...":"Reindex Specs"),9,Sx)]),B[16]||(B[16]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[B[9]||(B[9]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Default Permission Mode",-1)),B[10]||(B[10]=r("p",{class:"text-xs text-retro-muted mb-3"}," Set the default permission mode for all new chat conversations. ",-1)),r("div",_x,[(i(),u(he,null,Be(m,X=>r("label",{key:X.value,class:ve(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[s(a).permissionMode===X.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[r("input",{type:"radio",name:"permission-mode",value:X.value,checked:s(a).permissionMode===X.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:M=>re(X.value)},null,40,Mx),(i(),ce(En(X.icon),{class:ve(["w-4 h-4 flex-shrink-0",X.color])},null,8,["class"])),r("div",Tx,[r("div",Ax,_(X.label),1),r("div",Bx,_(X.description),1)])],2)),64))])]),B[17]||(B[17]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[B[12]||(B[12]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Auto Mode",-1)),B[13]||(B[13]=r("p",{class:"text-xs text-retro-muted mb-3"}," Configure how many spec cascades can run in parallel during Auto Mode. ",-1)),r("div",Ex,[B[11]||(B[11]=r("label",{class:"font-mono text-retro-text text-sm whitespace-nowrap",for:"concurrency-modal"}," Concurrency ",-1)),r("input",{id:"concurrency-modal",type:"range",min:"1",max:"10",step:"1",value:s(a).autoModeConcurrency,class:"flex-1 accent-retro-cyan",onChange:ue},null,40,Rx),r("span",Px,_(s(a).autoModeConcurrency),1)])])])])):(i(),u("section",Dx,[B[18]||(B[18]=r("div",null,[r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider"),r("p",{class:"text-xs text-retro-muted mb-3"}," Choose which registered provider and model powers new conversations. ")],-1)),Y(Hs,{providers:g.value,selected:s(a).providerSelection,permissionMode:s(a).permissionMode,pending:s(b),errorMessage:v.value,onSelect:I},null,8,["providers","selected","permissionMode","pending","errorMessage"])])),B[23]||(B[23]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[B[21]||(B[21]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Commit Messages",-1)),B[22]||(B[22]=r("p",{class:"text-xs text-retro-muted mb-3"}," Choose whether to use AI to generate commit messages automatically. ",-1)),r("div",Ix,[r("label",{class:ve(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[s(a).autoGenerateCommitMessages?"border-retro-border bg-retro-panel hover:border-retro-muted":"border-retro-cyan bg-retro-cyan/10"]])},[r("input",{type:"radio",name:"commit-messages",value:!1,checked:!s(a).autoGenerateCommitMessages,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:B[1]||(B[1]=X=>se(!1))},null,40,Lx),B[19]||(B[19]=r("div",{class:"flex-1"},[r("div",{class:"text-sm font-mono text-retro-text"},"Template (Recommended)"),r("div",{class:"text-xs text-retro-muted leading-tight"},"Simple template-based messages. No token usage.")],-1))],2),r("label",{class:ve(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[s(a).autoGenerateCommitMessages?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[r("input",{type:"radio",name:"commit-messages",value:!0,checked:s(a).autoGenerateCommitMessages,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:B[2]||(B[2]=X=>se(!0))},null,40,Nx),B[20]||(B[20]=r("div",{class:"flex-1"},[r("div",{class:"text-sm font-mono text-retro-text"},"AI-Generated"),r("div",{class:"text-xs text-retro-muted leading-tight"},"Uses Claude Haiku to create meaningful commit messages. ~300-500 tokens per commit.")],-1))],2)])])])])])]))}}),Hx={class:"fixed top-4 right-4 z-50 flex flex-col gap-2 max-w-sm"},Ox={class:"flex-1 text-sm font-mono text-retro-text"},Ux=["onClick"],jx=Ce({__name:"ToastContainer",setup(e){const{toasts:n,remove:t}=Dn(),a={success:{bg:"bg-retro-green/20",icon:"text-retro-green",border:"border-retro-green/50"},error:{bg:"bg-retro-red/20",icon:"text-retro-red",border:"border-retro-red/50"},info:{bg:"bg-retro-cyan/20",icon:"text-retro-cyan",border:"border-retro-cyan/50"},warning:{bg:"bg-retro-yellow/20",icon:"text-retro-yellow",border:"border-retro-yellow/50"}},o=l=>{switch(l){case"success":return vr;case"error":return In;case"warning":return Cn;default:return sa}};return(l,c)=>(i(),ce(Qt,{to:"body"},[r("div",Hx,[Y(Rs,{"enter-active-class":"transition-all duration-300 ease-out","leave-active-class":"transition-all duration-200 ease-in","enter-from-class":"opacity-0 translate-x-4","enter-to-class":"opacity-100 translate-x-0","leave-from-class":"opacity-100 translate-x-0","leave-to-class":"opacity-0 translate-x-4"},{default:We(()=>[(i(!0),u(he,null,Be(s(n),f=>(i(),u("div",{key:f.id,class:ve(["flex items-start gap-3 p-3 rounded-lg border shadow-lg",[a[f.type].bg,a[f.type].border]])},[(i(),ce(En(o(f.type)),{class:ve(["h-5 w-5 flex-shrink-0 mt-0.5",a[f.type].icon])},null,8,["class"])),r("p",Ox,_(f.message),1),r("button",{type:"button",class:"p-0.5 rounded text-retro-muted hover:text-retro-text transition-colors",onClick:m=>s(t)(f.id)},[Y(s(pt),{class:"h-4 w-4"})],8,Ux)],2))),128))]),_:1})])]))}});function Ho(e){typeof document>"u"||(e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),document.cookie=`spec-cat-theme=${e};path=/;SameSite=Lax`)}function zx(){const e=Kn(),n=j(()=>e.theme),t=j(()=>e.theme==="dark");function a(){const o=e.theme==="dark"?"light":"dark";e.setTheme(o),Ho(o)}return Me(()=>e.theme,o=>{Ho(o)},{immediate:!0}),{theme:n,isDark:t,toggleTheme:a}}const Vx={class:"flex h-screen min-w-[320px] overflow-x-auto bg-retro-black text-retro-text"},Wx={class:"flex flex-col overflow-hidden",style:{flex:"3"}},Gx={class:"flex-shrink-0 h-14 flex items-center justify-between px-4 border-b border-retro-border bg-retro-panel"},qx={class:"flex items-center gap-2 min-w-0"},Zx={key:0,class:"text-xs text-retro-muted font-mono truncate"},Kx={class:"flex items-center gap-1"},Yx=["title"],Xx={class:"flex-1 min-h-0 overflow-y-auto"},Qx={key:0,class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"7"}},Jx={class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},e0={class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},t0={key:0,class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"3"}},n0={key:3,class:"fixed inset-0 z-40 flex flex-col bg-retro-black"},i0=Ce({__name:"default",setup(e){const n=Ss(),t=Kn(),a=ht(),o=Qn(),{isDark:l,toggleTheme:c}=zx(),f=j(()=>o.diffViewerFile!==null),m=j(()=>n.isChatFullscreen),d=S(!1),b=S(""),C=j(()=>{if(!b.value)return"";const h=b.value.replace(/\/+$/,"").split("/");return h[h.length-1]||""}),g=j(()=>C.value?`spec cat :: ${C.value}`:"spec cat");Ps(()=>({title:g.value}));const v=()=>{typeof window<"u"&&n.updateViewport(window.innerWidth)};return st(async()=>{typeof window<"u"&&(n.updateViewport(window.innerWidth),window.addEventListener("resize",v)),await t.hydrate(),await a.initialize(),await a.loadConversations();try{const h=await $fetch("/api/cwd");b.value=h.cwd}catch{b.value=""}}),bt(()=>{typeof window<"u"&&window.removeEventListener("resize",v)}),(h,R)=>{const G=bm;return i(),u("div",Vx,[r("div",Wx,[r("div",Gx,[r("div",qx,[R[4]||(R[4]=r("img",{alt:"SpecCat",src:ym,class:"w-5 h-5 text-retro-cyan mb-1"},null,-1)),R[5]||(R[5]=r("span",{class:"text-sm font-bold text-retro-cyan font-mono uppercase tracking-wider flex-shrink-0"},"SPECCAT",-1)),C.value?(i(),u("span",Zx,"/ "+_(C.value),1)):H("",!0)]),r("div",Kx,[r("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:s(l)?"Switch to light theme":"Switch to dark theme",onClick:R[0]||(R[0]=(...I)=>s(c)&&s(c)(...I))},[s(l)?(i(),ce(s(ua),{key:0,class:"w-5 h-5"})):(i(),ce(s(la),{key:1,class:"w-5 h-5"}))],8,Yx),r("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:"Settings",onClick:R[1]||(R[1]=I=>d.value=!0)},[Y(s(Jo),{class:"w-5 h-5"})])])]),r("div",Xx,[Y(G,{"working-directory":b.value},null,8,["working-directory"])])]),f.value?(i(),u("div",Qx,[Y(cx,{file:s(o).diffViewerFile,"commit-hash":s(o).diffViewerCommitHash,content:s(o).diffViewerContent,loading:s(o).diffViewerLoading,onClose:R[2]||(R[2]=I=>s(o).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):(i(),u(he,{key:1},[r("div",Jx,[Y(Eh)]),r("div",e0,[Y(wp)]),m.value?H("",!0):(i(),u("div",t0,[Y(Fo)]))],64)),d.value?(i(),ce(Fx,{key:2,onClose:R[3]||(R[3]=I=>d.value=!1)})):H("",!0),Y(jx),m.value?(i(),u("div",n0,[Y(Fo)])):H("",!0)])}}});export{i0 as default};
|