5 lines
27 KiB
JavaScript
5 lines
27 KiB
JavaScript
|
import{o as Se,t as ke}from"../chunks/scheduler.k-kUyWhY.js";import{S as ct,a as lt,b as ft,H,N as K,r as ne,o as Ae,P as Oe,f as Qe,g as Re,c as de,i as $e,s as Te,d as q,e as F,h as et,j as bt}from"../chunks/singletons.4aHkxUVP.js";new URL("sveltekit-internal://");function Et(e,a){return e==="/"||a==="ignore"?e:a==="never"?e.endsWith("/")?e.slice(0,-1):e:a==="always"&&!e.endsWith("/")?e+"/":e}function St(e){return e.split("%25").map(decodeURI).join("%25")}function kt(e){for(const a in e)e[a]=decodeURIComponent(e[a]);return e}function Ie({href:e}){return e.split("#")[0]}const At=["href","pathname","search","toString","toJSON"];function Ot(e,a,c){const o=new URL(e);Object.defineProperty(o,"searchParams",{value:new Proxy(o.searchParams,{get(u,f){if(f==="get"||f==="getAll"||f==="has")return l=>(c(l),u[f](l));a();const w=Reflect.get(u,f);return typeof w=="function"?w.bind(u):w}}),enumerable:!0,configurable:!0});for(const u of At)Object.defineProperty(o,u,{get(){return a(),e[u]},enumerable:!0,configurable:!0});return Rt(o),o}function Rt(e){Object.defineProperty(e,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const $t="/__data.json",It=".html__data.json";function Pt(e){return e.endsWith(".html")?e.replace(/\.html$/,It):e.replace(/\/$/,"")+$t}function jt(...e){let a=5381;for(const c of e)if(typeof c=="string"){let o=c.length;for(;o;)a=a*33^c.charCodeAt(--o)}else if(ArrayBuffer.isView(c)){const o=new Uint8Array(c.buffer,c.byteOffset,c.byteLength);let u=o.length;for(;u;)a=a*33^o[--u]}else throw new TypeError("value must be a string or TypedArray");return(a>>>0).toString(36)}const ut=window.fetch;window.fetch=(e,a)=>((e instanceof Request?e.method:a?.method||"GET")!=="GET"&&ae.delete(Ce(e)),ut(e,a));const ae=new Map;function xt(e){const a=atob(e),c=new Uint8Array(a.length);for(let o=0;o<a.length;o++)c[o]=a.charCodeAt(o);return c.buffer}function Lt(e,a){const c=Ce(e,a),o=document.querySelector(c);if(o?.textContent){let{body:u,...f}=JSON.parse(o.textContent);const w=o.getAttribute("data-ttl");return w&&ae.set(c,{body:u,init:f,ttl:1e3*Number(w)}),o.getAttribute("data-b64")!==null&&(u=xt(u)),Promise.resolve(new Response(u,f))}return window.fetch(e,a)}function Nt(e,a,c){if(ae.size>0){const o=Ce(e,c),u=ae.get(o);if(u){if(performance.now()<u.ttl&&["default","force-cache","only-if-cached",void 0].includes(c?.cache))return new Response(u.body,u.init);ae.delete(o)}}return window.fetch(a,c)}function Ce(e,a){let o=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(a?.headers||a?.body){const u=[];a.headers&&u.push([...new Headers(a.headers)].join(",")),a.body&&(typeof a.body=="string"||ArrayBuffer.isView(a.body))&&u.push(a.body),o+=`[data-hash="${jt(...u)}"]`}return o}const Ut=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function Tt(e){const a=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Dt(e).map(o=>{const u=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(o);if(u)return a.push({name:u[1],matcher:u[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const f=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(o);if(f)return a.push({name:f[1],matcher:f[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!o)return;const w=o.split(/\[(.+?)\](?!\])/);return"/"+w.map((g,s)=>{if(s%2){if(g.startsWith("x+"))return Pe(String.fromCharCode(parseInt(g.slice(2),16)));if(g.startsWith("u+"))return Pe(String.fromCharCode(...g.slice(2).split("-").map(O=>parseInt(O,16))));const h=Ut.exec(g);if(!h)throw new Error(`Invalid param: ${g}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,v,I,E,$]=h;return a.push({name:E,matcher:$,optional:!!v,rest:!!I,chained:I?s===1&&w[0]==="":!1}),I?"(.*?)":v?"([^/]*)?":"([^/]+?)"}return Pe(g)}).join("")}).join("")}/?$`),params:a}}function Ct(e){return!/^\([^)]+\)$/.test(e)}function Dt(e){return e.slice(1).split("/").filter(Ct)}function Mt(e,a,c){const o={},u=e.slice(1),f=u.filter(l=>l!==void 0);let w=0;for(let l=0;l<a.length;l+=1){const g=a[l];let s=u[l-w];if(g.chained&&g.rest&&w&&(s=u.slice(l-w,l+1).f
|
||
|
`:return"\\n";case"\r":return"\\r";case" ":return"\\t";case"\b":return"\\b";case"\f":return"\\f";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:return e<" "?`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`:""}}function X(e){let a="",c=0;const o=e.length;for(let u=0;u<o;u+=1){const f=e[u],w=qt(f);w&&(a+=e.slice(c,u)+w,c=u+1)}return`"${c===0?e:a+e.slice(c)}"`}const Me=-1,dt=-2,pt=-3,ht=-4,_t=-5,Fe=-6;function Jt(e,a){return gt(JSON.parse(e),a)}function gt(e,a){if(typeof e=="number")return u(e,!0);if(!Array.isArray(e)||e.length===0)throw new Error("Invalid input");const c=e,o=Array(c.length);function u(f,w=!1){if(f===Me)return;if(f===pt)return NaN;if(f===ht)return 1/0;if(f===_t)return-1/0;if(f===Fe)return-0;if(w)throw new Error("Invalid input");if(f in o)return o[f];const l=c[f];if(!l||typeof l!="object")o[f]=l;else if(Array.isArray(l))if(typeof l[0]=="string"){const g=l[0],s=a?.[g];if(s)return o[f]=s(u(l[1]));switch(g){case"Date":o[f]=new Date(l[1]);break;case"Set":const h=new Set;o[f]=h;for(let E=1;E<l.length;E+=1)h.add(u(l[E]));break;case"Map":const v=new Map;o[f]=v;for(let E=1;E<l.length;E+=2)v.set(u(l[E]),u(l[E+1]));break;case"RegExp":o[f]=new RegExp(l[1],l[2]);break;case"Object":o[f]=Object(l[1]);break;case"BigInt":o[f]=BigInt(l[1]);break;case"null":const I=Object.create(null);o[f]=I;for(let E=1;E<l.length;E+=2)I[l[E]]=u(l[E+1]);break;default:throw new Error(`Unknown type ${g}`)}}else{const g=new Array(l.length);o[f]=g;for(let s=0;s<l.length;s+=1){const h=l[s];h!==dt&&(g[s]=u(h))}}else{const g={};o[f]=g;for(const s in l){const h=l[s];g[s]=u(h)}}return o[f]}return u(0)}function Gt(e,a){const c=[],o=new Map,u=[];for(const s in a)u.push({key:s,fn:a[s]});const f=[];let w=0;function l(s){if(typeof s=="function")throw new xe("Cannot stringify a function",f);if(o.has(s))return o.get(s);if(s===void 0)return Me;if(Number.isNaN(s))return pt;if(s===1/0)return ht;if(s===-1/0)return _t;if(s===0&&1/s<0)return Fe;const h=w++;o.set(s,h);for(const{key:I,fn:E}of u){const $=E(s);if($)return c[h]=`["${I}",${l($)}]`,h}let v="";if(tt(s))v=Le(s);else switch(Ht(s)){case"Number":case"String":case"Boolean":v=`["Object",${Le(s)}]`;break;case"BigInt":v=`["BigInt",${s}]`;break;case"Date":v=`["Date","${s.toISOString()}"]`;break;case"RegExp":const{source:E,flags:$}=s;v=$?`["RegExp",${X(E)},"${$}"]`:`["RegExp",${X(E)}]`;break;case"Array":v="[";for(let O=0;O<s.length;O+=1)O>0&&(v+=","),O in s?(f.push(`[${O}]`),v+=l(s[O]),f.pop()):v+=dt;v+="]";break;case"Set":v='["Set"';for(const O of s)v+=`,${l(O)}`;v+="]";break;case"Map":v='["Map"';for(const[O,D]of s)f.push(`.get(${tt(O)?Le(O):"..."})`),v+=`,${l(O)},${l(D)}`;v+="]";break;default:if(!Bt(s))throw new xe("Cannot stringify arbitrary non-POJOs",f);if(Object.getOwnPropertySymbols(s).length>0)throw new xe("Cannot stringify POJOs with symbolic keys",f);if(Object.getPrototypeOf(s)===null){v='["null"';for(const O in s)f.push(`.${O}`),v+=`,${X(O)},${l(s[O])}`,f.pop();v+="]"}else{v="{";let O=!1;for(const D in s)O&&(v+=","),O=!0,f.push(`.${D}`),v+=`${X(D)}:${l(s[D])}`,f.pop();v+="}"}}return c[h]=v,h}const g=l(e);return g<0?`${g}`:`[${c.join(",")}]`}function Le(e){const a=typeof e;return a==="string"?X(e):e instanceof String?X(e.toString()):e===void 0?Me.toString():e===0&&1/e<0?Fe.toString():a==="bigint"?`["BigInt","${e}"]`:String(e)}const mt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...mt];const Kt=new Set([...mt]);[...Kt];function Yt(e){return e.filter(a=>a!=null)}class _e{constructor(a,c){this.status=a,typeof c=="string"?this.body={message:c}:c?this.body=c:this.body={message:`Error: ${a}`}}toString(){return JSON.stringify(this.body)}}class nt{constructor(a,c){this.status=a,this.location=c}}class Ve extends Error{constructor(a,c,o){super(o),this.status=a,this.text=c}}const zt="x-sveltekit-invalidated",Wt="x-sveltekit-trailing-slash";function pe(e){return e instanceof _e||e instanceof Ve?e.status:500}function Xt(e){return e instanceof Ve?e.text:"Internal Error"}const Y=De(ct)??{},re=De(lt,Jt)??{},oe=De(ft)??{},rt=history.pushState,he=history.replaceState;function
|
||
|
`:l.decode(v);;){const I=s.indexOf(`
|
||
|
`);if(I===-1)break;const E=JSON.parse(s.slice(0,I));if(s=s.slice(I+1),E.type==="redirect")return u(E);if(E.type==="data")E.nodes?.forEach($=>{$?.type==="data"&&($.uses=yt($.uses),$.data=g($.data))}),u(E);else if(E.type==="chunk"){const{id:$,data:O,error:D}=E,Z=f.get($);f.delete($),D?Z.reject(g(D)):Z.fulfil(g(O))}}}})}function yt(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??[])}}function Ue(){const e=document.querySelector("[autofocus]");if(e)e.focus();else{const a=document.body,c=a.getAttribute("tabindex");a.tabIndex=-1,a.focus({preventScroll:!0,focusVisible:!1}),c!==null?a.setAttribute("tabindex",c):a.removeAttribute("tabindex");const o=getSelection();if(o&&o.type!=="None"){const u=[];for(let f=0;f<o.rangeCount;f+=1)u.push(o.getRangeAt(f));setTimeout(()=>{if(o.rangeCount===u.length){for(let f=0;f<o.rangeCount;f+=1){const w=u[f],l=o.getRangeAt(f);if(w.commonAncestorContainer!==l.commonAncestorContainer||w.startContainer!==l.startContainer||w.endContainer!==l.endContainer||w.startOffset!==l.startOffset||w.endOffset!==l.endOffset)return}o.removeAllRanges()}})}}}function it(e,a,c,o){let u,f;const w=new Promise((g,s)=>{u=g,f=s});return w.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url},to:c&&{params:a?.params??null,route:{id:a?.route?.id??null},url:c},willUnload:!a,type:o,complete:w},fulfil:u,reject:f}}async function tn(e,a,c){const o=Zt(e,a);bt({client:o}),c?await o._hydrate(c):o.goto(location.href,{replaceState:!0}),o._start_router()}export{tn as start};
|