Files
mermaid-live-editor/_app/immutable/start-c3859d08.js
T
2022-07-17 10:19:07 +00:00

2 lines
24 KiB
JavaScript

import{S as Ye,i as Fe,s as Ge,a as Xe,e as I,c as He,b as z,g as Y,t as V,d as F,f as D,h as j,j as Ze,k as Qe,o as $e,l as et,m as tt,n as nt,p as ye,q as M,r as rt,u as st,v as it,w as K,x as se,y as B,z as ie,A as ae,B as q,C as oe,D as De}from"./chunks/index-e5d76bd0.js";import{_ as ne,w as ue}from"./chunks/preload-helper-931883bc.js";import{s as at,a as ot}from"./chunks/paths-1c47712a.js";import{i as ct}from"./chunks/singletons-cdeec3fd.js";function lt(r){let e,t,o;const l=[r[1]||{}];var c=r[0][0];function d(n){let s={};for(let i=0;i<l.length;i+=1)s=oe(s,l[i]);return{props:s}}return c&&(e=new c(d())),{c(){e&&K(e.$$.fragment),t=I()},l(n){e&&se(e.$$.fragment,n),t=I()},m(n,s){e&&B(e,n,s),z(n,t,s),o=!0},p(n,s){const i=s&2?ie(l,[ae(n[1]||{})]):{};if(c!==(c=n[0][0])){if(e){Y();const u=e;V(u.$$.fragment,1,0,()=>{q(u,1)}),F()}c?(e=new c(d()),K(e.$$.fragment),D(e.$$.fragment,1),B(e,t.parentNode,t)):e=null}else c&&e.$set(i)},i(n){o||(e&&D(e.$$.fragment,n),o=!0)},o(n){e&&V(e.$$.fragment,n),o=!1},d(n){n&&j(t),e&&q(e,n)}}}function ft(r){let e,t,o;const l=[r[1]||{}];var c=r[0][0];function d(n){let s={$$slots:{default:[_t]},$$scope:{ctx:n}};for(let i=0;i<l.length;i+=1)s=oe(s,l[i]);return{props:s}}return c&&(e=new c(d(r))),{c(){e&&K(e.$$.fragment),t=I()},l(n){e&&se(e.$$.fragment,n),t=I()},m(n,s){e&&B(e,n,s),z(n,t,s),o=!0},p(n,s){const i=s&2?ie(l,[ae(n[1]||{})]):{};if(s&525&&(i.$$scope={dirty:s,ctx:n}),c!==(c=n[0][0])){if(e){Y();const u=e;V(u.$$.fragment,1,0,()=>{q(u,1)}),F()}c?(e=new c(d(n)),K(e.$$.fragment),D(e.$$.fragment,1),B(e,t.parentNode,t)):e=null}else c&&e.$set(i)},i(n){o||(e&&D(e.$$.fragment,n),o=!0)},o(n){e&&V(e.$$.fragment,n),o=!1},d(n){n&&j(t),e&&q(e,n)}}}function ut(r){let e,t,o;const l=[r[2]||{}];var c=r[0][1];function d(n){let s={};for(let i=0;i<l.length;i+=1)s=oe(s,l[i]);return{props:s}}return c&&(e=new c(d())),{c(){e&&K(e.$$.fragment),t=I()},l(n){e&&se(e.$$.fragment,n),t=I()},m(n,s){e&&B(e,n,s),z(n,t,s),o=!0},p(n,s){const i=s&4?ie(l,[ae(n[2]||{})]):{};if(c!==(c=n[0][1])){if(e){Y();const u=e;V(u.$$.fragment,1,0,()=>{q(u,1)}),F()}c?(e=new c(d()),K(e.$$.fragment),D(e.$$.fragment,1),B(e,t.parentNode,t)):e=null}else c&&e.$set(i)},i(n){o||(e&&D(e.$$.fragment,n),o=!0)},o(n){e&&V(e.$$.fragment,n),o=!1},d(n){n&&j(t),e&&q(e,n)}}}function dt(r){let e,t,o;const l=[r[2]||{}];var c=r[0][1];function d(n){let s={$$slots:{default:[pt]},$$scope:{ctx:n}};for(let i=0;i<l.length;i+=1)s=oe(s,l[i]);return{props:s}}return c&&(e=new c(d(r))),{c(){e&&K(e.$$.fragment),t=I()},l(n){e&&se(e.$$.fragment,n),t=I()},m(n,s){e&&B(e,n,s),z(n,t,s),o=!0},p(n,s){const i=s&4?ie(l,[ae(n[2]||{})]):{};if(s&521&&(i.$$scope={dirty:s,ctx:n}),c!==(c=n[0][1])){if(e){Y();const u=e;V(u.$$.fragment,1,0,()=>{q(u,1)}),F()}c?(e=new c(d(n)),K(e.$$.fragment),D(e.$$.fragment,1),B(e,t.parentNode,t)):e=null}else c&&e.$set(i)},i(n){o||(e&&D(e.$$.fragment,n),o=!0)},o(n){e&&V(e.$$.fragment,n),o=!1},d(n){n&&j(t),e&&q(e,n)}}}function pt(r){let e,t,o;const l=[r[3]||{}];var c=r[0][2];function d(n){let s={};for(let i=0;i<l.length;i+=1)s=oe(s,l[i]);return{props:s}}return c&&(e=new c(d())),{c(){e&&K(e.$$.fragment),t=I()},l(n){e&&se(e.$$.fragment,n),t=I()},m(n,s){e&&B(e,n,s),z(n,t,s),o=!0},p(n,s){const i=s&8?ie(l,[ae(n[3]||{})]):{};if(c!==(c=n[0][2])){if(e){Y();const u=e;V(u.$$.fragment,1,0,()=>{q(u,1)}),F()}c?(e=new c(d()),K(e.$$.fragment),D(e.$$.fragment,1),B(e,t.parentNode,t)):e=null}else c&&e.$set(i)},i(n){o||(e&&D(e.$$.fragment,n),o=!0)},o(n){e&&V(e.$$.fragment,n),o=!1},d(n){n&&j(t),e&&q(e,n)}}}function _t(r){let e,t,o,l;const c=[dt,ut],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=I()},l(s){t.l(s),o=I()},m(s,i){d[e].m(s,i),z(s,o,i),l=!0},p(s,i){let u=e;e=n(s),e===u?d[e].p(s,i):(Y(),V(d[u],1,1,()=>{d[u]=null}),F(),t=d[e],t?t.p(s,i):(t=d[e]=c[e](s),t.c()),D(t,1),t.m(o.parentNode,o))},i(s){l||(D(t),l=!0)},o(s){V(t),l=!1},d(s){d[e].d(s),s&&j(o)}}}function Ne(r){let e,t=r[5]&&xe(r);return{c(){e=et("div"),t&&t.c(),this.h()},l(o){e=tt(o,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var l=nt(e);t&&t.l(l),l.forEach(j),this.h()},h(){ye(e,"id","svelte-announcer"),ye(e,"aria-live","assertive"),ye(e,"aria-atomic","true"),M(e,"position","absolute"),M(e,"left","0"),M(e,"top","0"),M(e,"clip","rect(0 0 0 0)"),M(e,"clip-path","inset(50%)"),M(e,"overflow","hidden"),M(e,"white-space","nowrap"),M(e,"width","1px"),M(e,"height","1px")},m(o,l){z(o,e,l),t&&t.m(e,null)},p(o,l){o[5]?t?t.p(o,l):(t=xe(o),t.c(),t.m(e,null)):t&&(t.d(1),t=null)},d(o){o&&j(e),t&&t.d()}}}function xe(r){let e;return{c(){e=rt(r[6])},l(t){e=st(t,r[6])},m(t,o){z(t,e,o)},p(t,o){o&64&&it(e,t[6])},d(t){t&&j(e)}}}function ht(r){let e,t,o,l,c;const d=[ft,lt],n=[];function s(u,L){return u[0][1]?0:1}e=s(r),t=n[e]=d[e](r);let i=r[4]&&Ne(r);return{c(){t.c(),o=Xe(),i&&i.c(),l=I()},l(u){t.l(u),o=He(u),i&&i.l(u),l=I()},m(u,L){n[e].m(u,L),z(u,o,L),i&&i.m(u,L),z(u,l,L),c=!0},p(u,[L]){let k=e;e=s(u),e===k?n[e].p(u,L):(Y(),V(n[k],1,1,()=>{n[k]=null}),F(),t=n[e],t?t.p(u,L):(t=n[e]=d[e](u),t.c()),D(t,1),t.m(o.parentNode,o)),u[4]?i?i.p(u,L):(i=Ne(u),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null)},i(u){c||(D(t),c=!0)},o(u){V(t),c=!1},d(u){n[e].d(u),u&&j(o),i&&i.d(u),u&&j(l)}}}function mt(r,e,t){let{stores:o}=e,{page:l}=e,{components:c}=e,{props_0:d=null}=e,{props_1:n=null}=e,{props_2:s=null}=e;Ze("__svelte__",o),Qe(o.page.notify);let i=!1,u=!1,L=null;return $e(()=>{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,l=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(l)},[c,d,n,s,i,u,L,o,l]}class gt extends Ye{constructor(e){super(),Fe(this,e,mt,ht,Ge,{stores:7,page:8,components:0,props_0:1,props_1:2,props_2:3})}}const wt={},de=[()=>ne(()=>import("./pages/__layout.svelte-c11ff3d1.js"),["immutable/pages/__layout.svelte-c11ff3d1.js","immutable/assets/__layout-9fa704f5.css","immutable/chunks/index-e5d76bd0.js","immutable/chunks/paths-1c47712a.js","immutable/chunks/state-1c7c5d72.js","immutable/chunks/preload-helper-931883bc.js","immutable/chunks/theme-c7be9b95.js"]),()=>ne(()=>import("./error.svelte-2e8db8e7.js"),["immutable/error.svelte-2e8db8e7.js","immutable/chunks/index-e5d76bd0.js"]),()=>ne(()=>import("./pages/edit.svelte-15553243.js"),["immutable/pages/edit.svelte-15553243.js","immutable/assets/edit-826332b8.css","immutable/chunks/index-e5d76bd0.js","immutable/chunks/state-1c7c5d72.js","immutable/chunks/preload-helper-931883bc.js","immutable/chunks/theme-c7be9b95.js","immutable/chunks/util-cc637224.js","immutable/assets/util-5eb0c13e.css","immutable/chunks/paths-1c47712a.js"]),()=>ne(()=>import("./pages/index.svelte-999e865e.js"),["immutable/pages/index.svelte-999e865e.js","immutable/chunks/index-e5d76bd0.js","immutable/chunks/singletons-cdeec3fd.js","immutable/chunks/paths-1c47712a.js"]),()=>ne(()=>import("./pages/view.svelte-b8352928.js"),["immutable/pages/view.svelte-b8352928.js","immutable/chunks/index-e5d76bd0.js","immutable/chunks/util-cc637224.js","immutable/assets/util-5eb0c13e.css","immutable/chunks/state-1c7c5d72.js","immutable/chunks/preload-helper-931883bc.js"])],bt={"":[[0,3],[1]],edit:[[0,2],[1]],view:[[0,4],[1]]};function je(r){return r instanceof Error||r&&r.name&&r.message?r:new Error(JSON.stringify(r))}function Ce(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 ze(r,e){return r==="/"||e==="ignore"?r:e==="never"?r.endsWith("/")?r.slice(0,-1):r:e==="always"&&!r.endsWith("/")?r+"/":r}class yt 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 Ke(r){let e=r.baseURI;if(!e){const t=r.getElementsByTagName("base");e=t.length?t[0].href:r.URL}return e}function ke(){return{x:pageXOffset,y:pageYOffset}}function Be(r){return r.composedPath().find(t=>t instanceof Node&&t.nodeName.toUpperCase()==="A")}function qe(r){return r instanceof SVGAElement?new URL(r.href.baseVal,document.baseURI):new URL(r.href)}function Me(r){const e=ue(r);let t=!0;function o(){t=!0,e.update(d=>d)}function l(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:l,subscribe:c}}function vt(){const{set:r,subscribe:e}=ue(!1),t=+{BASE_URL:"/mermaid-live-editor/_app/",MODE:"production",DEV:!1,PROD:!0}.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL,o={BASE_URL:"/mermaid-live-editor/_app/",MODE:"production",DEV:!1,PROD:!0}.VITE_SVELTEKIT_APP_VERSION;let l;async function c(){clearTimeout(l),t&&(l=setTimeout(c,t));const d={BASE_URL:"/mermaid-live-editor/_app/",MODE:"production",DEV:!1,PROD:!0}.VITE_SVELTEKIT_APP_VERSION_FILE,n=await fetch(`${ot}/${d}`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(n.ok){const{version:s}=await n.json(),i=s!==o;return i&&(r(!0),clearTimeout(l)),i}else throw new Error(`Version check failed: ${n.status}`)}return t&&(l=setTimeout(c,t)),{subscribe:e,check:c}}function Et(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 $t(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="${Et(e.body)}"]`);const l=document.querySelector(o);if(l&&l.textContent){const{body:c,...d}=JSON.parse(l.textContent);return Promise.resolve(new Response(c,d))}return Re(r,e)}const kt=/^(\.\.\.)?(\w+)(?:=(\w+))?$/;function Rt(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=kt.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 Lt(r,e,t,o){const l={};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}l[d]=s}return l}function St(r,e,t){return Object.entries(e).map(([l,[c,d,n]])=>{const{pattern:s,names:i,types:u}=Rt(l);return{id:l,exec:L=>{const k=s.exec(L);if(k)return Lt(k,i,u,t)},a:c.map(L=>r[L]),b:d.map(L=>r[L]),has_shadow:!!n}})}const We="sveltekit:scroll",J="sveltekit:index",ve=St(de,bt,wt),At=de[0](),Ut=de[1](),Je={};let re={};try{re=JSON.parse(sessionStorage[We])}catch{}function Ee(r){re[r]=ke()}function Ot({target:r,session:e,base:t,trailing_slash:o}){var Ve;const l=new Map,c=[],d={url:Me({}),page:Me({}),navigating:ue(null),session:ue(e),updated:vt()},n={id:null,promise:null},s={before_navigate:[],after_navigate:[]};let i={branch:[],error:null,session_id:0,stuff:Je,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,N=(Ve=history.state)==null?void 0:Ve[J];N||(N=Date.now(),history.replaceState({...history.state,[J]:N},"",location.href));const pe=re[N];pe&&(history.scrollRestoration="manual",scrollTo(pe.x,pe.y));let _e=!1,he,Ae;async function Ue(a,{noscroll:p=!1,replaceState:b=!1,keepfocus:f=!1,state:_={}},w){if(typeof a=="string"&&(a=new URL(a,Ke(document))),X)return we({url:a,scroll:p?ke():null,keepfocus:f,redirect_chain:w,details:{state:_,replaceState:b},accepted:()=>{},blocked:()=>{}});await te(a)}async function Oe(a){const p=Ie(a);if(!p)throw new Error("Attempted to prefetch a URL that does not belong to this app");return n.promise=Pe(p,!1),n.id=p.id,n.promise}async function me(a,p,b,f,_){var R,O;const w=Ie(a),$=Ae={};let h=w&&await Pe(w,b);if(!h&&a.origin===location.origin&&a.pathname===location.pathname&&(h=await ee({status:404,error:new Error(`Not found: ${a.pathname}`),url:a,routeId:null})),!h)return await te(a),!1;if(Ae!==$)return!1;if(c.length=0,h.redirect)if(p.length>10||p.includes(a.pathname))h=await ee({status:500,error:new Error("Redirect loop"),url:a,routeId:null});else return X?Ue(new URL(h.redirect,a).href,{},[...p,a.pathname]):await te(new URL(h.redirect,location.href)),!1;else((O=(R=h.props)==null?void 0:R.page)==null?void 0:O.status)>=400&&await d.updated.check()&&await te(a);if(k=!0,f&&f.details){const{details:v}=f,S=v.replaceState?0:1;v.state[J]=N+=S,history[v.replaceState?"replaceState":"pushState"](v.state,"",a)}if(u?(i=h.state,h.props.page&&(h.props.page.url=a),ce.$set(h.props)):Te(h),f){const{scroll:v,keepfocus:S}=f;if(!S){const y=document.body,g=y.getAttribute("tabindex");y.tabIndex=-1,y.focus({preventScroll:!0}),setTimeout(()=>{var E;(E=getSelection())==null||E.removeAllRanges()}),g!==null?y.setAttribute("tabindex",g):y.removeAttribute("tabindex")}if(await De(),L){const y=a.hash&&document.getElementById(a.hash.slice(1));v?scrollTo(v.x,v.y):y?y.scrollIntoView():scrollTo(0,0)}}else await De();n.promise=null,n.id=null,L=!0,h.props.page&&(he=h.props.page);const m=h.state.branch[h.state.branch.length-1];X=(m==null?void 0:m.module.router)!==!1,_&&_(),k=!1}function Te(a){i=a.state;const p=document.querySelector("style[data-sveltekit]");if(p&&p.remove(),he=a.props.page,ce=new gt({target:r,props:{...a.props,stores:d},hydrate:!0}),X){const b={from:null,to:new URL(location.href)};s.after_navigate.forEach(f=>f(b))}u=!0}async function ge({url:a,params:p,stuff:b,branch:f,status:_,error:w,routeId:$}){var y,g;const h=f.filter(Boolean),m=h.find(E=>{var U;return(U=E.loaded)==null?void 0:U.redirect}),R={redirect:(y=m==null?void 0:m.loaded)==null?void 0:y.redirect,state:{url:a,params:p,branch:f,error:w,stuff:b,session_id:Z},props:{components:h.map(E=>E.module.default)}};for(let E=0;E<h.length;E+=1){const U=h[E].loaded;R.props[`props_${E}`]=U?await U.props:null}if(!i.url||a.href!==i.url.href||i.error!==w||i.stuff!==b){R.props.page={error:w,params:p,routeId:$,status:_,stuff:b,url:a};const E=(U,C)=>{Object.defineProperty(R.props.page,U,{get:()=>{throw new Error(`$page.${U} has been replaced by $page.url.${C}`)}})};E("origin","origin"),E("path","pathname"),E("query","searchParams")}const v=h[h.length-1],S=(g=v==null?void 0:v.loaded)==null?void 0:g.cache;if(S){const E=a.pathname+a.search;let U=!1;const C=()=>{l.get(E)===R&&l.delete(E),T(),clearTimeout(A)},A=setTimeout(C,S.maxage*1e3),T=d.session.subscribe(()=>{U&&C()});U=!0,l.set(E,R)}return R}async function Q({status:a,error:p,module:b,url:f,params:_,stuff:w,props:$,routeId:h}){const m={module:b,uses:{params:new Set,url:!1,session:!1,stuff:!1,dependencies:new Set},loaded:null,stuff:w};function R(y){const{href:g}=new URL(y,f);m.uses.dependencies.add(g)}$&&m.uses.dependencies.add(f.href);const O={};for(const y in _)Object.defineProperty(O,y,{get(){return m.uses.params.add(y),_[y]},enumerable:!0});const v=Le,S=new yt(f);if(b.load){const y={routeId:h,params:O,props:$||{},get url(){return m.uses.url=!0,S},get session(){return m.uses.session=!0,v},get stuff(){return m.uses.stuff=!0,{...w}},async fetch(g,E){let U;typeof g=="string"?U=g:(U=g.url,E={body:g.method==="GET"||g.method==="HEAD"?void 0:await g.blob(),cache:g.cache,credentials:g.credentials,headers:g.headers,integrity:g.integrity,keepalive:g.keepalive,method:g.method,mode:g.mode,redirect:g.redirect,referrer:g.referrer,referrerPolicy:g.referrerPolicy,signal:g.signal,...E});const C=new URL(U,f).href;return R(C),u?Re(C,E):$t(U,E)},status:a!=null?a:null,error:p!=null?p:null};m.loaded=Ce(await b.load.call(null,y)),m.loaded.stuff&&(m.stuff=m.loaded.stuff),m.loaded.dependencies&&m.loaded.dependencies.forEach(R)}else $&&(m.loaded=Ce({props:$}));return m}async function Pe({id:a,url:p,params:b,route:f},_){var g,E,U,C;if(n.id===a&&n.promise)return n.promise;if(!_){const A=l.get(a);if(A)return A}const{a:w,b:$,has_shadow:h}=f,m=i.url&&{url:a!==i.url.pathname+i.url.search,params:Object.keys(b).filter(A=>i.params[A]!==b[A]),session:Z!==i.session_id};let R=[],O=Je,v=!1,S=200,y=null;w.forEach(A=>A().catch(()=>{}));e:for(let A=0;A<w.length;A+=1){let T;try{if(!w[A])continue;const P=await w[A](),x=i.branch[A];if(!x||P!==x.module||m.url&&x.uses.url||m.params.some(W=>x.uses.params.has(W))||m.session&&x.uses.session||Array.from(x.uses.dependencies).some(W=>c.some(fe=>fe(W)))||v&&x.uses.stuff){let W={};const fe=h&&A===w.length-1;if(fe){const H=await Re(`${p.pathname}${p.pathname.endsWith("/")?"":"/"}__data.json${p.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};W=H.status===204?{}:await H.json()}else{S=H.status;try{y=await H.json()}catch{y=new Error("Failed to load data")}}}if(y||(T=await Q({module:P,url:p,params:b,props:W,stuff:O,routeId:f.id})),T&&(fe&&(T.uses.url=!0),T.loaded)){if(T.loaded.error&&(S=(g=T.loaded.status)!=null?g:500,y=T.loaded.error),T.loaded.redirect)return{redirect:T.loaded.redirect,props:{},state:i};T.loaded.stuff&&(v=!0)}}else T=x}catch(P){S=500,y=je(P)}if(y){for(;A--;)if($[A]){let P,x,le=A;for(;!(x=R[le]);)le-=1;try{if(P=await Q({status:S,error:y,module:await $[A](),url:p,params:b,stuff:x.stuff,routeId:f.id}),(E=P==null?void 0:P.loaded)!=null&&E.error)continue;(U=P==null?void 0:P.loaded)!=null&&U.stuff&&(O={...O,...P.loaded.stuff}),R=R.slice(0,le+1).concat(P);break e}catch{continue}}return await ee({status:S,error:y,url:p,routeId:f.id})}else(C=T==null?void 0:T.loaded)!=null&&C.stuff&&(O={...O,...T.loaded.stuff}),R.push(T)}return await ge({url:p,params:b,stuff:O,branch:R,status:S,error:y,routeId:f.id})}async function ee({status:a,error:p,url:b,routeId:f}){var h,m;const _={},w=await Q({module:await At,url:b,params:_,stuff:{},routeId:f}),$=await Q({status:a,error:p,module:await Ut,url:b,params:_,stuff:w&&w.loaded&&w.loaded.stuff||{},routeId:f});return await ge({url:b,params:_,stuff:{...(h=w==null?void 0:w.loaded)==null?void 0:h.stuff,...(m=$==null?void 0:$.loaded)==null?void 0:m.stuff},branch:[w,$],status:a,error:p,routeId:f})}function Ie(a){if(a.origin!==location.origin||!a.pathname.startsWith(t))return;const p=decodeURI(a.pathname.slice(t.length)||"/");for(const b of ve){const f=b.exec(p);if(f)return{id:ze(a.pathname,o)+a.search,route:b,params:f,url:a}}}async function we({url:a,scroll:p,keepfocus:b,redirect_chain:f,details:_,accepted:w,blocked:$}){const h=i.url;let m=!1;const R={from:h,to:a,cancel:()=>m=!0};if(s.before_navigate.forEach(S=>S(R)),m){$();return}const O=ze(a.pathname,o),v=new URL(a.origin+O+a.search+a.hash);Ee(N),w(),u&&d.navigating.set({from:i.url,to:v}),await me(v,f,!1,{scroll:p,keepfocus:b,details:_},()=>{const S={from:h,to:v};s.after_navigate.forEach(y=>y(S)),d.navigating.set(null)})}function te(a){return location.href=a.href,new Promise(()=>{})}return{after_navigate:a=>{$e(()=>(s.after_navigate.push(a),()=>{const p=s.after_navigate.indexOf(a);s.after_navigate.splice(p,1)}))},before_navigate:a=>{$e(()=>(s.before_navigate.push(a),()=>{const p=s.before_navigate.indexOf(a);s.before_navigate.splice(p,1)}))},disable_scroll_handling:()=>{(k||!u)&&(L=!1)},goto:(a,p={})=>Ue(a,p,[]),invalidate:a=>{if(typeof a=="function")c.push(a);else{const{href:p}=new URL(a,location.href);c.push(b=>b===p)}return G||(G=Promise.resolve().then(async()=>{await me(new URL(location.href),[],!0),G=null})),G},prefetch:async a=>{const p=new URL(a,Ke(document));await Oe(p)},prefetch_routes:async a=>{const b=(a?ve.filter(f=>a.some(_=>f.exec(_))):ve).map(f=>Promise.all(f.a.map(_=>_())));await Promise.all(b)},_start_router:()=>{history.scrollRestoration="manual",addEventListener("beforeunload",f=>{let _=!1;const w={from:i.url,to:null,cancel:()=>_=!0};s.before_navigate.forEach($=>$(w)),_?(f.preventDefault(),f.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){Ee(N);try{sessionStorage[We]=JSON.stringify(re)}catch{}}});const a=f=>{const _=Be(f);_&&_.href&&_.hasAttribute("sveltekit:prefetch")&&Oe(qe(_))};let p;const b=f=>{clearTimeout(p),p=setTimeout(()=>{var _;(_=f.target)==null||_.dispatchEvent(new CustomEvent("sveltekit:trigger_prefetch",{bubbles:!0}))},20)};addEventListener("touchstart",a),addEventListener("mousemove",b),addEventListener("sveltekit:trigger_prefetch",a),addEventListener("click",f=>{if(!X||f.button||f.which!==1||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||f.defaultPrevented)return;const _=Be(f);if(!_||!_.href)return;const w=_ instanceof SVGAElement,$=qe(_);if(!w&&$.origin==="null")return;const h=(_.getAttribute("rel")||"").split(/\s+/);if(_.hasAttribute("download")||h.includes("external")||_.hasAttribute("sveltekit:reload")||(w?_.target.baseVal:_.target))return;const[m,R]=$.href.split("#");if(R!==void 0&&m===location.href.split("#")[0]){_e=!0,Ee(N),d.page.set({...he,url:$}),d.page.notify();return}we({url:$,scroll:_.hasAttribute("sveltekit:noscroll")?ke():null,keepfocus:!1,redirect_chain:[],details:{state:{},replaceState:$.href===location.href},accepted:()=>f.preventDefault(),blocked:()=>f.preventDefault()})}),addEventListener("popstate",f=>{if(f.state&&X){if(f.state[J]===N)return;we({url:new URL(location.href),scroll:re[f.state[J]],keepfocus:!1,redirect_chain:[],details:null,accepted:()=>{N=f.state[J]},blocked:()=>{const _=N-f.state[J];history.go(_)}})}}),addEventListener("hashchange",()=>{_e&&(_e=!1,history.replaceState({...history.state,[J]:++N},"",location.href))})},_hydrate:async({status:a,error:p,nodes:b,params:f,routeId:_})=>{var O;const w=new URL(location.href),$=[];let h={},m,R;try{for(let v=0;v<b.length;v+=1){const S=v===b.length-1;let y;if(S){const E=document.querySelector('script[sveltekit\\:data-type="props"]');E&&(y=JSON.parse(E.textContent))}const g=await Q({module:await de[b[v]](),url:w,params:f,stuff:h,status:S?a:void 0,error:S?p:void 0,props:y,routeId:_});if(y&&(g.uses.dependencies.add(w.href),g.uses.url=!0),$.push(g),g&&g.loaded)if(g.loaded.error){if(p)throw g.loaded.error;R={status:(O=g.loaded.status)!=null?O:500,error:g.loaded.error,url:w,routeId:_}}else g.loaded.stuff&&(h={...h,...g.loaded.stuff})}m=R?await ee(R):await ge({url:w,params:f,stuff:h,branch:$,status:a,error:p,routeId:_})}catch(v){if(p)throw v;m=await ee({status:500,error:je(v),url:w,routeId:_})}m.redirect&&await te(new URL(m.redirect,location.href)),Te(m)}}}async function Dt({paths:r,target:e,session:t,route:o,spa:l,trailing_slash:c,hydrate:d}){const n=Ot({target:e,session:t,base:r.base,trailing_slash:c});ct({client:n}),at(r),d&&await n._hydrate(d),o&&(l&&n.goto(location.href,{replaceState:!0}),n._start_router()),dispatchEvent(new CustomEvent("sveltekit:start"))}export{Dt as start};