"use strict";(()=>{var e={};e.id=3058,e.ids=[3058],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},78893:e=>{e.exports=require("buffer")},61282:e=>{e.exports=require("child_process")},84770:e=>{e.exports=require("crypto")},17702:e=>{e.exports=require("events")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},32615:e=>{e.exports=require("http")},35240:e=>{e.exports=require("https")},98216:e=>{e.exports=require("net")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},76162:e=>{e.exports=require("stream")},82452:e=>{e.exports=require("tls")},17360:e=>{e.exports=require("url")},21764:e=>{e.exports=require("util")},71568:e=>{e.exports=require("zlib")},17679:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>v,patchFetch:()=>w,requestAsyncStorage:()=>x,routeModule:()=>g,serverHooks:()=>q,staticGenerationAsyncStorage:()=>f});var s={};t.r(s),t.d(s,{GET:()=>h,dynamic:()=>m});var o=t(49303),i=t(88716),n=t(60670),a=t(87070),p=t(97425),u=t(75748),c=t(43839),d=t(89194),l=t(13561);let m="force-dynamic";async function h(e){try{let r=(0,p.n)(),t=e.nextUrl?.searchParams,s=t?.get("repository"),o=(0,u.Xv)(r,s||void 0),i=c.g.getInstance(),n=["claude","codex","gemini"],m=await Promise.all(o.map(async e=>{let t={},s=!1,o=!1,a=!1;for(let p of n){let n=i.getTool(p),c=await n.isRunning(e.id),m=!1,h=!1;if(c)try{let t=await (0,d.NA)(e.id,p,100),s=(0,l._)(t,p);m="waiting"===s.status,h="running"===s.status,!s.hasActivePrompt&&(0,u._U)(r,e.id,void 0,10,p).some(e=>"prompt"===e.messageType&&e.promptData?.status!=="answered")&&(0,u.GP)(r,e.id,p)}catch{h=!0}t[p]={isRunning:c,isWaitingForResponse:m,isProcessing:h},c&&(s=!0),m&&(o=!0),h&&(a=!0)}return{...e,isSessionRunning:s,isWaitingForResponse:o,isProcessing:a,sessionStatusByCli:t}})),h=(0,u.ER)(r);return a.NextResponse.json({worktrees:m,repositories:h},{status:200})}catch(e){return console.error("Error fetching worktrees:",e),a.NextResponse.json({error:"Failed to fetch worktrees"},{status:500})}}let g=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/route",pathname:"/api/worktrees",filename:"route",bundlePath:"app/api/worktrees/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:x,staticGenerationAsyncStorage:f,serverHooks:q}=g,v="/api/worktrees/route";function w(){return(0,n.patchFetch)({serverHooks:q,staticGenerationAsyncStorage:f})}},13561:(e,r,t)=>{t.d(r,{_:()=>i});var s=t(19377),o=t(63661);function i(e,r,t){let i=(0,s.vp)(e),n=i.split("\n"),a=n.length-1;for(;a>=0&&""===n[a].trim();)a--;let p=n.slice(0,a+1),u=p.slice(-15).join("\n"),c=p.slice(-5).join("\n"),d=(0,s.Sg)(r);if((0,o.F)(i,d).isPrompt)return{status:"waiting",confidence:"high",reason:"prompt_detected",hasActivePrompt:!0};if((0,s.Wg)(r,c))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1};let{promptPattern:l}=(0,s.bs)(r);return l.test(u)?{status:"ready",confidence:"high",reason:"input_prompt",hasActivePrompt:!1}:t&&Date.now()-t.getTime()>5e3?{status:"ready",confidence:"low",reason:"no_recent_output",hasActivePrompt:!1}:{status:"running",confidence:"low",reason:"default",hasActivePrompt:!1}}}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,5972,3853,4893,7425,9367,7536],()=>t(17679));module.exports=s})();