module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},24361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},51615,(e,t,r)=>{t.exports=e.x("node:buffer",()=>require("node:buffer"))},68105,e=>{"use strict";var t=e.i(24652);let r=process.env.JWT_SECRET;e.s(["createToken",0,function(e){return t.default.sign(e,r,{expiresIn:"7d"})},"verifyToken",0,function(e){try{return t.default.verify(e,r)}catch{return null}}])},53065,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),p=e.i(47587),c=e.i(66012),R=e.i(70101),x=e.i(26937),E=e.i(10372),h=e.i(93695);e.i(52474);var v=e.i(220),g=e.i(89171),m=e.i(62294),f=e.i(93458),C=e.i(68105);async function b(){try{let e=await (0,f.cookies)(),t=e.get("token")?.value;if(!t)return g.NextResponse.json({error:"Sesión no válida"},{status:401});let r=(0,C.verifyToken)(t);if(!r||"brigadist"!==r.role)return g.NextResponse.json({error:"No autorizado"},{status:403});let a=r.id,[n]=await m.db.query("SELECT active FROM users WHERE id = ?",[a]);if(!n[0]||0===n[0].active)return g.NextResponse.json({error:"BLOCKED"},{status:403});let[s]=await m.db.query("SELECT * FROM militants WHERE created_by = ? AND status != 'inactive' ORDER BY created_at DESC",[a]),i=null;s.length>0&&(i=s[0].section_number);let o=`
      SELECT 
        g.*,
        IFNULL((
          SELECT COUNT(*) 
          FROM militants m 
          WHERE m.created_by = ? 
          AND m.status != 'inactive'
          AND m.created_at BETWEEN g.start_date AND g.end_date
        ), 0) as current_progress
      FROM goals g
      WHERE g.end_date >= CURDATE()
      AND (g.user_id = ? OR g.user_id IS NULL)
      ORDER BY g.created_at DESC
    `,[l]=await m.db.query(o,[a,a]),[u]=await m.db.query("SELECT DISTINCT section_number FROM sections ORDER BY section_number ASC");return g.NextResponse.json({militants:s,goals:l,userName:r.name,section_number:i,availableSections:u.map(e=>e.section_number)})}catch(e){return console.error("BRIGADIST_GET_ERROR:",e),g.NextResponse.json({error:"Error de servidor"},{status:500})}}e.s(["GET",0,b],64746);var w=e.i(64746);let y=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/brigadist/militants/route",pathname:"/api/brigadist/militants",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/brigadist/militants/route.ts",nextConfigOutput:"",userland:w,...{}}),{workAsyncStorage:T,workUnitAsyncStorage:N,serverHooks:_}=y;async function A(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),y.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/brigadist/militants/route";g=g.replace(/\/index$/,"")||"/";let m=await y.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!m)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:f,params:C,nextConfig:b,parsedUrl:w,isDraftMode:T,prerenderManifest:N,routerServerContext:_,isOnDemandRevalidate:A,revalidateOnlyGenerated:S,resolvedPathname:O,clientReferenceManifest:q,serverActionsManifest:D}=m,k=(0,o.normalizeAppPath)(g),P=!!(N.dynamicRoutes[k]||N.routes[O]),I=async()=>((null==_?void 0:_.render404)?await _.render404(e,t,w,!1):t.end("This page could not be found"),null);if(P&&!T){let e=!!N.routes[O],t=N.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(b.adapterPath)return await I();throw new h.NoFallbackError}}let j=null;!P||y.isDev||T||(j="/index"===(j=O)?"/":j);let H=!0===y.isDev||!P,M=P&&!H;D&&q&&(0,i.setManifestsSingleton)({page:g,clientReferenceManifest:q,serverActionsManifest:D});let U=e.method||"GET",L=(0,s.getTracer)(),F=L.getActiveScopeSpan(),B=!!(null==_?void 0:_.isWrappedByNextServer),K=!!(0,n.getRequestMeta)(e,"minimalMode"),W=(0,n.getRequestMeta)(e,"incrementalCache")||await y.getIncrementalCache(e,b,N,K);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let $={params:C,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts},cacheComponents:!!b.cacheComponents,supportsDynamicResponse:H,incrementalCache:W,cacheLifeProfiles:b.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>y.onRequestError(e,t,a,n,_)},sharedContext:{buildId:f}},G=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=u.NextRequestAdapter.fromNodeNextRequest(G,(0,u.signalFromNodeResponse)(t));try{let n,i=async e=>y.handle(X,$).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=L.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${U} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${U} ${g}`)}),o=async n=>{var s,o;let l=async({previousCacheEntry:r})=>{try{if(!K&&A&&S&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=$.renderOpts.fetchMetrics;let o=$.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=$.renderOpts.collectedTags;if(!P)return await (0,c.sendResponse)(G,V,s,$.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,R.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[E.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==$.renderOpts.collectedRevalidate&&!($.renderOpts.collectedRevalidate>=E.INFINITE_CACHE)&&$.renderOpts.collectedRevalidate,a=void 0===$.renderOpts.collectedExpire||$.renderOpts.collectedExpire>=E.INFINITE_CACHE?void 0:$.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await y.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:A})},!1,_),t}},u=await y.handleResponse({req:e,nextConfig:b,cacheKey:j,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:S,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:K});if(!P)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",A?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),T&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,R.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&P||d.delete(E.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,x.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(G,V,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};B&&F?await o(F):(n=L.getActiveScopeSpan(),await L.withPropagatedContext(e.headers,()=>L.trace(d.BaseServerSpan.handleRequest,{spanName:`${U} ${g}`,kind:s.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},o),void 0,!B))}catch(t){if(t instanceof h.NoFallbackError||await y.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:A})},!1,_),P)throw t;return await (0,c.sendResponse)(G,V,new Response(null,{status:500})),null}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:T,workUnitAsyncStorage:N})},"routeModule",0,y,"serverHooks",0,_,"workAsyncStorage",0,T,"workUnitAsyncStorage",0,N],53065)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__03mxawl._.js.map