2 lines
27 KiB
JavaScript
2 lines
27 KiB
JavaScript
import{$ as be,aA as U,j as T,o as P,ab as Z,b1 as Ne,b2 as mt}from"./CQO205-B.js";import{o as qe}from"./CqZim_6h.js";class ke{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Ee{constructor(t,n){this.status=t,this.location=n}}class Se extends Error{constructor(t,n,a){super(a),this.status=t,this.text=n}}new URL("sveltekit-internal://");function _t(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function wt(e){return e.split("%25").map(decodeURI).join("%25")}function vt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function de({href:e}){return e.split("#")[0]}function yt(e,t,n,a=!1){const r=new URL(e);Object.defineProperty(r,"searchParams",{value:new Proxy(r.searchParams,{get(o,s){if(s==="get"||s==="getAll"||s==="has")return l=>(n(l),o[s](l));t();const c=Reflect.get(o,s);return typeof c=="function"?c.bind(o):c}}),enumerable:!0,configurable:!0});const i=["href","pathname","search","toString","toJSON"];a&&i.push("hash");for(const o of i)Object.defineProperty(r,o,{get(){return t(),e[o]},enumerable:!0,configurable:!0});return r}function bt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let a=n.length;for(;a;)t=t*33^n.charCodeAt(--a)}else if(ArrayBuffer.isView(n)){const a=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let r=a.length;for(;r;)t=t*33^a[--r]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;new TextDecoder;function kt(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}const Et=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&G.delete(Re(e)),Et(e,t));const G=new Map;function St(e,t){const n=Re(e,t),a=document.querySelector(n);if(a?.textContent){a.remove();let{body:r,...i}=JSON.parse(a.textContent);const o=a.getAttribute("data-ttl");return o&&G.set(n,{body:r,init:i,ttl:1e3*Number(o)}),a.getAttribute("data-b64")!==null&&(r=kt(r)),Promise.resolve(new Response(r,i))}return window.fetch(e,t)}function Rt(e,t,n){if(G.size>0){const a=Re(e,n),r=G.get(a);if(r){if(performance.now()<r.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(r.body,r.init);G.delete(a)}}return window.fetch(t,n)}function Re(e,t){let a=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const r=[];t.headers&&r.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&r.push(t.body),a+=`[data-hash="${bt(...r)}"]`}return a}const xt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function At(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Ut(e).map(a=>{const r=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(a);if(r)return t.push({name:r[1],matcher:r[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(a);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!a)return;const o=a.split(/\[(.+?)\](?!\])/);return"/"+o.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return he(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return he(String.fromCharCode(...c.slice(2).split("-").map(w=>parseInt(w,16))));const d=xt.exec(c),[,h,f,u,p]=d;return t.push({name:u,matcher:p,optional:!!h,rest:!!f,chained:f?l===1&&o[0]==="":!1}),f?"([^]*?)":h?"([^/]*)?":"([^/]+?)"}return he(c)}).join("")}).join("")}/?$`),params:t}}function Lt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Ut(e){return e.slice(1).split("/").filter(Lt)}function Tt(e,t,n){const a={},r=e.slice(1),i=r.filter(s=>s!==void 0);let o=0;for(let s=0;s<t.length;s+=1){const c=t[s];let l=r[s-o];if(c.chained&&c.rest&&o&&(l=r.slice(s-o,s+1).filter(d=>d).join("/"),o=0),l===void 0){c.rest&&(a[c.name]="");continue}if(!c.matcher||n[c.matcher](l)){a[c.name]=l;const d=t[s+1],h=r[s+1];d&&!d.rest&&d.optional&&h&&c.chained&&(o=0),!d&&!h&&Object.keys(a).length===i.length&&(o=0);continue}if(c.optional&&c.chained){o++;continue}return}if(!o)return a}function he(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Pt({nodes:e,server_loads:t,dictionary:n,matchers:a}){const r=new Set(t);return Object.entries(n).map(([s,[c,l,d]])=>{const{pattern:h,params:f}=At(s),u={id:s,exec:p=>{const w=h.exec(p);if(w)return Tt(w,f,a)},errors:[1,...d||[]].map(p=>e[p]),layouts:[0,...l||[]].map(o),leaf:i(c)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function i(s){const c=s<0;return c&&(s=~s),[c,e[s]]}function o(s){return s===void 0?s:[r.has(s),e[s]]}}function We(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function De(e,t,n=JSON.stringify){const a=n(t);try{sessionStorage[e]=a}catch{}}const A=globalThis.__sveltekit_1uq6ubj?.base??"",It=globalThis.__sveltekit_1uq6ubj?.assets??A??"",Ot="1766259433446",Ye="sveltekit:snapshot",Je="sveltekit:scroll",ze="sveltekit:states",$t="sveltekit:pageurl",B="sveltekit:history",H="sveltekit:navigation",j={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},xe=location.origin;function Xe(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function ce(){return{x:pageXOffset,y:pageYOffset}}function V(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Ve={...j,"":j.hover};function Qe(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Ze(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=Qe(e)}}function me(e,t,n){let a;try{if(a=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&a.hash.match(/^#[^/]/)){const s=location.hash.split("#")[1]||"/";a.hash=`#${s}${a.hash}`}}catch{}const r=e instanceof SVGAElement?e.target.baseVal:e.target,i=!a||!!r||le(a,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),o=a?.origin===xe&&e.hasAttribute("download");return{url:a,external:i,target:r,download:o}}function ee(e){let t=null,n=null,a=null,r=null,i=null,o=null,s=e;for(;s&&s!==document.documentElement;)a===null&&(a=V(s,"preload-code")),r===null&&(r=V(s,"preload-data")),t===null&&(t=V(s,"keepfocus")),n===null&&(n=V(s,"noscroll")),i===null&&(i=V(s,"reload")),o===null&&(o=V(s,"replacestate")),s=Qe(s);function c(l){switch(l){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Ve[a??"off"],preload_data:Ve[r??"off"],keepfocus:c(t),noscroll:c(n),reload:c(i),replace_state:c(o)}}function Be(e){const t=be(e);let n=!0;function a(){n=!0,t.update(o=>o)}function r(o){n=!1,t.set(o)}function i(o){let s;return t.subscribe(c=>{(s===void 0||n&&c!==s)&&o(s=c)})}return{notify:a,set:r,subscribe:i}}const et={v:()=>{}};function Ct(){const{set:e,subscribe:t}=be(!1);let n;async function a(){clearTimeout(n);try{const r=await fetch(`${It}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const o=(await r.json()).version!==Ot;return o&&(e(!0),et.v(),clearTimeout(n)),o}catch{return!1}}return{subscribe:t,check:a}}function le(e,t,n){return e.origin!==xe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function ln(e){}const tt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...tt];const jt=new Set([...tt]);[...jt];function Nt(e){return e.filter(t=>t!=null)}function Ae(e){return e instanceof ke||e instanceof Se?e.status:500}function qt(e){return e instanceof Se?e.text:"Internal Error"}let k,W,pe;const Dt=qe.toString().includes("$$")||/function \w+\(\) \{\}/.test(qe.toString());Dt?(k={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},W={current:null},pe={current:!1}):(k=new class{#e=U({});get data(){return T(this.#e)}set data(t){P(this.#e,t)}#t=U(null);get form(){return T(this.#t)}set form(t){P(this.#t,t)}#n=U(null);get error(){return T(this.#n)}set error(t){P(this.#n,t)}#a=U({});get params(){return T(this.#a)}set params(t){P(this.#a,t)}#r=U({id:null});get route(){return T(this.#r)}set route(t){P(this.#r,t)}#o=U({});get state(){return T(this.#o)}set state(t){P(this.#o,t)}#s=U(-1);get status(){return T(this.#s)}set status(t){P(this.#s,t)}#i=U(new URL("https://example.com"));get url(){return T(this.#i)}set url(t){P(this.#i,t)}},W=new class{#e=U(null);get current(){return T(this.#e)}set current(t){P(this.#e,t)}},pe=new class{#e=U(!1);get current(){return T(this.#e)}set current(t){P(this.#e,t)}},et.v=()=>pe.current=!0);function nt(e){Object.assign(k,e)}const Ke={spanContext(){return Vt},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},Vt={traceId:"",spanId:"",traceFlags:0},Bt=new Set(["icon","shortcut icon","apple-touch-icon"]),q=We(Je)??{},Y=We(Ye)??{},C={url:Be({}),page:Be({}),navigating:be(null),updated:Ct()};function Le(e){q[e]=ce()}function Kt(e,t){let n=e+1;for(;q[n];)delete q[n],n+=1;for(n=t+1;Y[n];)delete Y[n],n+=1}function J(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function at(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(A||"/");e&&await e.update()}}function Fe(){}let Ue,_e,te,I,we,v;const ne=[],ae=[];let R=null;function ve(){R?.fork?.then(e=>e?.discard()),R=null}const Q=new Map,rt=new Set,Ft=new Set,M=new Set;let _={branch:[],error:null,url:null},ot=!1,re=!1,Ge=!0,z=!1,F=!1,st=!1,Te=!1,Pe,y,x,N;const oe=new Set,Me=new Map;async function hn(e,t,n){globalThis.__sveltekit_1uq6ubj?.data&&globalThis.__sveltekit_1uq6ubj.data,document.URL!==location.href&&(location.href=location.href),v=e,await e.hooks.init?.(),Ue=Pt(e),I=document.documentElement,we=t,_e=e.nodes[0],te=e.nodes[1],_e(),te(),y=history.state?.[B],x=history.state?.[H],y||(y=x=Date.now(),history.replaceState({...history.state,[B]:y,[H]:x},""));const a=q[y];function r(){a&&(history.scrollRestoration="manual",scrollTo(a.x,a.y))}n?(r(),await nn(we,n)):(await K({type:"enter",url:Xe(v.hash?on(new URL(location.href)):location.href),replace_state:!0}),r()),tn()}function Gt(){ne.length=0,Te=!1}function it(e){ae.some(t=>t?.snapshot)&&(Y[e]=ae.map(t=>t?.snapshot?.capture()))}function ct(e){Y[e]?.forEach((t,n)=>{ae[n]?.snapshot?.restore(t)})}function He(){Le(y),De(Je,q),it(x),De(Ye,Y)}async function Mt(e,t,n,a){let r;t.invalidateAll&&ve(),await K({type:"goto",url:Xe(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:a,accept:()=>{t.invalidateAll&&(Te=!0,r=[...Me.keys()]),t.invalidate&&t.invalidate.forEach(en)}}),t.invalidateAll&&Z().then(Z).then(()=>{Me.forEach(({resource:i},o)=>{r?.includes(o)&&i.refresh?.()})})}async function Ht(e){if(e.id!==R?.id){ve();const t={};if(oe.add(t),R={id:e.id,token:t,promise:ft({...e,preload:t}).then(n=>(oe.delete(t),n.type==="loaded"&&n.state.error&&ve(),n)),fork:null},Ne){const n=R;n.fork=n.promise.then(a=>{if(n===R&&a.type==="loaded")try{return Ne(()=>{Pe.$set(a.props),nt(a.props.page)})}catch{}return null})}}return R.promise}async function ge(e){const t=(await ue(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].map(n=>n?.[1]()))}async function lt(e,t,n){_=e.state;const a=document.querySelector("style[data-sveltekit]");if(a&&a.remove(),Object.assign(k,e.props.page),Pe=new v.root({target:t,props:{...e.props,stores:C,components:ae},hydrate:n,sync:!1}),await Promise.resolve(),ct(x),n){const r={from:null,to:{params:_.params,route:{id:_.route?.id??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};M.forEach(i=>i(r))}re=!0}function se({url:e,params:t,branch:n,status:a,error:r,route:i,form:o}){let s="never";if(A&&(e.pathname===A||e.pathname===A+"/"))s="always";else for(const u of n)u?.slash!==void 0&&(s=u.slash);e.pathname=_t(e.pathname,s),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:r,route:i},props:{constructors:Nt(n).map(u=>u.node.component),page:je(k)}};o!==void 0&&(c.props.form=o);let l={},d=!k,h=0;for(let u=0;u<Math.max(n.length,_.branch.length);u+=1){const p=n[u],w=_.branch[u];p?.data!==w?.data&&(d=!0),p&&(l={...l,...p.data},d&&(c.props[`data_${h}`]=l),h+=1)}return(!_.url||e.href!==_.url.href||_.error!==r||o!==void 0&&o!==k.form||d)&&(c.props.page={error:r,params:t,route:{id:i?.id??null},state:{},status:a,url:new URL(e),form:o??null,data:d?l:k.data}),c}async function Ie({loader:e,parent:t,url:n,params:a,route:r,server_data_node:i}){let o=null,s=!0;const c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();if(l.universal?.load){let d=function(...f){for(const u of f){const{href:p}=new URL(u,n);c.dependencies.add(p)}};const h={tracing:{enabled:!1,root:Ke,current:Ke},route:new Proxy(r,{get:(f,u)=>(s&&(c.route=!0),f[u])}),params:new Proxy(a,{get:(f,u)=>(s&&c.params.add(u),f[u])}),data:i?.data??null,url:yt(n,()=>{s&&(c.url=!0)},f=>{s&&c.search_params.add(f)},v.hash),async fetch(f,u){f instanceof Request&&(u={body:f.method==="GET"||f.method==="HEAD"?void 0:await f.blob(),cache:f.cache,credentials:f.credentials,headers:[...f.headers].length>0?f?.headers:void 0,integrity:f.integrity,keepalive:f.keepalive,method:f.method,mode:f.mode,redirect:f.redirect,referrer:f.referrer,referrerPolicy:f.referrerPolicy,signal:f.signal,...u});const{resolved:p,promise:w}=ut(f,u,n);return s&&d(p.href),w},setHeaders:()=>{},depends:d,parent(){return s&&(c.parent=!0),t()},untrack(f){s=!1;try{return f()}finally{s=!0}}};o=await l.universal.load.call(null,h)??null}return{node:l,loader:e,server:i,universal:l.universal?.load?{type:"data",data:o,uses:c}:null,data:o??i?.data??null,slash:l.universal?.trailingSlash??i?.slash}}function ut(e,t,n){let a=e instanceof Request?e.url:e;const r=new URL(a,n);r.origin===n.origin&&(a=r.href.slice(n.origin.length));const i=re?Rt(a,r.href,t):St(a,t);return{resolved:r,promise:i}}function Wt(e,t,n,a,r,i){if(Te)return!0;if(!r)return!1;if(r.parent&&e||r.route&&t||r.url&&n)return!0;for(const o of r.search_params)if(a.has(o))return!0;for(const o of r.params)if(i[o]!==_.params[o])return!0;for(const o of r.dependencies)if(ne.some(s=>s(new URL(o))))return!0;return!1}function Oe(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Yt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const a of n){const r=e.searchParams.getAll(a),i=t.searchParams.getAll(a);r.every(o=>i.includes(o))&&i.every(o=>r.includes(o))&&n.delete(a)}return n}function Jt({error:e,url:t,route:n,params:a}){return{type:"loaded",state:{error:e,url:t,route:n,params:a,branch:[]},props:{page:je(k),constructors:[]}}}async function ft({id:e,invalidating:t,url:n,params:a,route:r,preload:i}){if(R?.id===e)return oe.delete(R.token),R.promise;const{errors:o,layouts:s,leaf:c}=r,l=[...s,c];o.forEach(m=>m?.().catch(()=>{})),l.forEach(m=>m?.[1]().catch(()=>{}));const d=_.url?e!==ie(_.url):!1,h=_.route?r.id!==_.route.id:!1,f=Yt(_.url,n);let u=!1;const p=l.map(async(m,g)=>{if(!m)return;const E=_.branch[g];return m[1]===E?.loader&&!Wt(u,h,d,f,E.universal?.uses,a)?E:(u=!0,Ie({loader:m[1],url:n,params:a,route:r,parent:async()=>{const O={};for(let L=0;L<g;L+=1)Object.assign(O,(await p[L])?.data);return O},server_data_node:Oe(m[0]?{type:"skip"}:null,m[0]?E?.server:void 0)}))});for(const m of p)m.catch(()=>{});const w=[];for(let m=0;m<l.length;m+=1)if(l[m])try{w.push(await p[m])}catch(g){if(g instanceof Ee)return{type:"redirect",location:g.location};if(oe.has(i))return Jt({error:await X(g,{params:a,url:n,route:{id:r.id}}),url:n,params:a,route:r});let E=Ae(g),S;if(g instanceof ke)S=g.body;else{if(await C.updated.check())return await at(),await J(n);S=await X(g,{params:a,url:n,route:{id:r.id}})}const O=await zt(m,w,o);return O?se({url:n,params:a,branch:w.slice(0,O.idx).concat(O.node),status:E,error:S,route:r}):await ht(n,{id:r.id},S,E)}else w.push(void 0);return se({url:n,params:a,branch:w,status:200,error:null,route:r,form:t?void 0:null})}async function zt(e,t,n){for(;e--;)if(n[e]){let a=e;for(;!t[a];)a-=1;try{return{idx:a+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function $e({status:e,error:t,url:n,route:a}){const r={};let i=null;try{const o=await Ie({loader:_e,url:n,params:r,route:a,parent:()=>Promise.resolve({}),server_data_node:Oe(i)}),s={node:await te(),loader:te,universal:null,server:null,data:null};return se({url:n,params:r,branch:[o,s],status:e,error:t,route:null})}catch(o){if(o instanceof Ee)return Mt(new URL(o.location,location.href),{},0);throw o}}async function Xt(e){const t=e.href;if(Q.has(t))return Q.get(t);let n;try{const a=(async()=>{let r=await v.hooks.reroute({url:new URL(e),fetch:async(i,o)=>ut(i,o,e).promise})??e;if(typeof r=="string"){const i=new URL(e);v.hash?i.hash=r:i.pathname=r,r=i}return r})();Q.set(t,a),n=await a}catch{Q.delete(t);return}return n}async function ue(e,t){if(e&&!le(e,A,v.hash)){const n=await Xt(e);if(!n)return;const a=Qt(n);for(const r of Ue){const i=r.exec(a);if(i)return{id:ie(e),invalidating:t,route:r,params:vt(i),url:e}}}}function Qt(e){return wt(v.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(A.length))||"/"}function ie(e){return(v.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function dt({url:e,type:t,intent:n,delta:a,event:r}){let i=!1;const o=Ce(_,n,e,t);a!==void 0&&(o.navigation.delta=a),r!==void 0&&(o.navigation.event=r);const s={...o.navigation,cancel:()=>{i=!0,o.reject(new Error("navigation cancelled"))}};return z||rt.forEach(c=>c(s)),i?null:o}async function K({type:e,url:t,popped:n,keepfocus:a,noscroll:r,replace_state:i,state:o={},redirect_count:s=0,nav_token:c={},accept:l=Fe,block:d=Fe,event:h}){const f=N;N=c;const u=await ue(t,!1),p=e==="enter"?Ce(_,u,t,e):dt({url:t,type:e,delta:n?.delta,intent:u,event:h});if(!p){d(),N===c&&(N=f);return}const w=y,m=x;l(),z=!0,re&&p.navigation.type!=="enter"&&C.navigating.set(W.current=p.navigation);let g=u&&await ft(u);if(!g){if(le(t,A,v.hash))return await J(t,i);g=await ht(t,{id:null},await X(new Se(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=u?.url||t,N!==c)return p.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(s<20){await K({type:e,url:new URL(g.location,t),popped:n,keepfocus:a,noscroll:r,replace_state:i,state:o,redirect_count:s+1,nav_token:c}),p.fulfil(void 0);return}g=await $e({status:500,error:await X(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else g.props.page.status>=400&&await C.updated.check()&&(await at(),await J(t,i));if(Gt(),Le(w),it(m),g.props.page.url.pathname!==t.pathname&&(t.pathname=g.props.page.url.pathname),o=n?n.state:o,!n){const b=i?0:1,D={[B]:y+=b,[H]:x+=b,[ze]:o};(i?history.replaceState:history.pushState).call(history,D,"",t),i||Kt(y,x)}const E=u&&R?.id===u.id?R.fork:null;R=null,g.props.page.state=o;let S;if(re){const b=(await Promise.all(Array.from(Ft,$=>$(p.navigation)))).filter($=>typeof $=="function");if(b.length>0){let $=function(){b.forEach(fe=>{M.delete(fe)})};b.push($),b.forEach(fe=>{M.add(fe)})}_=g.state,g.props.page&&(g.props.page.url=t);const D=E&&await E;D?S=D.commit():(Pe.$set(g.props),nt(g.props.page),S=mt?.()),st=!0}else await lt(g,we,!1);const{activeElement:O}=document;await S,await Z(),await Z();let L=n?n.scroll:r?ce():null;if(Ge){const b=t.hash&&document.getElementById(pt(t));if(L)scrollTo(L.x,L.y);else if(b){b.scrollIntoView();const{top:D,left:$}=b.getBoundingClientRect();L={x:pageXOffset+$,y:pageYOffset+D}}else scrollTo(0,0)}const gt=document.activeElement!==O&&document.activeElement!==document.body;!a&&!gt&&rn(t,L),Ge=!0,g.props.page&&Object.assign(k,g.props.page),z=!1,e==="popstate"&&ct(x),p.fulfil(void 0),M.forEach(b=>b(p.navigation)),C.navigating.set(W.current=null)}async function ht(e,t,n,a,r){return e.origin===xe&&e.pathname===location.pathname&&!ot?await $e({status:a,error:n,url:e,route:t}):await J(e,r)}function Zt(){let e,t,n;I.addEventListener("mousemove",s=>{const c=s.target;clearTimeout(e),e=setTimeout(()=>{i(c,j.hover)},20)});function a(s){s.defaultPrevented||i(s.composedPath()[0],j.tap)}I.addEventListener("mousedown",a),I.addEventListener("touchstart",a,{passive:!0});const r=new IntersectionObserver(s=>{for(const c of s)c.isIntersecting&&(ge(new URL(c.target.href)),r.unobserve(c.target))},{threshold:0});async function i(s,c){const l=Ze(s,I),d=l===t&&c>=n;if(!l||d)return;const{url:h,external:f,download:u}=me(l,A,v.hash);if(f||u)return;const p=ee(l),w=h&&ie(_.url)===ie(h);if(!(p.reload||w))if(c<=p.preload_data){t=l,n=j.tap;const m=await ue(h,!1);if(!m)return;Ht(m)}else c<=p.preload_code&&(t=l,n=c,ge(h))}function o(){r.disconnect();for(const s of I.querySelectorAll("a")){const{url:c,external:l,download:d}=me(s,A,v.hash);if(l||d)continue;const h=ee(s);h.reload||(h.preload_code===j.viewport&&r.observe(s),h.preload_code===j.eager&&ge(c))}}M.add(o),o()}function X(e,t){if(e instanceof ke)return e.body;const n=Ae(e),a=qt(e);return v.hooks.handleError({error:e,event:t,status:n,message:a})??{message:a}}function en(e){if(typeof e=="function")ne.push(e);else{const{href:t}=new URL(e,location.href);ne.push(n=>n.href===t)}}function tn(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(He(),!z){const a=Ce(_,void 0,null,"leave"),r={...a.navigation,cancel:()=>{n=!0,a.reject(new Error("navigation cancelled"))}};rt.forEach(i=>i(r))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&He()}),navigator.connection?.saveData||Zt(),I.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=Ze(t.composedPath()[0],I);if(!n)return;const{url:a,external:r,target:i,download:o}=me(n,A,v.hash);if(!a)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const s=ee(n);if(!(n instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||o)return;const[l,d]=(v.hash?a.hash.replace(/^#/,""):a.href).split("#"),h=l===de(location);if(r||s.reload&&(!h||!d)){dt({url:a,type:"link",event:t})?z=!0:t.preventDefault();return}if(d!==void 0&&h){const[,f]=_.url.href.split("#");if(f===d){if(t.preventDefault(),d===""||d==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const u=n.ownerDocument.getElementById(decodeURIComponent(d));u&&(u.scrollIntoView(),u.focus())}return}if(F=!0,Le(y),e(a),!s.replace_state)return;F=!1}t.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await K({type:"link",url:a,keepfocus:s.keepfocus,noscroll:s.noscroll,replace_state:s.replace_state??a.href===location.href,event:t})}),I.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),a=t.submitter;if((a?.formTarget||n.target)==="_blank"||(a?.formMethod||n.method)!=="get")return;const o=new URL(a?.hasAttribute("formaction")&&a?.formAction||n.action);if(le(o,A,!1))return;const s=t.target,c=ee(s);if(c.reload)return;t.preventDefault(),t.stopPropagation();const l=new FormData(s,a);o.search=new URLSearchParams(l).toString(),K({type:"form",url:o,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??o.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!ye){if(t.state?.[B]){const n=t.state[B];if(N={},n===y)return;const a=q[n],r=t.state[ze]??{},i=new URL(t.state[$t]??location.href),o=t.state[H],s=_.url?de(location)===de(_.url):!1;if(o===x&&(st||s)){r!==k.state&&(k.state=r),e(i),q[y]=ce(),a&&scrollTo(a.x,a.y),y=n;return}const l=n-y;await K({type:"popstate",url:i,popped:{state:r,scroll:a,delta:l},accept:()=>{y=n,x=o},block:()=>{history.go(-l)},nav_token:N,event:t})}else if(!F){const n=new URL(location.href);e(n),v.hash&&location.reload()}}}),addEventListener("hashchange",()=>{F&&(F=!1,history.replaceState({...history.state,[B]:++y,[H]:x},"",location.href))});for(const t of document.querySelectorAll("link"))Bt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&C.navigating.set(W.current=null)});function e(t){_.url=k.url=t,C.page.set(je(k)),C.page.notify()}}async function nn(e,{status:t=200,error:n,node_ids:a,params:r,route:i,server_route:o,data:s,form:c}){ot=!0;const l=new URL(location.href);let d;({params:r={},route:i={id:null}}=await ue(l,!1)||{}),d=Ue.find(({id:u})=>u===i.id);let h,f=!0;try{const u=a.map(async(w,m)=>{const g=s[m];return g?.uses&&(g.uses=an(g.uses)),Ie({loader:v.nodes[w],url:l,params:r,route:i,parent:async()=>{const E={};for(let S=0;S<m;S+=1)Object.assign(E,(await u[S]).data);return E},server_data_node:Oe(g)})}),p=await Promise.all(u);if(d){const w=d.layouts;for(let m=0;m<w.length;m++)w[m]||p.splice(m,0,void 0)}h=se({url:l,params:r,branch:p,status:t,error:n,form:c,route:d??null})}catch(u){if(u instanceof Ee){await J(new URL(u.location,location.href));return}h=await $e({status:Ae(u),error:await X(u,{url:l,params:r,route:i}),url:l,route:i}),e.textContent="",f=!1}h.props.page&&(h.props.page.state={}),await lt(h,e,f)}function an(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let ye=!1;function rn(e,t=null){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const a=pt(e);if(a&&document.getElementById(a)){const{x:i,y:o}=t??ce();setTimeout(()=>{const s=history.state;ye=!0,location.replace(`#${a}`),v.hash&&location.replace(e.hash),history.replaceState(s,"",e.hash),scrollTo(i,o),ye=!1})}else{const i=document.body,o=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),o!==null?i.setAttribute("tabindex",o):i.removeAttribute("tabindex")}const r=getSelection();if(r&&r.type!=="None"){const i=[];for(let o=0;o<r.rangeCount;o+=1)i.push(r.getRangeAt(o));setTimeout(()=>{if(r.rangeCount===i.length){for(let o=0;o<r.rangeCount;o+=1){const s=i[o],c=r.getRangeAt(o);if(s.commonAncestorContainer!==c.commonAncestorContainer||s.startContainer!==c.startContainer||s.endContainer!==c.endContainer||s.startOffset!==c.startOffset||s.endOffset!==c.endOffset)return}r.removeAllRanges()}})}}}function Ce(e,t,n,a){let r,i;const o=new Promise((c,l)=>{r=c,i=l});return o.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n},willUnload:!t,type:a,complete:o},fulfil:r,reject:i}}function je(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 on(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function pt(e){let t;if(v.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{hn as a,ln as l,C as s};
|