@eliseubatista99/react-scaffold-core 0.1.48 → 0.1.49
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 _r="popstate";function xa(e={}){function t(a,i){let{pathname:s,search:l,hash:f}=a.location;return Nt("",{pathname:s,search:l,hash:f},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(a,i){return typeof i=="string"?i:Xe(i)}return Oa(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 ka(){return Math.random().toString(36).substring(2,10)}function Tr(e,t){return{usr:e.state,key:e.key,idx:t}}function Nt(e,t,r=null,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?De(t):t,state:r,key:t&&t.key||a||ka()}}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 De(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 Oa(e,t,r,a={}){let{window:i=document.defaultView,v5Compat:s=!1}=a,l=i.history,f="POP",c=null,h=g();h==null&&(h=0,l.replaceState({...l.state,idx:h},""));function g(){return(l.state||{idx:null}).idx}function C(){f="POP";let $=g(),O=$==null?null:$-h;h=$,c&&c({action:f,location:p.location,delta:O})}function j($,O){f="PUSH";let F=Nt(p.location,$,O);h=g()+1;let Y=Tr(F,h),V=p.createHref(F);try{l.pushState(Y,"",V)}catch(v){if(v instanceof DOMException&&v.name==="DataCloneError")throw v;i.location.assign(V)}s&&c&&c({action:f,location:p.location,delta:1})}function A($,O){f="REPLACE";let F=Nt(p.location,$,O);h=g();let Y=Tr(F,h),V=p.createHref(F);l.replaceState(Y,"",V),s&&c&&c({action:f,location:p.location,delta:0})}function E($){return Ca($)}let p={get action(){return f},get location(){return e(i,l)},listen($){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(_r,C),c=$,()=>{i.removeEventListener(_r,C),c=null}},createHref($){return t(i,$)},createURL:E,encodeLocation($){let O=E($);return{pathname:O.pathname,search:O.search,hash:O.hash}},push:j,replace:A,go($){return l.go($)}};return p}function Ca(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 a=typeof e=="string"?e:Xe(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function tn(e,t,r="/"){return Pa(e,t,r,!1)}function Pa(e,t,r,a){let i=typeof t=="string"?De(t):t,s=xe(i.pathname||"/",r);if(s==null)return null;let l=rn(e);Ea(l);let f=null;for(let c=0;f==null&&c<l.length;++c){let h=Ha(s);f=Ia(l[c],h,a)}return f}function rn(e,t=[],r=[],a=""){let i=(s,l,f)=>{let c={relativePath:f===void 0?s.path||"":f,caseSensitive:s.caseSensitive===!0,childrenIndex:l,route:s};c.relativePath.startsWith("/")&&(ae(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length));let h=Se([a,c.relativePath]),g=r.concat(c);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}".`),rn(s.children,t,g,h)),!(s.path==null&&!s.index)&&t.push({path:h,score:Ma(h,s.index),routesMeta:g})};return e.forEach((s,l)=>{if(s.path===""||!s.path?.includes("?"))i(s,l);else for(let f of nn(s.path))i(s,l,f)}),t}function nn(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(a.length===0)return i?[s,""]:[s];let l=nn(a.join("/")),f=[];return f.push(...l.map(c=>c===""?s:[s,c].join("/"))),i&&f.push(...l),f.map(c=>e.startsWith("/")&&c===""?"/":c)}function Ea(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:$a(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Ra=/^:[\w-]+$/,_a=3,Ta=2,ja=1,La=10,Da=-2,jr=e=>e==="*";function Ma(e,t){let r=e.split("/"),a=r.length;return r.some(jr)&&(a+=Da),t&&(a+=Ta),r.filter(i=>!jr(i)).reduce((i,s)=>i+(Ra.test(s)?_a:s===""?ja:La),a)}function $a(e,t){return e.length===t.length&&e.slice(0,-1).every((a,i)=>a===t[i])?e[e.length-1]-t[t.length-1]:0}function Ia(e,t,r=!1){let{routesMeta:a}=e,i={},s="/",l=[];for(let f=0;f<a.length;++f){let c=a[f],h=f===a.length-1,g=s==="/"?t:t.slice(s.length)||"/",C=gt({path:c.relativePath,caseSensitive:c.caseSensitive,end:h},g),j=c.route;if(!C&&h&&r&&!a[a.length-1].route.index&&(C=gt({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},g)),!C)return null;Object.assign(i,C.params),l.push({params:i,pathname:Se([s,C.pathname]),pathnameBase:Wa(Se([s,C.pathnameBase])),route:j}),C.pathnameBase!=="/"&&(s=Se([s,C.pathnameBase]))}return l}function gt(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Aa(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let s=i[0],l=s.replace(/(.)\/+$/,"$1"),f=i.slice(1);return{params:a.reduce((h,{paramName:g,isOptional:C},j)=>{if(g==="*"){let E=f[j]||"";l=s.slice(0,s.length-E.length).replace(/(.)\/+$/,"$1")}const A=f[j];return C&&!A?h[g]=void 0:h[g]=(A||"").replace(/%2F/g,"/"),h},{}),pathname:s,pathnameBase:l,pattern:e}}function Aa(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 a=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,f,c)=>(a.push({paramName:f,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(a.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),a]}function Ha(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,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function za(e,t="/"){let{pathname:r,search:a="",hash:i=""}=typeof e=="string"?De(e):e;return{pathname:r?r.startsWith("/")?r:Na(r,t):t,search:Ua(a),hash:Ya(i)}}function Na(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Mt(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 Fa(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function an(e){let t=Fa(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function on(e,t,r,a=!1){let i;typeof e=="string"?i=De(e):(i={...e},ae(!i.pathname||!i.pathname.includes("?"),Mt("?","pathname","search",i)),ae(!i.pathname||!i.pathname.includes("#"),Mt("#","pathname","hash",i)),ae(!i.search||!i.search.includes("#"),Mt("#","search","hash",i)));let s=e===""||i.pathname==="",l=s?"/":i.pathname,f;if(l==null)f=r;else{let C=t.length-1;if(!a&&l.startsWith("..")){let j=l.split("/");for(;j[0]==="..";)j.shift(),C-=1;i.pathname=j.join("/")}f=C>=0?t[C]:"/"}let c=za(i,f),h=l&&l!=="/"&&l.endsWith("/"),g=(s||l===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(h||g)&&(c.pathname+="/"),c}var Se=e=>e.join("/").replace(/\/\/+/g,"/"),Wa=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ua=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ya=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function qa(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var sn=["POST","PUT","PATCH","DELETE"];new Set(sn);var Ba=["GET",...sn];new Set(Ba);var Me=D.createContext(null);Me.displayName="DataRouter";var kt=D.createContext(null);kt.displayName="DataRouterState";var ln=D.createContext({isTransitioning:!1});ln.displayName="ViewTransition";var Va=D.createContext(new Map);Va.displayName="Fetchers";var Xa=D.createContext(null);Xa.displayName="Await";var we=D.createContext(null);we.displayName="Navigation";var Je=D.createContext(null);Je.displayName="Location";var ke=D.createContext({outlet:null,matches:[],isDataRoute:!1});ke.displayName="Route";var Vt=D.createContext(null);Vt.displayName="RouteError";function Ga(e,{relative:t}={}){ae(Ze(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=D.useContext(we),{hash:i,pathname:s,search:l}=Qe(e,{relative:t}),f=s;return r!=="/"&&(f=s==="/"?r:Se([r,s])),a.createHref({pathname:f,search:l,hash:i})}function Ze(){return D.useContext(Je)!=null}function Oe(){return ae(Ze(),"useLocation() may be used only in the context of a <Router> component."),D.useContext(Je).location}var un="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function cn(e){D.useContext(we).static||D.useLayoutEffect(e)}function Xt(){let{isDataRoute:e}=D.useContext(ke);return e?lo():Ka()}function Ka(){ae(Ze(),"useNavigate() may be used only in the context of a <Router> component.");let e=D.useContext(Me),{basename:t,navigator:r}=D.useContext(we),{matches:a}=D.useContext(ke),{pathname:i}=Oe(),s=JSON.stringify(an(a)),l=D.useRef(!1);return cn(()=>{l.current=!0}),D.useCallback((c,h={})=>{if(ve(l.current,un),!l.current)return;if(typeof c=="number"){r.go(c);return}let g=on(c,JSON.parse(s),i,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,i,e])}D.createContext(null);function Qe(e,{relative:t}={}){let{matches:r}=D.useContext(ke),{pathname:a}=Oe(),i=JSON.stringify(an(r));return D.useMemo(()=>on(e,JSON.parse(i),a,t==="path"),[e,i,a,t])}function Ja(e,t){return fn(e,t)}function fn(e,t,r,a){ae(Ze(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=D.useContext(we),{matches:s}=D.useContext(ke),l=s[s.length-1],f=l?l.params:{},c=l?l.pathname:"/",h=l?l.pathnameBase:"/",g=l&&l.route;{let O=g&&g.path||"";dn(c,!g||O.endsWith("*")||O.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${O}">) 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="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let C=Oe(),j;if(t){let O=typeof t=="string"?De(t):t;ae(h==="/"||O.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 "${O.pathname}" was given in the \`location\` prop.`),j=O}else j=C;let A=j.pathname||"/",E=A;if(h!=="/"){let O=h.replace(/^\//,"").split("/");E="/"+A.replace(/^\//,"").split("/").slice(O.length).join("/")}let p=tn(e,{pathname:E});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 $=ro(p&&p.map(O=>Object.assign({},O,{params:Object.assign({},f,O.params),pathname:Se([h,i.encodeLocation?i.encodeLocation(O.pathname).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?h:Se([h,i.encodeLocation?i.encodeLocation(O.pathnameBase).pathname:O.pathnameBase])})),s,r,a);return t&&$?D.createElement(Je.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...j},navigationType:"POP"}},$):$}function Za(){let e=so(),t=qa(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},s={padding:"2px 4px",backgroundColor:a},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=D.createElement(D.Fragment,null,D.createElement("p",null,"💿 Hey developer 👋"),D.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",D.createElement("code",{style:s},"ErrorBoundary")," or"," ",D.createElement("code",{style:s},"errorElement")," prop on your route.")),D.createElement(D.Fragment,null,D.createElement("h2",null,"Unexpected Application Error!"),D.createElement("h3",{style:{fontStyle:"italic"}},t),r?D.createElement("pre",{style:i},r):null,l)}var Qa=D.createElement(Za,null),eo=class extends D.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?D.createElement(ke.Provider,{value:this.props.routeContext},D.createElement(Vt.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function to({routeContext:e,match:t,children:r}){let a=D.useContext(Me);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),D.createElement(ke.Provider,{value:e},r)}function ro(e,t=[],r=null,a=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 i=e,s=r?.errors;if(s!=null){let c=i.findIndex(h=>h.route.id&&s?.[h.route.id]!==void 0);ae(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,c+1))}let l=!1,f=-1;if(r)for(let c=0;c<i.length;c++){let h=i[c];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(f=c),h.route.id){let{loaderData:g,errors:C}=r,j=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!C||C[h.route.id]===void 0);if(h.route.lazy||j){l=!0,f>=0?i=i.slice(0,f+1):i=[i[0]];break}}}return i.reduceRight((c,h,g)=>{let C,j=!1,A=null,E=null;r&&(C=s&&h.route.id?s[h.route.id]:void 0,A=h.route.errorElement||Qa,l&&(f<0&&g===0?(dn("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,E=null):f===g&&(j=!0,E=h.route.hydrateFallbackElement||null)));let p=t.concat(i.slice(0,g+1)),$=()=>{let O;return C?O=A:j?O=E:h.route.Component?O=D.createElement(h.route.Component,null):h.route.element?O=h.route.element:O=c,D.createElement(to,{match:h,routeContext:{outlet:c,matches:p,isDataRoute:r!=null},children:O})};return r&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?D.createElement(eo,{location:r.location,revalidation:r.revalidation,component:A,error:C,children:$(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):$()},null)}function Gt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function no(e){let t=D.useContext(Me);return ae(t,Gt(e)),t}function io(e){let t=D.useContext(kt);return ae(t,Gt(e)),t}function ao(e){let t=D.useContext(ke);return ae(t,Gt(e)),t}function Kt(e){let t=ao(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 oo(){return Kt("useRouteId")}function so(){let e=D.useContext(Vt),t=io("useRouteError"),r=Kt("useRouteError");return e!==void 0?e:t.errors?.[r]}function lo(){let{router:e}=no("useNavigate"),t=Kt("useNavigate"),r=D.useRef(!1);return cn(()=>{r.current=!0}),D.useCallback(async(i,s={})=>{ve(r.current,un),r.current&&(typeof i=="number"?e.navigate(i):await e.navigate(i,{fromRouteId:t,...s}))},[e,t])}var Lr={};function dn(e,t,r){!t&&!Lr[e]&&(Lr[e]=!0,ve(!1,r))}D.memo(uo);function uo({routes:e,future:t,state:r}){return fn(e,void 0,r,t)}function hn(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 co({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:i,static:s=!1}){ae(!Ze(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),f=D.useMemo(()=>({basename:l,navigator:i,static:s,future:{}}),[l,i,s]);typeof r=="string"&&(r=De(r));let{pathname:c="/",search:h="",hash:g="",state:C=null,key:j="default"}=r,A=D.useMemo(()=>{let E=xe(c,l);return E==null?null:{location:{pathname:E,search:h,hash:g,state:C,key:j},navigationType:a}},[l,c,h,g,C,j,a]);return ve(A!=null,`<Router basename="${l}"> is not able to match the URL "${c}${h}${g}" because it does not start with the basename, so the <Router> won't render anything.`),A==null?null:D.createElement(we.Provider,{value:f},D.createElement(Je.Provider,{children:t,value:A}))}function fo({children:e,location:t}){return Ja(Ft(e),t)}function Ft(e,t=[]){let r=[];return D.Children.forEach(e,(a,i)=>{if(!D.isValidElement(a))return;let s=[...t,i];if(a.type===D.Fragment){r.push.apply(r,Ft(a.props.children,s));return}ae(a.type===hn,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ae(!a.props.index||!a.props.children,"An index route cannot have child routes.");let l={id:a.props.id||s.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(l.children=Ft(a.props.children,s)),r.push(l)}),r}var dt="get",ht="application/x-www-form-urlencoded";function Ot(e){return e!=null&&typeof e.tagName=="string"}function ho(e){return Ot(e)&&e.tagName.toLowerCase()==="button"}function po(e){return Ot(e)&&e.tagName.toLowerCase()==="form"}function mo(e){return Ot(e)&&e.tagName.toLowerCase()==="input"}function vo(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function go(e,t){return e.button===0&&(!t||t==="_self")&&!vo(e)}function Wt(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(i=>[r,i]):[[r,a]])},[]))}function yo(e,t){let r=Wt(e);return t&&t.forEach((a,i)=>{r.has(i)||t.getAll(i).forEach(s=>{r.append(i,s)})}),r}var at=null;function bo(){if(at===null)try{new FormData(document.createElement("form"),0),at=!1}catch{at=!0}return at}var wo=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function $t(e){return e!=null&&!wo.has(e)?(ve(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ht}"`),null):e}function So(e,t){let r,a,i,s,l;if(po(e)){let f=e.getAttribute("action");a=f?xe(f,t):null,r=e.getAttribute("method")||dt,i=$t(e.getAttribute("enctype"))||ht,s=new FormData(e)}else if(ho(e)||mo(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||f.getAttribute("action");if(a=c?xe(c,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||dt,i=$t(e.getAttribute("formenctype"))||$t(f.getAttribute("enctype"))||ht,s=new FormData(f,e),!bo()){let{name:h,type:g,value:C}=e;if(g==="image"){let j=h?`${h}.`:"";s.append(`${j}x`,"0"),s.append(`${j}y`,"0")}else h&&s.append(h,C)}}else{if(Ot(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=dt,a=null,i=ht,l=e}return s&&i==="text/plain"&&(l=s,s=void 0),{action:a,method:r.toLowerCase(),encType:i,formData:s,body:l}}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function xo(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 ko(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 Oo(e,t,r){let a=await Promise.all(e.map(async i=>{let s=t.routes[i.route.id];if(s){let l=await xo(s,r);return l.links?l.links():[]}return[]}));return Ro(a.flat(1).filter(ko).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Dr(e,t,r,a,i,s){let l=(c,h)=>r[h]?c.route.id!==r[h].route.id:!0,f=(c,h)=>r[h].pathname!==c.pathname||r[h].route.path?.endsWith("*")&&r[h].params["*"]!==c.params["*"];return s==="assets"?t.filter((c,h)=>l(c,h)||f(c,h)):s==="data"?t.filter((c,h)=>{let g=a.routes[c.route.id];if(!g||!g.hasLoader)return!1;if(l(c,h)||f(c,h))return!0;if(c.route.shouldRevalidate){let C=c.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof C=="boolean")return C}return!0}):[]}function Co(e,t,{includeHydrateFallback:r}={}){return Po(e.map(a=>{let i=t.routes[a.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),r&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function Po(e){return[...new Set(e)]}function Eo(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function Ro(e,t){let r=new Set;return new Set(t),e.reduce((a,i)=>{let s=JSON.stringify(Eo(i));return r.has(s)||(r.add(s),a.push({key:s,link:i})),a},[])}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var _o=new Set([100,101,204,205]);function To(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 pn(){let e=D.useContext(Me);return Jt(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function jo(){let e=D.useContext(kt);return Jt(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Zt=D.createContext(void 0);Zt.displayName="FrameworkContext";function mn(){let e=D.useContext(Zt);return Jt(e,"You must render this element inside a <HydratedRouter> element"),e}function Lo(e,t){let r=D.useContext(Zt),[a,i]=D.useState(!1),[s,l]=D.useState(!1),{onFocus:f,onBlur:c,onMouseEnter:h,onMouseLeave:g,onTouchStart:C}=t,j=D.useRef(null);D.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let p=O=>{O.forEach(F=>{l(F.isIntersecting)})},$=new IntersectionObserver(p,{threshold:.5});return j.current&&$.observe(j.current),()=>{$.disconnect()}}},[e]),D.useEffect(()=>{if(a){let p=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(p)}}},[a]);let A=()=>{i(!0)},E=()=>{i(!1),l(!1)};return r?e!=="intent"?[s,j,{}]:[s,j,{onFocus:Ye(f,A),onBlur:Ye(c,E),onMouseEnter:Ye(h,A),onMouseLeave:Ye(g,E),onTouchStart:Ye(C,A)}]:[!1,j,{}]}function Ye(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Do({page:e,...t}){let{router:r}=pn(),a=D.useMemo(()=>tn(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?D.createElement($o,{page:e,matches:a,...t}):null}function Mo(e){let{manifest:t,routeModules:r}=mn(),[a,i]=D.useState([]);return D.useEffect(()=>{let s=!1;return Oo(e,t,r).then(l=>{s||i(l)}),()=>{s=!0}},[e,t,r]),a}function $o({page:e,matches:t,...r}){let a=Oe(),{manifest:i,routeModules:s}=mn(),{basename:l}=pn(),{loaderData:f,matches:c}=jo(),h=D.useMemo(()=>Dr(e,t,c,i,a,"data"),[e,t,c,i,a]),g=D.useMemo(()=>Dr(e,t,c,i,a,"assets"),[e,t,c,i,a]),C=D.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let E=new Set,p=!1;if(t.forEach(O=>{let F=i.routes[O.route.id];!F||!F.hasLoader||(!h.some(Y=>Y.route.id===O.route.id)&&O.route.id in f&&s[O.route.id]?.shouldRevalidate||F.hasClientLoader?p=!0:E.add(O.route.id))}),E.size===0)return[];let $=To(e,l);return p&&E.size>0&&$.searchParams.set("_routes",t.filter(O=>E.has(O.route.id)).map(O=>O.route.id).join(",")),[$.pathname+$.search]},[l,f,a,i,h,t,e,s]),j=D.useMemo(()=>Co(g,i),[g,i]),A=Mo(g);return D.createElement(D.Fragment,null,C.map(E=>D.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...r})),j.map(E=>D.createElement("link",{key:E,rel:"modulepreload",href:E,...r})),A.map(({key:E,link:p})=>D.createElement("link",{key:E,...p})))}function Io(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var vn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{vn&&(window.__reactRouterVersion="7.6.3")}catch{}function Ao({basename:e,children:t,window:r}){let a=D.useRef();a.current==null&&(a.current=xa({window:r,v5Compat:!0}));let i=a.current,[s,l]=D.useState({action:i.action,location:i.location}),f=D.useCallback(c=>{D.startTransition(()=>l(c))},[l]);return D.useLayoutEffect(()=>i.listen(f),[i,f]),D.createElement(co,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:i})}var gn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yn=D.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:i,reloadDocument:s,replace:l,state:f,target:c,to:h,preventScrollReset:g,viewTransition:C,...j},A){let{basename:E}=D.useContext(we),p=typeof h=="string"&&gn.test(h),$,O=!1;if(typeof h=="string"&&p&&($=h,vn))try{let y=new URL(window.location.href),d=h.startsWith("//")?new URL(y.protocol+h):new URL(h),x=xe(d.pathname,E);d.origin===y.origin&&x!=null?h=x+d.search+d.hash:O=!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=Ga(h,{relative:i}),[Y,V,v]=Lo(a,j),b=Fo(h,{replace:l,state:f,target:c,preventScrollReset:g,relative:i,viewTransition:C});function w(y){t&&t(y),y.defaultPrevented||b(y)}let P=D.createElement("a",{...j,...v,href:$||F,onClick:O||s?t:w,ref:Io(A,V),target:c,"data-discover":!p&&r==="render"?"true":void 0});return Y&&!p?D.createElement(D.Fragment,null,P,D.createElement(Do,{page:F})):P});yn.displayName="Link";var Ho=D.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:i=!1,style:s,to:l,viewTransition:f,children:c,...h},g){let C=Qe(l,{relative:h.relative}),j=Oe(),A=D.useContext(kt),{navigator:E,basename:p}=D.useContext(we),$=A!=null&&Vo(C)&&f===!0,O=E.encodeLocation?E.encodeLocation(C).pathname:C.pathname,F=j.pathname,Y=A&&A.navigation&&A.navigation.location?A.navigation.location.pathname:null;r||(F=F.toLowerCase(),Y=Y?Y.toLowerCase():null,O=O.toLowerCase()),Y&&p&&(Y=xe(Y,p)||Y);const V=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let v=F===O||!i&&F.startsWith(O)&&F.charAt(V)==="/",b=Y!=null&&(Y===O||!i&&Y.startsWith(O)&&Y.charAt(O.length)==="/"),w={isActive:v,isPending:b,isTransitioning:$},P=v?t:void 0,y;typeof a=="function"?y=a(w):y=[a,v?"active":null,b?"pending":null,$?"transitioning":null].filter(Boolean).join(" ");let d=typeof s=="function"?s(w):s;return D.createElement(yn,{...h,"aria-current":P,className:y,ref:g,style:d,to:l,viewTransition:f},typeof c=="function"?c(w):c)});Ho.displayName="NavLink";var zo=D.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:i,state:s,method:l=dt,action:f,onSubmit:c,relative:h,preventScrollReset:g,viewTransition:C,...j},A)=>{let E=qo(),p=Bo(f,{relative:h}),$=l.toLowerCase()==="get"?"get":"post",O=typeof f=="string"&&gn.test(f),F=Y=>{if(c&&c(Y),Y.defaultPrevented)return;Y.preventDefault();let V=Y.nativeEvent.submitter,v=V?.getAttribute("formmethod")||l;E(V||Y.currentTarget,{fetcherKey:t,method:v,navigate:r,replace:i,state:s,relative:h,preventScrollReset:g,viewTransition:C})};return D.createElement("form",{ref:A,method:$,action:p,onSubmit:a?c:F,...j,"data-discover":!O&&e==="render"?"true":void 0})});zo.displayName="Form";function No(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bn(e){let t=D.useContext(Me);return ae(t,No(e)),t}function Fo(e,{target:t,replace:r,state:a,preventScrollReset:i,relative:s,viewTransition:l}={}){let f=Xt(),c=Oe(),h=Qe(e,{relative:s});return D.useCallback(g=>{if(go(g,t)){g.preventDefault();let C=r!==void 0?r:Xe(c)===Xe(h);f(e,{replace:C,state:a,preventScrollReset:i,relative:s,viewTransition:l})}},[c,f,h,r,a,t,e,i,s,l])}function Wo(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=D.useRef(Wt(e)),r=D.useRef(!1),a=Oe(),i=D.useMemo(()=>yo(a.search,r.current?null:t.current),[a.search]),s=Xt(),l=D.useCallback((f,c)=>{const h=Wt(typeof f=="function"?f(i):f);r.current=!0,s("?"+h,c)},[s,i]);return[i,l]}var Uo=0,Yo=()=>`__${String(++Uo)}__`;function qo(){let{router:e}=bn("useSubmit"),{basename:t}=D.useContext(we),r=oo();return D.useCallback(async(a,i={})=>{let{action:s,method:l,encType:f,formData:c,body:h}=So(a,t);if(i.navigate===!1){let g=i.fetcherKey||Yo();await e.fetch(g,r,i.action||s,{preventScrollReset:i.preventScrollReset,formData:c,body:h,formMethod:i.method||l,formEncType:i.encType||f,flushSync:i.flushSync})}else await e.navigate(i.action||s,{preventScrollReset:i.preventScrollReset,formData:c,body:h,formMethod:i.method||l,formEncType:i.encType||f,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[e,t,r])}function Bo(e,{relative:t}={}){let{basename:r}=D.useContext(we),a=D.useContext(ke);ae(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),s={...Qe(e||".",{relative:t})},l=Oe();if(e==null){s.search=l.search;let f=new URLSearchParams(s.search),c=f.getAll("index");if(c.some(g=>g==="")){f.delete("index"),c.filter(C=>C).forEach(C=>f.append("index",C));let g=f.toString();s.search=g?`?${g}`:""}}return(!e||e===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(s.pathname=s.pathname==="/"?r:Se([r,s.pathname])),Xe(s)}function Vo(e,t={}){let r=D.useContext(ln);ae(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=bn("useViewTransitionState"),i=Qe(e,{relative:t.relative});if(!r.isTransitioning)return!1;let s=xe(r.currentLocation.pathname,a)||r.currentLocation.pathname,l=xe(r.nextLocation.pathname,a)||r.nextLocation.pathname;return gt(i.pathname,l)!=null||gt(i.pathname,s)!=null}[..._o];const wn=U.createContext({history:[],addToHistory:()=>{},popFromHistory:()=>"",replaceHistory:()=>{}}),Xo=()=>{const[e,t]=Wo(),r=U.useMemo(()=>Object.fromEntries(e.entries()),[e]),a=U.useCallback(h=>{const g={};return h.forEach(C=>{g[C]=e.get(C)}),g},[e]),i=U.useCallback(h=>e.get(h),[e]),s=U.useCallback((h,g)=>{const C=new URLSearchParams(e);C.set(h,String(g)),t(C)},[e,t]),l=U.useCallback(h=>{const g=new URLSearchParams(e);Object.entries(h).forEach(([C,j])=>{j!=null&&g.set(C,String(j))}),t(g)},[e,t]),f=U.useCallback(h=>{const g=new URLSearchParams(e);g.delete(h),t(g)},[e,t]),c=U.useCallback(h=>{const g=new URLSearchParams(e);h.forEach(C=>{g.delete(String(C))}),t(g)},[e,t]);return{getAll:()=>r,get:i,getMany:a,set:s,setMany:l,remove:f,removeMany:c}},Go=()=>{const e=Xt(),t=Oe(),r=Xo(),a=U.useContext(wn),i=f=>{const c=new URL(f.path,"http://dummy-base");return f.params&&Object.entries(f.params).forEach(([h,g])=>{g!=null&&c.searchParams.set(h,String(g))}),c.pathname+c.search},s=U.useCallback(f=>{const c=i(f);f.addToHistory!==!1?(e(c),a.addToHistory(c)):(e(c,{replace:!0}),a.popFromHistory(1),a.addToHistory(c))},[e]),l=U.useCallback(f=>{const c=f||1;e(-c),a.popFromHistory(c)},[e]);return{currentPath:t.pathname,history:a.history,searchParams:r,goBack:l,goTo:s}},Ko=({routes:e,children:t})=>{const r=U.useRef([]),[a,i]=U.useState([]),s=U.useCallback(g=>{r.current=g,i(g)},[]),l=(g,C=!1)=>{let j=[...r.current];C&&(j=j.slice(0,j.length-1)),j=[...j,g],s(j)},f=g=>{let C="",j=[];return r.current.length===0?"/":(r.current.length<=g?(C=r.current[0],j=[C]):(j=r.current.slice(0,r.current.length-g),C=j[j.length-1]),s(j),C)},c=g=>{s(g)},h=e.map(g=>J.jsx(hn,{path:g.path,element:g.render}));return J.jsx(wn.Provider,{value:{history:a,addToHistory:l,popFromHistory:f,replaceHistory:c},children:J.jsxs(Ao,{children:[t,J.jsx(fo,{children:h})]})})},Sn=U.createContext({visibleItems:[],isItemVisible:()=>!1,showItem:()=>{},hideItem:()=>{}}),Jo=({children:e})=>{const t=U.useRef([]),[r,a]=U.useState([]),i=U.useCallback(c=>{t.current=c,a(c)},[]),s=U.useCallback(c=>t.current.some(h=>h===c),[]),l=U.useCallback(c=>{s(c)||i([...t.current,c])},[s,i]),f=U.useCallback(c=>{s(c)&&i(t.current.filter(g=>g!==c))},[s,i]);return J.jsx(Sn.Provider,{value:{visibleItems:r,isItemVisible:s,showItem:l,hideItem:f},children:e})},et=()=>{const e=U.useContext(Sn),t=i=>e.visibleItems.some(s=>s===i),r=i=>{e.showItem(i)},a=i=>{e.hideItem(i)};return{visibleItems:e.visibleItems,isItemVisible:t,showItem:r,hideItem:a}},Zo=({id:e,onCloseDrawer:t,drawerCloseOffset:r=15})=>{const{isItemVisible:a}=et(),[i,s]=U.useState({isDragging:!1}),l=U.useRef(null),f=U.useRef(null),c=U.useRef(null),[h,g]=U.useState(0),C=E=>{s(E)},j=E=>{s(E),g(0)};return Zr({ref:c,onDrag:E=>{s(E);const p=f.current?.clientHeight||0;E.distanceY&&(g(E.distanceY<0?0:-E.distanceY),E.distanceY>=p-r&&(t?.(),j(E)))},onDragEnd:j,onDragStart:C}),{isVisible:a(e),drawerParentRef:l,drawerRef:f,drawerBottomDistance:h,handleRef:c}},Qo=e=>{const{children:t,backgroundStyles:r,contentStyles:a,handle:i}=e,{isVisible:s,drawerParentRef:l,drawerRef:f,handleRef:c,drawerBottomDistance:h}=Zo(e);return J.jsx(J.Fragment,{children:s&&J.jsx("div",{ref:l,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:J.jsxs("div",{ref:f,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`,...a},onClick:g=>{g.stopPropagation()},children:[J.jsx("div",{ref:c,style:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0px",height:"24px",width:"100%",cursor:"pointer",...i?.styles},children:i?.render}),t]})})})},es=({onSubmit:e,fields:t})=>{const r=U.useRef(null),a=U.useCallback(l=>{var f=Object.keys(l.currentTarget.elements),c=Object.values(l.currentTarget.elements),h=[];for(let g=0;g<f.length;g++){const C=f[g];if(t.findIndex(A=>A.name===C)===-1)continue;const j=c[g].value;h.push({name:C,value:j})}return h},[e]),i=U.useCallback(l=>{l.preventDefault();const f=a(l);e?.(f)},[e]);return{ref:r,submitForm:l=>{l.preventDefault(),l.stopPropagation(),r.current&&r.current.requestSubmit()},handleFormSubmission:i}},ts=e=>{const{fields:t,styles:r,submitButton:a}=e,{ref:i,handleFormSubmission:s,submitForm:l}=es(e),f=U.useCallback(()=>t.map(c=>({...c.content,key:c.name})),[t]);return J.jsxs("form",{ref:i,onSubmit:s,style:{width:"100%",display:"flex",flexDirection:"column",gap:"8px",flex:1,...r},children:[f(),J.jsx("div",{onClick:l,style:{display:"flex",width:"100%",alignItems:"center",justifyContent:"center",...a.styles},children:a.content})]})},rs=({src:e,alt:t="",onClick:r,styles:a})=>J.jsx("img",{src:e,alt:t,style:{overflow:"hidden",position:"relative",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",objectFit:"cover",...a},onClick:()=>r?.()}),ns=je.div`
|
|
126
|
+
Please change the parent <Route path="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let C=Oe(),j;if(t){let O=typeof t=="string"?De(t):t;ae(h==="/"||O.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 "${O.pathname}" was given in the \`location\` prop.`),j=O}else j=C;let A=j.pathname||"/",E=A;if(h!=="/"){let O=h.replace(/^\//,"").split("/");E="/"+A.replace(/^\//,"").split("/").slice(O.length).join("/")}let p=tn(e,{pathname:E});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 $=ro(p&&p.map(O=>Object.assign({},O,{params:Object.assign({},f,O.params),pathname:Se([h,i.encodeLocation?i.encodeLocation(O.pathname).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?h:Se([h,i.encodeLocation?i.encodeLocation(O.pathnameBase).pathname:O.pathnameBase])})),s,r,a);return t&&$?D.createElement(Je.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...j},navigationType:"POP"}},$):$}function Za(){let e=so(),t=qa(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},s={padding:"2px 4px",backgroundColor:a},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=D.createElement(D.Fragment,null,D.createElement("p",null,"💿 Hey developer 👋"),D.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",D.createElement("code",{style:s},"ErrorBoundary")," or"," ",D.createElement("code",{style:s},"errorElement")," prop on your route.")),D.createElement(D.Fragment,null,D.createElement("h2",null,"Unexpected Application Error!"),D.createElement("h3",{style:{fontStyle:"italic"}},t),r?D.createElement("pre",{style:i},r):null,l)}var Qa=D.createElement(Za,null),eo=class extends D.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?D.createElement(ke.Provider,{value:this.props.routeContext},D.createElement(Vt.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function to({routeContext:e,match:t,children:r}){let a=D.useContext(Me);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),D.createElement(ke.Provider,{value:e},r)}function ro(e,t=[],r=null,a=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 i=e,s=r?.errors;if(s!=null){let c=i.findIndex(h=>h.route.id&&s?.[h.route.id]!==void 0);ae(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,c+1))}let l=!1,f=-1;if(r)for(let c=0;c<i.length;c++){let h=i[c];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(f=c),h.route.id){let{loaderData:g,errors:C}=r,j=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!C||C[h.route.id]===void 0);if(h.route.lazy||j){l=!0,f>=0?i=i.slice(0,f+1):i=[i[0]];break}}}return i.reduceRight((c,h,g)=>{let C,j=!1,A=null,E=null;r&&(C=s&&h.route.id?s[h.route.id]:void 0,A=h.route.errorElement||Qa,l&&(f<0&&g===0?(dn("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,E=null):f===g&&(j=!0,E=h.route.hydrateFallbackElement||null)));let p=t.concat(i.slice(0,g+1)),$=()=>{let O;return C?O=A:j?O=E:h.route.Component?O=D.createElement(h.route.Component,null):h.route.element?O=h.route.element:O=c,D.createElement(to,{match:h,routeContext:{outlet:c,matches:p,isDataRoute:r!=null},children:O})};return r&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?D.createElement(eo,{location:r.location,revalidation:r.revalidation,component:A,error:C,children:$(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):$()},null)}function Gt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function no(e){let t=D.useContext(Me);return ae(t,Gt(e)),t}function io(e){let t=D.useContext(kt);return ae(t,Gt(e)),t}function ao(e){let t=D.useContext(ke);return ae(t,Gt(e)),t}function Kt(e){let t=ao(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 oo(){return Kt("useRouteId")}function so(){let e=D.useContext(Vt),t=io("useRouteError"),r=Kt("useRouteError");return e!==void 0?e:t.errors?.[r]}function lo(){let{router:e}=no("useNavigate"),t=Kt("useNavigate"),r=D.useRef(!1);return cn(()=>{r.current=!0}),D.useCallback(async(i,s={})=>{ve(r.current,un),r.current&&(typeof i=="number"?e.navigate(i):await e.navigate(i,{fromRouteId:t,...s}))},[e,t])}var Lr={};function dn(e,t,r){!t&&!Lr[e]&&(Lr[e]=!0,ve(!1,r))}D.memo(uo);function uo({routes:e,future:t,state:r}){return fn(e,void 0,r,t)}function hn(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 co({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:i,static:s=!1}){ae(!Ze(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),f=D.useMemo(()=>({basename:l,navigator:i,static:s,future:{}}),[l,i,s]);typeof r=="string"&&(r=De(r));let{pathname:c="/",search:h="",hash:g="",state:C=null,key:j="default"}=r,A=D.useMemo(()=>{let E=xe(c,l);return E==null?null:{location:{pathname:E,search:h,hash:g,state:C,key:j},navigationType:a}},[l,c,h,g,C,j,a]);return ve(A!=null,`<Router basename="${l}"> is not able to match the URL "${c}${h}${g}" because it does not start with the basename, so the <Router> won't render anything.`),A==null?null:D.createElement(we.Provider,{value:f},D.createElement(Je.Provider,{children:t,value:A}))}function fo({children:e,location:t}){return Ja(Ft(e),t)}function Ft(e,t=[]){let r=[];return D.Children.forEach(e,(a,i)=>{if(!D.isValidElement(a))return;let s=[...t,i];if(a.type===D.Fragment){r.push.apply(r,Ft(a.props.children,s));return}ae(a.type===hn,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ae(!a.props.index||!a.props.children,"An index route cannot have child routes.");let l={id:a.props.id||s.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(l.children=Ft(a.props.children,s)),r.push(l)}),r}var dt="get",ht="application/x-www-form-urlencoded";function Ot(e){return e!=null&&typeof e.tagName=="string"}function ho(e){return Ot(e)&&e.tagName.toLowerCase()==="button"}function po(e){return Ot(e)&&e.tagName.toLowerCase()==="form"}function mo(e){return Ot(e)&&e.tagName.toLowerCase()==="input"}function vo(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function go(e,t){return e.button===0&&(!t||t==="_self")&&!vo(e)}function Wt(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(i=>[r,i]):[[r,a]])},[]))}function yo(e,t){let r=Wt(e);return t&&t.forEach((a,i)=>{r.has(i)||t.getAll(i).forEach(s=>{r.append(i,s)})}),r}var at=null;function bo(){if(at===null)try{new FormData(document.createElement("form"),0),at=!1}catch{at=!0}return at}var wo=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function $t(e){return e!=null&&!wo.has(e)?(ve(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ht}"`),null):e}function So(e,t){let r,a,i,s,l;if(po(e)){let f=e.getAttribute("action");a=f?xe(f,t):null,r=e.getAttribute("method")||dt,i=$t(e.getAttribute("enctype"))||ht,s=new FormData(e)}else if(ho(e)||mo(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||f.getAttribute("action");if(a=c?xe(c,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||dt,i=$t(e.getAttribute("formenctype"))||$t(f.getAttribute("enctype"))||ht,s=new FormData(f,e),!bo()){let{name:h,type:g,value:C}=e;if(g==="image"){let j=h?`${h}.`:"";s.append(`${j}x`,"0"),s.append(`${j}y`,"0")}else h&&s.append(h,C)}}else{if(Ot(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=dt,a=null,i=ht,l=e}return s&&i==="text/plain"&&(l=s,s=void 0),{action:a,method:r.toLowerCase(),encType:i,formData:s,body:l}}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function xo(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 ko(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 Oo(e,t,r){let a=await Promise.all(e.map(async i=>{let s=t.routes[i.route.id];if(s){let l=await xo(s,r);return l.links?l.links():[]}return[]}));return Ro(a.flat(1).filter(ko).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Dr(e,t,r,a,i,s){let l=(c,h)=>r[h]?c.route.id!==r[h].route.id:!0,f=(c,h)=>r[h].pathname!==c.pathname||r[h].route.path?.endsWith("*")&&r[h].params["*"]!==c.params["*"];return s==="assets"?t.filter((c,h)=>l(c,h)||f(c,h)):s==="data"?t.filter((c,h)=>{let g=a.routes[c.route.id];if(!g||!g.hasLoader)return!1;if(l(c,h)||f(c,h))return!0;if(c.route.shouldRevalidate){let C=c.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof C=="boolean")return C}return!0}):[]}function Co(e,t,{includeHydrateFallback:r}={}){return Po(e.map(a=>{let i=t.routes[a.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),r&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function Po(e){return[...new Set(e)]}function Eo(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function Ro(e,t){let r=new Set;return new Set(t),e.reduce((a,i)=>{let s=JSON.stringify(Eo(i));return r.has(s)||(r.add(s),a.push({key:s,link:i})),a},[])}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var _o=new Set([100,101,204,205]);function To(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 pn(){let e=D.useContext(Me);return Jt(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function jo(){let e=D.useContext(kt);return Jt(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Zt=D.createContext(void 0);Zt.displayName="FrameworkContext";function mn(){let e=D.useContext(Zt);return Jt(e,"You must render this element inside a <HydratedRouter> element"),e}function Lo(e,t){let r=D.useContext(Zt),[a,i]=D.useState(!1),[s,l]=D.useState(!1),{onFocus:f,onBlur:c,onMouseEnter:h,onMouseLeave:g,onTouchStart:C}=t,j=D.useRef(null);D.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let p=O=>{O.forEach(F=>{l(F.isIntersecting)})},$=new IntersectionObserver(p,{threshold:.5});return j.current&&$.observe(j.current),()=>{$.disconnect()}}},[e]),D.useEffect(()=>{if(a){let p=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(p)}}},[a]);let A=()=>{i(!0)},E=()=>{i(!1),l(!1)};return r?e!=="intent"?[s,j,{}]:[s,j,{onFocus:Ye(f,A),onBlur:Ye(c,E),onMouseEnter:Ye(h,A),onMouseLeave:Ye(g,E),onTouchStart:Ye(C,A)}]:[!1,j,{}]}function Ye(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Do({page:e,...t}){let{router:r}=pn(),a=D.useMemo(()=>tn(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?D.createElement($o,{page:e,matches:a,...t}):null}function Mo(e){let{manifest:t,routeModules:r}=mn(),[a,i]=D.useState([]);return D.useEffect(()=>{let s=!1;return Oo(e,t,r).then(l=>{s||i(l)}),()=>{s=!0}},[e,t,r]),a}function $o({page:e,matches:t,...r}){let a=Oe(),{manifest:i,routeModules:s}=mn(),{basename:l}=pn(),{loaderData:f,matches:c}=jo(),h=D.useMemo(()=>Dr(e,t,c,i,a,"data"),[e,t,c,i,a]),g=D.useMemo(()=>Dr(e,t,c,i,a,"assets"),[e,t,c,i,a]),C=D.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let E=new Set,p=!1;if(t.forEach(O=>{let F=i.routes[O.route.id];!F||!F.hasLoader||(!h.some(Y=>Y.route.id===O.route.id)&&O.route.id in f&&s[O.route.id]?.shouldRevalidate||F.hasClientLoader?p=!0:E.add(O.route.id))}),E.size===0)return[];let $=To(e,l);return p&&E.size>0&&$.searchParams.set("_routes",t.filter(O=>E.has(O.route.id)).map(O=>O.route.id).join(",")),[$.pathname+$.search]},[l,f,a,i,h,t,e,s]),j=D.useMemo(()=>Co(g,i),[g,i]),A=Mo(g);return D.createElement(D.Fragment,null,C.map(E=>D.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...r})),j.map(E=>D.createElement("link",{key:E,rel:"modulepreload",href:E,...r})),A.map(({key:E,link:p})=>D.createElement("link",{key:E,...p})))}function Io(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var vn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{vn&&(window.__reactRouterVersion="7.6.3")}catch{}function Ao({basename:e,children:t,window:r}){let a=D.useRef();a.current==null&&(a.current=xa({window:r,v5Compat:!0}));let i=a.current,[s,l]=D.useState({action:i.action,location:i.location}),f=D.useCallback(c=>{D.startTransition(()=>l(c))},[l]);return D.useLayoutEffect(()=>i.listen(f),[i,f]),D.createElement(co,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:i})}var gn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yn=D.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:i,reloadDocument:s,replace:l,state:f,target:c,to:h,preventScrollReset:g,viewTransition:C,...j},A){let{basename:E}=D.useContext(we),p=typeof h=="string"&&gn.test(h),$,O=!1;if(typeof h=="string"&&p&&($=h,vn))try{let y=new URL(window.location.href),d=h.startsWith("//")?new URL(y.protocol+h):new URL(h),x=xe(d.pathname,E);d.origin===y.origin&&x!=null?h=x+d.search+d.hash:O=!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=Ga(h,{relative:i}),[Y,V,v]=Lo(a,j),b=Fo(h,{replace:l,state:f,target:c,preventScrollReset:g,relative:i,viewTransition:C});function w(y){t&&t(y),y.defaultPrevented||b(y)}let P=D.createElement("a",{...j,...v,href:$||F,onClick:O||s?t:w,ref:Io(A,V),target:c,"data-discover":!p&&r==="render"?"true":void 0});return Y&&!p?D.createElement(D.Fragment,null,P,D.createElement(Do,{page:F})):P});yn.displayName="Link";var Ho=D.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:i=!1,style:s,to:l,viewTransition:f,children:c,...h},g){let C=Qe(l,{relative:h.relative}),j=Oe(),A=D.useContext(kt),{navigator:E,basename:p}=D.useContext(we),$=A!=null&&Vo(C)&&f===!0,O=E.encodeLocation?E.encodeLocation(C).pathname:C.pathname,F=j.pathname,Y=A&&A.navigation&&A.navigation.location?A.navigation.location.pathname:null;r||(F=F.toLowerCase(),Y=Y?Y.toLowerCase():null,O=O.toLowerCase()),Y&&p&&(Y=xe(Y,p)||Y);const V=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let v=F===O||!i&&F.startsWith(O)&&F.charAt(V)==="/",b=Y!=null&&(Y===O||!i&&Y.startsWith(O)&&Y.charAt(O.length)==="/"),w={isActive:v,isPending:b,isTransitioning:$},P=v?t:void 0,y;typeof a=="function"?y=a(w):y=[a,v?"active":null,b?"pending":null,$?"transitioning":null].filter(Boolean).join(" ");let d=typeof s=="function"?s(w):s;return D.createElement(yn,{...h,"aria-current":P,className:y,ref:g,style:d,to:l,viewTransition:f},typeof c=="function"?c(w):c)});Ho.displayName="NavLink";var zo=D.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:i,state:s,method:l=dt,action:f,onSubmit:c,relative:h,preventScrollReset:g,viewTransition:C,...j},A)=>{let E=qo(),p=Bo(f,{relative:h}),$=l.toLowerCase()==="get"?"get":"post",O=typeof f=="string"&&gn.test(f),F=Y=>{if(c&&c(Y),Y.defaultPrevented)return;Y.preventDefault();let V=Y.nativeEvent.submitter,v=V?.getAttribute("formmethod")||l;E(V||Y.currentTarget,{fetcherKey:t,method:v,navigate:r,replace:i,state:s,relative:h,preventScrollReset:g,viewTransition:C})};return D.createElement("form",{ref:A,method:$,action:p,onSubmit:a?c:F,...j,"data-discover":!O&&e==="render"?"true":void 0})});zo.displayName="Form";function No(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bn(e){let t=D.useContext(Me);return ae(t,No(e)),t}function Fo(e,{target:t,replace:r,state:a,preventScrollReset:i,relative:s,viewTransition:l}={}){let f=Xt(),c=Oe(),h=Qe(e,{relative:s});return D.useCallback(g=>{if(go(g,t)){g.preventDefault();let C=r!==void 0?r:Xe(c)===Xe(h);f(e,{replace:C,state:a,preventScrollReset:i,relative:s,viewTransition:l})}},[c,f,h,r,a,t,e,i,s,l])}function Wo(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=D.useRef(Wt(e)),r=D.useRef(!1),a=Oe(),i=D.useMemo(()=>yo(a.search,r.current?null:t.current),[a.search]),s=Xt(),l=D.useCallback((f,c)=>{const h=Wt(typeof f=="function"?f(i):f);r.current=!0,s("?"+h,c)},[s,i]);return[i,l]}var Uo=0,Yo=()=>`__${String(++Uo)}__`;function qo(){let{router:e}=bn("useSubmit"),{basename:t}=D.useContext(we),r=oo();return D.useCallback(async(a,i={})=>{let{action:s,method:l,encType:f,formData:c,body:h}=So(a,t);if(i.navigate===!1){let g=i.fetcherKey||Yo();await e.fetch(g,r,i.action||s,{preventScrollReset:i.preventScrollReset,formData:c,body:h,formMethod:i.method||l,formEncType:i.encType||f,flushSync:i.flushSync})}else await e.navigate(i.action||s,{preventScrollReset:i.preventScrollReset,formData:c,body:h,formMethod:i.method||l,formEncType:i.encType||f,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[e,t,r])}function Bo(e,{relative:t}={}){let{basename:r}=D.useContext(we),a=D.useContext(ke);ae(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),s={...Qe(e||".",{relative:t})},l=Oe();if(e==null){s.search=l.search;let f=new URLSearchParams(s.search),c=f.getAll("index");if(c.some(g=>g==="")){f.delete("index"),c.filter(C=>C).forEach(C=>f.append("index",C));let g=f.toString();s.search=g?`?${g}`:""}}return(!e||e===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(s.pathname=s.pathname==="/"?r:Se([r,s.pathname])),Xe(s)}function Vo(e,t={}){let r=D.useContext(ln);ae(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=bn("useViewTransitionState"),i=Qe(e,{relative:t.relative});if(!r.isTransitioning)return!1;let s=xe(r.currentLocation.pathname,a)||r.currentLocation.pathname,l=xe(r.nextLocation.pathname,a)||r.nextLocation.pathname;return gt(i.pathname,l)!=null||gt(i.pathname,s)!=null}[..._o];const wn=U.createContext({history:[],addToHistory:()=>{},popFromHistory:()=>"",replaceHistory:()=>{}}),Xo=()=>{const[e,t]=Wo(),r=U.useMemo(()=>Object.fromEntries(e.entries()),[e]),a=U.useCallback(h=>{const g={};return h.forEach(C=>{g[C]=e.get(C)}),g},[e]),i=U.useCallback(h=>{const g=e.get(h);return g==null||g==null,g},[e]),s=U.useCallback((h,g)=>{const C=new URLSearchParams(e);C.set(h,String(g)),t(C)},[e,t]),l=U.useCallback(h=>{const g=new URLSearchParams(e);Object.entries(h).forEach(([C,j])=>{j!=null&&g.set(C,String(j))}),t(g)},[e,t]),f=U.useCallback(h=>{const g=new URLSearchParams(e);g.delete(h),t(g)},[e,t]),c=U.useCallback(h=>{const g=new URLSearchParams(e);h.forEach(C=>{g.delete(String(C))}),t(g)},[e,t]);return{getAll:()=>r,get:i,getMany:a,set:s,setMany:l,remove:f,removeMany:c}},Go=()=>{const e=Xt(),t=Oe(),r=Xo(),a=U.useContext(wn),i=f=>{const c=new URL(f.path,"http://dummy-base");return f.params&&Object.entries(f.params).forEach(([h,g])=>{g!=null&&c.searchParams.set(h,String(g))}),c.pathname+c.search},s=U.useCallback(f=>{const c=i(f);f.addToHistory!==!1?(e(c),a.addToHistory(c)):(e(c,{replace:!0}),a.popFromHistory(1),a.addToHistory(c))},[e]),l=U.useCallback(f=>{const c=f||1;e(-c),a.popFromHistory(c)},[e]);return{currentPath:t.pathname,history:a.history,searchParams:r,goBack:l,goTo:s}},Ko=({routes:e,children:t})=>{const r=U.useRef([]),[a,i]=U.useState([]),s=U.useCallback(g=>{r.current=g,i(g)},[]),l=(g,C=!1)=>{let j=[...r.current];C&&(j=j.slice(0,j.length-1)),j=[...j,g],s(j)},f=g=>{let C="",j=[];return r.current.length===0?"/":(r.current.length<=g?(C=r.current[0],j=[C]):(j=r.current.slice(0,r.current.length-g),C=j[j.length-1]),s(j),C)},c=g=>{s(g)},h=e.map(g=>J.jsx(hn,{path:g.path,element:g.render}));return J.jsx(wn.Provider,{value:{history:a,addToHistory:l,popFromHistory:f,replaceHistory:c},children:J.jsxs(Ao,{children:[t,J.jsx(fo,{children:h})]})})},Sn=U.createContext({visibleItems:[],isItemVisible:()=>!1,showItem:()=>{},hideItem:()=>{}}),Jo=({children:e})=>{const t=U.useRef([]),[r,a]=U.useState([]),i=U.useCallback(c=>{t.current=c,a(c)},[]),s=U.useCallback(c=>t.current.some(h=>h===c),[]),l=U.useCallback(c=>{s(c)||i([...t.current,c])},[s,i]),f=U.useCallback(c=>{s(c)&&i(t.current.filter(g=>g!==c))},[s,i]);return J.jsx(Sn.Provider,{value:{visibleItems:r,isItemVisible:s,showItem:l,hideItem:f},children:e})},et=()=>{const e=U.useContext(Sn),t=i=>e.visibleItems.some(s=>s===i),r=i=>{e.showItem(i)},a=i=>{e.hideItem(i)};return{visibleItems:e.visibleItems,isItemVisible:t,showItem:r,hideItem:a}},Zo=({id:e,onCloseDrawer:t,drawerCloseOffset:r=15})=>{const{isItemVisible:a}=et(),[i,s]=U.useState({isDragging:!1}),l=U.useRef(null),f=U.useRef(null),c=U.useRef(null),[h,g]=U.useState(0),C=E=>{s(E)},j=E=>{s(E),g(0)};return Zr({ref:c,onDrag:E=>{s(E);const p=f.current?.clientHeight||0;E.distanceY&&(g(E.distanceY<0?0:-E.distanceY),E.distanceY>=p-r&&(t?.(),j(E)))},onDragEnd:j,onDragStart:C}),{isVisible:a(e),drawerParentRef:l,drawerRef:f,drawerBottomDistance:h,handleRef:c}},Qo=e=>{const{children:t,backgroundStyles:r,contentStyles:a,handle:i}=e,{isVisible:s,drawerParentRef:l,drawerRef:f,handleRef:c,drawerBottomDistance:h}=Zo(e);return J.jsx(J.Fragment,{children:s&&J.jsx("div",{ref:l,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:J.jsxs("div",{ref:f,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`,...a},onClick:g=>{g.stopPropagation()},children:[J.jsx("div",{ref:c,style:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0px",height:"24px",width:"100%",cursor:"pointer",...i?.styles},children:i?.render}),t]})})})},es=({onSubmit:e,fields:t})=>{const r=U.useRef(null),a=U.useCallback(l=>{var f=Object.keys(l.currentTarget.elements),c=Object.values(l.currentTarget.elements),h=[];for(let g=0;g<f.length;g++){const C=f[g];if(t.findIndex(A=>A.name===C)===-1)continue;const j=c[g].value;h.push({name:C,value:j})}return h},[e]),i=U.useCallback(l=>{l.preventDefault();const f=a(l);e?.(f)},[e]);return{ref:r,submitForm:l=>{l.preventDefault(),l.stopPropagation(),r.current&&r.current.requestSubmit()},handleFormSubmission:i}},ts=e=>{const{fields:t,styles:r,submitButton:a}=e,{ref:i,handleFormSubmission:s,submitForm:l}=es(e),f=U.useCallback(()=>t.map(c=>({...c.content,key:c.name})),[t]);return J.jsxs("form",{ref:i,onSubmit:s,style:{width:"100%",display:"flex",flexDirection:"column",gap:"8px",flex:1,...r},children:[f(),J.jsx("div",{onClick:l,style:{display:"flex",width:"100%",alignItems:"center",justifyContent:"center",...a.styles},children:a.content})]})},rs=({src:e,alt:t="",onClick:r,styles:a})=>J.jsx("img",{src:e,alt:t,style:{overflow:"hidden",position:"relative",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",objectFit:"cover",...a},onClick:()=>r?.()}),ns=je.div`
|
|
127
127
|
display: flex;
|
|
128
128
|
flex-direction: column;
|
|
129
129
|
font-family: inherit;
|
package/dist/index.es.js
CHANGED
|
@@ -10,7 +10,7 @@ export declare const useNavigation: () => {
|
|
|
10
10
|
getAll: () => {
|
|
11
11
|
[k: string]: string;
|
|
12
12
|
};
|
|
13
|
-
get: (key: string) =>
|
|
13
|
+
get: <T>(key: string) => T | null;
|
|
14
14
|
getMany: (keys: string[]) => Record<string, string | null>;
|
|
15
15
|
set: (key: string, value: any) => void;
|
|
16
16
|
setMany: (params: Record<string, any>) => void;
|
|
@@ -2,7 +2,7 @@ export declare const useNavigationParams: () => {
|
|
|
2
2
|
getAll: () => {
|
|
3
3
|
[k: string]: string;
|
|
4
4
|
};
|
|
5
|
-
get: (key: string) =>
|
|
5
|
+
get: <T>(key: string) => T | null;
|
|
6
6
|
getMany: (keys: string[]) => Record<string, string | null>;
|
|
7
7
|
set: (key: string, value: any) => void;
|
|
8
8
|
setMany: (params: Record<string, any>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eliseubatista99/react-scaffold-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.49",
|
|
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",
|