Files
mermaid-live-editor/_app/immutable/start-371b74df.js
T
2022-09-02 11:46:16 +00:00

2 lines
22 KiB
JavaScript

var Be=Object.defineProperty;var xe=(a,e,t)=>e in a?Be(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var ue=(a,e,t)=>(xe(a,typeof e!="symbol"?e+"":e,t),t);import{S as Je,i as Ke,s as We,a as He,e as q,c as Fe,b as K,g as ne,t as z,d as re,f as B,h as x,j as Me,o as me,k as Ge,l as Ye,m as Xe,n as pe,p as N,q as Qe,r as Ze,u as et,v as H,w as be,x as F,y as M,z as Ue}from"./chunks/index-3a0ec1f8.js";import{g as Ie,f as De,a as Ce,s as J,b as _e,i as tt}from"./chunks/singletons-3510fc51.js";import{_ as X}from"./chunks/preload-helper-aa6bc0ce.js";import{s as nt}from"./chunks/paths-6cd3a76e.js";class ee{constructor(e,t){ue(this,"name","HttpError");ue(this,"stack");this.status=e,this.message=t!=null?t:`Error: ${e}`}toString(){return this.message}}class Ne{constructor(e,t){this.status=e,this.location=t}}function rt(a,e){return a==="/"||e==="ignore"?a:e==="never"?a.endsWith("/")?a.slice(0,-1):a:e==="always"&&!a.endsWith("/")?a+"/":a}function at(a){for(const e in a)a[e]=a[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 a}const st=["href","pathname","search","searchParams","toString","toJSON"];function it(a,e){const t=new URL(a);for(const o of st){let i=t[o];Object.defineProperty(t,o,{get(){return e(),i},enumerable:!0,configurable:!0})}return t[Symbol.for("nodejs.util.inspect.custom")]=(o,i,u)=>u(a,i),ot(t),t}function ot(a){Object.defineProperty(a,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}function lt(a){let e=5381,t=a.length;if(typeof a=="string")for(;t;)e=e*33^a.charCodeAt(--t);else for(;t;)e=e*33^a[--t];return(e>>>0).toString(36)}const te=window.fetch;function ct(a,e){let o=`script[sveltekit\\:data-type="data"][sveltekit\\:data-url=${JSON.stringify(typeof a=="string"?a:a.url)}]`;e&&typeof e.body=="string"&&(o+=`[sveltekit\\:data-body="${lt(e.body)}"]`);const i=document.querySelector(o);if(i&&i.textContent){const{body:u,...n}=JSON.parse(i.textContent);return Promise.resolve(new Response(u,n))}return te(a,e)}const ft=/^(\.\.\.)?(\w+)(?:=(\w+))?$/;function ut(a){const e=[],t=[];let o=!0;if(/\]\[/.test(a))throw new Error(`Invalid route ${a} \u2014 parameters must be separated`);if(Te("[",a)!==Te("]",a))throw new Error(`Invalid route ${a} \u2014 brackets are unbalanced`);return{pattern:a===""?/^\/$/:new RegExp(`^${a.split(/(?:\/|$)/).filter(pt).map((u,n,d)=>{const y=decodeURIComponent(u),m=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(y);if(m)return e.push(m[1]),t.push(m[2]),"(?:/(.*))?";const g=n===d.length-1;return y&&"/"+y.split(/\[(.+?)\]/).map(($,R)=>{if(R%2){const I=ft.exec($);if(!I)throw new Error(`Invalid param: ${$}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,U,G,Y]=I;return e.push(G),t.push(Y),U?"(.*?)":"([^/]+?)"}return g&&$.includes(".")&&(o=!1),$.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 pt(a){return!/^\([^)]+\)$/.test(a)}function dt(a,e,t,o){const i={};for(let u=0;u<e.length;u+=1){const n=e[u],d=t[u],y=a[u+1]||"";if(d){const m=o[d];if(!m)throw new Error(`Missing "${d}" param matcher`);if(!m(y))return}i[n]=y}return i}function Te(a,e){let t=0;for(let o=0;o<e.length;o+=1)e[o]===a&&(t+=1);return t}function ht(a,e,t){return Object.entries(e).map(([i,[u,n,d]])=>{const{pattern:y,names:m,types:g}=ut(i),$={id:i,exec:R=>{const I=y.exec(R);if(I)return dt(I,m,g,t)},errors:[1,...d||[]].map(R=>a[R]),layouts:[0,...n||[]].map(o),leaf:o(u)};return $.errors.length=$.layouts.length=Math.max($.errors.length,$.layouts.length),$});function o(i){const u=i<0;return u&&(i=~i),[u,a[i]]}}function mt(a,e){return new ee(a,e)}function _t(a){let e,t,o;var i=a[0][0];function u(n){return{props:{data:n[1],errors:n[3]}}}return i&&(e=new i(u(a))),{c(){e&&H(e.$$.fragment),t=q()},l(n){e&&be(e.$$.fragment,n),t=q()},m(n,d){e&&F(e,n,d),K(n,t,d),o=!0},p(n,d){const y={};if(d&2&&(y.data=n[1]),d&8&&(y.errors=n[3]),i!==(i=n[0][0])){if(e){ne();const m=e;z(m.$$.fragment,1,0,()=>{M(m,1)}),re()}i?(e=new i(u(n)),H(e.$$.fragment),B(e.$$.fragment,1),F(e,t.parentNode,t)):e=null}else i&&e.$set(y)},i(n){o||(e&&B(e.$$.fragment,n),o=!0)},o(n){e&&z(e.$$.fragment,n),o=!1},d(n){n&&x(t),e&&M(e,n)}}}function gt(a){let e,t,o;var i=a[0][0];function u(n){return{props:{data:n[1],errors:n[3],$$slots:{default:[wt]},$$scope:{ctx:n}}}}return i&&(e=new i(u(a))),{c(){e&&H(e.$$.fragment),t=q()},l(n){e&&be(e.$$.fragment,n),t=q()},m(n,d){e&&F(e,n,d),K(n,t,d),o=!0},p(n,d){const y={};if(d&2&&(y.data=n[1]),d&8&&(y.errors=n[3]),d&525&&(y.$$scope={dirty:d,ctx:n}),i!==(i=n[0][0])){if(e){ne();const m=e;z(m.$$.fragment,1,0,()=>{M(m,1)}),re()}i?(e=new i(u(n)),H(e.$$.fragment),B(e.$$.fragment,1),F(e,t.parentNode,t)):e=null}else i&&e.$set(y)},i(n){o||(e&&B(e.$$.fragment,n),o=!0)},o(n){e&&z(e.$$.fragment,n),o=!1},d(n){n&&x(t),e&&M(e,n)}}}function wt(a){let e,t,o;var i=a[0][1];function u(n){return{props:{data:n[2],errors:n[3]}}}return i&&(e=new i(u(a))),{c(){e&&H(e.$$.fragment),t=q()},l(n){e&&be(e.$$.fragment,n),t=q()},m(n,d){e&&F(e,n,d),K(n,t,d),o=!0},p(n,d){const y={};if(d&4&&(y.data=n[2]),d&8&&(y.errors=n[3]),i!==(i=n[0][1])){if(e){ne();const m=e;z(m.$$.fragment,1,0,()=>{M(m,1)}),re()}i?(e=new i(u(n)),H(e.$$.fragment),B(e.$$.fragment,1),F(e,t.parentNode,t)):e=null}else i&&e.$set(y)},i(n){o||(e&&B(e.$$.fragment,n),o=!0)},o(n){e&&z(e.$$.fragment,n),o=!1},d(n){n&&x(t),e&&M(e,n)}}}function Ve(a){let e,t=a[5]&&qe(a);return{c(){e=Ge("div"),t&&t.c(),this.h()},l(o){e=Ye(o,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=Xe(e);t&&t.l(i),i.forEach(x),this.h()},h(){pe(e,"id","svelte-announcer"),pe(e,"aria-live","assertive"),pe(e,"aria-atomic","true"),N(e,"position","absolute"),N(e,"left","0"),N(e,"top","0"),N(e,"clip","rect(0 0 0 0)"),N(e,"clip-path","inset(50%)"),N(e,"overflow","hidden"),N(e,"white-space","nowrap"),N(e,"width","1px"),N(e,"height","1px")},m(o,i){K(o,e,i),t&&t.m(e,null)},p(o,i){o[5]?t?t.p(o,i):(t=qe(o),t.c(),t.m(e,null)):t&&(t.d(1),t=null)},d(o){o&&x(e),t&&t.d()}}}function qe(a){let e;return{c(){e=Qe(a[6])},l(t){e=Ze(t,a[6])},m(t,o){K(t,e,o)},p(t,o){o&64&&et(e,t[6])},d(t){t&&x(e)}}}function bt(a){let e,t,o,i,u;const n=[gt,_t],d=[];function y(g,$){return g[0][1]?0:1}e=y(a),t=d[e]=n[e](a);let m=a[4]&&Ve(a);return{c(){t.c(),o=He(),m&&m.c(),i=q()},l(g){t.l(g),o=Fe(g),m&&m.l(g),i=q()},m(g,$){d[e].m(g,$),K(g,o,$),m&&m.m(g,$),K(g,i,$),u=!0},p(g,[$]){let R=e;e=y(g),e===R?d[e].p(g,$):(ne(),z(d[R],1,1,()=>{d[R]=null}),re(),t=d[e],t?t.p(g,$):(t=d[e]=n[e](g),t.c()),B(t,1),t.m(o.parentNode,o)),g[4]?m?m.p(g,$):(m=Ve(g),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null)},i(g){u||(B(t),u=!0)},o(g){z(t),u=!1},d(g){d[e].d(g),g&&x(o),m&&m.d(g),g&&x(i)}}}function yt(a,e,t){let{stores:o}=e,{page:i}=e,{components:u}=e,{data_0:n=null}=e,{data_1:d=null}=e,{errors:y}=e;Me(o.page.notify);let m=!1,g=!1,$=null;return me(()=>{const R=o.page.subscribe(()=>{m&&(t(5,g=!0),t(6,$=document.title||"untitled page"))});return t(4,m=!0),R}),a.$$set=R=>{"stores"in R&&t(7,o=R.stores),"page"in R&&t(8,i=R.page),"components"in R&&t(0,u=R.components),"data_0"in R&&t(1,n=R.data_0),"data_1"in R&&t(2,d=R.data_1),"errors"in R&&t(3,y=R.errors)},a.$$.update=()=>{a.$$.dirty&384&&o.page.set(i)},[u,n,d,y,m,g,$,o,i]}class vt extends Je{constructor(e){super(),Ke(this,e,yt,bt,We,{stores:7,page:8,components:0,data_0:1,data_1:2,errors:3})}}const kt={},ae=[()=>X(()=>import("./chunks/0-018bf4d5.js"),["chunks/0-018bf4d5.js","components/pages/_layout.svelte-a2025a85.js","assets/+layout-45beedef.css","chunks/index-3a0ec1f8.js","chunks/paths-6cd3a76e.js","chunks/state-82c28781.js","chunks/preload-helper-aa6bc0ce.js","chunks/theme-ca9e6d0b.js"],import.meta.url),()=>X(()=>import("./chunks/1-2313f4bc.js"),["chunks/1-2313f4bc.js","components/error.svelte-d636e048.js","chunks/index-3a0ec1f8.js","chunks/singletons-3510fc51.js","chunks/paths-6cd3a76e.js"],import.meta.url),()=>X(()=>import("./chunks/2-ca4a2f68.js"),["chunks/2-ca4a2f68.js","components/pages/_page.svelte-8cfad916.js","chunks/index-3a0ec1f8.js","chunks/singletons-3510fc51.js","chunks/paths-6cd3a76e.js"],import.meta.url),()=>X(()=>import("./chunks/3-684da8a7.js"),["chunks/3-684da8a7.js","components/pages/edit/_page.svelte-c3ad158f.js","assets/+page-826332b8.css","chunks/index-3a0ec1f8.js","chunks/state-82c28781.js","chunks/preload-helper-aa6bc0ce.js","chunks/theme-ca9e6d0b.js","chunks/view-676f02dc.js","assets/view-0c536ccf.css","chunks/paths-6cd3a76e.js"],import.meta.url),()=>X(()=>import("./chunks/4-3a7ab162.js"),["chunks/4-3a7ab162.js","components/pages/view/_page.svelte-3d4ff5af.js","chunks/index-3a0ec1f8.js","chunks/view-676f02dc.js","assets/view-0c536ccf.css","chunks/state-82c28781.js","chunks/preload-helper-aa6bc0ce.js"],import.meta.url)],Et={"":[2],edit:[3],view:[4]},ze="sveltekit:scroll",V="sveltekit:index",de=ht(ae,Et,kt),ge=ae[0],we=ae[1];ge();we();let Q={};try{Q=JSON.parse(sessionStorage[ze])}catch{}function he(a){Q[a]=_e()}function $t({target:a,base:e,trailing_slash:t}){var je;const o=[],i={id:null,promise:null},u={before_navigate:[],after_navigate:[]};let n={branch:[],error:null,session_id:0,url:null},d=!1,y=!0,m=!1,g=1,$=null,R,I=!0,U=(je=history.state)==null?void 0:je[V];U||(U=Date.now(),history.replaceState({...history.state,[V]:U},"",location.href));const G=Q[U];G&&(history.scrollRestoration="manual",scrollTo(G.x,G.y));let Y=!1,W,ye;async function ve(r,{noscroll:c=!1,replaceState:f=!1,keepfocus:s=!1,state:l={}},k){if(typeof r=="string"&&(r=new URL(r,Ie(document))),I)return le({url:r,scroll:c?_e():null,keepfocus:s,redirect_chain:k,details:{state:l,replaceState:f},accepted:()=>{},blocked:()=>{}});await T(r)}async function ke(r){const c=Le(r);if(!c)throw new Error("Attempted to prefetch a URL that does not belong to this app");return i.promise=Re(c),i.id=c.id,i.promise}async function Ee(r,c,f,s){var b,S,L;const l=Le(r),k=ye={};let p=l&&await Re(l);if(!p&&r.origin===location.origin&&r.pathname===location.pathname&&(p=await oe({status:404,error:new Error(`Not found: ${r.pathname}`),url:r,routeId:null})),!p)return await T(r),!1;if(r=(l==null?void 0:l.url)||r,ye!==k)return!1;if(o.length=0,p.type==="redirect")if(c.length>10||c.includes(r.pathname))p=await oe({status:500,error:new Error("Redirect loop"),url:r,routeId:null});else return I?ve(new URL(p.location,r).href,{},[...c,r.pathname]):await T(new URL(p.location,location.href)),!1;else((S=(b=p.props)==null?void 0:b.page)==null?void 0:S.status)>=400&&await J.updated.check()&&await T(r);if(m=!0,f&&f.details){const{details:v}=f,P=v.replaceState?0:1;v.state[V]=U+=P,history[v.replaceState?"replaceState":"pushState"](v.state,"",r)}if(d?(n=p.state,p.props.page&&(p.props.page.url=r),R.$set(p.props)):$e(p),f){const{scroll:v,keepfocus:P}=f;if(!P){const w=document.body,O=w.getAttribute("tabindex");w.tabIndex=-1,w.focus({preventScroll:!0}),setTimeout(()=>{var h;(h=getSelection())==null||h.removeAllRanges()}),O!==null?w.setAttribute("tabindex",O):w.removeAttribute("tabindex")}if(await Ue(),y){const w=r.hash&&document.getElementById(r.hash.slice(1));v?scrollTo(v.x,v.y):w?w.scrollIntoView():scrollTo(0,0)}}else await Ue();i.promise=null,i.id=null,y=!0,p.props.page&&(W=p.props.page);const E=p.state.branch[p.state.branch.length-1];I=((L=E==null?void 0:E.node.shared)==null?void 0:L.router)!==!1,s&&s(),m=!1}function $e(r){n=r.state;const c=document.querySelector("style[data-sveltekit]");if(c&&c.remove(),W=r.props.page,R=new vt({target:a,props:{...r.props,stores:J},hydrate:!0}),I){const f={from:null,to:new URL(location.href)};u.after_navigate.forEach(s=>s(f))}d=!0}async function Z({url:r,params:c,branch:f,status:s,error:l,routeId:k,validation_errors:p}){var P;const E=f.filter(Boolean),b={type:"loaded",state:{url:r,params:c,branch:f,error:l,session_id:g},props:{components:E.map(w=>w.node.component),errors:p}};let S={},L=!W;for(let w=0;w<E.length;w+=1){const O=E[w];S={...S,...O.data},(L||!n.branch.some(h=>h===O))&&(b.props[`data_${w}`]=S,L=L||Object.keys((P=O.data)!=null?P:{}).length>0)}if(L||(L=Object.keys(W.data).length!==Object.keys(S).length),!n.url||r.href!==n.url.href||n.error!==l||L){b.props.page={error:l,params:c,routeId:k,status:s,url:r,data:L?S:W.data};const w=(O,h)=>{Object.defineProperty(b.props.page,O,{get:()=>{throw new Error(`$page.${O} has been replaced by $page.url.${h}`)}})};w("origin","origin"),w("path","pathname"),w("query","searchParams")}return b}async function se({loader:r,parent:c,url:f,params:s,routeId:l,server_data_node:k}){var S,L,v,P,w;let p=null;const E={dependencies:new Set,params:new Set,parent:!1,url:!1},b=await r();if((S=b.shared)!=null&&S.load){let O=function(..._){for(const j of _){const{href:D}=new URL(j,f);E.dependencies.add(D)}};const h={};for(const _ in s)Object.defineProperty(h,_,{get(){return E.params.add(_),s[_]},enumerable:!0});const A={routeId:l,params:h,data:(L=k==null?void 0:k.data)!=null?L:null,url:it(f,()=>{E.url=!0}),async fetch(_,j){let D;typeof _=="string"?D=_:(D=_.url,j={body:_.method==="GET"||_.method==="HEAD"?void 0:await _.blob(),cache:_.cache,credentials:_.credentials,headers:_.headers,integrity:_.integrity,keepalive:_.keepalive,method:_.method,mode:_.mode,redirect:_.redirect,referrer:_.referrer,referrerPolicy:_.referrerPolicy,signal:_.signal,...j});const C=new URL(D,f).href;return O(C),d?te(C,j):ct(D,j)},setHeaders:()=>{},depends:O,parent(){return E.parent=!0,c()}};Object.defineProperties(A,{props:{get(){throw new Error("@migration task: Replace `props` with `data` stuff https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292693")},enumerable:!1},session:{get(){throw new Error("session is no longer available. See https://github.com/sveltejs/kit/discussions/5883")},enumerable:!1},stuff:{get(){throw new Error("@migration task: Remove stuff https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292693")},enumerable:!1}}),p=(v=await b.shared.load.call(null,A))!=null?v:null}return{node:b,loader:r,server:k,shared:(P=b.shared)!=null&&P.load?{type:"data",data:p,uses:E}:null,data:(w=p!=null?p:k==null?void 0:k.data)!=null?w:null}}function Se(r,c,f){if(!f)return!1;if(f.parent&&c||r.url&&f.url)return!0;for(const s of r.params)if(f.params.has(s))return!0;for(const s of f.dependencies)if(o.some(l=>l(s)))return!0;return!1}function ie(r,c){var f,s;return(r==null?void 0:r.type)==="data"?{type:"data",data:r.data,uses:{dependencies:new Set((f=r.uses.dependencies)!=null?f:[]),params:new Set((s=r.uses.params)!=null?s:[]),parent:!!r.uses.parent,url:!!r.uses.url}}:(r==null?void 0:r.type)==="skip"&&c!=null?c:null}async function Re({id:r,url:c,params:f,route:s}){if(i.id===r&&i.promise)return i.promise;const{errors:l,layouts:k,leaf:p}=s,E=n.url&&{url:r!==n.url.pathname+n.url.search,params:Object.keys(f).filter(h=>n.params[h]!==f[h])},b=[...k,p];l.forEach(h=>h==null?void 0:h().catch(()=>{})),b.forEach(h=>h==null?void 0:h[1]().catch(()=>{}));let S=null;const L=b.reduce((h,A,_)=>{var C;const j=n.branch[_],D=!!(A!=null&&A[0])&&((j==null?void 0:j.loader)!==A[1]||Se(E,h.some(Boolean),(C=j.server)==null?void 0:C.uses));return h.push(D),h},[]);if(L.some(Boolean)){try{const h=await te(`${c.pathname}${c.pathname.endsWith("/")?"":"/"}__data.json${c.search}`,{headers:{"x-sveltekit-invalidated":L.map(A=>A?"1":"").join(",")}});if(S=await h.json(),!h.ok)throw S}catch{T(c);return}if(S.type==="redirect")return S}const v=S==null?void 0:S.nodes;let P=!1;const w=b.map(async(h,A)=>{var ce,Oe;if(!h)return;const _=n.branch[A],j=(ce=v==null?void 0:v[A])!=null?ce:null;if((!j||j.type==="skip")&&h[1]===(_==null?void 0:_.loader)&&!Se(E,P,(Oe=_.shared)==null?void 0:Oe.uses))return _;if(P=!0,(j==null?void 0:j.type)==="error")throw j.httperror?mt(j.httperror.status,j.httperror.message):j.error;return se({loader:h[1],url:c,params:f,routeId:s.id,parent:async()=>{var Ae;const Pe={};for(let fe=0;fe<A;fe+=1)Object.assign(Pe,(Ae=await w[fe])==null?void 0:Ae.data);return Pe},server_data_node:ie(j,_==null?void 0:_.server)})});for(const h of w)h.catch(()=>{});const O=[];for(let h=0;h<b.length;h+=1)if(b[h])try{O.push(await w[h])}catch(A){const _=A;if(_ instanceof Ne)return{type:"redirect",location:_.location};const j=A instanceof ee?A.status:500;for(;h--;)if(l[h]){let D,C=h;for(;!O[C];)C-=1;try{return D={node:await l[h](),loader:l[h],data:{},server:null,shared:null},await Z({url:c,params:f,branch:O.slice(0,C+1).concat(D),status:j,error:_,routeId:s.id})}catch{continue}}T(c);return}else O.push(void 0);return await Z({url:c,params:f,branch:O,status:200,error:null,routeId:s.id})}async function oe({status:r,error:c,url:f,routeId:s}){var S;const l={},k=await ge();let p=null;if(k.server){const L=await te(`${f.pathname}${f.pathname.endsWith("/")?"":"/"}__data.json${f.search}`,{headers:{"x-sveltekit-invalidated":"1"}}),v=await L.json();if(p=(S=v==null?void 0:v[0])!=null?S:null,!L.ok||(v==null?void 0:v.type)!=="data"){T(f);return}}const E=await se({loader:ge,url:f,params:l,routeId:s,parent:()=>Promise.resolve({}),server_data_node:ie(p)}),b={node:await we(),loader:we,shared:null,server:null,data:null};return await Z({url:f,params:l,branch:[E,b],status:r,error:c,routeId:s})}function Le(r){if(r.origin!==location.origin||!r.pathname.startsWith(e))return;const c=decodeURI(r.pathname.slice(e.length)||"/");for(const f of de){const s=f.exec(c);if(s){const l=new URL(r.origin+rt(r.pathname,t)+r.search+r.hash);return{id:l.pathname+l.search,route:f,params:at(s),url:l}}}}async function le({url:r,scroll:c,keepfocus:f,redirect_chain:s,details:l,accepted:k,blocked:p}){const E=n.url;let b=!1;const S={from:E,to:r,cancel:()=>b=!0};if(u.before_navigate.forEach(L=>L(S)),b){p();return}he(U),k(),d&&J.navigating.set({from:n.url,to:r}),await Ee(r,s,{scroll:c,keepfocus:f,details:l},()=>{const L={from:E,to:r};u.after_navigate.forEach(v=>v(L)),J.navigating.set(null)})}function T(r){return location.href=r.href,new Promise(()=>{})}return{after_navigate:r=>{me(()=>(u.after_navigate.push(r),()=>{const c=u.after_navigate.indexOf(r);u.after_navigate.splice(c,1)}))},before_navigate:r=>{me(()=>(u.before_navigate.push(r),()=>{const c=u.before_navigate.indexOf(r);u.before_navigate.splice(c,1)}))},disable_scroll_handling:()=>{(m||!d)&&(y=!1)},goto:(r,c={})=>ve(r,c,[]),invalidate:r=>{var c,f;if(r===void 0){for(const s of n.branch)(c=s==null?void 0:s.server)==null||c.uses.dependencies.add(""),(f=s==null?void 0:s.shared)==null||f.uses.dependencies.add("");o.push(()=>!0)}else if(typeof r=="function")o.push(r);else{const{href:s}=new URL(r,location.href);o.push(l=>l===s)}return $||($=Promise.resolve().then(async()=>{await Ee(new URL(location.href),[]),$=null})),$},prefetch:async r=>{const c=new URL(r,Ie(document));await ke(c)},prefetch_routes:async r=>{const f=(r?de.filter(s=>r.some(l=>s.exec(l))):de).map(s=>Promise.all([...s.layouts,s.leaf].map(l=>l==null?void 0:l[1]())));await Promise.all(f)},_start_router:()=>{history.scrollRestoration="manual",addEventListener("beforeunload",s=>{let l=!1;const k={from:n.url,to:null,cancel:()=>l=!0};u.before_navigate.forEach(p=>p(k)),l?(s.preventDefault(),s.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){he(U);try{sessionStorage[ze]=JSON.stringify(Q)}catch{}}});const r=s=>{const l=De(s);l&&l.href&&l.hasAttribute("sveltekit:prefetch")&&ke(Ce(l))};let c;const f=s=>{clearTimeout(c),c=setTimeout(()=>{var l;(l=s.target)==null||l.dispatchEvent(new CustomEvent("sveltekit:trigger_prefetch",{bubbles:!0}))},20)};addEventListener("touchstart",r),addEventListener("mousemove",f),addEventListener("sveltekit:trigger_prefetch",r),addEventListener("click",s=>{if(!I||s.button||s.which!==1||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.defaultPrevented)return;const l=De(s);if(!l||!l.href)return;const k=l instanceof SVGAElement,p=Ce(l);if(!k&&!(p.protocol==="https:"||p.protocol==="http:"))return;const E=(l.getAttribute("rel")||"").split(/\s+/);if(l.hasAttribute("download")||E.includes("external")||l.hasAttribute("sveltekit:reload")||(k?l.target.baseVal:l.target))return;const[b,S]=p.href.split("#");if(S!==void 0&&b===location.href.split("#")[0]){Y=!0,he(U),J.page.set({...W,url:p}),J.page.notify();return}le({url:p,scroll:l.hasAttribute("sveltekit:noscroll")?_e():null,keepfocus:!1,redirect_chain:[],details:{state:{},replaceState:p.href===location.href},accepted:()=>s.preventDefault(),blocked:()=>s.preventDefault()})}),addEventListener("popstate",s=>{if(s.state&&I){if(s.state[V]===U)return;le({url:new URL(location.href),scroll:Q[s.state[V]],keepfocus:!1,redirect_chain:[],details:null,accepted:()=>{U=s.state[V]},blocked:()=>{const l=U-s.state[V];history.go(l)}})}}),addEventListener("hashchange",()=>{Y&&(Y=!1,history.replaceState({...history.state,[V]:++U},"",location.href))});for(const s of document.querySelectorAll("link"))s.rel==="icon"&&(s.href=s.href);addEventListener("pageshow",s=>{s.persisted&&J.navigating.set(null)})},_hydrate:async({status:r,error:c,node_ids:f,params:s,routeId:l})=>{const k=new URL(location.href);let p;try{const E=(v,P)=>{const w=document.querySelector(`script[sveltekit\\:data-type="${v}"]`);return w!=null&&w.textContent?JSON.parse(w.textContent):P},b=E("server_data",[]),S=E("validation_errors",void 0),L=f.map(async(v,P)=>se({loader:ae[v],url:k,params:s,routeId:l,parent:async()=>{const w={};for(let O=0;O<P;O+=1)Object.assign(w,(await L[O]).data);return w},server_data_node:ie(b[P])}));p=await Z({url:k,params:s,branch:await Promise.all(L),status:r,error:c!=null&&c.__is_http_error?new ee(c.status,c.message):c,validation_errors:S,routeId:l})}catch(E){const b=E;if(b instanceof Ne){await T(new URL(E.location,location.href));return}p=await oe({status:b instanceof ee?b.status:500,error:b,url:k,routeId:l})}$e(p)}}}function Pt(a){}async function At({paths:a,target:e,route:t,spa:o,trailing_slash:i,hydrate:u}){const n=$t({target:e,base:a.base,trailing_slash:i});tt({client:n}),nt(a),u&&await n._hydrate(u),t&&(o&&n.goto(location.href,{replaceState:!0}),n._start_router()),dispatchEvent(new CustomEvent("sveltekit:start"))}export{Pt as set_public_env,At as start};