@eliseubatista99/react-scaffold-core 0.1.76 → 0.1.78

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/dist/index.cjs.js CHANGED
@@ -123,7 +123,7 @@ React keys must be passed directly to JSX without using spread:
123
123
  * @license MIT
124
124
  */var Er="popstate";function ma(e={}){function t(i,a){let{pathname:s,search:c,hash:l}=i.location;return Nt("",{pathname:s,search:c,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(i,a){return typeof a=="string"?a:Xe(a)}return ga(t,r,null,e)}function ae(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ve(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function va(){return Math.random().toString(36).substring(2,10)}function Rr(e,t){return{usr:e.state,key:e.key,idx:t}}function Nt(e,t,r=null,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Le(t):t,state:r,key:t&&t.key||i||va()}}function Xe({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 Le(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function ga(e,t,r,i={}){let{window:a=document.defaultView,v5Compat:s=!1}=i,c=a.history,l="POP",u=null,h=g();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function g(){return(c.state||{idx:null}).idx}function x(){l="POP";let I=g(),k=I==null?null:I-h;h=I,u&&u({action:l,location:p.location,delta:k})}function j(I,k){l="PUSH";let F=Nt(p.location,I,k);h=g()+1;let U=Rr(F,h),B=p.createHref(F);try{c.pushState(U,"",B)}catch(v){if(v instanceof DOMException&&v.name==="DataCloneError")throw v;a.location.assign(B)}s&&u&&u({action:l,location:p.location,delta:1})}function M(I,k){l="REPLACE";let F=Nt(p.location,I,k);h=g();let U=Rr(F,h),B=p.createHref(F);c.replaceState(U,"",B),s&&u&&u({action:l,location:p.location,delta:0})}function P(I){return ya(I)}let p={get action(){return l},get location(){return e(a,c)},listen(I){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Er,x),u=I,()=>{a.removeEventListener(Er,x),u=null}},createHref(I){return t(a,I)},createURL:P,encodeLocation(I){let k=P(I);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:j,replace:M,go(I){return c.go(I)}};return p}function ya(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),ae(r,"No window.location.(origin|href) available to create URL");let i=typeof e=="string"?e:Xe(e);return i=i.replace(/ $/,"%20"),!t&&i.startsWith("//")&&(i=r+i),new URL(i,r)}function en(e,t,r="/"){return ba(e,t,r,!1)}function ba(e,t,r,i){let a=typeof t=="string"?Le(t):t,s=xe(a.pathname||"/",r);if(s==null)return null;let c=tn(e);wa(c);let l=null;for(let u=0;l==null&&u<c.length;++u){let h=ja(s);l=Ta(c[u],h,i)}return l}function tn(e,t=[],r=[],i=""){let a=(s,c,l)=>{let u={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:c,route:s};u.relativePath.startsWith("/")&&(ae(u.relativePath.startsWith(i),`Absolute route path "${u.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(i.length));let h=Se([i,u.relativePath]),g=r.concat(u);s.children&&s.children.length>0&&(ae(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),tn(s.children,t,g,h)),!(s.path==null&&!s.index)&&t.push({path:h,score:Ea(h,s.index),routesMeta:g})};return e.forEach((s,c)=>{if(s.path===""||!s.path?.includes("?"))a(s,c);else for(let l of rn(s.path))a(s,c,l)}),t}function rn(e){let t=e.split("/");if(t.length===0)return[];let[r,...i]=t,a=r.endsWith("?"),s=r.replace(/\?$/,"");if(i.length===0)return a?[s,""]:[s];let c=rn(i.join("/")),l=[];return l.push(...c.map(u=>u===""?s:[s,u].join("/"))),a&&l.push(...c),l.map(u=>e.startsWith("/")&&u===""?"/":u)}function wa(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Ra(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var Sa=/^:[\w-]+$/,xa=3,ka=2,Oa=1,Ca=10,Pa=-2,Tr=e=>e==="*";function Ea(e,t){let r=e.split("/"),i=r.length;return r.some(Tr)&&(i+=Pa),t&&(i+=ka),r.filter(a=>!Tr(a)).reduce((a,s)=>a+(Sa.test(s)?xa:s===""?Oa:Ca),i)}function Ra(e,t){return e.length===t.length&&e.slice(0,-1).every((i,a)=>i===t[a])?e[e.length-1]-t[t.length-1]:0}function Ta(e,t,r=!1){let{routesMeta:i}=e,a={},s="/",c=[];for(let l=0;l<i.length;++l){let u=i[l],h=l===i.length-1,g=s==="/"?t:t.slice(s.length)||"/",x=gt({path:u.relativePath,caseSensitive:u.caseSensitive,end:h},g),j=u.route;if(!x&&h&&r&&!i[i.length-1].route.index&&(x=gt({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},g)),!x)return null;Object.assign(a,x.params),c.push({params:a,pathname:Se([s,x.pathname]),pathnameBase:$a(Se([s,x.pathnameBase])),route:j}),x.pathnameBase!=="/"&&(s=Se([s,x.pathnameBase]))}return c}function gt(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=_a(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let s=a[0],c=s.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:i.reduce((h,{paramName:g,isOptional:x},j)=>{if(g==="*"){let P=l[j]||"";c=s.slice(0,s.length-P.length).replace(/(.)\/+$/,"$1")}const M=l[j];return x&&!M?h[g]=void 0:h[g]=(M||"").replace(/%2F/g,"/"),h},{}),pathname:s,pathnameBase:c,pattern:e}}function _a(e,t=!1,r=!0){ve(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 i=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,l,u)=>(i.push({paramName:l,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(i.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),i]}function ja(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ve(!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 xe(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}function Da(e,t="/"){let{pathname:r,search:i="",hash:a=""}=typeof e=="string"?Le(e):e;return{pathname:r?r.startsWith("/")?r:La(r,t):t,search:Ia(i),hash:Aa(a)}}function La(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Mt(e,t,r,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. 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 Ma(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function nn(e){let t=Ma(e);return t.map((r,i)=>i===t.length-1?r.pathname:r.pathnameBase)}function an(e,t,r,i=!1){let a;typeof e=="string"?a=Le(e):(a={...e},ae(!a.pathname||!a.pathname.includes("?"),Mt("?","pathname","search",a)),ae(!a.pathname||!a.pathname.includes("#"),Mt("#","pathname","hash",a)),ae(!a.search||!a.search.includes("#"),Mt("#","search","hash",a)));let s=e===""||a.pathname==="",c=s?"/":a.pathname,l;if(c==null)l=r;else{let x=t.length-1;if(!i&&c.startsWith("..")){let j=c.split("/");for(;j[0]==="..";)j.shift(),x-=1;a.pathname=j.join("/")}l=x>=0?t[x]:"/"}let u=Da(a,l),h=c&&c!=="/"&&c.endsWith("/"),g=(s||c===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(h||g)&&(u.pathname+="/"),u}var Se=e=>e.join("/").replace(/\/\/+/g,"/"),$a=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ia=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Aa=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Ha(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var on=["POST","PUT","PATCH","DELETE"];new Set(on);var za=["GET",...on];new Set(za);var Me=L.createContext(null);Me.displayName="DataRouter";var kt=L.createContext(null);kt.displayName="DataRouterState";var sn=L.createContext({isTransitioning:!1});sn.displayName="ViewTransition";var Na=L.createContext(new Map);Na.displayName="Fetchers";var Fa=L.createContext(null);Fa.displayName="Await";var we=L.createContext(null);we.displayName="Navigation";var Je=L.createContext(null);Je.displayName="Location";var ke=L.createContext({outlet:null,matches:[],isDataRoute:!1});ke.displayName="Route";var Vt=L.createContext(null);Vt.displayName="RouteError";function Wa(e,{relative:t}={}){ae(Ze(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=L.useContext(we),{hash:a,pathname:s,search:c}=Qe(e,{relative:t}),l=s;return r!=="/"&&(l=s==="/"?r:Se([r,s])),i.createHref({pathname:l,search:c,hash:a})}function Ze(){return L.useContext(Je)!=null}function Oe(){return ae(Ze(),"useLocation() may be used only in the context of a <Router> component."),L.useContext(Je).location}var ln="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function un(e){L.useContext(we).static||L.useLayoutEffect(e)}function Xt(){let{isDataRoute:e}=L.useContext(ke);return e?to():Ua()}function Ua(){ae(Ze(),"useNavigate() may be used only in the context of a <Router> component.");let e=L.useContext(Me),{basename:t,navigator:r}=L.useContext(we),{matches:i}=L.useContext(ke),{pathname:a}=Oe(),s=JSON.stringify(nn(i)),c=L.useRef(!1);return un(()=>{c.current=!0}),L.useCallback((u,h={})=>{if(ve(c.current,ln),!c.current)return;if(typeof u=="number"){r.go(u);return}let g=an(u,JSON.parse(s),a,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Se([t,g.pathname])),(h.replace?r.replace:r.push)(g,h.state,h)},[t,r,s,a,e])}L.createContext(null);function Qe(e,{relative:t}={}){let{matches:r}=L.useContext(ke),{pathname:i}=Oe(),a=JSON.stringify(nn(r));return L.useMemo(()=>an(e,JSON.parse(a),i,t==="path"),[e,a,i,t])}function Ya(e,t){return cn(e,t)}function cn(e,t,r,i){ae(Ze(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=L.useContext(we),{matches:s}=L.useContext(ke),c=s[s.length-1],l=c?c.params:{},u=c?c.pathname:"/",h=c?c.pathnameBase:"/",g=c&&c.route;{let k=g&&g.path||"";fn(u,!g||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
125
125
 
126
- Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let x=Oe(),j;if(t){let k=typeof t=="string"?Le(t):t;ae(h==="/"||k.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${k.pathname}" was given in the \`location\` prop.`),j=k}else j=x;let M=j.pathname||"/",P=M;if(h!=="/"){let k=h.replace(/^\//,"").split("/");P="/"+M.replace(/^\//,"").split("/").slice(k.length).join("/")}let p=en(e,{pathname:P});ve(g||p!=null,`No routes matched location "${j.pathname}${j.search}${j.hash}" `),ve(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${j.pathname}${j.search}${j.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let I=Ga(p&&p.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Se([h,a.encodeLocation?a.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?h:Se([h,a.encodeLocation?a.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),s,r,i);return t&&I?L.createElement(Je.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...j},navigationType:"POP"}},I):I}function qa(){let e=eo(),t=Ha(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:i},s={padding:"2px 4px",backgroundColor:i},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=L.createElement(L.Fragment,null,L.createElement("p",null,"💿 Hey developer 👋"),L.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",L.createElement("code",{style:s},"ErrorBoundary")," or"," ",L.createElement("code",{style:s},"errorElement")," prop on your route.")),L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},t),r?L.createElement("pre",{style:a},r):null,c)}var Ba=L.createElement(qa,null),Va=class extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?L.createElement(ke.Provider,{value:this.props.routeContext},L.createElement(Vt.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Xa({routeContext:e,match:t,children:r}){let i=L.useContext(Me);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),L.createElement(ke.Provider,{value:e},r)}function Ga(e,t=[],r=null,i=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,s=r?.errors;if(s!=null){let u=a.findIndex(h=>h.route.id&&s?.[h.route.id]!==void 0);ae(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let c=!1,l=-1;if(r)for(let u=0;u<a.length;u++){let h=a[u];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(l=u),h.route.id){let{loaderData:g,errors:x}=r,j=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!x||x[h.route.id]===void 0);if(h.route.lazy||j){c=!0,l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}return a.reduceRight((u,h,g)=>{let x,j=!1,M=null,P=null;r&&(x=s&&h.route.id?s[h.route.id]:void 0,M=h.route.errorElement||Ba,c&&(l<0&&g===0?(fn("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,P=null):l===g&&(j=!0,P=h.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,g+1)),I=()=>{let k;return x?k=M:j?k=P:h.route.Component?k=L.createElement(h.route.Component,null):h.route.element?k=h.route.element:k=u,L.createElement(Xa,{match:h,routeContext:{outlet:u,matches:p,isDataRoute:r!=null},children:k})};return r&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?L.createElement(Va,{location:r.location,revalidation:r.revalidation,component:M,error:x,children:I(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):I()},null)}function Gt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ka(e){let t=L.useContext(Me);return ae(t,Gt(e)),t}function Ja(e){let t=L.useContext(kt);return ae(t,Gt(e)),t}function Za(e){let t=L.useContext(ke);return ae(t,Gt(e)),t}function Kt(e){let t=Za(e),r=t.matches[t.matches.length-1];return ae(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Qa(){return Kt("useRouteId")}function eo(){let e=L.useContext(Vt),t=Ja("useRouteError"),r=Kt("useRouteError");return e!==void 0?e:t.errors?.[r]}function to(){let{router:e}=Ka("useNavigate"),t=Kt("useNavigate"),r=L.useRef(!1);return un(()=>{r.current=!0}),L.useCallback(async(a,s={})=>{ve(r.current,ln),r.current&&(typeof a=="number"?e.navigate(a):await e.navigate(a,{fromRouteId:t,...s}))},[e,t])}var _r={};function fn(e,t,r){!t&&!_r[e]&&(_r[e]=!0,ve(!1,r))}L.memo(ro);function ro({routes:e,future:t,state:r}){return cn(e,void 0,r,t)}function dn(e){ae(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function no({basename:e="/",children:t=null,location:r,navigationType:i="POP",navigator:a,static:s=!1}){ae(!Ze(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),l=L.useMemo(()=>({basename:c,navigator:a,static:s,future:{}}),[c,a,s]);typeof r=="string"&&(r=Le(r));let{pathname:u="/",search:h="",hash:g="",state:x=null,key:j="default"}=r,M=L.useMemo(()=>{let P=xe(u,c);return P==null?null:{location:{pathname:P,search:h,hash:g,state:x,key:j},navigationType:i}},[c,u,h,g,x,j,i]);return ve(M!=null,`<Router basename="${c}"> is not able to match the URL "${u}${h}${g}" because it does not start with the basename, so the <Router> won't render anything.`),M==null?null:L.createElement(we.Provider,{value:l},L.createElement(Je.Provider,{children:t,value:M}))}function io({children:e,location:t}){return Ya(Ft(e),t)}function Ft(e,t=[]){let r=[];return L.Children.forEach(e,(i,a)=>{if(!L.isValidElement(i))return;let s=[...t,a];if(i.type===L.Fragment){r.push.apply(r,Ft(i.props.children,s));return}ae(i.type===dn,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ae(!i.props.index||!i.props.children,"An index route cannot have child routes.");let c={id:i.props.id||s.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(c.children=Ft(i.props.children,s)),r.push(c)}),r}var ut="get",ct="application/x-www-form-urlencoded";function Ot(e){return e!=null&&typeof e.tagName=="string"}function ao(e){return Ot(e)&&e.tagName.toLowerCase()==="button"}function oo(e){return Ot(e)&&e.tagName.toLowerCase()==="form"}function so(e){return Ot(e)&&e.tagName.toLowerCase()==="input"}function lo(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function uo(e,t){return e.button===0&&(!t||t==="_self")&&!lo(e)}function Wt(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let i=e[r];return t.concat(Array.isArray(i)?i.map(a=>[r,a]):[[r,i]])},[]))}function co(e,t){let r=Wt(e);return t&&t.forEach((i,a)=>{r.has(a)||t.getAll(a).forEach(s=>{r.append(a,s)})}),r}var at=null;function fo(){if(at===null)try{new FormData(document.createElement("form"),0),at=!1}catch{at=!0}return at}var ho=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function $t(e){return e!=null&&!ho.has(e)?(ve(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ct}"`),null):e}function po(e,t){let r,i,a,s,c;if(oo(e)){let l=e.getAttribute("action");i=l?xe(l,t):null,r=e.getAttribute("method")||ut,a=$t(e.getAttribute("enctype"))||ct,s=new FormData(e)}else if(ao(e)||so(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||l.getAttribute("action");if(i=u?xe(u,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||ut,a=$t(e.getAttribute("formenctype"))||$t(l.getAttribute("enctype"))||ct,s=new FormData(l,e),!fo()){let{name:h,type:g,value:x}=e;if(g==="image"){let j=h?`${h}.`:"";s.append(`${j}x`,"0"),s.append(`${j}y`,"0")}else h&&s.append(h,x)}}else{if(Ot(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ut,i=null,a=ct,c=e}return s&&a==="text/plain"&&(c=s,s=void 0),{action:i,method:r.toLowerCase(),encType:a,formData:s,body:c}}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function mo(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function vo(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function go(e,t,r){let i=await Promise.all(e.map(async a=>{let s=t.routes[a.route.id];if(s){let c=await mo(s,r);return c.links?c.links():[]}return[]}));return So(i.flat(1).filter(vo).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function jr(e,t,r,i,a,s){let c=(u,h)=>r[h]?u.route.id!==r[h].route.id:!0,l=(u,h)=>r[h].pathname!==u.pathname||r[h].route.path?.endsWith("*")&&r[h].params["*"]!==u.params["*"];return s==="assets"?t.filter((u,h)=>c(u,h)||l(u,h)):s==="data"?t.filter((u,h)=>{let g=i.routes[u.route.id];if(!g||!g.hasLoader)return!1;if(c(u,h)||l(u,h))return!0;if(u.route.shouldRevalidate){let x=u.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function yo(e,t,{includeHydrateFallback:r}={}){return bo(e.map(i=>{let a=t.routes[i.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),r&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function bo(e){return[...new Set(e)]}function wo(e){let t={},r=Object.keys(e).sort();for(let i of r)t[i]=e[i];return t}function So(e,t){let r=new Set;return new Set(t),e.reduce((i,a)=>{let s=JSON.stringify(wo(a));return r.has(s)||(r.add(s),i.push({key:s,link:a})),i},[])}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var xo=new Set([100,101,204,205]);function ko(e,t){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname="_root.data":t&&xe(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.data`:r.pathname=`${r.pathname.replace(/\/$/,"")}.data`,r}function hn(){let e=L.useContext(Me);return Jt(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Oo(){let e=L.useContext(kt);return Jt(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Zt=L.createContext(void 0);Zt.displayName="FrameworkContext";function pn(){let e=L.useContext(Zt);return Jt(e,"You must render this element inside a <HydratedRouter> element"),e}function Co(e,t){let r=L.useContext(Zt),[i,a]=L.useState(!1),[s,c]=L.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:h,onMouseLeave:g,onTouchStart:x}=t,j=L.useRef(null);L.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let p=k=>{k.forEach(F=>{c(F.isIntersecting)})},I=new IntersectionObserver(p,{threshold:.5});return j.current&&I.observe(j.current),()=>{I.disconnect()}}},[e]),L.useEffect(()=>{if(i){let p=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(p)}}},[i]);let M=()=>{a(!0)},P=()=>{a(!1),c(!1)};return r?e!=="intent"?[s,j,{}]:[s,j,{onFocus:Ye(l,M),onBlur:Ye(u,P),onMouseEnter:Ye(h,M),onMouseLeave:Ye(g,P),onTouchStart:Ye(x,M)}]:[!1,j,{}]}function Ye(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Po({page:e,...t}){let{router:r}=hn(),i=L.useMemo(()=>en(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?L.createElement(Ro,{page:e,matches:i,...t}):null}function Eo(e){let{manifest:t,routeModules:r}=pn(),[i,a]=L.useState([]);return L.useEffect(()=>{let s=!1;return go(e,t,r).then(c=>{s||a(c)}),()=>{s=!0}},[e,t,r]),i}function Ro({page:e,matches:t,...r}){let i=Oe(),{manifest:a,routeModules:s}=pn(),{basename:c}=hn(),{loaderData:l,matches:u}=Oo(),h=L.useMemo(()=>jr(e,t,u,a,i,"data"),[e,t,u,a,i]),g=L.useMemo(()=>jr(e,t,u,a,i,"assets"),[e,t,u,a,i]),x=L.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let P=new Set,p=!1;if(t.forEach(k=>{let F=a.routes[k.route.id];!F||!F.hasLoader||(!h.some(U=>U.route.id===k.route.id)&&k.route.id in l&&s[k.route.id]?.shouldRevalidate||F.hasClientLoader?p=!0:P.add(k.route.id))}),P.size===0)return[];let I=ko(e,c);return p&&P.size>0&&I.searchParams.set("_routes",t.filter(k=>P.has(k.route.id)).map(k=>k.route.id).join(",")),[I.pathname+I.search]},[c,l,i,a,h,t,e,s]),j=L.useMemo(()=>yo(g,a),[g,a]),M=Eo(g);return L.createElement(L.Fragment,null,x.map(P=>L.createElement("link",{key:P,rel:"prefetch",as:"fetch",href:P,...r})),j.map(P=>L.createElement("link",{key:P,rel:"modulepreload",href:P,...r})),M.map(({key:P,link:p})=>L.createElement("link",{key:P,...p})))}function To(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var mn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{mn&&(window.__reactRouterVersion="7.6.3")}catch{}function _o({basename:e,children:t,window:r}){let i=L.useRef();i.current==null&&(i.current=ma({window:r,v5Compat:!0}));let a=i.current,[s,c]=L.useState({action:a.action,location:a.location}),l=L.useCallback(u=>{L.startTransition(()=>c(u))},[c]);return L.useLayoutEffect(()=>a.listen(l),[a,l]),L.createElement(no,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a})}var vn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,gn=L.forwardRef(function({onClick:t,discover:r="render",prefetch:i="none",relative:a,reloadDocument:s,replace:c,state:l,target:u,to:h,preventScrollReset:g,viewTransition:x,...j},M){let{basename:P}=L.useContext(we),p=typeof h=="string"&&vn.test(h),I,k=!1;if(typeof h=="string"&&p&&(I=h,mn))try{let y=new URL(window.location.href),d=h.startsWith("//")?new URL(y.protocol+h):new URL(h),O=xe(d.pathname,P);d.origin===y.origin&&O!=null?h=O+d.search+d.hash:k=!0}catch{ve(!1,`<Link to="${h}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let F=Wa(h,{relative:a}),[U,B,v]=Co(i,j),b=Mo(h,{replace:c,state:l,target:u,preventScrollReset:g,relative:a,viewTransition:x});function w(y){t&&t(y),y.defaultPrevented||b(y)}let E=L.createElement("a",{...j,...v,href:I||F,onClick:k||s?t:w,ref:To(M,B),target:u,"data-discover":!p&&r==="render"?"true":void 0});return U&&!p?L.createElement(L.Fragment,null,E,L.createElement(Po,{page:F})):E});gn.displayName="Link";var jo=L.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:i="",end:a=!1,style:s,to:c,viewTransition:l,children:u,...h},g){let x=Qe(c,{relative:h.relative}),j=Oe(),M=L.useContext(kt),{navigator:P,basename:p}=L.useContext(we),I=M!=null&&No(x)&&l===!0,k=P.encodeLocation?P.encodeLocation(x).pathname:x.pathname,F=j.pathname,U=M&&M.navigation&&M.navigation.location?M.navigation.location.pathname:null;r||(F=F.toLowerCase(),U=U?U.toLowerCase():null,k=k.toLowerCase()),U&&p&&(U=xe(U,p)||U);const B=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let v=F===k||!a&&F.startsWith(k)&&F.charAt(B)==="/",b=U!=null&&(U===k||!a&&U.startsWith(k)&&U.charAt(k.length)==="/"),w={isActive:v,isPending:b,isTransitioning:I},E=v?t:void 0,y;typeof i=="function"?y=i(w):y=[i,v?"active":null,b?"pending":null,I?"transitioning":null].filter(Boolean).join(" ");let d=typeof s=="function"?s(w):s;return L.createElement(gn,{...h,"aria-current":E,className:y,ref:g,style:d,to:c,viewTransition:l},typeof u=="function"?u(w):u)});jo.displayName="NavLink";var Do=L.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:a,state:s,method:c=ut,action:l,onSubmit:u,relative:h,preventScrollReset:g,viewTransition:x,...j},M)=>{let P=Ho(),p=zo(l,{relative:h}),I=c.toLowerCase()==="get"?"get":"post",k=typeof l=="string"&&vn.test(l),F=U=>{if(u&&u(U),U.defaultPrevented)return;U.preventDefault();let B=U.nativeEvent.submitter,v=B?.getAttribute("formmethod")||c;P(B||U.currentTarget,{fetcherKey:t,method:v,navigate:r,replace:a,state:s,relative:h,preventScrollReset:g,viewTransition:x})};return L.createElement("form",{ref:M,method:I,action:p,onSubmit:i?u:F,...j,"data-discover":!k&&e==="render"?"true":void 0})});Do.displayName="Form";function Lo(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yn(e){let t=L.useContext(Me);return ae(t,Lo(e)),t}function Mo(e,{target:t,replace:r,state:i,preventScrollReset:a,relative:s,viewTransition:c}={}){let l=Xt(),u=Oe(),h=Qe(e,{relative:s});return L.useCallback(g=>{if(uo(g,t)){g.preventDefault();let x=r!==void 0?r:Xe(u)===Xe(h);l(e,{replace:x,state:i,preventScrollReset:a,relative:s,viewTransition:c})}},[u,l,h,r,i,t,e,a,s,c])}function $o(e){ve(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=L.useRef(Wt(e)),r=L.useRef(!1),i=Oe(),a=L.useMemo(()=>co(i.search,r.current?null:t.current),[i.search]),s=Xt(),c=L.useCallback((l,u)=>{const h=Wt(typeof l=="function"?l(a):l);r.current=!0,s("?"+h,u)},[s,a]);return[a,c]}var Io=0,Ao=()=>`__${String(++Io)}__`;function Ho(){let{router:e}=yn("useSubmit"),{basename:t}=L.useContext(we),r=Qa();return L.useCallback(async(i,a={})=>{let{action:s,method:c,encType:l,formData:u,body:h}=po(i,t);if(a.navigate===!1){let g=a.fetcherKey||Ao();await e.fetch(g,r,a.action||s,{preventScrollReset:a.preventScrollReset,formData:u,body:h,formMethod:a.method||c,formEncType:a.encType||l,flushSync:a.flushSync})}else await e.navigate(a.action||s,{preventScrollReset:a.preventScrollReset,formData:u,body:h,formMethod:a.method||c,formEncType:a.encType||l,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,r])}function zo(e,{relative:t}={}){let{basename:r}=L.useContext(we),i=L.useContext(ke);ae(i,"useFormAction must be used inside a RouteContext");let[a]=i.matches.slice(-1),s={...Qe(e||".",{relative:t})},c=Oe();if(e==null){s.search=c.search;let l=new URLSearchParams(s.search),u=l.getAll("index");if(u.some(g=>g==="")){l.delete("index"),u.filter(x=>x).forEach(x=>l.append("index",x));let g=l.toString();s.search=g?`?${g}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(s.pathname=s.pathname==="/"?r:Se([r,s.pathname])),Xe(s)}function No(e,t={}){let r=L.useContext(sn);ae(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=yn("useViewTransitionState"),a=Qe(e,{relative:t.relative});if(!r.isTransitioning)return!1;let s=xe(r.currentLocation.pathname,i)||r.currentLocation.pathname,c=xe(r.nextLocation.pathname,i)||r.nextLocation.pathname;return gt(a.pathname,c)!=null||gt(a.pathname,s)!=null}[...xo];const bn=Y.createContext({history:[],addToHistory:()=>{},popFromHistory:()=>"",replaceHistory:()=>{}}),Fo=()=>{const[e,t]=$o(),r=Y.useMemo(()=>Object.fromEntries(e.entries()),[e]),i=Y.useCallback(h=>{const g={};return h.forEach(x=>{g[x]=e.get(x)}),g},[e]),a=Y.useCallback(h=>{const g=e.get(h);return g==null||g==null,g},[e]),s=Y.useCallback((h,g)=>{const x=new URLSearchParams(e);x.set(h,String(g)),t(x)},[e,t]),c=Y.useCallback(h=>{const g=new URLSearchParams(e);Object.entries(h).forEach(([x,j])=>{j!=null&&g.set(x,String(j))}),t(g)},[e,t]),l=Y.useCallback(h=>{const g=new URLSearchParams(e);g.delete(h),t(g)},[e,t]),u=Y.useCallback(h=>{const g=new URLSearchParams(e);h.forEach(x=>{g.delete(String(x))}),t(g)},[e,t]);return{getAll:()=>r,get:a,getMany:i,set:s,setMany:c,remove:l,removeMany:u}},Wo=()=>{const e=Xt(),t=Oe(),r=Fo(),i=Y.useContext(bn),a=l=>{const u=new URL(l.path,"http://dummy-base");return l.params&&Object.entries(l.params).forEach(([h,g])=>{g!=null&&u.searchParams.set(h,String(g))}),u.pathname+u.search},s=Y.useCallback(l=>{const u=a(l);l.addToHistory!==!1?(e(u),i.addToHistory(u)):(e(u,{replace:!0}),i.popFromHistory(1),i.addToHistory(u))},[e]),c=Y.useCallback(l=>{const u=l||1;e(-u),i.popFromHistory(u)},[e]);return{currentPath:t.pathname,history:i.history,searchParams:r,goBack:c,goTo:s}},Uo=({isReady:e=!0,routes:t,children:r})=>{const i=Y.useRef([]),[a,s]=Y.useState([]),c=Y.useCallback(x=>{i.current=x,s(x)},[]),l=(x,j=!1)=>{let M=[...i.current];j&&(M=M.slice(0,M.length-1)),M=[...M,x],c(M)},u=x=>{let j="",M=[];return i.current.length===0?"/":(i.current.length<=x?(j=i.current[0],M=[j]):(M=i.current.slice(0,i.current.length-x),j=M[M.length-1]),c(M),j)},h=x=>{c(x)},g=t.map(x=>G.jsx(dn,{path:x.path,element:x.render}));return G.jsx(bn.Provider,{value:{history:a,addToHistory:l,popFromHistory:u,replaceHistory:h},children:G.jsx(_o,{children:e&&G.jsxs(G.Fragment,{children:[r,G.jsx(io,{children:g})]})})})},wn=Y.createContext({visibleItems:[],isItemVisible:()=>!1,showItem:()=>{},hideItem:()=>{}}),Yo=({children:e})=>{const t=Y.useRef([]),[r,i]=Y.useState([]),a=Y.useCallback(u=>{t.current=u,i(u)},[]),s=Y.useCallback(u=>t.current.some(h=>h===u),[]),c=Y.useCallback(u=>{s(u)||a([...t.current,u])},[s,a]),l=Y.useCallback(u=>{s(u)&&a(t.current.filter(g=>g!==u))},[s,a]);return G.jsx(wn.Provider,{value:{visibleItems:r,isItemVisible:s,showItem:c,hideItem:l},children:e})},et=()=>{const e=Y.useContext(wn),t=a=>e.visibleItems.some(s=>s===a),r=a=>{e.showItem(a)},i=a=>{e.hideItem(a)};return{visibleItems:e.visibleItems,isItemVisible:t,showItem:r,hideItem:i}},qo=({id:e,onCloseDrawer:t,drawerCloseOffset:r=15})=>{const{isItemVisible:i}=et(),[a,s]=Y.useState({isDragging:!1}),c=Y.useRef(null),l=Y.useRef(null),u=Y.useRef(null),[h,g]=Y.useState(0),x=P=>{s(P)},j=P=>{s(P),g(0)};return Zr({ref:u,onDrag:P=>{s(P);const p=l.current?.clientHeight||0;P.distanceY&&(g(P.distanceY<0?0:-P.distanceY),P.distanceY>=p-r&&(t?.(),j(P)))},onDragEnd:j,onDragStart:x}),{isVisible:i(e),drawerParentRef:c,drawerRef:l,drawerBottomDistance:h,handleRef:u}},Bo=e=>{const{children:t,backgroundStyles:r,contentStyles:i,handle:a}=e,{isVisible:s,drawerParentRef:c,drawerRef:l,handleRef:u,drawerBottomDistance:h}=qo(e);return G.jsx(G.Fragment,{children:s&&G.jsx("div",{ref:c,style:{width:"100%",height:"100%",minHeight:"100vh",left:0,top:0,background:"#00000068",position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column",touchAction:"none",...r},children:G.jsxs("div",{ref:l,style:{width:"100%",height:"fit-content",minHeight:"80px",maxHeight:"90%",background:"#ffffff",borderTopLeftRadius:"16px",borderTopRightRadius:"16px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px",zIndex:1001,position:"absolute",bottom:`${h}px`,...i},onClick:g=>{g.stopPropagation()},children:[G.jsx("div",{ref:u,style:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0px",height:"24px",width:"100%",cursor:"pointer",...a?.styles},children:a?.render}),t]})})})},Vo=({onSubmit:e,fields:t})=>{const r=Y.useRef(null),i=Y.useCallback(c=>{var l=Object.keys(c.currentTarget.elements),u=Object.values(c.currentTarget.elements),h=[];console.debug("Form > ",{event:c,elementIds:l,elementValues:u});for(let g=0;g<l.length;g++){const x=l[g];if(t.list.findIndex(M=>M.name===x)===-1)continue;const j=u[g].value;h.push({name:x,value:j})}return h},[e]),a=Y.useCallback(c=>{c.preventDefault(),c.stopPropagation();const l=i(c);e?.(l)},[e]);return{ref:r,submitForm:c=>{r.current&&r.current.requestSubmit()},handleFormSubmission:a}},Xo=Pe.div`
126
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let x=Oe(),j;if(t){let k=typeof t=="string"?Le(t):t;ae(h==="/"||k.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${k.pathname}" was given in the \`location\` prop.`),j=k}else j=x;let M=j.pathname||"/",P=M;if(h!=="/"){let k=h.replace(/^\//,"").split("/");P="/"+M.replace(/^\//,"").split("/").slice(k.length).join("/")}let p=en(e,{pathname:P});ve(g||p!=null,`No routes matched location "${j.pathname}${j.search}${j.hash}" `),ve(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${j.pathname}${j.search}${j.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let I=Ga(p&&p.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Se([h,a.encodeLocation?a.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?h:Se([h,a.encodeLocation?a.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),s,r,i);return t&&I?L.createElement(Je.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...j},navigationType:"POP"}},I):I}function qa(){let e=eo(),t=Ha(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:i},s={padding:"2px 4px",backgroundColor:i},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=L.createElement(L.Fragment,null,L.createElement("p",null,"💿 Hey developer 👋"),L.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",L.createElement("code",{style:s},"ErrorBoundary")," or"," ",L.createElement("code",{style:s},"errorElement")," prop on your route.")),L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},t),r?L.createElement("pre",{style:a},r):null,c)}var Ba=L.createElement(qa,null),Va=class extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?L.createElement(ke.Provider,{value:this.props.routeContext},L.createElement(Vt.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Xa({routeContext:e,match:t,children:r}){let i=L.useContext(Me);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),L.createElement(ke.Provider,{value:e},r)}function Ga(e,t=[],r=null,i=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,s=r?.errors;if(s!=null){let u=a.findIndex(h=>h.route.id&&s?.[h.route.id]!==void 0);ae(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let c=!1,l=-1;if(r)for(let u=0;u<a.length;u++){let h=a[u];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(l=u),h.route.id){let{loaderData:g,errors:x}=r,j=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!x||x[h.route.id]===void 0);if(h.route.lazy||j){c=!0,l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}return a.reduceRight((u,h,g)=>{let x,j=!1,M=null,P=null;r&&(x=s&&h.route.id?s[h.route.id]:void 0,M=h.route.errorElement||Ba,c&&(l<0&&g===0?(fn("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,P=null):l===g&&(j=!0,P=h.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,g+1)),I=()=>{let k;return x?k=M:j?k=P:h.route.Component?k=L.createElement(h.route.Component,null):h.route.element?k=h.route.element:k=u,L.createElement(Xa,{match:h,routeContext:{outlet:u,matches:p,isDataRoute:r!=null},children:k})};return r&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?L.createElement(Va,{location:r.location,revalidation:r.revalidation,component:M,error:x,children:I(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):I()},null)}function Gt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ka(e){let t=L.useContext(Me);return ae(t,Gt(e)),t}function Ja(e){let t=L.useContext(kt);return ae(t,Gt(e)),t}function Za(e){let t=L.useContext(ke);return ae(t,Gt(e)),t}function Kt(e){let t=Za(e),r=t.matches[t.matches.length-1];return ae(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Qa(){return Kt("useRouteId")}function eo(){let e=L.useContext(Vt),t=Ja("useRouteError"),r=Kt("useRouteError");return e!==void 0?e:t.errors?.[r]}function to(){let{router:e}=Ka("useNavigate"),t=Kt("useNavigate"),r=L.useRef(!1);return un(()=>{r.current=!0}),L.useCallback(async(a,s={})=>{ve(r.current,ln),r.current&&(typeof a=="number"?e.navigate(a):await e.navigate(a,{fromRouteId:t,...s}))},[e,t])}var _r={};function fn(e,t,r){!t&&!_r[e]&&(_r[e]=!0,ve(!1,r))}L.memo(ro);function ro({routes:e,future:t,state:r}){return cn(e,void 0,r,t)}function dn(e){ae(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function no({basename:e="/",children:t=null,location:r,navigationType:i="POP",navigator:a,static:s=!1}){ae(!Ze(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),l=L.useMemo(()=>({basename:c,navigator:a,static:s,future:{}}),[c,a,s]);typeof r=="string"&&(r=Le(r));let{pathname:u="/",search:h="",hash:g="",state:x=null,key:j="default"}=r,M=L.useMemo(()=>{let P=xe(u,c);return P==null?null:{location:{pathname:P,search:h,hash:g,state:x,key:j},navigationType:i}},[c,u,h,g,x,j,i]);return ve(M!=null,`<Router basename="${c}"> is not able to match the URL "${u}${h}${g}" because it does not start with the basename, so the <Router> won't render anything.`),M==null?null:L.createElement(we.Provider,{value:l},L.createElement(Je.Provider,{children:t,value:M}))}function io({children:e,location:t}){return Ya(Ft(e),t)}function Ft(e,t=[]){let r=[];return L.Children.forEach(e,(i,a)=>{if(!L.isValidElement(i))return;let s=[...t,a];if(i.type===L.Fragment){r.push.apply(r,Ft(i.props.children,s));return}ae(i.type===dn,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ae(!i.props.index||!i.props.children,"An index route cannot have child routes.");let c={id:i.props.id||s.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(c.children=Ft(i.props.children,s)),r.push(c)}),r}var ut="get",ct="application/x-www-form-urlencoded";function Ot(e){return e!=null&&typeof e.tagName=="string"}function ao(e){return Ot(e)&&e.tagName.toLowerCase()==="button"}function oo(e){return Ot(e)&&e.tagName.toLowerCase()==="form"}function so(e){return Ot(e)&&e.tagName.toLowerCase()==="input"}function lo(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function uo(e,t){return e.button===0&&(!t||t==="_self")&&!lo(e)}function Wt(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let i=e[r];return t.concat(Array.isArray(i)?i.map(a=>[r,a]):[[r,i]])},[]))}function co(e,t){let r=Wt(e);return t&&t.forEach((i,a)=>{r.has(a)||t.getAll(a).forEach(s=>{r.append(a,s)})}),r}var at=null;function fo(){if(at===null)try{new FormData(document.createElement("form"),0),at=!1}catch{at=!0}return at}var ho=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function $t(e){return e!=null&&!ho.has(e)?(ve(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ct}"`),null):e}function po(e,t){let r,i,a,s,c;if(oo(e)){let l=e.getAttribute("action");i=l?xe(l,t):null,r=e.getAttribute("method")||ut,a=$t(e.getAttribute("enctype"))||ct,s=new FormData(e)}else if(ao(e)||so(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||l.getAttribute("action");if(i=u?xe(u,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||ut,a=$t(e.getAttribute("formenctype"))||$t(l.getAttribute("enctype"))||ct,s=new FormData(l,e),!fo()){let{name:h,type:g,value:x}=e;if(g==="image"){let j=h?`${h}.`:"";s.append(`${j}x`,"0"),s.append(`${j}y`,"0")}else h&&s.append(h,x)}}else{if(Ot(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ut,i=null,a=ct,c=e}return s&&a==="text/plain"&&(c=s,s=void 0),{action:i,method:r.toLowerCase(),encType:a,formData:s,body:c}}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function mo(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function vo(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function go(e,t,r){let i=await Promise.all(e.map(async a=>{let s=t.routes[a.route.id];if(s){let c=await mo(s,r);return c.links?c.links():[]}return[]}));return So(i.flat(1).filter(vo).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function jr(e,t,r,i,a,s){let c=(u,h)=>r[h]?u.route.id!==r[h].route.id:!0,l=(u,h)=>r[h].pathname!==u.pathname||r[h].route.path?.endsWith("*")&&r[h].params["*"]!==u.params["*"];return s==="assets"?t.filter((u,h)=>c(u,h)||l(u,h)):s==="data"?t.filter((u,h)=>{let g=i.routes[u.route.id];if(!g||!g.hasLoader)return!1;if(c(u,h)||l(u,h))return!0;if(u.route.shouldRevalidate){let x=u.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function yo(e,t,{includeHydrateFallback:r}={}){return bo(e.map(i=>{let a=t.routes[i.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),r&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function bo(e){return[...new Set(e)]}function wo(e){let t={},r=Object.keys(e).sort();for(let i of r)t[i]=e[i];return t}function So(e,t){let r=new Set;return new Set(t),e.reduce((i,a)=>{let s=JSON.stringify(wo(a));return r.has(s)||(r.add(s),i.push({key:s,link:a})),i},[])}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var xo=new Set([100,101,204,205]);function ko(e,t){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname="_root.data":t&&xe(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.data`:r.pathname=`${r.pathname.replace(/\/$/,"")}.data`,r}function hn(){let e=L.useContext(Me);return Jt(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Oo(){let e=L.useContext(kt);return Jt(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Zt=L.createContext(void 0);Zt.displayName="FrameworkContext";function pn(){let e=L.useContext(Zt);return Jt(e,"You must render this element inside a <HydratedRouter> element"),e}function Co(e,t){let r=L.useContext(Zt),[i,a]=L.useState(!1),[s,c]=L.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:h,onMouseLeave:g,onTouchStart:x}=t,j=L.useRef(null);L.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let p=k=>{k.forEach(F=>{c(F.isIntersecting)})},I=new IntersectionObserver(p,{threshold:.5});return j.current&&I.observe(j.current),()=>{I.disconnect()}}},[e]),L.useEffect(()=>{if(i){let p=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(p)}}},[i]);let M=()=>{a(!0)},P=()=>{a(!1),c(!1)};return r?e!=="intent"?[s,j,{}]:[s,j,{onFocus:Ye(l,M),onBlur:Ye(u,P),onMouseEnter:Ye(h,M),onMouseLeave:Ye(g,P),onTouchStart:Ye(x,M)}]:[!1,j,{}]}function Ye(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Po({page:e,...t}){let{router:r}=hn(),i=L.useMemo(()=>en(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?L.createElement(Ro,{page:e,matches:i,...t}):null}function Eo(e){let{manifest:t,routeModules:r}=pn(),[i,a]=L.useState([]);return L.useEffect(()=>{let s=!1;return go(e,t,r).then(c=>{s||a(c)}),()=>{s=!0}},[e,t,r]),i}function Ro({page:e,matches:t,...r}){let i=Oe(),{manifest:a,routeModules:s}=pn(),{basename:c}=hn(),{loaderData:l,matches:u}=Oo(),h=L.useMemo(()=>jr(e,t,u,a,i,"data"),[e,t,u,a,i]),g=L.useMemo(()=>jr(e,t,u,a,i,"assets"),[e,t,u,a,i]),x=L.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let P=new Set,p=!1;if(t.forEach(k=>{let F=a.routes[k.route.id];!F||!F.hasLoader||(!h.some(U=>U.route.id===k.route.id)&&k.route.id in l&&s[k.route.id]?.shouldRevalidate||F.hasClientLoader?p=!0:P.add(k.route.id))}),P.size===0)return[];let I=ko(e,c);return p&&P.size>0&&I.searchParams.set("_routes",t.filter(k=>P.has(k.route.id)).map(k=>k.route.id).join(",")),[I.pathname+I.search]},[c,l,i,a,h,t,e,s]),j=L.useMemo(()=>yo(g,a),[g,a]),M=Eo(g);return L.createElement(L.Fragment,null,x.map(P=>L.createElement("link",{key:P,rel:"prefetch",as:"fetch",href:P,...r})),j.map(P=>L.createElement("link",{key:P,rel:"modulepreload",href:P,...r})),M.map(({key:P,link:p})=>L.createElement("link",{key:P,...p})))}function To(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var mn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{mn&&(window.__reactRouterVersion="7.6.3")}catch{}function _o({basename:e,children:t,window:r}){let i=L.useRef();i.current==null&&(i.current=ma({window:r,v5Compat:!0}));let a=i.current,[s,c]=L.useState({action:a.action,location:a.location}),l=L.useCallback(u=>{L.startTransition(()=>c(u))},[c]);return L.useLayoutEffect(()=>a.listen(l),[a,l]),L.createElement(no,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a})}var vn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,gn=L.forwardRef(function({onClick:t,discover:r="render",prefetch:i="none",relative:a,reloadDocument:s,replace:c,state:l,target:u,to:h,preventScrollReset:g,viewTransition:x,...j},M){let{basename:P}=L.useContext(we),p=typeof h=="string"&&vn.test(h),I,k=!1;if(typeof h=="string"&&p&&(I=h,mn))try{let y=new URL(window.location.href),d=h.startsWith("//")?new URL(y.protocol+h):new URL(h),O=xe(d.pathname,P);d.origin===y.origin&&O!=null?h=O+d.search+d.hash:k=!0}catch{ve(!1,`<Link to="${h}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let F=Wa(h,{relative:a}),[U,B,v]=Co(i,j),b=Mo(h,{replace:c,state:l,target:u,preventScrollReset:g,relative:a,viewTransition:x});function w(y){t&&t(y),y.defaultPrevented||b(y)}let E=L.createElement("a",{...j,...v,href:I||F,onClick:k||s?t:w,ref:To(M,B),target:u,"data-discover":!p&&r==="render"?"true":void 0});return U&&!p?L.createElement(L.Fragment,null,E,L.createElement(Po,{page:F})):E});gn.displayName="Link";var jo=L.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:i="",end:a=!1,style:s,to:c,viewTransition:l,children:u,...h},g){let x=Qe(c,{relative:h.relative}),j=Oe(),M=L.useContext(kt),{navigator:P,basename:p}=L.useContext(we),I=M!=null&&No(x)&&l===!0,k=P.encodeLocation?P.encodeLocation(x).pathname:x.pathname,F=j.pathname,U=M&&M.navigation&&M.navigation.location?M.navigation.location.pathname:null;r||(F=F.toLowerCase(),U=U?U.toLowerCase():null,k=k.toLowerCase()),U&&p&&(U=xe(U,p)||U);const B=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let v=F===k||!a&&F.startsWith(k)&&F.charAt(B)==="/",b=U!=null&&(U===k||!a&&U.startsWith(k)&&U.charAt(k.length)==="/"),w={isActive:v,isPending:b,isTransitioning:I},E=v?t:void 0,y;typeof i=="function"?y=i(w):y=[i,v?"active":null,b?"pending":null,I?"transitioning":null].filter(Boolean).join(" ");let d=typeof s=="function"?s(w):s;return L.createElement(gn,{...h,"aria-current":E,className:y,ref:g,style:d,to:c,viewTransition:l},typeof u=="function"?u(w):u)});jo.displayName="NavLink";var Do=L.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:a,state:s,method:c=ut,action:l,onSubmit:u,relative:h,preventScrollReset:g,viewTransition:x,...j},M)=>{let P=Ho(),p=zo(l,{relative:h}),I=c.toLowerCase()==="get"?"get":"post",k=typeof l=="string"&&vn.test(l),F=U=>{if(u&&u(U),U.defaultPrevented)return;U.preventDefault();let B=U.nativeEvent.submitter,v=B?.getAttribute("formmethod")||c;P(B||U.currentTarget,{fetcherKey:t,method:v,navigate:r,replace:a,state:s,relative:h,preventScrollReset:g,viewTransition:x})};return L.createElement("form",{ref:M,method:I,action:p,onSubmit:i?u:F,...j,"data-discover":!k&&e==="render"?"true":void 0})});Do.displayName="Form";function Lo(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yn(e){let t=L.useContext(Me);return ae(t,Lo(e)),t}function Mo(e,{target:t,replace:r,state:i,preventScrollReset:a,relative:s,viewTransition:c}={}){let l=Xt(),u=Oe(),h=Qe(e,{relative:s});return L.useCallback(g=>{if(uo(g,t)){g.preventDefault();let x=r!==void 0?r:Xe(u)===Xe(h);l(e,{replace:x,state:i,preventScrollReset:a,relative:s,viewTransition:c})}},[u,l,h,r,i,t,e,a,s,c])}function $o(e){ve(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=L.useRef(Wt(e)),r=L.useRef(!1),i=Oe(),a=L.useMemo(()=>co(i.search,r.current?null:t.current),[i.search]),s=Xt(),c=L.useCallback((l,u)=>{const h=Wt(typeof l=="function"?l(a):l);r.current=!0,s("?"+h,u)},[s,a]);return[a,c]}var Io=0,Ao=()=>`__${String(++Io)}__`;function Ho(){let{router:e}=yn("useSubmit"),{basename:t}=L.useContext(we),r=Qa();return L.useCallback(async(i,a={})=>{let{action:s,method:c,encType:l,formData:u,body:h}=po(i,t);if(a.navigate===!1){let g=a.fetcherKey||Ao();await e.fetch(g,r,a.action||s,{preventScrollReset:a.preventScrollReset,formData:u,body:h,formMethod:a.method||c,formEncType:a.encType||l,flushSync:a.flushSync})}else await e.navigate(a.action||s,{preventScrollReset:a.preventScrollReset,formData:u,body:h,formMethod:a.method||c,formEncType:a.encType||l,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,r])}function zo(e,{relative:t}={}){let{basename:r}=L.useContext(we),i=L.useContext(ke);ae(i,"useFormAction must be used inside a RouteContext");let[a]=i.matches.slice(-1),s={...Qe(e||".",{relative:t})},c=Oe();if(e==null){s.search=c.search;let l=new URLSearchParams(s.search),u=l.getAll("index");if(u.some(g=>g==="")){l.delete("index"),u.filter(x=>x).forEach(x=>l.append("index",x));let g=l.toString();s.search=g?`?${g}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(s.pathname=s.pathname==="/"?r:Se([r,s.pathname])),Xe(s)}function No(e,t={}){let r=L.useContext(sn);ae(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=yn("useViewTransitionState"),a=Qe(e,{relative:t.relative});if(!r.isTransitioning)return!1;let s=xe(r.currentLocation.pathname,i)||r.currentLocation.pathname,c=xe(r.nextLocation.pathname,i)||r.nextLocation.pathname;return gt(a.pathname,c)!=null||gt(a.pathname,s)!=null}[...xo];const bn=Y.createContext({history:[],addToHistory:()=>{},popFromHistory:()=>"",replaceHistory:()=>{}}),Fo=()=>{const[e,t]=$o(),r=Y.useMemo(()=>Object.fromEntries(e.entries()),[e]),i=Y.useCallback(h=>{const g={};return h.forEach(x=>{g[x]=e.get(x)}),g},[e]),a=Y.useCallback(h=>{const g=e.get(h);return g==null||g==null,g},[e]),s=Y.useCallback((h,g)=>{const x=new URLSearchParams(e);x.set(h,String(g)),t(x)},[e,t]),c=Y.useCallback(h=>{const g=new URLSearchParams(e);Object.entries(h).forEach(([x,j])=>{j!=null&&g.set(x,String(j))}),t(g)},[e,t]),l=Y.useCallback(h=>{const g=new URLSearchParams(e);g.delete(h),t(g)},[e,t]),u=Y.useCallback(h=>{const g=new URLSearchParams(e);h.forEach(x=>{g.delete(String(x))}),t(g)},[e,t]);return{getAll:()=>r,get:a,getMany:i,set:s,setMany:c,remove:l,removeMany:u}},Wo=()=>{const e=Xt(),t=Oe(),r=Fo(),i=Y.useContext(bn),a=l=>{const u=new URL(l.path,"http://dummy-base");return l.params&&Object.entries(l.params).forEach(([h,g])=>{g!=null&&u.searchParams.set(h,String(g))}),u.pathname+u.search},s=Y.useCallback(l=>{const u=a(l);l.addToHistory!==!1?(e(u),i.addToHistory(u)):(e(u,{replace:!0}),i.popFromHistory(1),i.addToHistory(u))},[e]),c=Y.useCallback(l=>{const u=l||1;e(-u),i.popFromHistory(u)},[e]);return{currentPath:t.pathname,history:i.history,searchParams:r,goBack:c,goTo:s}},Uo=({isReady:e=!0,routes:t,children:r})=>{const i=Y.useRef([]),[a,s]=Y.useState([]),c=Y.useCallback(x=>{i.current=x,s(x)},[]),l=(x,j=!1)=>{let M=[...i.current];j&&(M=M.slice(0,M.length-1)),M=[...M,x],c(M)},u=x=>{let j="",M=[];return i.current.length===0?"/":(i.current.length<=x?(j=i.current[0],M=[j]):(M=i.current.slice(0,i.current.length-x),j=M[M.length-1]),c(M),j)},h=x=>{c(x)},g=t.map(x=>G.jsx(dn,{path:x.path,element:x.render}));return G.jsx(bn.Provider,{value:{history:a,addToHistory:l,popFromHistory:u,replaceHistory:h},children:G.jsx(_o,{children:e&&G.jsxs(G.Fragment,{children:[r,G.jsx(io,{children:g})]})})})},wn=Y.createContext({visibleItems:[],isItemVisible:()=>!1,showItem:()=>{},hideItem:()=>{}}),Yo=({children:e})=>{const t=Y.useRef([]),[r,i]=Y.useState([]),a=Y.useCallback(u=>{t.current=u,i(u)},[]),s=Y.useCallback(u=>t.current.some(h=>h===u),[]),c=Y.useCallback(u=>{s(u)||a([...t.current,u])},[s,a]),l=Y.useCallback(u=>{s(u)&&a(t.current.filter(g=>g!==u))},[s,a]);return G.jsx(wn.Provider,{value:{visibleItems:r,isItemVisible:s,showItem:c,hideItem:l},children:e})},et=()=>{const e=Y.useContext(wn),t=a=>e.visibleItems.some(s=>s===a),r=a=>{e.showItem(a)},i=a=>{e.hideItem(a)};return{visibleItems:e.visibleItems,isItemVisible:t,showItem:r,hideItem:i}},qo=({id:e,onCloseDrawer:t,drawerCloseOffset:r=15})=>{const{isItemVisible:i}=et(),[a,s]=Y.useState({isDragging:!1}),c=Y.useRef(null),l=Y.useRef(null),u=Y.useRef(null),[h,g]=Y.useState(0),x=P=>{s(P)},j=P=>{s(P),g(0)};return Zr({ref:u,onDrag:P=>{s(P);const p=l.current?.clientHeight||0;P.distanceY&&(g(P.distanceY<0?0:-P.distanceY),P.distanceY>=p-r&&(t?.(),j(P)))},onDragEnd:j,onDragStart:x}),{isVisible:i(e),drawerParentRef:c,drawerRef:l,drawerBottomDistance:h,handleRef:u}},Bo=e=>{const{children:t,backgroundStyles:r,contentStyles:i,handle:a}=e,{isVisible:s,drawerParentRef:c,drawerRef:l,handleRef:u,drawerBottomDistance:h}=qo(e);return G.jsx(G.Fragment,{children:s&&G.jsx("div",{ref:c,style:{width:"100%",height:"100%",minHeight:"100vh",left:0,top:0,background:"#00000068",position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column",touchAction:"none",...r},children:G.jsxs("div",{ref:l,style:{width:"100%",height:"fit-content",minHeight:"80px",maxHeight:"90%",background:"#ffffff",borderTopLeftRadius:"16px",borderTopRightRadius:"16px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px",zIndex:1001,position:"absolute",bottom:`${h}px`,...i},onClick:g=>{g.stopPropagation()},children:[G.jsx("div",{ref:u,style:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0px",height:"24px",width:"100%",cursor:"pointer",...a?.styles},children:a?.render}),t]})})})},Vo=({onSubmit:e,fields:t})=>{const r=Y.useRef(null),i=Y.useCallback(c=>{const l=Array.from(c.currentTarget.elements).filter(h=>!!h.getAttribute("name")),u=[];for(const h of l){const g=h.name;t.list.some(x=>x.name===g)&&u.push({name:g,value:h.value})}return u},[e]),a=Y.useCallback(c=>{c.preventDefault(),c.stopPropagation();const l=i(c);e?.(l)},[e]);return{ref:r,submitForm:c=>{r.current&&r.current.requestSubmit()},handleFormSubmission:a}},Xo=Pe.div`
127
127
  display: flex;
128
128
  width: 100%;
129
129
  align-items: center;
package/dist/index.es.js CHANGED
@@ -6072,19 +6072,17 @@ const Sn = B.createContext({
6072
6072
  }, Ho = ({ onSubmit: e, fields: t }) => {
6073
6073
  const r = B.useRef(null), i = B.useCallback(
6074
6074
  (c) => {
6075
- var l = Object.keys(c.currentTarget.elements), u = Object.values(c.currentTarget.elements), h = [];
6076
- console.debug("Form > ", { event: c, elementIds: l, elementValues: u });
6077
- for (let g = 0; g < l.length; g++) {
6078
- const x = l[g];
6079
- if (t.list.findIndex((M) => M.name === x) === -1)
6080
- continue;
6081
- const j = u[g].value;
6082
- h.push({
6083
- name: x,
6084
- value: j
6075
+ const l = Array.from(c.currentTarget.elements).filter(
6076
+ (h) => !!h.getAttribute("name")
6077
+ ), u = [];
6078
+ for (const h of l) {
6079
+ const g = h.name;
6080
+ t.list.some((x) => x.name === g) && u.push({
6081
+ name: g,
6082
+ value: h.value
6085
6083
  });
6086
6084
  }
6087
- return h;
6085
+ return u;
6088
6086
  },
6089
6087
  [e]
6090
6088
  ), a = B.useCallback(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliseubatista99/react-scaffold-core",
3
- "version": "0.1.76",
3
+ "version": "0.1.78",
4
4
  "private": false,
5
5
  "description": "A library which provides basic components, hooks, helpers and providers to easily build a React application and avoid repeating the usual code.",
6
6
  "main": "dist/index.cjs.js",