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}}])},45447,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),R=e.i(70101),h=e.i(26937),x=e.i(10372),E=e.i(93695);e.i(52474);var g=e.i(220),m=e.i(89171),v=e.i(62294),f=e.i(93458),w=e.i(68105);async function _(){try{let e=await (0,f.cookies)(),t=e.get("token")?.value,r=(0,w.verifyToken)(t||"");if(!r||"leader"!==r.role)return m.NextResponse.json({error:"No autorizado"},{status:401});let[a]=await v.db.query(`
      SELECT c.*, t.is_read, t.is_disseminated 
      FROM digital_campaigns c
      JOIN campaign_tracking t ON c.id = t.campaign_id
      WHERE t.user_id = ?
      ORDER BY c.created_at DESC
      LIMIT 1
    `,[r.id]);if(0===a.length)return m.NextResponse.json({message:"No hay campañas activas"});let n=a[0],[i]=await v.db.query(`
      SELECT 
        u.id, 
        u.full_name as user_name, 
        t.is_read, 
        t.read_at,
        m.neighborhood
      FROM users u
      INNER JOIN militants m ON u.militant_id = m.id
      LEFT JOIN campaign_tracking t ON u.id = t.user_id AND t.campaign_id = ?
      WHERE u.role = 'brigadist'
      AND m.neighborhood IN (
        SELECT neighborhood FROM militants WHERE id = (
          SELECT militant_id FROM users WHERE id = ?
        )
      )
    `,[n.id,r.id]);return await v.db.query("UPDATE campaign_tracking SET is_read = 1, read_at = NOW() WHERE campaign_id = ? AND user_id = ?",[n.id,r.id]),m.NextResponse.json({...n,trackers:i})}catch(e){return console.error("LEADER_GET_ERROR:",e),m.NextResponse.json({error:"Error de servidor al obtener misión"},{status:500})}}e.s(["GET",0,_],94486);var y=e.i(94486);let N=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/leader/campaign/route",pathname:"/api/leader/campaign",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/leader/campaign/route.ts",nextConfigOutput:"",userland:y,...{}}),{workAsyncStorage:C,workUnitAsyncStorage:T,serverHooks:b}=N;async function A(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),N.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let m="/api/leader/campaign/route";m=m.replace(/\/index$/,"")||"/";let v=await N.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:f,params:w,nextConfig:_,parsedUrl:y,isDraftMode:C,prerenderManifest:T,routerServerContext:b,isOnDemandRevalidate:A,revalidateOnlyGenerated:O,resolvedPathname:k,clientReferenceManifest:q,serverActionsManifest:S}=v,P=(0,o.normalizeAppPath)(m),I=!!(T.dynamicRoutes[P]||T.routes[k]),H=async()=>((null==b?void 0:b.render404)?await b.render404(e,t,y,!1):t.end("This page could not be found"),null);if(I&&!C){let e=!!T.routes[k],t=T.dynamicRoutes[P];if(t&&!1===t.fallback&&!e){if(_.adapterPath)return await H();throw new E.NoFallbackError}}let j=null;!I||N.isDev||C||(j="/index"===(j=k)?"/":j);let D=!0===N.isDev||!I,M=I&&!D;S&&q&&(0,s.setManifestsSingleton)({page:m,clientReferenceManifest:q,serverActionsManifest:S});let U=e.method||"GET",F=(0,i.getTracer)(),L=F.getActiveScopeSpan(),W=!!(null==b?void 0:b.isWrappedByNextServer),$=!!(0,n.getRequestMeta)(e,"minimalMode"),K=(0,n.getRequestMeta)(e,"incrementalCache")||await N.getIncrementalCache(e,_,T,$);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let B={params:w,previewProps:T.preview,renderOpts:{experimental:{authInterrupts:!!_.experimental.authInterrupts},cacheComponents:!!_.cacheComponents,supportsDynamicResponse:D,incrementalCache:K,cacheLifeProfiles:_.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>N.onRequestError(e,t,a,n,b)},sharedContext:{buildId:f}},G=new l.NodeNextRequest(e),J=new l.NodeNextResponse(t),V=d.NextRequestAdapter.fromNodeNextRequest(G,(0,d.signalFromNodeResponse)(t));try{let n,s=async e=>N.handle(V,B).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")!==u.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} ${m}`)}),o=async n=>{var i,o;let l=async({previousCacheEntry:r})=>{try{if(!$&&A&&O&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(n);e.fetchMetrics=B.renderOpts.fetchMetrics;let o=B.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=B.renderOpts.collectedTags;if(!I)return await (0,c.sendResponse)(G,J,i,B.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,R.toNodeOutgoingHttpHeaders)(i.headers);l&&(t[x.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await N.onRequestError(e,t,{routerKind:"App Router",routePath:m,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:A})},!1,b),t}},d=await N.handleResponse({req:e,nextConfig:_,cacheKey:j,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:T,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:O,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:$});if(!I)return null;if((null==d||null==(i=d.value)?void 0:i.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});$||t.setHeader("x-nextjs-cache",A?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,R.fromNodeOutgoingHttpHeaders)(d.value.headers);return $&&I||u.delete(x.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(G,J,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};W&&L?await o(L):(n=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${U} ${m}`,kind:i.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},o),void 0,!W))}catch(t){if(t instanceof E.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:A})},!1,b),I)throw t;return await (0,c.sendResponse)(G,J,new Response(null,{status:500})),null}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:T})},"routeModule",0,N,"serverHooks",0,b,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,T],45447)}];

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