module.exports=[193695,(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"))},324725,(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"))},814747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},918622,(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"))},556704,(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"))},832319,(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"))},270406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},425747,e=>{"use strict";e.i(684843),e.s([])},869789,e=>{"use strict";e.i(425747),e.s([])},382770,e=>{"use strict";var t=e.i(747909),r=e.i(174017),s=e.i(996250),a=e.i(759756),n=e.i(561916),o=e.i(174677),i=e.i(869741),l=e.i(316795),d=e.i(487718),p=e.i(995169),u=e.i(47587),c=e.i(666012),h=e.i(570101),v=e.i(626937),x=e.i(10372),m=e.i(193695);e.i(820232);var y=e.i(600220),f=e.i(89171);e.i(869789);var g=e.i(826882);let w="https://api.deno.com/v2",R=`Deno.serve(async (request) => {
  const target = request.headers.get("x-relay-target");
  const relayPath = request.headers.get("x-relay-path") || "/";

  if (!target) {
    return new Response(JSON.stringify({ error: "Missing x-relay-target header" }), {
      status: 400,
      headers: { "content-type": "application/json" },
    });
  }

  const targetUrl = target.replace(/\\/$/, "") + relayPath;
  const newHeaders = new Headers(request.headers);
  newHeaders.delete("x-relay-target");
  newHeaders.delete("x-relay-path");
  newHeaders.delete("host");

  const init = {
    method: request.method,
    headers: newHeaders,
  };

  if (request.method !== "GET" && request.method !== "HEAD") {
    init.body = request.body;
    init.duplex = "half";
  }

  try {
    const response = await fetch(targetUrl, init);
    return new Response(response.body, {
      status: response.status,
      headers: response.headers,
    });
  } catch (error) {
    return new Response(JSON.stringify({ error: error.message }), {
      status: 502,
      headers: { "content-type": "application/json" },
    });
  }
});`;async function E(e){try{let t=await e.json(),r=t.denoToken?.trim(),s=t.orgDomain?.trim(),a=t.projectName?.trim()||`relay-${Date.now().toString(36)}`;if(!s)return f.NextResponse.json({error:"Organization domain is required"},{status:400});if(!r)return f.NextResponse.json({error:"Deno Deploy API token is required"},{status:400});let n={Authorization:`Bearer ${r}`,"Content-Type":"application/json"},o=await fetch(`${w}/apps`,{method:"POST",headers:n,body:JSON.stringify({slug:a,labels:{"custom.kind":"9router-relay"},config:{install:"deno install",runtime:{type:"dynamic",entrypoint:"main.ts"}}})});if(!o.ok){let e=await o.text().catch(()=>"");if(409===o.status)return f.NextResponse.json({error:`App "${a}" already exists. Choose a different name.`},{status:409});return f.NextResponse.json({error:`Failed to create app (${o.status}): ${e}`},{status:o.status})}let i=await o.json(),l=await fetch(`${w}/apps/${i.id}/deploy`,{method:"POST",headers:n,body:JSON.stringify({assets:{"main.ts":{kind:"file",content:R,encoding:"utf-8"}}})});if(!l.ok){let e=await l.text().catch(()=>"");return console.error("Deno Deploy error:",l.status,e),await fetch(`${w}/apps/${i.id}`,{method:"DELETE",headers:{Authorization:`Bearer ${r}`}}).catch(()=>{}),f.NextResponse.json({error:`Deploy failed (${l.status}): ${e}`},{status:l.status})}let d=await l.json(),p=d.id,u=d.status,c=0;for(;"queued"===u||"building"===u;){if(c>=30)throw Error("Deploy timed out after 60 seconds");await new Promise(e=>setTimeout(e,2e3));let e=await fetch(`${w}/revisions/${p}`,{headers:{Authorization:`Bearer ${r}`}});if(!e.ok)break;u=(await e.json()).status,c++}if("succeeded"!==u)return await fetch(`${w}/apps/${i.id}`,{method:"DELETE",headers:{Authorization:`Bearer ${r}`}}).catch(()=>{}),f.NextResponse.json({error:`Deploy failed with status: ${u}`},{status:500});let h=s.split(".")[0],v=`https://${a}.${h}.deno.net`;console.log("Deno deployUrl:",v);let x=await (0,g.createProxyPool)({name:a,proxyUrl:v,type:"deno",noProxy:"",isActive:!0,strictProxy:!1});return f.NextResponse.json({proxyPool:x,deployUrl:v},{status:201})}catch(e){return console.log("Error deploying Deno Deploy relay:",e),f.NextResponse.json({error:e.message||"Deploy failed"},{status:500})}}e.s(["POST",0,E],169622);var P=e.i(169622);let _=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/proxy-pools/deno-deploy/route",pathname:"/api/proxy-pools/deno-deploy",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/proxy-pools/deno-deploy/route.js",nextConfigOutput:"standalone",userland:P,...{}}),{workAsyncStorage:b,workUnitAsyncStorage:j,serverHooks:A}=_;async function C(e,t,s){s.requestMeta&&(0,a.setRequestMeta)(e,s.requestMeta),_.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let f="/api/proxy-pools/deno-deploy/route";f=f.replace(/\/index$/,"")||"/";let g=await _.prepare(e,t,{srcPage:f,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve()),null;let{buildId:w,deploymentId:R,params:E,nextConfig:P,parsedUrl:b,isDraftMode:j,prerenderManifest:A,routerServerContext:C,isOnDemandRevalidate:N,revalidateOnlyGenerated:k,resolvedPathname:q,clientReferenceManifest:T,serverActionsManifest:$}=g,D=(0,i.normalizeAppPath)(f),S=!!(A.dynamicRoutes[D]||A.routes[q]),O=async()=>((null==C?void 0:C.render404)?await C.render404(e,t,b,!1):t.end("This page could not be found"),null);if(S&&!j){let e=!!A.routes[q],t=A.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(P.adapterPath)return await O();throw new m.NoFallbackError}}let H=null;!S||_.isDev||j||(H="/index"===(H=q)?"/":H);let U=!0===_.isDev||!S,I=S&&!U;$&&T&&(0,o.setManifestsSingleton)({page:f,clientReferenceManifest:T,serverActionsManifest:$});let M=e.method||"GET",B=(0,n.getTracer)(),F=B.getActiveScopeSpan(),z=!!(null==C?void 0:C.isWrappedByNextServer),K=!!(0,a.getRequestMeta)(e,"minimalMode"),L=(0,a.getRequestMeta)(e,"incrementalCache")||await _.getIncrementalCache(e,P,A,K);null==L||L.resetRequestCache(),globalThis.__incrementalCache=L;let G={params:E,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!P.experimental.authInterrupts},cacheComponents:!!P.cacheComponents,supportsDynamicResponse:U,incrementalCache:L,cacheLifeProfiles:P.cacheLife,waitUntil:s.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s,a)=>_.onRequestError(e,t,s,a,C)},sharedContext:{buildId:w,deploymentId:R}},J=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),W=d.NextRequestAdapter.fromNodeNextRequest(J,(0,d.signalFromNodeResponse)(t));try{let a,o=async e=>_.handle(W,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=B.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 s=r.get("next.route");if(s){let t=`${M} ${s}`;e.setAttributes({"next.route":s,"http.route":s,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",s),a.updateName(t))}else e.updateName(`${M} ${f}`)}),i=async a=>{var n,i;let l=async({previousCacheEntry:r})=>{try{if(!K&&N&&k&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await o(a);e.fetchMetrics=G.renderOpts.fetchMetrics;let i=G.renderOpts.pendingWaitUntil;i&&s.waitUntil&&(s.waitUntil(i),i=void 0);let l=G.renderOpts.collectedTags;if(!S)return await (0,c.sendResponse)(J,V,n,G.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);l&&(t[x.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,s=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:s}}}}catch(t){throw(null==r?void 0:r.isStale)&&await _.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:N})},!1,C),t}},d=await _.handleResponse({req:e,nextConfig:P,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:k,responseGenerator:l,waitUntil:s.waitUntil,isMinimalMode:K});if(!S)return null;if((null==d||null==(n=d.value)?void 0:n.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",N?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),j&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let p=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return K&&S||p.delete(x.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||p.get("Cache-Control")||p.set("Cache-Control",(0,v.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(J,V,new Response(d.value.body,{headers:p,status:d.value.status||200})),null};z&&F?await i(F):(a=B.getActiveScopeSpan(),await B.withPropagatedContext(e.headers,()=>B.trace(p.BaseServerSpan.handleRequest,{spanName:`${M} ${f}`,kind:n.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},i),void 0,!z))}catch(t){if(t instanceof m.NoFallbackError||await _.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:N})},!1,C),S)throw t;return await (0,c.sendResponse)(J,V,new Response(null,{status:500})),null}}e.s(["handler",0,C,"patchFetch",0,function(){return(0,s.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:j})},"routeModule",0,_,"serverHooks",0,A,"workAsyncStorage",0,b,"workUnitAsyncStorage",0,j],382770)},603283,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__01jhtos._.js"].map(t=>e.l(t))).then(()=>t(227359)))},255840,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0slucb~._.js"].map(t=>e.l(t))).then(()=>t(317026)))},654059,e=>{e.v(t=>Promise.all(["server/chunks/src_lib_db_0q087i2._.js"].map(t=>e.l(t))).then(()=>t(72167)))},287292,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0~p~am2._.js"].map(t=>e.l(t))).then(()=>t(344805)))},149047,e=>{e.v(t=>Promise.all(["server/chunks/src_lib_db_03zbn-s._.js"].map(t=>e.l(t))).then(()=>t(177498)))},936498,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0kaoh2i._.js"].map(t=>e.l(t))).then(()=>t(321297)))},866510,e=>{e.v(t=>Promise.all(["server/chunks/src_shared_constants_pricing_0oa_fz9.js"].map(t=>e.l(t))).then(()=>t(722503)))},555812,e=>{e.v(e=>Promise.resolve().then(()=>e(284904)))},552465,e=>{e.v(e=>Promise.resolve().then(()=>e(278199)))},43476,e=>{e.v(e=>Promise.resolve().then(()=>e(739080)))},224847,e=>{e.v(e=>Promise.resolve().then(()=>e(866951)))},378161,e=>{e.v(e=>Promise.resolve().then(()=>e(192561)))}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0..hq.v._.js.map