"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")},61282:e=>{e.exports=require("child_process")},84770:e=>{e.exports=require("crypto")},92048:e=>{e.exports=require("fs")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},21764:e=>{e.exports=require("util")},17679:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>k,patchFetch:()=>q,requestAsyncStorage:()=>w,routeModule:()=>h,serverHooks:()=>v,staticGenerationAsyncStorage:()=>f});var s={};t.r(s),t.d(s,{GET:()=>g,dynamic:()=>x});var o=t(49303),i=t(88716),a=t(60670),n=t(87070),p=t(97425),u=t(75748),c=t(97213),d=t(89194),l=t(19377),m=t(63661);let x="force-dynamic";async function g(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(),a=["claude","codex","gemini"],x=await Promise.all(o.map(async e=>{let t={},s=!1,o=!1,n=!1;for(let p of a){let a=i.getTool(p),c=await a.isRunning(e.id),x=!1,g=!1;if(c)try{let t=await (0,d.NA)(e.id,p,100),s=(0,l.vp)(t),o=(0,m.F)(s);if(o.isPrompt)x=!0;else{let e=s.split("\n").filter(e=>""!==e.trim()).slice(-15).join("\n");(0,l.Wg)(p,e)?g=!0:/^[>❯](\s*$|\s+\S)/m.test(e)||(g=!0)}!o.isPrompt&&(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{g=!0}t[p]={isRunning:c,isWaitingForResponse:x,isProcessing:g},c&&(s=!0),x&&(o=!0),g&&(n=!0)}return{...e,isSessionRunning:s,isWaitingForResponse:o,isProcessing:n,sessionStatusByCli:t}})),g=(0,u.ER)(r);return n.NextResponse.json({worktrees:x,repositories:g},{status:200})}catch(e){return console.error("Error fetching worktrees:",e),n.NextResponse.json({error:"Failed to fetch worktrees"},{status:500})}}let h=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:w,staticGenerationAsyncStorage:f,serverHooks:v}=h,k="/api/worktrees/route";function q(){return(0,a.patchFetch)({serverHooks:v,staticGenerationAsyncStorage:f})}}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,5972,7425,7213,1528],()=>t(17679));module.exports=s})();