"use strict";(()=>{var e={};e.id=5695,e.ids=[5695],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")},80134:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>j,patchFetch:()=>w,requestAsyncStorage:()=>y,routeModule:()=>m,serverHooks:()=>h,staticGenerationAsyncStorage:()=>g});var o={};t.r(o),t.d(o,{GET:()=>q,POST:()=>v});var s=t(49303),n=t(88716),a=t(60670),i=t(87070),u=t(97425),d=t(75748),l=t(38693),p=t(83513),x=t(87946);let c=p.tK;function f(e,r){let t={enabled:e?.enabled??!1,expiresAt:e?.enabled?e.expiresAt:null};return void 0!==r&&(t.pollingStarted=r),t}function b(e){let r=(0,u.getDbInstance)();return(0,d.gU)(r,e)?null:i.NextResponse.json({error:`Worktree '${e}' not found`},{status:404})}async function q(e,{params:r}){try{let e=b(r.id);if(e)return e;let t=(0,l.bq)(r.id);return i.NextResponse.json(f(t))}catch(e){return console.error("Error getting auto-yes state:",e),i.NextResponse.json({error:"Failed to get auto-yes state"},{status:500})}}async function v(e,{params:r}){try{var t;let o,s;if(!(0,l.m$)(r.id))return i.NextResponse.json({error:"Invalid worktree ID format"},{status:400});let n=b(r.id);if(n)return n;try{o=await e.json()}catch{return i.NextResponse.json({error:"Invalid JSON body"},{status:400})}if("boolean"!=typeof o.enabled)return i.NextResponse.json({error:"enabled must be a boolean"},{status:400});let a=x.Ad;if(o.enabled&&void 0!==o.duration){if(!(0,x.l1)(o.duration))return i.NextResponse.json({error:"Invalid duration value. Allowed values: 3600000, 10800000, 28800000"},{status:400});a=o.duration}if(o.enabled&&void 0!==o.stopPattern){let e="string"==typeof o.stopPattern?o.stopPattern.trim():"";if(e){let r=(0,x.go)(e);if(!r.valid)return i.NextResponse.json({error:r.error},{status:400});s=e}}let u=(t=o.cliToolId)&&c.includes(t)?o.cliToolId:"claude",d=(0,l.bY)(r.id,o.enabled,o.enabled?a:void 0,o.enabled?s:void 0),p=!1;if(o.enabled){let e=(0,l.w)(r.id,u);p=e.started,e.started||console.warn(`[Auto-Yes API] Polling not started: ${e.reason}`)}else(0,l.Qz)(r.id);return i.NextResponse.json(f(d,p))}catch(e){return console.error("Error setting auto-yes state:",e),i.NextResponse.json({error:"Failed to set auto-yes state"},{status:500})}}let m=new s.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/worktrees/[id]/auto-yes/route",pathname:"/api/worktrees/[id]/auto-yes",filename:"route",bundlePath:"app/api/worktrees/[id]/auto-yes/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/auto-yes/route.ts",nextConfigOutput:"",userland:o}),{requestAsyncStorage:y,staticGenerationAsyncStorage:g,serverHooks:h}=m,j="/api/worktrees/[id]/auto-yes/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),o=r.X(0,[8948,5972,3853,4893,2509,7425,7566,4952,8693],()=>t(80134));module.exports=o})();