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}}])},259,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),E=e.i(26937),x=e.i(10372),h=e.i(93695);e.i(52474);var v=e.i(220),m=e.i(89171),C=e.i(62294),T=e.i(93458),f=e.i(68105);async function g(){try{let e=await (0,T.cookies)(),t=e.get("token")?.value,r=(0,f.verifyToken)(t||"");if(!r)return m.NextResponse.json({error:"No autorizado"},{status:401});let[a]=await C.db.query("SELECT current_session_id FROM users WHERE id = ?",[r.id]);if(!a[0]||a[0].current_session_id!==r.sessionId)return m.NextResponse.json({error:"SESION_INVALIDA"},{status:401});let[n]=await C.db.query("SELECT COUNT(*) as total FROM militants"),[s]=await C.db.query("SELECT COUNT(*) as total FROM users WHERE role IN ('admin', 'leader', 'brigadist')"),[i]=await C.db.query(`
      SELECT 
        (SELECT COUNT(DISTINCT neighborhood) FROM militants) as registradas,
        (SELECT COUNT(DISTINCT colonia) FROM sections) as totales
    `),[o]=await C.db.query(`
      SELECT 
        (SELECT COUNT(DISTINCT section_number) FROM militants) as registradas,
        (SELECT COUNT(DISTINCT section_number) FROM sections) as totales
    `),[l]=await C.db.query(`
      SELECT section_number as section, COUNT(*) as count 
      FROM militants 
      WHERE section_number IS NOT NULL AND section_number != ''
      GROUP BY section_number 
      ORDER BY section_number ASC
    `),[u]=await C.db.query(`
      SELECT first_name, last_name_paternal, notes 
      FROM militants 
      WHERE status = 'review' 
      ORDER BY updated_at DESC 
      LIMIT 3
    `);return m.NextResponse.json({totalMilitantes:n[0].total,totalUsuarios:s[0].total,colonias:{registradas:i[0].registradas||0,totales:i[0].totales||0},secciones:{registradas:o[0].registradas||0,totales:o[0].totales||0},latestReviews:u||[],sectionsData:l||[]})}catch(e){return console.error("STATS_ERROR:",e),m.NextResponse.json({error:"Error al obtener estadísticas"},{status:500})}}e.s(["GET",0,g],46630);var w=e.i(46630);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/admin/stats/route",pathname:"/api/admin/stats",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/admin/stats/route.ts",nextConfigOutput:"",userland:w,...{}}),{workAsyncStorage:y,workUnitAsyncStorage:N,serverHooks:S}=b;async function O(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),b.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let m="/api/admin/stats/route";m=m.replace(/\/index$/,"")||"/";let C=await b.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!C)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:T,params:f,nextConfig:g,parsedUrl:w,isDraftMode:y,prerenderManifest:N,routerServerContext:S,isOnDemandRevalidate:O,revalidateOnlyGenerated:_,resolvedPathname:A,clientReferenceManifest:q,serverActionsManifest:I}=C,k=(0,o.normalizeAppPath)(m),M=!!(N.dynamicRoutes[k]||N.routes[A]),U=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,w,!1):t.end("This page could not be found"),null);if(M&&!y){let e=!!N.routes[A],t=N.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(g.adapterPath)return await U();throw new h.NoFallbackError}}let P=null;!M||b.isDev||y||(P="/index"===(P=A)?"/":P);let D=!0===b.isDev||!M,j=M&&!D;I&&q&&(0,i.setManifestsSingleton)({page:m,clientReferenceManifest:q,serverActionsManifest:I});let H=e.method||"GET",L=(0,s.getTracer)(),F=L.getActiveScopeSpan(),B=!!(null==S?void 0:S.isWrappedByNextServer),$=!!(0,n.getRequestMeta)(e,"minimalMode"),K=(0,n.getRequestMeta)(e,"incrementalCache")||await b.getIncrementalCache(e,g,N,$);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let W={params:f,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!g.experimental.authInterrupts},cacheComponents:!!g.cacheComponents,supportsDynamicResponse:D,incrementalCache:K,cacheLifeProfiles:g.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>b.onRequestError(e,t,a,n,S)},sharedContext:{buildId:T}},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=>b.handle(X,W).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=`${H} ${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(`${H} ${m}`)}),o=async n=>{var s,o;let l=async({previousCacheEntry:r})=>{try{if(!$&&O&&_&&!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=W.renderOpts.fetchMetrics;let o=W.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=W.renderOpts.collectedTags;if(!M)return await (0,c.sendResponse)(G,V,s,W.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,R.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[x.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:W.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 b.onRequestError(e,t,{routerKind:"App Router",routePath:m,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:O})},!1,S),t}},u=await b.handleResponse({req:e,nextConfig:g,cacheKey:P,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:_,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:$});if(!M)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});$||t.setHeader("x-nextjs-cache",O?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),y&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,R.fromNodeOutgoingHttpHeaders)(u.value.headers);return $&&M||d.delete(x.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,E.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:`${H} ${m}`,kind:s.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},o),void 0,!B))}catch(t){if(t instanceof h.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:O})},!1,S),M)throw t;return await (0,c.sendResponse)(G,V,new Response(null,{status:500})),null}}e.s(["handler",0,O,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:y,workUnitAsyncStorage:N})},"routeModule",0,b,"serverHooks",0,S,"workAsyncStorage",0,y,"workUnitAsyncStorage",0,N],259)}];

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