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),37870,e=>e.a(async(t,r)=>{try{var a=e.i(89171),n=e.i(64769),o=t([n]);async function i(e){try{let{searchParams:t}=new URL(e.url),r=t.get("vendedorId"),o=`
      SELECT column_name 
      FROM information_schema.columns 
      WHERE table_name = 'Pedido' 
      AND column_name IN ('clienteRnc', 'clienteTelefono', 'clienteDireccion')
    `,i=(await (0,n.queryOps)(o)).rows.map(e=>e.column_name),s=["id",'"numeroPedidoLocal"','"vendedorId"','"clienteId"','"clienteNombre"',"estado","subtotal","impuestos","total",'"notasEntrega"',"sincronizado",'"fechaDespacho"','"choferNombre"','"vehiculoPlaca"','"noConduce"',"merma",'"createdAt"','"updatedAt"'];i.includes("clienteRnc")?s.push('"clienteRnc"'):s.push('NULL as "clienteRnc"'),i.includes("clienteTelefono")?s.push('"clienteTelefono"'):s.push('NULL as "clienteTelefono"'),i.includes("clienteDireccion")?s.push('"clienteDireccion"'):s.push('NULL as "clienteDireccion"');let l=`SELECT ${s.join(", ")} FROM "Pedido"`,d=[];r&&(l+=' WHERE "vendedorId" = $1',d.push(r)),l+=' ORDER BY "createdAt" ASC LIMIT 200';let c=(await (0,n.queryOps)(l,d)).rows;if(0===c.length)return a.NextResponse.json([]);let u=c.map(e=>e.id),p=`
      SELECT 
        id, "pedidoId", "productoId", "productoNombre", cantidad, "precioUnitario"
      FROM "ItemPedido"
      WHERE "pedidoId" = ANY($1);
    `,h=(await (0,n.queryOps)(p,[u])).rows,R=c.map(e=>({...e,items:h.filter(t=>t.pedidoId===e.id)}));return a.NextResponse.json(R)}catch(e){return console.error("❌ Error al listar pedidos:",e.message),a.NextResponse.json({error:"Error interno al obtener pedidos",details:e.message},{status:500})}}[n]=o.then?(await o)():o,e.s(["GET",()=>i]),r()}catch(e){r(e)}},!1),54684,e=>e.a(async(t,r)=>{try{var a=e.i(47909),n=e.i(74017),o=e.i(96250),i=e.i(59756),s=e.i(61916),l=e.i(74677),d=e.i(69741),c=e.i(16795),u=e.i(87718),p=e.i(95169),h=e.i(47587),R=e.i(66012),m=e.i(70101),x=e.i(26937),E=e.i(10372),v=e.i(93695);e.i(52474);var f=e.i(220),g=e.i(37870),w=t([g]);[g]=w.then?(await w)():w;let b=new a.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/pedidos/route",pathname:"/api/pedidos",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/pedidos/route.ts",nextConfigOutput:"standalone",userland:g}),{workAsyncStorage:A,workUnitAsyncStorage:N,serverHooks:T}=b;function y(){return(0,o.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:N})}async function C(e,t,r){b.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let a="/api/pedidos/route";a=a.replace(/\/index$/,"")||"/";let o=await b.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:A,prerenderManifest:N,routerServerContext:T,isOnDemandRevalidate:O,revalidateOnlyGenerated:P,resolvedPathname:_,clientReferenceManifest:I,serverActionsManifest:q}=o,S=(0,d.normalizeAppPath)(a),k=!!(N.dynamicRoutes[S]||N.routes[_]),D=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,C,!1):t.end("This page could not be found"),null);if(k&&!A){let e=!!N.routes[_],t=N.dynamicRoutes[S];if(t&&!1===t.fallback&&!e){if(y.experimental.adapterPath)return await D();throw new v.NoFallbackError}}let j=null;!k||b.isDev||A||(j=_,j="/index"===j?"/":j);let U=!0===b.isDev||!k,H=k&&!U;q&&I&&(0,l.setManifestsSingleton)({page:a,clientReferenceManifest:I,serverActionsManifest:q});let M=e.method||"GET",L=(0,s.getTracer)(),$=L.getActiveScopeSpan(),F={params:w,prerenderManifest:N,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts},cacheComponents:!!y.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,i.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:y.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>b.onRequestError(e,t,a,n,T)},sharedContext:{buildId:g}},K=new c.NodeNextRequest(e),B=new c.NodeNextResponse(t),W=u.NextRequestAdapter.fromNodeNextRequest(K,(0,u.signalFromNodeResponse)(t));try{let o=async e=>b.handle(W,F).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")!==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=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${a}`)}),l=!!(0,i.getRequestMeta)(e,"minimalMode"),d=async i=>{var s,d;let c=async({previousCacheEntry:n})=>{try{if(!l&&O&&P&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await o(i);e.fetchMetrics=F.renderOpts.fetchMetrics;let s=F.renderOpts.pendingWaitUntil;s&&r.waitUntil&&(r.waitUntil(s),s=void 0);let d=F.renderOpts.collectedTags;if(!k)return await (0,R.sendResponse)(K,B,a,F.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(a.headers);d&&(t[E.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==F.renderOpts.collectedRevalidate&&!(F.renderOpts.collectedRevalidate>=E.INFINITE_CACHE)&&F.renderOpts.collectedRevalidate,n=void 0===F.renderOpts.collectedExpire||F.renderOpts.collectedExpire>=E.INFINITE_CACHE?void 0:F.renderOpts.collectedExpire;return{value:{kind:f.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 b.onRequestError(e,t,{routerKind:"App Router",routePath:a,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:O})},!1,T),t}},u=await b.handleResponse({req:e,nextConfig:y,cacheKey:j,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:P,responseGenerator:c,waitUntil:r.waitUntil,isMinimalMode:l});if(!k)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(d=u.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});l||t.setHeader("x-nextjs-cache",O?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let p=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return l&&k||p.delete(E.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||p.get("Cache-Control")||p.set("Cache-Control",(0,x.getCacheControlHeader)(u.cacheControl)),await (0,R.sendResponse)(K,B,new Response(u.value.body,{headers:p,status:u.value.status||200})),null};$?await d($):await L.withPropagatedContext(e.headers,()=>L.trace(p.BaseServerSpan.handleRequest,{spanName:`${M} ${a}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},d))}catch(t){if(t instanceof v.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:S,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:O})},!1,T),k)throw t;return await (0,R.sendResponse)(K,B,new Response(null,{status:500})),null}}e.s(["handler",()=>C,"patchFetch",()=>y,"routeModule",()=>b,"serverHooks",()=>T,"workAsyncStorage",()=>A,"workUnitAsyncStorage",()=>N]),r()}catch(e){r(e)}},!1)];

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