"use strict";(()=>{var e={};e.id=6521,e.ids=[6521],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")},30781:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>v,patchFetch:()=>w,requestAsyncStorage:()=>f,routeModule:()=>q,serverHooks:()=>h,staticGenerationAsyncStorage:()=>g});var s={};t.r(s),t.d(s,{POST:()=>m});var o=t(49303),i=t(88716),a=t(60670),n=t(87070),u=t(83513),p=t(55837),d=t(30721),c=t(94925),x=t(85930);let l=(0,t(43895).h)("api/capture");async function m(e,{params:r}){try{let{cliToolId:t,lines:s=1e3}=await e.json();if(!t||"string"!=typeof t||!(0,u._7)(t))return n.NextResponse.json({error:"Invalid cliToolId parameter"},{status:400});if("number"!=typeof s||!Number.isInteger(s)||s<1||s>1e5)return n.NextResponse.json({error:"Invalid lines parameter: must be an integer between 1 and 100000"},{status:400});let o=(0,c.getDbInstance)();if(!(0,d.gU)(o,r.id))return n.NextResponse.json({error:"Worktree not found"},{status:404});let i=p.g.getInstance().getTool(t).getSessionName(r.id);if(!await (0,x.Hk)(i))return n.NextResponse.json({error:"Session not found. Use startSession API to create a session first."},{status:404});let a=await (0,x.xq)(i,Math.floor(s));return n.NextResponse.json({output:a})}catch(e){return l.error("capture-api-error:",{error:e instanceof Error?e.message:String(e)}),n.NextResponse.json({error:"Failed to capture terminal output"},{status:500})}}let q=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/[id]/capture/route",pathname:"/api/worktrees/[id]/capture",filename:"route",bundlePath:"app/api/worktrees/[id]/capture/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/capture/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:f,staticGenerationAsyncStorage:g,serverHooks:h}=q,v="/api/worktrees/[id]/capture/route";function w(){return(0,a.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:g})}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,5972,3853,4893,3895,4925,721,9228],()=>t(30781));module.exports=s})();