UNPKG

@coji/journal-mcp

Version:

MCP server for journal entries with web viewer

27 lines 118 kB
var Bt={exports:{}},tt={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var $r;function ga(){if($r)return tt;$r=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(a,n,o){var l=null;if(o!==void 0&&(l=""+o),n.key!==void 0&&(l=""+n.key),"key"in n){o={};for(var s in n)s!=="key"&&(o[s]=n[s])}else o=n;return n=o.ref,{$$typeof:e,type:a,key:l,ref:n!==void 0?n:null,props:o}}return tt.Fragment=t,tt.jsx=r,tt.jsxs=r,tt}var Fr;function wa(){return Fr||(Fr=1,Bt.exports=ga()),Bt.exports}var dl=wa(),Yt={exports:{}},Y={};/** * @license React * react.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var jr;function Ea(){if(jr)return Y;jr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),p=Symbol.iterator;function f(m){return m===null||typeof m!="object"?null:(m=p&&m[p]||m["@@iterator"],typeof m=="function"?m:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,b={};function S(m,L,k){this.props=m,this.context=L,this.refs=b,this.updater=k||g}S.prototype.isReactComponent={},S.prototype.setState=function(m,L){if(typeof m!="object"&&typeof m!="function"&&m!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,m,L,"setState")},S.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function R(){}R.prototype=S.prototype;function A(m,L,k){this.props=m,this.context=L,this.refs=b,this.updater=k||g}var T=A.prototype=new R;T.constructor=A,w(T,S.prototype),T.isPureReactComponent=!0;var M=Array.isArray,x={H:null,A:null,T:null,S:null,V:null},y=Object.prototype.hasOwnProperty;function D(m,L,k,O,W,ee){return k=ee.ref,{$$typeof:e,type:m,key:L,ref:k!==void 0?k:null,props:ee}}function U(m,L){return D(m.type,L,void 0,void 0,void 0,m.props)}function j(m){return typeof m=="object"&&m!==null&&m.$$typeof===e}function K(m){var L={"=":"=0",":":"=2"};return"$"+m.replace(/[=:]/g,function(k){return L[k]})}var ne=/\/+/g;function se(m,L){return typeof m=="object"&&m!==null&&m.key!=null?K(""+m.key):L.toString(36)}function oe(){}function X(m){switch(m.status){case"fulfilled":return m.value;case"rejected":throw m.reason;default:switch(typeof m.status=="string"?m.then(oe,oe):(m.status="pending",m.then(function(L){m.status==="pending"&&(m.status="fulfilled",m.value=L)},function(L){m.status==="pending"&&(m.status="rejected",m.reason=L)})),m.status){case"fulfilled":return m.value;case"rejected":throw m.reason}}throw m}function Q(m,L,k,O,W){var ee=typeof m;(ee==="undefined"||ee==="boolean")&&(m=null);var z=!1;if(m===null)z=!0;else switch(ee){case"bigint":case"string":case"number":z=!0;break;case"object":switch(m.$$typeof){case e:case t:z=!0;break;case c:return z=m._init,Q(z(m._payload),L,k,O,W)}}if(z)return W=W(m),z=O===""?"."+se(m,0):O,M(W)?(k="",z!=null&&(k=z.replace(ne,"$&/")+"/"),Q(W,L,k,"",function($t){return $t})):W!=null&&(j(W)&&(W=U(W,k+(W.key==null||m&&m.key===W.key?"":(""+W.key).replace(ne,"$&/")+"/")+z)),L.push(W)),1;z=0;var Le=O===""?".":O+":";if(M(m))for(var ae=0;ae<m.length;ae++)O=m[ae],ee=Le+se(O,ae),z+=Q(O,L,k,ee,W);else if(ae=f(m),typeof ae=="function")for(m=ae.call(m),ae=0;!(O=m.next()).done;)O=O.value,ee=Le+se(O,ae++),z+=Q(O,L,k,ee,W);else if(ee==="object"){if(typeof m.then=="function")return Q(X(m),L,k,O,W);throw L=String(m),Error("Objects are not valid as a React child (found: "+(L==="[object Object]"?"object with keys {"+Object.keys(m).join(", ")+"}":L)+"). If you meant to render a collection of children, use an array instead.")}return z}function G(m,L,k){if(m==null)return m;var O=[],W=0;return Q(m,O,"","",function(ee){return L.call(k,ee,W++)}),O}function ue(m){if(m._status===-1){var L=m._result;L=L(),L.then(function(k){(m._status===0||m._status===-1)&&(m._status=1,m._result=k)},function(k){(m._status===0||m._status===-1)&&(m._status=2,m._result=k)}),m._status===-1&&(m._status=0,m._result=L)}if(m._status===1)return m._result.default;throw m._result}var de=typeof reportError=="function"?reportError:function(m){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var L=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof m=="object"&&m!==null&&typeof m.message=="string"?String(m.message):String(m),error:m});if(!window.dispatchEvent(L))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",m);return}console.error(m)};function ce(){}return Y.Children={map:G,forEach:function(m,L,k){G(m,function(){L.apply(this,arguments)},k)},count:function(m){var L=0;return G(m,function(){L++}),L},toArray:function(m){return G(m,function(L){return L})||[]},only:function(m){if(!j(m))throw Error("React.Children.only expected to receive a single React element child.");return m}},Y.Component=S,Y.Fragment=r,Y.Profiler=n,Y.PureComponent=A,Y.StrictMode=a,Y.Suspense=i,Y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=x,Y.__COMPILER_RUNTIME={__proto__:null,c:function(m){return x.H.useMemoCache(m)}},Y.cache=function(m){return function(){return m.apply(null,arguments)}},Y.cloneElement=function(m,L,k){if(m==null)throw Error("The argument must be a React element, but you passed "+m+".");var O=w({},m.props),W=m.key,ee=void 0;if(L!=null)for(z in L.ref!==void 0&&(ee=void 0),L.key!==void 0&&(W=""+L.key),L)!y.call(L,z)||z==="key"||z==="__self"||z==="__source"||z==="ref"&&L.ref===void 0||(O[z]=L[z]);var z=arguments.length-2;if(z===1)O.children=k;else if(1<z){for(var Le=Array(z),ae=0;ae<z;ae++)Le[ae]=arguments[ae+2];O.children=Le}return D(m.type,W,void 0,void 0,ee,O)},Y.createContext=function(m){return m={$$typeof:l,_currentValue:m,_currentValue2:m,_threadCount:0,Provider:null,Consumer:null},m.Provider=m,m.Consumer={$$typeof:o,_context:m},m},Y.createElement=function(m,L,k){var O,W={},ee=null;if(L!=null)for(O in L.key!==void 0&&(ee=""+L.key),L)y.call(L,O)&&O!=="key"&&O!=="__self"&&O!=="__source"&&(W[O]=L[O]);var z=arguments.length-2;if(z===1)W.children=k;else if(1<z){for(var Le=Array(z),ae=0;ae<z;ae++)Le[ae]=arguments[ae+2];W.children=Le}if(m&&m.defaultProps)for(O in z=m.defaultProps,z)W[O]===void 0&&(W[O]=z[O]);return D(m,ee,void 0,void 0,null,W)},Y.createRef=function(){return{current:null}},Y.forwardRef=function(m){return{$$typeof:s,render:m}},Y.isValidElement=j,Y.lazy=function(m){return{$$typeof:c,_payload:{_status:-1,_result:m},_init:ue}},Y.memo=function(m,L){return{$$typeof:u,type:m,compare:L===void 0?null:L}},Y.startTransition=function(m){var L=x.T,k={};x.T=k;try{var O=m(),W=x.S;W!==null&&W(k,O),typeof O=="object"&&O!==null&&typeof O.then=="function"&&O.then(ce,de)}catch(ee){de(ee)}finally{x.T=L}},Y.unstable_useCacheRefresh=function(){return x.H.useCacheRefresh()},Y.use=function(m){return x.H.use(m)},Y.useActionState=function(m,L,k){return x.H.useActionState(m,L,k)},Y.useCallback=function(m,L){return x.H.useCallback(m,L)},Y.useContext=function(m){return x.H.useContext(m)},Y.useDebugValue=function(){},Y.useDeferredValue=function(m,L){return x.H.useDeferredValue(m,L)},Y.useEffect=function(m,L,k){var O=x.H;if(typeof k=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return O.useEffect(m,L)},Y.useId=function(){return x.H.useId()},Y.useImperativeHandle=function(m,L,k){return x.H.useImperativeHandle(m,L,k)},Y.useInsertionEffect=function(m,L){return x.H.useInsertionEffect(m,L)},Y.useLayoutEffect=function(m,L){return x.H.useLayoutEffect(m,L)},Y.useMemo=function(m,L){return x.H.useMemo(m,L)},Y.useOptimistic=function(m,L){return x.H.useOptimistic(m,L)},Y.useReducer=function(m,L,k){return x.H.useReducer(m,L,k)},Y.useRef=function(m){return x.H.useRef(m)},Y.useState=function(m){return x.H.useState(m)},Y.useSyncExternalStore=function(m,L,k){return x.H.useSyncExternalStore(m,L,k)},Y.useTransition=function(){return x.H.useTransition()},Y.version="19.1.0",Y}var Hr;function Ra(){return Hr||(Hr=1,Yt.exports=Ea()),Yt.exports}var h=Ra(),rt={},Ur;function ba(){if(Ur)return rt;Ur=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.parse=l,rt.serialize=u;const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,a=/^[\u0020-\u003A\u003D-\u007E]*$/,n=Object.prototype.toString,o=(()=>{const f=function(){};return f.prototype=Object.create(null),f})();function l(f,g){const w=new o,b=f.length;if(b<2)return w;const S=(g==null?void 0:g.decode)||c;let R=0;do{const A=f.indexOf("=",R);if(A===-1)break;const T=f.indexOf(";",R),M=T===-1?b:T;if(A>M){R=f.lastIndexOf(";",A-1)+1;continue}const x=s(f,R,A),y=i(f,A,x),D=f.slice(x,y);if(w[D]===void 0){let U=s(f,A+1,M),j=i(f,M,U);const K=S(f.slice(U,j));w[D]=K}R=M+1}while(R<b);return w}function s(f,g,w){do{const b=f.charCodeAt(g);if(b!==32&&b!==9)return g}while(++g<w);return w}function i(f,g,w){for(;g>w;){const b=f.charCodeAt(--g);if(b!==32&&b!==9)return g+1}return w}function u(f,g,w){const b=(w==null?void 0:w.encode)||encodeURIComponent;if(!e.test(f))throw new TypeError(`argument name is invalid: ${f}`);const S=b(g);if(!t.test(S))throw new TypeError(`argument val is invalid: ${g}`);let R=f+"="+S;if(!w)return R;if(w.maxAge!==void 0){if(!Number.isInteger(w.maxAge))throw new TypeError(`option maxAge is invalid: ${w.maxAge}`);R+="; Max-Age="+w.maxAge}if(w.domain){if(!r.test(w.domain))throw new TypeError(`option domain is invalid: ${w.domain}`);R+="; Domain="+w.domain}if(w.path){if(!a.test(w.path))throw new TypeError(`option path is invalid: ${w.path}`);R+="; Path="+w.path}if(w.expires){if(!p(w.expires)||!Number.isFinite(w.expires.valueOf()))throw new TypeError(`option expires is invalid: ${w.expires}`);R+="; Expires="+w.expires.toUTCString()}if(w.httpOnly&&(R+="; HttpOnly"),w.secure&&(R+="; Secure"),w.partitioned&&(R+="; Partitioned"),w.priority)switch(typeof w.priority=="string"?w.priority.toLowerCase():void 0){case"low":R+="; Priority=Low";break;case"medium":R+="; Priority=Medium";break;case"high":R+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${w.priority}`)}if(w.sameSite)switch(typeof w.sameSite=="string"?w.sameSite.toLowerCase():w.sameSite){case!0:case"strict":R+="; SameSite=Strict";break;case"lax":R+="; SameSite=Lax";break;case"none":R+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${w.sameSite}`)}return R}function c(f){if(f.indexOf("%")===-1)return f;try{return decodeURIComponent(f)}catch{return f}}function p(f){return n.call(f)==="[object Date]"}return rt}ba();/** * react-router v7.6.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */var mn=e=>{throw TypeError(e)},Sa=(e,t,r)=>t.has(e)||mn("Cannot "+r),Wt=(e,t,r)=>(Sa(e,t,"read from private field"),r?r.call(e):t.get(e)),xa=(e,t,r)=>t.has(e)?mn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),zr="popstate";function fl(e={}){function t(a,n){let{pathname:o,search:l,hash:s}=a.location;return st("",{pathname:o,search:l,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default")}function r(a,n){return typeof n=="string"?n:Oe(n)}return Ca(t,r,null,e)}function J(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function re(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function La(){return Math.random().toString(36).substring(2,10)}function Br(e,t){return{usr:e.state,key:e.key,idx:t}}function st(e,t,r=null,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ne(t):t,state:r,key:t&&t.key||a||La()}}function Oe({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Ne(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function Ca(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,l=n.history,s="POP",i=null,u=c();u==null&&(u=0,l.replaceState({...l.state,idx:u},""));function c(){return(l.state||{idx:null}).idx}function p(){s="POP";let S=c(),R=S==null?null:S-u;u=S,i&&i({action:s,location:b.location,delta:R})}function f(S,R){s="PUSH";let A=st(b.location,S,R);u=c()+1;let T=Br(A,u),M=b.createHref(A);try{l.pushState(T,"",M)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;n.location.assign(M)}o&&i&&i({action:s,location:b.location,delta:1})}function g(S,R){s="REPLACE";let A=st(b.location,S,R);u=c();let T=Br(A,u),M=b.createHref(A);l.replaceState(T,"",M),o&&i&&i({action:s,location:b.location,delta:0})}function w(S){return pn(S)}let b={get action(){return s},get location(){return e(n,l)},listen(S){if(i)throw new Error("A history only accepts one active listener");return n.addEventListener(zr,p),i=S,()=>{n.removeEventListener(zr,p),i=null}},createHref(S){return t(n,S)},createURL:w,encodeLocation(S){let R=w(S);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:f,replace:g,go(S){return l.go(S)}};return b}function pn(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),J(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:Oe(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=r+a),new URL(a,r)}var it,Yr=class{constructor(e){if(xa(this,it,new Map),e)for(let[t,r]of e)this.set(t,r)}get(e){if(Wt(this,it).has(e))return Wt(this,it).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Wt(this,it).set(e,t)}};it=new WeakMap;var Pa=new Set(["lazy","caseSensitive","path","id","index","children"]);function Ta(e){return Pa.has(e)}var Ma=new Set(["lazy","caseSensitive","path","id","index","unstable_middleware","children"]);function _a(e){return Ma.has(e)}function Da(e){return e.index===!0}function Mt(e,t,r=[],a={}){return e.map((n,o)=>{let l=[...r,String(o)],s=typeof n.id=="string"?n.id:l.join("-");if(J(n.index!==!0||!n.children,"Cannot specify children on an index route"),J(!a[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),Da(n)){let i={...n,...t(n),id:s};return a[s]=i,i}else{let i={...n,...t(n),id:s,children:void 0};return a[s]=i,n.children&&(i.children=Mt(n.children,t,l,a)),i}})}function Ce(e,t,r="/"){return xt(e,t,r,!1)}function xt(e,t,r,a){let n=typeof t=="string"?Ne(t):t,o=ge(n.pathname||"/",r);if(o==null)return null;let l=vn(e);Aa(l);let s=null;for(let i=0;s==null&&i<l.length;++i){let u=za(o);s=Ua(l[i],u,a)}return s}function yn(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],handle:r.handle}}function vn(e,t=[],r=[],a=""){let n=(o,l,s)=>{let i={relativePath:s===void 0?o.path||"":s,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};i.relativePath.startsWith("/")&&(J(i.relativePath.startsWith(a),`Absolute route path "${i.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),i.relativePath=i.relativePath.slice(a.length));let u=Pe([a,i.relativePath]),c=r.concat(i);o.children&&o.children.length>0&&(J(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),vn(o.children,t,c,u)),!(o.path==null&&!o.index)&&t.push({path:u,score:ja(u,o.index),routesMeta:c})};return e.forEach((o,l)=>{var s;if(o.path===""||!((s=o.path)!=null&&s.includes("?")))n(o,l);else for(let i of gn(o.path))n(o,l,i)}),t}function gn(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let l=gn(a.join("/")),s=[];return s.push(...l.map(i=>i===""?o:[o,i].join("/"))),n&&s.push(...l),s.map(i=>e.startsWith("/")&&i===""?"/":i)}function Aa(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Ha(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Oa=/^:[\w-]+$/,ka=3,Na=2,Ia=1,$a=10,Fa=-2,Wr=e=>e==="*";function ja(e,t){let r=e.split("/"),a=r.length;return r.some(Wr)&&(a+=Fa),t&&(a+=Na),r.filter(n=>!Wr(n)).reduce((n,o)=>n+(Oa.test(o)?ka:o===""?Ia:$a),a)}function Ha(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function Ua(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",l=[];for(let s=0;s<a.length;++s){let i=a[s],u=s===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",p=_t({path:i.relativePath,caseSensitive:i.caseSensitive,end:u},c),f=i.route;if(!p&&u&&r&&!a[a.length-1].route.index&&(p=_t({path:i.relativePath,caseSensitive:i.caseSensitive,end:!1},c)),!p)return null;Object.assign(n,p.params),l.push({params:n,pathname:Pe([o,p.pathname]),pathnameBase:Wa(Pe([o,p.pathnameBase])),route:f}),p.pathnameBase!=="/"&&(o=Pe([o,p.pathnameBase]))}return l}function _t(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=wn(e.path,e.caseSensitive,e.end),n=t.match(r);if(!n)return null;let o=n[0],l=o.replace(/(.)\/+$/,"$1"),s=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:p},f)=>{if(c==="*"){let w=s[f]||"";l=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const g=s[f];return p&&!g?u[c]=void 0:u[c]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:l,pattern:e}}function wn(e,t=!1,r=!0){re(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,s,i)=>(a.push({paramName:s,isOptional:i!=null}),i?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function za(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return re(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ge(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function Ba(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?Ne(e):e;return{pathname:r?r.startsWith("/")?r:Ya(r,t):t,search:Va(a),hash:Ja(n)}}function Ya(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Vt(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function En(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function cr(e){let t=En(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function dr(e,t,r,a=!1){let n;typeof e=="string"?n=Ne(e):(n={...e},J(!n.pathname||!n.pathname.includes("?"),Vt("?","pathname","search",n)),J(!n.pathname||!n.pathname.includes("#"),Vt("#","pathname","hash",n)),J(!n.search||!n.search.includes("#"),Vt("#","search","hash",n)));let o=e===""||n.pathname==="",l=o?"/":n.pathname,s;if(l==null)s=r;else{let p=t.length-1;if(!a&&l.startsWith("..")){let f=l.split("/");for(;f[0]==="..";)f.shift(),p-=1;n.pathname=f.join("/")}s=p>=0?t[p]:"/"}let i=Ba(n,s),u=l&&l!=="/"&&l.endsWith("/"),c=(o||l===".")&&r.endsWith("/");return!i.pathname.endsWith("/")&&(u||c)&&(i.pathname+="/"),i}var Pe=e=>e.join("/").replace(/\/\/+/g,"/"),Wa=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Va=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ja=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ga=class{constructor(e,t){this.type="DataWithResponseInit",this.data=e,this.init=t||null}};function Xa(e,t){return new Ga(e,typeof t=="number"?{status:t}:t)}var qa=(e,t=302)=>{let r=t;typeof r=="number"?r={status:r}:typeof r.status>"u"&&(r.status=302);let a=new Headers(r.headers);return a.set("Location",e),new Response(null,{...r,headers:a})},ke=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function ze(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var Rn=["POST","PUT","PATCH","DELETE"],Ka=new Set(Rn),Qa=["GET",...Rn],Za=new Set(Qa),eo=new Set([301,302,303,307,308]),to=new Set([307,308]),Jt={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ro={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},nt={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},fr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,no=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),bn="remix-router-transitions",Sn=Symbol("ResetLoaderData");function hl(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";J(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a=e.hydrationRouteProperties||[],n=e.mapRouteProperties||no,o={},l=Mt(e.routes,n,void 0,o),s,i=e.basename||"/",u=e.dataStrategy||so,c={unstable_middleware:!1,...e.future},p=null,f=new Set,g=null,w=null,b=null,S=e.hydrationData!=null,R=Ce(l,e.history.location,i),A=!1,T=null,M;if(R==null&&!e.patchRoutesOnNavigation){let d=Re(404,{pathname:e.history.location.pathname}),{matches:v,route:E}=nn(l);M=!0,R=v,T={[E.id]:d}}else if(R&&!e.hydrationData&&pt(R,l,e.history.location.pathname).active&&(R=null),R)if(R.some(d=>d.route.lazy))M=!1;else if(!R.some(d=>d.route.loader))M=!0;else{let d=e.hydrationData?e.hydrationData.loaderData:null,v=e.hydrationData?e.hydrationData.errors:null;if(v){let E=R.findIndex(C=>v[C.route.id]!==void 0);M=R.slice(0,E+1).every(C=>!er(C.route,d,v))}else M=R.every(E=>!er(E.route,d,v))}else{M=!1,R=[];let d=pt(null,l,e.history.location.pathname);d.active&&d.matches&&(A=!0,R=d.matches)}let x,y={historyAction:e.history.action,location:e.history.location,matches:R,initialized:M,navigation:Jt,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||T,fetchers:new Map,blockers:new Map},D="POP",U=!1,j,K=!1,ne=new Map,se=null,oe=!1,X=!1,Q=new Set,G=new Map,ue=0,de=-1,ce=new Map,m=new Set,L=new Map,k=new Map,O=new Set,W=new Map,ee,z=null;function Le(){if(p=e.history.listen(({action:d,location:v,delta:E})=>{if(ee){ee(),ee=void 0;return}re(W.size===0||E!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let C=Or({currentLocation:y.location,nextLocation:v,historyAction:d});if(C&&E!=null){let P=new Promise(N=>{ee=N});e.history.go(E*-1),mt(C,{state:"blocked",location:v,proceed(){mt(C,{state:"proceeding",proceed:void 0,reset:void 0,location:v}),P.then(()=>e.history.go(E))},reset(){let N=new Map(y.blockers);N.set(C,nt),he({blockers:N})}});return}return Ie(d,v)}),r){Eo(t,ne);let d=()=>Ro(t,ne);t.addEventListener("pagehide",d),se=()=>t.removeEventListener("pagehide",d)}return y.initialized||Ie("POP",y.location,{initialHydration:!0}),x}function ae(){p&&p(),se&&se(),f.clear(),j&&j.abort(),y.fetchers.forEach((d,v)=>jt(v)),y.blockers.forEach((d,v)=>Ar(v))}function $t(d){return f.add(d),()=>f.delete(d)}function he(d,v={}){y={...y,...d};let E=[],C=[];y.fetchers.forEach((P,N)=>{P.state==="idle"&&(O.has(N)?E.push(N):C.push(N))}),O.forEach(P=>{!y.fetchers.has(P)&&!G.has(P)&&E.push(P)}),[...f].forEach(P=>P(y,{deletedFetchers:E,viewTransitionOpts:v.viewTransitionOpts,flushSync:v.flushSync===!0})),E.forEach(P=>jt(P)),C.forEach(P=>y.fetchers.delete(P))}function Ye(d,v,{flushSync:E}={}){var F,B;let C=y.actionData!=null&&y.navigation.formMethod!=null&&ve(y.navigation.formMethod)&&y.navigation.state==="loading"&&((F=d.state)==null?void 0:F._isRedirect)!==!0,P;v.actionData?Object.keys(v.actionData).length>0?P=v.actionData:P=null:C?P=y.actionData:P=null;let N=v.loaderData?tn(y.loaderData,v.loaderData,v.matches||[],v.errors):y.loaderData,H=y.blockers;H.size>0&&(H=new Map(H),H.forEach(($,V)=>H.set(V,nt)));let _=U===!0||y.navigation.formMethod!=null&&ve(y.navigation.formMethod)&&((B=d.state)==null?void 0:B._isRedirect)!==!0;s&&(l=s,s=void 0),oe||D==="POP"||(D==="PUSH"?e.history.push(d,d.state):D==="REPLACE"&&e.history.replace(d,d.state));let I;if(D==="POP"){let $=ne.get(y.location.pathname);$&&$.has(d.pathname)?I={currentLocation:y.location,nextLocation:d}:ne.has(d.pathname)&&(I={currentLocation:d,nextLocation:y.location})}else if(K){let $=ne.get(y.location.pathname);$?$.add(d.pathname):($=new Set([d.pathname]),ne.set(y.location.pathname,$)),I={currentLocation:y.location,nextLocation:d}}he({...v,actionData:P,loaderData:N,historyAction:D,location:d,initialized:!0,navigation:Jt,revalidation:"idle",restoreScrollPosition:Nr(d,v.matches||y.matches),preventScrollReset:_,blockers:H},{viewTransitionOpts:I,flushSync:E===!0}),D="POP",U=!1,K=!1,oe=!1,X=!1,z==null||z.resolve(),z=null}async function Lr(d,v){if(typeof d=="number"){e.history.go(d);return}let E=Zt(y.location,y.matches,i,d,v==null?void 0:v.fromRouteId,v==null?void 0:v.relative),{path:C,submission:P,error:N}=Vr(!1,E,v),H=y.location,_=st(y.location,C,v&&v.state);_={..._,...e.history.encodeLocation(_)};let I=v&&v.replace!=null?v.replace:void 0,F="PUSH";I===!0?F="REPLACE":I===!1||P!=null&&ve(P.formMethod)&&P.formAction===y.location.pathname+y.location.search&&(F="REPLACE");let B=v&&"preventScrollReset"in v?v.preventScrollReset===!0:void 0,$=(v&&v.flushSync)===!0,V=Or({currentLocation:H,nextLocation:_,historyAction:F});if(V){mt(V,{state:"blocked",location:_,proceed(){mt(V,{state:"proceeding",proceed:void 0,reset:void 0,location:_}),Lr(d,v)},reset(){let te=new Map(y.blockers);te.set(V,nt),he({blockers:te})}});return}await Ie(F,_,{submission:P,pendingError:N,preventScrollReset:B,replace:v&&v.replace,enableViewTransition:v&&v.viewTransition,flushSync:$})}function aa(){z||(z=bo()),Ft(),he({revalidation:"loading"});let d=z.promise;return y.navigation.state==="submitting"?d:y.navigation.state==="idle"?(Ie(y.historyAction,y.location,{startUninterruptedRevalidation:!0}),d):(Ie(D||y.historyAction,y.navigation.location,{overrideNavigation:y.navigation,enableViewTransition:K===!0}),d)}async function Ie(d,v,E){j&&j.abort(),j=null,D=d,oe=(E&&E.startUninterruptedRevalidation)===!0,ma(y.location,y.matches),U=(E&&E.preventScrollReset)===!0,K=(E&&E.enableViewTransition)===!0;let C=s||l,P=E&&E.overrideNavigation,N=E!=null&&E.initialHydration&&y.matches&&y.matches.length>0&&!A?y.matches:Ce(C,v,i),H=(E&&E.flushSync)===!0;if(N&&y.initialized&&!X&&po(y.location,v)&&!(E&&E.submission&&ve(E.submission.formMethod))){Ye(v,{matches:N},{flushSync:H});return}let _=pt(N,C,v.pathname);if(_.active&&_.matches&&(N=_.matches),!N){let{error:fe,notFoundMatches:pe,route:q}=Ht(v.pathname);Ye(v,{matches:pe,loaderData:{},errors:{[q.id]:fe}},{flushSync:H});return}j=new AbortController;let I=Ve(e.history,v,j.signal,E&&E.submission),F=new Yr(e.unstable_getContext?await e.unstable_getContext():void 0),B;if(E&&E.pendingError)B=[He(N).route.id,{type:"error",error:E.pendingError}];else if(E&&E.submission&&ve(E.submission.formMethod)){let fe=await oa(I,v,E.submission,N,F,_.active,E&&E.initialHydration===!0,{replace:E.replace,flushSync:H});if(fe.shortCircuited)return;if(fe.pendingActionResult){let[pe,q]=fe.pendingActionResult;if(ye(q)&&ze(q.error)&&q.error.status===404){j=null,Ye(v,{matches:fe.matches,loaderData:{},errors:{[pe]:q.error}});return}}N=fe.matches||N,B=fe.pendingActionResult,P=Gt(v,E.submission),H=!1,_.active=!1,I=Ve(e.history,I.url,I.signal)}let{shortCircuited:$,matches:V,loaderData:te,errors:le}=await ia(I,v,N,F,_.active,P,E&&E.submission,E&&E.fetcherSubmission,E&&E.replace,E&&E.initialHydration===!0,H,B);$||(j=null,Ye(v,{matches:V||N,...rn(B),loaderData:te,errors:le}))}async function oa(d,v,E,C,P,N,H,_={}){Ft();let I=go(v,E);if(he({navigation:I},{flushSync:_.flushSync===!0}),N){let $=await yt(C,v.pathname,d.signal);if($.type==="aborted")return{shortCircuited:!0};if($.type==="error"){let V=He($.partialMatches).route.id;return{matches:$.partialMatches,pendingActionResult:[V,{type:"error",error:$.error}]}}else if($.matches)C=$.matches;else{let{notFoundMatches:V,error:te,route:le}=Ht(v.pathname);return{matches:V,pendingActionResult:[le.id,{type:"error",error:te}]}}}let F,B=lt(C,v);if(!B.route.action&&!B.route.lazy)F={type:"error",error:Re(405,{method:d.method,pathname:v.pathname,routeId:B.route.id})};else{let $=Je(n,o,d,C,B,H?[]:a,P),V=await qe(d,$,P,null);if(F=V[B.route.id],!F){for(let te of C)if(V[te.route.id]){F=V[te.route.id];break}}if(d.signal.aborted)return{shortCircuited:!0}}if(Ue(F)){let $;return _&&_.replace!=null?$=_.replace:$=Qr(F.response.headers.get("Location"),new URL(d.url),i)===y.location.pathname+y.location.search,await $e(d,F,!0,{submission:E,replace:$}),{shortCircuited:!0}}if(ye(F)){let $=He(C,B.route.id);return(_&&_.replace)!==!0&&(D="PUSH"),{matches:C,pendingActionResult:[$.route.id,F,B.route.id]}}return{matches:C,pendingActionResult:[B.route.id,F]}}async function ia(d,v,E,C,P,N,H,_,I,F,B,$){let V=N||Gt(v,H),te=H||_||an(V),le=!oe&&!F;if(P){if(le){let Ee=Cr($);he({navigation:V,...Ee!==void 0?{actionData:Ee}:{}},{flushSync:B})}let Z=await yt(E,v.pathname,d.signal);if(Z.type==="aborted")return{shortCircuited:!0};if(Z.type==="error"){let Ee=He(Z.partialMatches).route.id;return{matches:Z.partialMatches,loaderData:{},errors:{[Ee]:Z.error}}}else if(Z.matches)E=Z.matches;else{let{error:Ee,notFoundMatches:De,route:gt}=Ht(v.pathname);return{matches:De,loaderData:{},errors:{[gt.id]:Ee}}}}let fe=s||l,{dsMatches:pe,revalidatingFetchers:q}=Jr(d,C,n,o,e.history,y,E,te,v,F?[]:a,F===!0,X,Q,O,L,m,fe,i,e.patchRoutesOnNavigation!=null,$);if(de=++ue,!e.dataStrategy&&!pe.some(Z=>Z.shouldLoad)&&q.length===0){let Z=_r();return Ye(v,{matches:E,loaderData:{},errors:$&&ye($[1])?{[$[0]]:$[1].error}:null,...rn($),...Z?{fetchers:new Map(y.fetchers)}:{}},{flushSync:B}),{shortCircuited:!0}}if(le){let Z={};if(!P){Z.navigation=V;let Ee=Cr($);Ee!==void 0&&(Z.actionData=Ee)}q.length>0&&(Z.fetchers=la(q)),he(Z,{flushSync:B})}q.forEach(Z=>{_e(Z.key),Z.controller&&G.set(Z.key,Z.controller)});let Ke=()=>q.forEach(Z=>_e(Z.key));j&&j.signal.addEventListener("abort",Ke);let{loaderResults:Fe,fetcherResults:Qe}=await Pr(pe,q,d,C);if(d.signal.aborted)return{shortCircuited:!0};j&&j.signal.removeEventListener("abort",Ke),q.forEach(Z=>G.delete(Z.key));let we=wt(Fe);if(we)return await $e(d,we.result,!0,{replace:I}),{shortCircuited:!0};if(we=wt(Qe),we)return m.add(we.key),await $e(d,we.result,!0,{replace:I}),{shortCircuited:!0};let{loaderData:Ze,errors:et}=en(y,E,Fe,$,q,Qe);F&&y.errors&&(et={...y.errors,...et});let Ut=_r(),je=Dr(de),vt=Ut||je||q.length>0;return{matches:E,loaderData:Ze,errors:et,...vt?{fetchers:new Map(y.fetchers)}:{}}}function Cr(d){if(d&&!ye(d[1]))return{[d[0]]:d[1].data};if(y.actionData)return Object.keys(y.actionData).length===0?null:y.actionData}function la(d){return d.forEach(v=>{let E=y.fetchers.get(v.key),C=at(void 0,E?E.data:void 0);y.fetchers.set(v.key,C)}),new Map(y.fetchers)}async function sa(d,v,E,C){_e(d);let P=(C&&C.flushSync)===!0,N=s||l,H=Zt(y.location,y.matches,i,E,v,C==null?void 0:C.relative),_=Ce(N,H,i),I=pt(_,N,H);if(I.active&&I.matches&&(_=I.matches),!_){Te(d,v,Re(404,{pathname:H}),{flushSync:P});return}let{path:F,submission:B,error:$}=Vr(!0,H,C);if($){Te(d,v,$,{flushSync:P});return}let V=lt(_,F),te=new Yr(e.unstable_getContext?await e.unstable_getContext():void 0),le=(C&&C.preventScrollReset)===!0;if(B&&ve(B.formMethod)){await ua(d,v,F,V,_,te,I.active,P,le,B);return}L.set(d,{routeId:v,path:F}),await ca(d,v,F,V,_,te,I.active,P,le,B)}async function ua(d,v,E,C,P,N,H,_,I,F){Ft(),L.delete(d);function B(ie){if(!ie.route.action&&!ie.route.lazy){let We=Re(405,{method:F.formMethod,pathname:E,routeId:v});return Te(d,v,We,{flushSync:_}),!0}return!1}if(!H&&B(C))return;let $=y.fetchers.get(d);Me(d,wo(F,$),{flushSync:_});let V=new AbortController,te=Ve(e.history,E,V.signal,F);if(H){let ie=await yt(P,E,te.signal,d);if(ie.type==="aborted")return;if(ie.type==="error"){Te(d,v,ie.error,{flushSync:_});return}else if(ie.matches){if(P=ie.matches,C=lt(P,E),B(C))return}else{Te(d,v,Re(404,{pathname:E}),{flushSync:_});return}}G.set(d,V);let le=ue,fe=Je(n,o,te,P,C,a,N),q=(await qe(te,fe,N,d))[C.route.id];if(te.signal.aborted){G.get(d)===V&&G.delete(d);return}if(O.has(d)){if(Ue(q)||ye(q)){Me(d,Ae(void 0));return}}else{if(Ue(q))if(G.delete(d),de>le){Me(d,Ae(void 0));return}else return m.add(d),Me(d,at(F)),$e(te,q,!1,{fetcherSubmission:F,preventScrollReset:I});if(ye(q)){Te(d,v,q.error);return}}let Ke=y.navigation.location||y.location,Fe=Ve(e.history,Ke,V.signal),Qe=s||l,we=y.navigation.state!=="idle"?Ce(Qe,y.navigation.location,i):y.matches;J(we,"Didn't find any matches after fetcher action");let Ze=++ue;ce.set(d,Ze);let et=at(F,q.data);y.fetchers.set(d,et);let{dsMatches:Ut,revalidatingFetchers:je}=Jr(Fe,N,n,o,e.history,y,we,F,Ke,a,!1,X,Q,O,L,m,Qe,i,e.patchRoutesOnNavigation!=null,[C.route.id,q]);je.filter(ie=>ie.key!==d).forEach(ie=>{let We=ie.key,Ir=y.fetchers.get(We),va=at(void 0,Ir?Ir.data:void 0);y.fetchers.set(We,va),_e(We),ie.controller&&G.set(We,ie.controller)}),he({fetchers:new Map(y.fetchers)});let vt=()=>je.forEach(ie=>_e(ie.key));V.signal.addEventListener("abort",vt);let{loaderResults:Z,fetcherResults:Ee}=await Pr(Ut,je,Fe,N);if(V.signal.aborted)return;if(V.signal.removeEventListener("abort",vt),ce.delete(d),G.delete(d),je.forEach(ie=>G.delete(ie.key)),y.fetchers.has(d)){let ie=Ae(q.data);y.fetchers.set(d,ie)}let De=wt(Z);if(De)return $e(Fe,De.result,!1,{preventScrollReset:I});if(De=wt(Ee),De)return m.add(De.key),$e(Fe,De.result,!1,{preventScrollReset:I});let{loaderData:gt,errors:zt}=en(y,we,Z,void 0,je,Ee);Dr(Ze),y.navigation.state==="loading"&&Ze>de?(J(D,"Expected pending action"),j&&j.abort(),Ye(y.navigation.location,{matches:we,loaderData:gt,errors:zt,fetchers:new Map(y.fetchers)})):(he({errors:zt,loaderData:tn(y.loaderData,gt,we,zt),fetchers:new Map(y.fetchers)}),X=!1)}async function ca(d,v,E,C,P,N,H,_,I,F){let B=y.fetchers.get(d);Me(d,at(F,B?B.data:void 0),{flushSync:_});let $=new AbortController,V=Ve(e.history,E,$.signal);if(H){let q=await yt(P,E,V.signal,d);if(q.type==="aborted")return;if(q.type==="error"){Te(d,v,q.error,{flushSync:_});return}else if(q.matches)P=q.matches,C=lt(P,E);else{Te(d,v,Re(404,{pathname:E}),{flushSync:_});return}}G.set(d,$);let te=ue,le=Je(n,o,V,P,C,a,N),pe=(await qe(V,le,N,d))[C.route.id];if(G.get(d)===$&&G.delete(d),!V.signal.aborted){if(O.has(d)){Me(d,Ae(void 0));return}if(Ue(pe))if(de>te){Me(d,Ae(void 0));return}else{m.add(d),await $e(V,pe,!1,{preventScrollReset:I});return}if(ye(pe)){Te(d,v,pe.error);return}Me(d,Ae(pe.data))}}async function $e(d,v,E,{submission:C,fetcherSubmission:P,preventScrollReset:N,replace:H}={}){v.response.headers.has("X-Remix-Revalidate")&&(X=!0);let _=v.response.headers.get("Location");J(_,"Expected a Location header on the redirect Response"),_=Qr(_,new URL(d.url),i);let I=st(y.location,_,{_isRedirect:!0});if(r){let le=!1;if(v.response.headers.has("X-Remix-Reload-Document"))le=!0;else if(fr.test(_)){const fe=pn(_,!0);le=fe.origin!==t.location.origin||ge(fe.pathname,i)==null}if(le){H?t.location.replace(_):t.location.assign(_);return}}j=null;let F=H===!0||v.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:B,formAction:$,formEncType:V}=y.navigation;!C&&!P&&B&&$&&V&&(C=an(y.navigation));let te=C||P;if(to.has(v.response.status)&&te&&ve(te.formMethod))await Ie(F,I,{submission:{...te,formAction:_},preventScrollReset:N||U,enableViewTransition:E?K:void 0});else{let le=Gt(I,C);await Ie(F,I,{overrideNavigation:le,fetcherSubmission:P,preventScrollReset:N||U,enableViewTransition:E?K:void 0})}}async function qe(d,v,E,C){let P,N={};try{P=await uo(u,d,v,C,E,!1)}catch(H){return v.filter(_=>_.shouldLoad).forEach(_=>{N[_.route.id]={type:"error",error:H}}),N}if(d.signal.aborted)return N;for(let[H,_]of Object.entries(P))if(yo(_)){let I=_.result;N[H]={type:"redirect",response:ho(I,d,H,v,i)}}else N[H]=await fo(_);return N}async function Pr(d,v,E,C){let P=qe(E,d,C,null),N=Promise.all(v.map(async I=>{if(I.matches&&I.match&&I.request&&I.controller){let B=(await qe(I.request,I.matches,C,I.key))[I.match.route.id];return{[I.key]:B}}else return Promise.resolve({[I.key]:{type:"error",error:Re(404,{pathname:I.path})}})})),H=await P,_=(await N).reduce((I,F)=>Object.assign(I,F),{});return{loaderResults:H,fetcherResults:_}}function Ft(){X=!0,L.forEach((d,v)=>{G.has(v)&&Q.add(v),_e(v)})}function Me(d,v,E={}){y.fetchers.set(d,v),he({fetchers:new Map(y.fetchers)},{flushSync:(E&&E.flushSync)===!0})}function Te(d,v,E,C={}){let P=He(y.matches,v);jt(d),he({errors:{[P.route.id]:E},fetchers:new Map(y.fetchers)},{flushSync:(C&&C.flushSync)===!0})}function Tr(d){return k.set(d,(k.get(d)||0)+1),O.has(d)&&O.delete(d),y.fetchers.get(d)||ro}function jt(d){let v=y.fetchers.get(d);G.has(d)&&!(v&&v.state==="loading"&&ce.has(d))&&_e(d),L.delete(d),ce.delete(d),m.delete(d),O.delete(d),Q.delete(d),y.fetchers.delete(d)}function da(d){let v=(k.get(d)||0)-1;v<=0?(k.delete(d),O.add(d)):k.set(d,v),he({fetchers:new Map(y.fetchers)})}function _e(d){let v=G.get(d);v&&(v.abort(),G.delete(d))}function Mr(d){for(let v of d){let E=Tr(v),C=Ae(E.data);y.fetchers.set(v,C)}}function _r(){let d=[],v=!1;for(let E of m){let C=y.fetchers.get(E);J(C,`Expected fetcher: ${E}`),C.state==="loading"&&(m.delete(E),d.push(E),v=!0)}return Mr(d),v}function Dr(d){let v=[];for(let[E,C]of ce)if(C<d){let P=y.fetchers.get(E);J(P,`Expected fetcher: ${E}`),P.state==="loading"&&(_e(E),ce.delete(E),v.push(E))}return Mr(v),v.length>0}function fa(d,v){let E=y.blockers.get(d)||nt;return W.get(d)!==v&&W.set(d,v),E}function Ar(d){y.blockers.delete(d),W.delete(d)}function mt(d,v){let E=y.blockers.get(d)||nt;J(E.state==="unblocked"&&v.state==="blocked"||E.state==="blocked"&&v.state==="blocked"||E.state==="blocked"&&v.state==="proceeding"||E.state==="blocked"&&v.state==="unblocked"||E.state==="proceeding"&&v.state==="unblocked",`Invalid blocker state transition: ${E.state} -> ${v.state}`);let C=new Map(y.blockers);C.set(d,v),he({blockers:C})}function Or({currentLocation:d,nextLocation:v,historyAction:E}){if(W.size===0)return;W.size>1&&re(!1,"A router only supports one blocker at a time");let C=Array.from(W.entries()),[P,N]=C[C.length-1],H=y.blockers.get(P);if(!(H&&H.state==="proceeding")&&N({currentLocation:d,nextLocation:v,historyAction:E}))return P}function Ht(d){let v=Re(404,{pathname:d}),E=s||l,{matches:C,route:P}=nn(E);return{notFoundMatches:C,route:P,error:v}}function ha(d,v,E){if(g=d,b=v,w=E||null,!S&&y.navigation===Jt){S=!0;let C=Nr(y.location,y.matches);C!=null&&he({restoreScrollPosition:C})}return()=>{g=null,b=null,w=null}}function kr(d,v){return w&&w(d,v.map(C=>yn(C,y.loaderData)))||d.key}function ma(d,v){if(g&&b){let E=kr(d,v);g[E]=b()}}function Nr(d,v){if(g){let E=kr(d,v),C=g[E];if(typeof C=="number")return C}return null}function pt(d,v,E){if(e.patchRoutesOnNavigation)if(d){if(Object.keys(d[0].params).length>0)return{active:!0,matches:xt(v,E,i,!0)}}else return{active:!0,matches:xt(v,E,i,!0)||[]};return{active:!1,matches:null}}async function yt(d,v,E,C){if(!e.patchRoutesOnNavigation)return{type:"success",matches:d};let P=d;for(;;){let N=s==null,H=s||l,_=o;try{await e.patchRoutesOnNavigation({signal:E,path:v,matches:P,fetcherKey:C,patch:(B,$)=>{E.aborted||Gr(B,$,H,_,n)}})}catch(B){return{type:"error",error:B,partialMatches:P}}finally{N&&!E.aborted&&(l=[...l])}if(E.aborted)return{type:"aborted"};let I=Ce(H,v,i);if(I)return{type:"success",matches:I};let F=xt(H,v,i,!0);if(!F||P.length===F.length&&P.every((B,$)=>B.route.id===F[$].route.id))return{type:"success",matches:null};P=F}}function pa(d){o={},s=Mt(d,n,void 0,o)}function ya(d,v){let E=s==null;Gr(d,v,s||l,o,n),E&&(l=[...l],he({}))}return x={get basename(){return i},get future(){return c},get state(){return y},get routes(){return l},get window(){return t},initialize:Le,subscribe:$t,enableScrollRestoration:ha,navigate:Lr,fetch:sa,revalidate:aa,createHref:d=>e.history.createHref(d),encodeLocation:d=>e.history.encodeLocation(d),getFetcher:Tr,deleteFetcher:da,dispose:ae,getBlocker:fa,deleteBlocker:Ar,patchRoutes:ya,_internalFetchControllers:G,_internalSetRoutes:pa},x}function ao(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Zt(e,t,r,a,n,o){let l,s;if(n){l=[];for(let u of t)if(l.push(u),u.route.id===n){s=u;break}}else l=t,s=t[t.length-1];let i=dr(a||".",cr(l),ge(e.pathname,r)||e.pathname,o==="path");if(a==null&&(i.search=e.search,i.hash=e.hash),(a==null||a===""||a===".")&&s){let u=mr(i.search);if(s.route.index&&!u)i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index";else if(!s.route.index&&u){let c=new URLSearchParams(i.search),p=c.getAll("index");c.delete("index"),p.filter(g=>g).forEach(g=>c.append("index",g));let f=c.toString();i.search=f?`?${f}`:""}}return r!=="/"&&(i.pathname=i.pathname==="/"?r:Pe([r,i.pathname])),Oe(i)}function Vr(e,t,r){if(!r||!ao(r))return{path:t};if(r.formMethod&&!vo(r.formMethod))return{path:t,error:Re(405,{method:r.formMethod})};let a=()=>({path:t,error:Re(400,{type:"invalid-body"})}),o=(r.formMethod||"get").toUpperCase(),l=Mn(t);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!ve(o))return a();let p=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((f,[g,w])=>`${f}${g}=${w} `,""):String(r.body);return{path:t,submission:{formMethod:o,formAction:l,formEncType:r.formEncType,formData:void 0,json:void 0,text:p}}}else if(r.formEncType==="application/json"){if(!ve(o))return a();try{let p=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:t,submission:{formMethod:o,formAction:l,formEncType:r.formEncType,formData:void 0,json:p,text:void 0}}}catch{return a()}}}J(typeof FormData=="function","FormData is not available in this environment");let s,i;if(r.formData)s=rr(r.formData),i=r.formData;else if(r.body instanceof FormData)s=rr(r.body),i=r.body;else if(r.body instanceof URLSearchParams)s=r.body,i=Zr(s);else if(r.body==null)s=new URLSearchParams,i=new FormData;else try{s=new URLSearchParams(r.body),i=Zr(s)}catch{return a()}let u={formMethod:o,formAction:l,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(ve(u.formMethod))return{path:t,submission:u};let c=Ne(t);return e&&c.search&&mr(c.search)&&s.append("index",""),c.search=`?${s}`,{path:Oe(c),submission:u}}function Jr(e,t,r,a,n,o,l,s,i,u,c,p,f,g,w,b,S,R,A,T){var oe;let M=T?ye(T[1])?T[1].error:T[1].data:void 0,x=n.createURL(o.location),y=n.createURL(i),D;if(c&&o.errors){let X=Object.keys(o.errors)[0];D=l.findIndex(Q=>Q.route.id===X)}else if(T&&ye(T[1])){let X=T[0];D=l.findIndex(Q=>Q.route.id===X)-1}let U=T?T[1].statusCode:void 0,j=U&&U>=400,K={currentUrl:x,currentParams:((oe=o.matches[0])==null?void 0:oe.params)||{},nextUrl:y,nextParams:l[0].params,...s,actionResult:M,actionStatus:U},ne=l.map((X,Q)=>{let{route:G}=X,ue=null;if(D!=null&&Q>D?ue=!1:G.lazy?ue=!0:G.loader==null?ue=!1:c?ue=er(G,o.loaderData,o.errors):oo(o.loaderData,o.matches[Q],X)&&(ue=!0),ue!==null)return tr(r,a,e,X,u,t,ue);let de=j?!1:p||x.pathname+x.search===y.pathname+y.search||x.search!==y.search||io(o.matches[Q],X),ce={...K,defaultShouldRevalidate:de},m=Dt(X,ce);return tr(r,a,e,X,u,t,m,ce)}),se=[];return w.forEach((X,Q)=>{if(c||!l.some(O=>O.route.id===X.routeId)||g.has(Q))return;let G=o.fetchers.get(Q),ue=G&&G.state!=="idle"&&G.data===void 0,de=Ce(S,X.path,R);if(!de){if(A&&ue)return;se.push({key:Q,routeId:X.routeId,path:X.path,matches:null,match:null,request:null,controller:null});return}if(b.has(Q))return;let ce=lt(de,X.path),m=new AbortController,L=Ve(n,X.path,m.signal),k=null;if(f.has(Q))f.delete(Q),k=Je(r,a,L,de,ce,u,t);else if(ue)p&&(k=Je(r,a,L,de,ce,u,t));else{let O={...K,defaultShouldRevalidate:j?!1:p};Dt(ce,O)&&(k=Je(r,a,L,de,ce,u,t,O))}k&&se.push({key:Q,routeId:X.routeId,path:X.path,matches:k,match:ce,request:L,controller:m})}),{dsMatches:ne,revalidatingFetchers:se}}function er(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let a=t!=null&&e.id in t,n=r!=null&&r[e.id]!==void 0;return!a&&n?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!a&&!n}function oo(e,t,r){let a=!t||r.route.id!==t.route.id,n=!e.hasOwnProperty(r.route.id);return a||n}function io(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function Dt(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Gr(e,t,r,a,n){let o;if(e){let i=a[e];J(i,`No route found to patch children into: routeId = ${e}`),i.children||(i.children=[]),o=i.children}else o=r;let l=t.filter(i=>!o.some(u=>xn(i,u))),s=Mt(l,n,[e||"_","patch",String((o==null?void 0:o.length)||"0")],a);o.push(...s)}function xn(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,a)=>{var n;return(n=t.children)==null?void 0:n.some(o=>xn(r,o))}):!1}var Xr=new WeakMap,Ln=({key:e,route:t,manifest:r,mapRouteProperties:a})=>{let n=r[t.id];if(J(n,"No route found in manifest"),!n.lazy||typeof n.lazy!="object")return;let o=n.lazy[e];if(!o)return;let l=Xr.get(n);l||(l={},Xr.set(n,l));let s=l[e];if(s)return s;let i=(async()=>{let u=Ta(e),p=n[e]!==void 0&&e!=="hasErrorBoundary";if(u)re(!u,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),l[e]=Promise.resolve();else if(p)re(!1,`Route "${n.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let f=await o();f!=null&&(Object.assign(n,{[e]:f}),Object.assign(n,a(n)))}typeof n.lazy=="object"&&(n.lazy[e]=void 0,Object.values(n.lazy).every(f=>f===void 0)&&(n.lazy=void 0))})();return l[e]=i,i},qr=new WeakMap;function lo(e,t,r,a,n){let o=r[e.id];if(J(o,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let c=qr.get(o);if(c)return{lazyRoutePromise:c,lazyHandlerPromise:c};let p=(async()=>{J(typeof e.lazy=="function","No lazy route function found");let f=await e.lazy(),g={};for(let w in f){let b=f[w];if(b===void 0)continue;let S=_a(w),A=o[w]!==void 0&&w!=="hasErrorBoundary";S?re(!S,"Route property "+w+" is not a supported property to be returned from a lazy route function. This property will be ignored."):A?re(!A,`Route "${o.id}" has a static property "${w}" defined but its lazy function is also returning a value for this property. The lazy route property "${w}" will be ignored.`):g[w]=b}Object.assign(o,g),Object.assign(o,{...a(o),lazy:void 0})})();return qr.set(o,p),p.catch(()=>{}),{lazyRoutePromise:p,lazyHandlerPromise:p}}let l=Object.keys(e.lazy),s=[],i;for(let c of l){if(n&&n.includes(c))continue;let p=Ln({key:c,route:e,manifest:r,mapRouteProperties:a});p&&(s.push(p),c===t&&(i=p))}let u=s.length>0?Promise.all(s).then(()=>{}):void 0;return u==null||u.catch(()=>{}),i==null||i.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:i}}async function Kr(e){let t=e.matches.filter(n=>n.shouldLoad),r={};return(await Promise.all(t.map(n=>n.resolve()))).forEach((n,o)=>{r[t[o].route.id]=n}),r}async function so(e){return e.matches.some(t=>t.route.unstable_middleware)?Cn(e,!1,()=>Kr(e),(t,r)=>({[r]:{type:"error",result:t}})):Kr(e)}async function Cn(e,t,r,a){let{matches:n,request:o,params:l,context:s}=e,i={handlerResult:void 0};try{let u=n.flatMap(p=>p.route.unstable_middleware?p.route.unstable_middleware.map(f=>[p.route.id,f]):[]),c=await Pn({request:o,params:l,context:s},u,t,i,r);return t?c:i.handlerResult}catch(u){if(!i.middlewareError)throw u;let c=await a(i.middlewareError.error,i.middlewareError.routeId);return i.handlerResult?Object.assign(i.handlerResult,c):c}}async function Pn(e,t,r,a,n,o=0){let{request:l}=e;if(l.signal.aborted)throw l.signal.reason?l.signal.reason:new Error(`Request aborted without an \`AbortSignal.reason\`: ${l.method} ${l.url}`);let s=t[o];