"use strict";(()=>{var e={};e.id=3114,e.ids=[3114],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")},84770:e=>{e.exports=require("crypto")},92048:e=>{e.exports=require("fs")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},78818:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>h,patchFetch:()=>I,requestAsyncStorage:()=>x,routeModule:()=>l,serverHooks:()=>g,staticGenerationAsyncStorage:()=>f});var o={};t.r(o),t.d(o,{DELETE:()=>c,PUT:()=>p});var s=t(49303),n=t(88716),a=t(60670),m=t(87070),i=t(94925),u=t(30721);let d=(0,t(43895).h)("api/memos");async function p(e,{params:r}){try{let t=(0,i.getDbInstance)();if(!(0,u.gU)(t,r.id))return m.NextResponse.json({error:`Worktree '${r.id}' not found`},{status:404});if(!(0,u.ZI)(t,r.memoId))return m.NextResponse.json({error:`Memo '${r.memoId}' not found`},{status:404});let{title:o,content:s}=await e.json().catch(()=>({}));if(void 0!==o&&o.length>100)return m.NextResponse.json({error:"title must be 100 characters or less"},{status:400});if(void 0!==s&&s.length>1e4)return m.NextResponse.json({error:"content must be 10000 characters or less"},{status:400});(0,u.Nr)(t,r.memoId,{title:o,content:s});let n=(0,u.ZI)(t,r.memoId);return m.NextResponse.json({memo:n},{status:200})}catch(e){return d.error("error-updating-memo:",{error:e instanceof Error?e.message:String(e)}),m.NextResponse.json({error:"Failed to update memo"},{status:500})}}async function c(e,{params:r}){try{let e=(0,i.getDbInstance)();if(!(0,u.gU)(e,r.id))return m.NextResponse.json({error:`Worktree '${r.id}' not found`},{status:404});if(!(0,u.ZI)(e,r.memoId))return m.NextResponse.json({error:`Memo '${r.memoId}' not found`},{status:404});return(0,u._e)(e,r.memoId),m.NextResponse.json({success:!0},{status:200})}catch(e){return d.error("error-deleting-memo:",{error:e instanceof Error?e.message:String(e)}),m.NextResponse.json({error:"Failed to delete memo"},{status:500})}}let l=new s.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/worktrees/[id]/memos/[memoId]/route",pathname:"/api/worktrees/[id]/memos/[memoId]",filename:"route",bundlePath:"app/api/worktrees/[id]/memos/[memoId]/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/memos/[memoId]/route.ts",nextConfigOutput:"",userland:o}),{requestAsyncStorage:x,staticGenerationAsyncStorage:f,serverHooks:g}=l,h="/api/worktrees/[id]/memos/[memoId]/route";function I(){return(0,a.patchFetch)({serverHooks:g,staticGenerationAsyncStorage:f})}}};var r=require("../../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),o=r.X(0,[8948,5972,3895,4925,721],()=>t(78818));module.exports=o})();