module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},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"))},23862,e=>e.a(async(t,r)=>{try{let t=await e.y("pg-587764f78a6c7a9c");e.n(t),r()}catch(e){r(e)}},!0),64769,e=>e.a(async(t,r)=>{try{var a=e.i(23862),n=t([a]);[a]=n.then?(await n)():n;let o=new a.Pool({host:"209.74.80.58",port:5432,user:"rrgnihyq_admin_domiblocks",password:"D0miblocks#2026",database:"rrgnihyq_DOMIBLOCKS_OPS",max:5,idleTimeoutMillis:3e4,connectionTimeoutMillis:1e4});o.on("error",e=>{console.error("❌ [DB OPS ERROR]:",e.message)}),e.s(["default",0,o,"queryOps",0,(e,t)=>o.query(e,t)]),r()}catch(e){r(e)}},!1),55014,e=>e.a(async(t,r)=>{try{var a=e.i(89171),n=e.i(64769),o=t([n]);async function s(e,{params:t}){try{let{id:r}=await t,{choferNombre:o,vehiculoPlaca:s,noConduce:i,estado:d}=await e.json();if("en proceso"===d&&!o){let e=`
        UPDATE "Pedido"
        SET 
          estado = $1,
          "updatedAt" = NOW()
        WHERE id = $2
        RETURNING id;
      `,t=await (0,n.queryOps)(e,["en proceso",r]);if(0===t.rowCount)return a.NextResponse.json({error:"Pedido no encontrado"},{status:404});return a.NextResponse.json({success:!0,message:"Pedido recibido en administración"})}if(!o||!s||!i)return a.NextResponse.json({error:"Faltan datos de despacho (Chofer, Vehículo o No. Conduce)"},{status:400});let l=`
      UPDATE "Pedido"
      SET 
        estado = $1,
        "fechaDespacho" = NOW(),
        "choferNombre" = $2,
        "vehiculoPlaca" = $3,
        "noConduce" = $4,
        "updatedAt" = NOW()
      WHERE id = $5
      RETURNING id;
    `,c=await (0,n.queryOps)(l,["despachado",o,s,i,r]);if(0===c.rowCount)return a.NextResponse.json({error:"Pedido no encontrado"},{status:404});return a.NextResponse.json({success:!0,message:"Pedido despachado correctamente"})}catch(e){return console.error("❌ Error en Despacho API:",e.message),a.NextResponse.json({error:"Error interno al procesar despacho",details:e.message},{status:500})}}[n]=o.then?(await o)():o,e.s(["POST",()=>s]),r()}catch(e){r(e)}},!1),12434,e=>e.a(async(t,r)=>{try{var a=e.i(47909),n=e.i(74017),o=e.i(96250),s=e.i(59756),i=e.i(61916),d=e.i(74677),l=e.i(69741),c=e.i(16795),u=e.i(87718),p=e.i(95169),h=e.i(47587),x=e.i(66012),R=e.i(70101),m=e.i(26937),v=e.i(10372),f=e.i(93695);e.i(52474);var E=e.i(220),g=e.i(55014),w=t([g]);[g]=w.then?(await w)():w;let N=new a.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/pedidos/[id]/despachar/route",pathname:"/api/pedidos/[id]/despachar",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/pedidos/[id]/despachar/route.ts",nextConfigOutput:"standalone",userland:g}),{workAsyncStorage:P,workUnitAsyncStorage:A,serverHooks:O}=N;function y(){return(0,o.patchFetch)({workAsyncStorage:P,workUnitAsyncStorage:A})}async function C(e,t,r){N.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let a="/api/pedidos/[id]/despachar/route";a=a.replace(/\/index$/,"")||"/";let o=await N.prepare(e,t,{srcPage:a,multiZoneDraftMode:!1});if(!o)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:g,params:w,nextConfig:y,parsedUrl:C,isDraftMode:P,prerenderManifest:A,routerServerContext:O,isOnDemandRevalidate:T,revalidateOnlyGenerated:b,resolvedPathname:q,clientReferenceManifest:S,serverActionsManifest:j}=o,_=(0,l.normalizeAppPath)(a),k=!!(A.dynamicRoutes[_]||A.routes[q]),D=async()=>((null==O?void 0:O.render404)?await O.render404(e,t,C,!1):t.end("This page could not be found"),null);if(k&&!P){let e=!!A.routes[q],t=A.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(y.experimental.adapterPath)return await D();throw new f.NoFallbackError}}let U=null;!k||N.isDev||P||(U=q,U="/index"===U?"/":U);let H=!0===N.isDev||!k,I=k&&!H;j&&S&&(0,d.setManifestsSingleton)({page:a,clientReferenceManifest:S,serverActionsManifest:j});let $=e.method||"GET",M=(0,i.getTracer)(),F=M.getActiveScopeSpan(),K={params:w,prerenderManifest:A,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts},cacheComponents:!!y.cacheComponents,supportsDynamicResponse:H,incrementalCache:(0,s.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:y.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>N.onRequestError(e,t,a,n,O)},sharedContext:{buildId:g}},B=new c.NodeNextRequest(e),W=new c.NodeNextResponse(t),L=u.NextRequestAdapter.fromNodeNextRequest(B,(0,u.signalFromNodeResponse)(t));try{let o=async e=>N.handle(L,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==p.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 n=r.get("next.route");if(n){let t=`${$} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${$} ${a}`)}),d=!!(0,s.getRequestMeta)(e,"minimalMode"),l=async s=>{var i,l;let c=async({previousCacheEntry:n})=>{try{if(!d&&T&&b&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await o(s);e.fetchMetrics=K.renderOpts.fetchMetrics;let i=K.renderOpts.pendingWaitUntil;i&&r.waitUntil&&(r.waitUntil(i),i=void 0);let l=K.renderOpts.collectedTags;if(!k)return await (0,x.sendResponse)(B,W,a,K.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,R.toNodeOutgoingHttpHeaders)(a.headers);l&&(t[v.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>=v.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,n=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=v.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:E.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==n?void 0:n.isStale)&&await N.onRequestError(e,t,{routerKind:"App Router",routePath:a,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:T})},!1,O),t}},u=await N.handleResponse({req:e,nextConfig:y,cacheKey:U,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:b,responseGenerator:c,waitUntil:r.waitUntil,isMinimalMode:d});if(!k)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==E.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});d||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),P&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let p=(0,R.fromNodeOutgoingHttpHeaders)(u.value.headers);return d&&k||p.delete(v.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||p.get("Cache-Control")||p.set("Cache-Control",(0,m.getCacheControlHeader)(u.cacheControl)),await (0,x.sendResponse)(B,W,new Response(u.value.body,{headers:p,status:u.value.status||200})),null};F?await l(F):await M.withPropagatedContext(e.headers,()=>M.trace(p.BaseServerSpan.handleRequest,{spanName:`${$} ${a}`,kind:i.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},l))}catch(t){if(t instanceof f.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:T})},!1,O),k)throw t;return await (0,x.sendResponse)(B,W,new Response(null,{status:500})),null}}e.s(["handler",()=>C,"patchFetch",()=>y,"routeModule",()=>N,"serverHooks",()=>O,"workAsyncStorage",()=>P,"workUnitAsyncStorage",()=>A]),r()}catch(e){r(e)}},!1)];

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