import{t as Q,b0 as rt}from"../chunks/QoSX5tB3.js";import{H as $,N as Y,r as De,n as C,i as we,b as R,s as j,a as pe,f as qe,g as me,c as Z,d as ue,S as Ke,P as ot,p as P,e as st,h as it,u as Me,o as ct,j as lt,w as ft,k as Ie,l as F,m as ut,q as Fe,t as dt,v as ht,x as He}from"../chunks/wsMJYR7a.js";import{y as Jt}from"../chunks/wsMJYR7a.js";const pt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/,mt=/^\/\((?:[^)]+)\)$/;function _t(e){const t=[];return{pattern:e==="/"||mt.test(e)?/^\/$/:new RegExp(`^${vt(e).map(n=>{const o=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(n);if(o)return t.push({name:o[1],matcher:o[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(n);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!n)return;const r=n.split(/\[(.+?)\](?!\])/);return"/"+r.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return de(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return de(String.fromCharCode(...c.slice(2).split("-").map(_=>parseInt(_,16))));const f=pt.exec(c),[,p,v,d,u]=f;return t.push({name:d,matcher:u,optional:!!p,rest:!!v,chained:v?l===1&&r[0]==="":!1}),v?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return de(c)}).join("")}).join("")}/?$`),params:t}}function gt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function vt(e){return e.slice(1).split("/").filter(gt)}function wt(e,t,a){const n={},o=e.slice(1),i=o.filter(s=>s!==void 0);let r=0;for(let s=0;sf).join("/"),r=0),l===void 0)if(c.rest)l="";else continue;if(!c.matcher||a[c.matcher](l)){n[c.name]=l;const f=t[s+1],p=o[s+1];f&&!f.rest&&f.optional&&p&&c.chained&&(r=0),!f&&!p&&Object.keys(n).length===i.length&&(r=0);continue}if(c.optional&&c.chained){r++;continue}return}if(!r)return n}function de(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}class ye{constructor(t,a){this.status=t,typeof a=="string"?this.body={message:a}:a?this.body=a:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class be{constructor(t,a){try{new Headers({location:a})}catch{throw new Error(`Invalid redirect location ${JSON.stringify(a)}: this string contains characters that cannot be used in HTTP headers`)}this.status=t,this.location=a}}class Ee extends Error{constructor(t,a,n){super(n),this.status=t,this.text=a}}function yt({nodes:e,server_loads:t,dictionary:a,matchers:n}){const o=new Set(t);return Object.entries(a).map(([s,[c,l,f]])=>{const{pattern:p,params:v}=_t(s),d={id:s,exec:u=>{const _=p.exec(u);if(_)return wt(_,v,n)},errors:[1,...f||[]].map(u=>e[u]),layouts:[0,...l||[]].map(r),leaf:i(c)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function i(s){const c=s<0;return c&&(s=~s),[c,e[s]]}function r(s){return s===void 0?s:[o.has(s),e[s]]}}function Be(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Oe(e,t,a=JSON.stringify){const n=a(t);try{sessionStorage[e]=n}catch{}}function bt(e){return e.filter(t=>t!=null)}function G(e,t){return e+"/"+t}function ke(e){return e instanceof ye||e instanceof Ee?e.status:500}function Et(e){return e instanceof Ee?e.text:"Internal Error"}const kt=new Set(["icon","shortcut icon","apple-touch-icon"]);let H=null;const O=Be(He)??{},z=Be(Fe)??{},I={url:Ie({}),page:Ie({}),navigating:ft(null),updated:lt()};function Se(e){O[e]=j()}function St(e,t){let a=e+1;for(;O[a];)delete O[a],a+=1;for(a=t+1;z[a];)delete z[a],a+=1}function J(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(C)}async function Ve(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(R||"/");e&&await e.update()}}let xe,_e,ee,L,ge,w;const te=[],ae=[];let S=null;function ne(){S?.fork?.then(e=>e?.discard()),S=null,N={element:void 0,href:void 0}}const X=new Map,Ye=new Set,xt=new Set,V=new Set;let g={branch:[],error:null,url:null},ze=!1,re=!1,Ce=!0,W=!1,B=!1,Je=!1,Re=!1,We,y,x,U;const oe=new Set,je=new Map,Ne=new Map;async function Vt(e,t,a){if(globalThis.__sveltekit_1krgchi.data){const{q:i={},p:r={},l:s={},f:c={}}=globalThis.__sveltekit_1krgchi.data;for(const l in i)i[l];for(const l in s)s[l];for(const l in c)c[l];for(const l in r)r[l]}document.URL!==location.href&&(location.href=location.href),w=e,await e.hooks.init?.(),xe=yt(e),L=document.documentElement,ge=t,_e=e.nodes[0],ee=e.nodes[1],_e(),ee(),y=history.state?.[$],x=history.state?.[Y],y||(y=x=Date.now(),history.replaceState({...history.state,[$]:y,[Y]:x},""));const n=O[y];function o(){n&&(history.scrollRestoration="manual",scrollTo(n.x,n.y))}a?(o(),await qt(ge,a)):(await D({type:"enter",url:De(w.hash?Ft(new URL(location.href)):location.href),replace_state:!0}),o()),Dt()}function Rt(){te.length=0,Re=!1}function Ge(e){ae.some(t=>t?.snapshot)&&(z[e]=ae.map(t=>t?.snapshot?.capture()))}function Xe(e){z[e]?.forEach((t,a)=>{ae[a]?.snapshot?.restore(t)})}function $e(){Se(y),Oe(He,O),Ge(x),Oe(Fe,z)}async function Lt(e,t,a,n){let o,i;t.invalidateAll&&ne(),await D({type:"goto",url:De(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:a,nav_token:n,accept:()=>{if(t.invalidateAll){Re=!0,o=new Set;for(const[r,s]of je)for(const[c,l]of s)l.resource?.reset(),o.add(G(r,c));i=new Set;for(const[r,s]of Ne)for(const c of s.keys())i.add(G(r,c))}t.invalidate&&t.invalidate.forEach($t)}}),t.invalidateAll&&Q().then(Q).then(()=>{for(const[r,s]of je)for(const[c,{resource:l}]of s)o?.has(G(r,c))&&l.start();for(const[r,s]of Ne)for(const[c,{resource:l}]of s)i?.has(G(r,c))&&l.reconnect()})}async function Pt(e){if(e.id!==S?.id){ne();const t={};oe.add(t),S={id:e.id,token:t,promise:Ze({...e,preload:t}).then(a=>(oe.delete(t),a.type==="loaded"&&a.state.error&&ne(),a)),fork:null}}return S.promise}async function he(e){const t=(await ce(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(a=>a[1]()))}async function Qe(e,t,a){const n={params:g.params,route:{id:g.route?.id??null},url:new URL(location.href)};if(g={...e.state,nav:n},Me(e.props.page),We=new w.root({target:t,props:{...e.props,stores:I,components:ae},hydrate:a,sync:!1,transformError:void 0}),await Promise.resolve(),a){const o={from:null,to:{...n,scroll:O[y]??j()},willUnload:!1,type:"enter",complete:Promise.resolve()};V.forEach(i=>i(o))}Xe(x),re=!0}async function se({url:e,params:t,branch:a,errors:n,status:o,error:i,route:r,form:s}){let c="never";if(R&&(e.pathname===R||e.pathname===R+"/"))c="always";else for(const u of a)u?.slash!==void 0&&(c=u.slash);e.pathname=it(e.pathname,c),e.search=e.search;const l={type:"loaded",state:{url:e,params:t,branch:a,error:i,route:r},props:{constructors:bt(a).map(u=>u.node.component),page:Ue(P)}};s!==void 0&&(l.props.form=s);let f={},p=!P,v=0;for(let u=0;us(new URL(r))))return!0;return!1}function Pe(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Ut(e,t){if(!e)return new Set(t.searchParams.keys());const a=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const n of a){const o=e.searchParams.getAll(n),i=t.searchParams.getAll(n);o.every(r=>i.includes(r))&&i.every(r=>o.includes(r))&&a.delete(n)}return a}function It({error:e,url:t,route:a,params:n}){return{type:"loaded",state:{error:e,url:t,route:a,params:n,branch:[]},props:{page:Ue(P),constructors:[]}}}async function Ze({id:e,invalidating:t,url:a,params:n,route:o,preload:i}){if(S?.id===e)return oe.delete(S.token),S.promise;const{errors:r,layouts:s,leaf:c}=o,l=[...s,c];r.forEach(m=>m?.().catch(C)),l.forEach(m=>m?.[1]().catch(C));const f=g.url?e!==ie(g.url):!1,p=g.route?o.id!==g.route.id:!1,v=Ut(g.url,a);let d=!1;const u=l.map(async(m,h)=>{if(!m)return;const b=g.branch[h];return m[1]===b?.loader&&!At(d,p,f,v,b.universal?.uses,n)?b:(d=!0,Le({loader:m[1],url:a,params:n,route:o,parent:async()=>{const T={};for(let A=0;APromise.resolve({}),server_data_node:Pe(i)}),s={node:await ee(),loader:ee,universal:null,server:null,data:null};return se({url:a,params:o,branch:[r,s],status:e,error:t,errors:[],route:null})}catch(r){if(r instanceof be){await Lt(new URL(r.location,location.href),{},0);return}const s=await w.get_error_template(),c=await q(r,{url:a,params:o,route:n}),l=String(c?.message??"").replace(/&/g,"&").replace(//g,">"),f=s({status:e,message:l}),p=new DOMParser().parseFromString(f,"text/html");throw document.documentElement.replaceChild(document.adoptNode(p.head),document.head),document.documentElement.replaceChild(document.adoptNode(p.body),document.body),r}}async function Ct(e){const t=e.href;if(X.has(t))return X.get(t);let a;try{const n=(async()=>{let o=await w.hooks.reroute({url:new URL(e),fetch:async(i,r)=>Tt(i,r,e).promise})??e;if(typeof o=="string"){const i=new URL(e);w.hash?i.hash=o:i.pathname=o,o=i}return o})();X.set(t,n),a=await n}catch{X.delete(t);return}return a}async function ce(e,t){if(e&&!we(e,R,w.hash)){const a=await Ct(e);if(!a)return;const n=jt(a);for(const o of xe){const i=o.exec(n);if(i)return{id:ie(e),invalidating:t,route:o,params:st(i),url:e}}}}function jt(e){return ut(w.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(R.length))||"/"}function ie(e){return(w.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function et({url:e,type:t,intent:a,delta:n,event:o,scroll:i}){let r=!1;const s=Ae(g,a,e,t,i??null);n!==void 0&&(s.navigation.delta=n),o!==void 0&&(s.navigation.event=o);const c={...s.navigation,cancel:()=>{r=!0,s.reject(new Error("navigation cancelled"))}};return W||Ye.forEach(l=>l(c)),r?null:s}async function D({type:e,url:t,popped:a,keepfocus:n,noscroll:o,replace_state:i,state:r={},redirect_count:s=0,nav_token:c={},accept:l=C,block:f=C,event:p}){const v=U;U=c;const d=await ce(t,!1),u=e==="enter"?Ae(g,d,t,e):et({url:t,type:e,delta:a?.delta,intent:d,scroll:a?.scroll,event:p});if(!u){f(),U===c&&(U=v);return}const _=y,m=x;l(),W=!0,re&&u.navigation.type!=="enter"&&I.navigating.set(pe.current=u.navigation);let h=d&&await Ze(d);if(!h){if(we(t,R,w.hash))return await J(t,i);h=await tt(t,{id:null},await q(new Ee(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=d?.url||t,U!==c){u.reject(new Error("navigation aborted"));return}if(!h)return;if(h.type==="redirect"){if(s<20){await D({type:e,url:new URL(h.location,t),popped:a,keepfocus:n,noscroll:o,replace_state:i,state:r,redirect_count:s+1,nav_token:c}),u.fulfil(void 0);return}if(h=await Te({status:500,error:await q(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}}),!h)return}else if(h.props.page.status>=400&&await I.updated.check())return await Ve(),await J(t,i);if(Rt(),Se(_),Ge(m),h.props.page.url.pathname!==t.pathname&&(t.pathname=h.props.page.url.pathname),r=a?a.state:r,!a){const E=i?0:1,K={[$]:y+=E,[Y]:x+=E,[Ke]:r};(i?history.replaceState:history.pushState).call(history,K,"",t),i||St(y,x)}const b=d&&S?.id===d.id?S.fork:null;S?.fork&&!b?ne():(S=null,N={element:void 0,href:void 0}),h.props.page.state=r;let k;if(re){const E=(await Promise.all(Array.from(xt,M=>M(u.navigation)))).filter(M=>typeof M=="function");if(E.length>0){let M=function(){E.forEach(fe=>{V.delete(fe)})};E.push(M),E.forEach(fe=>{V.add(fe)})}const K=u.navigation.to;g={...h.state,nav:{params:K.params,route:K.route,url:K.url}},h.props.page&&(h.props.page.url=t),!n&&document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&document.activeElement.blur();const le=b&&await b;le?k=le.commit():(H=null,We.$set(h.props),H&&Object.assign(h.props.page,H),Me(h.props.page),k=rt?.()),Je=!0}else await Qe(h,ge,!1);const{activeElement:T}=document;if(await k,await Q(),await Q(),U!==c){u.reject(new Error("navigation aborted"));return}h.props.page&&H&&Object.assign(h.props.page,H);let A=null;if(Ce){const E=a?a.scroll:o?j():null;E?scrollTo(E.x,E.y):(A=t.hash&&document.getElementById(at(t)))?A.scrollIntoView():scrollTo(0,0)}const nt=document.activeElement!==T&&document.activeElement!==document.body;!n&&!nt&&Mt(t,!A),Ce=!0,W=!1,u.fulfil(void 0),u.navigation.to&&(u.navigation.to.scroll=j()),V.forEach(E=>E(u.navigation)),e==="popstate"&&Xe(x),I.navigating.set(pe.current=null)}async function tt(e,t,a,n,o){return e.origin===ct&&e.pathname===location.pathname&&!ze?await Te({status:n,error:a,url:e,route:t}):await J(e,o)}let N={element:void 0,href:void 0};function Nt(){let e,t;L.addEventListener("mousemove",r=>{const s=r.target;clearTimeout(e),e=setTimeout(()=>{o(s,F.hover)},20)});function a(r){r.defaultPrevented||o(r.composedPath()[0],F.tap)}L.addEventListener("mousedown",a),L.addEventListener("touchstart",a,{passive:!0});const n=new IntersectionObserver(r=>{for(const s of r)s.isIntersecting&&(he(new URL(s.target.href)),n.unobserve(s.target))},{threshold:0});async function o(r,s){const c=qe(r,L),l=c===N.element&&c?.href===N.href&&s>=t;if(!c||l)return;const{url:f,external:p,download:v}=me(c,R,w.hash);if(p||v)return;const d=Z(c),u=f&&ie(g.url)===ie(f);if(!(d.reload||u))if(s<=d.preload_data){N={element:c,href:c.href},t=F.tap;const _=await ce(f,!1);if(!_)return;Pt(_)}else s<=d.preload_code&&(N={element:c,href:c.href},t=s,he(f))}function i(){n.disconnect();for(const r of L.querySelectorAll("a")){const{url:s,external:c,download:l}=me(r,R,w.hash);if(c||l)continue;const f=Z(r);f.reload||(f.preload_code===F.viewport&&n.observe(r),f.preload_code===F.eager&&he(s))}}V.add(i),i()}function q(e,t){if(e instanceof ye)return e.body;const a=ke(e),n=Et(e);return w.hooks.handleError({error:e,event:t,status:a,message:n})??{message:n}}function $t(e){if(typeof e=="function")te.push(e);else{const{href:t}=new URL(e,location.href);te.push(a=>a.href===t)}}function Dt(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let a=!1;if($e(),!W){const n=Ae(g,void 0,null,"leave"),o={...n.navigation,cancel:()=>{a=!0,n.reject(new Error("navigation cancelled"))}};Ye.forEach(i=>i(o))}a?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&$e()}),navigator.connection?.saveData||Nt(),L.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const a=qe(t.composedPath()[0],L);if(!a)return;const{url:n,external:o,target:i,download:r}=me(a,R,w.hash);if(!n)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const s=Z(a);if(!(a instanceof SVGAElement)&&n.protocol!==location.protocol&&!(n.protocol==="https:"||n.protocol==="http:")||r)return;const[l,f]=(w.hash?n.hash.replace(/^#/,""):n.href).split("#"),p=l===ue(location);if(o||s.reload&&(!p||!f)){et({url:n,type:"link",event:t})?W=!0:t.preventDefault();return}if(f!==void 0&&p){const[,v]=g.url.href.split("#");if(v===f){if(t.preventDefault(),f===""||f==="top"&&a.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const d=a.ownerDocument.getElementById(decodeURIComponent(f));d&&(d.scrollIntoView(),d.focus())}return}if(B=!0,Se(y),e(n),!s.replace_state)return;B=!1}t.preventDefault(),await new Promise(v=>{requestAnimationFrame(()=>{setTimeout(v,0)}),setTimeout(v,100)}),await D({type:"link",url:n,keepfocus:s.keepfocus,noscroll:s.noscroll,replace_state:s.replace_state??n.href===location.href,event:t})}),L.addEventListener("submit",t=>{if(t.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(t.target),n=t.submitter;if((n?.formTarget||a.target)==="_blank"||(n?.formMethod||a.method)!=="get")return;const r=new URL(n?.hasAttribute("formaction")&&n?.formAction||a.action);if(we(r,R,!1))return;const s=t.target,c=Z(s);if(c.reload)return;t.preventDefault(),t.stopPropagation();const l=new FormData(s,n);r.search=new URLSearchParams(l).toString(),D({type:"form",url:r,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??r.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!ve){if(t.state?.[$]){const a=t.state[$];if(U={},a===y)return;const n=O[a],o=t.state[Ke]??{},i=new URL(t.state[ot]??location.href),r=t.state[Y],s=g.url?ue(location)===ue(g.url):!1;if(r===x&&(Je||s)){o!==P.state&&(P.state=o),e(i),O[y]=j(),n&&scrollTo(n.x,n.y),y=a;return}const l=a-y;await D({type:"popstate",url:i,popped:{state:o,scroll:n,delta:l},accept:()=>{y=a,x=r},block:()=>{history.go(-l)},nav_token:U,event:t})}else if(!B){const a=new URL(location.href);e(a),w.hash&&location.reload()}}}),addEventListener("hashchange",()=>{B&&(B=!1,history.replaceState({...history.state,[$]:++y,[Y]:x},"",location.href))});for(const t of document.querySelectorAll("link"))kt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&I.navigating.set(pe.current=null)});function e(t){g.url=P.url=t,I.page.set(Ue(P)),I.page.notify()}}async function qt(e,{status:t=200,error:a,node_ids:n,params:o,route:i,server_route:r,data:s,form:c}){ze=!0;const l=new URL(location.href);let f;({params:o={},route:i={id:null}}=await ce(l,!1)||{}),f=xe.find(({id:d})=>d===i.id);let p,v=!0;try{const d=n.map(async(_,m)=>{const h=s[m];return h?.uses&&(h.uses=Kt(h.uses)),Le({loader:w.nodes[_],url:l,params:o,route:i,parent:async()=>{const b={};for(let k=0;k{const s=history.state;ve=!0,location.replace(new URL(`#${n}`,location.href)),history.replaceState(s,"",e),t&&scrollTo(i,r),ve=!1})}else{const i=document.body,r=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),r!==null?i.setAttribute("tabindex",r):i.removeAttribute("tabindex")}const o=getSelection();if(o&&o.type!=="None"){const i=[];for(let r=0;r{if(o.rangeCount===i.length){for(let r=0;r{i=l,r=f});return s.catch(C),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:j()},to:a&&{params:t?.params??null,route:{id:t?.route?.id??null},url:a,scroll:o},willUnload:!t,type:n,complete:s},fulfil:i,reject:r}}function Ue(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function Ft(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function at(e){let t;if(w.hash){const[,,a]=e.hash.split("#",3);t=a??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Jt as load_css,Vt as start};