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"))},49700,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),o=e.i(61916),i=e.i(74677),s=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),p=e.i(47587),c=e.i(66012),h=e.i(70101),R=e.i(26937),E=e.i(10372),m=e.i(93695);e.i(52474);var x=e.i(220),g=e.i(89171),C=e.i(62294);async function b(e){let{searchParams:t}=new URL(e.url),r=t.get("neighborhood"),a=t.get("section"),n=t.get("leaderId");try{let e=[],t=[];r&&(e.push("m.neighborhood = ?"),t.push(r)),a&&(e.push("m.section_number = ?"),t.push(a)),n&&(e.push("(m.leader_id = ? OR m.created_by = ?)"),t.push(n,n));let o=e.length>0?`WHERE ${e.join(" AND ")}`:"",[i]=await C.db.query(`
      SELECT 
        COUNT(m.id) as total_militants,
        COUNT(DISTINCT CASE WHEN u.role = 'leader' THEN m.id END) as leader_count,
        COUNT(DISTINCT CASE WHEN u.role = 'brigadist' THEN m.id END) as brigadist_count
      FROM militants m
      LEFT JOIN users u ON m.id = u.militant_id
      ${o}
    `,t),s=i[0],[l]=await C.db.query(`
      SELECT 
        s.section_number,
        (SELECT COUNT(*) FROM militants m ${o?o+" AND":"WHERE"} m.section_number = s.section_number) as total
      FROM (SELECT DISTINCT section_number FROM sections) s
      ORDER BY total ASC
    `,t),[u]=await C.db.query(`
      SELECT 
        latitude, 
        longitude, 
        first_name, 
        last_name_paternal, 
        neighborhood, 
        section_number 
      FROM militants m
      ${o} ${o?"AND":"WHERE"} latitude IS NOT NULL AND longitude IS NOT NULL
    `,t),[d]=await C.db.query("SELECT id, full_name FROM users WHERE role = 'leader' ORDER BY full_name ASC"),[p]=await C.db.query("SELECT DISTINCT neighborhood FROM militants WHERE neighborhood IS NOT NULL ORDER BY neighborhood ASC"),[c]=await C.db.query("SELECT DISTINCT colonia FROM sections WHERE colonia IS NOT NULL ORDER BY colonia ASC"),[h]=await C.db.query("SELECT DISTINCT section_number FROM sections ORDER BY CAST(section_number AS UNSIGNED) ASC");return g.NextResponse.json({stats:{total:s.total_militants||0,leaders:s.leader_count||0,brigadists:s.brigadist_count||0,militants:s.total_militants||0},leaders:d||[],sections:h||[],neighborhoods:p,allNeighborhoods:c,missing:l.map(e=>({name:`Secci\xf3n ${e.section_number}`,count:e.total})),points:u.map(e=>({lat:parseFloat(e.latitude),lng:parseFloat(e.longitude),name:`${e.first_name} ${e.last_name_paternal}`,colonia:e.neighborhood||"Sin Colonia",seccion:e.section_number||"S/N"}))})}catch(e){return console.error("ERROR_REPORTE_FULL:",e),g.NextResponse.json({error:"Error al generar el reporte"},{status:500})}}e.s(["GET",0,b],28733);var N=e.i(28733);let T=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/reports/full/route",pathname:"/api/reports/full",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/reports/full/route.ts",nextConfigOutput:"",userland:N,...{}}),{workAsyncStorage:v,workUnitAsyncStorage:f,serverHooks:S}=T;async function _(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),T.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/reports/full/route";g=g.replace(/\/index$/,"")||"/";let C=await T.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!C)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:b,params:N,nextConfig:v,parsedUrl:f,isDraftMode:S,prerenderManifest:_,routerServerContext:w,isOnDemandRevalidate:O,revalidateOnlyGenerated:y,resolvedPathname:A,clientReferenceManifest:I,serverActionsManifest:q}=C,D=(0,s.normalizeAppPath)(g),H=!!(_.dynamicRoutes[D]||_.routes[A]),U=async()=>((null==w?void 0:w.render404)?await w.render404(e,t,f,!1):t.end("This page could not be found"),null);if(H&&!S){let e=!!_.routes[A],t=_.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(v.adapterPath)return await U();throw new m.NoFallbackError}}let L=null;!H||T.isDev||S||(L="/index"===(L=A)?"/":L);let P=!0===T.isDev||!H,M=H&&!P;q&&I&&(0,i.setManifestsSingleton)({page:g,clientReferenceManifest:I,serverActionsManifest:q});let k=e.method||"GET",F=(0,o.getTracer)(),j=F.getActiveScopeSpan(),$=!!(null==w?void 0:w.isWrappedByNextServer),B=!!(0,n.getRequestMeta)(e,"minimalMode"),W=(0,n.getRequestMeta)(e,"incrementalCache")||await T.getIncrementalCache(e,v,_,B);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let K={params:N,previewProps:_.preview,renderOpts:{experimental:{authInterrupts:!!v.experimental.authInterrupts},cacheComponents:!!v.cacheComponents,supportsDynamicResponse:P,incrementalCache:W,cacheLifeProfiles:v.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>T.onRequestError(e,t,a,n,w)},sharedContext:{buildId:b}},G=new l.NodeNextRequest(e),Y=new l.NodeNextResponse(t),V=u.NextRequestAdapter.fromNodeNextRequest(G,(0,u.signalFromNodeResponse)(t));try{let n,i=async e=>T.handle(V,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.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=`${k} ${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(`${k} ${g}`)}),s=async n=>{var o,s;let l=async({previousCacheEntry:r})=>{try{if(!B&&O&&y&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await i(n);e.fetchMetrics=K.renderOpts.fetchMetrics;let s=K.renderOpts.pendingWaitUntil;s&&a.waitUntil&&(a.waitUntil(s),s=void 0);let l=K.renderOpts.collectedTags;if(!H)return await (0,c.sendResponse)(G,Y,o,K.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[E.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=E.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=E.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:x.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await T.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:O})},!1,w),t}},u=await T.handleResponse({req:e,nextConfig:v,cacheKey:L,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:_,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:y,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:B});if(!H)return null;if((null==u||null==(o=u.value)?void 0:o.kind)!==x.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(s=u.value)?void 0:s.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",O?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return B&&H||d.delete(E.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,R.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(G,Y,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};$&&j?await s(j):(n=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(d.BaseServerSpan.handleRequest,{spanName:`${k} ${g}`,kind:o.SpanKind.SERVER,attributes:{"http.method":k,"http.target":e.url}},s),void 0,!$))}catch(t){if(t instanceof m.NoFallbackError||await T.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:O})},!1,w),H)throw t;return await (0,c.sendResponse)(G,Y,new Response(null,{status:500})),null}}e.s(["handler",0,_,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:f})},"routeModule",0,T,"serverHooks",0,S,"workAsyncStorage",0,v,"workUnitAsyncStorage",0,f],49700)}];

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