You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
15 KiB

3 years ago
/**
* React Router v6.6.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@remix-run/router"),require("react")):"function"==typeof define&&define.amd?define(["exports","@remix-run/router","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouter={},e.RemixRouter,e.React)}(this,(function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=n(r);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}const i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},{useState:u,useEffect:l,useLayoutEffect:s,useDebugValue:c}=a;function d(e){const t=e.getSnapshot,r=e.value;try{const e=t();return!i(r,e)}catch(e){return!0}}const p=!!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)?function(e,t,r){return t()}:function(e,t,r){const n=t(),[{inst:a},o]=u({inst:{value:n,getSnapshot:t}});return s((()=>{a.value=n,a.getSnapshot=t,d(a)&&o({inst:a})}),[e,n,t]),l((()=>{d(a)&&o({inst:a});return e((()=>{d(a)&&o({inst:a})}))}),[e]),c(n),n},h="useSyncExternalStore"in a?(e=>e.useSyncExternalStore)(a):p,m=a.createContext(null),f=a.createContext(null),v=a.createContext(null),g=a.createContext(null),E=a.createContext(null),y=a.createContext(null),b=a.createContext({outlet:null,matches:[]}),x=a.createContext(null);function P(){return null!=a.useContext(y)}function R(){return P()||t.invariant(!1),a.useContext(y).location}function C(){P()||t.invariant(!1);let{basename:e,navigator:r}=a.useContext(E),{matches:n}=a.useContext(b),{pathname:o}=R(),i=JSON.stringify(t.UNSAFE_getPathContributingMatches(n).map((e=>e.pathnameBase))),u=a.useRef(!1);return a.useEffect((()=>{u.current=!0})),a.useCallback((function(n,a){if(void 0===a&&(a={}),!u.current)return;if("number"==typeof n)return void r.go(n);let l=t.resolveTo(n,JSON.parse(i),o,"path"===a.relative);"/"!==e&&(l.pathname="/"===l.pathname?e:t.joinPaths([e,l.pathname])),(a.replace?r.replace:r.push)(l,a.state,a)}),[e,r,i,o])}const O=a.createContext(null);function j(e){let t=a.useContext(b).outlet;return t?a.createElement(O.Provider,{value:e},t):t}function S(e,r){let{relative:n}=void 0===r?{}:r,{matches:o}=a.useContext(b),{pathname:i}=R(),u=JSON.stringify(t.UNSAFE_getPathContributingMatches(o).map((e=>e.pathnameBase)));return a.useMemo((()=>t.resolveTo(e,JSON.parse(u),i,"path"===n)),[e,u,i,n])}function D(e,r){P()||t.invariant(!1);let{navigator:n}=a.useContext(E),i=a.useContext(v),{matches:u}=a.useContext(b),l=u[u.length-1],s=l?l.params:{};!l||l.pathname;let c=l?l.pathnameBase:"/";l&&l.route;let d,p=R();if(r){var h;let e="string"==typeof r?t.parsePath(r):r;"/"===c||(null==(h=e.pathname)?void 0:h.startsWith(c))||t.invariant(!1),d=e}else d=p;let m=d.pathname||"/",f="/"===c?m:m.slice(c.length)||"/",g=t.matchRoutes(e,{pathname:f}),x=N(g&&g.map((e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:t.joinPaths([c,n.encodeLocation?n.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?c:t.joinPaths([c,n.encodeLocation?n.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),u,i||void 0);return r&&x?a.createElement(y.Provider,{value:{location:o({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:t.Action.Pop}},x):x}function U(){let e=k(),r=t.isRouteErrorResponse(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:o},u={padding:"2px 4px",backgroundColor:o};return a.createElement(a.Fragment,null,a.createElement("h2",null,"Unhandled Thrown Error!"),a.createElement("h3",{style:{fontStyle:
//# sourceMappingURL=react-router.production.min.js.map