1import{n as e,t}from"./redirect-Dza75jpa.js";import{Et as n,Tt as r}from"./index-53ltmEK5.js";function i(e){if(Array.isArray(e))return e.flatMap(e=>i(e));if(typeof e!=`string`)return[];let t=[],n=0,r,a,o,s,c,l=()=>{for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length},u=()=>(a=e.charAt(n),a!==`=`&&a!==`;`&&a!==`,`);for(;n<e.length;){for(r=n,c=!1;l();)if(a=e.charAt(n),a===`,`){for(o=n,n+=1,l(),s=n;n<e.length&&u();)n+=1;n<e.length&&e.charAt(n)===`=`?(c=!0,n=s,t.push(e.slice(r,o)),r=n):n=o+1}else n+=1;(!c||n>=e.length)&&t.push(e.slice(r))}return t}function a(e){return e instanceof Headers?e:Array.isArray(e)||typeof e==`object`?new Headers(e):null}function o(...e){return e.reduce((e,t)=>{let n=a(t);if(!n)return e;for(let[t,r]of n.entries())t===`set-cookie`?i(r).forEach(t=>e.append(`set-cookie`,t)):e.set(t,r);return e},new Headers)}function s(e){return e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function c(e,t){let n=Object.create(null);if(e)for(let t of Object.keys(e))s(t)&&(n[t]=e[t]);if(t&&typeof t==`object`)for(let e of Object.keys(t))s(e)&&(n[e]=t[e]);return n}function l(e){if(!e)return Object.create(null);let t=Object.create(null);for(let n of Object.keys(e))s(n)&&(t[n]=e[n]);return t}var u=()=>{throw Error(`createServerOnlyFn() functions can only be called on the server!`)},d=(t,r)=>{let i=r||t||{};i.method===void 0&&(i.method=`GET`);let a=e=>d(void 0,{...i,validator:e,inputValidator:e});return Object.assign(e=>d(void 0,{...i,...e}),{options:i,middleware:e=>{let t=[...i.middleware||[]];e.map(e=>{n in e?e.options.middleware&&t.push(...e.options.middleware):t.push(e)});let r=d(void 0,{...i,middleware:t});return r[n]=!0,r},validator:a,inputValidator:a,handler:(...t)=>{let[n,r]=t,a={...i,extractedFn:n,serverFn:r},o=[...a.middleware||[],h(a)];return n.method=i.method,Object.assign(async t=>{let r=await f(o,`client`,{...n,...a,data:t?.data,headers:t?.headers,signal:t?.signal,fetch:t?.fetch,context:l()}),i=e(r.error);if(i)throw i;if(r.error)throw r.error;return r.result},{...n,method:i.method,__executeServer:async e=>{let t=u(),r=t.contextAfterGlobalMiddlewares;return await f(o,`server`,{...n,...e,serverFnMeta:n.serverFnMeta,context:c(e.context,r),request:t.request}).then(e=>({result:e.result,error:e.error,context:e.sendContext}))}})}})};async function f(e,n,i){let a=p([...r()?.functionMiddleware||[],...e]);if(n===`server`){let e=u({throwIfNotFound:!1});e?.executedRequestMiddlewares&&(a=a.filter(t=>!e.executedRequestMiddlewares.has(t)))}let s=async e=>{let r=a.shift();if(!r)return e;try{let i=`validator`in r.options?r.options.validator:void 0;!i&&`inputValidator`in r.options&&(i=r.options.inputValidator),i&&n===`server`&&(e.data=await m(i,e.data));let a;if(n===`client`?`client`in r.options&&(a=r.options.client):`server`in r.options&&(a=r.options.server),a){let n=async(t={})=>{let n=await s({...e,...t,context:c(e.context,t.context),sendContext:c(e.sendContext,t.sendContext),headers:o(e.headers,t.headers),_callSiteFetch:e._callSiteFetch,fetch:e._callSiteFetch??t.fetch??e.fetch,result:t.result===void 0?t instanceof Response?t:e.result:t.result,error:t.error??e.error});if(n.error)throw n.error;return n},r=await a({...e,next:n});if(t(r))return{...e,error:r};if(r instanceof Response)return{...e,result:r};if(!r)throw Error(`User middleware returned undefined. You must call next() or return a result in your middlewares.`);return r}return s(e)}catch(t){return{...e,error:t}}};return s({...i,headers:i.headers||{},sendContext:i.sendContext||{},context:i.context||l(),_callSiteFetch:i.fetch})}function p(e,t=100){let n=new Set,r=[],i=(e,a)=>{if(a>t)throw Error(`Middleware nesting depth exceeded maximum of ${t}. Check for circular references.`);e.forEach(e=>{e.options.middleware&&i(e.options.middleware,a+1),n.has(e)||(n.add(e),r.push(e))})};return i(e,0),r}async function m(e,t){if(e==null)return{};if(`~standard`in e){let n=await e[`~standard`].validate(t);if(n.issues)throw Error(JSON.stringify(n.issues,void 0,2));return n.value}if(`parse`in e)return e.parse(t);if(typeof e==`function`)return e(t);throw Error(`Invalid validator type!`)}function h(e){return{"~types":void 0,options:{inputValidator:e.validator??e.inputValidator,client:async({next:t,sendContext:n,fetch:r,...i})=>{let a={...i,context:n,fetch:r};return t(await e.extractedFn?.(a))},server:async({next:t,...n})=>{let r=await e.serverFn?.(n);return t({...n,result:r})}}}}export{d as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.