import{S as tt,i as nt,s as rt,a as at,e as B,c as st,b as G,g as me,t as J,d as _e,f as z,h as F,j as ot,o as Oe,k as it,l as lt,m as ct,n as Re,p as x,q as ft,r as ut,u as dt,v as Y,w as Q,x as Ie,y as Z,z as ee,A as ue}from"./chunks/index-e5b56f0c.js";import{g as We,f as Ge,s as W,a as Pe,b as pt,i as ht}from"./chunks/singletons-0085d760.js";import{u as mt}from"./chunks/parse-75f4e1ae.js";function _t(r,e){return r==="/"||e==="ignore"?r:e==="never"?r.endsWith("/")?r.slice(0,-1):r:e==="always"&&!r.endsWith("/")?r+"/":r}function gt(r){return r.split("%25").map(decodeURI).join("%25")}function wt(r){for(const e in r)r[e]=decodeURIComponent(r[e]);return r}const yt=["href","pathname","search","searchParams","toString","toJSON"];function bt(r,e){const n=new URL(r);for(const o of yt){let i=n[o];Object.defineProperty(n,o,{get(){return e(),i},enumerable:!0,configurable:!0})}return vt(n),n}function vt(r){Object.defineProperty(r,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const Et="/__data.json";function kt(r){return r.replace(/\/$/,"")+Et}function Rt(r){let e=5381;if(typeof r=="string"){let n=r.length;for(;n;)e=e*33^r.charCodeAt(--n)}else if(ArrayBuffer.isView(r)){const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let o=n.length;for(;o;)e=e*33^n[--o]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}const ge=window.fetch;window.fetch=(r,e)=>{if((r instanceof Request?r.method:(e==null?void 0:e.method)||"GET")!=="GET"){const o=new URL(r instanceof Request?r.url:r.toString(),document.baseURI).href;se.delete(o)}return ge(r,e)};const se=new Map;function St(r,e){const n=Ze(r,e),o=document.querySelector(n);if(o!=null&&o.textContent){const{body:i,...h}=JSON.parse(o.textContent),t=o.getAttribute("data-ttl");return t&&se.set(n,{body:i,init:h,ttl:1e3*Number(t)}),Promise.resolve(new Response(i,h))}return ge(r,e)}function $t(r,e,n){if(se.size>0){const o=Ze(r,n),i=se.get(o);if(i){if(performance.now()<i.ttl)return new Response(i.body,i.init);se.delete(o)}}return ge(e,n)}function Ze(r,e){let o=`script[data-sveltekit-fetched][data-url=${JSON.stringify(r instanceof Request?r.url:r)}]`;return(e==null?void 0:e.body)&&(typeof e.body=="string"||ArrayBuffer.isView(e.body))&&(o+=`[data-hash="${Rt(e.body)}"]`),o}const Lt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function Ot(r){const e=[],n=[],o=[];let i=!0;return{pattern:r==="/"?/^\/$/:new RegExp(`^${Ut(r).map((t,p,y)=>{const m=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(t);if(m)return e.push(m[1]),n.push(m[2]),o.push(!1),"(?:/(.*))?";const _=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(t);if(_)return e.push(_[1]),n.push(_[2]),o.push(!0),"(?:/([^/]+))?";const k=p===y.length-1;return t?"/"+t.split(/\[(.+?)\](?!\])/).map((j,U)=>{if(U%2){if(j.startsWith("x+"))return Se(String.fromCharCode(parseInt(j.slice(2),16)));if(j.startsWith("u+"))return Se(String.fromCharCode(...j.slice(2).split("-").map(te=>parseInt(te,16))));const q=Lt.exec(j);if(!q)throw new Error(`Invalid param: ${j}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,C,ie,H,le]=q;return e.push(H),n.push(le),o.push(!!C),ie?"(.*?)":C?"([^/]*)?":"([^/]+?)"}return k&&j.includes(".")&&(i=!1),Se(j)}).join(""):void 0}).join("")}${i?"/?":""}$`),names:e,types:n,optional:o}}function Pt(r){return!/^\([^)]+\)$/.test(r)}function Ut(r){return r.slice(1).split("/").filter(Pt)}function At(r,{names:e,types:n,optional:o},i){const h={};for(let t=0;t<e.length;t+=1){const p=e[t],y=n[t];let m=r[t+1];if(m||!o[t]){if(y){const _=i[y];if(!_)throw new Error(`Missing "${y}" param matcher`);if(!_(m))return}h[p]=m!=null?m:""}}return h}function Se(r){return r.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function jt(r,e,n,o){const i=new Set(e);return Object.entries(n).map(([p,[y,m,_]])=>{const{pattern:k,names:S,types:K,optional:j}=Ot(p),U={id:p,exec:q=>{const C=k.exec(q);if(C)return At(C,{names:S,types:K,optional:j},o)},errors:[1,..._||[]].map(q=>r[q]),layouts:[0,...m||[]].map(t),leaf:h(y)};return U.errors.length=U.layouts.length=Math.max(U.errors.length,U.layouts.length),U});function h(p){const y=p<0;return y&&(p=~p),[y,r[p]]}function t(p){return p===void 0?p:[i.has(p),r[p]]}}function It(r){let e,n,o;var i=r[0][0];function h(t){return{props:{data:t[2],form:t[1]}}}return i&&(e=Y(i,h(r))),{c(){e&&Q(e.$$.fragment),n=B()},l(t){e&&Ie(e.$$.fragment,t),n=B()},m(t,p){e&&Z(e,t,p),G(t,n,p),o=!0},p(t,p){const y={};if(p&4&&(y.data=t[2]),p&2&&(y.form=t[1]),i!==(i=t[0][0])){if(e){me();const m=e;J(m.$$.fragment,1,0,()=>{ee(m,1)}),_e()}i?(e=Y(i,h(t)),Q(e.$$.fragment),z(e.$$.fragment,1),Z(e,n.parentNode,n)):e=null}else i&&e.$set(y)},i(t){o||(e&&z(e.$$.fragment,t),o=!0)},o(t){e&&J(e.$$.fragment,t),o=!1},d(t){t&&F(n),e&&ee(e,t)}}}function Tt(r){let e,n,o;var i=r[0][0];function h(t){return{props:{data:t[2],$$slots:{default:[Nt]},$$scope:{ctx:t}}}}return i&&(e=Y(i,h(r))),{c(){e&&Q(e.$$.fragment),n=B()},l(t){e&&Ie(e.$$.fragment,t),n=B()},m(t,p){e&&Z(e,t,p),G(t,n,p),o=!0},p(t,p){const y={};if(p&4&&(y.data=t[2]),p&523&&(y.$$scope={dirty:p,ctx:t}),i!==(i=t[0][0])){if(e){me();const m=e;J(m.$$.fragment,1,0,()=>{ee(m,1)}),_e()}i?(e=Y(i,h(t)),Q(e.$$.fragment),z(e.$$.fragment,1),Z(e,n.parentNode,n)):e=null}else i&&e.$set(y)},i(t){o||(e&&z(e.$$.fragment,t),o=!0)},o(t){e&&J(e.$$.fragment,t),o=!1},d(t){t&&F(n),e&&ee(e,t)}}}function Nt(r){let e,n,o;var i=r[0][1];function h(t){return{props:{data:t[3],form:t[1]}}}return i&&(e=Y(i,h(r))),{c(){e&&Q(e.$$.fragment),n=B()},l(t){e&&Ie(e.$$.fragment,t),n=B()},m(t,p){e&&Z(e,t,p),G(t,n,p),o=!0},p(t,p){const y={};if(p&8&&(y.data=t[3]),p&2&&(y.form=t[1]),i!==(i=t[0][1])){if(e){me();const m=e;J(m.$$.fragment,1,0,()=>{ee(m,1)}),_e()}i?(e=Y(i,h(t)),Q(e.$$.fragment),z(e.$$.fragment,1),Z(e,n.parentNode,n)):e=null}else i&&e.$set(y)},i(t){o||(e&&z(e.$$.fragment,t),o=!0)},o(t){e&&J(e.$$.fragment,t),o=!1},d(t){t&&F(n),e&&ee(e,t)}}}function He(r){let e,n=r[5]&&Me(r);return{c(){e=it("div"),n&&n.c(),this.h()},l(o){e=lt(o,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=ct(e);n&&n.l(i),i.forEach(F),this.h()},h(){Re(e,"id","svelte-announcer"),Re(e,"aria-live","assertive"),Re(e,"aria-atomic","true"),x(e,"position","absolute"),x(e,"left","0"),x(e,"top","0"),x(e,"clip","rect(0 0 0 0)"),x(e,"clip-path","inset(50%)"),x(e,"overflow","hidden"),x(e,"white-space","nowrap"),x(e,"width","1px"),x(e,"height","1px")},m(o,i){G(o,e,i),n&&n.m(e,null)},p(o,i){o[5]?n?n.p(o,i):(n=Me(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(o){o&&F(e),n&&n.d()}}}function Me(r){let e;return{c(){e=ft(r[6])},l(n){e=ut(n,r[6])},m(n,o){G(n,e,o)},p(n,o){o&64&&dt(e,n[6])},d(n){n&&F(e)}}}function Ct(r){let e,n,o,i,h;const t=[Tt,It],p=[];function y(_,k){return _[0][1]?0:1}e=y(r),n=p[e]=t[e](r);let m=r[4]&&He(r);return{c(){n.c(),o=at(),m&&m.c(),i=B()},l(_){n.l(_),o=st(_),m&&m.l(_),i=B()},m(_,k){p[e].m(_,k),G(_,o,k),m&&m.m(_,k),G(_,i,k),h=!0},p(_,[k]){let S=e;e=y(_),e===S?p[e].p(_,k):(me(),J(p[S],1,1,()=>{p[S]=null}),_e(),n=p[e],n?n.p(_,k):(n=p[e]=t[e](_),n.c()),z(n,1),n.m(o.parentNode,o)),_[4]?m?m.p(_,k):(m=He(_),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null)},i(_){h||(z(n),h=!0)},o(_){J(n),h=!1},d(_){p[e].d(_),_&&F(o),m&&m.d(_),_&&F(i)}}}function Dt(r,e,n){let{stores:o}=e,{page:i}=e,{components:h}=e,{form:t}=e,{data_0:p=null}=e,{data_1:y=null}=e;ot(o.page.notify);let m=!1,_=!1,k=null;return Oe(()=>{const S=o.page.subscribe(()=>{m&&(n(5,_=!0),n(6,k=document.title||"untitled page"))});return n(4,m=!0),S}),r.$$set=S=>{"stores"in S&&n(7,o=S.stores),"page"in S&&n(8,i=S.page),"components"in S&&n(0,h=S.components),"form"in S&&n(1,t=S.form),"data_0"in S&&n(2,p=S.data_0),"data_1"in S&&n(3,y=S.data_1)},r.$$.update=()=>{r.$$.dirty&384&&o.page.set(i)},[h,t,p,y,m,_,k,o,i]}class qt extends tt{constructor(e){super(),nt(this,e,Dt,Ct,rt,{stores:7,page:8,components:0,form:1,data_0:2,data_1:3})}}const xt=function(){const e=document.createElement("link").relList;return e&&e.supports&&e.supports("modulepreload")?"modulepreload":"preload"}(),Vt=function(r,e){return new URL(r,e).href},Xe={},X=function(e,n,o){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(h=>{if(h=Vt(h,o),h in Xe)return;Xe[h]=!0;const t=h.endsWith(".css"),p=t?'[rel="stylesheet"]':"";if(!!o)for(let _=i.length-1;_>=0;_--){const k=i[_];if(k.href===h&&(!t||k.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${p}`))return;const m=document.createElement("link");if(m.rel=t?"stylesheet":xt,t||(m.as="script",m.crossOrigin=""),m.href=h,document.head.appendChild(m),t)return new Promise((_,k)=>{m.addEventListener("load",_),m.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})})).then(()=>e())},Bt={},we=[()=>X(()=>import("./chunks/0-7ff3b15f.js"),["./chunks/0-7ff3b15f.js","./components/pages/_layout.svelte-12d4d1b6.js","./chunks/index-e5b56f0c.js","./chunks/stores-cc5d8b95.js","./chunks/singletons-0085d760.js","./chunks/index-a01ebb22.js","./assets/_layout-c5c520a0.css"],import.meta.url),()=>X(()=>import("./chunks/1-7b0b2e9e.js"),["./chunks/1-7b0b2e9e.js","./components/error.svelte-902e228b.js","./chunks/index-e5b56f0c.js","./chunks/stores-cc5d8b95.js","./chunks/singletons-0085d760.js","./chunks/index-a01ebb22.js"],import.meta.url),()=>X(()=>import("./chunks/2-2db0290c.js"),["./chunks/2-2db0290c.js","./chunks/_page-802cc2a3.js","./components/pages/_page.svelte-f814f306.js","./chunks/index-e5b56f0c.js","./chunks/index-a01ebb22.js","./assets/_page-265a38f0.css"],import.meta.url),()=>X(()=>import("./chunks/3-59b9a6a6.js"),["./chunks/3-59b9a6a6.js","./chunks/_page-9b9f8e4e.js","./chunks/environment-820b6ea4.js","./components/pages/about/_page.svelte-db515161.js","./chunks/index-e5b56f0c.js"],import.meta.url),()=>X(()=>import("./chunks/4-9c3276f5.js"),["./chunks/4-9c3276f5.js","./components/pages/sverdle/_page.svelte-39bd6f09.js","./chunks/index-e5b56f0c.js","./chunks/parse-75f4e1ae.js","./chunks/singletons-0085d760.js","./chunks/index-a01ebb22.js","./assets/_page-2c27b08c.css"],import.meta.url),()=>X(()=>import("./chunks/5-07c9b990.js"),["./chunks/5-07c9b990.js","./chunks/_page-30d445e4.js","./chunks/environment-820b6ea4.js","./components/pages/sverdle/how-to-play/_page.svelte-0d97f364.js","./chunks/index-e5b56f0c.js","./assets/_page-89a9e780.css"],import.meta.url)],Jt=[],zt={"/":[2],"/about":[3],"/sverdle":[-5],"/sverdle/how-to-play":[5]},Ft={handleError:({error:r})=>{console.error(r)}};class Ue{constructor(e,n){this.status=e,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}}class Ye{constructor(e,n){this.status=e,this.location=n}}async function Kt(r){var e;for(const n in r)if(typeof((e=r[n])==null?void 0:e.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(r).map(async([o,i])=>[o,await i])));return r}const et="sveltekit:scroll",V="sveltekit:index",de=jt(we,Jt,zt,Bt),Ae=we[0],je=we[1];Ae();je();let oe={};try{oe=JSON.parse(sessionStorage[et])}catch{}function $e(r){oe[r]=Pe()}function Wt({target:r,base:e,trailing_slash:n}){var ze;const o=[];let i=null;const h={before_navigate:[],after_navigate:[]};let t={branch:[],error:null,url:null},p=!1,y=!1,m=!0,_=!1,k=!1,S=!1,K=!1,j,U=(ze=history.state)==null?void 0:ze[V];U||(U=Date.now(),history.replaceState({...history.state,[V]:U},"",location.href));const q=oe[U];q&&(history.scrollRestoration="manual",scrollTo(q.x,q.y));let C,ie,H;async function le(){H=H||Promise.resolve(),await H,H=null;const a=new URL(location.href),l=ve(a,!0);i=null,await Ne(l,a,[])}async function te(a,{noScroll:l=!1,replaceState:c=!1,keepFocus:s=!1,state:f={},invalidateAll:u=!1},d,b){return typeof a=="string"&&(a=new URL(a,We(document))),Ee({url:a,scroll:l?Pe():null,keepfocus:s,redirect_chain:d,details:{state:f,replaceState:c},nav_token:b,accepted:()=>{u&&(K=!0)},blocked:()=>{},type:"goto"})}async function Te(a){const l=ve(a,!1);if(!l)throw new Error(`Attempted to prefetch a URL that does not belong to this app: ${a}`);return i={id:l.id,promise:qe(l).then(c=>(c.type==="loaded"&&c.state.error&&(i=null),c))},i.promise}async function Ne(a,l,c,s,f={},u){var b,v;ie=f;let d=a&&await qe(a);if(d||(d=await Je(l,{id:null},ae(new Error(`Not found: ${l.pathname}`),{url:l,params:{},route:{id:null}}),404)),l=(a==null?void 0:a.url)||l,ie!==f)return!1;if(d.type==="redirect")if(c.length>10||c.includes(l.pathname))d=await ce({status:500,error:ae(new Error("Redirect loop"),{url:l,params:{},route:{id:null}}),url:l,route:{id:null}});else return te(new URL(d.location,l).href,{},[...c,l.pathname],f),!1;else((v=(b=d.props)==null?void 0:b.page)==null?void 0:v.status)>=400&&await W.updated.check()&&await fe(l);if(o.length=0,K=!1,_=!0,s&&s.details){const{details:g}=s,w=g.replaceState?0:1;g.state[V]=U+=w,history[g.replaceState?"replaceState":"pushState"](g.state,"",l)}if(i=null,y){t=d.state,d.props.page&&(d.props.page.url=l);const g=he();j.$set(d.props),g()}else Ce(d);if(s){const{scroll:g,keepfocus:w}=s;if(w||Le(),await ue(),m){const L=l.hash&&document.getElementById(l.hash.slice(1));g?scrollTo(g.x,g.y):L?L.scrollIntoView():scrollTo(0,0)}}else await ue();m=!0,d.props.page&&(C=d.props.page),u&&u(),_=!1}function Ce(a){var f,u;t=a.state;const l=document.querySelector("style[data-sveltekit]");l&&l.remove(),C=a.props.page;const c=he();j=new qt({target:r,props:{...a.props,stores:W},hydrate:!0}),c();const s={from:null,to:pe("to",{params:t.params,route:{id:(u=(f=t.route)==null?void 0:f.id)!=null?u:null},url:new URL(location.href)}),willUnload:!1,type:"enter"};h.after_navigate.forEach(d=>d(s)),y=!0}async function ne({url:a,params:l,branch:c,status:s,error:f,route:u,form:d}){var I;const b=c.filter(Boolean),v={type:"loaded",state:{url:a,params:l,branch:c,error:f,route:u},props:{components:b.map($=>$.node.component)}};d!==void 0&&(v.props.form=d);let g={},w=!C;for(let $=0;$<b.length;$+=1){const T=b[$];g={...g,...T.data},(w||!t.branch.some(N=>N===T))&&(v.props[`data_${$}`]=g,w=w||Object.keys((I=T.data)!=null?I:{}).length>0)}if(w||(w=Object.keys(C.data).length!==Object.keys(g).length),!t.url||a.href!==t.url.href||t.error!==f||d!==void 0||w){v.props.page={error:f,params:l,route:u,status:s,url:a,form:d,data:w?g:C.data},Object.defineProperty(v.props.page,"routeId",{get(){throw new Error("$page.routeId has been replaced by $page.route.id")},enumerable:!1});const $=(T,N)=>{Object.defineProperty(v.props.page,T,{get:()=>{throw new Error(`$page.${T} has been replaced by $page.url.${N}`)}})};$("origin","origin"),$("path","pathname"),$("query","searchParams")}return v}async function ye({loader:a,parent:l,url:c,params:s,route:f,server_data_node:u}){var g,w,L,I,$;let d=null;const b={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1},v=await a();if((g=v.shared)!=null&&g.load){let T=function(...R){for(const D of R){const{href:E}=new URL(D,c);b.dependencies.add(E)}};const N={route:{get id(){return b.route=!0,f.id}},params:new Proxy(s,{get:(R,D)=>(b.params.add(D),R[D])}),data:(w=u==null?void 0:u.data)!=null?w:null,url:bt(c,()=>{b.url=!0}),async fetch(R,D){let E;R instanceof Request?(E=R.url,D={body:R.method==="GET"||R.method==="HEAD"?void 0:await R.blob(),cache:R.cache,credentials:R.credentials,headers:R.headers,integrity:R.integrity,keepalive:R.keepalive,method:R.method,mode:R.mode,redirect:R.redirect,referrer:R.referrer,referrerPolicy:R.referrerPolicy,signal:R.signal,...D}):E=R;const O=new URL(E,c).href;return T(O),y?$t(E,O,D):St(E,D)},setHeaders:()=>{},depends:T,parent(){return b.parent=!0,l()}};Object.defineProperties(N,{props:{get(){throw new Error("@migration task: Replace `props` with `data` stuff https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292693")},enumerable:!1},session:{get(){throw new Error("session is no longer available. See https://github.com/sveltejs/kit/discussions/5883")},enumerable:!1},stuff:{get(){throw new Error("@migration task: Remove stuff https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292693")},enumerable:!1},routeId:{get(){throw new Error("routeId has been replaced by route.id")},enumerable:!1}}),d=(L=await v.shared.load.call(null,N))!=null?L:null,d=d?await Kt(d):null}return{node:v,loader:a,server:u,shared:(I=v.shared)!=null&&I.load?{type:"data",data:d,uses:b}:null,data:($=d!=null?d:u==null?void 0:u.data)!=null?$:null}}function De(a,l,c,s,f){if(K)return!0;if(!s)return!1;if(s.parent&&a||s.route&&l||s.url&&c)return!0;for(const u of s.params)if(f[u]!==t.params[u])return!0;for(const u of s.dependencies)if(o.some(d=>d(new URL(u))))return!0;return!1}function be(a,l){var c,s;return(a==null?void 0:a.type)==="data"?{type:"data",data:a.data,uses:{dependencies:new Set((c=a.uses.dependencies)!=null?c:[]),params:new Set((s=a.uses.params)!=null?s:[]),parent:!!a.uses.parent,route:!!a.uses.route,url:!!a.uses.url}}:(a==null?void 0:a.type)==="skip"&&l!=null?l:null}async function qe({id:a,invalidating:l,url:c,params:s,route:f}){var D;if((i==null?void 0:i.id)===a)return i.promise;const{errors:u,layouts:d,leaf:b}=f,v=[...d,b];u.forEach(E=>E==null?void 0:E().catch(()=>{})),v.forEach(E=>E==null?void 0:E[1]().catch(()=>{}));let g=null;const w=t.url?a!==t.url.pathname+t.url.search:!1,L=t.route?a!==t.route.id:!1,I=v.reduce((E,O,A)=>{var re;const P=t.branch[A],M=!!(O!=null&&O[0])&&((P==null?void 0:P.loader)!==O[1]||De(E.some(Boolean),L,w,(re=P.server)==null?void 0:re.uses,s));return E.push(M),E},[]);if(I.some(Boolean)){try{g=await Qe(c,I)}catch(E){return ce({status:500,error:ae(E,{url:c,params:s,route:{id:f.id}}),url:c,route:f})}if(g.type==="redirect")return g}const $=g==null?void 0:g.nodes;let T=!1;const N=v.map(async(E,O)=>{var re;if(!E)return;const A=t.branch[O],P=$==null?void 0:$[O];if((!P||P.type==="skip")&&E[1]===(A==null?void 0:A.loader)&&!De(T,L,w,(re=A.shared)==null?void 0:re.uses,s))return A;if(T=!0,(P==null?void 0:P.type)==="error")throw P;return ye({loader:E[1],url:c,params:s,route:f,parent:async()=>{var Ke;const Fe={};for(let ke=0;ke<O;ke+=1)Object.assign(Fe,(Ke=await N[ke])==null?void 0:Ke.data);return Fe},server_data_node:be(P===void 0&&E[0]?{type:"skip"}:P!=null?P:null,A==null?void 0:A.server)})});for(const E of N)E.catch(()=>{});const R=[];for(let E=0;E<v.length;E+=1)if(v[E])try{R.push(await N[E])}catch(O){if(O instanceof Ye)return{type:"redirect",location:O.location};let A=500,P;$!=null&&$.includes(O)?(A=(D=O.status)!=null?D:A,P=O.error):O instanceof Ue?(A=O.status,P=O.body):P=ae(O,{params:s,url:c,route:{id:f.id}});const M=await xe(E,R,u);return M?await ne({url:c,params:s,branch:R.slice(0,M.idx).concat(M.node),status:A,error:P,route:f}):await Je(c,{id:f.id},P,A)}else R.push(void 0);return await ne({url:c,params:s,branch:R,status:200,error:null,route:f,form:l?void 0:null})}async function xe(a,l,c){for(;a--;)if(c[a]){let s=a;for(;!l[s];)s-=1;try{return{idx:s+1,node:{node:await c[a](),loader:c[a],data:{},server:null,shared:null}}}catch{continue}}}async function ce({status:a,error:l,url:c,route:s}){var g;const f={},u=await Ae();let d=null;if(u.server)try{const w=await Qe(c,[!0]);if(w.type!=="data"||w.nodes[0]&&w.nodes[0].type!=="data")throw 0;d=(g=w.nodes[0])!=null?g:null}catch{(c.origin!==location.origin||c.pathname!==location.pathname||p)&&await fe(c)}const b=await ye({loader:Ae,url:c,params:f,route:s,parent:()=>Promise.resolve({}),server_data_node:be(d)}),v={node:await je(),loader:je,shared:null,server:null,data:null};return await ne({url:c,params:f,branch:[b,v],status:a,error:l,route:null})}function ve(a,l){if(Ve(a))return;const c=gt(a.pathname.slice(e.length)||"/");for(const s of de){const f=s.exec(c);if(f){const u=new URL(a.origin+_t(a.pathname,n)+a.search+a.hash);return{id:u.pathname+u.search,invalidating:l,route:s,params:wt(f),url:u}}}}function Ve(a){return a.origin!==location.origin||!a.pathname.startsWith(e)}function Be({url:a,type:l,intent:c,delta:s}){var b,v,g,w,L;let f=!1;const u={from:pe("from",{params:t.params,route:{id:(v=(b=t.route)==null?void 0:b.id)!=null?v:null},url:t.url}),to:pe("to",{params:(g=c==null?void 0:c.params)!=null?g:null,route:{id:(L=(w=c==null?void 0:c.route)==null?void 0:w.id)!=null?L:null},url:a}),willUnload:!c,type:l};s!==void 0&&(u.delta=s);const d={...u,cancel:()=>{f=!0}};return k||h.before_navigate.forEach(I=>I(d)),f?null:u}async function Ee({url:a,scroll:l,keepfocus:c,redirect_chain:s,details:f,type:u,delta:d,nav_token:b,accepted:v,blocked:g}){const w=ve(a,!1),L=Be({url:a,type:u,delta:d,intent:w});if(!L){g();return}$e(U),v(),k=!0,y&&W.navigating.set(L),await Ne(w,a,s,{scroll:l,keepfocus:c,details:f},b,()=>{k=!1,h.after_navigate.forEach(I=>I(L)),W.navigating.set(null)})}async function Je(a,l,c,s){return a.origin===location.origin&&a.pathname===location.pathname&&!p?await ce({status:s,error:c,url:a,route:l}):await fe(a)}function fe(a){return location.href=a.href,new Promise(()=>{})}return{after_navigate:a=>{Oe(()=>(h.after_navigate.push(a),()=>{const l=h.after_navigate.indexOf(a);h.after_navigate.splice(l,1)}))},before_navigate:a=>{Oe(()=>(h.before_navigate.push(a),()=>{const l=h.before_navigate.indexOf(a);h.before_navigate.splice(l,1)}))},disable_scroll_handling:()=>{(_||!y)&&(m=!1)},goto:(a,l={})=>{if("keepfocus"in l)throw new Error("`keepfocus` has been renamed to `keepFocus` (note the difference in casing)");if("noscroll"in l)throw new Error("`noscroll` has been renamed to `noScroll` (note the difference in casing)");return te(a,l,[])},invalidate:a=>{if(a===void 0)throw new Error("`invalidate()` (with no arguments) has been replaced by `invalidateAll()`");if(typeof a=="function")o.push(a);else{const{href:l}=new URL(a,location.href);o.push(c=>c.href===l)}return le()},invalidateAll:()=>(K=!0,le()),prefetch:async a=>{const l=new URL(a,We(document));await Te(l)},prefetch_routes:async a=>{const c=(a?de.filter(s=>a.some(f=>s.exec(f))):de).map(s=>Promise.all([...s.layouts,s.leaf].map(f=>f==null?void 0:f[1]())));await Promise.all(c)},apply_action:async a=>{if(a.type==="error"){const l=new URL(location.href),{branch:c,route:s}=t;if(!s)return;const f=await xe(t.branch.length,c,s.errors);if(f){const u=await ne({url:l,params:t.params,branch:c.slice(0,f.idx).concat(f.node),status:500,error:a.error,route:s});t=u.state;const d=he();j.$set(u.props),d(),ue().then(Le)}}else if(a.type==="redirect")te(a.location,{invalidateAll:!0},[]);else{const l={form:a.data,page:{...C,form:a.data,status:a.status}},c=he();j.$set(l),c(),a.type==="success"&&ue().then(Le)}},_start_router:()=>{history.scrollRestoration="manual",addEventListener("beforeunload",s=>{var u,d;let f=!1;if(!k){const b={from:pe("from",{params:t.params,route:{id:(d=(u=t.route)==null?void 0:u.id)!=null?d:null},url:t.url}),to:null,willUnload:!0,type:"leave",cancel:()=>f=!0};h.before_navigate.forEach(v=>v(b))}f?(s.preventDefault(),s.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){$e(U);try{sessionStorage[et]=JSON.stringify(oe)}catch{}}});const a=s=>{const{url:f,options:u,has:d}=Ge(s);if(f&&u.prefetch&&!Ve(f)){if(u.reload||d.rel_external||d.target||d.download)return;Te(f)}};let l;const c=s=>{clearTimeout(l),l=setTimeout(()=>{var f;(f=s.target)==null||f.dispatchEvent(new CustomEvent("sveltekit:trigger_prefetch",{bubbles:!0}))},20)};addEventListener("touchstart",a),addEventListener("mousemove",c),addEventListener("sveltekit:trigger_prefetch",a),addEventListener("click",s=>{if(s.button||s.which!==1||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.defaultPrevented)return;const{a:f,url:u,options:d,has:b}=Ge(s);if(!f||!u||!(f instanceof SVGAElement)&&u.protocol!==location.protocol&&!(u.protocol==="https:"||u.protocol==="http:")||b.download)return;if(d.reload||b.rel_external||b.target){Be({url:u,type:"link"})||s.preventDefault(),k=!0;return}const[g,w]=u.href.split("#");if(w!==void 0&&g===location.href.split("#")[0]){S=!0,$e(U),t.url=u,W.page.set({...C,url:u}),W.page.notify();return}Ee({url:u,scroll:d.noscroll?Pe():null,keepfocus:!1,redirect_chain:[],details:{state:{},replaceState:u.href===location.href},accepted:()=>s.preventDefault(),blocked:()=>s.preventDefault(),type:"link"})}),addEventListener("popstate",s=>{if(s.state){if(s.state[V]===U)return;const f=s.state[V]-U;Ee({url:new URL(location.href),scroll:oe[s.state[V]],keepfocus:!1,redirect_chain:[],details:null,accepted:()=>{U=s.state[V]},blocked:()=>{history.go(-f)},type:"popstate",delta:f})}}),addEventListener("hashchange",()=>{S&&(S=!1,history.replaceState({...history.state,[V]:++U},"",location.href))});for(const s of document.querySelectorAll("link"))s.rel==="icon"&&(s.href=s.href);addEventListener("pageshow",s=>{s.persisted&&W.navigating.set(null)})},_hydrate:async({status:a,error:l,node_ids:c,params:s,route:f,data:u,form:d})=>{var g;p=!0;const b=new URL(location.href);let v;try{const w=c.map(async(L,I)=>{const $=u[I];return ye({loader:we[L],url:b,params:s,route:f,parent:async()=>{const T={};for(let N=0;N<I;N+=1)Object.assign(T,(await w[N]).data);return T},server_data_node:be($)})});v=await ne({url:b,params:s,branch:await Promise.all(w),status:a,error:l,form:d,route:(g=de.find(({id:L})=>L===f.id))!=null?g:null})}catch(w){if(w instanceof Ye){await fe(new URL(w.location,location.href));return}v=await ce({status:w instanceof Ue?w.status:500,error:ae(w,{url:b,params:s,route:f}),url:b,route:f})}Ce(v)}}}async function Qe(r,e){var h;const n=new URL(r);n.pathname=kt(r.pathname);const o=await ge(n.href,{headers:{"x-sveltekit-invalidated":e.map(t=>t?"1":"").join(",")}}),i=await o.json();if(!o.ok)throw new Error(i);return(h=i.nodes)==null||h.forEach(t=>{var p,y;(t==null?void 0:t.type)==="data"&&(t.data=mt(t.data),t.uses={dependencies:new Set((p=t.uses.dependencies)!=null?p:[]),params:new Set((y=t.uses.params)!=null?y:[]),parent:!!t.uses.parent,route:!!t.uses.route,url:!!t.uses.url})}),i}function ae(r,e){var n;return r instanceof Ue?r.body:(n=Ft.handleError({error:r,event:e}))!=null?n:{message:e.route.id!=null?"Internal Error":"Not Found"}}const Gt=["hash","href","host","hostname","origin","pathname","port","protocol","search","searchParams","toString","toJSON"];function pe(r,e){for(const n of Gt)Object.defineProperty(e,n,{get(){throw new Error(`The navigation shape changed - ${r}.${n} should now be ${r}.url.${n}`)},enumerable:!1});return Object.defineProperty(e,"routeId",{get(){throw new Error(`The navigation shape changed - ${r}.routeId should now be ${r}.route.id`)},enumerable:!1}),e}function he(){return()=>{}}function Le(){const r=document.querySelector("[autofocus]");if(r)r.focus();else{const e=document.body,n=e.getAttribute("tabindex");e.tabIndex=-1,e.focus({preventScroll:!0}),setTimeout(()=>{var o;(o=getSelection())==null||o.removeAllRanges()}),n!==null?e.setAttribute("tabindex",n):e.removeAttribute("tabindex")}}async function Yt({env:r,hydrate:e,paths:n,target:o,trailing_slash:i}){pt(n);const h=Wt({target:o,base:n.base,trailing_slash:i});ht({client:h}),e?await h._hydrate(e):h.goto(location.href,{replaceState:!0}),h._start_router()}export{Yt as start};
