import t from"./react.js";import{p as e}from"./common/index-3cf0d11f.js";var n=function(){};function o(){return(o=Object.assign||function(t){for(var e=1;e=0;f--){var h=a[f];"."===h?i(a,f):".."===h?(i(a,f),l++):l&&(i(a,f),l--)}if(!u)for(;l--;l)a.unshift("..");!u||""===a[0]||a[0]&&r(a[0])||a.unshift("");var y=a.join("/");return n&&"/"!==y.substr(-1)&&(y+="/"),y}(c.pathname,a.pathname)):c.pathname=a.pathname:c.pathname||(c.pathname="/"),c}function y(t,e){return t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&function t(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(Array.isArray(e))return Array.isArray(n)&&e.length===n.length&&e.every((function(e,o){return t(e,n[o])}));if("object"==typeof e||"object"==typeof n){var o=a(e),r=a(n);return o!==e||r!==n?t(o,r):Object.keys(Object.assign({},e,n)).every((function(o){return t(e[o],n[o])}))}return!1}(t.state,e.state)}function d(){var t=null;var e=[];return{setPrompt:function(e){return t=e,function(){t===e&&(t=null)}},confirmTransitionTo:function(e,n,o,r){if(null!=t){var i="function"==typeof t?t(e,n):t;"string"==typeof i?"function"==typeof o?o(i,r):r(!0):r(!1!==i)}else r(!0)},appendListener:function(t){var n=!0;function o(){n&&t.apply(void 0,arguments)}return e.push(o),function(){n=!1,e=e.filter((function(t){return t!==o}))}},notifyListeners:function(){for(var t=arguments.length,n=new Array(t),o=0;oe?n.splice(e,n.length-e,o):n.push(o),l({action:"PUSH",location:o,index:e,entries:n})}}))},replace:function(t,e){var o=h(t,e,y(),w.location);p.confirmTransitionTo(o,"REPLACE",n,(function(t){t&&(w.entries[w.index]=o,l({action:"REPLACE",location:o}))}))},go:g,goBack:function(){g(-1)},goForward:function(){g(1)},canGo:function(t){var e=w.index+t;return e>=0&&e may have only one child element"),this.unlisten=r.listen((function(){e.setState({match:e.computeMatch(r.location.pathname)})}))},o.prototype.componentWillReceiveProps=function(t){n(this.props.history===t.history)},o.prototype.componentWillUnmount=function(){this.unlisten()},o.prototype.render=function(){var e=this.props.children;return e?t.Children.only(e):null},o}(t.Component);S.propTypes={history:e.object.isRequired,children:e.node},S.contextTypes={router:e.object},S.childContextTypes={router:e.object.isRequired};var _=S;function L(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function M(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}var q=function(e){function o(){var t,n;L(this,o);for(var r=arguments.length,i=Array(r),a=0;a=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}(e,["replace","to","innerRef"]);T(this.context.router,"You should not use outside a "),T(void 0!==n,'You must specify the "to" property');var i=this.context.router.history,a="string"==typeof n?h(n,null,null,i.location):n,c=i.createHref(a);return t.createElement("a",$({},r,{onClick:this.handleClick,href:c,ref:o}))},n}(t.Component);D.propTypes={onClick:e.func,target:e.string,replace:e.bool,to:e.oneOfType([e.string,e.object]).isRequired,innerRef:e.oneOfType([e.string,e.func])},D.defaultProps={replace:!1},D.contextTypes={router:e.shape({history:e.shape({push:e.func.isRequired,replace:e.func.isRequired,createHref:e.func.isRequired}).isRequired}).isRequired};var K=D;function J(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function V(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}var G=function(e){function o(){var t,n;J(this,o);for(var r=arguments.length,i=Array(r),a=0;a1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];"string"==typeof e&&(e={path:e});var o=e,r=o.path,i=o.exact,a=void 0!==i&&i,c=o.strict,s=void 0!==c&&c,u=o.sensitive,p=void 0!==u&&u;if(null==r)return n;var l=dt(r,{end:a,strict:s,sensitive:p}),f=l.re,h=l.keys,y=f.exec(t);if(!y)return null;var d=y[0],v=y.slice(1),m=t===d;return a&&!m?null:{path:r,url:"/"===r&&""===d?"/":d,isExact:m,params:h.reduce((function(t,e,n){return t[e.name]=v[n],t}),{})}},mt=Object.assign||function(t){for(var e=1;e or withRouter() outside a ");var s=e.route,u=(o||s.location).pathname;return vt(u,{path:r,strict:i,exact:a,sensitive:c},s.match)},o.prototype.componentWillMount=function(){n(!(this.props.component&&this.props.render)),n(!(this.props.component&&this.props.children&&!wt(this.props.children))),n(!(this.props.render&&this.props.children&&!wt(this.props.children)))},o.prototype.componentWillReceiveProps=function(t,e){n(!(t.location&&!this.props.location)),n(!(!t.location&&this.props.location)),this.setState({match:this.computeMatch(t,e.router)})},o.prototype.render=function(){var e=this.state.match,n=this.props,o=n.children,r=n.component,i=n.render,a=this.context.router,c=a.history,s=a.route,u=a.staticContext,p={match:e,location:this.props.location||s.location,history:c,staticContext:u};return r?e?t.createElement(r,p):null:i?e?i(p):null:"function"==typeof o?o(p):o&&!wt(o)?t.Children.only(o):null},o}(t.Component);Ot.propTypes={computedMatch:e.object,path:e.string,exact:e.bool,strict:e.bool,sensitive:e.bool,component:e.func,render:e.func,children:e.oneOfType([e.func,e.node]),location:e.object},Ot.contextTypes={router:e.shape({history:e.object.isRequired,route:e.object.isRequired,staticContext:e.object})},Ot.childContextTypes={router:e.object.isRequired};var xt=Ot,Pt=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}(e,["to","exact","strict","location","activeClassName","className","activeStyle","style","isActive","aria-current"]),h="object"===(void 0===n?"undefined":jt(n))?n.pathname:n,y=h&&h.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1");return t.createElement(xt,{path:y,exact:o,strict:r,location:i,children:function(e){var o=e.location,r=e.match,i=!!(p?p(r,o):r);return t.createElement(K,Pt({to:n,className:i?[c,a].filter((function(t){return t})).join(" "):c,style:i?Pt({},u,s):u,"aria-current":i&&l||null},f))}})};Et.propTypes={to:K.propTypes.to,exact:e.bool,strict:e.bool,location:e.object,activeClassName:e.string,className:e.string,activeStyle:e.object,style:e.object,isActive:e.func,"aria-current":e.oneOf(["page","step","location","date","time","true"])},Et.defaultProps={activeClassName:"active","aria-current":"page"};var Rt=Et;function Tt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ct(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}var kt=function(t){function e(){return Tt(this,e),Ct(this,t.apply(this,arguments))}return function(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)}(e,t),e.prototype.enable=function(t){this.unblock&&this.unblock(),this.unblock=this.context.router.history.block(t)},e.prototype.disable=function(){this.unblock&&(this.unblock(),this.unblock=null)},e.prototype.componentWillMount=function(){T(this.context.router,"You should not use outside a "),this.props.when&&this.enable(this.props.message)},e.prototype.componentWillReceiveProps=function(t){t.when?this.props.when&&this.props.message===t.message||this.enable(t.message):this.disable()},e.prototype.componentWillUnmount=function(){this.disable()},e.prototype.render=function(){return null},e}(t.Component);kt.propTypes={when:e.bool,message:e.oneOfType([e.func,e.string]).isRequired},kt.defaultProps={when:!0},kt.contextTypes={router:e.shape({history:e.shape({block:e.func.isRequired}).isRequired}).isRequired};var At=kt,St={},_t=0,Lt=function(t){var e=t,n=St[e]||(St[e]={});if(n[t])return n[t];var o=X.compile(t);return _t<1e4&&(n[t]=o,_t++),o},Mt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("/"===t)return t;var n=Lt(t);return n(e,{pretty:!0})},qt=Object.assign||function(t){for(var e=1;e outside a "),this.isStatic()&&this.perform()},e.prototype.componentDidMount=function(){this.isStatic()||this.perform()},e.prototype.componentDidUpdate=function(t){var e=h(t.to),o=h(this.props.to);y(e,o)?n(!1,"You tried to redirect to the same route you're currently on: \""+o.pathname+o.search+'"'):this.perform()},e.prototype.computeTo=function(t){var e=t.computedMatch,n=t.to;return e?"string"==typeof n?Mt(n,e.params):qt({},n,{pathname:Mt(n.pathname,e.params)}):n},e.prototype.perform=function(){var t=this.context.router.history,e=this.props.push,n=this.computeTo(this.props);e?t.push(n):t.replace(n)},e.prototype.render=function(){return null},e}(t.Component);Ht.propTypes={computedMatch:e.object,push:e.bool,from:e.string,to:e.oneOfType([e.string,e.object]).isRequired},Ht.defaultProps={push:!1},Ht.contextTypes={router:e.shape({history:e.shape({push:e.func.isRequired,replace:e.func.isRequired}).isRequired,staticContext:e.object}).isRequired};var Nt=Ht,It=Object.assign||function(t){for(var e=1;e",t)}},Vt=function(){},Gt=function(e){function o(){var t,n;$t(this,o);for(var r=arguments.length,i=Array(r),a=0;a=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}(e,["basename","context","location"]),i={createHref:this.createHref,action:"POP",location:Dt(n,h(o)),push:this.handlePush,replace:this.handleReplace,go:Jt("go"),goBack:Jt("goBack"),goForward:Jt("goForward"),listen:this.handleListen,block:this.handleBlock};return t.createElement(_,It({},r,{history:i}))},o}(t.Component);Gt.propTypes={basename:e.string,context:e.object.isRequired,location:e.oneOfType([e.string,e.object])},Gt.defaultProps={basename:"",location:"/"},Gt.childContextTypes={router:e.object.isRequired};var zt=Gt;function Qt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Xt(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}var Zt=function(e){function o(){return Qt(this,o),Xt(this,e.apply(this,arguments))}return function(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)}(o,e),o.prototype.componentWillMount=function(){T(this.context.router,"You should not use outside a ")},o.prototype.componentWillReceiveProps=function(t){n(!(t.location&&!this.props.location)),n(!(!t.location&&this.props.location))},o.prototype.render=function(){var e=this.context.router.route,n=this.props.children,o=this.props.location||e.location,r=void 0,i=void 0;return t.Children.forEach(n,(function(n){if(null==r&&t.isValidElement(n)){var a=n.props,c=a.path,s=a.exact,u=a.strict,p=a.sensitive,l=a.from,f=c||l;i=n,r=vt(o.pathname,{path:f,exact:s,strict:u,sensitive:p},e.match)}})),r?t.cloneElement(i,{location:o,computedMatch:r}):null},o}(t.Component);Zt.contextTypes={router:e.shape({route:e.object.isRequired}).isRequired},Zt.propTypes={children:e.node,location:e.object};var te=Zt,ee={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},ne={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},oe=Object.defineProperty,re=Object.getOwnPropertyNames,ie=Object.getOwnPropertySymbols,ae=Object.getOwnPropertyDescriptor,ce=Object.getPrototypeOf,se=ce&&ce(Object);var ue=function t(e,n,o){if("string"!=typeof n){if(se){var r=ce(n);r&&r!==se&&t(e,r,o)}var i=re(n);ie&&(i=i.concat(ie(n)));for(var a=0;a=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}(e,["wrappedComponentRef"]);return t.createElement(xt,{children:function(e){return t.createElement(n,pe({},r,e,{ref:o}))}})};return o.displayName="withRouter("+(n.displayName||n.name)+")",o.WrappedComponent=n,o.propTypes={wrappedComponentRef:e.func},ue(o,n)};export{U as BrowserRouter,I as HashRouter,K as Link,z as MemoryRouter,Rt as NavLink,At as Prompt,Nt as Redirect,xt as Route,_ as Router,zt as StaticRouter,te as Switch,Mt as generatePath,vt as matchPath,le as withRouter}; //# sourceMappingURL=react-router-dom.js.map