import{t as e}from"./request-context-DZ1qRdCD.js";import{E as t,M as n,O as r,S as i,Y as a,it as o,nt as s,rt as c}from"./implicit-tags-BJP8ZwY0.js";import{a as l}from"./dist-BXwifpp-.js";import"node:fs";function u(){return globalThis.__VINEXT_onRequestErrorHandler__??null}function d(t,n,r){let i=u();if(!i)return Promise.resolve();let a=(async()=>{try{await i(t,n,r)}catch(e){console.error(`[vinext] onRequestError handler threw:`,e instanceof Error?e.message:String(e))}})();return e()?.waitUntil(a),a}function f(e){if(!e.startsWith(`/`))throw Error(`[vinext] App Router render pathname must be absolute: ${e}`);return o(l(e))}function p(e){return e===null||!c(e)?null:f(e)}function m(e){let t=e.interceptionContext??null,r=f(e.targetMatchedPathname??e.displayPathname),i=f(e.matchedRoutePathname??e.targetMatchedPathname??e.displayPathname),a=p(e.interceptSourceMatchedUrl??null),o=e.interceptSlotId??null,s=a??i,c=n.encodeRouteId(s,null),l=n.encodePageId(s,null),u=a===null||o===null?null:{sourceMatchedUrl:a,sourceRouteId:n.encodeRouteId(a,null),slotId:o,targetMatchedUrl:r,targetRouteId:n.encodeRouteId(r,null)};return{displayPathname:e.displayPathname,interception:u,interceptionContext:t,matchedRoutePathname:s,pageId:l,routeId:c,targetMatchedPathname:r}}function h(){return`3fffc28053a703ded776449a4b03f1d404bf7989eb5a18a02464f9f71d9005a1`}function g(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e.charCodeAt(r)^t.charCodeAt(r);return n===0}function _(e){return typeof e!=`string`||e.length===0?!1:g(e,h())}function v(e){return typeof e==`string`?_(e):!1}async function y(e){let t=await s().get(e);if(!t)return null;let n=t.cacheState===`expired`;return{value:t,isStale:n||t.cacheState===`stale`,...n?{isExpired:!0}:{}}}function b(e,t={}){return{revalidate:e,...t.expireSeconds===void 0?{}:{expire:t.expireSeconds},...t.staleSeconds===void 0?{}:{stale:t.staleSeconds}}}async function x(e,t,n){await s().set(e,t,{cacheControl:n.cacheControl,revalidate:n.cacheControl.revalidate,tags:n.tags??[]})}var S=Symbol.for(`vinext.isrCache.pendingRegenerations`),C=globalThis,w=C[S]??=new Map,T=Symbol.for(`vinext.isrCache.pendingOnDemandRegenerations`);C[T]??=new Map;function E(t,n,r){if(!s().ownsBackgroundRevalidation||w.has(t))return;let i=n().catch(e=>{console.error(`[vinext] ISR background regeneration failed for ${t}:`,e),r&&d(e instanceof Error?e:Error(String(e)),{path:t,method:`GET`,headers:{}},{routerKind:r.routerKind,routePath:r.routePath,routeType:r.routeType,revalidateReason:`stale`})}).finally(()=>{w.delete(t)});w.set(t,i),e()?.waitUntil(i)}function D(e,t,n,r,i){let a={kind:`APP_PAGE`,html:e,rscData:t,headers:i,postponed:void 0,status:n};return r&&(a.renderObservation=r),a}function O(e){return e===`/`?`/`:e.replace(/\/$/,``)}function k(e,t,n){let r=O(t),i=n?`:${n}`:``,o=`${e}:${r}${i}`;return o.length<=200?o:`${e}:__hash:${a(r)}${i}`}function A(e,t,n=`25272b1a-84b2-43e2-87c4-a5fbb384e04d`){return k(n?`app:${n}`:`app`,e,t)}function j(e){return A(e,`html`)}function M(e){return p(e)}function N(e,n,o=i,s,c){let l=r(n),u=s==null?null:M(s),d=[u?`source:${a(u)}`:null,c?`selector:${a(c)}`:null,l?`slots:${a(l)}`:null,t(o)].filter(e=>e!==null).join(`:`);return A(e,d?`rsc:${d}`:`rsc`)}function P(e){return A(e,`route`)}export{v as a,x as c,d,D as i,E as l,P as n,b as o,N as r,y as s,j as t,m as u};