"use strict";(()=>{var e={};e.id=143,e.ids=[143],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")},2602:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>y,patchFetch:()=>g,requestAsyncStorage:()=>x,routeModule:()=>l,serverHooks:()=>f,staticGenerationAsyncStorage:()=>m});var s={};r.r(s),r.d(s,{GET:()=>c,PATCH:()=>d});var n=r(9303),i=r(8716),a=r(670),o=r(7070),u=r(728),p=r(5456);async function c(){if(!await (0,p.PR)())return o.NextResponse.json({error:"Unauthorized"},{status:401});let e=await u._.subscriptionTier.findMany({orderBy:{tierNumber:"asc"}});return o.NextResponse.json({tiers:e})}async function d(e){let t=await (0,p.PR)();if(!t)return o.NextResponse.json({error:"Unauthorized"},{status:401});let{id:r,...s}=await e.json(),n=await u._.subscriptionTier.update({where:{id:r},data:s});return await u._.activityLog.create({data:{userId:t.userId,action:"updated",entity:"SubscriptionTier",entityId:n.id,details:`${n.name}: ${JSON.stringify(s)}`}}),o.NextResponse.json({tier:n})}let l=new n.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/tiers/route",pathname:"/api/tiers",filename:"route",bundlePath:"app/api/tiers/route"},resolvedPagePath:"/Users/jakeshore/.clawdbot/workspace/oskv-dashboard/src/app/api/tiers/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:x,staticGenerationAsyncStorage:m,serverHooks:f}=l,y="/api/tiers/route";function g(){return(0,a.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:m})}},5456:(e,t,r)=>{r.d(t,{PR:()=>u,fT:()=>o});var s=r(1482),n=r.n(s),i=r(1615);let a=process.env.JWT_SECRET||"fallback-secret";function o(e){return n().sign(e,a,{expiresIn:"7d"})}async function u(){let e=await (0,i.cookies)(),t=e.get("token")?.value;return t?function(e){try{return n().verify(e,a)}catch{return null}}(t):null}},728:(e,t,r)=>{r.d(t,{_:()=>n});let s=require("@prisma/client"),n=globalThis.prisma||new s.PrismaClient}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[276,972,261],()=>r(2602));module.exports=s})();