UNPKG

react-protected-route

Version:
14 lines 24 kB
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=11)}([function(e,t,r){e.exports=r(8)()},function(e,t,r){"use strict";e.exports=function(){}},function(e,t,r){"use strict";e.exports=r(6)},function(e,t,r){"use strict";e.exports=function(e,t,r,n,o,i,u,a){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,o,i,u,a],s=0;(c=new Error(t.replace(/%s/g,function(){return l[s++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}}},function(e,t,r){"use strict";var n=function(){};e.exports=n},function(e,t,r){var n=r(10);e.exports=h,e.exports.parse=i,e.exports.compile=function(e,t){return a(i(e,t))},e.exports.tokensToFunction=a,e.exports.tokensToRegExp=f;var o=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function i(e,t){for(var r,n=[],i=0,u=0,a="",s=t&&t.delimiter||"/";null!=(r=o.exec(e));){var p=r[0],f=r[1],h=r.index;if(a+=e.slice(u,h),u=h+p.length,f)a+=f[1];else{var y=e[u],d=r[2],m=r[3],v=r[4],b=r[5],g=r[6],O=r[7];a&&(n.push(a),a="");var w=null!=d&&null!=y&&y!==d,x="+"===g||"*"===g,j="?"===g||"*"===g,S=r[2]||s,_=v||b;n.push({name:m||i++,prefix:d||"",delimiter:S,optional:j,repeat:x,partial:w,asterisk:!!O,pattern:_?l(_):O?".*":"[^"+c(S)+"]+?"})}}return u<e.length&&(a+=e.substr(u)),a&&n.push(a),n}function u(e){return encodeURI(e).replace(/[\/?#]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}function a(e){for(var t=new Array(e.length),r=0;r<e.length;r++)"object"==typeof e[r]&&(t[r]=new RegExp("^(?:"+e[r].pattern+")$"));return function(r,o){for(var i="",a=r||{},c=(o||{}).pretty?u:encodeURIComponent,l=0;l<e.length;l++){var s=e[l];if("string"!=typeof s){var p,f=a[s.name];if(null==f){if(s.optional){s.partial&&(i+=s.prefix);continue}throw new TypeError('Expected "'+s.name+'" to be defined')}if(n(f)){if(!s.repeat)throw new TypeError('Expected "'+s.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(s.optional)continue;throw new TypeError('Expected "'+s.name+'" to not be empty')}for(var h=0;h<f.length;h++){if(p=c(f[h]),!t[l].test(p))throw new TypeError('Expected all "'+s.name+'" to match "'+s.pattern+'", but received `'+JSON.stringify(p)+"`");i+=(0===h?s.prefix:s.delimiter)+p}}else{if(p=s.asterisk?encodeURI(f).replace(/[?#]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}):c(f),!t[l].test(p))throw new TypeError('Expected "'+s.name+'" to match "'+s.pattern+'", but received "'+p+'"');i+=s.prefix+p}}else i+=s}return i}}function c(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function l(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function s(e,t){return e.keys=t,e}function p(e){return e.sensitive?"":"i"}function f(e,t,r){n(t)||(r=t||r,t=[]);for(var o=(r=r||{}).strict,i=!1!==r.end,u="",a=0;a<e.length;a++){var l=e[a];if("string"==typeof l)u+=c(l);else{var f=c(l.prefix),h="(?:"+l.pattern+")";t.push(l),l.repeat&&(h+="(?:"+f+h+")*"),u+=h=l.optional?l.partial?f+"("+h+")?":"(?:"+f+"("+h+"))?":f+"("+h+")"}}var y=c(r.delimiter||"/"),d=u.slice(-y.length)===y;return o||(u=(d?u.slice(0,-y.length):u)+"(?:"+y+"(?=$))?"),u+=i?"$":o&&d?"":"(?="+y+"|$)",s(new RegExp("^"+u,p(r)),t)}function h(e,t,r){return n(t)||(r=t||r,t=[]),r=r||{},e instanceof RegExp?function(e,t){var r=e.source.match(/\((?!\?)/g);if(r)for(var n=0;n<r.length;n++)t.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return s(e,t)}(e,t):n(e)?function(e,t,r){for(var n=[],o=0;o<e.length;o++)n.push(h(e[o],t,r).source);return s(new RegExp("(?:"+n.join("|")+")",p(r)),t)}(e,t,r):function(e,t,r){return f(i(e,r),t,r)}(e,t,r)}},function(e,t,r){"use strict"; /** @license React v16.7.0 * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var n=r(7),o="function"==typeof Symbol&&Symbol.for,i=o?Symbol.for("react.element"):60103,u=o?Symbol.for("react.portal"):60106,a=o?Symbol.for("react.fragment"):60107,c=o?Symbol.for("react.strict_mode"):60108,l=o?Symbol.for("react.profiler"):60114,s=o?Symbol.for("react.provider"):60109,p=o?Symbol.for("react.context"):60110,f=o?Symbol.for("react.concurrent_mode"):60111,h=o?Symbol.for("react.forward_ref"):60112,y=o?Symbol.for("react.suspense"):60113,d=o?Symbol.for("react.memo"):60115,m=o?Symbol.for("react.lazy"):60116,v="function"==typeof Symbol&&Symbol.iterator;function b(e){for(var t=arguments.length-1,r="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=0;n<t;n++)r+="&args[]="+encodeURIComponent(arguments[n+1]);!function(e,t,r,n,o,i,u,a){if(!e){if(e=void 0,void 0===t)e=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,i,u,a],l=0;(e=Error(t.replace(/%s/g,function(){return c[l++]}))).name="Invariant Violation"}throw e.framesToPop=1,e}}(!1,"Minified React error #"+e+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",r)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},O={};function w(e,t,r){this.props=e,this.context=t,this.refs=O,this.updater=r||g}function x(){}function j(e,t,r){this.props=e,this.context=t,this.refs=O,this.updater=r||g}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&b("85"),this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},x.prototype=w.prototype;var S=j.prototype=new x;S.constructor=j,n(S,w.prototype),S.isPureReactComponent=!0;var _={current:null,currentDispatcher:null},R=Object.prototype.hasOwnProperty,E={key:!0,ref:!0,__self:!0,__source:!0};function P(e,t,r){var n=void 0,o={},u=null,a=null;if(null!=t)for(n in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(u=""+t.key),t)R.call(t,n)&&!E.hasOwnProperty(n)&&(o[n]=t[n]);var c=arguments.length-2;if(1===c)o.children=r;else if(1<c){for(var l=Array(c),s=0;s<c;s++)l[s]=arguments[s+2];o.children=l}if(e&&e.defaultProps)for(n in c=e.defaultProps)void 0===o[n]&&(o[n]=c[n]);return{$$typeof:i,type:e,key:u,ref:a,props:o,_owner:_.current}}function k(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var T=/\/+/g,C=[];function $(e,t,r,n){if(C.length){var o=C.pop();return o.result=e,o.keyPrefix=t,o.func=r,o.context=n,o.count=0,o}return{result:e,keyPrefix:t,func:r,context:n,count:0}}function A(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>C.length&&C.push(e)}function M(e,t,r){return null==e?0:function e(t,r,n,o){var a=typeof t;"undefined"!==a&&"boolean"!==a||(t=null);var c=!1;if(null===t)c=!0;else switch(a){case"string":case"number":c=!0;break;case"object":switch(t.$$typeof){case i:case u:c=!0}}if(c)return n(o,t,""===r?"."+q(t,0):r),1;if(c=0,r=""===r?".":r+":",Array.isArray(t))for(var l=0;l<t.length;l++){var s=r+q(a=t[l],l);c+=e(a,s,n,o)}else if(s=null===t||"object"!=typeof t?null:"function"==typeof(s=v&&t[v]||t["@@iterator"])?s:null,"function"==typeof s)for(t=s.call(t),l=0;!(a=t.next()).done;)c+=e(a=a.value,s=r+q(a,l++),n,o);else"object"===a&&b("31","[object Object]"==(n=""+t)?"object with keys {"+Object.keys(t).join(", ")+"}":n,"");return c}(e,"",t,r)}function q(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}(e.key):t.toString(36)}function I(e,t){e.func.call(e.context,t,e.count++)}function U(e,t,r){var n=e.result,o=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?Y(e,n,r,function(e){return e}):null!=e&&(k(e)&&(e=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,o+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(T,"$&/")+"/")+r)),n.push(e))}function Y(e,t,r,n,o){var i="";null!=r&&(i=(""+r).replace(T,"$&/")+"/"),M(e,U,t=$(t,i,n,o)),A(t)}var N={Children:{map:function(e,t,r){if(null==e)return e;var n=[];return Y(e,n,null,t,r),n},forEach:function(e,t,r){if(null==e)return e;M(e,I,t=$(null,null,t,r)),A(t)},count:function(e){return M(e,function(){return null},null)},toArray:function(e){var t=[];return Y(e,t,null,function(e){return e}),t},only:function(e){return k(e)||b("143"),e}},createRef:function(){return{current:null}},Component:w,PureComponent:j,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:p,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:h,render:e}},lazy:function(e){return{$$typeof:m,_ctor:e,_status:-1,_result:null}},memo:function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},Fragment:a,StrictMode:c,Suspense:y,createElement:P,cloneElement:function(e,t,r){null==e&&b("267",e);var o=void 0,u=n({},e.props),a=e.key,c=e.ref,l=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,l=_.current),void 0!==t.key&&(a=""+t.key);var s=void 0;for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)R.call(t,o)&&!E.hasOwnProperty(o)&&(u[o]=void 0===t[o]&&void 0!==s?s[o]:t[o])}if(1===(o=arguments.length-2))u.children=r;else if(1<o){s=Array(o);for(var p=0;p<o;p++)s[p]=arguments[p+2];u.children=s}return{$$typeof:i,type:e.type,key:a,ref:c,props:u,_owner:l}},createFactory:function(e){var t=P.bind(null,e);return t.type=e,t},isValidElement:k,version:"16.7.0",unstable_ConcurrentMode:f,unstable_Profiler:l,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:_,assign:n}},D={default:N},F=D&&N||D;e.exports=F.default||F},function(e,t,r){"use strict"; /* object-assign (c) Sindre Sorhus @license MIT */var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,u,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var l in r=Object(arguments[c]))o.call(r,l)&&(a[l]=r[l]);if(n){u=n(r);for(var s=0;s<u.length;s++)i.call(r,u[s])&&(a[u[s]]=r[u[s]])}}return a}},function(e,t,r){"use strict";var n=r(9);function o(){}e.exports=function(){function e(e,t,r,o,i,u){if(u!==n){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 t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=o,r.PropTypes=r,r}},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},function(e,t,r){"use strict";r.r(t);var n=r(2),o=r.n(n),i=r(4),u=r.n(i),a=r(3),c=r.n(a),l=r(0),s=r.n(l),p=r(5),f=r.n(p),h={},y=0,d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];"string"==typeof t&&(t={path:t});var n=t,o=n.path,i=n.exact,u=void 0!==i&&i,a=n.strict,c=void 0!==a&&a,l=n.sensitive;if(null==o)return r;var s=function(e,t){var r=""+t.end+t.strict+t.sensitive,n=h[r]||(h[r]={});if(n[e])return n[e];var o=[],i={re:f()(e,o,t),keys:o};return y<1e4&&(n[e]=i,y++),i}(o,{end:u,strict:c,sensitive:void 0!==l&&l}),p=s.re,d=s.keys,m=p.exec(e);if(!m)return null;var v=m[0],b=m.slice(1),g=e===v;return u&&!g?null:{path:o,url:"/"===o&&""===v?"/":v,isExact:g,params:d.reduce(function(e,t,r){return e[t.name]=b[r],e},{})}},m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function v(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var b=function(e){return 0===o.a.Children.count(e)},g=function(e){function t(){var r,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,i=Array(o),u=0;u<o;u++)i[u]=arguments[u];return r=n=v(this,e.call.apply(e,[this].concat(i))),n.state={match:n.computeMatch(n.props,n.context.router)},v(n,r)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.getChildContext=function(){return{router:m({},this.context.router,{route:{location:this.props.location||this.context.router.route.location,match:this.state.match}})}},t.prototype.computeMatch=function(e,t){var r=e.computedMatch,n=e.location,o=e.path,i=e.strict,u=e.exact,a=e.sensitive;if(r)return r;c()(t,"You should not use <Route> or withRouter() outside a <Router>");var l=t.route,s=(n||l.location).pathname;return d(s,{path:o,strict:i,exact:u,sensitive:a},l.match)},t.prototype.componentWillMount=function(){u()(!(this.props.component&&this.props.render),"You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored"),u()(!(this.props.component&&this.props.children&&!b(this.props.children)),"You should not use <Route component> and <Route children> in the same route; <Route children> will be ignored"),u()(!(this.props.render&&this.props.children&&!b(this.props.children)),"You should not use <Route render> and <Route children> in the same route; <Route children> will be ignored")},t.prototype.componentWillReceiveProps=function(e,t){u()(!(e.location&&!this.props.location),'<Route> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),u()(!(!e.location&&this.props.location),'<Route> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'),this.setState({match:this.computeMatch(e,t.router)})},t.prototype.render=function(){var e=this.state.match,t=this.props,r=t.children,n=t.component,i=t.render,u=this.context.router,a=u.history,c=u.route,l=u.staticContext,s={match:e,location:this.props.location||c.location,history:a,staticContext:l};return n?e?o.a.createElement(n,s):null:i?e?i(s):null:"function"==typeof r?r(s):r&&!b(r)?o.a.Children.only(r):null},t}(o.a.Component);g.propTypes={computedMatch:s.a.object,path:s.a.string,exact:s.a.bool,strict:s.a.bool,sensitive:s.a.bool,component:s.a.func,render:s.a.func,children:s.a.oneOfType([s.a.func,s.a.node]),location:s.a.object},g.contextTypes={router:s.a.shape({history:s.a.object.isRequired,route:s.a.object.isRequired,staticContext:s.a.object})},g.childContextTypes={router:s.a.object.isRequired};var O=g;r(1);function w(e){return"/"===e.charAt(0)}function x(e,t){for(var r=t,n=r+1,o=e.length;n<o;r+=1,n+=1)e[r]=e[n];e.pop()}var j=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e&&e.split("/")||[],n=t&&t.split("/")||[],o=e&&w(e),i=t&&w(t),u=o||i;if(e&&w(e)?n=r:r.length&&(n.pop(),n=n.concat(r)),!n.length)return"/";var a=void 0;if(n.length){var c=n[n.length-1];a="."===c||".."===c||""===c}else a=!1;for(var l=0,s=n.length;s>=0;s--){var p=n[s];"."===p?x(n,s):".."===p?(x(n,s),l++):l&&(x(n,s),l--)}if(!u)for(;l--;l)n.unshift("..");!u||""===n[0]||n[0]&&w(n[0])||n.unshift("");var f=n.join("/");return a&&"/"!==f.substr(-1)&&(f+="/"),f},S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var _=function e(t,r){if(t===r)return!0;if(null==t||null==r)return!1;if(Array.isArray(t))return Array.isArray(r)&&t.length===r.length&&t.every(function(t,n){return e(t,r[n])});var n=void 0===t?"undefined":S(t);if(n!==(void 0===r?"undefined":S(r)))return!1;if("object"===n){var o=t.valueOf(),i=r.valueOf();if(o!==t||i!==r)return e(o,i);var u=Object.keys(t),a=Object.keys(r);return u.length===a.length&&u.every(function(n){return e(t[n],r[n])})}return!1},R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},E=function(e,t,r,n){var o=void 0;"string"==typeof e?(o=function(e){var t=e||"/",r="",n="",o=t.indexOf("#");-1!==o&&(n=t.substr(o),t=t.substr(0,o));var i=t.indexOf("?");return-1!==i&&(r=t.substr(i),t=t.substr(0,i)),{pathname:t,search:"?"===r?"":r,hash:"#"===n?"":n}}(e)).state=t:(void 0===(o=R({},e)).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!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return r&&(o.key=r),n?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=j(o.pathname,n.pathname)):o.pathname=n.pathname:o.pathname||(o.pathname="/"),o},P=function(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&_(e.state,t.state)},k=("undefined"==typeof window||!window.document||window.document.createElement,"function"==typeof Symbol&&Symbol.iterator,Object.assign,Object.assign,"function"==typeof Symbol&&Symbol.iterator,Object.assign,{}),T=0,C=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"/"===e?e:function(e){var t=e,r=k[t]||(k[t]={});if(r[e])return r[e];var n=f.a.compile(e);return T<1e4&&(r[e]=n,T++),n}(e)(t,{pretty:!0})},$=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};var A=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.isStatic=function(){return this.context.router&&this.context.router.staticContext},t.prototype.componentWillMount=function(){c()(this.context.router,"You should not use <Redirect> outside a <Router>"),this.isStatic()&&this.perform()},t.prototype.componentDidMount=function(){this.isStatic()||this.perform()},t.prototype.componentDidUpdate=function(e){var t=E(e.to),r=E(this.props.to);P(t,r)?u()(!1,"You tried to redirect to the same route you're currently on: \""+r.pathname+r.search+'"'):this.perform()},t.prototype.computeTo=function(e){var t=e.computedMatch,r=e.to;return t?"string"==typeof r?C(r,t.params):$({},r,{pathname:C(r.pathname,t.params)}):r},t.prototype.perform=function(){var e=this.context.router.history,t=this.props.push,r=this.computeTo(this.props);t?e.push(r):e.replace(r)},t.prototype.render=function(){return null},t}(o.a.Component);A.propTypes={computedMatch:s.a.object,push:s.a.bool,from:s.a.string,to:s.a.oneOfType([s.a.string,s.a.object]).isRequired},A.defaultProps={push:!1},A.contextTypes={router:s.a.shape({history:s.a.shape({push:s.a.func.isRequired,replace:s.a.func.isRequired}).isRequired,staticContext:s.a.object}).isRequired};var M=A;function q(e){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(){return(I=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function U(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function N(e,t){return!t||"object"!==q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var L=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),N(this,D(t).apply(this,arguments))}var r,i,u;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&F(e,t)}(t,n["Component"]),r=t,(i=[{key:"render",value:function(){var e=this.props,t=e.isAuthenticated,r=e.redirectTo,n=e.component,i=U(e,["isAuthenticated","redirectTo","component"]);return o.a.createElement(O,I({},i,{render:function(e){return t?o.a.createElement(n,e):o.a.createElement(M,{to:r})}}))}}])&&Y(r.prototype,i),u&&Y(r,u),t}();V(L,"propTypes",{isAuthenticated:s.a.bool,redirectTo:s.a.string,component:s.a.oneOfType([s.a.string,s.a.func])}),V(L,"defaultProps",{isAuthenticated:!1,redirectTo:"/"});var W=L;t.default=W}]);