2 lines
24 KiB
JavaScript
2 lines
24 KiB
JavaScript
import{S as Me,i as We,s as Ye,a as Ge,e as x,c as Xe,b as z,g as W,t as T,d as Y,f as I,h as C,j as He,k as Ze,o as ke,l as Qe,m as et,n as tt,p as ye,q as K,r as nt,u as rt,v as st,w as q,x as se,y as B,z as ae,A as ie,B as J,C as oe,D as Ie}from"./chunks/index-1530a265.js";import{_ as ne,w as ue}from"./chunks/preload-helper-23bf4dac.js";import{s as at,a as it}from"./chunks/paths-b9644fda.js";import{i as ot}from"./chunks/singletons-eca981c1.js";function ct(r){let e,t,o;const f=[r[1]||{}];var c=r[0][0];function d(n){let s={};for(let i=0;i<f.length;i+=1)s=oe(s,f[i]);return{props:s}}return c&&(e=new c(d())),{c(){e&&q(e.$$.fragment),t=x()},l(n){e&&se(e.$$.fragment,n),t=x()},m(n,s){e&&B(e,n,s),z(n,t,s),o=!0},p(n,s){const i=s&2?ae(f,[ie(n[1]||{})]):{};if(c!==(c=n[0][0])){if(e){W();const u=e;T(u.$$.fragment,1,0,()=>{J(u,1)}),Y()}c?(e=new c(d()),q(e.$$.fragment),I(e.$$.fragment,1),B(e,t.parentNode,t)):e=null}else c&&e.$set(i)},i(n){o||(e&&I(e.$$.fragment,n),o=!0)},o(n){e&&T(e.$$.fragment,n),o=!1},d(n){n&&C(t),e&&J(e,n)}}}function lt(r){let e,t,o;const f=[r[1]||{}];var c=r[0][0];function d(n){let s={$$slots:{default:[pt]},$$scope:{ctx:n}};for(let i=0;i<f.length;i+=1)s=oe(s,f[i]);return{props:s}}return c&&(e=new c(d(r))),{c(){e&&q(e.$$.fragment),t=x()},l(n){e&&se(e.$$.fragment,n),t=x()},m(n,s){e&&B(e,n,s),z(n,t,s),o=!0},p(n,s){const i=s&2?ae(f,[ie(n[1]||{})]):{};if(s&525&&(i.$$scope={dirty:s,ctx:n}),c!==(c=n[0][0])){if(e){W();const u=e;T(u.$$.fragment,1,0,()=>{J(u,1)}),Y()}c?(e=new c(d(n)),q(e.$$.fragment),I(e.$$.fragment,1),B(e,t.parentNode,t)):e=null}else c&&e.$set(i)},i(n){o||(e&&I(e.$$.fragment,n),o=!0)},o(n){e&&T(e.$$.fragment,n),o=!1},d(n){n&&C(t),e&&J(e,n)}}}function ft(r){let e,t,o;const f=[r[2]||{}];var c=r[0][1];function d(n){let s={};for(let i=0;i<f.length;i+=1)s=oe(s,f[i]);return{props:s}}return c&&(e=new c(d())),{c(){e&&q(e.$$.fragment),t=x()},l(n){e&&se(e.$$.fragment,n),t=x()},m(n,s){e&&B(e,n,s),z(n,t,s),o=!0},p(n,s){const i=s&4?ae(f,[ie(n[2]||{})]):{};if(c!==(c=n[0][1])){if(e){W();const u=e;T(u.$$.fragment,1,0,()=>{J(u,1)}),Y()}c?(e=new c(d()),q(e.$$.fragment),I(e.$$.fragment,1),B(e,t.parentNode,t)):e=null}else c&&e.$set(i)},i(n){o||(e&&I(e.$$.fragment,n),o=!0)},o(n){e&&T(e.$$.fragment,n),o=!1},d(n){n&&C(t),e&&J(e,n)}}}function ut(r){let e,t,o;const f=[r[2]||{}];var c=r[0][1];function d(n){let s={$$slots:{default:[dt]},$$scope:{ctx:n}};for(let i=0;i<f.length;i+=1)s=oe(s,f[i]);return{props:s}}return c&&(e=new c(d(r))),{c(){e&&q(e.$$.fragment),t=x()},l(n){e&&se(e.$$.fragment,n),t=x()},m(n,s){e&&B(e,n,s),z(n,t,s),o=!0},p(n,s){const i=s&4?ae(f,[ie(n[2]||{})]):{};if(s&521&&(i.$$scope={dirty:s,ctx:n}),c!==(c=n[0][1])){if(e){W();const u=e;T(u.$$.fragment,1,0,()=>{J(u,1)}),Y()}c?(e=new c(d(n)),q(e.$$.fragment),I(e.$$.fragment,1),B(e,t.parentNode,t)):e=null}else c&&e.$set(i)},i(n){o||(e&&I(e.$$.fragment,n),o=!0)},o(n){e&&T(e.$$.fragment,n),o=!1},d(n){n&&C(t),e&&J(e,n)}}}function dt(r){let e,t,o;const f=[r[3]||{}];var c=r[0][2];function d(n){let s={};for(let i=0;i<f.length;i+=1)s=oe(s,f[i]);return{props:s}}return c&&(e=new c(d())),{c(){e&&q(e.$$.fragment),t=x()},l(n){e&&se(e.$$.fragment,n),t=x()},m(n,s){e&&B(e,n,s),z(n,t,s),o=!0},p(n,s){const i=s&8?ae(f,[ie(n[3]||{})]):{};if(c!==(c=n[0][2])){if(e){W();const u=e;T(u.$$.fragment,1,0,()=>{J(u,1)}),Y()}c?(e=new c(d()),q(e.$$.fragment),I(e.$$.fragment,1),B(e,t.parentNode,t)):e=null}else c&&e.$set(i)},i(n){o||(e&&I(e.$$.fragment,n),o=!0)},o(n){e&&T(e.$$.fragment,n),o=!1},d(n){n&&C(t),e&&J(e,n)}}}function pt(r){let e,t,o,f;const c=[ut,ft],d=[];function n(s,i){return s[0][2]?0:1}return e=n(r),t=d[e]=c[e](r),{c(){t.c(),o=x()},l(s){t.l(s),o=x()},m(s,i){d[e].m(s,i),z(s,o,i),f=!0},p(s,i){let u=e;e=n(s),e===u?d[e].p(s,i):(W(),T(d[u],1,1,()=>{d[u]=null}),Y(),t=d[e],t?t.p(s,i):(t=d[e]=c[e](s),t.c()),I(t,1),t.m(o.parentNode,o))},i(s){f||(I(t),f=!0)},o(s){T(t),f=!1},d(s){d[e].d(s),s&&C(o)}}}function je(r){let e,t=r[5]&&De(r);return{c(){e=Qe("div"),t&&t.c(),this.h()},l(o){e=et(o,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var f=tt(e);t&&t.l(f),f.forEach(C),this.h()},h(){ye(e,"id","svelte-announcer"),ye(e,"aria-live","assertive"),ye(e,"aria-atomic","true"),K(e,"position","absolute"),K(e,"left","0"),K(e,"top","0"),K(e,"clip","rect(0 0 0 0)"),K(e,"clip-path","inset(50%)"),K(e,"overflow","hidden"),K(e,"white-space","nowrap"),K(e,"width","1px"),K(e,"height","1px")},m(o,f){z(o,e,f),t&&t.m(e,null)},p(o,f){o[5]?t?t.p(o,f):(t=De(o),t.c(),t.m(e,null)):t&&(t.d(1),t=null)},d(o){o&&C(e),t&&t.d()}}}function De(r){let e;return{c(){e=nt(r[6])},l(t){e=rt(t,r[6])},m(t,o){z(t,e,o)},p(t,o){o&64&&st(e,t[6])},d(t){t&&C(e)}}}function ht(r){let e,t,o,f,c;const d=[lt,ct],n=[];function s(u,L){return u[0][1]?0:1}e=s(r),t=n[e]=d[e](r);let i=r[4]&&je(r);return{c(){t.c(),o=Ge(),i&&i.c(),f=x()},l(u){t.l(u),o=Xe(u),i&&i.l(u),f=x()},m(u,L){n[e].m(u,L),z(u,o,L),i&&i.m(u,L),z(u,f,L),c=!0},p(u,[L]){let k=e;e=s(u),e===k?n[e].p(u,L):(W(),T(n[k],1,1,()=>{n[k]=null}),Y(),t=n[e],t?t.p(u,L):(t=n[e]=d[e](u),t.c()),I(t,1),t.m(o.parentNode,o)),u[4]?i?i.p(u,L):(i=je(u),i.c(),i.m(f.parentNode,f)):i&&(i.d(1),i=null)},i(u){c||(I(t),c=!0)},o(u){T(t),c=!1},d(u){n[e].d(u),u&&C(o),i&&i.d(u),u&&C(f)}}}function _t(r,e,t){let{stores:o}=e,{page:f}=e,{components:c}=e,{props_0:d=null}=e,{props_1:n=null}=e,{props_2:s=null}=e;He("__svelte__",o),Ze(o.page.notify);let i=!1,u=!1,L=null;return ke(()=>{const k=o.page.subscribe(()=>{i&&(t(5,u=!0),t(6,L=document.title||"untitled page"))});return t(4,i=!0),k}),r.$$set=k=>{"stores"in k&&t(7,o=k.stores),"page"in k&&t(8,f=k.page),"components"in k&&t(0,c=k.components),"props_0"in k&&t(1,d=k.props_0),"props_1"in k&&t(2,n=k.props_1),"props_2"in k&&t(3,s=k.props_2)},r.$$.update=()=>{r.$$.dirty&384&&o.page.set(f)},[c,d,n,s,i,u,L,o,f]}class mt extends Me{constructor(e){super(),We(this,e,_t,ht,Ye,{stores:7,page:8,components:0,props_0:1,props_1:2,props_2:3})}}const gt={},de=[()=>ne(()=>import("./pages/__layout.svelte-80cbe5fd.js"),["_app/immutable/pages/__layout.svelte-80cbe5fd.js","_app/immutable/assets/__layout-fad35cb5.css","_app/immutable/chunks/index-1530a265.js","_app/immutable/chunks/paths-b9644fda.js","_app/immutable/chunks/state-ff996242.js","_app/immutable/chunks/preload-helper-23bf4dac.js","_app/immutable/chunks/theme-0a0b64a3.js"]),()=>ne(()=>import("./error.svelte-521a283e.js"),["_app/immutable/error.svelte-521a283e.js","_app/immutable/chunks/index-1530a265.js"]),()=>ne(()=>import("./pages/edit.svelte-55a59e33.js"),["_app/immutable/pages/edit.svelte-55a59e33.js","_app/immutable/assets/edit-826332b8.css","_app/immutable/chunks/index-1530a265.js","_app/immutable/chunks/state-ff996242.js","_app/immutable/chunks/preload-helper-23bf4dac.js","_app/immutable/chunks/theme-0a0b64a3.js","_app/immutable/chunks/util-a6f77fda.js","_app/immutable/assets/util-5eb0c13e.css","_app/immutable/chunks/paths-b9644fda.js"]),()=>ne(()=>import("./pages/index.svelte-94449298.js"),["_app/immutable/pages/index.svelte-94449298.js","_app/immutable/chunks/index-1530a265.js","_app/immutable/chunks/singletons-eca981c1.js","_app/immutable/chunks/paths-b9644fda.js"]),()=>ne(()=>import("./pages/view.svelte-1820080c.js"),["_app/immutable/pages/view.svelte-1820080c.js","_app/immutable/chunks/index-1530a265.js","_app/immutable/chunks/util-a6f77fda.js","_app/immutable/assets/util-5eb0c13e.css","_app/immutable/chunks/state-ff996242.js","_app/immutable/chunks/preload-helper-23bf4dac.js"])],wt={"":[[0,3],[1]],edit:[[0,2],[1]],view:[[0,4],[1]]};function Ce(r){return r instanceof Error||r&&r.name&&r.message?r:new Error(JSON.stringify(r))}function Ve(r){if(!r)return{};if(r.fallthrough)throw new Error("fallthrough is no longer supported. Use matchers instead: https://kit.svelte.dev/docs/routing#advanced-routing-matching");if("maxage"in r)throw new Error("maxage should be replaced with cache: { maxage }");const e=r.status&&r.status>=400&&r.status<=599&&!r.redirect;if(r.error||e){const t=r.status;if(!r.error&&e)return{status:t||500,error:new Error(`${t}`)};const o=typeof r.error=="string"?new Error(r.error):r.error;return o instanceof Error?!t||t<400||t>599?(console.warn('"error" returned from load() without a valid status code \u2014 defaulting to 500'),{status:500,error:o}):{status:t,error:o}:{status:500,error:new Error(`"error" property returned from load() must be a string or instance of Error, received type "${typeof o}"`)}}if(r.redirect){if(!r.status||Math.floor(r.status/100)!==3)throw new Error('"redirect" property returned from load() must be accompanied by a 3xx status code');if(typeof r.redirect!="string")throw new Error('"redirect" property returned from load() must be a string')}if(r.dependencies&&(!Array.isArray(r.dependencies)||r.dependencies.some(t=>typeof t!="string")))throw new Error('"dependencies" property returned from load() must be of type string[]');if(r.context)throw new Error('You are returning "context" from a load function. "context" was renamed to "stuff", please adjust your code accordingly.');return r}function bt(r,e){return r==="/"||e==="ignore"?r:e==="never"?r.endsWith("/")?r.slice(0,-1):r:e==="always"&&!r.endsWith("/")?r+"/":r}function yt(r){for(const e in r)r[e]=r[e].replace(/%23/g,"#").replace(/%3[Bb]/g,";").replace(/%2[Cc]/g,",").replace(/%2[Ff]/g,"/").replace(/%3[Ff]/g,"?").replace(/%3[Aa]/g,":").replace(/%40/g,"@").replace(/%26/g,"&").replace(/%3[Dd]/g,"=").replace(/%2[Bb]/g,"+").replace(/%24/g,"$");return r}class vt extends URL{get hash(){throw new Error("url.hash is inaccessible from load. Consider accessing hash from the page store within the script tag of your component.")}}function ze(r){let e=r.baseURI;if(!e){const t=r.getElementsByTagName("base");e=t.length?t[0].href:r.URL}return e}function Ee(){return{x:pageXOffset,y:pageYOffset}}function qe(r){return r.composedPath().find(t=>t instanceof Node&&t.nodeName.toUpperCase()==="A")}function Be(r){return r instanceof SVGAElement?new URL(r.href.baseVal,document.baseURI):new URL(r.href)}function Je(r){const e=ue(r);let t=!0;function o(){t=!0,e.update(d=>d)}function f(d){t=!1,e.set(d)}function c(d){let n;return e.subscribe(s=>{(n===void 0||t&&s!==n)&&d(n=s)})}return{notify:o,set:f,subscribe:c}}function $t(){const{set:r,subscribe:e}=ue(!1);let t;async function o(){clearTimeout(t);const f=await fetch(`${it}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(f.ok){const{version:c}=await f.json(),d=c!=="1658494160721";return d&&(r(!0),clearTimeout(t)),d}else throw new Error(`Version check failed: ${f.status}`)}return{subscribe:e,check:o}}function kt(r){let e=5381,t=r.length;if(typeof r=="string")for(;t;)e=e*33^r.charCodeAt(--t);else for(;t;)e=e*33^r[--t];return(e>>>0).toString(36)}const Re=window.fetch;function Et(r,e){let o=`script[sveltekit\\:data-type="data"][sveltekit\\:data-url=${JSON.stringify(typeof r=="string"?r:r.url)}]`;e&&typeof e.body=="string"&&(o+=`[sveltekit\\:data-body="${kt(e.body)}"]`);const f=document.querySelector(o);if(f&&f.textContent){const{body:c,...d}=JSON.parse(f.textContent);return Promise.resolve(new Response(c,d))}return Re(r,e)}const Rt=/^(\.\.\.)?(\w+)(?:=(\w+))?$/;function Lt(r){const e=[],t=[];let o=!0;return{pattern:r===""?/^\/$/:new RegExp(`^${decodeURIComponent(r).split(/(?:@[a-zA-Z0-9_-]+)?(?:\/|$)/).map((c,d,n)=>{const s=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(c);if(s)return e.push(s[1]),t.push(s[2]),"(?:/(.*))?";const i=d===n.length-1;return c&&"/"+c.split(/\[(.+?)\]/).map((u,L)=>{if(L%2){const k=Rt.exec(u);if(!k)throw new Error(`Invalid param: ${u}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,Z,G,ce]=k;return e.push(G),t.push(ce),Z?"(.*?)":"([^/]+?)"}return i&&u.includes(".")&&(o=!1),u.normalize().replace(/%5[Bb]/g,"[").replace(/%5[Dd]/g,"]").replace(/#/g,"%23").replace(/\?/g,"%3F").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("")}).join("")}${o?"/?":""}$`),names:e,types:t}}function St(r,e,t,o){const f={};for(let c=0;c<e.length;c+=1){const d=e[c],n=t[c],s=r[c+1]||"";if(n){const i=o[n];if(!i)throw new Error(`Missing "${n}" param matcher`);if(!i(s))return}f[d]=s}return f}function Ut(r,e,t){return Object.entries(e).map(([f,[c,d,n]])=>{const{pattern:s,names:i,types:u}=Lt(f);return{id:f,exec:L=>{const k=s.exec(L);if(k)return St(k,i,u,t)},a:c.map(L=>r[L]),b:d.map(L=>r[L]),has_shadow:!!n}})}const Fe="sveltekit:scroll",F="sveltekit:index",ve=Ut(de,wt,gt),At=de[0](),Ot=de[1](),Ke={};let re={};try{re=JSON.parse(sessionStorage[Fe])}catch{}function $e(r){re[r]=Ee()}function Nt({target:r,session:e,base:t,trailing_slash:o}){var Te;const f=new Map,c=[],d={url:Je({}),page:Je({}),navigating:ue(null),session:ue(e),updated:$t()},n={id:null,promise:null},s={before_navigate:[],after_navigate:[]};let i={branch:[],error:null,session_id:0,stuff:Ke,url:null},u=!1,L=!0,k=!1,Z=1,G=null,ce,Le,Se=!1;d.session.subscribe(async a=>{Le=a,Se&&(Z+=1,me(new URL(location.href),[],!0))}),Se=!0;let X=!0,j=(Te=history.state)==null?void 0:Te[F];j||(j=Date.now(),history.replaceState({...history.state,[F]:j},"",location.href));const pe=re[j];pe&&(history.scrollRestoration="manual",scrollTo(pe.x,pe.y));let he=!1,_e,Ue;async function Ae(a,{noscroll:h=!1,replaceState:b=!1,keepfocus:l=!1,state:p={}},_){if(typeof a=="string"&&(a=new URL(a,ze(document))),X)return we({url:a,scroll:h?Ee():null,keepfocus:l,redirect_chain:_,details:{state:p,replaceState:b},accepted:()=>{},blocked:()=>{}});await te(a)}async function Oe(a){const h=xe(a);if(!h)throw new Error("Attempted to prefetch a URL that does not belong to this app");return n.promise=Pe(h,!1),n.id=h.id,n.promise}async function me(a,h,b,l,p){var R,S;const _=xe(a),v=Ue={};let m=_&&await Pe(_,b);if(!m&&a.origin===location.origin&&a.pathname===location.pathname&&(m=await ee({status:404,error:new Error(`Not found: ${a.pathname}`),url:a,routeId:null})),!m)return await te(a),!1;if(a=(_==null?void 0:_.url)||a,Ue!==v)return!1;if(c.length=0,m.redirect)if(h.length>10||h.includes(a.pathname))m=await ee({status:500,error:new Error("Redirect loop"),url:a,routeId:null});else return X?Ae(new URL(m.redirect,a).href,{},[...h,a.pathname]):await te(new URL(m.redirect,location.href)),!1;else((S=(R=m.props)==null?void 0:R.page)==null?void 0:S.status)>=400&&await d.updated.check()&&await te(a);if(k=!0,l&&l.details){const{details:E}=l,A=E.replaceState?0:1;E.state[F]=j+=A,history[E.replaceState?"replaceState":"pushState"](E.state,"",a)}if(u?(i=m.state,m.props.page&&(m.props.page.url=a),ce.$set(m.props)):Ne(m),l){const{scroll:E,keepfocus:A}=l;if(!A){const y=document.body,w=y.getAttribute("tabindex");y.tabIndex=-1,y.focus({preventScroll:!0}),setTimeout(()=>{var $;($=getSelection())==null||$.removeAllRanges()}),w!==null?y.setAttribute("tabindex",w):y.removeAttribute("tabindex")}if(await Ie(),L){const y=a.hash&&document.getElementById(a.hash.slice(1));E?scrollTo(E.x,E.y):y?y.scrollIntoView():scrollTo(0,0)}}else await Ie();n.promise=null,n.id=null,L=!0,m.props.page&&(_e=m.props.page);const g=m.state.branch[m.state.branch.length-1];X=(g==null?void 0:g.module.router)!==!1,p&&p(),k=!1}function Ne(a){i=a.state;const h=document.querySelector("style[data-sveltekit]");if(h&&h.remove(),_e=a.props.page,ce=new mt({target:r,props:{...a.props,stores:d},hydrate:!0}),X){const b={from:null,to:new URL(location.href)};s.after_navigate.forEach(l=>l(b))}u=!0}async function ge({url:a,params:h,stuff:b,branch:l,status:p,error:_,routeId:v}){var y,w;const m=l.filter(Boolean),g=m.find($=>{var O;return(O=$.loaded)==null?void 0:O.redirect}),R={redirect:(y=g==null?void 0:g.loaded)==null?void 0:y.redirect,state:{url:a,params:h,branch:l,error:_,stuff:b,session_id:Z},props:{components:m.map($=>$.module.default)}};for(let $=0;$<m.length;$+=1){const O=m[$].loaded;R.props[`props_${$}`]=O?await O.props:null}if(!i.url||a.href!==i.url.href||i.error!==_||i.stuff!==b){R.props.page={error:_,params:h,routeId:v,status:p,stuff:b,url:a};const $=(O,V)=>{Object.defineProperty(R.props.page,O,{get:()=>{throw new Error(`$page.${O} has been replaced by $page.url.${V}`)}})};$("origin","origin"),$("path","pathname"),$("query","searchParams")}const E=m[m.length-1],A=(w=E==null?void 0:E.loaded)==null?void 0:w.cache;if(A){const $=a.pathname+a.search;let O=!1;const V=()=>{f.get($)===R&&f.delete($),N(),clearTimeout(U)},U=setTimeout(V,A.maxage*1e3),N=d.session.subscribe(()=>{O&&V()});O=!0,f.set($,R)}return R}async function Q({status:a,error:h,module:b,url:l,params:p,stuff:_,props:v,routeId:m}){const g={module:b,uses:{params:new Set,url:!1,session:!1,stuff:!1,dependencies:new Set},loaded:null,stuff:_};function R(y){const{href:w}=new URL(y,l);g.uses.dependencies.add(w)}v&&g.uses.dependencies.add(l.href);const S={};for(const y in p)Object.defineProperty(S,y,{get(){return g.uses.params.add(y),p[y]},enumerable:!0});const E=Le,A=new vt(l);if(b.load){const y={routeId:m,params:S,props:v||{},get url(){return g.uses.url=!0,A},get session(){return g.uses.session=!0,E},get stuff(){return g.uses.stuff=!0,{..._}},async fetch(w,$){let O;typeof w=="string"?O=w:(O=w.url,$={body:w.method==="GET"||w.method==="HEAD"?void 0:await w.blob(),cache:w.cache,credentials:w.credentials,headers:w.headers,integrity:w.integrity,keepalive:w.keepalive,method:w.method,mode:w.mode,redirect:w.redirect,referrer:w.referrer,referrerPolicy:w.referrerPolicy,signal:w.signal,...$});const V=new URL(O,l).href;return R(V),u?Re(V,$):Et(O,$)},status:a!=null?a:null,error:h!=null?h:null};g.loaded=Ve(await b.load.call(null,y)),g.loaded.stuff&&(g.stuff=g.loaded.stuff),g.loaded.dependencies&&g.loaded.dependencies.forEach(R)}else v&&(g.loaded=Ve({props:v}));return g}async function Pe({id:a,url:h,params:b,route:l},p){var w,$,O,V;if(n.id===a&&n.promise)return n.promise;if(!p){const U=f.get(a);if(U)return U}const{a:_,b:v,has_shadow:m}=l,g=i.url&&{url:a!==i.url.pathname+i.url.search,params:Object.keys(b).filter(U=>i.params[U]!==b[U]),session:Z!==i.session_id};let R=[],S=Ke,E=!1,A=200,y=null;_.forEach(U=>U().catch(()=>{}));e:for(let U=0;U<_.length;U+=1){let N;try{if(!_[U])continue;const P=await _[U](),D=i.branch[U];if(!D||P!==D.module||g.url&&D.uses.url||g.params.some(M=>D.uses.params.has(M))||g.session&&D.uses.session||Array.from(D.uses.dependencies).some(M=>c.some(fe=>fe(M)))||E&&D.uses.stuff){let M={};const fe=m&&U===_.length-1;if(fe){const H=await Re(`${h.pathname}${h.pathname.endsWith("/")?"":"/"}__data.json${h.search}`,{headers:{"x-sveltekit-load":"true"}});if(H.ok){const be=H.headers.get("x-sveltekit-location");if(be)return{redirect:be,props:{},state:i};M=H.status===204?{}:await H.json()}else{A=H.status;try{y=await H.json()}catch{y=new Error("Failed to load data")}}}if(y||(N=await Q({module:P,url:h,params:b,props:M,stuff:S,routeId:l.id})),N&&(fe&&(N.uses.url=!0),N.loaded)){if(N.loaded.error&&(A=(w=N.loaded.status)!=null?w:500,y=N.loaded.error),N.loaded.redirect)return{redirect:N.loaded.redirect,props:{},state:i};N.loaded.stuff&&(E=!0)}}else N=D}catch(P){A=500,y=Ce(P)}if(y){for(;U--;)if(v[U]){let P,D,le=U;for(;!(D=R[le]);)le-=1;try{if(P=await Q({status:A,error:y,module:await v[U](),url:h,params:b,stuff:D.stuff,routeId:l.id}),($=P==null?void 0:P.loaded)!=null&&$.error)continue;(O=P==null?void 0:P.loaded)!=null&&O.stuff&&(S={...S,...P.loaded.stuff}),R=R.slice(0,le+1).concat(P);break e}catch{continue}}return await ee({status:A,error:y,url:h,routeId:l.id})}else(V=N==null?void 0:N.loaded)!=null&&V.stuff&&(S={...S,...N.loaded.stuff}),R.push(N)}return await ge({url:h,params:b,stuff:S,branch:R,status:A,error:y,routeId:l.id})}async function ee({status:a,error:h,url:b,routeId:l}){var m,g;const p={},_=await Q({module:await At,url:b,params:p,stuff:{},routeId:l}),v=await Q({status:a,error:h,module:await Ot,url:b,params:p,stuff:_&&_.loaded&&_.loaded.stuff||{},routeId:l});return await ge({url:b,params:p,stuff:{...(m=_==null?void 0:_.loaded)==null?void 0:m.stuff,...(g=v==null?void 0:v.loaded)==null?void 0:g.stuff},branch:[_,v],status:a,error:h,routeId:l})}function xe(a){if(a.origin!==location.origin||!a.pathname.startsWith(t))return;const h=decodeURI(a.pathname.slice(t.length)||"/");for(const b of ve){const l=b.exec(h);if(l){const p=new URL(a.origin+bt(a.pathname,o)+a.search+a.hash);return{id:p.pathname+p.search,route:b,params:yt(l),url:p}}}}async function we({url:a,scroll:h,keepfocus:b,redirect_chain:l,details:p,accepted:_,blocked:v}){const m=i.url;let g=!1;const R={from:m,to:a,cancel:()=>g=!0};if(s.before_navigate.forEach(S=>S(R)),g){v();return}$e(j),_(),u&&d.navigating.set({from:i.url,to:a}),await me(a,l,!1,{scroll:h,keepfocus:b,details:p},()=>{const S={from:m,to:a};s.after_navigate.forEach(E=>E(S)),d.navigating.set(null)})}function te(a){return location.href=a.href,new Promise(()=>{})}return{after_navigate:a=>{ke(()=>(s.after_navigate.push(a),()=>{const h=s.after_navigate.indexOf(a);s.after_navigate.splice(h,1)}))},before_navigate:a=>{ke(()=>(s.before_navigate.push(a),()=>{const h=s.before_navigate.indexOf(a);s.before_navigate.splice(h,1)}))},disable_scroll_handling:()=>{(k||!u)&&(L=!1)},goto:(a,h={})=>Ae(a,h,[]),invalidate:a=>{if(typeof a=="function")c.push(a);else{const{href:h}=new URL(a,location.href);c.push(b=>b===h)}return G||(G=Promise.resolve().then(async()=>{await me(new URL(location.href),[],!0),G=null})),G},prefetch:async a=>{const h=new URL(a,ze(document));await Oe(h)},prefetch_routes:async a=>{const b=(a?ve.filter(l=>a.some(p=>l.exec(p))):ve).map(l=>Promise.all(l.a.map(p=>p())));await Promise.all(b)},_start_router:()=>{history.scrollRestoration="manual",addEventListener("beforeunload",l=>{let p=!1;const _={from:i.url,to:null,cancel:()=>p=!0};s.before_navigate.forEach(v=>v(_)),p?(l.preventDefault(),l.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){$e(j);try{sessionStorage[Fe]=JSON.stringify(re)}catch{}}});const a=l=>{const p=qe(l);p&&p.href&&p.hasAttribute("sveltekit:prefetch")&&Oe(Be(p))};let h;const b=l=>{clearTimeout(h),h=setTimeout(()=>{var p;(p=l.target)==null||p.dispatchEvent(new CustomEvent("sveltekit:trigger_prefetch",{bubbles:!0}))},20)};addEventListener("touchstart",a),addEventListener("mousemove",b),addEventListener("sveltekit:trigger_prefetch",a),addEventListener("click",l=>{if(!X||l.button||l.which!==1||l.metaKey||l.ctrlKey||l.shiftKey||l.altKey||l.defaultPrevented)return;const p=qe(l);if(!p||!p.href)return;const _=p instanceof SVGAElement,v=Be(p);if(!_&&v.origin==="null")return;const m=(p.getAttribute("rel")||"").split(/\s+/);if(p.hasAttribute("download")||m.includes("external")||p.hasAttribute("sveltekit:reload")||(_?p.target.baseVal:p.target))return;const[g,R]=v.href.split("#");if(R!==void 0&&g===location.href.split("#")[0]){he=!0,$e(j),d.page.set({..._e,url:v}),d.page.notify();return}we({url:v,scroll:p.hasAttribute("sveltekit:noscroll")?Ee():null,keepfocus:!1,redirect_chain:[],details:{state:{},replaceState:v.href===location.href},accepted:()=>l.preventDefault(),blocked:()=>l.preventDefault()})}),addEventListener("popstate",l=>{if(l.state&&X){if(l.state[F]===j)return;we({url:new URL(location.href),scroll:re[l.state[F]],keepfocus:!1,redirect_chain:[],details:null,accepted:()=>{j=l.state[F]},blocked:()=>{const p=j-l.state[F];history.go(p)}})}}),addEventListener("hashchange",()=>{he&&(he=!1,history.replaceState({...history.state,[F]:++j},"",location.href))});for(const l of document.querySelectorAll("link"))l.rel==="icon"&&(l.href=l.href);addEventListener("pageshow",l=>{l.persisted&&d.navigating.set(null)})},_hydrate:async({status:a,error:h,nodes:b,params:l,routeId:p})=>{var S;const _=new URL(location.href),v=[];let m={},g,R;try{for(let E=0;E<b.length;E+=1){const A=E===b.length-1;let y;if(A){const $=document.querySelector('script[sveltekit\\:data-type="props"]');$&&(y=JSON.parse($.textContent))}const w=await Q({module:await de[b[E]](),url:_,params:l,stuff:m,status:A?a:void 0,error:A?h:void 0,props:y,routeId:p});if(y&&(w.uses.dependencies.add(_.href),w.uses.url=!0),v.push(w),w&&w.loaded)if(w.loaded.error){if(h)throw w.loaded.error;R={status:(S=w.loaded.status)!=null?S:500,error:w.loaded.error,url:_,routeId:p}}else w.loaded.stuff&&(m={...m,...w.loaded.stuff})}g=R?await ee(R):await ge({url:_,params:l,stuff:m,branch:v,status:a,error:h,routeId:p})}catch(E){if(h)throw E;g=await ee({status:500,error:Ce(E),url:_,routeId:p})}g.redirect&&await te(new URL(g.redirect,location.href)),Ne(g)}}}async function jt({paths:r,target:e,session:t,route:o,spa:f,trailing_slash:c,hydrate:d}){const n=Nt({target:e,session:t,base:r.base,trailing_slash:c});ot({client:n}),at(r),d&&await n._hydrate(d),o&&(f&&n.goto(location.href,{replaceState:!0}),n._start_router()),dispatchEvent(new CustomEvent("sveltekit:start"))}export{jt as start};
|