mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 04:40:05 +01:00
5 lines
43 KiB
JavaScript
5 lines
43 KiB
JavaScript
function rt(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in e)){const u=Object.getOwnPropertyDescriptor(n,a);u&&Object.defineProperty(e,a,u.get?u:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Ae(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var se={exports:{}},R={};var Se;function nt(){if(Se)return R;Se=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),s=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),o=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),v=Symbol.iterator;function E(i){return i===null||typeof i!="object"?null:(i=v&&i[v]||i["@@iterator"],typeof i=="function"?i:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,g={};function y(i,p,C){this.props=i,this.context=p,this.refs=g,this.updater=C||_}y.prototype.isReactComponent={},y.prototype.setState=function(i,p){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,p,"setState")},y.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function m(){}m.prototype=y.prototype;function b(i,p,C){this.props=i,this.context=p,this.refs=g,this.updater=C||_}var $=b.prototype=new m;$.constructor=b,S($,y.prototype),$.isPureReactComponent=!0;var N=Array.isArray;function j(){}var x={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function A(i,p,C){var w=C.ref;return{$$typeof:e,type:i,key:p,ref:w!==void 0?w:null,props:C}}function W(i,p){return A(i.type,p,i.props)}function q(i){return typeof i=="object"&&i!==null&&i.$$typeof===e}function Xe(i){var p={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(C){return p[C]})}var Ce=/\/+/g;function le(i,p){return typeof i=="object"&&i!==null&&i.key!=null?Xe(""+i.key):p.toString(36)}function Qe(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(j,j):(i.status="pending",i.then(function(p){i.status==="pending"&&(i.status="fulfilled",i.value=p)},function(p){i.status==="pending"&&(i.status="rejected",i.reason=p)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function K(i,p,C,w,P){var T=typeof i;(T==="undefined"||T==="boolean")&&(i=null);var L=!1;if(i===null)L=!0;else switch(T){case"bigint":case"string":case"number":L=!0;break;case"object":switch(i.$$typeof){case e:case t:L=!0;break;case f:return L=i._init,K(L(i._payload),p,C,w,P)}}if(L)return P=P(i),L=w===""?"."+le(i,0):w,N(P)?(C="",L!=null&&(C=L.replace(Ce,"$&/")+"/"),K(P,p,C,"",function(tt){return tt})):P!=null&&(q(P)&&(P=W(P,C+(P.key==null||i&&i.key===P.key?"":(""+P.key).replace(Ce,"$&/")+"/")+L)),p.push(P)),1;L=0;var F=w===""?".":w+":";if(N(i))for(var D=0;D<i.length;D++)w=i[D],T=F+le(w,D),L+=K(w,p,C,T,P);else if(D=E(i),typeof D=="function")for(i=D.call(i),D=0;!(w=i.next()).done;)w=w.value,T=F+le(w,D++),L+=K(w,p,C,T,P);else if(T==="object"){if(typeof i.then=="function")return K(Qe(i),p,C,w,P);throw p=String(i),Error("Objects are not valid as a React child (found: "+(p==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":p)+"). If you meant to render a collection of children, use an array instead.")}return L}function te(i,p,C){if(i==null)return i;var w=[],P=0;return K(i,w,"","",function(T){return p.call(C,T,P++)}),w}function Ze(i){if(i._status===-1){var p=i._result;p=p(),p.then(function(C){(i._status===0||i._status===-1)&&(i._status=1,i._result=C)},function(C){(i._status===0||i._status===-1)&&(i._status=2,i._result=C)}),i._status===-1&&(i._status=0,i._result=p)}if(i._status===1)return i._result.default;throw i._result}var _e=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var p=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(p))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},et={map:te,forEach:function(i,p,C){te(i,function(){p.apply(this,arguments)},C)},count:function(i){var p=0;return te(i,function(){p++}),p},toArray:function(i){return te(i,function(p){return p})||[]},only:function(i){if(!q(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};return R.Activity=h,R.Children=et,R.Component=y,R.Fragment=r,R.Profiler=a,R.PureComponent=b,R.StrictMode=n,R.Suspense=l,R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=x,R.__COMPILER_RUNTIME={__proto__:null,c:function(i){return x.H.useMemoCache(i)}},R.cache=function(i){return function(){return i.apply(null,arguments)}},R.cacheSignal=function(){return null},R.cloneElement=function(i,p,C){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var w=S({},i.props),P=i.key;if(p!=null)for(T in p.key!==void 0&&(P=""+p.key),p)!z.call(p,T)||T==="key"||T==="__self"||T==="__source"||T==="ref"&&p.ref===void 0||(w[T]=p[T]);var T=arguments.length-2;if(T===1)w.children=C;else if(1<T){for(var L=Array(T),F=0;F<T;F++)L[F]=arguments[F+2];w.children=L}return A(i.type,P,w)},R.createContext=function(i){return i={$$typeof:s,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:u,_context:i},i},R.createElement=function(i,p,C){var w,P={},T=null;if(p!=null)for(w in p.key!==void 0&&(T=""+p.key),p)z.call(p,w)&&w!=="key"&&w!=="__self"&&w!=="__source"&&(P[w]=p[w]);var L=arguments.length-2;if(L===1)P.children=C;else if(1<L){for(var F=Array(L),D=0;D<L;D++)F[D]=arguments[D+2];P.children=F}if(i&&i.defaultProps)for(w in L=i.defaultProps,L)P[w]===void 0&&(P[w]=L[w]);return A(i,T,P)},R.createRef=function(){return{current:null}},R.forwardRef=function(i){return{$$typeof:d,render:i}},R.isValidElement=q,R.lazy=function(i){return{$$typeof:f,_payload:{_status:-1,_result:i},_init:Ze}},R.memo=function(i,p){return{$$typeof:o,type:i,compare:p===void 0?null:p}},R.startTransition=function(i){var p=x.T,C={};x.T=C;try{var w=i(),P=x.S;P!==null&&P(C,w),typeof w=="object"&&w!==null&&typeof w.then=="function"&&w.then(j,_e)}catch(T){_e(T)}finally{p!==null&&C.types!==null&&(p.types=C.types),x.T=p}},R.unstable_useCacheRefresh=function(){return x.H.useCacheRefresh()},R.use=function(i){return x.H.use(i)},R.useActionState=function(i,p,C){return x.H.useActionState(i,p,C)},R.useCallback=function(i,p){return x.H.useCallback(i,p)},R.useContext=function(i){return x.H.useContext(i)},R.useDebugValue=function(){},R.useDeferredValue=function(i,p){return x.H.useDeferredValue(i,p)},R.useEffect=function(i,p){return x.H.useEffect(i,p)},R.useEffectEvent=function(i){return x.H.useEffectEvent(i)},R.useId=function(){return x.H.useId()},R.useImperativeHandle=function(i,p,C){return x.H.useImperativeHandle(i,p,C)},R.useInsertionEffect=function(i,p){return x.H.useInsertionEffect(i,p)},R.useLayoutEffect=function(i,p){return x.H.useLayoutEffect(i,p)},R.useMemo=function(i,p){return x.H.useMemo(i,p)},R.useOptimistic=function(i,p){return x.H.useOptimistic(i,p)},R.useReducer=function(i,p,C){return x.H.useReducer(i,p,C)},R.useRef=function(i){return x.H.useRef(i)},R.useState=function(i){return x.H.useState(i)},R.useSyncExternalStore=function(i,p,C){return x.H.useSyncExternalStore(i,p,C)},R.useTransition=function(){return x.H.useTransition()},R.version="19.2.0",R}var xe;function Ne(){return xe||(xe=1,se.exports=nt()),se.exports}var c=Ne();const ot=Ae(c),kr=rt({__proto__:null,default:ot},[c]);var ce={exports:{}},k={};var Pe;function at(){if(Pe)return k;Pe=1;var e=Ne();function t(l){var o="https://react.dev/errors/"+l;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)o+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+l+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for("react.portal");function u(l,o,f){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:h==null?null:""+h,children:l,containerInfo:o,implementation:f}}var s=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(l,o){if(l==="font")return"";if(typeof o=="string")return o==="use-credentials"?o:""}return k.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,k.createPortal=function(l,o){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)throw Error(t(299));return u(l,o,null,f)},k.flushSync=function(l){var o=s.T,f=n.p;try{if(s.T=null,n.p=2,l)return l()}finally{s.T=o,n.p=f,n.d.f()}},k.preconnect=function(l,o){typeof l=="string"&&(o?(o=o.crossOrigin,o=typeof o=="string"?o==="use-credentials"?o:"":void 0):o=null,n.d.C(l,o))},k.prefetchDNS=function(l){typeof l=="string"&&n.d.D(l)},k.preinit=function(l,o){if(typeof l=="string"&&o&&typeof o.as=="string"){var f=o.as,h=d(f,o.crossOrigin),v=typeof o.integrity=="string"?o.integrity:void 0,E=typeof o.fetchPriority=="string"?o.fetchPriority:void 0;f==="style"?n.d.S(l,typeof o.precedence=="string"?o.precedence:void 0,{crossOrigin:h,integrity:v,fetchPriority:E}):f==="script"&&n.d.X(l,{crossOrigin:h,integrity:v,fetchPriority:E,nonce:typeof o.nonce=="string"?o.nonce:void 0})}},k.preinitModule=function(l,o){if(typeof l=="string")if(typeof o=="object"&&o!==null){if(o.as==null||o.as==="script"){var f=d(o.as,o.crossOrigin);n.d.M(l,{crossOrigin:f,integrity:typeof o.integrity=="string"?o.integrity:void 0,nonce:typeof o.nonce=="string"?o.nonce:void 0})}}else o==null&&n.d.M(l)},k.preload=function(l,o){if(typeof l=="string"&&typeof o=="object"&&o!==null&&typeof o.as=="string"){var f=o.as,h=d(f,o.crossOrigin);n.d.L(l,f,{crossOrigin:h,integrity:typeof o.integrity=="string"?o.integrity:void 0,nonce:typeof o.nonce=="string"?o.nonce:void 0,type:typeof o.type=="string"?o.type:void 0,fetchPriority:typeof o.fetchPriority=="string"?o.fetchPriority:void 0,referrerPolicy:typeof o.referrerPolicy=="string"?o.referrerPolicy:void 0,imageSrcSet:typeof o.imageSrcSet=="string"?o.imageSrcSet:void 0,imageSizes:typeof o.imageSizes=="string"?o.imageSizes:void 0,media:typeof o.media=="string"?o.media:void 0})}},k.preloadModule=function(l,o){if(typeof l=="string")if(o){var f=d(o.as,o.crossOrigin);n.d.m(l,{as:typeof o.as=="string"&&o.as!=="script"?o.as:void 0,crossOrigin:f,integrity:typeof o.integrity=="string"?o.integrity:void 0})}else n.d.m(l)},k.requestFormReset=function(l){n.d.r(l)},k.unstable_batchedUpdates=function(l,o){return l(o)},k.useFormState=function(l,o,f){return s.H.useFormState(l,o,f)},k.useFormStatus=function(){return s.H.useHostTransitionStatus()},k.version="19.2.0",k}var be;function it(){if(be)return ce.exports;be=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ce.exports=at(),ce.exports}var ut=it();const $r=Ae(ut);var Te="popstate";function lt(e={}){function t(n,a){let{pathname:u,search:s,hash:d}=n.location;return pe("",{pathname:u,search:s,hash:d},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:Q(a)}return ct(t,r,null,e)}function O(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function M(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function st(){return Math.random().toString(36).substring(2,10)}function Le(e,t){return{usr:e.state,key:e.key,idx:t}}function pe(e,t,r=null,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?V(t):t,state:r,key:t&&t.key||n||st()}}function Q({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 V(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function ct(e,t,r,n={}){let{window:a=document.defaultView,v5Compat:u=!1}=n,s=a.history,d="POP",l=null,o=f();o==null&&(o=0,s.replaceState({...s.state,idx:o},""));function f(){return(s.state||{idx:null}).idx}function h(){d="POP";let g=f(),y=g==null?null:g-o;o=g,l&&l({action:d,location:S.location,delta:y})}function v(g,y){d="PUSH";let m=pe(S.location,g,y);o=f()+1;let b=Le(m,o),$=S.createHref(m);try{s.pushState(b,"",$)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;a.location.assign($)}u&&l&&l({action:d,location:S.location,delta:1})}function E(g,y){d="REPLACE";let m=pe(S.location,g,y);o=f();let b=Le(m,o),$=S.createHref(m);s.replaceState(b,"",$),u&&l&&l({action:d,location:S.location,delta:0})}function _(g){return ft(g)}let S={get action(){return d},get location(){return e(a,s)},listen(g){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(Te,h),l=g,()=>{a.removeEventListener(Te,h),l=null}},createHref(g){return t(a,g)},createURL:_,encodeLocation(g){let y=_(g);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:v,replace:E,go(g){return s.go(g)}};return S}function ft(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),O(r,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:Q(e);return n=n.replace(/ $/,"%20"),!t&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function De(e,t,r="/"){return dt(e,t,r,!1)}function dt(e,t,r,n){let a=typeof t=="string"?V(t):t,u=B(a.pathname||"/",r);if(u==null)return null;let s=Me(e);pt(s);let d=null;for(let l=0;d==null&&l<s.length;++l){let o=St(u);d=Ct(s[l],o,n)}return d}function Me(e,t=[],r=[],n="",a=!1){let u=(s,d,l=a,o)=>{let f={relativePath:o===void 0?s.path||"":o,caseSensitive:s.caseSensitive===!0,childrenIndex:d,route:s};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(n)&&l)return;O(f.relativePath.startsWith(n),`Absolute route path "${f.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(n.length)}let h=U([n,f.relativePath]),v=r.concat(f);s.children&&s.children.length>0&&(O(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),Me(s.children,t,v,h,l)),!(s.path==null&&!s.index)&&t.push({path:h,score:Rt(h,s.index),routesMeta:v})};return e.forEach((s,d)=>{if(s.path===""||!s.path?.includes("?"))u(s,d);else for(let l of Ie(s.path))u(s,d,!0,l)}),t}function Ie(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),u=r.replace(/\?$/,"");if(n.length===0)return a?[u,""]:[u];let s=Ie(n.join("/")),d=[];return d.push(...s.map(l=>l===""?u:[u,l].join("/"))),a&&d.push(...s),d.map(l=>e.startsWith("/")&&l===""?"/":l)}function pt(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:wt(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var ht=/^:[\w-]+$/,mt=3,yt=2,gt=1,vt=10,Et=-2,Oe=e=>e==="*";function Rt(e,t){let r=e.split("/"),n=r.length;return r.some(Oe)&&(n+=Et),t&&(n+=yt),r.filter(a=>!Oe(a)).reduce((a,u)=>a+(ht.test(u)?mt:u===""?gt:vt),n)}function wt(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function Ct(e,t,r=!1){let{routesMeta:n}=e,a={},u="/",s=[];for(let d=0;d<n.length;++d){let l=n[d],o=d===n.length-1,f=u==="/"?t:t.slice(u.length)||"/",h=ae({path:l.relativePath,caseSensitive:l.caseSensitive,end:o},f),v=l.route;if(!h&&o&&r&&!n[n.length-1].route.index&&(h=ae({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},f)),!h)return null;Object.assign(a,h.params),s.push({params:a,pathname:U([u,h.pathname]),pathnameBase:Tt(U([u,h.pathnameBase])),route:v}),h.pathnameBase!=="/"&&(u=U([u,h.pathnameBase]))}return s}function ae(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=_t(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let u=a[0],s=u.replace(/(.)\/+$/,"$1"),d=a.slice(1);return{params:n.reduce((o,{paramName:f,isOptional:h},v)=>{if(f==="*"){let _=d[v]||"";s=u.slice(0,u.length-_.length).replace(/(.)\/+$/,"$1")}const E=d[v];return h&&!E?o[f]=void 0:o[f]=(E||"").replace(/%2F/g,"/"),o},{}),pathname:u,pathnameBase:s,pattern:e}}function _t(e,t=!1,r=!0){M(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 n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,d,l)=>(n.push({paramName:d,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function St(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return M(!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 B(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function xt(e,t="/"){let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?V(e):e;return{pathname:r?r.startsWith("/")?r:Pt(r,t):t,search:Lt(n),hash:Ot(a)}}function Pt(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 fe(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. 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 bt(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function me(e){let t=bt(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function ye(e,t,r,n=!1){let a;typeof e=="string"?a=V(e):(a={...e},O(!a.pathname||!a.pathname.includes("?"),fe("?","pathname","search",a)),O(!a.pathname||!a.pathname.includes("#"),fe("#","pathname","hash",a)),O(!a.search||!a.search.includes("#"),fe("#","search","hash",a)));let u=e===""||a.pathname==="",s=u?"/":a.pathname,d;if(s==null)d=r;else{let h=t.length-1;if(!n&&s.startsWith("..")){let v=s.split("/");for(;v[0]==="..";)v.shift(),h-=1;a.pathname=v.join("/")}d=h>=0?t[h]:"/"}let l=xt(a,d),o=s&&s!=="/"&&s.endsWith("/"),f=(u||s===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(o||f)&&(l.pathname+="/"),l}var U=e=>e.join("/").replace(/\/\/+/g,"/"),Tt=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Lt=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ot=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function kt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var He=["POST","PUT","PATCH","DELETE"];new Set(He);var $t=["GET",...He];new Set($t);var G=c.createContext(null);G.displayName="DataRouter";var ie=c.createContext(null);ie.displayName="DataRouterState";c.createContext(!1);var Fe=c.createContext({isTransitioning:!1});Fe.displayName="ViewTransition";var At=c.createContext(new Map);At.displayName="Fetchers";var Nt=c.createContext(null);Nt.displayName="Await";var I=c.createContext(null);I.displayName="Navigation";var Z=c.createContext(null);Z.displayName="Location";var H=c.createContext({outlet:null,matches:[],isDataRoute:!1});H.displayName="Route";var ge=c.createContext(null);ge.displayName="RouteError";function Dt(e,{relative:t}={}){O(J(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=c.useContext(I),{hash:a,pathname:u,search:s}=ee(e,{relative:t}),d=u;return r!=="/"&&(d=u==="/"?r:U([r,u])),n.createHref({pathname:d,search:s,hash:a})}function J(){return c.useContext(Z)!=null}function Y(){return O(J(),"useLocation() may be used only in the context of a <Router> component."),c.useContext(Z).location}var Ue="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Be(e){c.useContext(I).static||c.useLayoutEffect(e)}function je(){let{isDataRoute:e}=c.useContext(H);return e?Jt():Mt()}function Mt(){O(J(),"useNavigate() may be used only in the context of a <Router> component.");let e=c.useContext(G),{basename:t,navigator:r}=c.useContext(I),{matches:n}=c.useContext(H),{pathname:a}=Y(),u=JSON.stringify(me(n)),s=c.useRef(!1);return Be(()=>{s.current=!0}),c.useCallback((l,o={})=>{if(M(s.current,Ue),!s.current)return;if(typeof l=="number"){r.go(l);return}let f=ye(l,JSON.parse(u),a,o.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:U([t,f.pathname])),(o.replace?r.replace:r.push)(f,o.state,o)},[t,r,u,a,e])}var It=c.createContext(null);function Ht(e){let t=c.useContext(H).outlet;return c.useMemo(()=>t&&c.createElement(It.Provider,{value:e},t),[t,e])}function ee(e,{relative:t}={}){let{matches:r}=c.useContext(H),{pathname:n}=Y(),a=JSON.stringify(me(r));return c.useMemo(()=>ye(e,JSON.parse(a),n,t==="path"),[e,a,n,t])}function Ft(e,t){return We(e,t)}function We(e,t,r,n,a){O(J(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:u}=c.useContext(I),{matches:s}=c.useContext(H),d=s[s.length-1],l=d?d.params:{},o=d?d.pathname:"/",f=d?d.pathnameBase:"/",h=d&&d.route;{let m=h&&h.path||"";Ye(o,!h||m.endsWith("*")||m.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${m}">) 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.
|
|
|
|
Please change the parent <Route path="${m}"> to <Route path="${m==="/"?"*":`${m}/*`}">.`)}let v=Y(),E;if(t){let m=typeof t=="string"?V(t):t;O(f==="/"||m.pathname?.startsWith(f),`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 "${f}" but pathname "${m.pathname}" was given in the \`location\` prop.`),E=m}else E=v;let _=E.pathname||"/",S=_;if(f!=="/"){let m=f.replace(/^\//,"").split("/");S="/"+_.replace(/^\//,"").split("/").slice(m.length).join("/")}let g=De(e,{pathname:S});M(h||g!=null,`No routes matched location "${E.pathname}${E.search}${E.hash}" `),M(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${E.pathname}${E.search}${E.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 y=Yt(g&&g.map(m=>Object.assign({},m,{params:Object.assign({},l,m.params),pathname:U([f,u.encodeLocation?u.encodeLocation(m.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?f:U([f,u.encodeLocation?u.encodeLocation(m.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathnameBase])})),s,r,n,a);return t&&y?c.createElement(Z.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...E},navigationType:"POP"}},y):y}function Ut(){let e=Gt(),t=kt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},u={padding:"2px 4px",backgroundColor:n},s=null;return console.error("Error handled by React Router default ErrorBoundary:",e),s=c.createElement(c.Fragment,null,c.createElement("p",null,"💿 Hey developer 👋"),c.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",c.createElement("code",{style:u},"ErrorBoundary")," or"," ",c.createElement("code",{style:u},"errorElement")," prop on your route.")),c.createElement(c.Fragment,null,c.createElement("h2",null,"Unexpected Application Error!"),c.createElement("h3",{style:{fontStyle:"italic"}},t),r?c.createElement("pre",{style:a},r):null,s)}var Bt=c.createElement(Ut,null),jt=class extends c.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){this.props.unstable_onError?this.props.unstable_onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?c.createElement(H.Provider,{value:this.props.routeContext},c.createElement(ge.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Wt({routeContext:e,match:t,children:r}){let n=c.useContext(G);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),c.createElement(H.Provider,{value:e},r)}function Yt(e,t=[],r=null,n=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 u=e,s=r?.errors;if(s!=null){let o=u.findIndex(f=>f.route.id&&s?.[f.route.id]!==void 0);O(o>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),u=u.slice(0,Math.min(u.length,o+1))}let d=!1,l=-1;if(r)for(let o=0;o<u.length;o++){let f=u[o];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=o),f.route.id){let{loaderData:h,errors:v}=r,E=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!v||v[f.route.id]===void 0);if(f.route.lazy||E){d=!0,l>=0?u=u.slice(0,l+1):u=[u[0]];break}}}return u.reduceRight((o,f,h)=>{let v,E=!1,_=null,S=null;r&&(v=s&&f.route.id?s[f.route.id]:void 0,_=f.route.errorElement||Bt,d&&(l<0&&h===0?(Ye("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,S=null):l===h&&(E=!0,S=f.route.hydrateFallbackElement||null)));let g=t.concat(u.slice(0,h+1)),y=()=>{let m;return v?m=_:E?m=S:f.route.Component?m=c.createElement(f.route.Component,null):f.route.element?m=f.route.element:m=o,c.createElement(Wt,{match:f,routeContext:{outlet:o,matches:g,isDataRoute:r!=null},children:m})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?c.createElement(jt,{location:r.location,revalidation:r.revalidation,component:_,error:v,children:y(),routeContext:{outlet:null,matches:g,isDataRoute:!0},unstable_onError:n}):y()},null)}function ve(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zt(e){let t=c.useContext(G);return O(t,ve(e)),t}function qt(e){let t=c.useContext(ie);return O(t,ve(e)),t}function Kt(e){let t=c.useContext(H);return O(t,ve(e)),t}function Ee(e){let t=Kt(e),r=t.matches[t.matches.length-1];return O(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Vt(){return Ee("useRouteId")}function Gt(){let e=c.useContext(ge),t=qt("useRouteError"),r=Ee("useRouteError");return e!==void 0?e:t.errors?.[r]}function Jt(){let{router:e}=zt("useNavigate"),t=Ee("useNavigate"),r=c.useRef(!1);return Be(()=>{r.current=!0}),c.useCallback(async(a,u={})=>{M(r.current,Ue),r.current&&(typeof a=="number"?e.navigate(a):await e.navigate(a,{fromRouteId:t,...u}))},[e,t])}var ke={};function Ye(e,t,r){!t&&!ke[e]&&(ke[e]=!0,M(!1,r))}c.memo(Xt);function Xt({routes:e,future:t,state:r,unstable_onError:n}){return We(e,void 0,r,n,t)}function Ar({to:e,replace:t,state:r,relative:n}){O(J(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=c.useContext(I);M(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:u}=c.useContext(H),{pathname:s}=Y(),d=je(),l=ye(e,me(u),s,n==="path"),o=JSON.stringify(l);return c.useEffect(()=>{d(JSON.parse(o),{replace:t,state:r,relative:n})},[d,o,n,t,r]),null}function Nr(e){return Ht(e.context)}function Qt(e){O(!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 Zt({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:a,static:u=!1}){O(!J(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),d=c.useMemo(()=>({basename:s,navigator:a,static:u,future:{}}),[s,a,u]);typeof r=="string"&&(r=V(r));let{pathname:l="/",search:o="",hash:f="",state:h=null,key:v="default"}=r,E=c.useMemo(()=>{let _=B(l,s);return _==null?null:{location:{pathname:_,search:o,hash:f,state:h,key:v},navigationType:n}},[s,l,o,f,h,v,n]);return M(E!=null,`<Router basename="${s}"> is not able to match the URL "${l}${o}${f}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:c.createElement(I.Provider,{value:d},c.createElement(Z.Provider,{children:t,value:E}))}function Dr({children:e,location:t}){return Ft(he(e),t)}function he(e,t=[]){let r=[];return c.Children.forEach(e,(n,a)=>{if(!c.isValidElement(n))return;let u=[...t,a];if(n.type===c.Fragment){r.push.apply(r,he(n.props.children,u));return}O(n.type===Qt,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),O(!n.props.index||!n.props.children,"An index route cannot have child routes.");let s={id:n.props.id||u.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=he(n.props.children,u)),r.push(s)}),r}var ne="get",oe="application/x-www-form-urlencoded";function ue(e){return e!=null&&typeof e.tagName=="string"}function er(e){return ue(e)&&e.tagName.toLowerCase()==="button"}function tr(e){return ue(e)&&e.tagName.toLowerCase()==="form"}function rr(e){return ue(e)&&e.tagName.toLowerCase()==="input"}function nr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function or(e,t){return e.button===0&&(!t||t==="_self")&&!nr(e)}var re=null;function ar(){if(re===null)try{new FormData(document.createElement("form"),0),re=!1}catch{re=!0}return re}var ir=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function de(e){return e!=null&&!ir.has(e)?(M(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${oe}"`),null):e}function ur(e,t){let r,n,a,u,s;if(tr(e)){let d=e.getAttribute("action");n=d?B(d,t):null,r=e.getAttribute("method")||ne,a=de(e.getAttribute("enctype"))||oe,u=new FormData(e)}else if(er(e)||rr(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||d.getAttribute("action");if(n=l?B(l,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||ne,a=de(e.getAttribute("formenctype"))||de(d.getAttribute("enctype"))||oe,u=new FormData(d,e),!ar()){let{name:o,type:f,value:h}=e;if(f==="image"){let v=o?`${o}.`:"";u.append(`${v}x`,"0"),u.append(`${v}y`,"0")}else o&&u.append(o,h)}}else{if(ue(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ne,n=null,a=oe,s=e}return u&&a==="text/plain"&&(s=u,u=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:u,body:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Re(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function lr(e,t,r){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n.pathname==="/"?n.pathname=`_root.${r}`:t&&B(n.pathname,t)==="/"?n.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:n.pathname=`${n.pathname.replace(/\/$/,"")}.${r}`,n}async function sr(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 cr(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 fr(e,t,r){let n=await Promise.all(e.map(async a=>{let u=t.routes[a.route.id];if(u){let s=await sr(u,r);return s.links?s.links():[]}return[]}));return mr(n.flat(1).filter(cr).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function $e(e,t,r,n,a,u){let s=(l,o)=>r[o]?l.route.id!==r[o].route.id:!0,d=(l,o)=>r[o].pathname!==l.pathname||r[o].route.path?.endsWith("*")&&r[o].params["*"]!==l.params["*"];return u==="assets"?t.filter((l,o)=>s(l,o)||d(l,o)):u==="data"?t.filter((l,o)=>{let f=n.routes[l.route.id];if(!f||!f.hasLoader)return!1;if(s(l,o)||d(l,o))return!0;if(l.route.shouldRevalidate){let h=l.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function dr(e,t,{includeHydrateFallback:r}={}){return pr(e.map(n=>{let a=t.routes[n.route.id];if(!a)return[];let u=[a.module];return a.clientActionModule&&(u=u.concat(a.clientActionModule)),a.clientLoaderModule&&(u=u.concat(a.clientLoaderModule)),r&&a.hydrateFallbackModule&&(u=u.concat(a.hydrateFallbackModule)),a.imports&&(u=u.concat(a.imports)),u}).flat(1))}function pr(e){return[...new Set(e)]}function hr(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function mr(e,t){let r=new Set;return new Set(t),e.reduce((n,a)=>{let u=JSON.stringify(hr(a));return r.has(u)||(r.add(u),n.push({key:u,link:a})),n},[])}function ze(){let e=c.useContext(G);return Re(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function yr(){let e=c.useContext(ie);return Re(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var we=c.createContext(void 0);we.displayName="FrameworkContext";function qe(){let e=c.useContext(we);return Re(e,"You must render this element inside a <HydratedRouter> element"),e}function gr(e,t){let r=c.useContext(we),[n,a]=c.useState(!1),[u,s]=c.useState(!1),{onFocus:d,onBlur:l,onMouseEnter:o,onMouseLeave:f,onTouchStart:h}=t,v=c.useRef(null);c.useEffect(()=>{if(e==="render"&&s(!0),e==="viewport"){let S=y=>{y.forEach(m=>{s(m.isIntersecting)})},g=new IntersectionObserver(S,{threshold:.5});return v.current&&g.observe(v.current),()=>{g.disconnect()}}},[e]),c.useEffect(()=>{if(n){let S=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(S)}}},[n]);let E=()=>{a(!0)},_=()=>{a(!1),s(!1)};return r?e!=="intent"?[u,v,{}]:[u,v,{onFocus:X(d,E),onBlur:X(l,_),onMouseEnter:X(o,E),onMouseLeave:X(f,_),onTouchStart:X(h,E)}]:[!1,v,{}]}function X(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function vr({page:e,...t}){let{router:r}=ze(),n=c.useMemo(()=>De(r.routes,e,r.basename),[r.routes,e,r.basename]);return n?c.createElement(Rr,{page:e,matches:n,...t}):null}function Er(e){let{manifest:t,routeModules:r}=qe(),[n,a]=c.useState([]);return c.useEffect(()=>{let u=!1;return fr(e,t,r).then(s=>{u||a(s)}),()=>{u=!0}},[e,t,r]),n}function Rr({page:e,matches:t,...r}){let n=Y(),{manifest:a,routeModules:u}=qe(),{basename:s}=ze(),{loaderData:d,matches:l}=yr(),o=c.useMemo(()=>$e(e,t,l,a,n,"data"),[e,t,l,a,n]),f=c.useMemo(()=>$e(e,t,l,a,n,"assets"),[e,t,l,a,n]),h=c.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let _=new Set,S=!1;if(t.forEach(y=>{let m=a.routes[y.route.id];!m||!m.hasLoader||(!o.some(b=>b.route.id===y.route.id)&&y.route.id in d&&u[y.route.id]?.shouldRevalidate||m.hasClientLoader?S=!0:_.add(y.route.id))}),_.size===0)return[];let g=lr(e,s,"data");return S&&_.size>0&&g.searchParams.set("_routes",t.filter(y=>_.has(y.route.id)).map(y=>y.route.id).join(",")),[g.pathname+g.search]},[s,d,n,a,o,t,e,u]),v=c.useMemo(()=>dr(f,a),[f,a]),E=Er(f);return c.createElement(c.Fragment,null,h.map(_=>c.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...r})),v.map(_=>c.createElement("link",{key:_,rel:"modulepreload",href:_,...r})),E.map(({key:_,link:S})=>c.createElement("link",{key:_,nonce:r.nonce,...S})))}function wr(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Ke=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ke&&(window.__reactRouterVersion="7.9.5")}catch{}function Mr({basename:e,children:t,window:r}){let n=c.useRef();n.current==null&&(n.current=lt({window:r,v5Compat:!0}));let a=n.current,[u,s]=c.useState({action:a.action,location:a.location}),d=c.useCallback(l=>{c.startTransition(()=>s(l))},[s]);return c.useLayoutEffect(()=>a.listen(d),[a,d]),c.createElement(Zt,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:a})}var Ve=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ge=c.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:a,reloadDocument:u,replace:s,state:d,target:l,to:o,preventScrollReset:f,viewTransition:h,...v},E){let{basename:_}=c.useContext(I),S=typeof o=="string"&&Ve.test(o),g,y=!1;if(typeof o=="string"&&S&&(g=o,Ke))try{let A=new URL(window.location.href),W=o.startsWith("//")?new URL(A.protocol+o):new URL(o),q=B(W.pathname,_);W.origin===A.origin&&q!=null?o=q+W.search+W.hash:y=!0}catch{M(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let m=Dt(o,{relative:a}),[b,$,N]=gr(n,v),j=xr(o,{replace:s,state:d,target:l,preventScrollReset:f,relative:a,viewTransition:h});function x(A){t&&t(A),A.defaultPrevented||j(A)}let z=c.createElement("a",{...v,...N,href:g||m,onClick:y||u?t:x,ref:wr(E,$),target:l,"data-discover":!S&&r==="render"?"true":void 0});return b&&!S?c.createElement(c.Fragment,null,z,c.createElement(vr,{page:m})):z});Ge.displayName="Link";var Cr=c.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:a=!1,style:u,to:s,viewTransition:d,children:l,...o},f){let h=ee(s,{relative:o.relative}),v=Y(),E=c.useContext(ie),{navigator:_,basename:S}=c.useContext(I),g=E!=null&&Or(h)&&d===!0,y=_.encodeLocation?_.encodeLocation(h).pathname:h.pathname,m=v.pathname,b=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;r||(m=m.toLowerCase(),b=b?b.toLowerCase():null,y=y.toLowerCase()),b&&S&&(b=B(b,S)||b);const $=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let N=m===y||!a&&m.startsWith(y)&&m.charAt($)==="/",j=b!=null&&(b===y||!a&&b.startsWith(y)&&b.charAt(y.length)==="/"),x={isActive:N,isPending:j,isTransitioning:g},z=N?t:void 0,A;typeof n=="function"?A=n(x):A=[n,N?"active":null,j?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let W=typeof u=="function"?u(x):u;return c.createElement(Ge,{...o,"aria-current":z,className:A,ref:f,style:W,to:s,viewTransition:d},typeof l=="function"?l(x):l)});Cr.displayName="NavLink";var _r=c.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:a,state:u,method:s=ne,action:d,onSubmit:l,relative:o,preventScrollReset:f,viewTransition:h,...v},E)=>{let _=Tr(),S=Lr(d,{relative:o}),g=s.toLowerCase()==="get"?"get":"post",y=typeof d=="string"&&Ve.test(d),m=b=>{if(l&&l(b),b.defaultPrevented)return;b.preventDefault();let $=b.nativeEvent.submitter,N=$?.getAttribute("formmethod")||s;_($||b.currentTarget,{fetcherKey:t,method:N,navigate:r,replace:a,state:u,relative:o,preventScrollReset:f,viewTransition:h})};return c.createElement("form",{ref:E,method:g,action:S,onSubmit:n?l:m,...v,"data-discover":!y&&e==="render"?"true":void 0})});_r.displayName="Form";function Sr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Je(e){let t=c.useContext(G);return O(t,Sr(e)),t}function xr(e,{target:t,replace:r,state:n,preventScrollReset:a,relative:u,viewTransition:s}={}){let d=je(),l=Y(),o=ee(e,{relative:u});return c.useCallback(f=>{if(or(f,t)){f.preventDefault();let h=r!==void 0?r:Q(l)===Q(o);d(e,{replace:h,state:n,preventScrollReset:a,relative:u,viewTransition:s})}},[l,d,o,r,n,t,e,a,u,s])}var Pr=0,br=()=>`__${String(++Pr)}__`;function Tr(){let{router:e}=Je("useSubmit"),{basename:t}=c.useContext(I),r=Vt();return c.useCallback(async(n,a={})=>{let{action:u,method:s,encType:d,formData:l,body:o}=ur(n,t);if(a.navigate===!1){let f=a.fetcherKey||br();await e.fetch(f,r,a.action||u,{preventScrollReset:a.preventScrollReset,formData:l,body:o,formMethod:a.method||s,formEncType:a.encType||d,flushSync:a.flushSync})}else await e.navigate(a.action||u,{preventScrollReset:a.preventScrollReset,formData:l,body:o,formMethod:a.method||s,formEncType:a.encType||d,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,r])}function Lr(e,{relative:t}={}){let{basename:r}=c.useContext(I),n=c.useContext(H);O(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),u={...ee(e||".",{relative:t})},s=Y();if(e==null){u.search=s.search;let d=new URLSearchParams(u.search),l=d.getAll("index");if(l.some(f=>f==="")){d.delete("index"),l.filter(h=>h).forEach(h=>d.append("index",h));let f=d.toString();u.search=f?`?${f}`:""}}return(!e||e===".")&&a.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:U([r,u.pathname])),Q(u)}function Or(e,{relative:t}={}){let r=c.useContext(Fe);O(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=Je("useViewTransitionState"),a=ee(e,{relative:t});if(!r.isTransitioning)return!1;let u=B(r.currentLocation.pathname,n)||r.currentLocation.pathname,s=B(r.nextLocation.pathname,n)||r.nextLocation.pathname;return ae(a.pathname,s)!=null||ae(a.pathname,u)!=null}export{Mr as B,Ge as L,Cr as N,Nr as O,ot as R,$r as a,Ne as b,it as c,kr as d,ut as e,Ar as f,je as g,Dr as h,Qt as i,c as r,Y as u};
|
|
//# sourceMappingURL=react-B75e6Si-.js.map
|