@jamesmddoyle/phantom 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # PHANTOM
2
+
3
+ [![npm version](https://img.shields.io/npm/v/%40jamesmddoyle%2Fphantom?color=5e4d8a)](https://www.npmjs.com/package/@jamesmddoyle/phantom)
4
+
5
+ Phantom is a low-level API mocker and traffic inspector. Built using raw Node.js TCP sockets. It includes a built in dashboard for real-time monitoring and route configuration.
6
+
7
+ ## Features
8
+
9
+ - **Traffic Inspector**: View request and response headers, bodies, and latency in a real-time feed.
10
+ - **Chaos Engine**: Injected artificial delays and random error rates on a per-route basis.
11
+ - **Deep Search**: Filter request history by path, method, or content within the body.
12
+ - **Self-Contained**: The server serves both the mock API and the static dashboard UI on a single port.
13
+ - **Binary Support**: Capability to handle and serve binary assets like images.
14
+
15
+ ## Installation
16
+
17
+ Install Phantom via npm:
18
+
19
+ ```bash
20
+ npm i @jamesmddoyle/phantom
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ Run Phantom in any directory. It will look for a `routes.json` file by default.
26
+
27
+ ## CLI Options
28
+
29
+ - `--port`: The port to run the server on (default: 3001).
30
+ - `--config`: Custom path to a routes JSON file.
31
+ - `--delay`: Global latency override in milliseconds.
32
+ - `--error-rate`: Global failure rate override (0.0 to 1.0).
33
+
34
+ ## Route Configuration
35
+
36
+ Example `routes.json` structure:
37
+
38
+ ```json
39
+ [
40
+ {
41
+ "path": "/api/users",
42
+ "method": "GET",
43
+ "status": 200,
44
+ "body": { "id": 1, "name": "Phantom User" },
45
+ "enabled": true,
46
+ "delay": 500,
47
+ "errorRate": 0.1
48
+ }
49
+ ]
50
+ ```
51
+
52
+ ## Commands
53
+
54
+ - `make dev`: Run the dashboard and server in development mode.
55
+ - `make build`: Build both projects for production.
56
+ - `make run`: Run the production build locally.
57
+ - `make test`: Run server-side tests.
@@ -0,0 +1 @@
1
+ import{bp as be,ad as A,g as U,R as T,ac as ee,bq as dt}from"./Bj1t19nj.js";import{o as je}from"./DHt6uv_5.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 Se{constructor(t,n){this.status=t,this.location=n}}class Ee extends Error{constructor(t,n,a){super(a),this.status=t,this.text=n}}new URL("sveltekit-internal://");function ht(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function pt(e){return e.split("%25").map(decodeURI).join("%25")}function gt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function de({href:e}){return e.split("#")[0]}function _t(...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 mt(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 vt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&F.delete(Re(e)),vt(e,t));const F=new Map;function wt(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&&F.set(n,{body:r,init:i,ttl:1e3*Number(o)}),a.getAttribute("data-b64")!==null&&(r=mt(r)),Promise.resolve(new Response(r,i))}return window.fetch(e,t)}function yt(e,t,n){if(F.size>0){const a=Re(e,n),r=F.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);F.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="${_t(...r)}"]`}return a}const bt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function kt(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Et(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((l,c)=>{if(c%2){if(l.startsWith("x+"))return he(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return he(String.fromCharCode(...l.slice(2).split("-").map(m=>parseInt(m,16))));const f=bt.exec(l),[,h,v,u,p]=f;return t.push({name:u,matcher:p,optional:!!h,rest:!!v,chained:v?c===1&&o[0]==="":!1}),v?"([^]*?)":h?"([^/]*)?":"([^/]+?)"}return he(l)}).join("")}).join("")}/?$`),params:t}}function St(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Et(e){return e.slice(1).split("/").filter(St)}function Rt(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 l=t[s];let c=r[s-o];if(l.chained&&l.rest&&o&&(c=r.slice(s-o,s+1).filter(f=>f).join("/"),o=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){a[l.name]=c;const f=t[s+1],h=r[s+1];f&&!f.rest&&f.optional&&h&&l.chained&&(o=0),!f&&!h&&Object.keys(a).length===i.length&&(o=0);continue}if(l.optional&&l.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 xt({nodes:e,server_loads:t,dictionary:n,matchers:a}){const r=new Set(t);return Object.entries(n).map(([s,[l,c,f]])=>{const{pattern:h,params:v}=kt(s),u={id:s,exec:p=>{const m=h.exec(p);if(m)return Rt(m,v,a)},errors:[1,...f||[]].map(p=>e[p]),layouts:[0,...c||[]].map(o),leaf:i(l)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function i(s){const l=s<0;return l&&(s=~s),[l,e[s]]}function o(s){return s===void 0?s:[r.has(s),e[s]]}}function Fe(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Ne(e,t,n=JSON.stringify){const a=n(t);try{sessionStorage[e]=a}catch{}}const x=globalThis.__sveltekit_6gv8fy?.base??"",Lt=globalThis.__sveltekit_6gv8fy?.assets??x??"",At="1772475994684",Ge="sveltekit:snapshot",We="sveltekit:scroll",Ye="sveltekit:states",Ut="sveltekit:pageurl",B="sveltekit:history",W="sveltekit:navigation",j={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},xe=location.origin;function ze(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 q(){return{x:pageXOffset,y:pageYOffset}}function V(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const qe={...j,"":j.hover};function He(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Je(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=He(e)}}function _e(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||ce(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 te(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=He(s);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:qe[a??"off"],preload_data:qe[r??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(o)}}function De(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(l=>{(s===void 0||n&&l!==s)&&o(s=l)})}return{notify:a,set:r,subscribe:i}}const Xe={v:()=>{}};function Tt(){const{set:e,subscribe:t}=be(!1);let n;async function a(){clearTimeout(n);try{const r=await fetch(`${Lt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const o=(await r.json()).version!==At;return o&&(e(!0),Xe.v(),clearTimeout(n)),o}catch{return!1}}return{subscribe:t,check:a}}function ce(e,t,n){return e.origin!==xe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function rn(e){}const Qe=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...Qe];const It=new Set([...Qe]);[...It];function Ot(e){return e.filter(t=>t!=null)}function Le(e){return e instanceof ke||e instanceof Ee?e.status:500}function Pt(e){return e instanceof Ee?e.text:"Internal Error"}let k,Y,pe;const $t=je.toString().includes("$$")||/function \w+\(\) \{\}/.test(je.toString());$t?(k={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},Y={current:null},pe={current:!1}):(k=new class{#e=A({});get data(){return U(this.#e)}set data(t){T(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){T(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){T(this.#n,t)}#a=A({});get params(){return U(this.#a)}set params(t){T(this.#a,t)}#r=A({id:null});get route(){return U(this.#r)}set route(t){T(this.#r,t)}#o=A({});get state(){return U(this.#o)}set state(t){T(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){T(this.#s,t)}#i=A(new URL("https://example.com"));get url(){return U(this.#i)}set url(t){T(this.#i,t)}},Y=new class{#e=A(null);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},pe=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},Xe.v=()=>pe.current=!0);function Ct(e){Object.assign(k,e)}const jt=new Set(["icon","shortcut icon","apple-touch-icon"]),C=Fe(We)??{},z=Fe(Ge)??{},$={url:De({}),page:De({}),navigating:be(null),updated:Tt()};function Ae(e){C[e]=q()}function Nt(e,t){let n=e+1;for(;C[n];)delete C[n],n+=1;for(n=t+1;z[n];)delete z[n],n+=1}function H(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function Ze(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(x||"/");e&&await e.update()}}function Ve(){}let Ue,me,ne,I,ve,y;const ae=[],re=[];let L=null;function we(){L?.fork?.then(e=>e?.discard()),L=null}const Z=new Map,et=new Set,qt=new Set,G=new Set;let _={branch:[],error:null,url:null},tt=!1,oe=!1,Be=!0,J=!1,M=!1,nt=!1,Te=!1,at,w,R,N;const se=new Set,Ke=new Map;async function cn(e,t,n){globalThis.__sveltekit_6gv8fy?.data&&globalThis.__sveltekit_6gv8fy.data,document.URL!==location.href&&(location.href=location.href),y=e,await e.hooks.init?.(),Ue=xt(e),I=document.documentElement,ve=t,me=e.nodes[0],ne=e.nodes[1],me(),ne(),w=history.state?.[B],R=history.state?.[W],w||(w=R=Date.now(),history.replaceState({...history.state,[B]:w,[W]:R},""));const a=C[w];function r(){a&&(history.scrollRestoration="manual",scrollTo(a.x,a.y))}n?(r(),await Qt(ve,n)):(await K({type:"enter",url:ze(y.hash?tn(new URL(location.href)):location.href),replace_state:!0}),r()),Xt()}function Dt(){ae.length=0,Te=!1}function rt(e){re.some(t=>t?.snapshot)&&(z[e]=re.map(t=>t?.snapshot?.capture()))}function ot(e){z[e]?.forEach((t,n)=>{re[n]?.snapshot?.restore(t)})}function Me(){Ae(w),Ne(We,C),rt(R),Ne(Ge,z)}async function Vt(e,t,n,a){let r;t.invalidateAll&&we(),await K({type:"goto",url:ze(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=[...Ke.keys()]),t.invalidate&&t.invalidate.forEach(Jt)}}),t.invalidateAll&&ee().then(ee).then(()=>{Ke.forEach(({resource:i},o)=>{r?.includes(o)&&i.refresh?.()})})}async function Bt(e){if(e.id!==L?.id){we();const t={};se.add(t),L={id:e.id,token:t,promise:it({...e,preload:t}).then(n=>(se.delete(t),n.type==="loaded"&&n.state.error&&we(),n)),fork:null}}return L.promise}async function ge(e){const t=(await ue(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(n=>n[1]()))}async function st(e,t,n){_=e.state;const a=document.querySelector("style[data-sveltekit]");if(a&&a.remove(),Object.assign(k,e.props.page),at=new y.root({target:t,props:{...e.props,stores:$,components:re},hydrate:n,sync:!1}),await Promise.resolve(),ot(R),n){const r={from:null,to:{params:_.params,route:{id:_.route?.id??null},url:new URL(location.href),scroll:C[w]??q()},willUnload:!1,type:"enter",complete:Promise.resolve()};G.forEach(i=>i(r))}oe=!0}function ie({url:e,params:t,branch:n,status:a,error:r,route:i,form:o}){let s="never";if(x&&(e.pathname===x||e.pathname===x+"/"))s="always";else for(const u of n)u?.slash!==void 0&&(s=u.slash);e.pathname=ht(e.pathname,s),e.search=e.search;const l={type:"loaded",state:{url:e,params:t,branch:n,error:r,route:i},props:{constructors:Ot(n).map(u=>u.node.component),page:Ce(k)}};o!==void 0&&(l.props.form=o);let c={},f=!k,h=0;for(let u=0;u<Math.max(n.length,_.branch.length);u+=1){const p=n[u],m=_.branch[u];p?.data!==m?.data&&(f=!0),p&&(c={...c,...p.data},f&&(l.props[`data_${h}`]=c),h+=1)}return(!_.url||e.href!==_.url.href||_.error!==r||o!==void 0&&o!==k.form||f)&&(l.props.page={error:r,params:t,route:{id:i?.id??null},state:{},status:a,url:new URL(e),form:o??null,data:f?c:k.data}),l}async function Ie({loader:e,parent:t,url:n,params:a,route:r,server_data_node:i}){let o=null;const s={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();return{node:l,loader:e,server:i,universal:l.universal?.load?{type:"data",data:o,uses:s}:null,data:o??i?.data??null,slash:l.universal?.trailingSlash??i?.slash}}function Kt(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=oe?yt(a,r.href,t):wt(a,t);return{resolved:r,promise:i}}function Mt(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(ae.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 Ft(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 Gt({error:e,url:t,route:n,params:a}){return{type:"loaded",state:{error:e,url:t,route:n,params:a,branch:[]},props:{page:Ce(k),constructors:[]}}}async function it({id:e,invalidating:t,url:n,params:a,route:r,preload:i}){if(L?.id===e)return se.delete(L.token),L.promise;const{errors:o,layouts:s,leaf:l}=r,c=[...s,l];o.forEach(g=>g?.().catch(()=>{})),c.forEach(g=>g?.[1]().catch(()=>{}));const f=_.url?e!==le(_.url):!1,h=_.route?r.id!==_.route.id:!1,v=Ft(_.url,n);let u=!1;const p=c.map(async(g,d)=>{if(!g)return;const S=_.branch[d];return g[1]===S?.loader&&!Mt(u,h,f,v,S.universal?.uses,a)?S:(u=!0,Ie({loader:g[1],url:n,params:a,route:r,parent:async()=>{const O={};for(let P=0;P<d;P+=1)Object.assign(O,(await p[P])?.data);return O},server_data_node:Oe(g[0]?{type:"skip"}:null,g[0]?S?.server:void 0)}))});for(const g of p)g.catch(()=>{});const m=[];for(let g=0;g<c.length;g+=1)if(c[g])try{m.push(await p[g])}catch(d){if(d instanceof Se)return{type:"redirect",location:d.location};if(se.has(i))return Gt({error:await X(d,{params:a,url:n,route:{id:r.id}}),url:n,params:a,route:r});let S=Le(d),E;if(d instanceof ke)E=d.body;else{if(await $.updated.check())return await Ze(),await H(n);E=await X(d,{params:a,url:n,route:{id:r.id}})}const O=await Wt(g,m,o);return O?ie({url:n,params:a,branch:m.slice(0,O.idx).concat(O.node),status:S,error:E,route:r}):await ct(n,{id:r.id},E,S)}else m.push(void 0);return ie({url:n,params:a,branch:m,status:200,error:null,route:r,form:t?void 0:null})}async function Wt(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 Pe({status:e,error:t,url:n,route:a}){const r={};let i=null;try{const o=await Ie({loader:me,url:n,params:r,route:a,parent:()=>Promise.resolve({}),server_data_node:Oe(i)}),s={node:await ne(),loader:ne,universal:null,server:null,data:null};return ie({url:n,params:r,branch:[o,s],status:e,error:t,route:null})}catch(o){if(o instanceof Se)return Vt(new URL(o.location,location.href),{},0);throw o}}async function Yt(e){const t=e.href;if(Z.has(t))return Z.get(t);let n;try{const a=(async()=>{let r=await y.hooks.reroute({url:new URL(e),fetch:async(i,o)=>Kt(i,o,e).promise})??e;if(typeof r=="string"){const i=new URL(e);y.hash?i.hash=r:i.pathname=r,r=i}return r})();Z.set(t,a),n=await a}catch{Z.delete(t);return}return n}async function ue(e,t){if(e&&!ce(e,x,y.hash)){const n=await Yt(e);if(!n)return;const a=zt(n);for(const r of Ue){const i=r.exec(a);if(i)return{id:le(e),invalidating:t,route:r,params:gt(i),url:e}}}}function zt(e){return pt(y.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(x.length))||"/"}function le(e){return(y.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function lt({url:e,type:t,intent:n,delta:a,event:r,scroll:i}){let o=!1;const s=$e(_,n,e,t,i??null);a!==void 0&&(s.navigation.delta=a),r!==void 0&&(s.navigation.event=r);const l={...s.navigation,cancel:()=>{o=!0,s.reject(new Error("navigation cancelled"))}};return J||et.forEach(c=>c(l)),o?null:s}async function K({type:e,url:t,popped:n,keepfocus:a,noscroll:r,replace_state:i,state:o={},redirect_count:s=0,nav_token:l={},accept:c=Ve,block:f=Ve,event:h}){const v=N;N=l;const u=await ue(t,!1),p=e==="enter"?$e(_,u,t,e):lt({url:t,type:e,delta:n?.delta,intent:u,scroll:n?.scroll,event:h});if(!p){f(),N===l&&(N=v);return}const m=w,g=R;c(),J=!0,oe&&p.navigation.type!=="enter"&&$.navigating.set(Y.current=p.navigation);let d=u&&await it(u);if(!d){if(ce(t,x,y.hash))return await H(t,i);d=await ct(t,{id:null},await X(new Ee(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=u?.url||t,N!==l)return p.reject(new Error("navigation aborted")),!1;if(d.type==="redirect"){if(s<20){await K({type:e,url:new URL(d.location,t),popped:n,keepfocus:a,noscroll:r,replace_state:i,state:o,redirect_count:s+1,nav_token:l}),p.fulfil(void 0);return}d=await Pe({status:500,error:await X(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else d.props.page.status>=400&&await $.updated.check()&&(await Ze(),await H(t,i));if(Dt(),Ae(m),rt(g),d.props.page.url.pathname!==t.pathname&&(t.pathname=d.props.page.url.pathname),o=n?n.state:o,!n){const b=i?0:1,Q={[B]:w+=b,[W]:R+=b,[Ye]:o};(i?history.replaceState:history.pushState).call(history,Q,"",t),i||Nt(w,R)}const S=u&&L?.id===u.id?L.fork:null;L=null,d.props.page.state=o;let E;if(oe){const b=(await Promise.all(Array.from(qt,D=>D(p.navigation)))).filter(D=>typeof D=="function");if(b.length>0){let D=function(){b.forEach(fe=>{G.delete(fe)})};b.push(D),b.forEach(fe=>{G.add(fe)})}_=d.state,d.props.page&&(d.props.page.url=t);const Q=S&&await S;Q?E=Q.commit():(at.$set(d.props),Ct(d.props.page),E=dt?.()),nt=!0}else await st(d,ve,!1);const{activeElement:O}=document;await E,await ee(),await ee();let P=null;if(Be){const b=n?n.scroll:r?q():null;b?scrollTo(b.x,b.y):(P=t.hash&&document.getElementById(ut(t)))?P.scrollIntoView():scrollTo(0,0)}const ft=document.activeElement!==O&&document.activeElement!==document.body;!a&&!ft&&en(t,!P),Be=!0,d.props.page&&Object.assign(k,d.props.page),J=!1,e==="popstate"&&ot(R),p.fulfil(void 0),p.navigation.to&&(p.navigation.to.scroll=q()),G.forEach(b=>b(p.navigation)),$.navigating.set(Y.current=null)}async function ct(e,t,n,a,r){return e.origin===xe&&e.pathname===location.pathname&&!tt?await Pe({status:a,error:n,url:e,route:t}):await H(e,r)}function Ht(){let e,t={element:void 0,href:void 0},n;I.addEventListener("mousemove",s=>{const l=s.target;clearTimeout(e),e=setTimeout(()=>{i(l,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 l of s)l.isIntersecting&&(ge(new URL(l.target.href)),r.unobserve(l.target))},{threshold:0});async function i(s,l){const c=Je(s,I),f=c===t.element&&c?.href===t.href&&l>=n;if(!c||f)return;const{url:h,external:v,download:u}=_e(c,x,y.hash);if(v||u)return;const p=te(c),m=h&&le(_.url)===le(h);if(!(p.reload||m))if(l<=p.preload_data){t={element:c,href:c.href},n=j.tap;const g=await ue(h,!1);if(!g)return;Bt(g)}else l<=p.preload_code&&(t={element:c,href:c.href},n=l,ge(h))}function o(){r.disconnect();for(const s of I.querySelectorAll("a")){const{url:l,external:c,download:f}=_e(s,x,y.hash);if(c||f)continue;const h=te(s);h.reload||(h.preload_code===j.viewport&&r.observe(s),h.preload_code===j.eager&&ge(l))}}G.add(o),o()}function X(e,t){if(e instanceof ke)return e.body;const n=Le(e),a=Pt(e);return y.hooks.handleError({error:e,event:t,status:n,message:a})??{message:a}}function Jt(e){if(typeof e=="function")ae.push(e);else{const{href:t}=new URL(e,location.href);ae.push(n=>n.href===t)}}function Xt(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Me(),!J){const a=$e(_,void 0,null,"leave"),r={...a.navigation,cancel:()=>{n=!0,a.reject(new Error("navigation cancelled"))}};et.forEach(i=>i(r))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Me()}),navigator.connection?.saveData||Ht(),I.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=Je(t.composedPath()[0],I);if(!n)return;const{url:a,external:r,target:i,download:o}=_e(n,x,y.hash);if(!a)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const s=te(n);if(!(n instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||o)return;const[c,f]=(y.hash?a.hash.replace(/^#/,""):a.href).split("#"),h=c===de(location);if(r||s.reload&&(!h||!f)){lt({url:a,type:"link",event:t})?J=!0:t.preventDefault();return}if(f!==void 0&&h){const[,v]=_.url.href.split("#");if(v===f){if(t.preventDefault(),f===""||f==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const u=n.ownerDocument.getElementById(decodeURIComponent(f));u&&(u.scrollIntoView(),u.focus())}return}if(M=!0,Ae(w),e(a),!s.replace_state)return;M=!1}t.preventDefault(),await new Promise(v=>{requestAnimationFrame(()=>{setTimeout(v,0)}),setTimeout(v,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(ce(o,x,!1))return;const s=t.target,l=te(s);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(s,a);o.search=new URLSearchParams(c).toString(),K({type:"form",url:o,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.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===w)return;const a=C[n],r=t.state[Ye]??{},i=new URL(t.state[Ut]??location.href),o=t.state[W],s=_.url?de(location)===de(_.url):!1;if(o===R&&(nt||s)){r!==k.state&&(k.state=r),e(i),C[w]=q(),a&&scrollTo(a.x,a.y),w=n;return}const c=n-w;await K({type:"popstate",url:i,popped:{state:r,scroll:a,delta:c},accept:()=>{w=n,R=o},block:()=>{history.go(-c)},nav_token:N,event:t})}else if(!M){const n=new URL(location.href);e(n),y.hash&&location.reload()}}}),addEventListener("hashchange",()=>{M&&(M=!1,history.replaceState({...history.state,[B]:++w,[W]:R},"",location.href))});for(const t of document.querySelectorAll("link"))jt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&$.navigating.set(Y.current=null)});function e(t){_.url=k.url=t,$.page.set(Ce(k)),$.page.notify()}}async function Qt(e,{status:t=200,error:n,node_ids:a,params:r,route:i,server_route:o,data:s,form:l}){tt=!0;const c=new URL(location.href);let f;({params:r={},route:i={id:null}}=await ue(c,!1)||{}),f=Ue.find(({id:u})=>u===i.id);let h,v=!0;try{const u=a.map(async(m,g)=>{const d=s[g];return d?.uses&&(d.uses=Zt(d.uses)),Ie({loader:y.nodes[m],url:c,params:r,route:i,parent:async()=>{const S={};for(let E=0;E<g;E+=1)Object.assign(S,(await u[E]).data);return S},server_data_node:Oe(d)})}),p=await Promise.all(u);if(f){const m=f.layouts;for(let g=0;g<m.length;g++)m[g]||p.splice(g,0,void 0)}h=ie({url:c,params:r,branch:p,status:t,error:n,form:l,route:f??null})}catch(u){if(u instanceof Se){await H(new URL(u.location,location.href));return}h=await Pe({status:Le(u),error:await X(u,{url:c,params:r,route:i}),url:c,route:i}),e.textContent="",v=!1}h.props.page&&(h.props.page.state={}),await st(h,e,v)}function Zt(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 en(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const a=ut(e);if(a&&document.getElementById(a)){const{x:i,y:o}=q();setTimeout(()=>{const s=history.state;ye=!0,location.replace(new URL(`#${a}`,location.href)),history.replaceState(s,"",e),t&&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],l=r.getRangeAt(o);if(s.commonAncestorContainer!==l.commonAncestorContainer||s.startContainer!==l.startContainer||s.endContainer!==l.endContainer||s.startOffset!==l.startOffset||s.endOffset!==l.endOffset)return}r.removeAllRanges()}})}}}function $e(e,t,n,a,r=null){let i,o;const s=new Promise((c,f)=>{i=c,o=f});return s.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:q()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:r},willUnload:!t,type:a,complete:s},fulfil:i,reject:o}}function Ce(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 tn(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function ut(e){let t;if(y.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{cn as a,rn as l,k as p,$ as s};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.CnuSotPZ.js","../chunks/DUglripS.js","../chunks/Bj1t19nj.js","../chunks/DHt6uv_5.js","../chunks/BWM6cuy1.js","../chunks/CG6hkJ2r.js","../chunks/Mkbhf_NF.js","../assets/index.BkcWggqo.css","../assets/0.qdgu5uXf.css","../nodes/1.U9Wsfz4H.js","../chunks/BfCPr1xz.js","../nodes/2.wYRnMaww.js","../assets/2.NbOPcGNK.css"])))=>i.map(i=>d[i]);
2
- import{y as N,D as z,C as G,E as J,F as K,I as W,J as Q,K as D,H as X,z as Z,a8 as $,a9 as tt,a as et,aa as rt,a5 as st,R as O,a6 as at,g as d,ab as nt,M as ot,O as ct,p as it,b as ut,u as lt,ac as ft,i as w,s as dt,j as ht,ad as S,k as mt,m as _t,t as vt,ae as T}from"../chunks/Bj1t19nj.js";import{h as gt,m as yt,u as Et,a as P,c as x,f as q,t as bt,s as Pt}from"../chunks/DUglripS.js";import{o as Rt}from"../chunks/DHt6uv_5.js";import{B as kt,p as A,i as j}from"../chunks/BWM6cuy1.js";function C(s,t,a){var i;N&&(i=Z,z());var n=new kt(s);G(()=>{var e=t()??null;if(N){var r=K(i),o=r===X,E=e!==null;if(o!==E){var h=W();Q(h),n.anchor=h,D(!1),n.ensure(e,e&&(c=>a(c,e))),D(!0);return}}n.ensure(e,e&&(c=>a(c,e)))},J)}function I(s,t){return s===t||s?.[st]===t}function L(s={},t,a,i){return $(()=>{var n,e;return tt(()=>{n=e,e=[],et(()=>{s!==a(...e)&&(t(s,...e),n&&I(a(...n),s)&&t(null,...n))})}),()=>{rt(()=>{e&&I(a(...e),s)&&t(null,...e)})}}),s}function wt(s){return class extends Ot{constructor(t){super({component:s,...t})}}}class Ot{#e;#t;constructor(t){var a=new Map,i=(e,r)=>{var o=ct(r,!1,!1);return a.set(e,o),o};const n=new Proxy({...t.props||{},$$events:{}},{get(e,r){return d(a.get(r)??i(r,Reflect.get(e,r)))},has(e,r){return r===at?!0:(d(a.get(r)??i(r,Reflect.get(e,r))),Reflect.has(e,r))},set(e,r,o){return O(a.get(r)??i(r,o),o),Reflect.set(e,r,o)}});this.#t=(t.hydrate?gt:yt)(t.component,{target:t.target,anchor:t.anchor,props:n,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError}),(!t?.props?.$$host||t.sync===!1)&&nt(),this.#e=n.$$events;for(const e of Object.keys(this.#t))e==="$set"||e==="$destroy"||e==="$on"||ot(this,e,{get(){return this.#t[e]},set(r){this.#t[e]=r},enumerable:!0});this.#t.$set=e=>{Object.assign(n,e)},this.#t.$destroy=()=>{Et(this.#t)}}$set(t){this.#t.$set(t)}$on(t,a){this.#e[t]=this.#e[t]||[];const i=(...n)=>a.call(this,...n);return this.#e[t].push(i),()=>{this.#e[t]=this.#e[t].filter(n=>n!==i)}}$destroy(){this.#t.$destroy()}}const St="modulepreload",Tt=function(s,t){return new URL(s,t).href},B={},p=function(t,a,i){let n=Promise.resolve();if(a&&a.length>0){let h=function(c){return Promise.all(c.map(f=>Promise.resolve(f).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};const r=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),E=o?.nonce||o?.getAttribute("nonce");n=h(a.map(c=>{if(c=Tt(c,i),c in B)return;B[c]=!0;const f=c.endsWith(".css"),m=f?'[rel="stylesheet"]':"";if(i)for(let _=r.length-1;_>=0;_--){const u=r[_];if(u.href===c&&(!f||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${m}`))return;const l=document.createElement("link");if(l.rel=f?"stylesheet":St,f||(l.as="script"),l.crossOrigin="",l.href=c,E&&l.setAttribute("nonce",E),document.head.appendChild(l),f)return new Promise((_,u)=>{l.addEventListener("load",_),l.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${c}`)))})}))}function e(r){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=r,window.dispatchEvent(o),!o.defaultPrevented)throw r}return n.then(r=>{for(const o of r||[])o.status==="rejected"&&e(o.reason);return t().catch(e)})},It={};var xt=q('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),At=q("<!> <!>",1);function jt(s,t){it(t,!0);let a=A(t,"components",23,()=>[]),i=A(t,"data_0",3,null),n=A(t,"data_1",3,null);ut(()=>t.stores.page.set(t.page)),lt(()=>{t.stores,t.page,t.constructors,a(),t.form,i(),n(),t.stores.page.notify()});let e=S(!1),r=S(!1),o=S(null);Rt(()=>{const u=t.stores.page.subscribe(()=>{d(e)&&(O(r,!0),ft().then(()=>{O(o,document.title||"untitled page",!0)}))});return O(e,!0),u});const E=T(()=>t.constructors[1]);var h=At(),c=w(h);{var f=u=>{const v=T(()=>t.constructors[0]);var g=x(),R=w(g);C(R,()=>d(v),(y,b)=>{L(b(y,{get data(){return i()},get form(){return t.form},get params(){return t.page.params},children:(k,Lt)=>{var M=x(),V=w(M);C(V,()=>d(E),(Y,H)=>{L(H(Y,{get data(){return n()},get form(){return t.form},get params(){return t.page.params}}),U=>a()[1]=U,()=>a()?.[1])}),P(k,M)},$$slots:{default:!0}}),k=>a()[0]=k,()=>a()?.[0])}),P(u,g)},m=u=>{const v=T(()=>t.constructors[0]);var g=x(),R=w(g);C(R,()=>d(v),(y,b)=>{L(b(y,{get data(){return i()},get form(){return t.form},get params(){return t.page.params}}),k=>a()[0]=k,()=>a()?.[0])}),P(u,g)};j(c,u=>{t.constructors[1]?u(f):u(m,!1)})}var l=dt(c,2);{var _=u=>{var v=xt(),g=mt(v);{var R=y=>{var b=bt();vt(()=>Pt(b,d(o))),P(y,b)};j(g,y=>{d(r)&&y(R)})}_t(v),P(u,v)};j(l,u=>{d(e)&&u(_)})}P(s,h),ht()}const Bt=wt(jt),qt=[()=>p(()=>import("../nodes/0.CnuSotPZ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>p(()=>import("../nodes/1.U9Wsfz4H.js"),__vite__mapDeps([9,1,2,6,10,3]),import.meta.url),()=>p(()=>import("../nodes/2.wYRnMaww.js"),__vite__mapDeps([11,1,2,4,5,6,7,12]),import.meta.url)],Ft=[],Vt={"/":[2]},F={handleError:(({error:s})=>{console.error(s)}),reroute:(()=>{}),transport:{}},Ct=Object.fromEntries(Object.entries(F.transport).map(([s,t])=>[s,t.decode])),Yt=Object.fromEntries(Object.entries(F.transport).map(([s,t])=>[s,t.encode])),Ht=!1,Ut=(s,t)=>Ct[s](t);export{Ut as decode,Ct as decoders,Vt as dictionary,Yt as encoders,Ht as hash,F as hooks,It as matchers,qt as nodes,Bt as root,Ft as server_loads};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.CnuSotPZ.js","../chunks/DUglripS.js","../chunks/Bj1t19nj.js","../chunks/DHt6uv_5.js","../chunks/BWM6cuy1.js","../chunks/CG6hkJ2r.js","../chunks/Mkbhf_NF.js","../assets/index.BkcWggqo.css","../assets/0.qdgu5uXf.css","../nodes/1.D3cq8P48.js","../chunks/T8p1hvv1.js","../nodes/2.wYRnMaww.js","../assets/2.NbOPcGNK.css"])))=>i.map(i=>d[i]);
2
+ import{y as N,D as z,C as G,E as J,F as K,I as W,J as Q,K as D,H as X,z as Z,a8 as $,a9 as tt,a as et,aa as rt,a5 as st,R as O,a6 as at,g as d,ab as nt,M as ot,O as ct,p as it,b as ut,u as lt,ac as ft,i as w,s as dt,j as ht,ad as S,k as mt,m as _t,t as vt,ae as T}from"../chunks/Bj1t19nj.js";import{h as gt,m as yt,u as Et,a as P,c as x,f as q,t as bt,s as Pt}from"../chunks/DUglripS.js";import{o as Rt}from"../chunks/DHt6uv_5.js";import{B as kt,p as A,i as j}from"../chunks/BWM6cuy1.js";function C(s,t,a){var i;N&&(i=Z,z());var n=new kt(s);G(()=>{var e=t()??null;if(N){var r=K(i),o=r===X,E=e!==null;if(o!==E){var h=W();Q(h),n.anchor=h,D(!1),n.ensure(e,e&&(c=>a(c,e))),D(!0);return}}n.ensure(e,e&&(c=>a(c,e)))},J)}function I(s,t){return s===t||s?.[st]===t}function L(s={},t,a,i){return $(()=>{var n,e;return tt(()=>{n=e,e=[],et(()=>{s!==a(...e)&&(t(s,...e),n&&I(a(...n),s)&&t(null,...n))})}),()=>{rt(()=>{e&&I(a(...e),s)&&t(null,...e)})}}),s}function wt(s){return class extends Ot{constructor(t){super({component:s,...t})}}}class Ot{#e;#t;constructor(t){var a=new Map,i=(e,r)=>{var o=ct(r,!1,!1);return a.set(e,o),o};const n=new Proxy({...t.props||{},$$events:{}},{get(e,r){return d(a.get(r)??i(r,Reflect.get(e,r)))},has(e,r){return r===at?!0:(d(a.get(r)??i(r,Reflect.get(e,r))),Reflect.has(e,r))},set(e,r,o){return O(a.get(r)??i(r,o),o),Reflect.set(e,r,o)}});this.#t=(t.hydrate?gt:yt)(t.component,{target:t.target,anchor:t.anchor,props:n,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError}),(!t?.props?.$$host||t.sync===!1)&&nt(),this.#e=n.$$events;for(const e of Object.keys(this.#t))e==="$set"||e==="$destroy"||e==="$on"||ot(this,e,{get(){return this.#t[e]},set(r){this.#t[e]=r},enumerable:!0});this.#t.$set=e=>{Object.assign(n,e)},this.#t.$destroy=()=>{Et(this.#t)}}$set(t){this.#t.$set(t)}$on(t,a){this.#e[t]=this.#e[t]||[];const i=(...n)=>a.call(this,...n);return this.#e[t].push(i),()=>{this.#e[t]=this.#e[t].filter(n=>n!==i)}}$destroy(){this.#t.$destroy()}}const St="modulepreload",Tt=function(s,t){return new URL(s,t).href},B={},p=function(t,a,i){let n=Promise.resolve();if(a&&a.length>0){let h=function(c){return Promise.all(c.map(f=>Promise.resolve(f).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};const r=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),E=o?.nonce||o?.getAttribute("nonce");n=h(a.map(c=>{if(c=Tt(c,i),c in B)return;B[c]=!0;const f=c.endsWith(".css"),m=f?'[rel="stylesheet"]':"";if(i)for(let _=r.length-1;_>=0;_--){const u=r[_];if(u.href===c&&(!f||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${m}`))return;const l=document.createElement("link");if(l.rel=f?"stylesheet":St,f||(l.as="script"),l.crossOrigin="",l.href=c,E&&l.setAttribute("nonce",E),document.head.appendChild(l),f)return new Promise((_,u)=>{l.addEventListener("load",_),l.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${c}`)))})}))}function e(r){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=r,window.dispatchEvent(o),!o.defaultPrevented)throw r}return n.then(r=>{for(const o of r||[])o.status==="rejected"&&e(o.reason);return t().catch(e)})},It={};var xt=q('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),At=q("<!> <!>",1);function jt(s,t){it(t,!0);let a=A(t,"components",23,()=>[]),i=A(t,"data_0",3,null),n=A(t,"data_1",3,null);ut(()=>t.stores.page.set(t.page)),lt(()=>{t.stores,t.page,t.constructors,a(),t.form,i(),n(),t.stores.page.notify()});let e=S(!1),r=S(!1),o=S(null);Rt(()=>{const u=t.stores.page.subscribe(()=>{d(e)&&(O(r,!0),ft().then(()=>{O(o,document.title||"untitled page",!0)}))});return O(e,!0),u});const E=T(()=>t.constructors[1]);var h=At(),c=w(h);{var f=u=>{const v=T(()=>t.constructors[0]);var g=x(),R=w(g);C(R,()=>d(v),(y,b)=>{L(b(y,{get data(){return i()},get form(){return t.form},get params(){return t.page.params},children:(k,Lt)=>{var M=x(),V=w(M);C(V,()=>d(E),(Y,H)=>{L(H(Y,{get data(){return n()},get form(){return t.form},get params(){return t.page.params}}),U=>a()[1]=U,()=>a()?.[1])}),P(k,M)},$$slots:{default:!0}}),k=>a()[0]=k,()=>a()?.[0])}),P(u,g)},m=u=>{const v=T(()=>t.constructors[0]);var g=x(),R=w(g);C(R,()=>d(v),(y,b)=>{L(b(y,{get data(){return i()},get form(){return t.form},get params(){return t.page.params}}),k=>a()[0]=k,()=>a()?.[0])}),P(u,g)};j(c,u=>{t.constructors[1]?u(f):u(m,!1)})}var l=dt(c,2);{var _=u=>{var v=xt(),g=mt(v);{var R=y=>{var b=bt();vt(()=>Pt(b,d(o))),P(y,b)};j(g,y=>{d(r)&&y(R)})}_t(v),P(u,v)};j(l,u=>{d(e)&&u(_)})}P(s,h),ht()}const Bt=wt(jt),qt=[()=>p(()=>import("../nodes/0.CnuSotPZ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>p(()=>import("../nodes/1.D3cq8P48.js"),__vite__mapDeps([9,1,2,6,10,3]),import.meta.url),()=>p(()=>import("../nodes/2.wYRnMaww.js"),__vite__mapDeps([11,1,2,4,5,6,7,12]),import.meta.url)],Ft=[],Vt={"/":[2]},F={handleError:(({error:s})=>{console.error(s)}),reroute:(()=>{}),transport:{}},Ct=Object.fromEntries(Object.entries(F.transport).map(([s,t])=>[s,t.decode])),Yt=Object.fromEntries(Object.entries(F.transport).map(([s,t])=>[s,t.encode])),Ht=!1,Ut=(s,t)=>Ct[s](t);export{Ut as decode,Ct as decoders,Vt as dictionary,Yt as encoders,Ht as hash,F as hooks,It as matchers,qt as nodes,Bt as root,Ft as server_loads};
@@ -0,0 +1 @@
1
+ import{l as o,a as r}from"../chunks/T8p1hvv1.js";export{o as load_css,r as start};
@@ -1 +1 @@
1
- import{a as u,f as h,s as a}from"../chunks/DUglripS.js";import{i as g}from"../chunks/Mkbhf_NF.js";import{p as l,i as v,t as d,j as _,k as e,m as o,s as x}from"../chunks/Bj1t19nj.js";import{s as k,p}from"../chunks/BfCPr1xz.js";const $={get error(){return p.error},get status(){return p.status}};k.updated.check;const m=$;var b=h("<h1> </h1> <p> </p>",1);function y(i,f){l(f,!1),g();var r=b(),t=v(r),n=e(t,!0);o(t);var s=x(t,2),c=e(s,!0);o(s),d(()=>{a(n,m.status),a(c,m.error?.message)}),u(i,r),_()}export{y as component};
1
+ import{a as u,f as h,s as a}from"../chunks/DUglripS.js";import{i as g}from"../chunks/Mkbhf_NF.js";import{p as l,i as v,t as d,j as _,k as e,m as o,s as x}from"../chunks/Bj1t19nj.js";import{s as k,p}from"../chunks/T8p1hvv1.js";const $={get error(){return p.error},get status(){return p.status}};k.updated.check;const m=$;var b=h("<h1> </h1> <p> </p>",1);function y(i,f){l(f,!1),g();var r=b(),t=v(r),n=e(t,!0);o(t);var s=x(t,2),c=e(s,!0);o(s),d(()=>{a(n,m.status),a(c,m.error?.message)}),u(i,r),_()}export{y as component};
@@ -1 +1 @@
1
- {"version":"1772473509001"}
1
+ {"version":"1772475994684"}
@@ -8,11 +8,11 @@
8
8
  href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap"
9
9
  rel="stylesheet"
10
10
  />
11
- <link href="/_app/immutable/entry/start.qmYEGFx1.js" rel="modulepreload">
12
- <link href="/_app/immutable/chunks/BfCPr1xz.js" rel="modulepreload">
11
+ <link href="/_app/immutable/entry/start._1Z5a52H.js" rel="modulepreload">
12
+ <link href="/_app/immutable/chunks/T8p1hvv1.js" rel="modulepreload">
13
13
  <link href="/_app/immutable/chunks/Bj1t19nj.js" rel="modulepreload">
14
14
  <link href="/_app/immutable/chunks/DHt6uv_5.js" rel="modulepreload">
15
- <link href="/_app/immutable/entry/app.C0Uz1Yok.js" rel="modulepreload">
15
+ <link href="/_app/immutable/entry/app.C80n4TC_.js" rel="modulepreload">
16
16
  <link href="/_app/immutable/chunks/DUglripS.js" rel="modulepreload">
17
17
  <link href="/_app/immutable/chunks/BWM6cuy1.js" rel="modulepreload">
18
18
 
@@ -21,15 +21,15 @@
21
21
  <div style="display: contents">
22
22
  <script>
23
23
  {
24
- __sveltekit_1uutb4r = {
24
+ __sveltekit_6gv8fy = {
25
25
  base: ""
26
26
  };
27
27
 
28
28
  const element = document.currentScript.parentElement;
29
29
 
30
30
  Promise.all([
31
- import("/_app/immutable/entry/start.qmYEGFx1.js"),
32
- import("/_app/immutable/entry/app.C0Uz1Yok.js")
31
+ import("/_app/immutable/entry/start._1Z5a52H.js"),
32
+ import("/_app/immutable/entry/app.C80n4TC_.js")
33
33
  ]).then(([kit, app]) => {
34
34
  kit.start(app, element);
35
35
  });
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "phantom",
3
- "version": "0.1.0",
2
+ "name": "@jamesmddoyle/phantom",
3
+ "version": "0.1.1",
4
4
  "description": "API mocker and traffic inspector with a built-in dashboard.",
5
5
  "author": "James Doyle",
6
6
  "license": "MIT",
@@ -8,7 +8,8 @@
8
8
  "phantom": "./dist/index.js"
9
9
  },
10
10
  "files": [
11
- "dist"
11
+ "dist",
12
+ "README.md"
12
13
  ],
13
14
  "type": "module",
14
15
  "scripts": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jamesmddoyle/phantom",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "API mocker and traffic inspector with a built-in dashboard.",
5
5
  "author": "James Doyle",
6
6
  "license": "MIT",
@@ -8,7 +8,8 @@
8
8
  "phantom": "./dist/index.js"
9
9
  },
10
10
  "files": [
11
- "dist"
11
+ "dist",
12
+ "README.md"
12
13
  ],
13
14
  "type": "module",
14
15
  "scripts": {
@@ -1 +0,0 @@
1
- import{bp as be,ad as A,g as U,R as T,ac as ee,bq as dt}from"./Bj1t19nj.js";import{o as je}from"./DHt6uv_5.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 Se{constructor(t,n){this.status=t,this.location=n}}class Ee extends Error{constructor(t,n,a){super(a),this.status=t,this.text=n}}new URL("sveltekit-internal://");function ht(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function pt(e){return e.split("%25").map(decodeURI).join("%25")}function gt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function de({href:e}){return e.split("#")[0]}function _t(...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 mt(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 wt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&F.delete(Re(e)),wt(e,t));const F=new Map;function vt(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&&F.set(n,{body:r,init:i,ttl:1e3*Number(o)}),a.getAttribute("data-b64")!==null&&(r=mt(r)),Promise.resolve(new Response(r,i))}return window.fetch(e,t)}function yt(e,t,n){if(F.size>0){const a=Re(e,n),r=F.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);F.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="${_t(...r)}"]`}return a}const bt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function kt(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Et(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((l,c)=>{if(c%2){if(l.startsWith("x+"))return he(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return he(String.fromCharCode(...l.slice(2).split("-").map(m=>parseInt(m,16))));const f=bt.exec(l),[,h,w,u,p]=f;return t.push({name:u,matcher:p,optional:!!h,rest:!!w,chained:w?c===1&&o[0]==="":!1}),w?"([^]*?)":h?"([^/]*)?":"([^/]+?)"}return he(l)}).join("")}).join("")}/?$`),params:t}}function St(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Et(e){return e.slice(1).split("/").filter(St)}function Rt(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 l=t[s];let c=r[s-o];if(l.chained&&l.rest&&o&&(c=r.slice(s-o,s+1).filter(f=>f).join("/"),o=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){a[l.name]=c;const f=t[s+1],h=r[s+1];f&&!f.rest&&f.optional&&h&&l.chained&&(o=0),!f&&!h&&Object.keys(a).length===i.length&&(o=0);continue}if(l.optional&&l.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 xt({nodes:e,server_loads:t,dictionary:n,matchers:a}){const r=new Set(t);return Object.entries(n).map(([s,[l,c,f]])=>{const{pattern:h,params:w}=kt(s),u={id:s,exec:p=>{const m=h.exec(p);if(m)return Rt(m,w,a)},errors:[1,...f||[]].map(p=>e[p]),layouts:[0,...c||[]].map(o),leaf:i(l)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function i(s){const l=s<0;return l&&(s=~s),[l,e[s]]}function o(s){return s===void 0?s:[r.has(s),e[s]]}}function Fe(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Ne(e,t,n=JSON.stringify){const a=n(t);try{sessionStorage[e]=a}catch{}}const x=globalThis.__sveltekit_1uutb4r?.base??"",Lt=globalThis.__sveltekit_1uutb4r?.assets??x??"",At="1772473509001",Ge="sveltekit:snapshot",We="sveltekit:scroll",Ye="sveltekit:states",Ut="sveltekit:pageurl",B="sveltekit:history",W="sveltekit:navigation",j={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},xe=location.origin;function ze(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 q(){return{x:pageXOffset,y:pageYOffset}}function V(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const qe={...j,"":j.hover};function He(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Je(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=He(e)}}function _e(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||ce(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 te(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=He(s);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:qe[a??"off"],preload_data:qe[r??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(o)}}function De(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(l=>{(s===void 0||n&&l!==s)&&o(s=l)})}return{notify:a,set:r,subscribe:i}}const Xe={v:()=>{}};function Tt(){const{set:e,subscribe:t}=be(!1);let n;async function a(){clearTimeout(n);try{const r=await fetch(`${Lt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const o=(await r.json()).version!==At;return o&&(e(!0),Xe.v(),clearTimeout(n)),o}catch{return!1}}return{subscribe:t,check:a}}function ce(e,t,n){return e.origin!==xe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function rn(e){}const Qe=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...Qe];const It=new Set([...Qe]);[...It];function Ot(e){return e.filter(t=>t!=null)}function Le(e){return e instanceof ke||e instanceof Ee?e.status:500}function Pt(e){return e instanceof Ee?e.text:"Internal Error"}let k,Y,pe;const $t=je.toString().includes("$$")||/function \w+\(\) \{\}/.test(je.toString());$t?(k={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},Y={current:null},pe={current:!1}):(k=new class{#e=A({});get data(){return U(this.#e)}set data(t){T(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){T(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){T(this.#n,t)}#a=A({});get params(){return U(this.#a)}set params(t){T(this.#a,t)}#r=A({id:null});get route(){return U(this.#r)}set route(t){T(this.#r,t)}#o=A({});get state(){return U(this.#o)}set state(t){T(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){T(this.#s,t)}#i=A(new URL("https://example.com"));get url(){return U(this.#i)}set url(t){T(this.#i,t)}},Y=new class{#e=A(null);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},pe=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},Xe.v=()=>pe.current=!0);function Ct(e){Object.assign(k,e)}const jt=new Set(["icon","shortcut icon","apple-touch-icon"]),C=Fe(We)??{},z=Fe(Ge)??{},$={url:De({}),page:De({}),navigating:be(null),updated:Tt()};function Ae(e){C[e]=q()}function Nt(e,t){let n=e+1;for(;C[n];)delete C[n],n+=1;for(n=t+1;z[n];)delete z[n],n+=1}function H(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function Ze(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(x||"/");e&&await e.update()}}function Ve(){}let Ue,me,ne,I,we,y;const ae=[],re=[];let L=null;function ve(){L?.fork?.then(e=>e?.discard()),L=null}const Z=new Map,et=new Set,qt=new Set,G=new Set;let _={branch:[],error:null,url:null},tt=!1,oe=!1,Be=!0,J=!1,M=!1,nt=!1,Te=!1,at,v,R,N;const se=new Set,Ke=new Map;async function cn(e,t,n){globalThis.__sveltekit_1uutb4r?.data&&globalThis.__sveltekit_1uutb4r.data,document.URL!==location.href&&(location.href=location.href),y=e,await e.hooks.init?.(),Ue=xt(e),I=document.documentElement,we=t,me=e.nodes[0],ne=e.nodes[1],me(),ne(),v=history.state?.[B],R=history.state?.[W],v||(v=R=Date.now(),history.replaceState({...history.state,[B]:v,[W]:R},""));const a=C[v];function r(){a&&(history.scrollRestoration="manual",scrollTo(a.x,a.y))}n?(r(),await Qt(we,n)):(await K({type:"enter",url:ze(y.hash?tn(new URL(location.href)):location.href),replace_state:!0}),r()),Xt()}function Dt(){ae.length=0,Te=!1}function rt(e){re.some(t=>t?.snapshot)&&(z[e]=re.map(t=>t?.snapshot?.capture()))}function ot(e){z[e]?.forEach((t,n)=>{re[n]?.snapshot?.restore(t)})}function Me(){Ae(v),Ne(We,C),rt(R),Ne(Ge,z)}async function Vt(e,t,n,a){let r;t.invalidateAll&&ve(),await K({type:"goto",url:ze(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=[...Ke.keys()]),t.invalidate&&t.invalidate.forEach(Jt)}}),t.invalidateAll&&ee().then(ee).then(()=>{Ke.forEach(({resource:i},o)=>{r?.includes(o)&&i.refresh?.()})})}async function Bt(e){if(e.id!==L?.id){ve();const t={};se.add(t),L={id:e.id,token:t,promise:it({...e,preload:t}).then(n=>(se.delete(t),n.type==="loaded"&&n.state.error&&ve(),n)),fork:null}}return L.promise}async function ge(e){const t=(await ue(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(n=>n[1]()))}async function st(e,t,n){_=e.state;const a=document.querySelector("style[data-sveltekit]");if(a&&a.remove(),Object.assign(k,e.props.page),at=new y.root({target:t,props:{...e.props,stores:$,components:re},hydrate:n,sync:!1}),await Promise.resolve(),ot(R),n){const r={from:null,to:{params:_.params,route:{id:_.route?.id??null},url:new URL(location.href),scroll:C[v]??q()},willUnload:!1,type:"enter",complete:Promise.resolve()};G.forEach(i=>i(r))}oe=!0}function ie({url:e,params:t,branch:n,status:a,error:r,route:i,form:o}){let s="never";if(x&&(e.pathname===x||e.pathname===x+"/"))s="always";else for(const u of n)u?.slash!==void 0&&(s=u.slash);e.pathname=ht(e.pathname,s),e.search=e.search;const l={type:"loaded",state:{url:e,params:t,branch:n,error:r,route:i},props:{constructors:Ot(n).map(u=>u.node.component),page:Ce(k)}};o!==void 0&&(l.props.form=o);let c={},f=!k,h=0;for(let u=0;u<Math.max(n.length,_.branch.length);u+=1){const p=n[u],m=_.branch[u];p?.data!==m?.data&&(f=!0),p&&(c={...c,...p.data},f&&(l.props[`data_${h}`]=c),h+=1)}return(!_.url||e.href!==_.url.href||_.error!==r||o!==void 0&&o!==k.form||f)&&(l.props.page={error:r,params:t,route:{id:i?.id??null},state:{},status:a,url:new URL(e),form:o??null,data:f?c:k.data}),l}async function Ie({loader:e,parent:t,url:n,params:a,route:r,server_data_node:i}){let o=null;const s={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();return{node:l,loader:e,server:i,universal:l.universal?.load?{type:"data",data:o,uses:s}:null,data:o??i?.data??null,slash:l.universal?.trailingSlash??i?.slash}}function Kt(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=oe?yt(a,r.href,t):vt(a,t);return{resolved:r,promise:i}}function Mt(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(ae.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 Ft(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 Gt({error:e,url:t,route:n,params:a}){return{type:"loaded",state:{error:e,url:t,route:n,params:a,branch:[]},props:{page:Ce(k),constructors:[]}}}async function it({id:e,invalidating:t,url:n,params:a,route:r,preload:i}){if(L?.id===e)return se.delete(L.token),L.promise;const{errors:o,layouts:s,leaf:l}=r,c=[...s,l];o.forEach(g=>g?.().catch(()=>{})),c.forEach(g=>g?.[1]().catch(()=>{}));const f=_.url?e!==le(_.url):!1,h=_.route?r.id!==_.route.id:!1,w=Ft(_.url,n);let u=!1;const p=c.map(async(g,d)=>{if(!g)return;const S=_.branch[d];return g[1]===S?.loader&&!Mt(u,h,f,w,S.universal?.uses,a)?S:(u=!0,Ie({loader:g[1],url:n,params:a,route:r,parent:async()=>{const O={};for(let P=0;P<d;P+=1)Object.assign(O,(await p[P])?.data);return O},server_data_node:Oe(g[0]?{type:"skip"}:null,g[0]?S?.server:void 0)}))});for(const g of p)g.catch(()=>{});const m=[];for(let g=0;g<c.length;g+=1)if(c[g])try{m.push(await p[g])}catch(d){if(d instanceof Se)return{type:"redirect",location:d.location};if(se.has(i))return Gt({error:await X(d,{params:a,url:n,route:{id:r.id}}),url:n,params:a,route:r});let S=Le(d),E;if(d instanceof ke)E=d.body;else{if(await $.updated.check())return await Ze(),await H(n);E=await X(d,{params:a,url:n,route:{id:r.id}})}const O=await Wt(g,m,o);return O?ie({url:n,params:a,branch:m.slice(0,O.idx).concat(O.node),status:S,error:E,route:r}):await ct(n,{id:r.id},E,S)}else m.push(void 0);return ie({url:n,params:a,branch:m,status:200,error:null,route:r,form:t?void 0:null})}async function Wt(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 Pe({status:e,error:t,url:n,route:a}){const r={};let i=null;try{const o=await Ie({loader:me,url:n,params:r,route:a,parent:()=>Promise.resolve({}),server_data_node:Oe(i)}),s={node:await ne(),loader:ne,universal:null,server:null,data:null};return ie({url:n,params:r,branch:[o,s],status:e,error:t,route:null})}catch(o){if(o instanceof Se)return Vt(new URL(o.location,location.href),{},0);throw o}}async function Yt(e){const t=e.href;if(Z.has(t))return Z.get(t);let n;try{const a=(async()=>{let r=await y.hooks.reroute({url:new URL(e),fetch:async(i,o)=>Kt(i,o,e).promise})??e;if(typeof r=="string"){const i=new URL(e);y.hash?i.hash=r:i.pathname=r,r=i}return r})();Z.set(t,a),n=await a}catch{Z.delete(t);return}return n}async function ue(e,t){if(e&&!ce(e,x,y.hash)){const n=await Yt(e);if(!n)return;const a=zt(n);for(const r of Ue){const i=r.exec(a);if(i)return{id:le(e),invalidating:t,route:r,params:gt(i),url:e}}}}function zt(e){return pt(y.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(x.length))||"/"}function le(e){return(y.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function lt({url:e,type:t,intent:n,delta:a,event:r,scroll:i}){let o=!1;const s=$e(_,n,e,t,i??null);a!==void 0&&(s.navigation.delta=a),r!==void 0&&(s.navigation.event=r);const l={...s.navigation,cancel:()=>{o=!0,s.reject(new Error("navigation cancelled"))}};return J||et.forEach(c=>c(l)),o?null:s}async function K({type:e,url:t,popped:n,keepfocus:a,noscroll:r,replace_state:i,state:o={},redirect_count:s=0,nav_token:l={},accept:c=Ve,block:f=Ve,event:h}){const w=N;N=l;const u=await ue(t,!1),p=e==="enter"?$e(_,u,t,e):lt({url:t,type:e,delta:n?.delta,intent:u,scroll:n?.scroll,event:h});if(!p){f(),N===l&&(N=w);return}const m=v,g=R;c(),J=!0,oe&&p.navigation.type!=="enter"&&$.navigating.set(Y.current=p.navigation);let d=u&&await it(u);if(!d){if(ce(t,x,y.hash))return await H(t,i);d=await ct(t,{id:null},await X(new Ee(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=u?.url||t,N!==l)return p.reject(new Error("navigation aborted")),!1;if(d.type==="redirect"){if(s<20){await K({type:e,url:new URL(d.location,t),popped:n,keepfocus:a,noscroll:r,replace_state:i,state:o,redirect_count:s+1,nav_token:l}),p.fulfil(void 0);return}d=await Pe({status:500,error:await X(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else d.props.page.status>=400&&await $.updated.check()&&(await Ze(),await H(t,i));if(Dt(),Ae(m),rt(g),d.props.page.url.pathname!==t.pathname&&(t.pathname=d.props.page.url.pathname),o=n?n.state:o,!n){const b=i?0:1,Q={[B]:v+=b,[W]:R+=b,[Ye]:o};(i?history.replaceState:history.pushState).call(history,Q,"",t),i||Nt(v,R)}const S=u&&L?.id===u.id?L.fork:null;L=null,d.props.page.state=o;let E;if(oe){const b=(await Promise.all(Array.from(qt,D=>D(p.navigation)))).filter(D=>typeof D=="function");if(b.length>0){let D=function(){b.forEach(fe=>{G.delete(fe)})};b.push(D),b.forEach(fe=>{G.add(fe)})}_=d.state,d.props.page&&(d.props.page.url=t);const Q=S&&await S;Q?E=Q.commit():(at.$set(d.props),Ct(d.props.page),E=dt?.()),nt=!0}else await st(d,we,!1);const{activeElement:O}=document;await E,await ee(),await ee();let P=null;if(Be){const b=n?n.scroll:r?q():null;b?scrollTo(b.x,b.y):(P=t.hash&&document.getElementById(ut(t)))?P.scrollIntoView():scrollTo(0,0)}const ft=document.activeElement!==O&&document.activeElement!==document.body;!a&&!ft&&en(t,!P),Be=!0,d.props.page&&Object.assign(k,d.props.page),J=!1,e==="popstate"&&ot(R),p.fulfil(void 0),p.navigation.to&&(p.navigation.to.scroll=q()),G.forEach(b=>b(p.navigation)),$.navigating.set(Y.current=null)}async function ct(e,t,n,a,r){return e.origin===xe&&e.pathname===location.pathname&&!tt?await Pe({status:a,error:n,url:e,route:t}):await H(e,r)}function Ht(){let e,t={element:void 0,href:void 0},n;I.addEventListener("mousemove",s=>{const l=s.target;clearTimeout(e),e=setTimeout(()=>{i(l,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 l of s)l.isIntersecting&&(ge(new URL(l.target.href)),r.unobserve(l.target))},{threshold:0});async function i(s,l){const c=Je(s,I),f=c===t.element&&c?.href===t.href&&l>=n;if(!c||f)return;const{url:h,external:w,download:u}=_e(c,x,y.hash);if(w||u)return;const p=te(c),m=h&&le(_.url)===le(h);if(!(p.reload||m))if(l<=p.preload_data){t={element:c,href:c.href},n=j.tap;const g=await ue(h,!1);if(!g)return;Bt(g)}else l<=p.preload_code&&(t={element:c,href:c.href},n=l,ge(h))}function o(){r.disconnect();for(const s of I.querySelectorAll("a")){const{url:l,external:c,download:f}=_e(s,x,y.hash);if(c||f)continue;const h=te(s);h.reload||(h.preload_code===j.viewport&&r.observe(s),h.preload_code===j.eager&&ge(l))}}G.add(o),o()}function X(e,t){if(e instanceof ke)return e.body;const n=Le(e),a=Pt(e);return y.hooks.handleError({error:e,event:t,status:n,message:a})??{message:a}}function Jt(e){if(typeof e=="function")ae.push(e);else{const{href:t}=new URL(e,location.href);ae.push(n=>n.href===t)}}function Xt(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Me(),!J){const a=$e(_,void 0,null,"leave"),r={...a.navigation,cancel:()=>{n=!0,a.reject(new Error("navigation cancelled"))}};et.forEach(i=>i(r))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Me()}),navigator.connection?.saveData||Ht(),I.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=Je(t.composedPath()[0],I);if(!n)return;const{url:a,external:r,target:i,download:o}=_e(n,x,y.hash);if(!a)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const s=te(n);if(!(n instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||o)return;const[c,f]=(y.hash?a.hash.replace(/^#/,""):a.href).split("#"),h=c===de(location);if(r||s.reload&&(!h||!f)){lt({url:a,type:"link",event:t})?J=!0:t.preventDefault();return}if(f!==void 0&&h){const[,w]=_.url.href.split("#");if(w===f){if(t.preventDefault(),f===""||f==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const u=n.ownerDocument.getElementById(decodeURIComponent(f));u&&(u.scrollIntoView(),u.focus())}return}if(M=!0,Ae(v),e(a),!s.replace_state)return;M=!1}t.preventDefault(),await new Promise(w=>{requestAnimationFrame(()=>{setTimeout(w,0)}),setTimeout(w,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(ce(o,x,!1))return;const s=t.target,l=te(s);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(s,a);o.search=new URLSearchParams(c).toString(),K({type:"form",url:o,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.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===v)return;const a=C[n],r=t.state[Ye]??{},i=new URL(t.state[Ut]??location.href),o=t.state[W],s=_.url?de(location)===de(_.url):!1;if(o===R&&(nt||s)){r!==k.state&&(k.state=r),e(i),C[v]=q(),a&&scrollTo(a.x,a.y),v=n;return}const c=n-v;await K({type:"popstate",url:i,popped:{state:r,scroll:a,delta:c},accept:()=>{v=n,R=o},block:()=>{history.go(-c)},nav_token:N,event:t})}else if(!M){const n=new URL(location.href);e(n),y.hash&&location.reload()}}}),addEventListener("hashchange",()=>{M&&(M=!1,history.replaceState({...history.state,[B]:++v,[W]:R},"",location.href))});for(const t of document.querySelectorAll("link"))jt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&$.navigating.set(Y.current=null)});function e(t){_.url=k.url=t,$.page.set(Ce(k)),$.page.notify()}}async function Qt(e,{status:t=200,error:n,node_ids:a,params:r,route:i,server_route:o,data:s,form:l}){tt=!0;const c=new URL(location.href);let f;({params:r={},route:i={id:null}}=await ue(c,!1)||{}),f=Ue.find(({id:u})=>u===i.id);let h,w=!0;try{const u=a.map(async(m,g)=>{const d=s[g];return d?.uses&&(d.uses=Zt(d.uses)),Ie({loader:y.nodes[m],url:c,params:r,route:i,parent:async()=>{const S={};for(let E=0;E<g;E+=1)Object.assign(S,(await u[E]).data);return S},server_data_node:Oe(d)})}),p=await Promise.all(u);if(f){const m=f.layouts;for(let g=0;g<m.length;g++)m[g]||p.splice(g,0,void 0)}h=ie({url:c,params:r,branch:p,status:t,error:n,form:l,route:f??null})}catch(u){if(u instanceof Se){await H(new URL(u.location,location.href));return}h=await Pe({status:Le(u),error:await X(u,{url:c,params:r,route:i}),url:c,route:i}),e.textContent="",w=!1}h.props.page&&(h.props.page.state={}),await st(h,e,w)}function Zt(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 en(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const a=ut(e);if(a&&document.getElementById(a)){const{x:i,y:o}=q();setTimeout(()=>{const s=history.state;ye=!0,location.replace(new URL(`#${a}`,location.href)),history.replaceState(s,"",e),t&&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],l=r.getRangeAt(o);if(s.commonAncestorContainer!==l.commonAncestorContainer||s.startContainer!==l.startContainer||s.endContainer!==l.endContainer||s.startOffset!==l.startOffset||s.endOffset!==l.endOffset)return}r.removeAllRanges()}})}}}function $e(e,t,n,a,r=null){let i,o;const s=new Promise((c,f)=>{i=c,o=f});return s.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:q()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:r},willUnload:!t,type:a,complete:s},fulfil:i,reject:o}}function Ce(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 tn(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function ut(e){let t;if(y.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{cn as a,rn as l,k as p,$ as s};
@@ -1 +0,0 @@
1
- import{l as o,a as r}from"../chunks/BfCPr1xz.js";export{o as load_css,r as start};