'use strict';(function(h,g){"object"===typeof exports&&"undefined"!==typeof module?g(exports,require("react"),require("history")):"function"===typeof define&&define.amd?define(["exports","react","history"],g):(h=h||self,g(h.ReactRouter={},h.React,h.HistoryLibrary))})(this,function(h,g,C){function z(){z=Object.assign||function(a){for(var b=1;b may be used only in the context of a component."); E(!g.useContext(p).static," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");var d=W();g.useEffect(function(){d(b,{replace:c,state:e})});return null}function A(){return X()}function P(a){a=a.element;return void 0===a?g.createElement(A,null):a}function F(a){var b=a.children;b=void 0===b?null:b;var c=a.action;c=void 0===c?C.Action.Pop: c;var e=a.location,d=a.navigator;a=a.static;a=void 0===a?!1:a;n()?k(!1,"You cannot render a inside another . You never need more than one."):void 0;return g.createElement(p.Provider,{children:b,value:{action:c,location:e,navigator:d,static:a}})}function Q(a){var b=a.basename;b=void 0===b?"":b;a=G(a.children);return Y(a,b)}function n(){return null!=g.useContext(p).location}function R(){n()?void 0:k(!1,"useLocation() may be used only in the context of a component.");return g.useContext(p).location} function W(){n()?void 0:k(!1,"useNavigate() may be used only in the context of a component.");var a=g.useContext(p).navigator,b=g.useContext(t).pathname,c=g.useRef(!1);g.useEffect(function(){c.current=!0});return g.useCallback(function(e,d){void 0===d&&(d={});c.current?"number"===typeof e?a.go(e):(e=S(e,b),(d.replace?a.replace:a.push)(e,d.state)):E(!1,"You should call navigate() in a useEffect, not when your component is first rendered.")},[a,b])}function X(){return g.useContext(t).outlet} function Z(a){var b=g.useContext(t).pathname;return g.useMemo(function(){return S(a,b)},[a,b])}function Y(a,b){void 0===b&&(b="");var c=g.useContext(t),e=c.route,d=c.pathname,l=c.params;c=e&&e.path;ha(d,!e||e.path.endsWith("*"),'You rendered descendant (or called `useRoutes`) at "'+d+'" (under ) 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.\n\nPlease change the parent to .'));b=b?B([d,b]):d;var f=R();return(e=g.useMemo(function(){return aa(a,f,b)},[f,a,b]))?e.reduceRight(function(a,c){var e=c.pathname,d=c.route;return g.createElement(t.Provider,{children:d.element,value:{outlet:a,params:Object.freeze(z({},l,{},c.params)),pathname:B([b,e]),route:d}})},null):null}function T(a){return a.map(function(a){var b={path:a.path||"/",caseSensitive:!0===a.caseSensitive,element:a.element||g.createElement(A,null)};a.children&&(b.children=T(a.children)); return b})}function G(a){var b=[];g.Children.forEach(a,function(a){if(g.isValidElement(a))if(a.type===g.Fragment)b.push.apply(b,G(a.props.children));else{var c={path:a.props.path||"/",caseSensitive:!0===a.props.caseSensitive,element:a};a.props.children&&(a=G(a.props.children),a.length&&(c.children=a));b.push(c)}});return b}function aa(a,b,c){void 0===c&&(c="");"string"===typeof b&&(b=C.parsePath(b));b=b.pathname||"/";if(c)if(c=c.replace(/^\/*/,"/").replace(/\/+$/,""),b.startsWith(c))b=b===c?"/":b.slice(c.length); else return null;a=ba(a);ia(a);var e=null;for(c=0;null==e&&ca;a++)b["_"+String.fromCharCode(a)]=a;if("0123456789"!==Object.getOwnPropertyNames(b).map(function(a){return b[a]}).join(""))return!1;var c={};"abcdefghijklmnopqrst".split("").forEach(function(a){c[a]=a});return"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},c)).join("")?!1:!0}catch(e){return!1}}()?Object.assign:function(a,b){if(null===a||void 0===a)throw new TypeError("Object.assign cannot be called with null or undefined");var c= Object(a);for(var e,d=1;d>";h=h||m;if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==u){if(b)throw c=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"), c.name="Invariant Violation",c;"undefined"!==typeof console&&(u=g+":"+m,!w[u]&&3>d&&(y("You are manually calling a React.PropTypes validation function for the `"+h+"` prop on `"+g+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),w[u]=!0,d++))}return null==f[m]?c?null===f[m]?new e("The "+x+" `"+h+"` is marked as required in `"+(g+"`, but its value is `null`.")): new e("The "+x+" `"+h+"` is marked as required in `"+(g+"`, but its value is `undefined`.")):null:a(f,m,g,x,h)}var w={},d=0,f=c.bind(null,!1);f.isRequired=c.bind(null,!0);return f}function f(a){return d(function(b,c,w,d,f,g){b=b[c];return h(b)!==a?(b=k(b),new e("Invalid "+d+" `"+f+"` of type `"+(b+"` supplied to `"+w+"`, expected `")+(a+"`."))):null})}function g(b){switch(typeof b){case "number":case "string":case "undefined":return!0;case "boolean":return!b;case "object":if(Array.isArray(b))return b.every(g); if(null===b||a(b))return!0;var c=b&&(q&&b[q]||b["@@iterator"]);var e="function"===typeof c?c:void 0;if(e)if(c=e.call(b),e!==b.entries)for(;!(b=c.next()).done;){if(!g(b.value))return!1}else for(;!(b=c.next()).done;){if((b=b.value)&&!g(b[1]))return!1}else return!1;return!0;default:return!1}}function h(a){var b=typeof a;return Array.isArray(a)?"array":a instanceof RegExp?"object":"symbol"===b||a&&("Symbol"===a["@@toStringTag"]||"function"===typeof Symbol&&a instanceof Symbol)?"symbol":b}function k(a){if("undefined"=== typeof a||null===a)return""+a;var b=h(a);if("object"===b){if(a instanceof Date)return"date";if(a instanceof RegExp)return"regexp"}return b}function n(a){a=k(a);switch(a){case "array":case "object":return"an "+a;case "boolean":case "date":case "regexp":return"a "+a;default:return a}}var q="function"===typeof Symbol&&Symbol.iterator,p={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:d(D),arrayOf:function(a){return d(function(b, c,d,f,g){if("function"!==typeof a)return new e("Property `"+g+"` of component `"+d+"` has invalid PropType notation inside arrayOf.");b=b[c];if(!Array.isArray(b))return b=h(b),new e("Invalid "+f+" `"+g+"` of type `"+(b+"` supplied to `"+d+"`, expected an array."));for(c=0;c>";b=b[c];b=b.constructor&&b.constructor.name?b.constructor.name:"<>";return new e("Invalid "+ f+" `"+g+"` of type `"+(b+"` supplied to `"+d+"`, expected instance of `")+(h+"`."))}return null})},node:function(){return d(function(a,b,c,d,f){return g(a[b])?null:new e("Invalid "+d+" `"+f+"` supplied to `"+(c+"`, expected a ReactNode."))})}(),objectOf:function(a){return d(function(b,c,d,f,g){if("function"!==typeof a)return new e("Property `"+g+"` of component `"+d+"` has invalid PropType notation inside objectOf.");b=b[c];c=h(b);if("object"!==c)return new e("Invalid "+f+" `"+g+"` of type `"+(c+ "` supplied to `"+d+"`, expected an object."));for(var m in b)if(Ba(b,m)&&(c=a(b,m,d,f,g+"."+m,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"),c instanceof Error))return c;return null})},oneOf:function(a){return Array.isArray(a)?d(function(b,d,f,g,h){b=b[d];for(d=0;d component.");var c=g.useContext(p).navigator;g.useEffect(function(){if(b){var e=c.block(function(b){var c=z({},b,{retry:function(){e();b.retry()}});a(c)});return e}},[c,a,b])}; h.useHref=function(a){n()?void 0:k(!1,"useHref() may be used only in the context of a component.");var b=g.useContext(p).navigator;a=Z(a);return b.createHref(a)};h.useInRouterContext=n;h.useLocation=R;h.useMatch=function(a){n()?void 0:k(!1,"useMatch() may be used only in the context of a component.");var b=R();return U(a,b.pathname)};h.useNavigate=W;h.useOutlet=X;h.useParams=function(){return g.useContext(t).params};h.useResolvedPath=Z;h.useRoutes=function(a,b){void 0===b&&(b=""); n()?void 0:k(!1,"useRoutes() may be used only in the context of a component.");var c=g.useMemo(function(){return T(a)},[a]);return Y(c,b)};Object.defineProperty(h,"__esModule",{value:!0})}); //# sourceMappingURL=react-router.development.js.map