react-router 5.0.0 → 5.0.1
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/cjs/react-router.js +20 -16
- package/cjs/react-router.min.js +1 -1
- package/esm/react-router.js +20 -14
- package/package.json +14 -15
- package/umd/react-router.js +133 -201
- package/umd/react-router.min.js +1 -1
package/cjs/react-router.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
4
|
|
|
7
|
-
var createContext = _interopDefault(require('create-react-context'));
|
|
5
|
+
var createContext = _interopDefault(require('mini-create-react-context'));
|
|
8
6
|
var React = _interopDefault(require('react'));
|
|
9
7
|
var PropTypes = _interopDefault(require('prop-types'));
|
|
10
8
|
var warning = _interopDefault(require('tiny-warning'));
|
|
@@ -57,14 +55,13 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
57
55
|
|
|
58
56
|
var createNamedContext = function createNamedContext(name) {
|
|
59
57
|
var context = createContext();
|
|
60
|
-
context.
|
|
61
|
-
context.Consumer.displayName = name + ".Consumer";
|
|
58
|
+
context.displayName = name;
|
|
62
59
|
return context;
|
|
63
60
|
};
|
|
64
61
|
|
|
65
62
|
var context =
|
|
66
63
|
/*#__PURE__*/
|
|
67
|
-
createNamedContext(
|
|
64
|
+
createNamedContext("Router");
|
|
68
65
|
|
|
69
66
|
/**
|
|
70
67
|
* The public API for putting history on context.
|
|
@@ -335,7 +332,11 @@ function Redirect(_ref) {
|
|
|
335
332
|
method(location);
|
|
336
333
|
},
|
|
337
334
|
onUpdate: function onUpdate(self, prevProps) {
|
|
338
|
-
|
|
335
|
+
var prevLocation = history.createLocation(prevProps.to);
|
|
336
|
+
|
|
337
|
+
if (!history.locationsAreEqual(prevLocation, _extends({}, location, {
|
|
338
|
+
key: prevLocation.key
|
|
339
|
+
}))) {
|
|
339
340
|
method(location);
|
|
340
341
|
}
|
|
341
342
|
},
|
|
@@ -397,6 +398,7 @@ function matchPath(pathname, options) {
|
|
|
397
398
|
sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
|
|
398
399
|
var paths = [].concat(path);
|
|
399
400
|
return paths.reduce(function (matched, path) {
|
|
401
|
+
if (!path) return null;
|
|
400
402
|
if (matched) return matched;
|
|
401
403
|
|
|
402
404
|
var _compilePath = compilePath$1(path, {
|
|
@@ -599,7 +601,8 @@ function (_React$Component) {
|
|
|
599
601
|
var _this$props = this.props,
|
|
600
602
|
_this$props$basename = _this$props.basename,
|
|
601
603
|
basename = _this$props$basename === void 0 ? "" : _this$props$basename,
|
|
602
|
-
context = _this$props.context
|
|
604
|
+
_this$props$context = _this$props.context,
|
|
605
|
+
context = _this$props$context === void 0 ? {} : _this$props$context;
|
|
603
606
|
context.action = action;
|
|
604
607
|
context.location = addBasename(basename, history.createLocation(location));
|
|
605
608
|
context.url = createURL(context.location);
|
|
@@ -712,25 +715,26 @@ function (_React$Component) {
|
|
|
712
715
|
*/
|
|
713
716
|
|
|
714
717
|
function withRouter(Component) {
|
|
718
|
+
var displayName = "withRouter(" + (Component.displayName || Component.name) + ")";
|
|
719
|
+
|
|
715
720
|
var C = function C(props) {
|
|
716
721
|
var wrappedComponentRef = props.wrappedComponentRef,
|
|
717
722
|
remainingProps = _objectWithoutPropertiesLoose(props, ["wrappedComponentRef"]);
|
|
718
723
|
|
|
719
|
-
return React.createElement(
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
}
|
|
724
|
+
return React.createElement(context.Consumer, null, function (context$$1) {
|
|
725
|
+
!context$$1 ? invariant(false, "You should not use <" + displayName + " /> outside a <Router>") : void 0;
|
|
726
|
+
return React.createElement(Component, _extends({}, remainingProps, context$$1, {
|
|
727
|
+
ref: wrappedComponentRef
|
|
728
|
+
}));
|
|
725
729
|
});
|
|
726
730
|
};
|
|
727
731
|
|
|
728
|
-
C.displayName =
|
|
732
|
+
C.displayName = displayName;
|
|
729
733
|
C.WrappedComponent = Component;
|
|
730
734
|
|
|
731
735
|
{
|
|
732
736
|
C.propTypes = {
|
|
733
|
-
wrappedComponentRef: PropTypes.func
|
|
737
|
+
wrappedComponentRef: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.object])
|
|
734
738
|
};
|
|
735
739
|
}
|
|
736
740
|
|
package/cjs/react-router.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var createContext=_interopDefault(require("create-react-context")),React=_interopDefault(require("react"));require("prop-types"),require("tiny-warning");var history=require("history"),invariant=_interopDefault(require("tiny-invariant")),pathToRegexp=_interopDefault(require("path-to-regexp"));require("react-is");var hoistStatics=_interopDefault(require("hoist-non-react-statics"));function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function _inheritsLoose(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function _objectWithoutPropertiesLoose(t,e){if(null==t)return{};var n,o,r={},a=Object.keys(t);for(o=0;o<a.length;o++)n=a[o],0<=e.indexOf(n)||(r[n]=t[n]);return r}var createNamedContext=function(t){var e=createContext();return e.
|
|
1
|
+
"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var createContext=_interopDefault(require("mini-create-react-context")),React=_interopDefault(require("react"));require("prop-types"),require("tiny-warning");var history=require("history"),invariant=_interopDefault(require("tiny-invariant")),pathToRegexp=_interopDefault(require("path-to-regexp"));require("react-is");var hoistStatics=_interopDefault(require("hoist-non-react-statics"));function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function _inheritsLoose(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function _objectWithoutPropertiesLoose(t,e){if(null==t)return{};var n,o,r={},a=Object.keys(t);for(o=0;o<a.length;o++)n=a[o],0<=e.indexOf(n)||(r[n]=t[n]);return r}var createNamedContext=function(t){var e=createContext();return e.displayName=t,e},context=createNamedContext("Router"),Router=function(n){function t(t){var e;return(e=n.call(this,t)||this).state={location:t.history.location},e._isMounted=!1,e._pendingLocation=null,t.staticContext||(e.unlisten=t.history.listen(function(t){e._isMounted?e.setState({location:t}):e._pendingLocation=t})),e}_inheritsLoose(t,n),t.computeRootMatch=function(t){return{path:"/",url:"/",params:{},isExact:"/"===t}};var e=t.prototype;return e.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},e.componentWillUnmount=function(){this.unlisten&&this.unlisten()},e.render=function(){return React.createElement(context.Provider,{children:this.props.children||null,value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}})},t}(React.Component),MemoryRouter=function(r){function t(){for(var t,e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return(t=r.call.apply(r,[this].concat(n))||this).history=history.createMemoryHistory(t.props),t}return _inheritsLoose(t,r),t.prototype.render=function(){return React.createElement(Router,{history:this.history,children:this.props.children})},t}(React.Component),Lifecycle=function(t){function e(){return t.apply(this,arguments)||this}_inheritsLoose(e,t);var n=e.prototype;return n.componentDidMount=function(){this.props.onMount&&this.props.onMount.call(this,this)},n.componentDidUpdate=function(t){this.props.onUpdate&&this.props.onUpdate.call(this,this,t)},n.componentWillUnmount=function(){this.props.onUnmount&&this.props.onUnmount.call(this,this)},n.render=function(){return null},e}(React.Component);function Prompt(t){var o=t.message,e=t.when,r=void 0===e||e;return React.createElement(context.Consumer,null,function(t){if(t||invariant(!1),!r||t.staticContext)return null;var n=t.history.block;return React.createElement(Lifecycle,{onMount:function(t){t.release=n(o)},onUpdate:function(t,e){e.message!==o&&(t.release(),t.release=n(o))},onUnmount:function(t){t.release()},message:o})})}var cache={},cacheLimit=1e4,cacheCount=0;function compilePath(t){if(cache[t])return cache[t];var e=pathToRegexp.compile(t);return cacheCount<cacheLimit&&(cache[t]=e,cacheCount++),e}function generatePath(t,e){return void 0===t&&(t="/"),void 0===e&&(e={}),"/"===t?t:compilePath(t)(e,{pretty:!0})}function Redirect(t){var a=t.computedMatch,i=t.to,e=t.push,c=void 0!==e&&e;return React.createElement(context.Consumer,null,function(t){t||invariant(!1);var e=t.history,n=t.staticContext,o=c?e.push:e.replace,r=history.createLocation(a?"string"==typeof i?generatePath(i,a.params):_extends({},i,{pathname:generatePath(i.pathname,a.params)}):i);return n?(o(r),null):React.createElement(Lifecycle,{onMount:function(){o(r)},onUpdate:function(t,e){var n=history.createLocation(e.to);history.locationsAreEqual(n,_extends({},r,{key:n.key}))||o(r)},to:i})})}var cache$1={},cacheLimit$1=1e4,cacheCount$1=0;function compilePath$1(t,e){var n=""+e.end+e.strict+e.sensitive,o=cache$1[n]||(cache$1[n]={});if(o[t])return o[t];var r=[],a={regexp:pathToRegexp(t,r,e),keys:r};return cacheCount$1<cacheLimit$1&&(o[t]=a,cacheCount$1++),a}function matchPath(s,t){void 0===t&&(t={}),"string"==typeof t&&(t={path:t});var e=t,n=e.path,o=e.exact,p=void 0!==o&&o,r=e.strict,h=void 0!==r&&r,a=e.sensitive,l=void 0!==a&&a;return[].concat(n).reduce(function(t,e){if(!e)return null;if(t)return t;var n=compilePath$1(e,{end:p,strict:h,sensitive:l}),o=n.regexp,r=n.keys,a=o.exec(s);if(!a)return null;var i=a[0],c=a.slice(1),u=s===i;return p&&!u?null:{path:e,url:"/"===e&&""===i?"/":i,isExact:u,params:r.reduce(function(t,e,n){return t[e.name]=c[n],t},{})}},null)}function isEmptyChildren(t){return 0===React.Children.count(t)}var Route=function(t){function e(){return t.apply(this,arguments)||this}return _inheritsLoose(e,t),e.prototype.render=function(){var c=this;return React.createElement(context.Consumer,null,function(t){t||invariant(!1);var e=c.props.location||t.location,n=_extends({},t,{location:e,match:c.props.computedMatch?c.props.computedMatch:c.props.path?matchPath(e.pathname,c.props):t.match}),o=c.props,r=o.children,a=o.component,i=o.render;return Array.isArray(r)&&0===r.length&&(r=null),"function"==typeof r&&void 0===(r=r(n))&&(r=null),React.createElement(context.Provider,{value:n},r&&!isEmptyChildren(r)?r:n.match?a?React.createElement(a,n):i?i(n):null:null)})},e}(React.Component);function addLeadingSlash(t){return"/"===t.charAt(0)?t:"/"+t}function addBasename(t,e){return t?_extends({},e,{pathname:addLeadingSlash(t)+e.pathname}):e}function stripBasename(t,e){if(!t)return e;var n=addLeadingSlash(t);return 0!==e.pathname.indexOf(n)?e:_extends({},e,{pathname:e.pathname.substr(n.length)})}function createURL(t){return"string"==typeof t?t:history.createPath(t)}function staticHandler(t){return function(){invariant(!1)}}function noop(){}var StaticRouter=function(r){function t(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return(e=r.call.apply(r,[this].concat(n))||this).handlePush=function(t){return e.navigateTo(t,"PUSH")},e.handleReplace=function(t){return e.navigateTo(t,"REPLACE")},e.handleListen=function(){return noop},e.handleBlock=function(){return noop},e}_inheritsLoose(t,r);var e=t.prototype;return e.navigateTo=function(t,e){var n=this.props,o=n.basename,r=void 0===o?"":o,a=n.context,i=void 0===a?{}:a;i.action=e,i.location=addBasename(r,history.createLocation(t)),i.url=createURL(i.location)},e.render=function(){var t=this.props,e=t.basename,n=void 0===e?"":e,o=t.context,r=void 0===o?{}:o,a=t.location,i=void 0===a?"/":a,c=_objectWithoutPropertiesLoose(t,["basename","context","location"]),u={createHref:function(t){return addLeadingSlash(n+createURL(t))},action:"POP",location:stripBasename(n,history.createLocation(i)),push:this.handlePush,replace:this.handleReplace,go:staticHandler("go"),goBack:staticHandler("goBack"),goForward:staticHandler("goForward"),listen:this.handleListen,block:this.handleBlock};return React.createElement(Router,_extends({},c,{history:u,staticContext:r}))},t}(React.Component),Switch=function(t){function e(){return t.apply(this,arguments)||this}return _inheritsLoose(e,t),e.prototype.render=function(){var t=this;return React.createElement(context.Consumer,null,function(n){n||invariant(!1);var o,r,a=t.props.location||n.location;return React.Children.forEach(t.props.children,function(t){if(null==r&&React.isValidElement(t)){var e=(o=t).props.path||t.props.from;r=e?matchPath(a.pathname,_extends({},t.props,{path:e})):n.match}}),r?React.cloneElement(o,{location:a,computedMatch:r}):null})},e}(React.Component);function withRouter(o){var t="withRouter("+(o.displayName||o.name)+")",e=function(t){var e=t.wrappedComponentRef,n=_objectWithoutPropertiesLoose(t,["wrappedComponentRef"]);return React.createElement(context.Consumer,null,function(t){return t||invariant(!1),React.createElement(o,_extends({},n,t,{ref:e}))})};return e.displayName=t,e.WrappedComponent=o,hoistStatics(e,o)}exports.MemoryRouter=MemoryRouter,exports.Prompt=Prompt,exports.Redirect=Redirect,exports.Route=Route,exports.Router=Router,exports.StaticRouter=StaticRouter,exports.Switch=Switch,exports.generatePath=generatePath,exports.matchPath=matchPath,exports.withRouter=withRouter,exports.__RouterContext=context;
|
package/esm/react-router.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import createContext from 'create-react-context';
|
|
1
|
+
import createContext from 'mini-create-react-context';
|
|
2
2
|
import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -15,14 +15,13 @@ import hoistStatics from 'hoist-non-react-statics';
|
|
|
15
15
|
|
|
16
16
|
var createNamedContext = function createNamedContext(name) {
|
|
17
17
|
var context = createContext();
|
|
18
|
-
context.
|
|
19
|
-
context.Consumer.displayName = name + ".Consumer";
|
|
18
|
+
context.displayName = name;
|
|
20
19
|
return context;
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
var context =
|
|
24
23
|
/*#__PURE__*/
|
|
25
|
-
createNamedContext(
|
|
24
|
+
createNamedContext("Router");
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* The public API for putting history on context.
|
|
@@ -293,7 +292,11 @@ function Redirect(_ref) {
|
|
|
293
292
|
method(location);
|
|
294
293
|
},
|
|
295
294
|
onUpdate: function onUpdate(self, prevProps) {
|
|
296
|
-
|
|
295
|
+
var prevLocation = createLocation(prevProps.to);
|
|
296
|
+
|
|
297
|
+
if (!locationsAreEqual(prevLocation, _extends({}, location, {
|
|
298
|
+
key: prevLocation.key
|
|
299
|
+
}))) {
|
|
297
300
|
method(location);
|
|
298
301
|
}
|
|
299
302
|
},
|
|
@@ -355,6 +358,7 @@ function matchPath(pathname, options) {
|
|
|
355
358
|
sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
|
|
356
359
|
var paths = [].concat(path);
|
|
357
360
|
return paths.reduce(function (matched, path) {
|
|
361
|
+
if (!path) return null;
|
|
358
362
|
if (matched) return matched;
|
|
359
363
|
|
|
360
364
|
var _compilePath = compilePath$1(path, {
|
|
@@ -557,7 +561,8 @@ function (_React$Component) {
|
|
|
557
561
|
var _this$props = this.props,
|
|
558
562
|
_this$props$basename = _this$props.basename,
|
|
559
563
|
basename = _this$props$basename === void 0 ? "" : _this$props$basename,
|
|
560
|
-
context = _this$props.context
|
|
564
|
+
_this$props$context = _this$props.context,
|
|
565
|
+
context = _this$props$context === void 0 ? {} : _this$props$context;
|
|
561
566
|
context.action = action;
|
|
562
567
|
context.location = addBasename(basename, createLocation(location));
|
|
563
568
|
context.url = createURL(context.location);
|
|
@@ -670,25 +675,26 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
670
675
|
*/
|
|
671
676
|
|
|
672
677
|
function withRouter(Component) {
|
|
678
|
+
var displayName = "withRouter(" + (Component.displayName || Component.name) + ")";
|
|
679
|
+
|
|
673
680
|
var C = function C(props) {
|
|
674
681
|
var wrappedComponentRef = props.wrappedComponentRef,
|
|
675
682
|
remainingProps = _objectWithoutPropertiesLoose(props, ["wrappedComponentRef"]);
|
|
676
683
|
|
|
677
|
-
return React.createElement(
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}
|
|
684
|
+
return React.createElement(context.Consumer, null, function (context$$1) {
|
|
685
|
+
!context$$1 ? process.env.NODE_ENV !== "production" ? invariant(false, "You should not use <" + displayName + " /> outside a <Router>") : invariant(false) : void 0;
|
|
686
|
+
return React.createElement(Component, _extends({}, remainingProps, context$$1, {
|
|
687
|
+
ref: wrappedComponentRef
|
|
688
|
+
}));
|
|
683
689
|
});
|
|
684
690
|
};
|
|
685
691
|
|
|
686
|
-
C.displayName =
|
|
692
|
+
C.displayName = displayName;
|
|
687
693
|
C.WrappedComponent = Component;
|
|
688
694
|
|
|
689
695
|
if (process.env.NODE_ENV !== "production") {
|
|
690
696
|
C.propTypes = {
|
|
691
|
-
wrappedComponentRef: PropTypes.func
|
|
697
|
+
wrappedComponentRef: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.object])
|
|
692
698
|
};
|
|
693
699
|
}
|
|
694
700
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-router",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Declarative routing for React",
|
|
5
5
|
"repository": "ReactTraining/react-router",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/runtime": "^7.1.2",
|
|
43
|
-
"create-react-context": "^0.2.2",
|
|
44
43
|
"history": "^4.9.0",
|
|
45
44
|
"hoist-non-react-statics": "^3.1.0",
|
|
46
45
|
"loose-envify": "^1.3.1",
|
|
46
|
+
"mini-create-react-context": "^0.3.0",
|
|
47
47
|
"path-to-regexp": "^1.7.0",
|
|
48
48
|
"prop-types": "^15.6.2",
|
|
49
49
|
"react-is": "^16.6.0",
|
|
@@ -56,25 +56,24 @@
|
|
|
56
56
|
"@babel/plugin-transform-runtime": "^7.1.0",
|
|
57
57
|
"@babel/preset-env": "^7.1.0",
|
|
58
58
|
"@babel/preset-react": "^7.0.0",
|
|
59
|
-
"babel-core": "^7.0.0-bridge.0",
|
|
60
59
|
"babel-eslint": "^10.0.1",
|
|
61
|
-
"babel-jest": "^
|
|
60
|
+
"babel-jest": "^24.8.0",
|
|
62
61
|
"babel-plugin-dev-expression": "^0.2.1",
|
|
63
|
-
"eslint": "^5.
|
|
64
|
-
"eslint-plugin-import": "^2.
|
|
62
|
+
"eslint": "^5.16.0",
|
|
63
|
+
"eslint-plugin-import": "^2.17.0",
|
|
65
64
|
"eslint-plugin-react": "^7.9.1",
|
|
66
|
-
"jest": "^
|
|
67
|
-
"jest-circus": "^
|
|
68
|
-
"raf": "^3.4.
|
|
65
|
+
"jest": "^24.8.0",
|
|
66
|
+
"jest-circus": "^24.8.0",
|
|
67
|
+
"raf": "^3.4.1",
|
|
69
68
|
"react": "^16.5.2",
|
|
70
69
|
"react-dom": "^16.5.2",
|
|
71
70
|
"rollup": "^0.66.6",
|
|
72
|
-
"rollup-plugin-babel": "^4.
|
|
73
|
-
"rollup-plugin-commonjs": "^9.
|
|
71
|
+
"rollup-plugin-babel": "^4.3.2",
|
|
72
|
+
"rollup-plugin-commonjs": "^9.3.4",
|
|
74
73
|
"rollup-plugin-node-resolve": "^3.4.0",
|
|
75
|
-
"rollup-plugin-replace": "^2.
|
|
76
|
-
"rollup-plugin-size-snapshot": "
|
|
77
|
-
"rollup-plugin-uglify": "^6.0.
|
|
74
|
+
"rollup-plugin-replace": "^2.2.0",
|
|
75
|
+
"rollup-plugin-size-snapshot": "0.7.0",
|
|
76
|
+
"rollup-plugin-uglify": "^6.0.2"
|
|
78
77
|
},
|
|
79
78
|
"browserify": {
|
|
80
79
|
"transform": [
|
|
@@ -89,5 +88,5 @@
|
|
|
89
88
|
"history",
|
|
90
89
|
"link"
|
|
91
90
|
],
|
|
92
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "0c9a10d9807b879912f2dff2fbebffe0aa7048ed"
|
|
93
92
|
}
|
package/umd/react-router.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(factory((global.ReactRouter = {}),global.React));
|
|
5
5
|
}(this, (function (exports,React) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var React__default = 'default' in React ? React['default'] : React;
|
|
8
8
|
|
|
9
9
|
function _inheritsLoose(subClass, superClass) {
|
|
10
10
|
subClass.prototype = Object.create(superClass.prototype);
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
subClass.__proto__ = superClass;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
15
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
16
16
|
|
|
17
17
|
function unwrapExports (x) {
|
|
18
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x
|
|
18
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function createCommonjsModule(fn, module) {
|
|
@@ -1233,124 +1233,56 @@
|
|
|
1233
1233
|
return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1;
|
|
1234
1234
|
};
|
|
1235
1235
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
* LICENSE file in the root directory of this source tree.
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
*/
|
|
1244
|
-
|
|
1245
|
-
function makeEmptyFunction(arg) {
|
|
1246
|
-
return function () {
|
|
1247
|
-
return arg;
|
|
1248
|
-
};
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
/**
|
|
1252
|
-
* This function accepts and discards inputs; it has no side effects. This is
|
|
1253
|
-
* primarily useful idiomatically for overridable function endpoints which
|
|
1254
|
-
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
|
1255
|
-
*/
|
|
1256
|
-
var emptyFunction$1 = function emptyFunction() {};
|
|
1257
|
-
|
|
1258
|
-
emptyFunction$1.thatReturns = makeEmptyFunction;
|
|
1259
|
-
emptyFunction$1.thatReturnsFalse = makeEmptyFunction(false);
|
|
1260
|
-
emptyFunction$1.thatReturnsTrue = makeEmptyFunction(true);
|
|
1261
|
-
emptyFunction$1.thatReturnsNull = makeEmptyFunction(null);
|
|
1262
|
-
emptyFunction$1.thatReturnsThis = function () {
|
|
1263
|
-
return this;
|
|
1264
|
-
};
|
|
1265
|
-
emptyFunction$1.thatReturnsArgument = function (arg) {
|
|
1266
|
-
return arg;
|
|
1267
|
-
};
|
|
1268
|
-
|
|
1269
|
-
var emptyFunction_1 = emptyFunction$1;
|
|
1270
|
-
|
|
1271
|
-
/**
|
|
1272
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
1273
|
-
* This can be used to log issues in development environments in critical
|
|
1274
|
-
* paths. Removing the logging code for production environments will keep the
|
|
1275
|
-
* same logic and follow the same code paths.
|
|
1276
|
-
*/
|
|
1277
|
-
|
|
1278
|
-
var warning$1 = emptyFunction_1;
|
|
1279
|
-
|
|
1280
|
-
{
|
|
1281
|
-
var printWarning$2 = function printWarning(format) {
|
|
1282
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1283
|
-
args[_key - 1] = arguments[_key];
|
|
1236
|
+
function warning$1(condition, message) {
|
|
1237
|
+
{
|
|
1238
|
+
if (condition) {
|
|
1239
|
+
return;
|
|
1284
1240
|
}
|
|
1285
1241
|
|
|
1286
|
-
var
|
|
1287
|
-
|
|
1288
|
-
return args[argIndex++];
|
|
1289
|
-
});
|
|
1242
|
+
var text = "Warning: " + message;
|
|
1243
|
+
|
|
1290
1244
|
if (typeof console !== 'undefined') {
|
|
1291
|
-
console.
|
|
1245
|
+
console.warn(text);
|
|
1292
1246
|
}
|
|
1247
|
+
|
|
1293
1248
|
try {
|
|
1294
|
-
|
|
1295
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
1296
|
-
// to find the callsite that caused this warning to fire.
|
|
1297
|
-
throw new Error(message);
|
|
1249
|
+
throw Error(text);
|
|
1298
1250
|
} catch (x) {}
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
warning$1 = function warning(condition, format) {
|
|
1302
|
-
if (format === undefined) {
|
|
1303
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
|
1307
|
-
return; // Ignore CompositeComponent proptype check.
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
if (!condition) {
|
|
1311
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
1312
|
-
args[_key2 - 2] = arguments[_key2];
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
printWarning$2.apply(undefined, [format].concat(args));
|
|
1316
|
-
}
|
|
1317
|
-
};
|
|
1251
|
+
}
|
|
1318
1252
|
}
|
|
1319
1253
|
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
var _propTypes2 = _interopRequireDefault(propTypes);
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
var _gud2 = _interopRequireDefault(gud);
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
var _warning2 = _interopRequireDefault(warning_1);
|
|
1341
|
-
|
|
1342
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1254
|
+
function _defineProperty(obj, key, value) {
|
|
1255
|
+
if (key in obj) {
|
|
1256
|
+
Object.defineProperty(obj, key, {
|
|
1257
|
+
value: value,
|
|
1258
|
+
enumerable: true,
|
|
1259
|
+
configurable: true,
|
|
1260
|
+
writable: true
|
|
1261
|
+
});
|
|
1262
|
+
} else {
|
|
1263
|
+
obj[key] = value;
|
|
1264
|
+
}
|
|
1343
1265
|
|
|
1344
|
-
|
|
1266
|
+
return obj;
|
|
1267
|
+
}
|
|
1345
1268
|
|
|
1346
|
-
function
|
|
1269
|
+
function _inheritsLoose$1(subClass, superClass) {
|
|
1270
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
1271
|
+
subClass.prototype.constructor = subClass;
|
|
1272
|
+
subClass.__proto__ = superClass;
|
|
1273
|
+
}
|
|
1347
1274
|
|
|
1348
|
-
function
|
|
1275
|
+
function _assertThisInitialized(self) {
|
|
1276
|
+
if (self === void 0) {
|
|
1277
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1278
|
+
}
|
|
1349
1279
|
|
|
1350
|
-
|
|
1280
|
+
return self;
|
|
1281
|
+
}
|
|
1351
1282
|
|
|
1352
|
-
// Inlined Object.is polyfill.
|
|
1283
|
+
var MAX_SIGNED_31_BIT_INT = 1073741823; // Inlined Object.is polyfill.
|
|
1353
1284
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
1285
|
+
|
|
1354
1286
|
function objectIs(x, y) {
|
|
1355
1287
|
if (x === y) {
|
|
1356
1288
|
return x !== 0 || 1 / x === 1 / y;
|
|
@@ -1387,43 +1319,50 @@
|
|
|
1387
1319
|
}
|
|
1388
1320
|
|
|
1389
1321
|
function createReactContext(defaultValue, calculateChangedBits) {
|
|
1390
|
-
var
|
|
1322
|
+
var _defineProperty2, _defineProperty3;
|
|
1391
1323
|
|
|
1392
|
-
var contextProp = '__create-react-context-' + (
|
|
1324
|
+
var contextProp = '__create-react-context-' + gud() + '__';
|
|
1393
1325
|
|
|
1394
|
-
var Provider =
|
|
1395
|
-
|
|
1326
|
+
var Provider =
|
|
1327
|
+
/*#__PURE__*/
|
|
1328
|
+
function (_Component) {
|
|
1329
|
+
_inheritsLoose$1(Provider, _Component);
|
|
1396
1330
|
|
|
1397
1331
|
function Provider() {
|
|
1398
|
-
var
|
|
1399
|
-
|
|
1400
|
-
_classCallCheck(this, Provider);
|
|
1332
|
+
var _this;
|
|
1401
1333
|
|
|
1402
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
1334
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1403
1335
|
args[_key] = arguments[_key];
|
|
1404
1336
|
}
|
|
1405
1337
|
|
|
1406
|
-
|
|
1338
|
+
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
1339
|
+
|
|
1340
|
+
_defineProperty(_assertThisInitialized(_this), "emitter", createEventEmitter(_this.props.value));
|
|
1341
|
+
|
|
1342
|
+
return _this;
|
|
1407
1343
|
}
|
|
1408
1344
|
|
|
1409
|
-
Provider.prototype
|
|
1345
|
+
var _proto = Provider.prototype;
|
|
1346
|
+
|
|
1347
|
+
_proto.getChildContext = function getChildContext() {
|
|
1410
1348
|
var _ref;
|
|
1411
1349
|
|
|
1412
1350
|
return _ref = {}, _ref[contextProp] = this.emitter, _ref;
|
|
1413
1351
|
};
|
|
1414
1352
|
|
|
1415
|
-
|
|
1353
|
+
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1416
1354
|
if (this.props.value !== nextProps.value) {
|
|
1417
1355
|
var oldValue = this.props.value;
|
|
1418
1356
|
var newValue = nextProps.value;
|
|
1419
|
-
var changedBits
|
|
1357
|
+
var changedBits;
|
|
1420
1358
|
|
|
1421
1359
|
if (objectIs(oldValue, newValue)) {
|
|
1422
1360
|
changedBits = 0; // No change
|
|
1423
1361
|
} else {
|
|
1424
1362
|
changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
|
|
1363
|
+
|
|
1425
1364
|
{
|
|
1426
|
-
(
|
|
1365
|
+
warning$1((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: ' + changedBits);
|
|
1427
1366
|
}
|
|
1428
1367
|
|
|
1429
1368
|
changedBits |= 0;
|
|
@@ -1435,61 +1374,73 @@
|
|
|
1435
1374
|
}
|
|
1436
1375
|
};
|
|
1437
1376
|
|
|
1438
|
-
|
|
1377
|
+
_proto.render = function render() {
|
|
1439
1378
|
return this.props.children;
|
|
1440
1379
|
};
|
|
1441
1380
|
|
|
1442
1381
|
return Provider;
|
|
1443
1382
|
}(React.Component);
|
|
1444
1383
|
|
|
1445
|
-
Provider
|
|
1384
|
+
_defineProperty(Provider, "childContextTypes", (_defineProperty2 = {}, _defineProperty2[contextProp] = propTypes.object.isRequired, _defineProperty2));
|
|
1446
1385
|
|
|
1447
|
-
var Consumer =
|
|
1448
|
-
|
|
1386
|
+
var Consumer =
|
|
1387
|
+
/*#__PURE__*/
|
|
1388
|
+
function (_Component2) {
|
|
1389
|
+
_inheritsLoose$1(Consumer, _Component2);
|
|
1449
1390
|
|
|
1450
1391
|
function Consumer() {
|
|
1451
|
-
var
|
|
1452
|
-
|
|
1453
|
-
_classCallCheck(this, Consumer);
|
|
1392
|
+
var _this2;
|
|
1454
1393
|
|
|
1455
|
-
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1394
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1456
1395
|
args[_key2] = arguments[_key2];
|
|
1457
1396
|
}
|
|
1458
1397
|
|
|
1459
|
-
|
|
1398
|
+
_this2 = _Component2.call.apply(_Component2, [this].concat(args)) || this;
|
|
1399
|
+
|
|
1400
|
+
_defineProperty(_assertThisInitialized(_this2), "observedBits", void 0);
|
|
1401
|
+
|
|
1402
|
+
_defineProperty(_assertThisInitialized(_this2), "state", {
|
|
1460
1403
|
value: _this2.getValue()
|
|
1461
|
-
}
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
_defineProperty(_assertThisInitialized(_this2), "onUpdate", function (newValue, changedBits) {
|
|
1462
1407
|
var observedBits = _this2.observedBits | 0;
|
|
1408
|
+
|
|
1463
1409
|
if ((observedBits & changedBits) !== 0) {
|
|
1464
|
-
_this2.setState({
|
|
1410
|
+
_this2.setState({
|
|
1411
|
+
value: _this2.getValue()
|
|
1412
|
+
});
|
|
1465
1413
|
}
|
|
1466
|
-
}
|
|
1414
|
+
});
|
|
1415
|
+
|
|
1416
|
+
return _this2;
|
|
1467
1417
|
}
|
|
1468
1418
|
|
|
1469
|
-
Consumer.prototype
|
|
1470
|
-
var observedBits = nextProps.observedBits;
|
|
1419
|
+
var _proto2 = Consumer.prototype;
|
|
1471
1420
|
|
|
1421
|
+
_proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1422
|
+
var observedBits = nextProps.observedBits;
|
|
1472
1423
|
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT // Subscribe to all changes by default
|
|
1473
1424
|
: observedBits;
|
|
1474
1425
|
};
|
|
1475
1426
|
|
|
1476
|
-
|
|
1427
|
+
_proto2.componentDidMount = function componentDidMount() {
|
|
1477
1428
|
if (this.context[contextProp]) {
|
|
1478
1429
|
this.context[contextProp].on(this.onUpdate);
|
|
1479
1430
|
}
|
|
1480
|
-
var observedBits = this.props.observedBits;
|
|
1481
1431
|
|
|
1432
|
+
var observedBits = this.props.observedBits;
|
|
1482
1433
|
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT // Subscribe to all changes by default
|
|
1483
1434
|
: observedBits;
|
|
1484
1435
|
};
|
|
1485
1436
|
|
|
1486
|
-
|
|
1437
|
+
_proto2.componentWillUnmount = function componentWillUnmount() {
|
|
1487
1438
|
if (this.context[contextProp]) {
|
|
1488
1439
|
this.context[contextProp].off(this.onUpdate);
|
|
1489
1440
|
}
|
|
1490
1441
|
};
|
|
1491
1442
|
|
|
1492
|
-
|
|
1443
|
+
_proto2.getValue = function getValue() {
|
|
1493
1444
|
if (this.context[contextProp]) {
|
|
1494
1445
|
return this.context[contextProp].get();
|
|
1495
1446
|
} else {
|
|
@@ -1497,15 +1448,14 @@
|
|
|
1497
1448
|
}
|
|
1498
1449
|
};
|
|
1499
1450
|
|
|
1500
|
-
|
|
1451
|
+
_proto2.render = function render() {
|
|
1501
1452
|
return onlyChild(this.props.children)(this.state.value);
|
|
1502
1453
|
};
|
|
1503
1454
|
|
|
1504
1455
|
return Consumer;
|
|
1505
1456
|
}(React.Component);
|
|
1506
1457
|
|
|
1507
|
-
Consumer
|
|
1508
|
-
|
|
1458
|
+
_defineProperty(Consumer, "contextTypes", (_defineProperty3 = {}, _defineProperty3[contextProp] = propTypes.object, _defineProperty3));
|
|
1509
1459
|
|
|
1510
1460
|
return {
|
|
1511
1461
|
Provider: Provider,
|
|
@@ -1513,44 +1463,19 @@
|
|
|
1513
1463
|
};
|
|
1514
1464
|
}
|
|
1515
1465
|
|
|
1516
|
-
|
|
1517
|
-
module.exports = exports['default'];
|
|
1518
|
-
});
|
|
1519
|
-
|
|
1520
|
-
unwrapExports(implementation);
|
|
1521
|
-
|
|
1522
|
-
var lib = createCommonjsModule(function (module, exports) {
|
|
1523
|
-
|
|
1524
|
-
exports.__esModule = true;
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
var _react2 = _interopRequireDefault(React);
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
var _implementation2 = _interopRequireDefault(implementation);
|
|
1533
|
-
|
|
1534
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1535
|
-
|
|
1536
|
-
exports.default = _react2.default.createContext || _implementation2.default;
|
|
1537
|
-
module.exports = exports['default'];
|
|
1538
|
-
});
|
|
1539
|
-
|
|
1540
|
-
var createContext = unwrapExports(lib);
|
|
1466
|
+
var index = React__default.createContext || createReactContext;
|
|
1541
1467
|
|
|
1542
1468
|
// TODO: Replace with React.createContext once we can assume React 16+
|
|
1543
1469
|
|
|
1544
1470
|
var createNamedContext = function createNamedContext(name) {
|
|
1545
|
-
var context =
|
|
1546
|
-
context.
|
|
1547
|
-
context.Consumer.displayName = name + ".Consumer";
|
|
1471
|
+
var context = index();
|
|
1472
|
+
context.displayName = name;
|
|
1548
1473
|
return context;
|
|
1549
1474
|
};
|
|
1550
1475
|
|
|
1551
1476
|
var context =
|
|
1552
1477
|
/*#__PURE__*/
|
|
1553
|
-
createNamedContext(
|
|
1478
|
+
createNamedContext("Router");
|
|
1554
1479
|
|
|
1555
1480
|
/**
|
|
1556
1481
|
* The public API for putting history on context.
|
|
@@ -1617,7 +1542,7 @@
|
|
|
1617
1542
|
};
|
|
1618
1543
|
|
|
1619
1544
|
_proto.render = function render() {
|
|
1620
|
-
return
|
|
1545
|
+
return React__default.createElement(context.Provider, {
|
|
1621
1546
|
children: this.props.children || null,
|
|
1622
1547
|
value: {
|
|
1623
1548
|
history: this.props.history,
|
|
@@ -1629,7 +1554,7 @@
|
|
|
1629
1554
|
};
|
|
1630
1555
|
|
|
1631
1556
|
return Router;
|
|
1632
|
-
}(
|
|
1557
|
+
}(React__default.Component);
|
|
1633
1558
|
|
|
1634
1559
|
{
|
|
1635
1560
|
Router.propTypes = {
|
|
@@ -1667,14 +1592,14 @@
|
|
|
1667
1592
|
var _proto = MemoryRouter.prototype;
|
|
1668
1593
|
|
|
1669
1594
|
_proto.render = function render() {
|
|
1670
|
-
return
|
|
1595
|
+
return React__default.createElement(Router, {
|
|
1671
1596
|
history: this.history,
|
|
1672
1597
|
children: this.props.children
|
|
1673
1598
|
});
|
|
1674
1599
|
};
|
|
1675
1600
|
|
|
1676
1601
|
return MemoryRouter;
|
|
1677
|
-
}(
|
|
1602
|
+
}(React__default.Component);
|
|
1678
1603
|
|
|
1679
1604
|
{
|
|
1680
1605
|
MemoryRouter.propTypes = {
|
|
@@ -1718,7 +1643,7 @@
|
|
|
1718
1643
|
};
|
|
1719
1644
|
|
|
1720
1645
|
return Lifecycle;
|
|
1721
|
-
}(
|
|
1646
|
+
}(React__default.Component);
|
|
1722
1647
|
|
|
1723
1648
|
/**
|
|
1724
1649
|
* The public API for prompting the user before navigating away from a screen.
|
|
@@ -1728,11 +1653,11 @@
|
|
|
1728
1653
|
var message = _ref.message,
|
|
1729
1654
|
_ref$when = _ref.when,
|
|
1730
1655
|
when = _ref$when === void 0 ? true : _ref$when;
|
|
1731
|
-
return
|
|
1656
|
+
return React__default.createElement(context.Consumer, null, function (context$$1) {
|
|
1732
1657
|
!context$$1 ? invariant(false, "You should not use <Prompt> outside a <Router>") : void 0;
|
|
1733
1658
|
if (!when || context$$1.staticContext) return null;
|
|
1734
1659
|
var method = context$$1.history.block;
|
|
1735
|
-
return
|
|
1660
|
+
return React__default.createElement(Lifecycle, {
|
|
1736
1661
|
onMount: function onMount(self) {
|
|
1737
1662
|
self.release = method(message);
|
|
1738
1663
|
},
|
|
@@ -2234,7 +2159,7 @@
|
|
|
2234
2159
|
to = _ref.to,
|
|
2235
2160
|
_ref$push = _ref.push,
|
|
2236
2161
|
push = _ref$push === void 0 ? false : _ref$push;
|
|
2237
|
-
return
|
|
2162
|
+
return React__default.createElement(context.Consumer, null, function (context$$1) {
|
|
2238
2163
|
!context$$1 ? invariant(false, "You should not use <Redirect> outside a <Router>") : void 0;
|
|
2239
2164
|
var history = context$$1.history,
|
|
2240
2165
|
staticContext = context$$1.staticContext;
|
|
@@ -2249,12 +2174,16 @@
|
|
|
2249
2174
|
return null;
|
|
2250
2175
|
}
|
|
2251
2176
|
|
|
2252
|
-
return
|
|
2177
|
+
return React__default.createElement(Lifecycle, {
|
|
2253
2178
|
onMount: function onMount() {
|
|
2254
2179
|
method(location);
|
|
2255
2180
|
},
|
|
2256
2181
|
onUpdate: function onUpdate(self, prevProps) {
|
|
2257
|
-
|
|
2182
|
+
var prevLocation = createLocation(prevProps.to);
|
|
2183
|
+
|
|
2184
|
+
if (!locationsAreEqual(prevLocation, _extends({}, location, {
|
|
2185
|
+
key: prevLocation.key
|
|
2186
|
+
}))) {
|
|
2258
2187
|
method(location);
|
|
2259
2188
|
}
|
|
2260
2189
|
},
|
|
@@ -2577,6 +2506,7 @@
|
|
|
2577
2506
|
sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
|
|
2578
2507
|
var paths = [].concat(path);
|
|
2579
2508
|
return paths.reduce(function (matched, path) {
|
|
2509
|
+
if (!path) return null;
|
|
2580
2510
|
if (matched) return matched;
|
|
2581
2511
|
|
|
2582
2512
|
var _compilePath = compilePath$1(path, {
|
|
@@ -2609,7 +2539,7 @@
|
|
|
2609
2539
|
}
|
|
2610
2540
|
|
|
2611
2541
|
function isEmptyChildren(children) {
|
|
2612
|
-
return
|
|
2542
|
+
return React__default.Children.count(children) === 0;
|
|
2613
2543
|
}
|
|
2614
2544
|
/**
|
|
2615
2545
|
* The public API for matching a single path and rendering.
|
|
@@ -2630,7 +2560,7 @@
|
|
|
2630
2560
|
_proto.render = function render() {
|
|
2631
2561
|
var _this = this;
|
|
2632
2562
|
|
|
2633
|
-
return
|
|
2563
|
+
return React__default.createElement(context.Consumer, null, function (context$$1) {
|
|
2634
2564
|
!context$$1 ? invariant(false, "You should not use <Route> outside a <Router>") : void 0;
|
|
2635
2565
|
var location = _this.props.location || context$$1.location;
|
|
2636
2566
|
var match = _this.props.computedMatch ? _this.props.computedMatch // <Switch> already computed the match for us
|
|
@@ -2664,14 +2594,14 @@
|
|
|
2664
2594
|
}
|
|
2665
2595
|
}
|
|
2666
2596
|
|
|
2667
|
-
return
|
|
2597
|
+
return React__default.createElement(context.Provider, {
|
|
2668
2598
|
value: props
|
|
2669
|
-
}, children && !isEmptyChildren(children) ? children : props.match ? component ?
|
|
2599
|
+
}, children && !isEmptyChildren(children) ? children : props.match ? component ? React__default.createElement(component, props) : render ? render(props) : null : null);
|
|
2670
2600
|
});
|
|
2671
2601
|
};
|
|
2672
2602
|
|
|
2673
2603
|
return Route;
|
|
2674
|
-
}(
|
|
2604
|
+
}(React__default.Component);
|
|
2675
2605
|
|
|
2676
2606
|
{
|
|
2677
2607
|
Route.propTypes = {
|
|
@@ -2794,7 +2724,8 @@
|
|
|
2794
2724
|
var _this$props = this.props,
|
|
2795
2725
|
_this$props$basename = _this$props.basename,
|
|
2796
2726
|
basename = _this$props$basename === void 0 ? "" : _this$props$basename,
|
|
2797
|
-
context = _this$props.context
|
|
2727
|
+
_this$props$context = _this$props.context,
|
|
2728
|
+
context = _this$props$context === void 0 ? {} : _this$props$context;
|
|
2798
2729
|
context.action = action;
|
|
2799
2730
|
context.location = addBasename(basename, createLocation(location));
|
|
2800
2731
|
context.url = createURL(context.location);
|
|
@@ -2824,14 +2755,14 @@
|
|
|
2824
2755
|
listen: this.handleListen,
|
|
2825
2756
|
block: this.handleBlock
|
|
2826
2757
|
};
|
|
2827
|
-
return
|
|
2758
|
+
return React__default.createElement(Router, _extends({}, rest, {
|
|
2828
2759
|
history: history,
|
|
2829
2760
|
staticContext: context
|
|
2830
2761
|
}));
|
|
2831
2762
|
};
|
|
2832
2763
|
|
|
2833
2764
|
return StaticRouter;
|
|
2834
|
-
}(
|
|
2765
|
+
}(React__default.Component);
|
|
2835
2766
|
|
|
2836
2767
|
{
|
|
2837
2768
|
StaticRouter.propTypes = {
|
|
@@ -2863,7 +2794,7 @@
|
|
|
2863
2794
|
_proto.render = function render() {
|
|
2864
2795
|
var _this = this;
|
|
2865
2796
|
|
|
2866
|
-
return
|
|
2797
|
+
return React__default.createElement(context.Consumer, null, function (context$$1) {
|
|
2867
2798
|
!context$$1 ? invariant(false, "You should not use <Switch> outside a <Router>") : void 0;
|
|
2868
2799
|
var location = _this.props.location || context$$1.location;
|
|
2869
2800
|
var element, match; // We use React.Children.forEach instead of React.Children.toArray().find()
|
|
@@ -2871,8 +2802,8 @@
|
|
|
2871
2802
|
// to trigger an unmount/remount for two <Route>s that render the same
|
|
2872
2803
|
// component at different URLs.
|
|
2873
2804
|
|
|
2874
|
-
|
|
2875
|
-
if (match == null &&
|
|
2805
|
+
React__default.Children.forEach(_this.props.children, function (child) {
|
|
2806
|
+
if (match == null && React__default.isValidElement(child)) {
|
|
2876
2807
|
element = child;
|
|
2877
2808
|
var path = child.props.path || child.props.from;
|
|
2878
2809
|
match = path ? matchPath(location.pathname, _extends({}, child.props, {
|
|
@@ -2880,7 +2811,7 @@
|
|
|
2880
2811
|
})) : context$$1.match;
|
|
2881
2812
|
}
|
|
2882
2813
|
});
|
|
2883
|
-
return match ?
|
|
2814
|
+
return match ? React__default.cloneElement(element, {
|
|
2884
2815
|
location: location,
|
|
2885
2816
|
computedMatch: match
|
|
2886
2817
|
}) : null;
|
|
@@ -2888,7 +2819,7 @@
|
|
|
2888
2819
|
};
|
|
2889
2820
|
|
|
2890
2821
|
return Switch;
|
|
2891
|
-
}(
|
|
2822
|
+
}(React__default.Component);
|
|
2892
2823
|
|
|
2893
2824
|
{
|
|
2894
2825
|
Switch.propTypes = {
|
|
@@ -2990,25 +2921,26 @@
|
|
|
2990
2921
|
*/
|
|
2991
2922
|
|
|
2992
2923
|
function withRouter(Component) {
|
|
2924
|
+
var displayName = "withRouter(" + (Component.displayName || Component.name) + ")";
|
|
2925
|
+
|
|
2993
2926
|
var C = function C(props) {
|
|
2994
2927
|
var wrappedComponentRef = props.wrappedComponentRef,
|
|
2995
2928
|
remainingProps = _objectWithoutPropertiesLoose(props, ["wrappedComponentRef"]);
|
|
2996
2929
|
|
|
2997
|
-
return
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
}
|
|
2930
|
+
return React__default.createElement(context.Consumer, null, function (context$$1) {
|
|
2931
|
+
!context$$1 ? invariant(false, "You should not use <" + displayName + " /> outside a <Router>") : void 0;
|
|
2932
|
+
return React__default.createElement(Component, _extends({}, remainingProps, context$$1, {
|
|
2933
|
+
ref: wrappedComponentRef
|
|
2934
|
+
}));
|
|
3003
2935
|
});
|
|
3004
2936
|
};
|
|
3005
2937
|
|
|
3006
|
-
C.displayName =
|
|
2938
|
+
C.displayName = displayName;
|
|
3007
2939
|
C.WrappedComponent = Component;
|
|
3008
2940
|
|
|
3009
2941
|
{
|
|
3010
2942
|
C.propTypes = {
|
|
3011
|
-
wrappedComponentRef: propTypes.func
|
|
2943
|
+
wrappedComponentRef: propTypes.oneOfType([propTypes.string, propTypes.func, propTypes.object])
|
|
3012
2944
|
};
|
|
3013
2945
|
}
|
|
3014
2946
|
|
package/umd/react-router.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t.ReactRouter={},t.React)}(this,function(t,h){"use strict";function r(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}h=h&&h.hasOwnProperty("default")?h.default:h;var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function o(t,e){return t(e={exports:{}},e.exports),e.exports}var i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;(function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}})()&&Object.assign;function u(){}var d=o(function(t){t.exports=function(){function t(t,e,n,r,o,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var a=new 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");throw a.name="Invariant Violation",a}}function e(){return t}var n={array:t.isRequired=t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return n.checkPropTypes=u,n.PropTypes=n}()});function b(){return(b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function y(t){return"/"===t.charAt(0)}function m(t,e){for(var n=e,r=n+1,o=t.length;r<o;n+=1,r+=1)t[n]=t[r];t.pop()}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var p="Invariant failed";function l(t,e){if(!t)throw new Error(p)}function x(t){var e=t.pathname,n=t.search,r=t.hash,o=e||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}function w(t,e,n,r){var o;"string"==typeof t?(o=function(t){var e=t||"/",n="",r="",o=e.indexOf("#");-1!==o&&(r=e.substr(o),e=e.substr(0,o));var i=e.indexOf("?");return-1!==i&&(n=e.substr(i),e=e.substr(0,i)),{pathname:e,search:"?"===n?"":n,hash:"#"===r?"":r}}(t)).state=e:(void 0===(o=b({},t)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==e&&void 0===o.state&&(o.state=e));try{o.pathname=decodeURI(o.pathname)}catch(t){throw t instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):t}return n&&(o.key=n),r?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],r=e&&e.split("/")||[],o=t&&y(t),i=e&&y(e),a=o||i;if(t&&y(t)?r=n:n.length&&(r.pop(),r=r.concat(n)),!r.length)return"/";var c=void 0;if(r.length){var u=r[r.length-1];c="."===u||".."===u||""===u}else c=!1;for(var s=0,p=r.length;0<=p;p--){var l=r[p];"."===l?m(r,p):".."===l?(m(r,p),s++):s&&(m(r,p),s--)}if(!a)for(;s--;s)r.unshift("..");!a||""===r[0]||r[0]&&y(r[0])||r.unshift("");var f=r.join("/");return c&&"/"!==f.substr(-1)&&(f+="/"),f}(o.pathname,r.pathname)):o.pathname=r.pathname:o.pathname||(o.pathname="/"),o}function f(t,e){return t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&function n(e,r){if(e===r)return!0;if(null==e||null==r)return!1;if(Array.isArray(e))return Array.isArray(r)&&e.length===r.length&&e.every(function(t,e){return n(t,r[e])});var t=void 0===e?"undefined":s(e);if(t!==(void 0===r?"undefined":s(r)))return!1;if("object"!==t)return!1;var o=e.valueOf(),i=r.valueOf();if(o!==e||i!==r)return n(o,i);var a=Object.keys(e),c=Object.keys(r);return a.length===c.length&&a.every(function(t){return n(e[t],r[t])})}(t.state,e.state)}"undefined"==typeof window||!window.document||window.document.createElement;function P(t,e,n){return Math.min(Math.max(t,e),n)}function v(t){void 0===t&&(t={});var i,r,e=t,o=e.getUserConfirmation,n=e.initialEntries,a=void 0===n?["/"]:n,c=e.initialIndex,u=void 0===c?0:c,s=e.keyLength,p=void 0===s?6:s,l=(i=null,r=[],{setPrompt:function(t){return i=t,function(){i===t&&(i=null)}},confirmTransitionTo:function(t,e,n,r){if(null!=i){var o="function"==typeof i?i(t,e):i;"string"==typeof o?"function"==typeof n?n(o,r):r(!0):r(!1!==o)}else r(!0)},appendListener:function(t){var e=!0;function n(){e&&t.apply(void 0,arguments)}return r.push(n),function(){e=!1,r=r.filter(function(t){return t!==n})}},notifyListeners:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];r.forEach(function(t){return t.apply(void 0,e)})}});function f(t){b(g,t),g.length=g.entries.length,l.notifyListeners(g.location,g.action)}function h(){return Math.random().toString(36).substr(2,p)}var d=P(u,0,a.length-1),y=a.map(function(t){return w(t,void 0,"string"==typeof t?h():t.key||h())}),m=x;function v(t){var e=P(g.index+t,0,g.entries.length-1),n=g.entries[e];l.confirmTransitionTo(n,"POP",o,function(t){t?f({action:"POP",location:n,index:e}):f()})}var g={length:y.length,action:"POP",location:y[d],index:d,entries:y,createHref:m,push:function(t,e){var r=w(t,e,h(),g.location);l.confirmTransitionTo(r,"PUSH",o,function(t){if(t){var e=g.index+1,n=g.entries.slice(0);n.length>e?n.splice(e,n.length-e,r):n.push(r),f({action:"PUSH",location:r,index:e,entries:n})}})},replace:function(t,e){var n="REPLACE",r=w(t,e,h(),g.location);l.confirmTransitionTo(r,n,o,function(t){t&&(g.entries[g.index]=r,f({action:n,location:r}))})},go:v,goBack:function(){v(-1)},goForward:function(){v(1)},canGo:function(t){var e=g.index+t;return 0<=e&&e<g.entries.length},block:function(t){return void 0===t&&(t=!1),l.setPrompt(t)},listen:function(t){return l.appendListener(t)}};return g}var g="__global_unique_id__",C=function(){return e[g]=(e[g]||0)+1};function E(t){return function(){return t}}var O=function(){};O.thatReturns=E,O.thatReturnsFalse=E(!1),O.thatReturnsTrue=E(!0),O.thatReturnsNull=E(null),O.thatReturnsThis=function(){return this},O.thatReturnsArgument=function(t){return t};var R=O,_=o(function(t,e){e.__esModule=!0;n(h);var c=n(d),u=n(C);n(R);function n(t){return t&&t.__esModule?t:{default:t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var f=1073741823;e.default=function(t,a){var e,n,r="__create-react-context-"+(0,u.default)()+"__",o=function(c){function u(){var t,e,n,r;s(this,u);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return(t=e=p(this,c.call.apply(c,[this].concat(i)))).emitter=(n=e.props.value,r=[],{on:function(t){r.push(t)},off:function(e){r=r.filter(function(t){return t!==e})},get:function(){return n},set:function(t,e){n=t,r.forEach(function(t){return t(n,e)})}}),p(e,t)}return l(u,c),u.prototype.getChildContext=function(){var t;return(t={})[r]=this.emitter,t},u.prototype.componentWillReceiveProps=function(t){if(this.props.value!==t.value){var e=this.props.value,n=t.value,r=void 0;((o=e)===(i=n)?0!==o||1/o==1/i:o!=o&&i!=i)?r=0:(r="function"==typeof a?a(e,n):f,0!=(r|=0)&&this.emitter.set(t.value,r))}var o,i},u.prototype.render=function(){return this.props.children},u}(h.Component);o.childContextTypes=((e={})[r]=c.default.object.isRequired,e);var i=function(i){function a(){var t,n;s(this,a);for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];return(t=n=p(this,i.call.apply(i,[this].concat(r)))).state={value:n.getValue()},n.onUpdate=function(t,e){0!=((0|n.observedBits)&e)&&n.setState({value:n.getValue()})},p(n,t)}return l(a,i),a.prototype.componentWillReceiveProps=function(t){var e=t.observedBits;this.observedBits=null==e?f:e},a.prototype.componentDidMount=function(){this.context[r]&&this.context[r].on(this.onUpdate);var t=this.props.observedBits;this.observedBits=null==t?f:t},a.prototype.componentWillUnmount=function(){this.context[r]&&this.context[r].off(this.onUpdate)},a.prototype.getValue=function(){return this.context[r]?this.context[r].get():t},a.prototype.render=function(){return t=this.props.children,(Array.isArray(t)?t[0]:t)(this.state.value);var t},a}(h.Component);return i.contextTypes=((n={})[r]=c.default.object,n),{Provider:o,Consumer:i}},t.exports=e.default});n(_);var S=n(o(function(t,e){e.__esModule=!0;var n=o(h),r=o(_);function o(t){return t&&t.__esModule?t:{default:t}}e.default=n.default.createContext||r.default,t.exports=e.default})),j=function(t){var e=S();return e.Provider.displayName=t+".Provider",e.Consumer.displayName=t+".Consumer",e}("Router"),M=function(n){function t(t){var e;return(e=n.call(this,t)||this).state={location:t.history.location},e._isMounted=!1,e._pendingLocation=null,t.staticContext||(e.unlisten=t.history.listen(function(t){e._isMounted?e.setState({location:t}):e._pendingLocation=t})),e}r(t,n),t.computeRootMatch=function(t){return{path:"/",url:"/",params:{},isExact:"/"===t}};var e=t.prototype;return e.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},e.componentWillUnmount=function(){this.unlisten&&this.unlisten()},e.render=function(){return h.createElement(j.Provider,{children:this.props.children||null,value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}})},t}(h.Component),T=function(o){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=o.call.apply(o,[this].concat(n))||this).history=v(t.props),t}return r(t,o),t.prototype.render=function(){return h.createElement(M,{history:this.history,children:this.props.children})},t}(h.Component),A=function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.componentDidMount=function(){this.props.onMount&&this.props.onMount.call(this,this)},n.componentDidUpdate=function(t){this.props.onUpdate&&this.props.onUpdate.call(this,this,t)},n.componentWillUnmount=function(){this.props.onUnmount&&this.props.onUnmount.call(this,this)},n.render=function(){return null},e}(h.Component);var k=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},$=z,U=B,F=function(t,e){return V(B(t,e))},L=V,I=J,N=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function B(t,e){for(var n,r,o=[],i=0,a=0,c="",u=e&&e.delimiter||"/";null!=(n=N.exec(t));){var s=n[0],p=n[1],l=n.index;if(c+=t.slice(a,l),a=l+s.length,p)c+=p[1];else{var f=t[a],h=n[2],d=n[3],y=n[4],m=n[5],v=n[6],g=n[7];c&&(o.push(c),c="");var b=null!=h&&null!=f&&f!==h,x="+"===v||"*"===v,w="?"===v||"*"===v,P=n[2]||u,C=y||m;o.push({name:d||i++,prefix:h||"",delimiter:P,optional:w,repeat:x,partial:b,asterisk:!!g,pattern:C?(r=C,r.replace(/([=!:$\/()])/g,"\\$1")):g?".*":"[^"+W(P)+"]+?"})}}return a<t.length&&(c+=t.substr(a)),c&&o.push(c),o}function D(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function V(p){for(var l=new Array(p.length),t=0;t<p.length;t++)"object"==typeof p[t]&&(l[t]=new RegExp("^(?:"+p[t].pattern+")$"));return function(t,e){for(var n="",r=t||{},o=(e||{}).pretty?D:encodeURIComponent,i=0;i<p.length;i++){var a=p[i];if("string"!=typeof a){var c,u=r[a.name];if(null==u){if(a.optional){a.partial&&(n+=a.prefix);continue}throw new TypeError('Expected "'+a.name+'" to be defined')}if(k(u)){if(!a.repeat)throw new TypeError('Expected "'+a.name+'" to not repeat, but received `'+JSON.stringify(u)+"`");if(0===u.length){if(a.optional)continue;throw new TypeError('Expected "'+a.name+'" to not be empty')}for(var s=0;s<u.length;s++){if(c=o(u[s]),!l[i].test(c))throw new TypeError('Expected all "'+a.name+'" to match "'+a.pattern+'", but received `'+JSON.stringify(c)+"`");n+=(0===s?a.prefix:a.delimiter)+c}}else{if(c=a.asterisk?encodeURI(u).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}):o(u),!l[i].test(c))throw new TypeError('Expected "'+a.name+'" to match "'+a.pattern+'", but received "'+c+'"');n+=a.prefix+c}}else n+=a}return n}}function W(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function q(t,e){return t.keys=e,t}function H(t){return t.sensitive?"":"i"}function J(t,e,n){k(e)||(n=e||n,e=[]);for(var r=(n=n||{}).strict,o=!1!==n.end,i="",a=0;a<t.length;a++){var c=t[a];if("string"==typeof c)i+=W(c);else{var u=W(c.prefix),s="(?:"+c.pattern+")";e.push(c),c.repeat&&(s+="(?:"+u+s+")*"),i+=s=c.optional?c.partial?u+"("+s+")?":"(?:"+u+"("+s+"))?":u+"("+s+")"}}var p=W(n.delimiter||"/"),l=i.slice(-p.length)===p;return r||(i=(l?i.slice(0,-p.length):i)+"(?:"+p+"(?=$))?"),i+=o?"$":r&&l?"":"(?="+p+"|$)",q(new RegExp("^"+i,H(n)),e)}function z(t,e,n){return k(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?function(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return q(t,e)}(t,e):k(t)?function(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(z(t[o],e,n).source);return q(new RegExp("(?:"+r.join("|")+")",H(n)),e)}(t,e,n):(r=e,J(B(t,o=n),r,o));var r,o}$.parse=U,$.compile=F,$.tokensToFunction=L,$.tokensToRegExp=I;var G={},Y=1e4,K=0;function Q(t,e){return void 0===t&&(t="/"),void 0===e&&(e={}),"/"===t?t:function(t){if(G[t])return G[t];var e=$.compile(t);return K<Y&&(G[t]=e,K++),e}(t)(e,{pretty:!0})}var X=o(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,a=n?Symbol.for("react.strict_mode"):60108,c=n?Symbol.for("react.profiler"):60114,u=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,p=n?Symbol.for("react.concurrent_mode"):60111,l=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,h=n?Symbol.for("react.memo"):60115,d=n?Symbol.for("react.lazy"):60116;function y(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case r:switch(t=t.type){case p:case i:case c:case a:return t;default:switch(t=t&&t.$$typeof){case s:case l:case u:return t;default:return e}}case o:return e}}}function m(t){return y(t)===p}e.typeOf=y,e.AsyncMode=p,e.ConcurrentMode=p,e.ContextConsumer=s,e.ContextProvider=u,e.Element=r,e.ForwardRef=l,e.Fragment=i,e.Profiler=c,e.Portal=o,e.StrictMode=a,e.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===i||t===p||t===c||t===a||t===f||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===h||t.$$typeof===u||t.$$typeof===s||t.$$typeof===l)},e.isAsyncMode=function(t){return m(t)},e.isConcurrentMode=m,e.isContextConsumer=function(t){return y(t)===s},e.isContextProvider=function(t){return y(t)===u},e.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===r},e.isForwardRef=function(t){return y(t)===l},e.isFragment=function(t){return y(t)===i},e.isProfiler=function(t){return y(t)===c},e.isPortal=function(t){return y(t)===o},e.isStrictMode=function(t){return y(t)===a}});n(X);X.typeOf,X.AsyncMode,X.ConcurrentMode,X.ContextConsumer,X.ContextProvider,X.Element,X.ForwardRef,X.Fragment,X.Profiler,X.Portal,X.StrictMode,X.isValidElementType,X.isAsyncMode,X.isConcurrentMode,X.isContextConsumer,X.isContextProvider,X.isElement,X.isForwardRef,X.isFragment,X.isProfiler,X.isPortal,X.isStrictMode;var Z=o(function(t,e){});n(Z);Z.typeOf,Z.AsyncMode,Z.ConcurrentMode,Z.ContextConsumer,Z.ContextProvider,Z.Element,Z.ForwardRef,Z.Fragment,Z.Profiler,Z.Portal,Z.StrictMode,Z.isValidElementType,Z.isAsyncMode,Z.isConcurrentMode,Z.isContextConsumer,Z.isContextProvider,Z.isElement,Z.isForwardRef,Z.isFragment,Z.isProfiler,Z.isPortal,Z.isStrictMode;var tt=o(function(t){t.exports=X}),et=(tt.isValidElementType,{}),nt=1e4,rt=0;function ot(s,t){void 0===t&&(t={}),"string"==typeof t&&(t={path:t});var e=t,n=e.path,r=e.exact,p=void 0!==r&&r,o=e.strict,l=void 0!==o&&o,i=e.sensitive,f=void 0!==i&&i;return[].concat(n).reduce(function(t,e){if(t)return t;var n=function(t,e){var n=""+e.end+e.strict+e.sensitive,r=et[n]||(et[n]={});if(r[t])return r[t];var o=[],i={regexp:$(t,o,e),keys:o};return rt<nt&&(r[t]=i,rt++),i}(e,{end:p,strict:l,sensitive:f}),r=n.regexp,o=n.keys,i=r.exec(s);if(!i)return null;var a=i[0],c=i.slice(1),u=s===a;return p&&!u?null:{path:e,url:"/"===e&&""===a?"/":a,isExact:u,params:o.reduce(function(t,e,n){return t[e.name]=c[n],t},{})}},null)}var it=function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){var u=this;return h.createElement(j.Consumer,null,function(t){t||l(!1);var e,n=u.props.location||t.location,r=b({},t,{location:n,match:u.props.computedMatch?u.props.computedMatch:u.props.path?ot(n.pathname,u.props):t.match}),o=u.props,i=o.children,a=o.component,c=o.render;return Array.isArray(i)&&0===i.length&&(i=null),"function"==typeof i&&void 0===(i=i(r))&&(i=null),h.createElement(j.Provider,{value:r},i&&(e=i,0!==h.Children.count(e))?i:r.match?a?h.createElement(a,r):c?c(r):null:null)})},e}(h.Component);function at(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],0<=e.indexOf(n)||(o[n]=t[n]);return o}function ct(t){return"/"===t.charAt(0)?t:"/"+t}function ut(t){return"string"==typeof t?t:x(t)}function st(t){return function(){l(!1)}}function pt(){}var lt=function(o){function t(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=o.call.apply(o,[this].concat(n))||this).handlePush=function(t){return e.navigateTo(t,"PUSH")},e.handleReplace=function(t){return e.navigateTo(t,"REPLACE")},e.handleListen=function(){return pt},e.handleBlock=function(){return pt},e}r(t,o);var e=t.prototype;return e.navigateTo=function(t,e){var n,r,o=this.props,i=o.basename,a=void 0===i?"":i,c=o.context;c.action=e,c.location=(n=a,r=w(t),n?b({},r,{pathname:ct(n)+r.pathname}):r),c.url=ut(c.location)},e.render=function(){var t=this.props,e=t.basename,n=void 0===e?"":e,r=t.context,o=void 0===r?{}:r,i=t.location,a=void 0===i?"/":i,c=at(t,["basename","context","location"]),u={createHref:function(t){return ct(n+ut(t))},action:"POP",location:function(t,e){if(!t)return e;var n=ct(t);return 0!==e.pathname.indexOf(n)?e:b({},e,{pathname:e.pathname.substr(n.length)})}(n,w(a)),push:this.handlePush,replace:this.handleReplace,go:st(),goBack:st(),goForward:st(),listen:this.handleListen,block:this.handleBlock};return h.createElement(M,b({},c,{history:u,staticContext:o}))},t}(h.Component),ft=function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){var t=this;return h.createElement(j.Consumer,null,function(n){n||l(!1);var r,o,i=t.props.location||n.location;return h.Children.forEach(t.props.children,function(t){if(null==o&&h.isValidElement(t)){var e=(r=t).props.path||t.props.from;o=e?ot(i.pathname,b({},t.props,{path:e})):n.match}}),o?h.cloneElement(r,{location:i,computedMatch:o}):null})},e}(h.Component),ht={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},dt={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},yt={};yt[tt.ForwardRef]={$$typeof:!0,render:!0};var mt=Object.defineProperty,vt=Object.getOwnPropertyNames,gt=Object.getOwnPropertySymbols,bt=Object.getOwnPropertyDescriptor,xt=Object.getPrototypeOf,wt=Object.prototype;var Pt=function t(e,n,r){if("string"==typeof n)return e;if(wt){var o=xt(n);o&&o!==wt&&t(e,o,r)}var i=vt(n);gt&&(i=i.concat(gt(n)));for(var a=yt[e.$$typeof]||ht,c=yt[n.$$typeof]||ht,u=0;u<i.length;++u){var s=i[u];if(!(dt[s]||r&&r[s]||c&&c[s]||a&&a[s])){var p=bt(n,s);try{mt(e,s,p)}catch(t){}}}return e};t.MemoryRouter=T,t.Prompt=function(t){var r=t.message,e=t.when,o=void 0===e||e;return h.createElement(j.Consumer,null,function(t){if(t||l(!1),!o||t.staticContext)return null;var n=t.history.block;return h.createElement(A,{onMount:function(t){t.release=n(r)},onUpdate:function(t,e){e.message!==r&&(t.release(),t.release=n(r))},onUnmount:function(t){t.release()},message:r})})},t.Redirect=function(t){var i=t.computedMatch,a=t.to,e=t.push,c=void 0!==e&&e;return h.createElement(j.Consumer,null,function(t){t||l(!1);var e=t.history,n=t.staticContext,r=c?e.push:e.replace,o=w(i?"string"==typeof a?Q(a,i.params):b({},a,{pathname:Q(a.pathname,i.params)}):a);return n?(r(o),null):h.createElement(A,{onMount:function(){r(o)},onUpdate:function(t,e){f(e.to,o)||r(o)},to:a})})},t.Route=it,t.Router=M,t.StaticRouter=lt,t.Switch=ft,t.generatePath=Q,t.matchPath=ot,t.withRouter=function(r){var t=function(t){var e=t.wrappedComponentRef,n=at(t,["wrappedComponentRef"]);return h.createElement(it,{children:function(t){return h.createElement(r,b({},n,t,{ref:e}))}})};return t.displayName="withRouter("+(r.displayName||r.name)+")",t.WrappedComponent=r,Pt(t,r)},t.__RouterContext=j,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t.ReactRouter={},t.React)}(this,function(t,a){"use strict";var s="default"in a?a.default:a;function r(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t,e){return t(e={exports:{}},e.exports),e.exports}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;(function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}})()&&Object.assign;function p(){}var l=n(function(t){t.exports=function(){function t(t,e,n,r,o,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var a=new 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");throw a.name="Invariant Violation",a}}function e(){return t}var n={array:t.isRequired=t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return n.checkPropTypes=p,n.PropTypes=n}()});function b(){return(b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function h(t){return"/"===t.charAt(0)}function d(t,e){for(var n=e,r=n+1,o=t.length;r<o;n+=1,r+=1)t[n]=t[r];t.pop()}var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var m="Invariant failed";function y(t,e){if(!t)throw new Error(m)}function x(t){var e=t.pathname,n=t.search,r=t.hash,o=e||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}function w(t,e,n,r){var o;"string"==typeof t?(o=function(t){var e=t||"/",n="",r="",o=e.indexOf("#");-1!==o&&(r=e.substr(o),e=e.substr(0,o));var i=e.indexOf("?");return-1!==i&&(n=e.substr(i),e=e.substr(0,i)),{pathname:e,search:"?"===n?"":n,hash:"#"===r?"":r}}(t)).state=e:(void 0===(o=b({},t)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==e&&void 0===o.state&&(o.state=e));try{o.pathname=decodeURI(o.pathname)}catch(t){throw t instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):t}return n&&(o.key=n),r?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],r=e&&e.split("/")||[],o=t&&h(t),i=e&&h(e),a=o||i;if(t&&h(t)?r=n:n.length&&(r.pop(),r=r.concat(n)),!r.length)return"/";var c=void 0;if(r.length){var u=r[r.length-1];c="."===u||".."===u||""===u}else c=!1;for(var s=0,p=r.length;0<=p;p--){var l=r[p];"."===l?d(r,p):".."===l?(d(r,p),s++):s&&(d(r,p),s--)}if(!a)for(;s--;s)r.unshift("..");!a||""===r[0]||r[0]&&h(r[0])||r.unshift("");var f=r.join("/");return c&&"/"!==f.substr(-1)&&(f+="/"),f}(o.pathname,r.pathname)):o.pathname=r.pathname:o.pathname||(o.pathname="/"),o}function v(t,e){return t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&function n(e,r){if(e===r)return!0;if(null==e||null==r)return!1;if(Array.isArray(e))return Array.isArray(r)&&e.length===r.length&&e.every(function(t,e){return n(t,r[e])});var t=void 0===e?"undefined":f(e);if(t!==(void 0===r?"undefined":f(r)))return!1;if("object"!==t)return!1;var o=e.valueOf(),i=r.valueOf();if(o!==e||i!==r)return n(o,i);var a=Object.keys(e),c=Object.keys(r);return a.length===c.length&&a.every(function(t){return n(e[t],r[t])})}(t.state,e.state)}"undefined"==typeof window||!window.document||window.document.createElement;function C(t,e,n){return Math.min(Math.max(t,e),n)}function g(t){void 0===t&&(t={});var i,r,e=t,o=e.getUserConfirmation,n=e.initialEntries,a=void 0===n?["/"]:n,c=e.initialIndex,u=void 0===c?0:c,s=e.keyLength,p=void 0===s?6:s,l=(i=null,r=[],{setPrompt:function(t){return i=t,function(){i===t&&(i=null)}},confirmTransitionTo:function(t,e,n,r){if(null!=i){var o="function"==typeof i?i(t,e):i;"string"==typeof o?"function"==typeof n?n(o,r):r(!0):r(!1!==o)}else r(!0)},appendListener:function(t){var e=!0;function n(){e&&t.apply(void 0,arguments)}return r.push(n),function(){e=!1,r=r.filter(function(t){return t!==n})}},notifyListeners:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];r.forEach(function(t){return t.apply(void 0,e)})}});function f(t){b(g,t),g.length=g.entries.length,l.notifyListeners(g.location,g.action)}function h(){return Math.random().toString(36).substr(2,p)}var d=C(u,0,a.length-1),m=a.map(function(t){return w(t,void 0,"string"==typeof t?h():t.key||h())}),y=x;function v(t){var e=C(g.index+t,0,g.entries.length-1),n=g.entries[e];l.confirmTransitionTo(n,"POP",o,function(t){t?f({action:"POP",location:n,index:e}):f()})}var g={length:m.length,action:"POP",location:m[d],index:d,entries:m,createHref:y,push:function(t,e){var r=w(t,e,h(),g.location);l.confirmTransitionTo(r,"PUSH",o,function(t){if(t){var e=g.index+1,n=g.entries.slice(0);n.length>e?n.splice(e,n.length-e,r):n.push(r),f({action:"PUSH",location:r,index:e,entries:n})}})},replace:function(t,e){var n="REPLACE",r=w(t,e,h(),g.location);l.confirmTransitionTo(r,n,o,function(t){t&&(g.entries[g.index]=r,f({action:n,location:r}))})},go:v,goBack:function(){v(-1)},goForward:function(){v(1)},canGo:function(t){var e=g.index+t;return 0<=e&&e<g.entries.length},block:function(t){return void 0===t&&(t=!1),l.setPrompt(t)},listen:function(t){return l.appendListener(t)}};return g}var P="__global_unique_id__";function E(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function O(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function R(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var S=1073741823;var _=s.createContext||function(n,c){var t,e,r="__create-react-context-"+(u[P]=(u[P]||0)+1)+"__",o=function(a){function t(){for(var t,n,r,e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return E(R(t=a.call.apply(a,[this].concat(o))||this),"emitter",(n=t.props.value,r=[],{on:function(t){r.push(t)},off:function(e){r=r.filter(function(t){return t!==e})},get:function(){return n},set:function(t,e){n=t,r.forEach(function(t){return t(n,e)})}})),t}O(t,a);var e=t.prototype;return e.getChildContext=function(){var t;return(t={})[r]=this.emitter,t},e.componentWillReceiveProps=function(t){if(this.props.value!==t.value){var e,n=this.props.value,r=t.value;((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)?e=0:(e="function"==typeof c?c(n,r):S,0!=(e|=0)&&this.emitter.set(t.value,e))}var o,i},e.render=function(){return this.props.children},t}(a.Component);E(o,"childContextTypes",((t={})[r]=l.object.isRequired,t));var i=function(o){function t(){for(var n,t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return E(R(n=o.call.apply(o,[this].concat(e))||this),"observedBits",void 0),E(R(n),"state",{value:n.getValue()}),E(R(n),"onUpdate",function(t,e){0!=((0|n.observedBits)&e)&&n.setState({value:n.getValue()})}),n}O(t,o);var e=t.prototype;return e.componentWillReceiveProps=function(t){var e=t.observedBits;this.observedBits=null==e?S:e},e.componentDidMount=function(){this.context[r]&&this.context[r].on(this.onUpdate);var t=this.props.observedBits;this.observedBits=null==t?S:t},e.componentWillUnmount=function(){this.context[r]&&this.context[r].off(this.onUpdate)},e.getValue=function(){return this.context[r]?this.context[r].get():n},e.render=function(){return t=this.props.children,(Array.isArray(t)?t[0]:t)(this.state.value);var t},t}(a.Component);return E(i,"contextTypes",((e={})[r]=l.object,e)),{Provider:o,Consumer:i}},j=function(t){var e=_();return e.displayName=t,e}("Router"),M=function(n){function t(t){var e;return(e=n.call(this,t)||this).state={location:t.history.location},e._isMounted=!1,e._pendingLocation=null,t.staticContext||(e.unlisten=t.history.listen(function(t){e._isMounted?e.setState({location:t}):e._pendingLocation=t})),e}r(t,n),t.computeRootMatch=function(t){return{path:"/",url:"/",params:{},isExact:"/"===t}};var e=t.prototype;return e.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},e.componentWillUnmount=function(){this.unlisten&&this.unlisten()},e.render=function(){return s.createElement(j.Provider,{children:this.props.children||null,value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}})},t}(s.Component),T=function(o){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=o.call.apply(o,[this].concat(n))||this).history=g(t.props),t}return r(t,o),t.prototype.render=function(){return s.createElement(M,{history:this.history,children:this.props.children})},t}(s.Component),A=function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.componentDidMount=function(){this.props.onMount&&this.props.onMount.call(this,this)},n.componentDidUpdate=function(t){this.props.onUpdate&&this.props.onUpdate.call(this,this,t)},n.componentWillUnmount=function(){this.props.onUnmount&&this.props.onUnmount.call(this,this)},n.render=function(){return null},e}(s.Component);var k=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},$=z,U=N,F=function(t,e){return V(N(t,e))},L=V,I=J,B=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function N(t,e){for(var n,r,o=[],i=0,a=0,c="",u=e&&e.delimiter||"/";null!=(n=B.exec(t));){var s=n[0],p=n[1],l=n.index;if(c+=t.slice(a,l),a=l+s.length,p)c+=p[1];else{var f=t[a],h=n[2],d=n[3],m=n[4],y=n[5],v=n[6],g=n[7];c&&(o.push(c),c="");var b=null!=h&&null!=f&&f!==h,x="+"===v||"*"===v,w="?"===v||"*"===v,C=n[2]||u,P=m||y;o.push({name:d||i++,prefix:h||"",delimiter:C,optional:w,repeat:x,partial:b,asterisk:!!g,pattern:P?(r=P,r.replace(/([=!:$\/()])/g,"\\$1")):g?".*":"[^"+W(C)+"]+?"})}}return a<t.length&&(c+=t.substr(a)),c&&o.push(c),o}function D(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function V(p){for(var l=new Array(p.length),t=0;t<p.length;t++)"object"==typeof p[t]&&(l[t]=new RegExp("^(?:"+p[t].pattern+")$"));return function(t,e){for(var n="",r=t||{},o=(e||{}).pretty?D:encodeURIComponent,i=0;i<p.length;i++){var a=p[i];if("string"!=typeof a){var c,u=r[a.name];if(null==u){if(a.optional){a.partial&&(n+=a.prefix);continue}throw new TypeError('Expected "'+a.name+'" to be defined')}if(k(u)){if(!a.repeat)throw new TypeError('Expected "'+a.name+'" to not repeat, but received `'+JSON.stringify(u)+"`");if(0===u.length){if(a.optional)continue;throw new TypeError('Expected "'+a.name+'" to not be empty')}for(var s=0;s<u.length;s++){if(c=o(u[s]),!l[i].test(c))throw new TypeError('Expected all "'+a.name+'" to match "'+a.pattern+'", but received `'+JSON.stringify(c)+"`");n+=(0===s?a.prefix:a.delimiter)+c}}else{if(c=a.asterisk?encodeURI(u).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}):o(u),!l[i].test(c))throw new TypeError('Expected "'+a.name+'" to match "'+a.pattern+'", but received "'+c+'"');n+=a.prefix+c}}else n+=a}return n}}function W(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function q(t,e){return t.keys=e,t}function H(t){return t.sensitive?"":"i"}function J(t,e,n){k(e)||(n=e||n,e=[]);for(var r=(n=n||{}).strict,o=!1!==n.end,i="",a=0;a<t.length;a++){var c=t[a];if("string"==typeof c)i+=W(c);else{var u=W(c.prefix),s="(?:"+c.pattern+")";e.push(c),c.repeat&&(s+="(?:"+u+s+")*"),i+=s=c.optional?c.partial?u+"("+s+")?":"(?:"+u+"("+s+"))?":u+"("+s+")"}}var p=W(n.delimiter||"/"),l=i.slice(-p.length)===p;return r||(i=(l?i.slice(0,-p.length):i)+"(?:"+p+"(?=$))?"),i+=o?"$":r&&l?"":"(?="+p+"|$)",q(new RegExp("^"+i,H(n)),e)}function z(t,e,n){return k(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?function(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return q(t,e)}(t,e):k(t)?function(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(z(t[o],e,n).source);return q(new RegExp("(?:"+r.join("|")+")",H(n)),e)}(t,e,n):(r=e,J(N(t,o=n),r,o));var r,o}$.parse=U,$.compile=F,$.tokensToFunction=L,$.tokensToRegExp=I;var G={},Y=1e4,K=0;function Q(t,e){return void 0===t&&(t="/"),void 0===e&&(e={}),"/"===t?t:function(t){if(G[t])return G[t];var e=$.compile(t);return K<Y&&(G[t]=e,K++),e}(t)(e,{pretty:!0})}var X=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,a=n?Symbol.for("react.strict_mode"):60108,c=n?Symbol.for("react.profiler"):60114,u=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,p=n?Symbol.for("react.concurrent_mode"):60111,l=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,h=n?Symbol.for("react.memo"):60115,d=n?Symbol.for("react.lazy"):60116;function m(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case r:switch(t=t.type){case p:case i:case c:case a:return t;default:switch(t=t&&t.$$typeof){case s:case l:case u:return t;default:return e}}case o:return e}}}function y(t){return m(t)===p}e.typeOf=m,e.AsyncMode=p,e.ConcurrentMode=p,e.ContextConsumer=s,e.ContextProvider=u,e.Element=r,e.ForwardRef=l,e.Fragment=i,e.Profiler=c,e.Portal=o,e.StrictMode=a,e.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===i||t===p||t===c||t===a||t===f||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===h||t.$$typeof===u||t.$$typeof===s||t.$$typeof===l)},e.isAsyncMode=function(t){return y(t)},e.isConcurrentMode=y,e.isContextConsumer=function(t){return m(t)===s},e.isContextProvider=function(t){return m(t)===u},e.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===r},e.isForwardRef=function(t){return m(t)===l},e.isFragment=function(t){return m(t)===i},e.isProfiler=function(t){return m(t)===c},e.isPortal=function(t){return m(t)===o},e.isStrictMode=function(t){return m(t)===a}});e(X);X.typeOf,X.AsyncMode,X.ConcurrentMode,X.ContextConsumer,X.ContextProvider,X.Element,X.ForwardRef,X.Fragment,X.Profiler,X.Portal,X.StrictMode,X.isValidElementType,X.isAsyncMode,X.isConcurrentMode,X.isContextConsumer,X.isContextProvider,X.isElement,X.isForwardRef,X.isFragment,X.isProfiler,X.isPortal,X.isStrictMode;var Z=n(function(t,e){});e(Z);Z.typeOf,Z.AsyncMode,Z.ConcurrentMode,Z.ContextConsumer,Z.ContextProvider,Z.Element,Z.ForwardRef,Z.Fragment,Z.Profiler,Z.Portal,Z.StrictMode,Z.isValidElementType,Z.isAsyncMode,Z.isConcurrentMode,Z.isContextConsumer,Z.isContextProvider,Z.isElement,Z.isForwardRef,Z.isFragment,Z.isProfiler,Z.isPortal,Z.isStrictMode;var tt=n(function(t){t.exports=X}),et=(tt.isValidElementType,{}),nt=1e4,rt=0;function ot(s,t){void 0===t&&(t={}),"string"==typeof t&&(t={path:t});var e=t,n=e.path,r=e.exact,p=void 0!==r&&r,o=e.strict,l=void 0!==o&&o,i=e.sensitive,f=void 0!==i&&i;return[].concat(n).reduce(function(t,e){if(!e)return null;if(t)return t;var n=function(t,e){var n=""+e.end+e.strict+e.sensitive,r=et[n]||(et[n]={});if(r[t])return r[t];var o=[],i={regexp:$(t,o,e),keys:o};return rt<nt&&(r[t]=i,rt++),i}(e,{end:p,strict:l,sensitive:f}),r=n.regexp,o=n.keys,i=r.exec(s);if(!i)return null;var a=i[0],c=i.slice(1),u=s===a;return p&&!u?null:{path:e,url:"/"===e&&""===a?"/":a,isExact:u,params:o.reduce(function(t,e,n){return t[e.name]=c[n],t},{})}},null)}var it=function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){var u=this;return s.createElement(j.Consumer,null,function(t){t||y(!1);var e,n=u.props.location||t.location,r=b({},t,{location:n,match:u.props.computedMatch?u.props.computedMatch:u.props.path?ot(n.pathname,u.props):t.match}),o=u.props,i=o.children,a=o.component,c=o.render;return Array.isArray(i)&&0===i.length&&(i=null),"function"==typeof i&&void 0===(i=i(r))&&(i=null),s.createElement(j.Provider,{value:r},i&&(e=i,0!==s.Children.count(e))?i:r.match?a?s.createElement(a,r):c?c(r):null:null)})},e}(s.Component);function at(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],0<=e.indexOf(n)||(o[n]=t[n]);return o}function ct(t){return"/"===t.charAt(0)?t:"/"+t}function ut(t){return"string"==typeof t?t:x(t)}function st(t){return function(){y(!1)}}function pt(){}var lt=function(o){function t(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=o.call.apply(o,[this].concat(n))||this).handlePush=function(t){return e.navigateTo(t,"PUSH")},e.handleReplace=function(t){return e.navigateTo(t,"REPLACE")},e.handleListen=function(){return pt},e.handleBlock=function(){return pt},e}r(t,o);var e=t.prototype;return e.navigateTo=function(t,e){var n,r,o=this.props,i=o.basename,a=void 0===i?"":i,c=o.context,u=void 0===c?{}:c;u.action=e,u.location=(n=a,r=w(t),n?b({},r,{pathname:ct(n)+r.pathname}):r),u.url=ut(u.location)},e.render=function(){var t=this.props,e=t.basename,n=void 0===e?"":e,r=t.context,o=void 0===r?{}:r,i=t.location,a=void 0===i?"/":i,c=at(t,["basename","context","location"]),u={createHref:function(t){return ct(n+ut(t))},action:"POP",location:function(t,e){if(!t)return e;var n=ct(t);return 0!==e.pathname.indexOf(n)?e:b({},e,{pathname:e.pathname.substr(n.length)})}(n,w(a)),push:this.handlePush,replace:this.handleReplace,go:st(),goBack:st(),goForward:st(),listen:this.handleListen,block:this.handleBlock};return s.createElement(M,b({},c,{history:u,staticContext:o}))},t}(s.Component),ft=function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){var t=this;return s.createElement(j.Consumer,null,function(n){n||y(!1);var r,o,i=t.props.location||n.location;return s.Children.forEach(t.props.children,function(t){if(null==o&&s.isValidElement(t)){var e=(r=t).props.path||t.props.from;o=e?ot(i.pathname,b({},t.props,{path:e})):n.match}}),o?s.cloneElement(r,{location:i,computedMatch:o}):null})},e}(s.Component),ht={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},dt={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},mt={};mt[tt.ForwardRef]={$$typeof:!0,render:!0};var yt=Object.defineProperty,vt=Object.getOwnPropertyNames,gt=Object.getOwnPropertySymbols,bt=Object.getOwnPropertyDescriptor,xt=Object.getPrototypeOf,wt=Object.prototype;var Ct=function t(e,n,r){if("string"==typeof n)return e;if(wt){var o=xt(n);o&&o!==wt&&t(e,o,r)}var i=vt(n);gt&&(i=i.concat(gt(n)));for(var a=mt[e.$$typeof]||ht,c=mt[n.$$typeof]||ht,u=0;u<i.length;++u){var s=i[u];if(!(dt[s]||r&&r[s]||c&&c[s]||a&&a[s])){var p=bt(n,s);try{yt(e,s,p)}catch(t){}}}return e};t.MemoryRouter=T,t.Prompt=function(t){var r=t.message,e=t.when,o=void 0===e||e;return s.createElement(j.Consumer,null,function(t){if(t||y(!1),!o||t.staticContext)return null;var n=t.history.block;return s.createElement(A,{onMount:function(t){t.release=n(r)},onUpdate:function(t,e){e.message!==r&&(t.release(),t.release=n(r))},onUnmount:function(t){t.release()},message:r})})},t.Redirect=function(t){var i=t.computedMatch,a=t.to,e=t.push,c=void 0!==e&&e;return s.createElement(j.Consumer,null,function(t){t||y(!1);var e=t.history,n=t.staticContext,r=c?e.push:e.replace,o=w(i?"string"==typeof a?Q(a,i.params):b({},a,{pathname:Q(a.pathname,i.params)}):a);return n?(r(o),null):s.createElement(A,{onMount:function(){r(o)},onUpdate:function(t,e){var n=w(e.to);v(n,b({},o,{key:n.key}))||r(o)},to:a})})},t.Route=it,t.Router=M,t.StaticRouter=lt,t.Switch=ft,t.generatePath=Q,t.matchPath=ot,t.withRouter=function(r){var t="withRouter("+(r.displayName||r.name)+")",e=function(t){var e=t.wrappedComponentRef,n=at(t,["wrappedComponentRef"]);return s.createElement(j.Consumer,null,function(t){return t||y(!1),s.createElement(r,b({},n,t,{ref:e}))})};return e.displayName=t,e.WrappedComponent=r,Ct(e,r)},t.__RouterContext=j,Object.defineProperty(t,"__esModule",{value:!0})});
|