(()=>{var a={};a.id=2381,a.ids=[2381],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},22606:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>S,patchFetch:()=>R,routeModule:()=>N,serverHooks:()=>Q,workAsyncStorage:()=>O,workUnitAsyncStorage:()=>P});var d={};c.r(d),c.d(d,{POST:()=>M,maxDuration:()=>z,runtime:()=>y});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211),w=c(94282);let x=new Set(["well-architected","azure-well-architected","team-topologies"]),y="nodejs",z=120,A=["c4","clean-architecture","solid","twelve-factor","dora","iso25010","wardley","well-architected","azure-well-architected"],B={c4:{name:"C4 Model",category:"Structural Clarity",prismPath:"/api/green/c4-model"},"clean-architecture":{name:"Clean Architecture",category:"Layer Violations",prismPath:"/api/green/cross-layer"},solid:{name:"SOLID Principles",category:"Code Quality",prismPath:"/api/green/coherence-score"},"twelve-factor":{name:"12-Factor App",category:"Cloud-Native Readiness",prismPath:"/api/green/twelve-factor"},dora:{name:"DORA Metrics",category:"Delivery Performance",prismPath:"/api/green/dora"},iso25010:{name:"ISO 25010",category:"Quality Profile",prismPath:"/api/green/status"},wardley:{name:"Wardley Map",category:"Strategic Positioning",prismPath:"/api/green/insights"},"well-architected":{name:"AWS Well-Architected",category:"Cloud Architecture",prismPath:"/api/green/well-architected"},"azure-well-architected":{name:"Azure Well-Architected",category:"Cloud Architecture",prismPath:"/api/green/azure-well-architected"}};function C(a){return a>=90?"A+":a>=85?"A":a>=80?"A-":a>=75?"B+":a>=70?"B":a>=65?"B-":a>=60?"C+":a>=55?"C":a>=50?"C-":a>=40?"D":"F"}function D(a){return a>=85?"Elite":a>=70?"Advanced":a>=55?"Developing":a>=40?"Initial":"Ad-hoc"}async function E(a,b,c,d){try{let e=new URLSearchParams({target:c});d&&e.set("workspace",d);let f=await fetch(`${a}${b}?${e.toString()}`,{signal:AbortSignal.timeout(8e3)});if(!f.ok)return null;return await f.json()}catch{return null}}function F(a,b=!1){if(!a)return{score:55,topFinding:`${b?"Azure":"AWS"} Well-Architected data unavailable`};let c=a.report??a,d="number"==typeof c.overallScore?c.overallScore:55;return{score:d,topFinding:`${b?"Azure":"AWS"} WAF score ${d}/100 across ${b?"5 pillars":"6 pillars"}`,details:{overallScore:d}}}async function G(a,b,d,e,f){let g=d.map(a=>`- ${a.name}: ${a.score}/100 (${a.grade}) — ${a.topFinding}`).join("\n"),h=`You are an expert software architect generating an executive architecture report.

Project: ${b}
Overall Architecture Score: ${e}/100 (${f})

Framework Results:
${g}

Generate a JSON response with exactly this structure:
{
  "executiveSummary": "<2-3 sentence executive summary of the architecture health>",
  "recommendations": [
    "<Top action item 1>",
    "<Top action item 2>",
    "<Top action item 3>",
    "<Top action item 4>",
    "<Top action item 5>"
  ],
  "roadmap": [
    {
      "phase": "Immediate",
      "timeframe": "0–30 days",
      "actions": ["<action 1>", "<action 2>"],
      "impact": "high"
    },
    {
      "phase": "Short-term",
      "timeframe": "30–90 days",
      "actions": ["<action 1>", "<action 2>"],
      "impact": "high"
    },
    {
      "phase": "Medium-term",
      "timeframe": "90–180 days",
      "actions": ["<action 1>"],
      "impact": "medium"
    }
  ]
}

Be specific, actionable, and grounded in the framework scores provided. Return only valid JSON.`;try{let{DirectLlmProvider:g}=await Promise.resolve().then(c.bind(c,82353)),i=new g({apiKey:a}),j=(await i.complete({messages:[{role:"user",content:h}],maxTokens:1500})).content.match(/\{[\s\S]*\}/);if(!j)throw Error("No JSON in response");let k=JSON.parse(j[0]);return{executiveSummary:k.executiveSummary??H(b,e,f),recommendations:Array.isArray(k.recommendations)?k.recommendations.slice(0,5):I(d),roadmap:Array.isArray(k.roadmap)?k.roadmap:J(d)}}catch{return{executiveSummary:H(b,e,f),recommendations:I(d),roadmap:J(d)}}}function H(a,b,c){let d=D(b);return`${a} achieves an overall architecture score of ${b}/100 (${c}), placing it at the ${d} maturity level. The codebase shows measurable compliance across multiple architectural frameworks, with clear opportunities to improve delivery performance and structural integrity. Prioritising the recommendations below will accelerate the path to architectural excellence.`}function I(a){return[...a].sort((a,b)=>a.score-b.score).slice(0,5).map(a=>`Improve ${a.name} compliance — currently ${a.score}/100: ${a.topFinding}`)}function J(a){let b=a.filter(a=>"fail"===a.status),c=a.filter(a=>"warn"===a.status);return[{phase:"Immediate",timeframe:"0–30 days",actions:b.length>0?b.slice(0,2).map(a=>`Address ${a.name} failures: ${a.topFinding}`):["Establish architecture decision records (ADRs)","Run full PRISM scan on all environments"],impact:"high"},{phase:"Short-term",timeframe:"30–90 days",actions:c.length>0?c.slice(0,2).map(a=>`Improve ${a.name}: ${a.topFinding}`):["Implement automated architecture compliance checks in CI","Document system bounded contexts"],impact:"high"},{phase:"Medium-term",timeframe:"90–180 days",actions:["Achieve A-grade across all framework assessments","Schedule quarterly architecture reviews"],impact:"medium"}]}function K(a){return a.startsWith("A")?"#22c55e":a.startsWith("B")?"#3b82f6":a.startsWith("C")?"#f59e0b":"#ef4444"}function L(a){let b={pass:"background:#22c55e20;color:#22c55e;border:1px solid #22c55e40",warn:"background:#f59e0b20;color:#f59e0b;border:1px solid #f59e0b40",fail:"background:#ef444420;color:#ef4444;border:1px solid #ef444440",unknown:"background:#64748b20;color:#64748b;border:1px solid #64748b40"};return b[a]??b.unknown}async function M(a){let b,c,d,e,f,g,h,i,j,k,{config:l,targetPath:m}=await (0,w.zN)(a);try{b=await a.json()}catch{return v.NextResponse.json({error:"Invalid JSON"},{status:400})}if(!l.apiKey)return v.NextResponse.json({error:"No API key configured. Add your Anthropic API key in Settings."},{status:400});let n=b.projectName?.trim()||(0,w.nk)(m)||"Project",o=(b.frameworks?.length?b.frameworks:A).filter(a=>a in B).filter(a=>!x.has(a)),p=process.env.PRISM_URL??"http://localhost:3001",q=b.workspace,r=await Promise.all(o.map(a=>E(p,B[a].prismPath,b.target??m,q))),s=o.map((a,b)=>{let c=B[a],d=r[b],e={};switch(a){case"c4":e=function(a){if(!a)return{score:55,topFinding:"C4 model could not be built — check PRISM target config"};let b=a.model,c=Array.isArray(b?.containers)?b.containers.length:0,d=Array.isArray(b?.components)?b.components.length:0;return{score:Math.min(100,50+5*c+15*(d>0)),topFinding:c>0?`${c} containers mapped, ${d} components identified`:"No containers detected — consider defining system boundaries",details:{containers:c,components:d}}}(d);break;case"clean-architecture":e=function(a){if(!a)return{score:60,topFinding:"Layer analysis unavailable — PRISM cross-layer data not found"};let b=a.snapshot,c=b?.violations?.length??0;return{score:Math.max(20,100-8*c),topFinding:0===c?"No layer violations detected — Dependency Rule upheld":`${c} layer violation${c>1?"s":""} detected`,details:{violations:c}}}(d);break;case"solid":e=function(a){if(!a)return{score:60,topFinding:"SOLID analysis requires PRISM coherence data"};let b=a?.latest,c="number"==typeof b?.score?b.score:60,d="string"==typeof b?.grade?b.grade:"?";return{score:c,topFinding:`Coherence score ${c}/100 (${d}) — proxy for SOLID adherence`,details:{coherenceScore:c,grade:d}}}(d);break;case"twelve-factor":e=function(a){if(!a)return{score:55,topFinding:"12-Factor analysis unavailable"};let b=a.report,c="number"==typeof b?.overallScore?b.overallScore:55,d="number"==typeof b?.passCount?b.passCount:"?";return{score:c,topFinding:`${d}/12 factors satisfied (score: ${c}/100)`,details:{overallScore:c,passCount:d}}}(d);break;case"dora":e=function(a){if(!a)return{score:50,topFinding:"DORA metrics require git history — ensure PRISM target is set"};let b=a.deploymentFrequency,c=a.leadTimeForChanges;return{score:"number"==typeof a.overallScore?a.overallScore:50,topFinding:b?.category?`Deployment frequency: ${b.category}; Lead time: ${c?.category??"unknown"}`:"DORA data partial — increase deployment tracking",details:{deploymentFrequency:b,leadTime:c}}}(d);break;case"iso25010":e=function(a){if(!a)return{score:60,topFinding:"Quality profile derived from architectural health signals"};let b="number"==typeof a.health?a.health:60;return{score:b,topFinding:`Overall system health: ${b}/100. ISO 25010 quality characteristics assessed.`,details:{health:b}}}(d);break;case"wardley":e=d?{score:"number"==typeof d.score?d.score:55,topFinding:"Strategic component evolution mapped — review commodity vs custom build decisions",details:d}:{score:55,topFinding:"Strategic positioning analysis requires architecture insights"};break;case"well-architected":e=F(d,!1);break;case"azure-well-architected":e=F(d,!0)}let f=e.score??55,g=C(f),h=f>=70?"pass":f>=50?"warn":"fail";return{id:a,name:c.name,category:c.category,score:f,grade:g,status:h,topFinding:e.topFinding??"Analysis data unavailable",details:e.details??{}}}),t=Math.round(s.reduce((a,b)=>a+b.score,0)/s.length),u=C(t),y=D(t),{executiveSummary:z,recommendations:H,roadmap:I}=await G(l.apiKey,n,s,t,u),J={projectName:n,overallScore:t,overallGrade:u,maturityLevel:y,executiveSummary:z,frameworks:s,recommendations:H,evolutionRoadmap:I,generatedAt:new Date().toLocaleString("en-GB",{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})},M=(c=K(J.overallGrade),d=J.frameworks.map(a=>`
      <tr style="border-bottom:1px solid #1e293b">
        <td style="padding:10px 12px;font-weight:500;color:#e2e8f0">${a.name}</td>
        <td style="padding:10px 12px;color:#94a3b8;font-size:12px">${a.category}</td>
        <td style="padding:10px 12px">
          <div style="display:flex;align-items:center;gap:8px">
            <div style="background:#1e293b;border-radius:4px;height:6px;width:80px;overflow:hidden">
              <div style="background:${K(a.grade)};height:6px;width:${a.score}%"></div>
            </div>
            <span style="color:#e2e8f0;font-weight:600;font-size:13px">${a.score}</span>
          </div>
        </td>
        <td style="padding:10px 12px">
          <span style="font-size:11px;font-weight:700;padding:2px 8px;border-radius:4px;${L(a.status)}">${a.grade}</span>
        </td>
        <td style="padding:10px 12px;color:#64748b;font-size:12px;max-width:260px">${a.topFinding}</td>
      </tr>`).join(""),e=J.recommendations.map((a,b)=>`
      <div style="display:flex;gap:12px;padding:12px 0;border-bottom:1px solid #1e293b">
        <div style="min-width:24px;height:24px;border-radius:50%;background:#f97316;color:#000;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700">${b+1}</div>
        <p style="margin:0;color:#cbd5e1;font-size:13px;line-height:1.6">${a}</p>
      </div>`).join(""),f=J.evolutionRoadmap.map(a=>{let b="high"===a.impact?"#ef4444":"medium"===a.impact?"#f59e0b":"#22c55e",c=a.actions.map(a=>`<li style="margin:4px 0;color:#94a3b8;font-size:13px">${a}</li>`).join("");return`
        <div style="padding:16px;border-radius:8px;background:#0f172a;border:1px solid #1e293b">
          <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:8px">
            <span style="font-weight:600;color:#e2e8f0">${a.phase}</span>
            <div style="display:flex;align-items:center;gap:8px">
              <span style="font-size:11px;color:#64748b;font-family:monospace">${a.timeframe}</span>
              <span style="font-size:10px;padding:2px 6px;border-radius:3px;background:${b}20;color:${b};border:1px solid ${b}40;text-transform:uppercase;font-weight:700">${a.impact} impact</span>
            </div>
          </div>
          <ul style="margin:0;padding-left:16px">${c}</ul>
        </div>`}).join(""),g=J.frameworks.map(a=>`
      <div style="border:1px solid #1e293b;border-radius:10px;overflow:hidden;margin-bottom:16px">
        <div style="background:#0f172a;padding:14px 16px;display:flex;align-items:center;justify-content:space-between">
          <div>
            <span style="font-weight:600;color:#e2e8f0">${a.name}</span>
            <span style="margin-left:8px;font-size:11px;color:#64748b">${a.category}</span>
          </div>
          <div style="display:flex;align-items:center;gap:10px">
            <span style="font-size:20px;font-weight:700;color:${K(a.grade)}">${a.score}</span>
            <span style="font-size:13px;padding:2px 8px;border-radius:4px;${L(a.status)};font-weight:700">${a.grade}</span>
          </div>
        </div>
        <div style="padding:14px 16px;background:#020617">
          <p style="margin:0;color:#94a3b8;font-size:13px">📌 <strong style="color:#cbd5e1">Key Finding:</strong> ${a.topFinding}</p>
        </div>
      </div>`).join(""),`<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Architecture Framework Report — ${J.projectName}</title>
  <style>
    * { box-sizing: border-box; }
    body { margin: 0; padding: 0; background: #020617; color: #e2e8f0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
    table { width: 100%; border-collapse: collapse; }
    @media print { body { background: #fff; color: #0f172a; } }
  </style>
</head>
<body>
  <div style="max-width:900px;margin:0 auto;padding:40px 24px">

    <!-- Header -->
    <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:8px">
      <div>
        <div style="font-size:11px;color:#64748b;font-family:monospace;letter-spacing:0.05em;text-transform:uppercase;margin-bottom:4px">Architecture Framework Report</div>
        <h1 style="margin:0;font-size:28px;font-weight:700;color:#f1f5f9">${J.projectName}</h1>
        <div style="font-size:12px;color:#475569;margin-top:4px">${J.generatedAt}</div>
      </div>
      <div style="text-align:right">
        <div style="font-size:52px;font-weight:800;color:${c};line-height:1">${J.overallScore}</div>
        <div style="font-size:16px;font-weight:700;color:${c}">${J.overallGrade}</div>
        <div style="font-size:11px;color:#64748b;margin-top:4px">${J.maturityLevel} Maturity</div>
      </div>
    </div>

    <div style="height:1px;background:linear-gradient(90deg,${c}80,transparent);margin:24px 0"></div>

    <!-- Executive Summary -->
    <section style="margin-bottom:36px">
      <h2 style="font-size:14px;font-weight:700;color:#f97316;text-transform:uppercase;letter-spacing:0.1em;margin:0 0 12px">Executive Summary</h2>
      <div style="padding:16px 20px;background:#0f172a;border:1px solid #1e293b;border-left:3px solid #f97316;border-radius:8px">
        <p style="margin:0;color:#cbd5e1;line-height:1.7;font-size:14px">${J.executiveSummary}</p>
      </div>
    </section>

    <!-- Compliance Matrix -->
    <section style="margin-bottom:36px">
      <h2 style="font-size:14px;font-weight:700;color:#f97316;text-transform:uppercase;letter-spacing:0.1em;margin:0 0 12px">Framework Compliance Matrix</h2>
      <div style="border:1px solid #1e293b;border-radius:10px;overflow:hidden">
        <table>
          <thead>
            <tr style="background:#0f172a">
              <th style="padding:10px 12px;text-align:left;font-size:11px;color:#64748b;font-weight:600;text-transform:uppercase;letter-spacing:0.05em">Framework</th>
              <th style="padding:10px 12px;text-align:left;font-size:11px;color:#64748b;font-weight:600;text-transform:uppercase;letter-spacing:0.05em">Category</th>
              <th style="padding:10px 12px;text-align:left;font-size:11px;color:#64748b;font-weight:600;text-transform:uppercase;letter-spacing:0.05em">Score</th>
              <th style="padding:10px 12px;text-align:left;font-size:11px;color:#64748b;font-weight:600;text-transform:uppercase;letter-spacing:0.05em">Grade</th>
              <th style="padding:10px 12px;text-align:left;font-size:11px;color:#64748b;font-weight:600;text-transform:uppercase;letter-spacing:0.05em">Top Finding</th>
            </tr>
          </thead>
          <tbody>${d}</tbody>
        </table>
      </div>
    </section>

    <!-- Detailed Results -->
    <section style="margin-bottom:36px">
      <h2 style="font-size:14px;font-weight:700;color:#f97316;text-transform:uppercase;letter-spacing:0.1em;margin:0 0 12px">Detailed Framework Results</h2>
      ${g}
    </section>

    <!-- Recommendations -->
    <section style="margin-bottom:36px">
      <h2 style="font-size:14px;font-weight:700;color:#f97316;text-transform:uppercase;letter-spacing:0.1em;margin:0 0 12px">Top Recommendations</h2>
      <div style="background:#0f172a;border:1px solid #1e293b;border-radius:10px;padding:4px 16px">
        ${e}
      </div>
    </section>

    <!-- Roadmap -->
    <section style="margin-bottom:36px">
      <h2 style="font-size:14px;font-weight:700;color:#f97316;text-transform:uppercase;letter-spacing:0.1em;margin:0 0 12px">Architecture Evolution Roadmap</h2>
      <div style="display:flex;flex-direction:column;gap:12px">
        ${f}
      </div>
    </section>

    <!-- Footer -->
    <div style="border-top:1px solid #1e293b;padding-top:20px;margin-top:40px;text-align:center">
      <p style="margin:0;color:#475569;font-size:11px">
        Generated with <a href="https://forge0x2b.dev" style="color:#f97316;text-decoration:none">forge0x2B</a> \xb7 Architecture intelligence for engineering teams
      </p>
    </div>

  </div>
</body>
</html>`),N=(h=["| Framework | Category | Score | Grade | Top Finding |","|-----------|----------|-------|-------|-------------|",...J.frameworks.map(a=>`| **${a.name}** | ${a.category} | ${a.score}/100 | **${a.grade}** | ${a.topFinding} |`)].join("\n"),i=J.recommendations.map((a,b)=>`${b+1}. ${a}`).join("\n"),j=J.evolutionRoadmap.map(a=>{let b=a.actions.map(a=>`   - ${a}`).join("\n");return`### ${a.phase} (${a.timeframe}) — ${a.impact.toUpperCase()} impact
${b}`}).join("\n\n"),k=J.frameworks.map(a=>`### ${a.name} — ${a.score}/100 (${a.grade})

**Category:** ${a.category}  
**Key Finding:** ${a.topFinding}`).join("\n\n---\n\n"),`# Architecture Framework Report — ${J.projectName}

**Overall Score:** ${J.overallScore}/100 (${J.overallGrade}) \xb7 **Maturity Level:** ${J.maturityLevel}
**Generated:** ${J.generatedAt}

---

## Executive Summary

${J.executiveSummary}

---

## Framework Compliance Matrix

${h}

---

## Detailed Framework Results

${k}

---

## Top Recommendations

${i}

---

## Architecture Evolution Roadmap

${j}

---

*Generated with [forge0x2B](https://forge0x2b.dev) \xb7 Architecture intelligence for engineering teams*`);return v.NextResponse.json({report:J,html:M,markdown:N,generatedAt:new Date().toISOString()})}let N=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/forge/framework-report/route",pathname:"/api/forge/framework-report",filename:"route",bundlePath:"app/api/forge/framework-report/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/private/tmp/forge-publish/app/api/forge/framework-report/route.ts",nextConfigOutput:"standalone",userland:d,...{}}),{workAsyncStorage:O,workUnitAsyncStorage:P,serverHooks:Q}=N;function R(){return(0,g.patchFetch)({workAsyncStorage:O,workUnitAsyncStorage:P})}async function S(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),N.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/forge/framework-report/route";"/index"===d&&(d="/");let e=await N.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:F,serverActionsManifest:G}=e,H=(0,k.normalizeAppPath)(d),I=!!(A.dynamicRoutes[H]||A.routes[E]),J=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(I&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[H];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await J();throw new t.NoFallbackError}}let K=null;!I||N.isDev||z||(K="/index"===(K=E)?"/":K);let L=!0===N.isDev||!I,M=I&&!L;G&&F&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:F,serverActionsManifest:G});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await N.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:L,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>N.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>N.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!I)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await N.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,B),b}},k=await N.handleResponse({req:a,nextConfig:x,cacheKey:K,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!I)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&I||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await N.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,B),I)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{"use strict";a.exports=require("node:fs")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},82353:a=>{"use strict";a.exports=import("forgesmith/providers")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94282:(a,b,c)=>{"use strict";c.d(b,{kV:()=>i,nk:()=>h,normalizeProjectRoot:()=>g,zN:()=>j});var d=c(73024),e=c(76760),f=c.n(e);function g(a){if(!a)return a;let b=a.replace(/\/+$/,"");return".prism"===f().basename(b)?f().dirname(b):b}function h(a){let b=g(a);try{let a=f().join(b,"package.json");if((0,d.existsSync)(a)){let b=JSON.parse((0,d.readFileSync)(a,"utf-8"));if("string"==typeof b.name&&""!==b.name.trim()){let a=b.name.trim(),c=a.lastIndexOf("/");return c>=0?a.slice(c+1):a}}}catch{}let c=f().basename(b);return c&&"."!==c?c:"Project"}function i(){return process.env.FORGE_TARGET&&""!==process.env.FORGE_TARGET.trim()?g(process.env.FORGE_TARGET):process.cwd()}async function j(a,b){let{loadConfig:d}=await c.e(4447).then(c.bind(c,84447)),e=await d(process.cwd()),f=function(a,b,c){if(c&&""!==c.trim())return g(c);let d=a.nextUrl.searchParams.get("target");if(d&&""!==d.trim())return g(d);let e=b?.prismFolderPath;return e&&""!==e.trim()?g(e):process.env.FORGE_TARGET&&""!==process.env.FORGE_TARGET.trim()?g(process.env.FORGE_TARGET):process.cwd()}(a,e,b),h=f===process.cwd()?e:await d(f);return!h.apiKey&&e.apiKey&&(h.apiKey=e.apiKey),!h.prismFolderPath&&e.prismFolderPath&&(h.prismFolderPath=e.prismFolderPath),{config:h,targetPath:f}}},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[3445,1813],()=>b(b.s=22606));module.exports=c})();