import { e } from './chunks/dev-fallback-Bc5Ork7Y.js';
import { j as json, t as text, R as Redirect, S as SvelteKitError, H as HttpError, e as error, A as ActionFailure } from './chunks/index-wpIsICWW.js';
import { f, h, e as e$1, E as E$1, i, j as j$1, I as I$3, y, R as R$1, w as with_request_store, L as L$1, U as U$2, T as T$1, C as C$2, t, s, x as x$2, O as O$1, l, c, P as P$1, a as try_get_request_store, r, o, b as c$1 } from './chunks/exports-BWb4C4M4.js';
import { a as asClassComponent } from './chunks/legacy-server-U-epADY3.js';
import { s as setContext, r as readable, w as writable } from './chunks/async-DSsyBdZ5.js';
import { a } from './chunks/index5-BoOEKc6P.js';
import './chunks/index-CVCLyXDH.js';

/**
 * @template {{ tracing: { enabled: boolean, root: import('@opentelemetry/api').Span, current: import('@opentelemetry/api').Span } }} T
 * @param {T} event_like
 * @param {import('@opentelemetry/api').Span} current
 * @returns {T}
 */
function merge_tracing(event_like, current) {
	return {
		...event_like,
		tracing: {
			...event_like.tracing,
			current
		}
	};
}

const be={"<":"\\u003C","\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t","\u2028":"\\u2028","\u2029":"\\u2029"};class v extends Error{constructor(r,e){super(r),this.name="DevalueError",this.path=e.join("");}}function C$1(t){return Object(t)!==t}const Y=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Z(t){const r=Object.getPrototypeOf(t);return r===Object.prototype||r===null||Object.getPrototypeOf(r)===null||Object.getOwnPropertyNames(r).sort().join("\0")===Y}function W$1(t){return Object.prototype.toString.call(t).slice(8,-1)}function J(t){switch(t){case '"':return '\\"';case "<":return "\\u003C";case "\\":return "\\\\";case `
`:return "\\n";case "\r":return "\\r";case "	":return "\\t";case "\b":return "\\b";case "\f":return "\\f";case "\u2028":return "\\u2028";case "\u2029":return "\\u2029";default:return t<" "?`\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`:""}}function g(t){let r="",e=0;const n=t.length;for(let a=0;a<n;a+=1){const s=t[a],m=J(s);m&&(r+=t.slice(e,a)+m,e=a+1);}return `"${e===0?t:r+t.slice(e)}"`}function G$1(t){return Object.getOwnPropertySymbols(t).filter(r=>Object.getOwnPropertyDescriptor(t,r).enumerable)}const H=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function D(t){return H.test(t)?"."+t:"["+JSON.stringify(t)+"]"}function q(t){const r=new DataView(t);let e="";for(let n=0;n<t.byteLength;n++)e+=String.fromCharCode(r.getUint8(n));return X(e)}function K(t){const r=Q(t),e=new ArrayBuffer(r.length),n=new DataView(e);for(let a=0;a<e.byteLength;a++)n.setUint8(a,r.charCodeAt(a));return e}const L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Q(t){t.length%4===0&&(t=t.replace(/==?$/,""));let r="",e=0,n=0;for(let a=0;a<t.length;a++)e<<=6,e|=L.indexOf(t[a]),n+=6,n===24&&(r+=String.fromCharCode((e&16711680)>>16),r+=String.fromCharCode((e&65280)>>8),r+=String.fromCharCode(e&255),e=n=0);return n===12?(e>>=4,r+=String.fromCharCode(e)):n===18&&(e>>=2,r+=String.fromCharCode((e&65280)>>8),r+=String.fromCharCode(e&255)),r}function X(t){let r="";for(let e=0;e<t.length;e+=3){const n=[void 0,void 0,void 0,void 0];n[0]=t.charCodeAt(e)>>2,n[1]=(t.charCodeAt(e)&3)<<4,t.length>e+1&&(n[1]|=t.charCodeAt(e+1)>>4,n[2]=(t.charCodeAt(e+1)&15)<<2),t.length>e+2&&(n[2]|=t.charCodeAt(e+2)>>6,n[3]=t.charCodeAt(e+2)&63);for(let a=0;a<n.length;a++)typeof n[a]>"u"?r+="=":r+=L[n[a]];}return r}const E=-1,z=-2,U$1=-3,B=-4,x$1=-5,T=-6;function M$2(t,r){return ee(JSON.parse(t),r)}function ee(t,r){if(typeof t=="number")return a(t,true);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const e=t,n=Array(e.length);function a(s,m=false){if(s===E)return;if(s===U$1)return NaN;if(s===B)return 1/0;if(s===x$1)return  -1/0;if(s===T)return  -0;if(m||typeof s!="number")throw new Error("Invalid input");if(s in n)return n[s];const o=e[s];if(!o||typeof o!="object")n[s]=o;else if(Array.isArray(o))if(typeof o[0]=="string"){const h=o[0],i=r?.[h];if(i){let f=o[1];return typeof f!="number"&&(f=e.push(o[1])-1),n[s]=i(a(f))}switch(h){case "Date":n[s]=new Date(o[1]);break;case "Set":const f=new Set;n[s]=f;for(let b=1;b<o.length;b+=1)f.add(a(o[b]));break;case "Map":const c=new Map;n[s]=c;for(let b=1;b<o.length;b+=2)c.set(a(o[b]),a(o[b+1]));break;case "RegExp":n[s]=new RegExp(o[1],o[2]);break;case "Object":n[s]=Object(o[1]);break;case "BigInt":n[s]=BigInt(o[1]);break;case "null":const p=Object.create(null);n[s]=p;for(let b=1;b<o.length;b+=2)p[o[b]]=a(o[b+1]);break;case "Int8Array":case "Uint8Array":case "Uint8ClampedArray":case "Int16Array":case "Uint16Array":case "Int32Array":case "Uint32Array":case "Float32Array":case "Float64Array":case "BigInt64Array":case "BigUint64Array":{const b=globalThis[h],l=new b(a(o[1]));n[s]=o[2]!==void 0?l.subarray(o[2],o[3]):l;break}case "ArrayBuffer":{const b=o[1],l=K(b);n[s]=l;break}case "Temporal.Duration":case "Temporal.Instant":case "Temporal.PlainDate":case "Temporal.PlainTime":case "Temporal.PlainDateTime":case "Temporal.PlainMonthDay":case "Temporal.PlainYearMonth":case "Temporal.ZonedDateTime":{const b=h.slice(9);n[s]=Temporal[b].from(o[1]);break}case "URL":{const b=new URL(o[1]);n[s]=b;break}case "URLSearchParams":{const b=new URLSearchParams(o[1]);n[s]=b;break}default:throw new Error(`Unknown type ${h}`)}}else {const h=new Array(o.length);n[s]=h;for(let i=0;i<o.length;i+=1){const f=o[i];f!==z&&(h[i]=a(f));}}else {const h={};n[s]=h;for(const i in o){if(i==="__proto__")throw new Error("Cannot parse an object with a `__proto__` property");const f=o[i];h[i]=a(f);}}return n[s]}return a(0)}function te(t,r){const e=[],n=new Map,a=[];if(r)for(const i of Object.getOwnPropertyNames(r))a.push({key:i,fn:r[i]});const s=[];let m=0;function o(i){if(typeof i=="function")throw new v("Cannot stringify a function",s);if(i===void 0)return E;if(Number.isNaN(i))return U$1;if(i===1/0)return B;if(i===-1/0)return x$1;if(i===0&&1/i<0)return T;if(n.has(i))return n.get(i);const f=m++;n.set(i,f);for(const{key:p,fn:b}of a){const l=b(i);if(l)return e[f]=`["${p}",${o(l)}]`,f}let c="";if(C$1(i))c=I$2(i);else {const p=W$1(i);switch(p){case "Number":case "String":case "Boolean":c=`["Object",${I$2(i)}]`;break;case "BigInt":c=`["BigInt",${i}]`;break;case "Date":c=`["Date","${!isNaN(i.getDate())?i.toISOString():""}"]`;break;case "URL":c=`["URL",${g(i.toString())}]`;break;case "URLSearchParams":c=`["URLSearchParams",${g(i.toString())}]`;break;case "RegExp":const{source:l,flags:y}=i;c=y?`["RegExp",${g(l)},"${y}"]`:`["RegExp",${g(l)}]`;break;case "Array":c="[";for(let u=0;u<i.length;u+=1)u>0&&(c+=","),u in i?(s.push(`[${u}]`),c+=o(i[u]),s.pop()):c+=z;c+="]";break;case "Set":c='["Set"';for(const u of i)c+=`,${o(u)}`;c+="]";break;case "Map":c='["Map"';for(const[u,d]of i)s.push(`.get(${C$1(u)?I$2(u):"..."})`),c+=`,${o(u)},${o(d)}`,s.pop();c+="]";break;case "Int8Array":case "Uint8Array":case "Uint8ClampedArray":case "Int16Array":case "Uint16Array":case "Int32Array":case "Uint32Array":case "Float32Array":case "Float64Array":case "BigInt64Array":case "BigUint64Array":{const u=i;c='["'+p+'",'+o(u.buffer);const d=i.byteOffset,w=d+i.byteLength;if(d>0||w!==u.buffer.byteLength){const A=+/(\d+)/.exec(p)[1]/8;c+=`,${d/A},${w/A}`;}c+="]";break}case "ArrayBuffer":{c=`["ArrayBuffer","${q(i)}"]`;break}case "Temporal.Duration":case "Temporal.Instant":case "Temporal.PlainDate":case "Temporal.PlainTime":case "Temporal.PlainDateTime":case "Temporal.PlainMonthDay":case "Temporal.PlainYearMonth":case "Temporal.ZonedDateTime":c=`["${p}",${g(i.toString())}]`;break;default:if(!Z(i))throw new v("Cannot stringify arbitrary non-POJOs",s);if(G$1(i).length>0)throw new v("Cannot stringify POJOs with symbolic keys",s);if(Object.getPrototypeOf(i)===null){c='["null"';for(const u in i)s.push(D(u)),c+=`,${g(u)},${o(i[u])}`,s.pop();c+="]";}else {c="{";let u=false;for(const d in i)u&&(c+=","),u=true,s.push(D(d)),c+=`${g(d)}:${o(i[d])}`,s.pop();c+="}";}}}return e[f]=c,f}const h=o(t);return h<0?`${h}`:`[${e.join(",")}]`}function I$2(t){const r=typeof t;return r==="string"?g(t):t instanceof String?g(t.toString()):t===void 0?E.toString():t===0&&1/t<0?T.toString():r==="bigint"?`["BigInt","${t}"]`:String(t)}function re$1(t,r,e){r.startsWith("n:")?(r=r.slice(2),e=e===""?void 0:parseFloat(e)):r.startsWith("b:")&&(r=r.slice(2),e=e==="on"),ie(t,oe(r),e);}function ne$1(t){const r={};for(let e of t.keys()){const n=e.endsWith("[]");let a=t.getAll(e);if(n&&(e=e.slice(0,-2)),a.length>1&&!n)throw new Error(`Form cannot contain duplicated keys — "${e}" has ${a.length} values`);a=a.filter(s=>typeof s=="string"||s.name!==""||s.size>0),e.startsWith("n:")?(e=e.slice(2),a=a.map(s=>s===""?void 0:parseFloat(s))):e.startsWith("b:")&&(e=e.slice(2),a=a.map(s=>s==="on")),re$1(r,e,n?a:a[0]);}return r}const ae$1="application/x-sveltekit-formdata",N=0;async function he$1(t){if(t.headers.get("content-type")!==ae$1){const l=await t.formData();return {data:ne$1(l),meta:{},form_data:l}}if(!t.body)throw new Error("Could not deserialize binary form: no body");const r=t.body.getReader(),e=[];async function n(l){if(l in e)return e[l];let y=e.length;for(;y<=l;)e[y]=r.read().then(u=>u.value),y++;return e[l]}async function a(l,y){let u,d=0,w;for(w=0;;w++){const _=await n(w);if(!_)return null;const P=d+_.byteLength;if(l>=d&&l<P){u=_;break}d=P;}if(l+y<=d+u.byteLength)return u.subarray(l-d,l+y-d);const A=new Uint8Array(y);A.set(u.subarray(l-d));let $=u.byteLength-l+d;for(;$<y;){w++;let _=await n(w);if(!_)return null;_.byteLength>y-$&&(_=_.subarray(0,y-$)),A.set(_,$),$+=_.byteLength;}return A}const s=await a(0,7);if(!s)throw new Error("Could not deserialize binary form: too short");if(s[0]!==N)throw new Error(`Could not deserialize binary form: got version ${s[0]}, expected version ${N}`);const m=new DataView(s.buffer),o=m.getUint32(1,true),h=m.getUint16(5,true),i=await a(7,o);if(!i)throw new Error("Could not deserialize binary form: data too short");let f$1,c;if(h>0){const l=await a(7+o,h);if(!l)throw new Error("Could not deserialize binary form: file offset table too short");f$1=JSON.parse(f.decode(l)),c=7+o+h;}const[p,b]=M$2(f.decode(i),{File:([l,y,u,d,w])=>new Proxy(new S(l,y,u,d,n,c+f$1[w]),{getPrototypeOf(){return File.prototype}})});return (async()=>{let l=true;for(;l;)l=!!await n(e.length);})(),{data:p,meta:b,form_data:null}}class S{#t;#e;constructor(r,e,n,a,s,m){this.name=r,this.type=e,this.size=n,this.lastModified=a,this.webkitRelativePath="",this.#t=s,this.#e=m,this.arrayBuffer=this.arrayBuffer.bind(this),this.bytes=this.bytes.bind(this),this.slice=this.slice.bind(this),this.stream=this.stream.bind(this),this.text=this.text.bind(this);}#r;async arrayBuffer(){return this.#r??=await new Response(this.stream()).arrayBuffer(),this.#r}async bytes(){return new Uint8Array(await this.arrayBuffer())}slice(r=0,e=this.size,n=this.type){r<0?r=Math.max(this.size+r,0):r=Math.min(r,this.size),e<0?e=Math.max(this.size+e,0):e=Math.min(e,this.size);const a=Math.max(e-r,0);return new S(this.name,n,a,this.lastModified,this.#t,this.#e+r)}stream(){let r=0,e=0;return new ReadableStream({start:async n=>{let a=0,s=null;for(e=0;;e++){const m=await this.#t(e);if(!m)return null;const o=a+m.byteLength;if(this.#e>=a&&this.#e<o){s=m;break}a=o;}this.#e+this.size<=a+s.byteLength?(n.enqueue(s.subarray(this.#e-a,this.#e+this.size-a)),n.close()):(n.enqueue(s.subarray(this.#e-a)),r=s.byteLength-this.#e+a);},pull:async n=>{e++;let a=await this.#t(e);if(!a){n.error("Could not deserialize binary form: incomplete file data"),n.close();return}a.byteLength>this.size-r&&(a=a.subarray(0,this.size-r)),n.enqueue(a),r+=a.byteLength,r>=this.size&&n.close();}})}async text(){return f.decode(await this.arrayBuffer())}}const se=/^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/;function oe(t){if(!se.test(t))throw new Error(`Invalid path ${t}`);return t.split(/\.|\[|\]/).filter(Boolean)}function R(t){if(t==="__proto__"||t==="constructor"||t==="prototype")throw new Error(`Invalid key "${t}"`+(e?": This key is not allowed to prevent prototype pollution.":""))}function ie(t,r,e){let n=t;for(let s=0;s<r.length-1;s+=1){const m=r[s];R(m);const o=/^\d+$/.test(r[s+1]),h=m in n,i=n[m];if(h&&o!==Array.isArray(i))throw new Error(`Invalid array key ${r[s+1]}`);h||(n[m]=o?[]:{}),n=n[m];}const a=r[r.length-1];R(a),n[a]=e;}function we(t,r){const e=/^(moz-icon|view-source|jar):/.exec(r);e&&console.warn(`${t}: Calling \`depends('${r}')\` will throw an error in Firefox because \`${e[1]}\` is a special URI scheme`);}const _e$1="x-sveltekit-invalidated",ge="x-sveltekit-trailing-slash";function Ae$1(t,r){if(t!=null&&Object.getPrototypeOf(t)!==Object.prototype)throw new Error(`a load function ${r} returned ${typeof t!="object"?`a ${typeof t}`:t instanceof Response?"a Response object":Array.isArray(t)?"an array":"a non-plain object"}, but must return a plain object at the top level (i.e. \`return {...}\`)`)}function le(t,r){const e=Object.fromEntries(Object.entries(r).map(([n,a])=>[n,a.encode]));return te(t,e)}function $e(t,r){if(!t)return;const e=f.decode(h(t.replaceAll("-","+").replaceAll("_","/"))),n=Object.fromEntries(Object.entries(r).map(([a,s])=>[a,s.decode]));return M$2(e,n)}function Oe(t,r){return t+"/"+r}

let x={},G=n=>n?.stack;function O(n){}function P(n){x=n;}let k=null;function I$1(n){k=n;}function j(n,e){n.component(t=>{let{stores:i,page:a$1,constructors:s$1,components:u=[],form:r,data_0:c=null,data_1:f=null}=e;a||setContext("__svelte__",i),a||i.page.set(a$1);const g=s$1[1];if(s$1[1]){t.push("<!--[-->");const o=s$1[0];t.push("<!---->"),o(t,{data:c,form:r,params:a$1.params,children:p=>{p.push("<!---->"),g(p,{data:f,form:r,params:a$1.params}),p.push("<!---->");},$$slots:{default:true}}),t.push("<!---->");}else {t.push("<!--[!-->");const o=s$1[0];t.push("<!---->"),o(t,{data:c,form:r,params:a$1.params}),t.push("<!---->");}t.push("<!--]--> "),t.push("<!--[!-->"),t.push("<!--]-->");});}const C=asClassComponent(j),M$1={app_template_contains_nonce:false,async:true,csp:{mode:"auto",directives:{"upgrade-insecure-requests":false,"block-all-mixed-content":false},reportOnly:{"upgrade-insecure-requests":false,"block-all-mixed-content":false}},csrf_check_origin:true,csrf_trusted_origins:[],embedded:false,env_public_prefix:"PUBLIC_",env_private_prefix:"",hash_routing:false,hooks:null,preload_strategy:"modulepreload",root:C,service_worker:false,service_worker_options:void 0,templates:{app:({head:n,body:e,assets:t,nonce:i,env:a})=>`<!doctype html>
<html
	lang="en"
	style="
		margin: 0;
		padding: 0;
		min-height: 100%;
		display: flex;
		flex-direction: column;
	"
>
	<head>
		<meta charset="utf-8" />
		<link rel="icon" href="/favicon.ico" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<meta property="og:title" content="Gradio" />
		<meta property="og:type" content="website" />
		<meta property="og:url" content="{url}" />
		<meta property="og:description" content="Click to try out the app!" />
		<meta
			property="og:image"
			content="https://raw.githubusercontent.com/gradio-app/gradio/main/js/_website/src/lib/assets/img/header-image.jpg"
		/>
		<meta name="twitter:card" content="summary_large_image" />
		<meta name="twitter:creator" content="@Gradio" />
		<meta name="twitter:title" content="Gradio" />
		<meta name="twitter:description" content="Click to try out the app!" />
		<meta
			name="twitter:image"
			content="https://raw.githubusercontent.com/gradio-app/gradio/main/js/_website/src/lib/assets/img/header-image.jpg"
		/>
		<script data-gradio-mode>
			window.__gradio_mode__ = "app";
			window.iFrameResizer = {
				autoResize: false,
				sizeWidth: false
			};
			window.parent?.postMessage(
				{ type: "SET_SCROLLING", enabled: false },
				"*"
			);
		<\/script>
		<script
			src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"
			async
		><\/script>

		`+n+`
	</head>
	<body
		data-sveltekit-preload-data="hover"
		style="
			width: 100%;
			margin: 0;
			padding: 0;
			display: flex;
			flex-direction: column;
			flex-grow: 1;
		"
	>
		<div style="display: contents">`+e+`</div>
	</body>
</html>
`,error:({status:n,message:e})=>`<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>`+e+`</title>

		<style>
			body {
				--bg: white;
				--fg: #222;
				--divider: #ccc;
				background: var(--bg);
				color: var(--fg);
				font-family:
					system-ui,
					-apple-system,
					BlinkMacSystemFont,
					'Segoe UI',
					Roboto,
					Oxygen,
					Ubuntu,
					Cantarell,
					'Open Sans',
					'Helvetica Neue',
					sans-serif;
				display: flex;
				align-items: center;
				justify-content: center;
				height: 100vh;
				margin: 0;
			}

			.error {
				display: flex;
				align-items: center;
				max-width: 32rem;
				margin: 0 1rem;
			}

			.status {
				font-weight: 200;
				font-size: 3rem;
				line-height: 1;
				position: relative;
				top: -0.05rem;
			}

			.message {
				border-left: 1px solid var(--divider);
				padding: 0 0 0 1rem;
				margin: 0 0 0 1rem;
				min-height: 2.5rem;
				display: flex;
				align-items: center;
			}

			.message h1 {
				font-weight: 400;
				font-size: 1em;
				margin: 0;
			}

			@media (prefers-color-scheme: dark) {
				body {
					--bg: #222;
					--fg: #ddd;
					--divider: #666;
				}
			}
		</style>
	</head>
	<body>
		<div class="error">
			<span class="status">`+n+`</span>
			<div class="message">
				<h1>`+e+`</h1>
			</div>
		</div>
	</body>
</html>
`},version_hash:"7fch81"};async function U(){return {handle:void 0,handleFetch:void 0,handleError:void 0,handleValidationError:void 0,init:void 0,reroute:void 0,transport:void 0}}

function Rt(){let e,t;return {promise:new Promise((n,s)=>{e=n,t=s;}),resolve:e,reject:t}}const qr=[101,103,204,205,304],Nr=!!globalThis.process?.versions?.webcontainer,zr="/_svelte_kit_assets",Tt=["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"],Lr=["GET","POST","HEAD"],Pe="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",Dr=/[<\b\f\n\r\t\0\u2028\u2029]/g,Ir=/^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;function W(e,t){const r=new Map,n=[],s=new Map;function a(i){if(typeof i=="function")throw new v("Cannot stringify a function",n);if(!C$1(i)){if(r.has(i)){r.set(i,r.get(i)+1);return}if(r.set(i,1),t){const u=t(i,h=>W(h,t));if(typeof u=="string"){s.set(i,u);return}}switch(W$1(i)){case "Number":case "BigInt":case "String":case "Boolean":case "Date":case "RegExp":case "URL":case "URLSearchParams":return;case "Array":i.forEach((u,h)=>{n.push(`[${h}]`),a(u),n.pop();});break;case "Set":Array.from(i).forEach(a);break;case "Map":for(const[u,h]of i)n.push(`.get(${C$1(u)?Ue(u):"..."})`),a(h),n.pop();break;case "Int8Array":case "Uint8Array":case "Uint8ClampedArray":case "Int16Array":case "Uint16Array":case "Int32Array":case "Uint32Array":case "Float32Array":case "Float64Array":case "BigInt64Array":case "BigUint64Array":a(i.buffer);return;case "ArrayBuffer":return;case "Temporal.Duration":case "Temporal.Instant":case "Temporal.PlainDate":case "Temporal.PlainTime":case "Temporal.PlainDateTime":case "Temporal.PlainMonthDay":case "Temporal.PlainYearMonth":case "Temporal.ZonedDateTime":return;default:if(!Z(i))throw new v("Cannot stringify arbitrary non-POJOs",n);if(G$1(i).length>0)throw new v("Cannot stringify POJOs with symbolic keys",n);for(const u in i)n.push(D(u)),a(i[u]),n.pop();}}}a(e);const c=new Map;Array.from(r).filter(i=>i[1]>1).sort((i,l)=>l[1]-i[1]).forEach((i,l)=>{c.set(i[0],Hr(l));});function d(i){if(c.has(i))return c.get(i);if(C$1(i))return Ue(i);if(s.has(i))return s.get(i);const l=W$1(i);switch(l){case "Number":case "String":case "Boolean":return `Object(${d(i.valueOf())})`;case "RegExp":return `new RegExp(${g(i.source)}, "${i.flags}")`;case "Date":return `new Date(${i.getTime()})`;case "URL":return `new URL(${g(i.toString())})`;case "URLSearchParams":return `new URLSearchParams(${g(i.toString())})`;case "Array":const u=i.map((_,y)=>y in i?d(_):""),h=i.length===0||i.length-1 in i?"":",";return `[${u.join(",")}${h}]`;case "Set":case "Map":return `new ${l}([${Array.from(i).map(d).join(",")}])`;case "Int8Array":case "Uint8Array":case "Uint8ClampedArray":case "Int16Array":case "Uint16Array":case "Int32Array":case "Uint32Array":case "Float32Array":case "Float64Array":case "BigInt64Array":case "BigUint64Array":{let _=`new ${l}`;if(r.get(i.buffer)===1){const x=new i.constructor(i.buffer);_+=`([${x}])`;}else _+=`([${d(i.buffer)}])`;const y=i.byteOffset,b=y+i.byteLength;if(y>0||b!==i.buffer.byteLength){const x=+/(\d+)/.exec(l)[1]/8;_+=`.subarray(${y/x},${b/x})`;}return _}case "ArrayBuffer":return `new Uint8Array([${new Uint8Array(i).toString()}]).buffer`;case "Temporal.Duration":case "Temporal.Instant":case "Temporal.PlainDate":case "Temporal.PlainTime":case "Temporal.PlainDateTime":case "Temporal.PlainMonthDay":case "Temporal.PlainYearMonth":case "Temporal.ZonedDateTime":return `${l}.from(${g(i.toString())})`;default:const p=Object.keys(i),m=p.map(_=>`${Wr(_)}:${d(i[_])}`).join(",");return Object.getPrototypeOf(i)===null?p.length>0?`{${m},__proto__:null}`:"{__proto__:null}":`{${m}}`}}const o=d(e);if(c.size){const i=[],l=[],u=[];return c.forEach((h,p)=>{if(i.push(h),s.has(p)){u.push(s.get(p));return}if(C$1(p)){u.push(Ue(p));return}switch(W$1(p)){case "Number":case "String":case "Boolean":u.push(`Object(${d(p.valueOf())})`);break;case "RegExp":u.push(p.toString());break;case "Date":u.push(`new Date(${p.getTime()})`);break;case "Array":u.push(`Array(${p.length})`),p.forEach((f,_)=>{l.push(`${h}[${_}]=${d(f)}`);});break;case "Set":u.push("new Set"),l.push(`${h}.${Array.from(p).map(f=>`add(${d(f)})`).join(".")}`);break;case "Map":u.push("new Map"),l.push(`${h}.${Array.from(p).map(([f,_])=>`set(${d(f)}, ${d(_)})`).join(".")}`);break;case "ArrayBuffer":u.push(`new Uint8Array([${new Uint8Array(p).join(",")}]).buffer`);break;default:u.push(Object.getPrototypeOf(p)===null?"Object.create(null)":"{}"),Object.keys(p).forEach(f=>{l.push(`${h}${Br(f)}=${d(p[f])}`);});}}),l.push(`return ${o}`),`(function(${i.join(",")}){${l.join(";")}}(${u.join(",")}))`}else return o}function Hr(e){let t="";do t=Pe[e%Pe.length]+t,e=~~(e/Pe.length)-1;while(e>=0);return Ir.test(t)?`${t}0`:t}function Mr(e){return be[e]||e}function Ot(e){return e.replace(Dr,Mr)}function Wr(e){return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(e)?e:Ot(JSON.stringify(e))}function Br(e){return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(e)?`.${e}`:`[${Ot(JSON.stringify(e))}]`}function Ue(e){if(typeof e=="string")return g(e);if(e===void 0)return "void 0";if(e===0&&1/e<0)return "-0";const t=String(e);return typeof e=="number"?t.replace(/^(-)?0\./,"$1."):typeof e=="bigint"?e+"n":t}function Ve(e,t){const r=[];e.split(",").forEach((a,c)=>{const d=/([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(a);if(d){const[,o,i,l="1"]=d;r.push({type:o,subtype:i,q:+l,i:c});}}),r.sort((a,c)=>a.q!==c.q?c.q-a.q:a.subtype==="*"!=(c.subtype==="*")?a.subtype==="*"?1:-1:a.type==="*"!=(c.type==="*")?a.type==="*"?1:-1:a.i-c.i);let n,s=1/0;for(const a of t){const[c,d]=a.split("/"),o=r.findIndex(i=>(i.type===c||i.type==="*")&&(i.subtype===d||i.subtype==="*"));o!==-1&&o<s&&(n=a,s=o);}return n}function Fr(e,...t){const r=e.headers.get("content-type")?.split(";",1)[0].trim()??"";return t.includes(r.toLowerCase())}function Ge(e){return Fr(e,"application/x-www-form-urlencoded","multipart/form-data","text/plain",ae$1)}function Vr(e){return e instanceof Error||e&&e.name&&e.message?e:new Error(JSON.stringify(e))}function ce(e){return e instanceof HttpError||e instanceof SvelteKitError?e.status:500}function Gr(e){return e instanceof SvelteKitError?e.text:"Internal Error"}const Ct={"&":"&amp;",'"':"&quot;"},Pt={"&":"&amp;","<":"&lt;"},Ut="[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]",Jr=new RegExp(`[${Object.keys(Ct).join("")}]|`+Ut,"g"),Zr=new RegExp(`[${Object.keys(Pt).join("")}]|`+Ut,"g");function Je(e,t){const r=t?Ct:Pt;return e.replace(t?Jr:Zr,s=>s.length===2?s:r[s]??`&#${s.charCodeAt(0)};`)}function qt(e,t){return text(`${t} method not allowed`,{status:405,headers:{allow:Kr(e).join(", ")}})}function Kr(e){const t=Tt.filter(r=>r in e);return "GET"in e&&!("HEAD"in e)&&t.push("HEAD"),t}function Nt(e$1){return e?"__sveltekit_dev":`__sveltekit_${e$1.version_hash}`}function Ae(e$1,t,r){let n=e$1.templates.error({status:t,message:Je(r)});return e&&(n=n.replace("</head>",'<script type="module" src="/@vite/client"><\/script></head>')),text(n,{headers:{"content-type":"text/html; charset=utf-8"},status:t})}async function ct(e,t,r,n){n=n instanceof HttpError?n:Vr(n);const s=ce(n),a=await M(e,t,r,n),c=Ve(e.request.headers.get("accept")||"text/html",["application/json","text/html"]);return e.isDataRequest||c==="application/json"?json(a,{status:s}):Ae(r,s,a.message)}async function M(e$1,t,r,n){if(n instanceof HttpError)return {message:"Unknown Error",...n.body};e&&typeof n=="object"&&G(n);const s=ce(n),a=Gr(n);return await with_request_store({event:e$1,state:t},()=>r.hooks.handleError({error:n,event:e$1,status:s,message:a}))??{message:a}}function Se(e,t){return new Response(void 0,{status:e,headers:{location:t}})}function zt(e,t){return t.path?`Data returned from \`load\` while rendering ${e.route.id} is not serializable: ${t.message} (${t.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`:t.path===""?`Data returned from \`load\` while rendering ${e.route.id} is not a plain object`:t.message}function Lt(e){const t={};return e.uses&&e.uses.dependencies.size>0&&(t.dependencies=Array.from(e.uses.dependencies)),e.uses&&e.uses.search_params.size>0&&(t.search_params=Array.from(e.uses.search_params)),e.uses&&e.uses.params.size>0&&(t.params=Array.from(e.uses.params)),e.uses?.parent&&(t.parent=1),e.uses?.route&&(t.route=1),e.uses?.url&&(t.url=1),t}function Dt(e,t){return e._.prerendered_routes.has(t)||t.at(-1)==="/"&&e._.prerendered_routes.has(t.slice(0,-1))}function Xr(e$1,t,r){const n=`
\x1B[1;31m[${e$1}] ${r.request.method} ${r.url.pathname}\x1B[0m`;return e$1===404?n:`${n}
${e?Yr(t):t.stack}`}let It=e=>e;if(e)try{const e=await import('node:path'),t=await import('node:process');It=r=>e.relative(t.cwd(),r);}catch{}function Yr(e){const t=(e.stack?.split(`
`)??[]).map(n=>n.replace(/\((.+)(:\d+:\d+)\)$/,(s,a,c)=>`(${It(a)}${c})`)),r=t.findLastIndex(n=>/\(src[\\/]/.test(n));return r===-1?e.stack:t.slice(0,r+1).join(`
`)}function Ht(e){const r=e?.split("/")?.at(-1);return r?r.split(".").slice(0,-1).join("."):"unknown"}async function Qr(e,t,r,n){const s=e.request.method;let a=r[s]||r.fallback;if(s==="HEAD"&&!r.HEAD&&r.GET&&(a=r.GET),!a)return qt(r,s);const c=r.prerender??n.prerender_default;if(c&&(r.POST||r.PATCH||r.PUT||r.DELETE))throw new Error("Cannot prerender endpoints that have mutative methods");if(n.prerendering&&!n.prerendering.inside_reroute&&!c){if(n.depth>0)throw new Error(`${e.route.id} is not prerenderable`);return new Response(void 0,{status:204})}t.is_endpoint_request=true;try{const d=await with_request_store({event:e,state:t},()=>a(e));if(!(d instanceof Response))throw new Error(`Invalid response from route ${e.url.pathname}: handler should return a Response object`);if(n.prerendering&&(!n.prerendering.inside_reroute||c)){const o=new Response(d.clone().body,{status:d.status,statusText:d.statusText,headers:new Headers(d.headers)});if(o.headers.set("x-sveltekit-prerender",String(c)),n.prerendering.inside_reroute&&c)o.headers.set("x-sveltekit-routeid",encodeURI(e.route.id)),n.prerendering.dependencies.set(e.url.pathname,{response:o,body:null});else return o}return d}catch(d){if(d instanceof Redirect)return new Response(void 0,{status:d.status,headers:{location:d.location}});throw d}}function en(e){const{method:t,headers:r}=e.request;if(Tt.includes(t)&&!Lr.includes(t))return  true;if(t==="POST"&&r.get("x-sveltekit-action")==="true")return  false;const n=e.request.headers.get("accept")??"*/*";return Ve(n,["*","text/html"])!=="text/html"}function Ie(e){return e.filter(t=>t!=null)}const Ze="/__data.json",je=".html__data.json";function tn(e){return e.endsWith(Ze)||e.endsWith(je)}function Ke(e){return e.endsWith(".html")?e.replace(/\.html$/,je):e.replace(/\/$/,"")+Ze}function rn(e){return e.endsWith(je)?e.slice(0,-je.length)+".html":e.slice(0,-Ze.length)}const Xe="/__route.js";function nn(e){return e.endsWith(Xe)}function Mt(e){return e.replace(/\/$/,"")+Xe}function sn(e){return e.slice(0,-Xe.length)}const an={spanContext(){return on},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return  false},recordException(){return this},addLink(){return this},addLinks(){return this}},on={traceId:"",spanId:"",traceFlags:0};async function ne({name:e,attributes:t,fn:r}){return r(an)}function Wt(e){return Ve(e.request.headers.get("accept")??"*/*",["application/json","text/html"])==="application/json"&&e.request.method==="POST"}async function cn(e$1,t,r,n){const s=n?.actions;if(!s){const a=new SvelteKitError(405,"Method Not Allowed",`POST method not allowed. No form actions exist for ${e?`the page at ${e$1.route.id}`:"this page"}`);return pe({type:"error",error:await M(e$1,t,r,a)},{status:a.status,headers:{allow:"GET"}})}Ft(s);try{const a=await Vt(e$1,t,s);return e&&Gt(a),a instanceof ActionFailure?pe({type:"failure",status:a.status,data:lt(a.data,e$1.route.id,r.hooks.transport)}):pe({type:"success",status:a?200:204,data:lt(a,e$1.route.id,r.hooks.transport)})}catch(a){const c=a;return c instanceof Redirect?Bt(c):pe({type:"error",error:await M(e$1,t,r,Ye(c))},{status:ce(c)})}}function Ye(e){return e instanceof ActionFailure?new Error('Cannot "throw fail()". Use "return fail()"'):e}function Bt(e){return pe({type:"redirect",status:e.status,location:e.location})}function pe(e,t){return json(e,t)}function ln(e){return e.request.method==="POST"}async function un(e$1,t,r){const n=r?.actions;if(!n)return e$1.setHeaders({allow:"GET"}),{type:"error",error:new SvelteKitError(405,"Method Not Allowed",`POST method not allowed. No form actions exist for ${e?`the page at ${e$1.route.id}`:"this page"}`)};Ft(n);try{const s=await Vt(e$1,t,n);return e&&Gt(s),s instanceof ActionFailure?{type:"failure",status:s.status,data:s.data}:{type:"success",status:200,data:s}}catch(s){const a=s;return a instanceof Redirect?{type:"redirect",status:a.status,location:a.location}:{type:"error",error:Ye(a)}}}function Ft(e){if(e.default&&Object.keys(e).length>1)throw new Error("When using named actions, the default action cannot be used. See the docs for more info: https://svelte.dev/docs/kit/form-actions#named-actions")}async function Vt(e,t,r){const n=new URL(e.request.url);let s="default";for(const c of n.searchParams)if(c[0].startsWith("/")){if(s=c[0].slice(1),s==="default")throw new Error('Cannot use reserved action name "default"');break}const a=r[s];if(!a)throw new SvelteKitError(404,"Not Found",`No action with name '${s}' found`);if(!Ge(e.request))throw new SvelteKitError(415,"Unsupported Media Type",`Form actions expect form-encoded data — received ${e.request.headers.get("content-type")}`);return ne({name:"sveltekit.form_action",attributes:{"http.route":e.route.id||"unknown"},fn:async c=>{const d=merge_tracing(e,c),o=await with_request_store({event:d,state:t},()=>a(d));return o instanceof ActionFailure&&c.setAttributes({"sveltekit.form_action.result.type":"failure","sveltekit.form_action.result.status":o.status}),o}})}function Gt(e){if(e instanceof Redirect)throw new Error("Cannot `return redirect(...)` — use `redirect(...)` instead");if(e instanceof HttpError)throw new Error("Cannot `return error(...)` — use `error(...)` or `return fail(...)` instead")}function dn(e,t,r){const n=s=>{for(const a in r){const c=r[a].encode(s);if(c)return `app.decode('${a}', ${W(c,n)})`}};return Jt(e,s=>W(s,n),t)}function lt(e,t,r){const n=Object.fromEntries(Object.entries(r).map(([s,a])=>[s,a.encode]));return Jt(e,s=>te(s,n),t)}function Jt(e,t,r){try{return t(e)}catch(n){const s=n;if(e instanceof Response)throw new Error(`Data returned from action inside ${r} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" });`);if("path"in s){let a=`Data returned from action inside ${r} is not serializable: ${s.message}`;throw s.path!==""&&(a+=` (data.${s.path})`),new Error(a)}throw s}}function Zt(){let e=-1,t=-1;const r=[];return {iterate:(n=s=>s)=>({[Symbol.asyncIterator](){return {next:async()=>{const s=r[++t];if(!s)return {value:null,done:true};const a=await s.promise;return {value:n(a),done:false}}}}}),add:n=>{r.push(Rt()),n.then(s=>{r[++e].resolve(s);});}}}function he(e,t,r){let n=1,s=-1;const a=Zt(),c=Nt(r);function d(i){return function l(u){if(typeof u?.then=="function"){const h=n++,p=u.then(m=>({data:m})).catch(async m=>({error:await M(e,t,r,m)})).then(async({data:m,error:f})=>{let _;try{_=W(f?[,f]:[m],l);}catch{f=await M(e,t,r,new Error(`Failed to serialize promise while rendering ${e.route.id}`)),m=void 0,_=W([,f],l);}return {index:i,str:`${c}.resolve(${h}, ${_.includes("app.decode")?`(app) => ${_}`:`() => ${_}`})`}});return a.add(p),`${c}.defer(${h})`}else for(const h in r.hooks.transport){const p=r.hooks.transport[h].encode(u);if(p)return `app.decode('${h}', ${W(p,l)})`}}}const o=[];return {set_max_nodes(i){s=i;},add_node(i,l){try{if(!l){o[i]="null";return}const u={type:"data",data:l.data,uses:Lt(l)};l.slash&&(u.slash=l.slash),o[i]=W(u,d(i));}catch(u){throw u.path=u.path.slice(1),new Error(zt(e,u))}},get_data(i){const l=`<script${i.script_needs_nonce?` nonce="${i.nonce}"`:""}>`,u=`<\/script>
`;return {data:`[${Ie(s>-1?o.slice(0,s):o).join(",")}]`,chunks:n>1?a.iterate(({index:h,str:p})=>s>-1&&h>=s?"":l+p+u):null}}}}function Kt(e,t,r){let n=1;const s=Zt(),a={...Object.fromEntries(Object.entries(r.hooks.transport).map(([d,o])=>[d,o.encode])),Promise:d=>{if(typeof d?.then!="function")return;const o=n++;let i="data";const l=d.catch(async u=>(i="error",M(e,t,r,u))).then(async u=>{let h;try{h=te(u,a);}catch{const p=await M(e,t,r,new Error(`Failed to serialize promise while rendering ${e.route.id}`));i="error",h=te(p,a);}return `{"type":"chunk","id":${o},"${i}":${h}}
`});return s.add(l),o}},c=[];return {add_node(d,o){try{if(!o){c[d]="null";return}if(o.type==="error"||o.type==="skip"){c[d]=JSON.stringify(o);return}c[d]=`{"type":"data","data":${te(o.data,a)},"uses":${JSON.stringify(Lt(o))}${o.slash?`,"slash":${JSON.stringify(o.slash)}`:""}}`;}catch(i){throw i.path="data"+i.path,new Error(zt(e,i))}},get_data(){return {data:`{"type":"data","nodes":[${c.join(",")}]}
`,chunks:n>1?s.iterate():null}}}}async function Qe({event:e$1,event_state:t,state:r,node:n,parent:s}){if(!n?.server)return null;let a=true;const c={dependencies:new Set,params:new Set,parent:false,route:false,url:false,search_params:new Set},d=n.server.load,o=n.server.trailingSlash;if(!d)return {type:"data",data:null,uses:c,slash:o};const i=O$1(e$1.url,()=>{e&&l&&!c.url&&console.warn(`${n.server_id}: Accessing URL properties in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the URL changes`),a&&(c.url=true);},h=>{e&&l&&!c.search_params.has(h)&&console.warn(`${n.server_id}: Accessing URL properties in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the URL changes`),a&&c.search_params.add(h);});r.prerendering&&R$1(i);let l=false;const u=await ne({name:"sveltekit.load",attributes:{"sveltekit.load.node_id":n.server_id||"unknown","sveltekit.load.node_type":Ht(n.server_id),"http.route":e$1.route.id||"unknown"},fn:async h=>{const p=merge_tracing(e$1,h);return await with_request_store({event:p,state:t},()=>d.call(null,{...p,fetch:(f,_)=>{const y=new URL(f instanceof Request?f.url:f,e$1.url);return e&&l&&!c.dependencies.has(y.href)&&console.warn(`${n.server_id}: Calling \`event.fetch(...)\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the dependency is invalidated`),e$1.fetch(f,_)},depends:(...f)=>{for(const _ of f){const{href:y}=new URL(_,e$1.url);e&&(we(n.server_id||"missing route ID",_),l&&!c.dependencies.has(y)&&console.warn(`${n.server_id}: Calling \`depends(...)\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the dependency is invalidated`)),c.dependencies.add(y);}},params:new Proxy(e$1.params,{get:(f,_)=>(e&&l&&typeof _=="string"&&!c.params.has(_)&&console.warn(`${n.server_id}: Accessing \`params.${String(_)}\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the param changes`),a&&c.params.add(_),f[_])}),parent:async()=>(e&&l&&!c.parent&&console.warn(`${n.server_id}: Calling \`parent(...)\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when parent data changes`),a&&(c.parent=!0),s()),route:new Proxy(e$1.route,{get:(f,_)=>(e&&l&&typeof _=="string"&&!c.route&&console.warn(`${n.server_id}: Accessing \`route.${String(_)}\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the route changes`),a&&(c.route=!0),f[_])}),url:i,untrack(f){a=!1;try{return f()}finally{a=!0;}}}))}});return e&&Ae$1(u,`in ${n.server_id}`),l=true,{type:"data",data:u??null,uses:c,slash:o}}async function Xt({event:e$1,event_state:t,fetched:r,node:n,parent:s,server_data_promise:a,state:c,resolve_opts:d,csr:o}){const i=await a,l=n?.universal?.load;if(!l)return i?.data??null;const u=await ne({name:"sveltekit.load",attributes:{"sveltekit.load.node_id":n.universal_id||"unknown","sveltekit.load.node_type":Ht(n.universal_id),"http.route":e$1.route.id||"unknown"},fn:async h=>{const p=merge_tracing(e$1,h);return await with_request_store({event:p,state:t},()=>l.call(null,{url:e$1.url,params:e$1.params,data:i?.data??null,route:e$1.route,fetch:fn(e$1,c,r,o,d),setHeaders:e$1.setHeaders,depends:()=>{},parent:s,untrack:m=>m(),tracing:p.tracing}))}});return e&&Ae$1(u,`in ${n.universal_id}`),u??null}function fn(e,t,r,n,s){const a=async(c$1,d)=>{const o=c$1 instanceof Request&&c$1.body?c$1.clone().body:null,i=c$1 instanceof Request&&[...c$1.headers].length?new Headers(c$1.headers):d?.headers;let l=await e.fetch(c$1,d);const u=new URL(c$1 instanceof Request?c$1.url:c$1,e.url),h=u.origin===e.url.origin;let p;if(h)t.prerendering&&(p={response:l,body:null},t.prerendering.dependencies.set(u.pathname,p));else if(u.protocol==="https:"||u.protocol==="http:")if((c$1 instanceof Request?c$1.mode:d?.mode??"cors")==="no-cors")l=new Response("",{status:l.status,statusText:l.statusText,headers:l.headers});else {const y=l.headers.get("access-control-allow-origin");if(!y||y!==e.url.origin&&y!=="*")throw new Error(`CORS error: ${y?"Incorrect":"No"} 'Access-Control-Allow-Origin' header is present on the requested resource`)}let m;const f=new Proxy(l,{get(_,y,b){async function x(E,w){const $=Number(_.status);if(isNaN($))throw new Error(`response.status is not a number. value: "${_.status}" type: ${typeof _.status}`);r.push({url:h?u.href.slice(e.url.origin.length):u.href,method:e.request.method,request_body:c$1 instanceof Request&&o?await pn(o):d?.body,request_headers:i,response_body:E,response:_,is_b64:w});}if(y==="body"){if(_.body===null)return null;if(m)return m;const[E,w]=_.body.tee();return (async()=>{let $=new Uint8Array;for await(const g of E){const v=new Uint8Array($.length+g.length);v.set($,0),v.set(g,$.length),$=v;}p&&(p.body=new Uint8Array($)),x(c($),true);})(),m=w}if(y==="arrayBuffer")return async()=>{const E=await _.arrayBuffer(),w=new Uint8Array(E);return p&&(p.body=w),E instanceof ArrayBuffer&&await x(c(w),true),E};async function k(){const E=await _.text();if(E===""&&qr.includes(_.status)){await x(void 0,false);return}return (!E||typeof E=="string")&&await x(E,false),p&&(p.body=E),E}return y==="text"?k:y==="json"?async()=>{const E=await k();return E?JSON.parse(E):void 0}:Reflect.get(_,y,_)}});if(n){const _=l.headers.get;l.headers.get=y=>{const b=y.toLowerCase(),x=_.call(l.headers,b);if(x&&!b.startsWith("x-sveltekit-")&&!s.filterSerializedResponseHeaders(b,x))throw new Error(`Failed to get response header "${b}" — it must be included by the \`filterSerializedResponseHeaders\` option: https://svelte.dev/docs/kit/hooks#Server-hooks-handle (at ${e.route.id})`);return x};}return f};return (c,d)=>{const o=a(c,d);return o.catch(()=>{}),o}}async function pn(e){let t="";const r=e.getReader();for(;;){const{done:n,value:s}=await r.read();if(n)break;t+=f.decode(s);}return t}function Yt(...e){let t=5381;for(const r of e)if(typeof r=="string"){let n=r.length;for(;n;)t=t*33^r.charCodeAt(--n);}else if(ArrayBuffer.isView(r)){const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let s=n.length;for(;s;)t=t*33^n[--s];}else throw new TypeError("value must be a string or TypedArray");return (t>>>0).toString(36)}const Qt={"<":"\\u003C","\u2028":"\\u2028","\u2029":"\\u2029"},hn=new RegExp(`[${Object.keys(Qt).join("")}]`,"g");function _n(e,t,r=false){const n={};let s=null,a=null,c=false;for(const[l,u]of e.response.headers)t(l,u)&&(n[l]=u),l==="cache-control"?s=u:l==="age"?a=u:l==="vary"&&u.trim()==="*"&&(c=true);const d={status:e.response.status,statusText:e.response.statusText,headers:n,body:e.response_body},o=JSON.stringify(d).replace(hn,l=>Qt[l]),i=['type="application/json"',"data-sveltekit-fetched",`data-url="${Je(e.url,true)}"`];if(e.is_b64&&i.push("data-b64"),e.request_headers||e.request_body){const l=[];e.request_headers&&l.push([...new Headers(e.request_headers)].join(",")),e.request_body&&l.push(e.request_body),i.push(`data-hash="${Yt(...l)}"`);}if(!r&&e.method==="GET"&&s&&!c){const l=/s-maxage=(\d+)/g.exec(s)??/max-age=(\d+)/g.exec(s);if(l){const u=+l[1]-+(a??"0");i.push(`data-ttl="${u}"`);}}return `<script ${i.join(" ")}>${o}<\/script>`}const I=JSON.stringify;function ut(e){He[0]||mn();const t=er.slice(0),r=yn(e);for(let s=0;s<r.length;s+=16){const a=r.subarray(s,s+16);let c,d,o,i=t[0],l=t[1],u=t[2],h=t[3],p=t[4],m=t[5],f=t[6],_=t[7];for(let y=0;y<64;y++)y<16?c=a[y]:(d=a[y+1&15],o=a[y+14&15],c=a[y&15]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(o>>>17^o>>>19^o>>>10^o<<15^o<<13)+a[y&15]+a[y+9&15]|0),c=c+_+(p>>>6^p>>>11^p>>>25^p<<26^p<<21^p<<7)+(f^p&(m^f))+He[y],_=f,f=m,m=p,p=h+c|0,h=u,u=l,l=i,i=c+(l&u^h&(l^u))+(l>>>2^l>>>13^l>>>22^l<<30^l<<19^l<<10)|0;t[0]=t[0]+i|0,t[1]=t[1]+l|0,t[2]=t[2]+u|0,t[3]=t[3]+h|0,t[4]=t[4]+p|0,t[5]=t[5]+m|0,t[6]=t[6]+f|0,t[7]=t[7]+_|0;}const n=new Uint8Array(t.buffer);return tr(n),btoa(String.fromCharCode(...n))}const er=new Uint32Array(8),He=new Uint32Array(64);function mn(){function e(r){return (r-Math.floor(r))*4294967296}let t=2;for(let r=0;r<64;t++){let n=true;for(let s=2;s*s<=t;s++)if(t%s===0){n=false;break}n&&(r<8&&(er[r]=e(t**(1/2))),He[r]=e(t**(1/3)),r++);}}function tr(e){for(let t=0;t<e.length;t+=4){const r=e[t+0],n=e[t+1],s=e[t+2],a=e[t+3];e[t+0]=a,e[t+1]=s,e[t+2]=n,e[t+3]=r;}}function yn(e){const t=s.encode(e),r=t.length*8,n=512*Math.ceil((r+65)/512),s$1=new Uint8Array(n/8);s$1.set(t),s$1[t.length]=128,tr(s$1);const a=new Uint32Array(s$1.buffer);return a[a.length-2]=Math.floor(r/4294967296),a[a.length-1]=r,a}const dt=new Uint8Array(16);function wn(){return crypto.getRandomValues(dt),btoa(String.fromCharCode(...dt))}const gn=new Set(["self","unsafe-eval","unsafe-hashes","unsafe-inline","none","strict-dynamic","report-sample","wasm-unsafe-eval","script"]),bn=/^(nonce|sha\d\d\d)-/;class rr{#e;#t;#c;#l;#u;#d;#f;#p;#n;#s;#a;#o;#i;#r;#h;constructor(t,r,n){this.#e=t,this.#n=e?{...r}:r;const s=this.#n;this.#s=[],this.#a=[],this.#o=[],this.#i=[],this.#r=[];const a=s["script-src"]||s["default-src"],c=s["script-src-elem"],d=s["style-src"]||s["default-src"],o=s["style-src-attr"],i=s["style-src-elem"];e&&(d&&!d.includes("unsafe-inline")&&(s["style-src"]=[...d.filter(u=>!(u.startsWith("sha256-")||u.startsWith("nonce-"))),"unsafe-inline"]),o&&!o.includes("unsafe-inline")&&(s["style-src-attr"]=[...o.filter(u=>!(u.startsWith("sha256-")||u.startsWith("nonce-"))),"unsafe-inline"]),i&&!i.includes("unsafe-inline")&&(s["style-src-elem"]=[...i.filter(u=>!(u.startsWith("sha256-")||u.startsWith("nonce-"))),"unsafe-inline"]));const l=u=>!!u&&!u.some(h=>h==="unsafe-inline");this.#c=l(a),this.#l=l(c),this.#d=l(d),this.#f=l(o),this.#p=l(i),this.#t=this.#c||this.#l,this.#u=!e&&(this.#d||this.#f||this.#p),this.script_needs_nonce=this.#t&&!this.#e,this.style_needs_nonce=this.#u&&!this.#e,this.#h=n;}add_script(t){if(!this.#t)return;const r=this.#e?`sha256-${ut(t)}`:`nonce-${this.#h}`;this.#c&&this.#s.push(r),this.#l&&this.#a.push(r);}add_style(t){if(!this.#u)return;const r=this.#e?`sha256-${ut(t)}`:`nonce-${this.#h}`;if(this.#d&&this.#o.push(r),this.#f&&this.#i.push(r),this.#p){const n="sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=",s=this.#n;s["style-src-elem"]&&!s["style-src-elem"].includes(n)&&!this.#r.includes(n)&&this.#r.push(n),r!==n&&this.#r.push(r);}}get_header(t=false){const r=[],n={...this.#n};this.#o.length>0&&(n["style-src"]=[...n["style-src"]||n["default-src"]||[],...this.#o]),this.#i.length>0&&(n["style-src-attr"]=[...n["style-src-attr"]||[],...this.#i]),this.#r.length>0&&(n["style-src-elem"]=[...n["style-src-elem"]||[],...this.#r]),this.#s.length>0&&(n["script-src"]=[...n["script-src"]||n["default-src"]||[],...this.#s]),this.#a.length>0&&(n["script-src-elem"]=[...n["script-src-elem"]||[],...this.#a]);for(const s in n){if(t&&(s==="frame-ancestors"||s==="report-uri"||s==="sandbox"))continue;const a=n[s];if(!a)continue;const c=[s];Array.isArray(a)&&a.forEach(d=>{gn.has(d)||bn.test(d)?c.push(`'${d}'`):c.push(d);}),r.push(c.join(" "));}return r.join("; ")}}class $n extends rr{get_meta(){const t=this.get_header(true);if(t)return `<meta http-equiv="content-security-policy" content="${Je(t,true)}">`}}class vn extends rr{constructor(t,r,n){if(super(t,r,n),Object.values(r).filter(s=>!!s).length>0){const s=r["report-to"]?.length??false,a=r["report-uri"]?.length??false;if(!s&&!a)throw Error("`content-security-policy-report-only` must be specified with either the `report-to` or `report-uri` directives, or both")}}}class kn{nonce=wn();csp_provider;report_only_provider;constructor({mode:t,directives:r,reportOnly:n},{prerender:s}){const a=t==="hash"||t==="auto"&&s;this.csp_provider=new $n(a,r,this.nonce),this.report_only_provider=new vn(a,n,this.nonce);}get script_needs_nonce(){return this.csp_provider.script_needs_nonce||this.report_only_provider.script_needs_nonce}get style_needs_nonce(){return this.csp_provider.style_needs_nonce||this.report_only_provider.style_needs_nonce}add_script(t){this.csp_provider.add_script(t),this.report_only_provider.add_script(t);}add_style(t){this.csp_provider.add_style(t),this.report_only_provider.add_style(t);}}function nr(e,t,r){const n={},s=e.slice(1),a=s.filter(d=>d!==void 0);let c=0;for(let d=0;d<t.length;d+=1){const o=t[d];let i=s[d-c];if(o.chained&&o.rest&&c&&(i=s.slice(d-c,d+1).filter(l=>l).join("/"),c=0),i===void 0){o.rest&&(n[o.name]="");continue}if(!o.matcher||r[o.matcher](i)){n[o.name]=i;const l=t[d+1],u=s[d+1];l&&!l.rest&&l.optional&&u&&o.chained&&(c=0),!l&&!u&&Object.keys(n).length===a.length&&(c=0);continue}if(o.optional&&o.chained){c++;continue}return}if(!c)return n}function sr(e,t,r){const{errors:n,layouts:s,leaf:a}=e,c=[...n,...s.map(d=>d?.[1]),a[1]].filter(d=>typeof d=="number").map(d=>`'${d}': () => ${ar(r._.client.nodes?.[d],t)}`).join(`,
		`);return [`{
	id: ${I(e.id)}`,`errors: ${I(e.errors)}`,`layouts: ${I(e.layouts)}`,`leaf: ${I(e.leaf)}`,`nodes: {
		${c}
	}
}`].join(`,
	`)}function ar(e,t$1){if(!e)return "Promise.resolve({})";if(e[0]==="/")return `import('${e}')`;if(t!=="")return `import('${t}/${e}')`;let r=l(t$1.pathname,`${e$1}/${e}`);return r[0]!=="."&&(r=`./${r}`),`import('${r}')`}async function En(e,t,r){if(!r._.client.routes)return text("Server-side route resolution disabled",{status:400});let n=null,s={};const a=await r._.matchers();for(const c of r._.client.routes){const d=c.pattern.exec(e);if(!d)continue;const o=nr(d,c.params,a);if(o){n=c,s=j$1(o);break}}return or(n,s,t,r).response}function or(e,t,r,n){const s=new Headers({"content-type":"application/javascript; charset=utf-8"});if(e){const a=sr(e,r,n),c=`${xn(e,r,n)}
export const route = ${a}; export const params = ${JSON.stringify(t)};`;return {response:text(c,{headers:s}),body:c}}else return {response:text("",{headers:s}),body:""}}function xn(e,t$1,r){const{errors:n,layouts:s,leaf:a}=e;let c="";for(const d of [...n,...s.map(o=>o?.[1]),a[1]]){if(typeof d!="number")continue;const o=r._.client.css?.[d];for(const i of o??[])c+=`'${t||e$1}/${i}',`;}return c?`${ar(r._.client.start,t$1)}.then(x => x.load_css([${c}]));`:""}const An={...readable(false),check:()=>false};async function _e({branch:e$2,fetched:t$1,options:r$1,manifest:n,state:s$1,page_config:a,status:c,error:d=null,event:o$1,event_state:i$1,resolve_opts:l,action_result:u,data_serializer:h}){if(s$1.prerendering){if(r$1.csp.mode==="nonce")throw new Error('Cannot use prerendering if config.kit.csp.mode === "nonce"');if(r$1.app_template_contains_nonce)throw new Error("Cannot use prerendering if page template contains %sveltekit.nonce%")}const{client:p}=n._,m=new Set(p.imports),f=new Set(p.stylesheets),_=new Set(p.fonts),y=new Set,b=new Set,x$1=new Map;let k;const E=u?.type==="success"||u?.type==="failure"?u.data??null:null;let w=e$1,$=t,g=I(e$1);if(s$1.prerendering?.fallback?r$1.hash_routing&&(g="new URL('.', location).pathname.slice(0, -1)"):(w=o$1.url.pathname.slice(e$1.length).split("/").slice(2).map(()=>"..").join("/")||".",g=`new URL(${I(w)}, location).pathname.slice(0, -1)`,(!t||t[0]==="/"&&t!==zr)&&($=w)),a.ssr){const j={stores:{page:writable(null),navigating:writable(null),updated:An},constructors:await Promise.all(e$2.map(({node:P})=>{if(!P.component)throw new Error(`Missing +page.svelte component for route ${o$1.route.id}`);return P.component()})),form:E};let O={};for(let P=0;P<e$2.length;P+=1)O={...O,...e$2[P].data},j[`data_${P}`]=O;j.page={error:d,params:o$1.params,route:o$1.route,status:c,url:o$1.url,data:O,form:E,state:{}};const G={context:new Map([["__request__",{page:j.page}]])},ee=globalThis.fetch;try{if(e){let P=!1;globalThis.fetch=(N,Z)=>{if(typeof N=="string"&&!P$1.test(N))throw new Error(`Cannot call \`fetch\` eagerly during server-side rendering with relative URL (${N}) — put your \`fetch\` calls inside \`onMount\` or a \`load\` function instead`);return !P&&!try_get_request_store()?.state.is_in_remote_function&&(console.warn("Avoid calling `fetch` eagerly during server-side rendering — put your `fetch` calls inside `onMount` or a `load` function instead"),P=!0),ee(N,Z)};}k=await with_request_store({event:o$1,state:i$1},async()=>{r&&o({base:w,assets:$});const P=r$1.root.render(j,G),N=r$1.async&&"then"in P?P.then(C=>C):P;r$1.async&&c$1();const{head:Z,html:we,css:ge}=r$1.async?await N:N;return {head:Z,html:we,css:ge}});}finally{e&&(globalThis.fetch=ee),c$1();}for(const{node:P}of e$2){for(const N of P.imports)m.add(N);for(const N of P.stylesheets)f.add(N);for(const N of P.fonts)_.add(N);P.inline_styles&&!p.inline&&Object.entries(await P.inline_styles()).forEach(([N,Z])=>x$1.set(N,Z));}}else k={head:"",html:"",css:{code:"",map:null}};let v="",A=k.html;const S=new kn(r$1.csp,{prerender:!!s$1.prerendering}),T=j=>j.startsWith("/")?e$1+j:`${$}/${j}`,U=p.inline?p.inline?.style:Array.from(x$1.values()).join(`
`);if(U){const j=e?[" data-sveltekit"]:[];S.style_needs_nonce&&j.push(` nonce="${S.nonce}"`),S.add_style(U),v+=`
	<style${j.join("")}>${U}</style>`;}for(const j of f){const O=T(j),G=['rel="stylesheet"'];x$1.has(j)?G.push("disabled",'media="(max-width: 0)"'):l.preload({type:"css",path:O})&&y.add(`<${encodeURI(O)}>; rel="preload"; as="style"; nopush`),v+=`
		<link href="${O}" ${G.join(" ")}>`;}for(const j of _){const O=T(j);if(l.preload({type:"font",path:O})){const G=j.slice(j.lastIndexOf(".")+1);b.add(`<link rel="preload" as="font" type="font/${G}" href="${O}" crossorigin>`),y.add(`<${encodeURI(O)}>; rel="preload"; as="font"; type="font/${G}"; crossorigin; nopush`);}}const F=Nt(r$1),{data:V,chunks:J}=h.get_data(S);if(a.ssr&&a.csr&&(A+=`
			${t$1.map(j=>_n(j,l.filterSerializedResponseHeaders,!!s$1.prerendering)).join(`
			`)}`),a.csr){const j=n._.client.routes?.find(C=>C.id===o$1.route.id)??null;if(p.uses_env_dynamic_public&&s$1.prerendering&&m.add(`${i}/env.js`),!p.inline){const C=Array.from(m,q=>T(q)).filter(q=>l.preload({type:"js",path:q}));for(const q of C)y.add(`<${encodeURI(q)}>; rel="modulepreload"; nopush`),r$1.preload_strategy!=="modulepreload"?v+=`
		<link rel="preload" as="script" crossorigin="anonymous" href="${q}">`:b.add(`<link rel="modulepreload" href="${q}">`);}if(s$1.prerendering&&b.size>0&&(v+=Array.from(b).map(C=>`
		${C}`).join("")),n._.client.routes&&s$1.prerendering&&!s$1.prerendering.fallback){const C=Mt(o$1.url.pathname);s$1.prerendering.dependencies.set(C,or(j,o$1.params,new URL(C,o$1.url),n));}const O=[],G=p.uses_env_dynamic_public&&s$1.prerendering,ee=[`base: ${g}`];if(t&&ee.push(`assets: ${I(t)}`),p.uses_env_dynamic_public&&ee.push(`env: ${G?"null":I(x)}`),J){O.push("const deferred = new Map();"),ee.push(`defer: (id) => new Promise((fulfil, reject) => {
							deferred.set(id, { fulfil, reject });
						})`);let C="";Object.keys(r$1.hooks.transport).length>0&&(p.inline?C=`const app = __sveltekit_${r$1.version_hash}.app.app;`:p.app?C=`const app = await import(${I(T(p.app))});`:C=`const { app } = await import(${I(T(p.start))});`);const q=C?`${C}
							const [data, error] = fn(app);`:"const [data, error] = fn();";ee.push(`resolve: async (id, fn) => {
							${q}

							const try_to_resolve = () => {
								if (!deferred.has(id)) {
									setTimeout(try_to_resolve, 0);
									return;
								}
								const { fulfil, reject } = deferred.get(id);
								deferred.delete(id);
								if (error) reject(error);
								else fulfil(data);
							}
							try_to_resolve();
						}`);}O.push(`${F} = {
						${ee.join(`,
						`)}
					};`);const P=["element"];if(O.push("const element = document.currentScript.parentElement;"),a.ssr){const C={form:"null",error:"null"};E&&(C.form=dn(E,o$1.route.id,r$1.hooks.transport)),d&&(C.error=W(d));const q=[`node_ids: [${e$2.map(({node:Q})=>Q.index).join(", ")}]`,`data: ${V}`,`form: ${C.form}`,`error: ${C.error}`];if(c!==200&&q.push(`status: ${c}`),n._.client.routes){if(j){const Q=sr(j,o$1.url,n).replaceAll(`
`,`
							`);q.push(`params: ${W(o$1.params)}`,`server_route: ${Q}`);}}else r$1.embedded&&q.push(`params: ${W(o$1.params)}`,`route: ${I(o$1.route)}`);const te="	".repeat(G?7:6);P.push(`{
${te}	${q.join(`,
${te}	`)}
${te}}`);}const{remote_data:N}=i$1;let Z="";if(N){const C={};for(const[te,Q]of N)if(te.id)for(const ue in Q)C[Oe(te.id,ue)]=await Q[ue];const q=te=>{for(const Q in r$1.hooks.transport){const ue=r$1.hooks.transport[Q].encode(te);if(ue)return `app.decode('${Q}', ${W(ue,q)})`}};Z=`${F}.data = ${W(C,q)};

						`;}const we=p.inline?`${p.inline.script}

					${Z}${F}.app.start(${P.join(", ")});`:p.app?`Promise.all([
						import(${I(T(p.start))}),
						import(${I(T(p.app))})
					]).then(([kit, app]) => {
						${Z}kit.start(app, ${P.join(", ")});
					});`:`import(${I(T(p.start))}).then((app) => {
						${Z}app.start(${P.join(", ")})
					});`;if(G?O.push(`import(${I(`${w}/${i}/env.js`)}).then(({ env }) => {
						${F}.env = env;

						${we.replace(/\n/g,`
	`)}
					});`):O.push(we),r$1.service_worker){let C=e?", { type: 'module' }":"";if(r$1.service_worker_options!=null){const q={...r$1.service_worker_options};e&&(q.type="module"),C=`, ${I(q)}`;}O.push(`if ('serviceWorker' in navigator) {
						addEventListener('load', function () {
							navigator.serviceWorker.register('${T("service-worker.js")}'${C});
						});
					}`);}const ge=`
				{
					${O.join(`

					`)}
				}
			`;S.add_script(ge),A+=`
			<script${S.script_needs_nonce?` nonce="${S.nonce}"`:""}>${ge}<\/script>
		`;}const Y=new Headers({"x-sveltekit-page":"true","content-type":"text/html"});if(s$1.prerendering){const j=[],O=S.csp_provider.get_meta();O&&j.push(O),s$1.prerendering.cache&&j.push(`<meta http-equiv="cache-control" content="${s$1.prerendering.cache}">`),j.length>0&&(v=j.join(`
`)+v);}else {const j=S.csp_provider.get_header();j&&Y.set("content-security-policy",j);const O=S.report_only_provider.get_header();O&&Y.set("content-security-policy-report-only",O),y.size&&Y.set("link",Array.from(y).join(", "));}v+=k.head;const me=r$1.templates.app({head:v,body:A,assets:$,nonce:S.nonce,env:x}),ye=await l.transformPageChunk({html:me,done:true})||"";return J||Y.set("etag",`"${Yt(ye)}"`),e&&(a.csr?ye.split("<!--").length<me.split("<!--").length&&console.warn("\x1B[1m\x1B[31mRemoving comments in transformPageChunk can break Svelte's hydration\x1B[39m\x1B[22m"):J&&console.warn("\x1B[1m\x1B[31mReturning promises from server `load` functions will only work if `csr === true`\x1B[39m\x1B[22m")),J?new Response(new ReadableStream({async start(j){j.enqueue(s.encode(ye+`
`));for await(const O of J)O.length&&j.enqueue(s.encode(O));j.close();},type:"bytes"}),{headers:Y}):text(ye,{status:c,headers:Y})}class et{data;constructor(t){this.data=t;}layouts(){return this.data.slice(0,-1)}page(){return this.data.at(-1)}validate(){for(const r of this.layouts())r&&(L$1(r.server,r.server_id),U$2(r.universal,r.universal_id));const t=this.page();t&&(T$1(t.server,t.server_id),C$2(t.universal,t.universal_id));}#e(t){return this.data.reduce((r,n)=>n?.universal?.[t]??n?.server?.[t]??r,void 0)}csr(){return this.#e("csr")??true}ssr(){return this.#e("ssr")??true}prerender(){return this.#e("prerender")??false}trailing_slash(){return this.#e("trailingSlash")??"never"}get_config(){let t={};for(const r of this.data)!r?.universal?.config&&!r?.server?.config||(t={...t,...r?.universal?.config,...r?.server?.config});return Object.keys(t).length?t:void 0}should_prerender_data(){return this.data.some(t=>t?.server?.load||t?.server?.trailingSlash!==void 0)}}async function ir({event:e,event_state:t,options:r,manifest:n,state:s,status:a,error:c,resolve_opts:d}){if(e.request.headers.get("x-sveltekit-error"))return Ae(r,a,c.message);const o=[];try{const i=[],l=await n._.nodes[0](),u=new et([l]),h=u.ssr(),p=u.csr(),m=he(e,t,r);if(h){s.error=!0;const f=Qe({event:e,event_state:t,state:s,node:l,parent:async()=>({})}),_=await f;m.add_node(0,_);const y=await Xt({event:e,event_state:t,fetched:o,node:l,parent:async()=>({}),resolve_opts:d,server_data_promise:f,state:s,csr:p});i.push({node:l,server_data:_,data:y},{node:await n._.nodes[1](),data:null,server_data:null});}return await _e({options:r,manifest:n,state:s,page_config:{ssr:h,csr:p},status:a,error:await M(e,t,r,c),branch:i,fetched:o,event:e,event_state:t,resolve_opts:d,data_serializer:m})}catch(i){return i instanceof Redirect?Se(i.status,i.location):Ae(r,ce(i),(await M(e,t,r,i)).message)}}async function Sn(e,t,r,n,s){return ne({name:"sveltekit.remote.call",attributes:{},fn:a=>{const c=merge_tracing(e,a);return with_request_store({event:c,state:t},()=>jn(c,t,r,n,s))}})}async function jn(e,t,r,n,s){const[a,c,d]=s.split("/"),o=n._.remotes;o[a]||error(404);const l=(await o[a]()).default[c];l||error(404);const u=l.__,h=r.hooks.transport;e.tracing.current.setAttributes({"sveltekit.remote.call.type":u.type,"sveltekit.remote.call.name":u.name});let p;try{if(u.type==="query_batch"){if(e.request.method!=="POST")throw new SvelteKitError(405,"Method Not Allowed",`\`query.batch\` functions must be invoked via POST request, not ${e.request.method}`);const{payloads:y}=await e.request.json(),b=y.map(E=>$e(E,h)),x=await with_request_store({event:e,state:t},()=>u.run(b)),k=await Promise.all(b.map(async(E,w)=>{try{return {type:"result",data:x(E,w)}}catch($){return {type:"error",error:await M(e,t,r,$),status:$ instanceof HttpError||$ instanceof SvelteKitError?$.status:500}}}));return json({type:"result",result:le(k,h)})}if(u.type==="form"){if(e.request.method!=="POST")throw new SvelteKitError(405,"Method Not Allowed",`\`form\` functions must be invoked via POST request, not ${e.request.method}`);if(!Ge(e.request))throw new SvelteKitError(415,"Unsupported Media Type",`\`form\` functions expect form-encoded data — received ${e.request.headers.get("content-type")}`);const{data:y,meta:b,form_data:x}=await he$1(e.request);d&&!("id"in y)&&(y.id=JSON.parse(decodeURIComponent(d)));const k=u.fn,E=await with_request_store({event:e,state:t},()=>k(y,b,x));return json({type:"result",result:le(E,h),refreshes:E.issues?void 0:await m(b.remote_refreshes)})}if(u.type==="command"){const{payload:y,refreshes:b}=await e.request.json(),x=$e(y,h),k=await with_request_store({event:e,state:t},()=>l(x));return json({type:"result",result:le(k,h),refreshes:await m(b)})}const f=u.type==="prerender"?d:new URL(e.request.url).searchParams.get("payload"),_=await with_request_store({event:e,state:t},()=>l($e(f,h)));return json({type:"result",result:le(_,h)})}catch(f){if(f instanceof Redirect)return json({type:"redirect",location:f.location,refreshes:await m(p)});const _=f instanceof HttpError||f instanceof SvelteKitError?f.status:500;return json({type:"error",error:await M(e,t,r,f),status:_},{status:t.prerendering?_:void 0,headers:{"cache-control":"private, no-store"}})}async function m(f){const _=t.refreshes??{};if(f)for(const y of f){if(_[y]!==void 0)continue;const[b,x,k]=y.split("/"),E=n._.remotes[b],w=(await E?.())?.default?.[x];w||error(400,"Bad Request"),_[y]=with_request_store({event:e,state:t},()=>w($e(k,h)));}if(Object.keys(_).length!==0)return le(Object.fromEntries(await Promise.all(Object.entries(_).map(async([y,b])=>[y,await b]))),h)}}async function Rn(e,t,r,n){return ne({name:"sveltekit.remote.form.post",attributes:{},fn:s=>{const a=merge_tracing(e,s);return with_request_store({event:a,state:t},()=>Tn(a,t,r,n))}})}async function Tn(e$1,t,r,n){const[s,a,c]=n.split("/");let i=(await r._.remotes[s]?.())?.default[a];if(!i)return e$1.setHeaders({allow:"GET"}),{type:"error",error:new SvelteKitError(405,"Method Not Allowed",`POST method not allowed. No form actions exist for ${e?`the page at ${e$1.route.id}`:"this page"}`)};c&&(i=with_request_store({event:e$1,state:t},()=>i.for(JSON.parse(c))));try{const l=i.__.fn,{data:u,meta:h,form_data:p}=await he$1(e$1.request);return c&&!("id"in u)&&(u.id=JSON.parse(decodeURIComponent(c))),await with_request_store({event:e$1,state:t},()=>l(u,h,p)),{type:"success",status:200}}catch(l){const u=l;return u instanceof Redirect?{type:"redirect",status:u.status,location:u.location}:{type:"error",error:Ye(u)}}}function On(e){return e.pathname.startsWith(`${e$1}/${i}/remote/`)&&e.pathname.replace(`${e$1}/${i}/remote/`,"")}function Cn(e){return e.searchParams.get("/remote")}const Pn=10;async function Un(e$1,t,r,n,s,a,c,d){if(a.depth>Pn)return text(`Not found: ${e$1.url.pathname}`,{status:404});if(Wt(e$1)){const o=await s._.nodes[r.leaf]();return cn(e$1,t,n,o?.server)}try{const o=c.page();let i=200,l;if(ln(e$1)){const $=Cn(e$1.url);if($?l=await Rn(e$1,t,s,$):l=await un(e$1,t,o.server),l?.type==="redirect")return Se(l.status,l.location);l?.type==="error"&&(i=ce(l.error)),l?.type==="failure"&&(i=l.status);}const u=c.prerender();if(u){if(o.server?.actions)throw new Error("Cannot prerender pages with actions")}else if(a.prerendering)return new Response(void 0,{status:204});a.prerender_default=u;const h=c.should_prerender_data(),p=Ke(e$1.url.pathname),m=[],f=c.ssr(),_=c.csr();if(f===!1&&!(a.prerendering&&h))return e&&l&&!e$1.request.headers.has("x-sveltekit-action")&&(l.type==="error"?console.warn("The form action returned an error, but +error.svelte wasn't rendered because SSR is off. To get the error page with CSR, enhance your form with `use:enhance`. See https://svelte.dev/docs/kit/form-actions#progressive-enhancement-use-enhance"):l.data&&console.warn("The form action returned a value, but it isn't available in `page.form`, because SSR is off. To handle the returned value in CSR, enhance your form with `use:enhance`. See https://svelte.dev/docs/kit/form-actions#progressive-enhancement-use-enhance")),await _e({branch:[],fetched:m,page_config:{ssr:!1,csr:_},status:i,error:null,event:e$1,event_state:t,options:n,manifest:s,state:a,resolve_opts:d,data_serializer:he(e$1,t,n)});const y=[];let b=null;const x=he(e$1,t,n),k=a.prerendering&&h?Kt(e$1,t,n):null,E=c.data.map(($,g)=>{if(b)throw b;return Promise.resolve().then(async()=>{try{if($===o&&l?.type==="error")throw l.error;const v=await Qe({event:e$1,event_state:t,state:a,node:$,parent:async()=>{const A={};for(let S=0;S<g;S+=1){const T=await E[S];T&&Object.assign(A,T.data);}return A}});return $&&x.add_node(g,v),k?.add_node(g,v),v}catch(v){throw b=v,b}})}),w=c.data.map(($,g)=>{if(b)throw b;return Promise.resolve().then(async()=>{try{return await Xt({event:e$1,event_state:t,fetched:m,node:$,parent:async()=>{const v={};for(let A=0;A<g;A+=1)Object.assign(v,await w[A]);return v},resolve_opts:d,server_data_promise:E[g],state:a,csr:_})}catch(v){throw b=v,b}})});for(const $ of E)$.catch(()=>{});for(const $ of w)$.catch(()=>{});for(let $=0;$<c.data.length;$+=1){const g=c.data[$];if(g)try{const v=await E[$],A=await w[$];y.push({node:g,server_data:v,data:A});}catch(v){const A=v;if(A instanceof Redirect){if(a.prerendering&&h){const U=JSON.stringify({type:"redirect",location:A.location});a.prerendering.dependencies.set(p,{response:text(U),body:U});}return Se(A.status,A.location)}const S=ce(A),T=await M(e$1,t,n,A);for(;$--;)if(r.errors[$]){const U=r.errors[$],F=await s._.nodes[U]();let V=$;for(;!y[V];)V-=1;x.set_max_nodes(V+1);const J=Ie(y.slice(0,V+1)),Y=new et(J.map(me=>me.node));return await _e({event:e$1,event_state:t,options:n,manifest:s,state:a,resolve_opts:d,page_config:{ssr:Y.ssr(),csr:Y.csr()},status:S,error:T,branch:J.concat({node:F,data:null,server_data:null}),fetched:m,data_serializer:x})}return Ae(n,S,T.message)}else y.push(null);}if(a.prerendering&&k){let{data:$,chunks:g}=k.get_data();if(g)for await(const v of g)$+=v;a.prerendering.dependencies.set(p,{response:text($),body:$});}return await _e({event:e$1,event_state:t,options:n,manifest:s,state:a,resolve_opts:d,page_config:{csr:_,ssr:f},status:i,error:null,branch:f===!1?[]:Ie(y),action_result:l,fetched:m,data_serializer:f===!1?he(e$1,t,n):x})}catch(o){return await ir({event:e$1,event_state:t,options:n,manifest:s,state:a,status:500,error:o,resolve_opts:d})}}function qn(e){let t=false,r;return ()=>t?r:(t=true,r=e())}async function Nn(e,t,r,n,s$1,a,c,d){if(!r.page)return new Response(void 0,{status:404});try{const o=[...r.page.layouts,r.page.leaf],i=c??o.map(()=>!0);let l=!1;const u=new URL(e.url);u.pathname=y(u.pathname,d);const h={...e,url:u},p=o.map((k,E)=>qn(async()=>{try{if(l)return {type:"skip"};const w=k==null?k:await s$1._.nodes[k]();return Qe({event:h,event_state:t,state:a,node:w,parent:async()=>{const $={};for(let g=0;g<E;g+=1){const v=await p[g]();v&&Object.assign($,v.data);}return $}})}catch(w){throw l=!0,w}})),m=p.map(async(k,E)=>i[E]?k():{type:"skip"});let f=m.length;const _=await Promise.all(m.map((k,E)=>k.catch(async w=>{if(w instanceof Redirect)throw w;return f=Math.min(f,E+1),{type:"error",error:await M(e,t,n,w),status:w instanceof HttpError||w instanceof SvelteKitError?w.status:void 0}}))),y$1=Kt(e,t,n);for(let k=0;k<_.length;k++)y$1.add_node(k,_[k]);const{data:b,chunks:x}=y$1.get_data();return x?new Response(new ReadableStream({async start(k){k.enqueue(s.encode(b));for await(const E of x)k.enqueue(s.encode(E));k.close();},type:"bytes"}),{headers:{"content-type":"text/sveltekit-data","cache-control":"private, no-store"}}):Me(b)}catch(o){const i=o;return i instanceof Redirect?We(i):Me(await M(e,t,n,i),500)}}function Me(e,t=200){return text(typeof e=="string"?e:JSON.stringify(e),{status:t,headers:{"content-type":"application/json","cache-control":"private, no-store"}})}function We(e){return Me({type:"redirect",location:e.location})}var ve={};var ft;function zn(){if(ft)return ve;ft=1,ve.parse=r,ve.serialize=n;var e=Object.prototype.toString,t=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function r(o,i){if(typeof o!="string")throw new TypeError("argument str must be a string");for(var l={},u=i||{},h=u.decode||s,p=0;p<o.length;){var m=o.indexOf("=",p);if(m===-1)break;var f=o.indexOf(";",p);if(f===-1)f=o.length;else if(f<m){p=o.lastIndexOf(";",m-1)+1;continue}var _=o.slice(p,m).trim();if(l[_]===void 0){var y=o.slice(m+1,f).trim();y.charCodeAt(0)===34&&(y=y.slice(1,-1)),l[_]=d(y,h);}p=f+1;}return l}function n(o,i,l){var u=l||{},h=u.encode||a;if(typeof h!="function")throw new TypeError("option encode is invalid");if(!t.test(o))throw new TypeError("argument name is invalid");var p=h(i);if(p&&!t.test(p))throw new TypeError("argument val is invalid");var m=o+"="+p;if(u.maxAge!=null){var f=u.maxAge-0;if(isNaN(f)||!isFinite(f))throw new TypeError("option maxAge is invalid");m+="; Max-Age="+Math.floor(f);}if(u.domain){if(!t.test(u.domain))throw new TypeError("option domain is invalid");m+="; Domain="+u.domain;}if(u.path){if(!t.test(u.path))throw new TypeError("option path is invalid");m+="; Path="+u.path;}if(u.expires){var _=u.expires;if(!c(_)||isNaN(_.valueOf()))throw new TypeError("option expires is invalid");m+="; Expires="+_.toUTCString();}if(u.httpOnly&&(m+="; HttpOnly"),u.secure&&(m+="; Secure"),u.partitioned&&(m+="; Partitioned"),u.priority){var y=typeof u.priority=="string"?u.priority.toLowerCase():u.priority;switch(y){case "low":m+="; Priority=Low";break;case "medium":m+="; Priority=Medium";break;case "high":m+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(u.sameSite){var b=typeof u.sameSite=="string"?u.sameSite.toLowerCase():u.sameSite;switch(b){case  true:m+="; SameSite=Strict";break;case "lax":m+="; SameSite=Lax";break;case "strict":m+="; SameSite=Strict";break;case "none":m+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return m}function s(o){return o.indexOf("%")!==-1?decodeURIComponent(o):o}function a(o){return encodeURIComponent(o)}function c(o){return e.call(o)==="[object Date]"||o instanceof Date}function d(o,i){try{return i(o)}catch{return o}}return ve}var re=zn();const Ln=/[\x00-\x1F\x7F()<>@,;:"/[\]?={} \t]/,ke={},Dn=4129;function qe(e){if(e?.path===void 0)throw new Error("You must specify a `path` when setting, deleting or serializing cookies")}function In(e,t,r){return `${e||""}${t}?${encodeURIComponent(r)}`}function Hn(e$1,t){const r=e$1.headers.get("cookie")??"",n=re.parse(r,{decode:h=>h});let s$1;const a=new Map,c={httpOnly:true,sameSite:"lax",secure:!(t.hostname==="localhost"&&t.protocol==="http:")},d={get(h,p){const m=Array.from(a.values()).filter(y=>y.name===h&&Ne(t.hostname,y.options.domain)&&Ee(t.pathname,y.options.path)).sort((y,b)=>b.options.path.length-y.options.path.length)[0];if(m)return m.options.maxAge===0?void 0:m.value;const _=re.parse(r,{decode:p?.decode})[h];if(e&&!_){const y=Array.from(ke[h]??[]).filter(b=>Ee(b,t.pathname)&&b!==t.pathname);y.length>0&&console.warn(`'${h}' cookie does not exist for ${t.pathname}, but was previously set at ${Mn([...y])}. Did you mean to set its 'path' to '/' instead?`);}return _},getAll(h){const p=re.parse(r,{decode:h?.decode}),m=new Map;for(const f of a.values())if(Ne(t.hostname,f.options.domain)&&Ee(t.pathname,f.options.path)){const _=m.get(f.name);(!_||f.options.path.length>_.options.path.length)&&m.set(f.name,f);}for(const f of m.values())p[f.name]=f.value;return Object.entries(p).map(([f,_])=>({name:f,value:_}))},set(h,p,m){const f=h.match(Ln);f&&console.warn(`The cookie name "${h}" will be invalid in SvelteKit 3.0 as it contains ${f.join(" and ")}. See RFC 2616 for more details https://datatracker.ietf.org/doc/html/rfc2616#section-2.2`),qe(m),l(h,p,{...c,...m});},delete(h,p){qe(p),d.set(h,"",{...p,maxAge:0});},serialize(h,p,m){qe(m);let f=m.path;if(!m.domain||m.domain===t.hostname){if(!s$1)throw new Error("Cannot serialize cookies until after the route is determined");f=x$2(s$1,f);}return re.serialize(h,p,{...c,...m,path:f})}};function o(h,p){const m={...n};for(const f of a.values()){if(!Ne(h.hostname,f.options.domain)||!Ee(h.pathname,f.options.path))continue;const _=f.options.encode||encodeURIComponent;m[f.name]=_(f.value);}if(p){const f=re.parse(p,{decode:_=>_});for(const _ in f)m[_]=f[_];}return Object.entries(m).map(([f,_])=>`${f}=${_}`).join("; ")}const i=[];function l(h,p,m){if(!s$1){i.push(()=>l(h,p,m));return}let f=m.path;(!m.domain||m.domain===t.hostname)&&(f=x$2(s$1,f));const _=In(m.domain,f,h),y={name:h,value:p,options:{...m,path:f}};if(a.set(_,y),e){const b=re.serialize(h,p,y.options);if(s.encode(b).byteLength>Dn)throw new Error(`Cookie "${h}" is too large, and will be discarded by the browser`);ke[h]??=new Set,p?ke[h].add(f):ke[h].delete(f);}}function u(h){s$1=y(t.pathname,h),i.forEach(p=>p());}return {cookies:d,new_cookies:a,get_cookie_header:o,set_internal:l,set_trailing_slash:u}}function Ne(e,t){if(!t)return  true;const r=t[0]==="."?t.slice(1):t;return e===r?true:e.endsWith("."+r)}function Ee(e,t){if(!t)return  true;const r=t.endsWith("/")?t.slice(0,-1):t;return e===r?true:e.startsWith(r+"/")}function pt(e,t){for(const r of t){const{name:n,value:s,options:a}=r;if(e.append("set-cookie",re.serialize(n,s,a)),a.path.endsWith(".html")){const c=Ke(a.path);e.append("set-cookie",re.serialize(n,s,{...a,path:c}));}}}function Mn(e){return e.length<=2?e.join(" and "):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`}var ae={exports:{}},ht;function Wn(){if(ht)return ae.exports;ht=1;var e={decodeValues:true,map:false,silent:false};function t(o){return typeof o!="string"||o in{}}function r(){return Object.create(null)}function n(o){return typeof o=="string"&&!!o.trim()}function s(o,i){var l=o.split(";").filter(n),u=l.shift(),h=a(u),p=h.name,m=h.value;if(i=i?Object.assign({},e,i):e,t(p))return null;try{m=i.decodeValues?decodeURIComponent(m):m;}catch(_){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",_);}var f=r();return f.name=p,f.value=m,l.forEach(function(_){var y=_.split("="),b=y.shift().trimLeft().toLowerCase();if(!t(b)){var x=y.join("=");if(b==="expires")f.expires=new Date(x);else if(b==="max-age"){var k=parseInt(x,10);Number.isNaN(k)||(f.maxAge=k);}else b==="secure"?f.secure=true:b==="httponly"?f.httpOnly=true:b==="samesite"?f.sameSite=x:b==="partitioned"?f.partitioned=true:b&&(f[b]=x);}}),f}function a(o){var i="",l="",u=o.split("=");return u.length>1?(i=u.shift(),l=u.join("=")):l=o,{name:i,value:l}}function c(o,i){if(i=i?Object.assign({},e,i):e,!o)return i.map?r():[];if(o.headers)if(typeof o.headers.getSetCookie=="function")o=o.headers.getSetCookie();else if(o.headers["set-cookie"])o=o.headers["set-cookie"];else {var l=o.headers[Object.keys(o.headers).find(function(h){return h.toLowerCase()==="set-cookie"})];!l&&o.headers.cookie&&!i.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),o=l;}if(Array.isArray(o)||(o=[o]),i.map){var u=r();return o.filter(n).reduce(function(h,p){var m=s(p,i);return m&&!t(m.name)&&(h[m.name]=m),h},u)}else return o.filter(n).map(function(h){return s(h,i)}).filter(Boolean)}function d(o){if(Array.isArray(o))return o;if(typeof o!="string")return [];var i=[],l=0,u,h,p,m,f;function _(){for(;l<o.length&&/\s/.test(o.charAt(l));)l+=1;return l<o.length}function y(){return h=o.charAt(l),h!=="="&&h!==";"&&h!==","}for(;l<o.length;){for(u=l,f=false;_();)if(h=o.charAt(l),h===","){for(p=l,l+=1,_(),m=l;l<o.length&&y();)l+=1;l<o.length&&o.charAt(l)==="="?(f=true,l=m,i.push(o.substring(u,p)),u=l):l=p+1;}else l+=1;(!f||l>=o.length)&&i.push(o.substring(u,o.length));}return i}return ae.exports=c,ae.exports.parse=c,ae.exports.parseString=s,ae.exports.splitCookiesString=d,ae.exports}var _t=Wn();function Bn({event:e,options:t$1,manifest:r,state:n,get_cookie_header:s,set_internal:a}){const c=async(d,o)=>{const i=mt(d,o,e.url);let l=(d instanceof Request?d.mode:o?.mode)??"cors",u=(d instanceof Request?d.credentials:o?.credentials)??"same-origin";return t$1.hooks.handleFetch({event:e,request:i,fetch:async(h,p)=>{const m=mt(h,p,e.url),f=new URL(m.url);if(m.headers.has("origin")||m.headers.set("origin",e.url.origin),h!==i&&(l=(h instanceof Request?h.mode:p?.mode)??"cors",u=(h instanceof Request?h.credentials:p?.credentials)??"same-origin"),(m.method==="GET"||m.method==="HEAD")&&(l==="no-cors"&&f.origin!==e.url.origin||f.origin===e.url.origin)&&m.headers.delete("origin"),f.origin!==e.url.origin){if(`.${f.hostname}`.endsWith(`.${e.url.hostname}`)&&u!=="omit"){const g=s(f,m.headers.get("cookie"));g&&m.headers.set("cookie",g);}return fetch(m)}const _=t||e$1,y=decodeURIComponent(f.pathname),b=(y.startsWith(_)?y.slice(_.length):y).slice(1),x=`${b}/index.html`,k$1=r.assets.has(b)||b in r._.server_assets,E=r.assets.has(x)||x in r._.server_assets;if(k$1||E){const g=k$1?b:x;if(n.read){const v=k$1?r.mimeTypes[b.slice(b.lastIndexOf("."))]:"text/html";return new Response(n.read(g),{headers:v?{"content-type":v}:{}})}else if(k&&g in r._.server_assets){const v=r._.server_assets[g],A=r.mimeTypes[g.slice(g.lastIndexOf("."))];return new Response(k(g),{headers:{"Content-Length":""+v,"Content-Type":A}})}return await fetch(m)}if(Dt(r,e$1+y))return await fetch(m);if(u!=="omit"){const g=s(f,m.headers.get("cookie"));g&&m.headers.set("cookie",g);const v=e.request.headers.get("authorization");v&&!m.headers.has("authorization")&&m.headers.set("authorization",v);}m.headers.has("accept")||m.headers.set("accept","*/*"),m.headers.has("accept-language")||m.headers.set("accept-language",e.request.headers.get("accept-language"));const w=await Fn(m,t$1,r,n),$=w.headers.get("set-cookie");if($)for(const g of _t.splitCookiesString($)){const{name:v,value:A,...S}=_t.parseString(g,{decodeValues:false}),T=S.path??(f.pathname.split("/").slice(0,-1).join("/")||"/");a(v,A,{path:T,encode:U=>U,...S});}return w}})};return (d,o)=>{const i=c(d,o);return i.catch(()=>{}),i}}function mt(e,t,r){return e instanceof Request?e:new Request(typeof e=="string"?new URL(e,r):e,t)}async function Fn(e,t,r,n){if(e.signal){if(e.signal.aborted)throw new DOMException("The operation was aborted.","AbortError");let s=()=>{};const a=new Promise((d,o)=>{const i=()=>{o(new DOMException("The operation was aborted.","AbortError"));};e.signal.addEventListener("abort",i,{once:true}),s=()=>e.signal.removeEventListener("abort",i);}),c=await Promise.race([Be(e,t,r,{...n,depth:n.depth+1}),a]);return s(),c}else return await Be(e,t,r,{...n,depth:n.depth+1})}let yt,ze,Le;function Vn(e){return yt??=`export const env=${JSON.stringify(x)}`,ze??=`W/${Date.now()}`,Le??=new Headers({"content-type":"application/javascript; charset=utf-8",etag:ze}),e.headers.get("if-none-match")===ze?new Response(void 0,{status:304,headers:Le}):new Response(yt,{headers:Le})}const wt=new Set(["max-age","public","private","no-cache","no-store","must-revalidate","proxy-revalidate","s-maxage","immutable","stale-while-revalidate","stale-if-error","no-transform","only-if-cached","max-stale","min-fresh"]),Gn=/^(application|audio|example|font|haptics|image|message|model|multipart|text|video|x-[a-z]+)\/[-+.\w]+$/i,Jn={"cache-control":e=>{const t=`(While parsing "${e}".)`,r=e.split(",").map(a=>a.trim());if(r.some(a=>!a))throw new Error(`\`cache-control\` header contains empty directives. ${t}`);const s=r.map(a=>a.split("=")[0].toLowerCase()).find(a=>!wt.has(a));if(s)throw new Error(`Invalid cache-control directive "${s}". Did you mean one of: ${[...wt].join(", ")}? ${t}`)},"content-type":e=>{const t=e.split(";")[0].trim(),r=`(While parsing "${e}".)`;if(!Gn.test(t))throw new Error(`Invalid content-type value "${t}". ${r}`)}};function Zn(e){for(const[t,r]of Object.entries(e)){const n=Jn[t.toLowerCase()];try{n?.(r);}catch(s){s instanceof Error&&console.warn(`[SvelteKit] ${s.message}`);}}}const gt=({html:e})=>e,bt=()=>false,$t=({type:e})=>e==="js"||e==="css",Kn=new Set(["GET","HEAD","POST"]),Xn=new Set(["GET","HEAD","OPTIONS"]);let vt=false;const Be=es(Yn);async function Yn(e$2,t,r,n){const s=new URL(e$2.url),a=nn(s.pathname),c=tn(s.pathname),d=On(s);if(!e){const w=e$2.headers.get("origin");if(d){if(e$2.method!=="GET"&&w!==s.origin)return json({message:"Cross-site remote requests are forbidden"},{status:403})}else if(t.csrf_check_origin&&Ge(e$2)&&(e$2.method==="POST"||e$2.method==="PUT"||e$2.method==="PATCH"||e$2.method==="DELETE")&&w!==s.origin&&(!w||!t.csrf_trusted_origins.includes(w))){const g=`Cross-site ${e$2.method} form submissions are forbidden`,v={status:403};return e$2.headers.get("accept")==="application/json"?json({message:g},v):text(g,v)}}if(t.hash_routing&&s.pathname!==e$1+"/"&&s.pathname!=="/[fallback]")return text("Not found",{status:404});let o;a?s.pathname=sn(s.pathname):c?(s.pathname=rn(s.pathname)+(s.searchParams.get(ge)==="1"?"/":"")||"/",s.searchParams.delete(ge),o=s.searchParams.get(_e$1)?.split("").map(w=>w==="1"),s.searchParams.delete(_e$1)):d&&(s.pathname=e$2.headers.get("x-sveltekit-pathname")??e$1,s.search=e$2.headers.get("x-sveltekit-search")??"");const i$1={},{cookies:l,new_cookies:u,get_cookie_header:h,set_internal:p,set_trailing_slash:m}=Hn(e$2,s),f={prerendering:n.prerendering,transport:t.hooks.transport,handleValidationError:t.hooks.handleValidationError,tracing:{record_span:ne},is_in_remote_function:false},_={cookies:l,fetch:null,getClientAddress:n.getClientAddress||(()=>{throw new Error("@sveltejs/adapter-node does not specify getClientAddress. Please raise an issue")}),locals:{},params:{},platform:n.platform,request:e$2,route:{id:null},setHeaders:w=>{e&&Zn(w);for(const $ in w){const g=$.toLowerCase(),v=w[$];if(g==="set-cookie")throw new Error("Use `event.cookies.set(name, value, options)` instead of `event.setHeaders` to set cookies");if(g in i$1)if(g==="server-timing")i$1[g]+=", "+v;else throw new Error(`"${$}" header is already set`);else i$1[g]=v,n.prerendering&&g==="cache-control"&&(n.prerendering.cache=v);}},url:s,isDataRequest:c,isSubRequest:n.depth>0,isRemoteRequest:!!d};_.fetch=Bn({event:_,options:t,manifest:r,state:n,get_cookie_header:h,set_internal:p}),n.emulator?.platform&&(_.platform=await n.emulator.platform({config:{},prerender:!!n.prerendering?.fallback}));let y$1=s.pathname;if(!d){const w=n.prerendering?.inside_reroute;try{n.prerendering&&(n.prerendering.inside_reroute=!0),y$1=await t.hooks.reroute({url:new URL(s),fetch:_.fetch})??s.pathname;}catch{return text("Internal Server Error",{status:500})}finally{n.prerendering&&(n.prerendering.inside_reroute=w);}}try{y$1=E$1(y$1);}catch{return text("Malformed URI",{status:400})}if(y$1!==s.pathname&&!n.prerendering?.fallback&&Dt(r,y$1)){const w=new URL(e$2.url);w.pathname=c?Ke(y$1):a?Mt(y$1):y$1;const $=await fetch(w,e$2),g=new Headers($.headers);return g.has("content-encoding")&&(g.delete("content-encoding"),g.delete("content-length")),new Response($.body,{headers:g,status:$.status,statusText:$.statusText})}let b=null;if(e$1&&!n.prerendering?.fallback){if(!y$1.startsWith(e$1))return text("Not found",{status:404});y$1=y$1.slice(e$1.length)||"/";}if(a)return En(y$1,new URL(e$2.url),r);if(y$1===`/${i}/env.js`)return Vn(e$2);if(!d&&y$1.startsWith(`/${i}`)){const w=new Headers;return w.set("cache-control","public, max-age=0, must-revalidate"),text("Not found",{status:404,headers:w})}if(!n.prerendering?.fallback){const w=await r._.matchers();for(const $ of r._.routes){const g=$.pattern.exec(y$1);if(!g)continue;const v=nr(g,$.params,w);if(v){b=$,_.route={id:b.id},_.params=j$1(v);break}}}let x={transformPageChunk:gt,filterSerializedResponseHeaders:bt,preload:$t},k="never";try{const w=b?.page?new et(await Qn(b.page,r)):void 0;if(b&&!d){if(s.pathname===e$1||s.pathname===e$1+"/")k="always";else if(w)e&&w.validate(),k=w.trailing_slash();else if(b.endpoint){const g=await b.endpoint();k=g.trailingSlash??"never",e&&I$3(g,b.endpoint_id);}if(!c){const g=y(s.pathname,k);if(g!==s.pathname&&!n.prerendering?.fallback)return new Response(void 0,{status:308,headers:{"x-sveltekit-normalize":"1",location:(g.startsWith("//")?s.origin+g:g)+(s.search==="?"?"":s.search)}})}if(n.before_handle||n.emulator?.platform){let g={},v=!1;if(b.endpoint){const A=await b.endpoint();g=A.config??g,v=A.prerender??v;}else w&&(g=w.get_config()??g,v=w.prerender());n.before_handle&&n.before_handle(_,g,v),n.emulator?.platform&&(_.platform=await n.emulator.platform({config:g,prerender:v}));}}m(k),n.prerendering&&!n.prerendering.fallback&&!n.prerendering.inside_reroute&&R$1(s);const $=await ne({name:"sveltekit.handle.root",attributes:{"http.route":_.route.id||"unknown","http.method":_.request.method,"http.url":_.url.href,"sveltekit.is_data_request":c,"sveltekit.is_sub_request":_.isSubRequest},fn:async g=>{const v={..._,tracing:{enabled:!1,root:g,current:g}};return await with_request_store({event:v,state:f},()=>t.hooks.handle({event:v,resolve:(A,S)=>ne({name:"sveltekit.resolve",attributes:{"http.route":A.route.id||"unknown"},fn:T=>with_request_store(null,()=>E(merge_tracing(A,T),w,S).then(U=>{for(const F in i$1){const V=i$1[F];U.headers.set(F,V);}return pt(U.headers,u.values()),n.prerendering&&A.route.id!==null&&U.headers.set("x-sveltekit-routeid",encodeURI(A.route.id)),T.setAttributes({"http.response.status_code":U.status,"http.response.body.size":U.headers.get("content-length")||"unknown"}),U}))})}))}});if($.status===200&&$.headers.has("etag")){let g=e$2.headers.get("if-none-match");g?.startsWith('W/"')&&(g=g.substring(2));const v=$.headers.get("etag");if(g===v){const A=new Headers({etag:v});for(const S of ["cache-control","content-location","date","expires","vary","set-cookie"]){const T=$.headers.get(S);T&&A.set(S,T);}return new Response(void 0,{status:304,headers:A})}}if(c&&$.status>=300&&$.status<=308){const g=$.headers.get("location");if(g)return We(new Redirect($.status,g))}return $}catch(w){if(w instanceof Redirect){const $=c||d?We(w):b?.page&&Wt(_)?Bt(w):Se(w.status,w.location);return pt($.headers,u.values()),$}return await ct(_,f,t,w)}async function E(w,$,g){try{if(g&&(x={transformPageChunk:g.transformPageChunk||gt,filterSerializedResponseHeaders:g.filterSerializedResponseHeaders||bt,preload:g.preload||$t}),t.hash_routing||n.prerendering?.fallback)return await _e({event:w,event_state:f,options:t,manifest:r,state:n,page_config:{ssr:!1,csr:!0},status:200,error:null,branch:[],fetched:[],resolve_opts:x,data_serializer:he(w,f,t)});if(d)return await Sn(w,f,t,r,d);if(b){const A=w.request.method;let S;if(c)S=await Nn(w,f,b,t,r,n,o,k);else if(b.endpoint&&(!b.page||en(w)))S=await Qr(w,f,await b.endpoint(),n);else if(b.page)if($)if(Kn.has(A))S=await Un(w,f,b.page,t,r,n,$,x);else {const T=new Set(Xn);if((await r._.nodes[b.page.leaf]())?.server?.actions&&T.add("POST"),A==="OPTIONS")S=new Response(null,{status:204,headers:{allow:Array.from(T.values()).join(", ")}});else {const F=[...T].reduce((V,J)=>(V[J]=!0,V),{});S=qt(F,A);}}else throw new Error("page_nodes not found. This should never happen");else throw new Error("Route is neither page nor endpoint. This should never happen");if(e$2.method==="GET"&&b.page&&b.endpoint){const T=S.headers.get("vary")?.split(",")?.map(U=>U.trim().toLowerCase());T?.includes("accept")||T?.includes("*")||(S=new Response(S.body,{status:S.status,statusText:S.statusText,headers:new Headers(S.headers)}),S.headers.append("Vary","Accept"));}return S}if(n.error&&w.isSubRequest){const A=new Headers(e$2.headers);return A.set("x-sveltekit-error","true"),await fetch(e$2,{headers:A})}if(n.error)return text("Internal Server Error",{status:500});if(n.depth===0)return e&&w.url.pathname==="/.well-known/appspecific/com.chrome.devtools.json"?(vt||(console.log(`
Google Chrome is requesting ${w.url.pathname} to automatically configure devtools project settings. To learn why, and how to prevent this message, see https://svelte.dev/docs/cli/devtools-json
`),vt=!0),new Response(void 0,{status:404})):await ir({event:w,event_state:f,options:t,manifest:r,state:n,status:404,error:new SvelteKitError(404,"Not Found",`Not found: ${w.url.pathname}`),resolve_opts:x});if(n.prerendering)return text("not found",{status:404});const v=await fetch(e$2);return new Response(v.body,v)}catch(v){return await ct(w,f,t,v)}finally{w.cookies.set=()=>{throw new Error("Cannot use `cookies.set(...)` after the response has been generated")},w.setHeaders=()=>{throw new Error("Cannot use `setHeaders(...)` after the response has been generated")};}}}function Qn(e,t){return Promise.all([...e.layouts.map(r=>r==null?r:t._.nodes[r]()),t._.nodes[e.leaf]()])}function es(e){return async(t,...r)=>e(t,...r)}function kt(e,t,r){return Object.fromEntries(Object.entries(e).filter(([n])=>n.startsWith(t)&&(r===""||!n.startsWith(r))))}let ts,Et=null;class fs{#e;#t;constructor(t){if(this.#e=M$1,this.#t=t,Nr){const r=this.respond.bind(this);this.respond=async(...n)=>{const{promise:s,resolve:a}=Rt(),c=Et;return Et=s,await c,r(...n).finally(a)};}}async init({env:t,read:r}){const{env_public_prefix:n,env_private_prefix:s}=this.#e;O(kt(t,s,n)),P(kt(t,n,s)),r&&I$1(c=>{const d=r(c);return d instanceof ReadableStream?d:new ReadableStream({async start(o){try{const i=await Promise.resolve(d);if(!i){o.close();return}const l=i.getReader();for(;;){const{done:u,value:h}=await l.read();if(u)break;o.enqueue(h);}o.close();}catch(i){o.error(i);}}})}),await(ts??=(async()=>{try{const a=await U();this.#e.hooks={handle:a.handle||(({event:c,resolve:d})=>d(c)),handleError:a.handleError||(({status:c,error:d,event:o})=>{const i=Xr(c,d,o);console.error(i);}),handleFetch:a.handleFetch||(({request:c,fetch:d})=>d(c)),handleValidationError:a.handleValidationError||(({issues:c})=>(console.error("Remote function schema validation failed:",c),{message:"Bad Request"})),reroute:a.reroute||(()=>{}),transport:a.transport||{}},a.transport&&Object.fromEntries(Object.entries(a.transport).map(([c,d])=>[c,d.decode])),a.init&&await a.init();}catch(a){if(e)this.#e.hooks={handle:()=>{throw a},handleError:({error:c})=>console.error(c),handleFetch:({request:c,fetch:d})=>d(c),handleValidationError:()=>({message:"Bad Request"}),reroute:()=>{},transport:{}};else throw a}})());}async respond(t,r){return Be(t,this.#e,this.#t,{...r,error:false,depth:0})}}

export { fs as Server };
//# sourceMappingURL=index.js.map
