"use strict";(()=>{var e={};e.id=996,e.ids=[996],e.modules={2934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},4580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},5869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},8893:e=>{e.exports=require("buffer")},4770:e=>{e.exports=require("crypto")},6162:e=>{e.exports=require("stream")},1764:e=>{e.exports=require("util")},8157:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>y,patchFetch:()=>g,requestAsyncStorage:()=>x,routeModule:()=>l,serverHooks:()=>f,staticGenerationAsyncStorage:()=>m});var n={};r.r(n),r.d(n,{GET:()=>p,POST:()=>d});var a=r(9303),s=r(8716),i=r(670),o=r(7070),u=r(728),c=r(5456);async function p(){if(!await (0,c.PR)())return o.NextResponse.json({error:"Unauthorized"},{status:401});let e=await u._.funnelMetric.findMany({orderBy:{date:"desc"},take:30});return o.NextResponse.json({metrics:e})}async function d(e){let t=await (0,c.PR)();if(!t)return o.NextResponse.json({error:"Unauthorized"},{status:401});let r=await e.json(),n=await u._.funnelMetric.create({data:{...r,date:new Date(r.date||new Date)}});return await u._.activityLog.create({data:{userId:t.userId,action:"recorded",entity:"FunnelMetric",entityId:n.id,details:"New metric entry"}}),o.NextResponse.json({metric:n})}let l=new a.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/metrics/route",pathname:"/api/metrics",filename:"route",bundlePath:"app/api/metrics/route"},resolvedPagePath:"/Users/jakeshore/.clawdbot/workspace/oskv-dashboard/src/app/api/metrics/route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:x,staticGenerationAsyncStorage:m,serverHooks:f}=l,y="/api/metrics/route";function g(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:m})}},5456:(e,t,r)=>{r.d(t,{PR:()=>u,fT:()=>o});var n=r(1482),a=r.n(n),s=r(1615);let i=process.env.JWT_SECRET||"fallback-secret";function o(e){return a().sign(e,i,{expiresIn:"7d"})}async function u(){let e=await (0,s.cookies)(),t=e.get("token")?.value;return t?function(e){try{return a().verify(e,i)}catch{return null}}(t):null}},728:(e,t,r)=>{r.d(t,{_:()=>a});let n=require("@prisma/client"),a=globalThis.prisma||new n.PrismaClient}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[276,972,261],()=>r(8157));module.exports=n})();