redux-first-router
Version:
think of your app in states not routes (and, yes, while keeping the address bar in sync)
1 lines • 31.5 kB
JavaScript
!function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports.ReduxFirstRouter=e():t.ReduxFirstRouter=e()}(window,function(){return function(n){var r={};function o(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}return o.m=n,o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=13)}([function(t,e,n){"use strict";e.__esModule=!0;e.addLeadingSlash=function(t){return"/"===t.charAt(0)?t:"/"+t},e.stripLeadingSlash=function(t){return"/"===t.charAt(0)?t.substr(1):t};var r=e.hasBasename=function(t,e){return new RegExp("^"+e+"(\\/|\\?|#|$)","i").test(t)};e.stripBasename=function(t,e){return r(t,e)?t.substr(e.length):t},e.stripTrailingSlash=function(t){return"/"===t.charAt(t.length-1)?t.slice(0,-1):t},e.parsePath=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}},e.createPath=function(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(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.compileParamsToPath=e.compilePath=void 0;var r,o=n(11),f=(r=o)&&r.__esModule?r:{default:r};var s={},d=0,m=e.compilePath=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.end,r=void 0===n||n,o=e.strict,i=(r?"t":"f")+(void 0!==o&&o?"t":"f"),a=s[i]||(s[i]={});if(a[t])return a[t];var u=[],c={re:(0,f.default)(t,u,e),keys:u};return d<1e4&&(a[t]=c,d++),c},i={};e.compileParamsToPath=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i[t]||f.default.compile(t);return(i[t]=n)(e)};e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"===typeof e&&(e={path:e,exact:!1,strict:!1});var n=e,r=n.path,o=void 0===r?"/":r,i=n.exact,a=void 0!==i&&i,u=n.strict,c=m(o,{end:a,strict:void 0!==u&&u}),f=c.re,s=c.keys,d=f.exec(t);if(!d)return null;var l,p=(l=d,Array.isArray(l)?l:Array.from(l)),h=p[0],v=p.slice(1),y=t===h;return a&&!y?null:{path:o,url:"/"===o&&""===h?"/":h,isExact:y,params:s.reduce(function(t,e,n){return t[e.name]=v[n],t},{})}}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";t.exports=function(t,e,n,r,o,i,a,u){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,o,i,a,u],s=0;(c=new Error(e.replace(/%s/g,function(){return f[s++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}}},function(t,e,n){"use strict";e.__esModule=!0,e.locationsAreEqual=e.createLocation=void 0;var i=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},a=o(n(8)),r=o(n(9)),u=n(0);function o(t){return t&&t.__esModule?t:{default:t}}e.createLocation=function(t,e,n,r){var o=void 0;"string"===typeof t?(o=(0,u.parsePath)(t)).state=e:(void 0===(o=i({},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=(0,a.default)(o.pathname,r.pathname)):o.pathname=r.pathname:o.pathname||(o.pathname="/"),o},e.locationsAreEqual=function(t,e){return t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&(0,r.default)(t.state,e.state)}},function(t,e,n){"use strict";e.__esModule=!0;var r,o=n(2),a=(r=o)&&r.__esModule?r:{default:r};e.default=function(){var i=null,r=[];return{setPrompt:function(t){return(0,a.default)(null==i,"A history supports only one prompt at a time"),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):((0,a.default)(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),r(!0)):r(!1!==o)}else r(!0)},appendListener:function(t){var e=!0,n=function(){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=Array(t),n=0;n<t;n++)e[n]=arguments[n];r.forEach(function(t){return t.apply(void 0,e)})}}}},function(t,e,n){"use strict";e.__esModule=!0;var L="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},T=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},A=r(n(2)),_=r(n(3)),R=n(4),M=n(0),C=r(n(5)),U=n(10);function r(t){return t&&t.__esModule?t:{default:t}}var q="popstate",B="hashchange",F=function(){try{return window.history.state||{}}catch(t){return{}}};e.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,_.default)(U.canUseDOM,"Browser history needs a DOM");var u=window.history,c=(0,U.supportsHistory)(),e=!(0,U.supportsPopStateOnHashChange)(),n=t.forceRefresh,f=void 0!==n&&n,r=t.getUserConfirmation,o=void 0===r?U.getConfirmation:r,i=t.keyLength,a=void 0===i?6:i,s=t.basename?(0,M.stripTrailingSlash)((0,M.addLeadingSlash)(t.basename)):"",d=function(t){var e=t||{},n=e.key,r=e.state,o=window.location,i=o.pathname+o.search+o.hash;return(0,A.default)(!s||(0,M.hasBasename)(i,s),'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "'+i+'" to begin with "'+s+'".'),s&&(i=(0,M.stripBasename)(i,s)),(0,R.createLocation)(i,r,n)},l=function(){return Math.random().toString(36).substr(2,a)},p=(0,C.default)(),h=function(t){T(E,t),E.length=u.length,p.notifyListeners(E.location,E.action)},v=function(t){(0,U.isExtraneousPopstateEvent)(t)||g(d(t.state))},y=function(){g(d(F()))},m=!1,g=function(e){m?(m=!1,h()):p.confirmTransitionTo(e,"POP",o,function(t){t?h({action:"POP",location:e}):b(e)})},b=function(t){var e=E.location,n=x.indexOf(e.key);-1===n&&(n=0);var r=x.indexOf(t.key);-1===r&&(r=0);var o=n-r;o&&(m=!0,O(o))},w=d(F()),x=[w.key],S=function(t){return s+(0,M.createPath)(t)},O=function(t){u.go(t)},k=0,P=function(t){1===(k+=t)?((0,U.addEventListener)(window,q,v),e&&(0,U.addEventListener)(window,B,y)):0===k&&((0,U.removeEventListener)(window,q,v),e&&(0,U.removeEventListener)(window,B,y))},j=!1,E={length:u.length,action:"POP",location:w,createHref:S,push:function(t,e){(0,A.default)(!("object"===("undefined"===typeof t?"undefined":L(t))&&void 0!==t.state&&void 0!==e),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var a=(0,R.createLocation)(t,e,l(),E.location);p.confirmTransitionTo(a,"PUSH",o,function(t){if(t){var e=S(a),n=a.key,r=a.state;if(c)if(u.pushState({key:n,state:r},null,e),f)window.location.href=e;else{var o=x.indexOf(E.location.key),i=x.slice(0,-1===o?0:o+1);i.push(a.key),x=i,h({action:"PUSH",location:a})}else(0,A.default)(void 0===r,"Browser history cannot push state in browsers that do not support HTML5 history"),window.location.href=e}})},replace:function(t,e){(0,A.default)(!("object"===("undefined"===typeof t?"undefined":L(t))&&void 0!==t.state&&void 0!==e),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var i="REPLACE",a=(0,R.createLocation)(t,e,l(),E.location);p.confirmTransitionTo(a,i,o,function(t){if(t){var e=S(a),n=a.key,r=a.state;if(c)if(u.replaceState({key:n,state:r},null,e),f)window.location.replace(e);else{var o=x.indexOf(E.location.key);-1!==o&&(x[o]=a.key),h({action:i,location:a})}else(0,A.default)(void 0===r,"Browser history cannot replace state in browsers that do not support HTML5 history"),window.location.replace(e)}})},go:O,goBack:function(){return O(-1)},goForward:function(){return O(1)},block:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=p.setPrompt(t);return j||(P(1),j=!0),function(){return j&&(j=!1,P(-1)),e()}},listen:function(t){var e=p.appendListener(t);return P(1),function(){P(-1),e()}}};return E}},function(t,e,n){"use strict";e.__esModule=!0;var g="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},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},w=o(n(2)),r=o(n(3)),x=n(0),S=n(4),O=o(n(5));function o(t){return t&&t.__esModule?t:{default:t}}var k=function(t,e,n){return Math.min(Math.max(t,e),n)},i=!("undefined"===typeof window||"undefined"===typeof window.confirm),P=function(t,e){return(0,r.default)(i,"Environment needs a window + window.confirm function. You can provideyour own confirmation UI via the getUserConfirmation option."),e(window.confirm(t))};e.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.getUserConfirmation,o=void 0===e?P:e,n=t.initialEntries,r=void 0===n?["/"]:n,i=t.initialIndex,a=void 0===i?0:i,u=t.keyLength,c=void 0===u?6:u,f=t.basename?(0,x.stripTrailingSlash)((0,x.addLeadingSlash)(t.basename)):"",s=(0,O.default)(),d=function(t){b(m,t),m.length=m.entries.length,s.notifyListeners(m.location,m.action)},l=function(){return Math.random().toString(36).substr(2,c)},p=k(a,0,r.length-1),h=function(t){return f?(0,x.stripBasename)(t,f):t},v=r.map(function(t){return"string"===typeof t?(0,S.createLocation)(h(t),void 0,l()):(0,S.createLocation)(h(t),void 0,t.key||l())}),y=function(t){var e=k(m.index+t,0,m.entries.length-1),n=m.entries[e];s.confirmTransitionTo(n,"POP",o,function(t){t?d({action:"POP",location:n,index:e}):d()})},m={length:v.length,action:"POP",location:v[p],index:p,entries:v,createHref:function(t){return f+(0,x.createPath)(t)},push:function(t,e){(0,w.default)(!("object"===("undefined"===typeof t?"undefined":g(t))&&void 0!==t.state&&void 0!==e),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var r=(0,S.createLocation)(h(t),e,l(),m.location);s.confirmTransitionTo(r,"PUSH",o,function(t){if(t){var e=m.index+1,n=m.entries.slice(0);n.length>e?n.splice(e,n.length-e,r):n.push(r),d({action:"PUSH",location:r,index:e,entries:n})}})},replace:function(t,e){(0,w.default)(!("object"===("undefined"===typeof t?"undefined":g(t))&&void 0!==t.state&&void 0!==e),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var n="REPLACE",r=(0,S.createLocation)(h(t),e,l(),m.location);s.confirmTransitionTo(r,n,o,function(t){t&&(m.entries[m.index]=r,d({action:n,location:r}))})},go:y,goBack:function(){return y(-1)},goForward:function(){return y(1)},canGo:function(t){var e=m.index+t;return e>=0&&e<m.entries.length},block:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return s.setPrompt(t)},listen:function(t){return s.appendListener(t)}};return m}},function(t,e,n){"use strict";function p(t){return"/"===t.charAt(0)}function h(t,e){for(var n=e,r=n+1,o=t.length;r<o;n+=1,r+=1)t[n]=t[r];t.pop()}n.r(e),e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],r=e&&e.split("/")||[],o=t&&p(t),i=e&&p(e),a=o||i;if(t&&p(t)?r=n:n.length&&(r.pop(),r=r.concat(n)),!r.length)return"/";var u=void 0;if(r.length){var c=r[r.length-1];u="."===c||".."===c||""===c}else u=!1;for(var f=0,s=r.length;s>=0;s--){var d=r[s];"."===d?h(r,s):".."===d?(h(r,s),f++):f&&(h(r,s),f--)}if(!a)for(;f--;f)r.unshift("..");!a||""===r[0]||r[0]&&p(r[0])||r.unshift("");var l=r.join("/");return u&&"/"!==l.substr(-1)&&(l+="/"),l}},function(t,e,n){"use strict";n.r(e);var c="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};e.default=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="undefined"===typeof e?"undefined":c(e);if(t!==("undefined"===typeof r?"undefined":c(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),u=Object.keys(r);return a.length===u.length&&a.every(function(t){return n(e[t],r[t])})}},function(t,e,n){"use strict";e.__esModule=!0;e.canUseDOM=!("undefined"===typeof window||!window.document||!window.document.createElement),e.addEventListener=function(t,e,n){return t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)},e.removeEventListener=function(t,e,n){return t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent("on"+e,n)},e.getConfirmation=function(t,e){return e(window.confirm(t))},e.supportsHistory=function(){var t=window.navigator.userAgent;return(-1===t.indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&(window.history&&"pushState"in window.history)},e.supportsPopStateOnHashChange=function(){return-1===window.navigator.userAgent.indexOf("Trident")},e.supportsGoWithoutReloadUsingHash=function(){return-1===window.navigator.userAgent.indexOf("Firefox")},e.isExtraneousPopstateEvent=function(t){return void 0===t.state&&-1===navigator.userAgent.indexOf("CriOS")}},function(t,e,n){var l=n(12);t.exports=u,t.exports.parse=i,t.exports.compile=function(t,e){return r(i(t,e))},t.exports.tokensToFunction=r,t.exports.tokensToRegExp=a;var k=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function i(t,e){for(var n,r,o=[],i=0,a=0,u="",c=e&&e.delimiter||"/";null!=(n=k.exec(t));){var f=n[0],s=n[1],d=n.index;if(u+=t.slice(a,d),a=d+f.length,s)u+=s[1];else{var l=t[a],p=n[2],h=n[3],v=n[4],y=n[5],m=n[6],g=n[7];u&&(o.push(u),u="");var b=null!=p&&null!=l&&l!==p,w="+"===m||"*"===m,x="?"===m||"*"===m,S=n[2]||c,O=v||y;o.push({name:h||i++,prefix:p||"",delimiter:S,optional:x,repeat:w,partial:b,asterisk:!!g,pattern:O?(r=O,r.replace(/([=!:$\/()])/g,"\\$1")):g?".*":"[^"+P(S)+"]+?"})}}return a<t.length&&(u+=t.substr(a)),u&&o.push(u),o}function p(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function r(s){for(var d=new Array(s.length),t=0;t<s.length;t++)"object"===typeof s[t]&&(d[t]=new RegExp("^(?:"+s[t].pattern+")$"));return function(t,e){for(var n="",r=t||{},o=(e||{}).pretty?p:encodeURIComponent,i=0;i<s.length;i++){var a=s[i];if("string"!==typeof a){var u,c=r[a.name];if(null==c){if(a.optional){a.partial&&(n+=a.prefix);continue}throw new TypeError('Expected "'+a.name+'" to be defined')}if(l(c)){if(!a.repeat)throw new TypeError('Expected "'+a.name+'" to not repeat, but received `'+JSON.stringify(c)+"`");if(0===c.length){if(a.optional)continue;throw new TypeError('Expected "'+a.name+'" to not be empty')}for(var f=0;f<c.length;f++){if(u=o(c[f]),!d[i].test(u))throw new TypeError('Expected all "'+a.name+'" to match "'+a.pattern+'", but received `'+JSON.stringify(u)+"`");n+=(0===f?a.prefix:a.delimiter)+u}}else{if(u=a.asterisk?encodeURI(c).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}):o(c),!d[i].test(u))throw new TypeError('Expected "'+a.name+'" to match "'+a.pattern+'", but received "'+u+'"');n+=a.prefix+u}}else n+=a}return n}}function P(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function h(t,e){return t.keys=e,t}function v(t){return t.sensitive?"":"i"}function a(t,e,n){l(e)||(n=e||n,e=[]);for(var r=(n=n||{}).strict,o=!1!==n.end,i="",a=0;a<t.length;a++){var u=t[a];if("string"===typeof u)i+=P(u);else{var c=P(u.prefix),f="(?:"+u.pattern+")";e.push(u),u.repeat&&(f+="(?:"+c+f+")*"),i+=f=u.optional?u.partial?c+"("+f+")?":"(?:"+c+"("+f+"))?":c+"("+f+")"}}var s=P(n.delimiter||"/"),d=i.slice(-s.length)===s;return r||(i=(d?i.slice(0,-s.length):i)+"(?:"+s+"(?=$))?"),i+=o?"$":r&&d?"":"(?="+s+"|$)",h(new RegExp("^"+i,v(n)),e)}function u(t,e,n){return l(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 h(t,e)}(t,e):l(t)?function(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(u(t[o],e,n).source);return h(new RegExp("(?:"+r.join("|")+")",v(n)),e)}(t,e,n):(r=e,a(i(t,o=n),r,o));var r,o}},function(t,e){t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},function(t,e,n){"use strict";n.r(e);var r=n(6),at=n.n(r),o=n(7),ut=n.n(o),ct=n(0),O=n(1),k=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},P="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},ft=function(t,e,n){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:U().basename,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:U().strict,a=t.split("?"),u=a[1],c=u&&n&&n.parse(u),f=(r=e,Object.keys(r).map(function(t){return r[t]})),s=Object.keys(e);t=o?Object(ct.stripBasename)(a[0],o):a[0];for(var d=0,l=void 0,p=void 0;!l&&d<f.length;){var h="string"===typeof f[d]?f[d]:f[d].path;if(h){var v=Object(O.compilePath)(h,{strict:i}),y=v.re,m=v.keys;l=y.exec(t),p=m,d++}else d++}if(l){var g="object"===P(f[--d])&&f[d].capitalizedWords,b="object"===P(f[d])&&f[d].coerceNumbers,w=f[d]&&"function"===typeof f[d].fromPath&&f[d].fromPath,x="object"===P(f[d])&&f[d].meta;return{type:s[d],payload:(p||[]).reduce(function(t,e,n){var r=l&&l[n+1];return"string"===typeof r&&(w?r=w&&w(r,e.name):b&&j(r)?r=parseFloat(r):g&&(r=r.replace(/-/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()}))),t[e.name]=r,t},{}),meta:k({},x?{meta:x}:{},c?{query:c}:{})}}var S=k({notFoundPath:t},c?{query:c}:{});return{type:Ut,payload:{},meta:S}},j=function(t){return/^\d+$/.test(t)},p=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},st=function(t,e,n,r,o){var i=e.type,a=e.payload,u=void 0===a?{}:a,c=e.meta,f=void 0===c?{}:c,s=e.query||f.query||u.query,d=t.split("?"),l=d[1];return p({},e,e.query&&{query:s},{type:i,payload:u,meta:p({},f,f.query&&{query:s},{location:{current:p({pathname:d[0],type:i,payload:u},s&&{query:s,search:l}),prev:n,kind:o,history:void 0}})})},dt=function(t){return t.entries?{index:t.index,length:t.entries.length,entries:t.entries.slice(0)}:void 0},lt=function(t){return!!(t.meta&&t.meta.location&&t.meta.location.current)},pt=function(t){return!!(t&&t.meta&&t.meta.location&&"redirect"===t.meta.location.kind)},ht=function(){return"undefined"===typeof window||!!window.SSRtest},vt=function(t,e,n,r,o){if("undefined"!==typeof window){var i=n.thunk;if("function"===typeof i){var a=r(e()),u=a.kind,c=a.hasSSR;if("load"!==u||"load"===u&&!c||!n.path){var f=i(t,e,o);f&&"function"===typeof f.next&&f.next(M)}}}},yt=function(t){var e=t.pathname,n=t.search;return n?(0!==n.indexOf("?")&&(n="?"+n),""+e+n):e},mt="undefined"!==typeof window&&window.document&&window.document.createElement,i=void 0,s=void 0,gt=void 0,bt=function(){i&&i(),s&&s()},wt=function(t,e){if(!("undefined"!==typeof window&&window.confirm))throw new Error("[rudy] environment requires `displayConfirmLeave` option");e(window.confirm(t))},xt=function(a,u,c,t,f,e){var n=function(t){var e=u.getState(),n=c(e).routesMap,r=t.pathname,o=ft(r,n,f),i=a(e,o);return i||bt(),i};return i=t.block(n),s=e,n},St=function(t,e){gt(t,function(t){t&&bt(),e(t)})},Ot=function(t,e,n,r,o,i,a,u){var c=ft(t,e,i);return o=f(!!r.entries,r,o,a,u),st(t,c,n,0,o)},f=function(t,e,n,r,o){return t&&r&&"pop"===n?a(e,r)?"back":u(e,r,o)?"next":n:n},a=function(t,e){var n=t.entries[t.index+1];return n&&n.pathname===e},u=function(t,e,n){var r=t.entries[t.index-1],o=n===t.length;return r&&r.pathname===e&&o},d="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},kt=function(t,e,n){var r=e[t.type],o="object"===("undefined"===typeof r?"undefined":d(r))?r.path:r,i=l(r,t.payload),a=Object(O.compileParamsToPath)(o,i)||"/",u=t.query||t.meta&&t.meta.query||t.payload&&t.payload.query,c=u&&n&&n.stringify(u);return c?a+"?"+c:a},l=function(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(o).reduce(function(t,e){var n=o[e];return t[e]=c(n,r,e),t},{})},c=function(t,e,n){return"function"===typeof e.toPath?e.toPath(t,n):"string"===typeof t?t.includes("/")?t.split("/"):!0===e.capitalizedWords?t.replace(/ /g,"-").toLowerCase():t:"number"===typeof t?t:void 0},Pt=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},jt=function(t,e,n,r){var o=r.meta&&r.meta.location&&r.meta.location.kind;return o||(t?h(n,e)?(n.index--,"back"):v(n,e)?(n.index++,"next"):"push":"push")},h=function(t,e){var n=t.entries[t.index-1];return n&&n.pathname===e},v=function(t,e){var n=t.entries[t.index+1];return n&&n.pathname===e},Et=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},Lt="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},Tt=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},y=function(){var S=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var e=t.notFoundPath,O=void 0===e?"/not-found":e,n=t.scrollTop,f=void 0!==n&&n,r=t.location,o=t.title,s=t.onBeforeChange,d=t.onAfterChange,l=t.onBackNext,i=t.restoreScroll,a=t.initialDispatch,c=void 0===a||a,k=t.querySerializer,u=t.displayConfirmLeave,P=t.extra;gt=u||wt,(Ct=t).basename&&(t.basename=Object(ct.stripTrailingSlash)(Object(ct.addLeadingSlash)(t.basename)));var p,h,v,y,m,g,b,w,x,j,E,L=mt&&!0?at.a:ut.a,T=t.createHistory||L,A=t.initialEntries||"/",_="string"===typeof A?[A]:A,R=T({basename:t.basename,initialEntries:_,getUserConfirmation:St}),M=yt(R.location),C={pathname:"",type:"",payload:{}},U="function"===typeof r?r:r?function(t){return t[r]}:function(t){return t.location},q="function"===typeof o?o:o?function(t){return t[o]}:function(t){return t.title},B=i&&i(R),F=ft(M,S,k),H=F.type,D=F.payload,N=F.meta,$=(h=N,v=H,y=D,m=S,g=R,Et({search:(p=M).split("?")[1],pathname:p.split("?")[0],type:v,payload:y},h,{prev:{pathname:"",type:"",payload:{}},kind:void 0,history:dt(g),hasSSR:!!ht()||void 0,routesMap:m})),I=$,G={},Y=1,W=(b=$,w=S,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,e=arguments[1],n=(w=t.routesMap||w)[e.type];if(e.type!==Ut&&(!n||e.error||"string"!==typeof n&&!n.path||e.meta.location.current.pathname===t.pathname&&e.meta.location.current.search===t.search&&"load"!==e.meta.location.kind))return!n||e.error||"string"!==typeof n&&!n.path||e.meta.location.current.pathname!==t.pathname||e.meta.location.current.search!==t.search||e.meta.location.kind===t.kind?e.type===qt?Et({},t,{routesMap:Et({},t.routesMap,e.payload.routes)}):t:Et({},t,{kind:e.meta.location.kind});var r=e.meta.location.current.query,o=e.meta.location.current.search;return Et({pathname:e.meta.location.current.pathname,type:e.type,payload:Et({},e.payload)},r&&{query:r,search:o},{prev:e.meta.location.prev,kind:e.meta.location.kind,history:e.meta.location.history,hasSSR:t.hasSSR,routesMap:w})}),z=(x=S,j=U,E={action:F,extra:P},function(t){var e=t.dispatch,n=t.getState,r=j(n()).type,o=x[r];return o&&"function"===typeof o.thunk?Promise.resolve(o.thunk(e,n,E)):Promise.resolve()}),J="undefined"!==typeof document?document:{},K=void 0,V=void 0,Q=void 0,X=void 0,Z=void 0;t.navigators&&(K=t.navigators.navigators,V=t.navigators.patchNavigators,Q=t.navigators.actionToNavigation,X=t.navigators.navigationToAction,V(K));var tt=function(e,t,n){var r,o,i=n.meta.location;if(it){var a=it(i.current);if(a)return r=e,o=n,gt(a,function(t){t&&(bt(),r.dispatch(o))}),!0;it=null}if(s){var u=void 0,c={action:n,extra:P};if(s(function(t){pt(t)&&(u=!0,C=i.current,yt(i.current)===M||ht()||(Z="onBeforeChange"));return e.dispatch(t)},e.getState,c),u)return!0}I=U(e.getState()),C=i.current,Y=t.length,nt(i,t),"undefined"!==typeof window&&"undefined"!==typeof window.navigator&&"ReactNative"===window.navigator.product&&(i.history=dt(t))},et=function(e,t,n){var r=e.dispatch,o=e.getState(),i=U(o).kind,a=q(o),u={action:n,extra:P};if(G=U(o),"object"===("undefined"===typeof t?"undefined":Lt(t))){var c=!1;if(vt(function(t){return pt(t)&&(c=!0),e.dispatch(t)},e.getState,t,U,u),c)return}d&&d(r,e.getState,u),ht()||(i&&("function"===typeof l&&/back|next|pop/.test(i)&&l(r,e.getState,u),setTimeout(function(){var t,e;if(t=J,"string"===typeof(e=a)&&t.title!==e&&(t.title=e),f)return window.scrollTo(0,0);Rt(!1)})),"object"===("undefined"===typeof t?"undefined":Lt(t))&&t.confirmLeave&&(it=xt(t.confirmLeave,e,U,R,k,function(){return it=null})))},nt=function(t,e){var n=yt(t.current);if(n!==M){M=n;var r=t.kind;if(!(r&&/back|next|pop|stealth/.test(r)))e["redirect"===r&&"onBeforeChange"!==Z?"replace":"push"](M)}},rt=function(t,e,n){var r=yt(e);if(r!==M){var o=Ot(r,S,C,R,("REPLACE"===n?"redirect":n).toLowerCase(),k,M,Y);M=r,t.dispatch(o)}};_t=B,Mt=U;var ot=void 0,it=null;return Rt=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];B&&(!t&&B.manual||B.updateScroll(I,G))},{reducer:W,middleware:function(x){return function(w){return function(t){if(t.error)return w(t);if(t.type===qt){var e=U(x.getState()).type,n=S[e];S=Tt({},S,t.payload.routes);var r=w(t),o=S[e];return n!==o&&(null!==it&&bt(),"object"===("undefined"===typeof o?"undefined":Lt(o))&&o.confirmLeave&&(it=xt(o.confirmLeave,x,U,R,k,function(){return it=null}))),r}var i=void 0;if(K&&0===t.type.indexOf("Navigation/")){var a=X(K,x,S,t);i=a.navigationAction,t=a.action}var u,c,f,s,d,l,p,h,v,y=S[t.type];if("object"===("undefined"===typeof y?"undefined":Lt(y))&&!y.path){var m=w(t);return vt(x.dispatch,x.getState,y,U,{action:m,extra:P}),m}t.type!==Ut||lt(t)?y&&!lt(t)&&(t=function(e,t,n,r,o,i){try{var a=kt(e,t,i),u=jt(!!r.entries,a,r,e);return st(a,e,n,0,u)}catch(t){var c=Pt({},e.payload);return st(o||n.pathname||"/",Pt({},e,{type:Ut,payload:c}),n)}}(t,S,C,R,O,k)):(u=t,c=U(x.getState()),f=C,s=O,d=u.payload,l=u.meta,p=c.pathname,h=l&&l.location&&l.location.kind||"load"===c.kind&&"load"||"push",v=l&&l.notFoundPath||"redirect"===h&&s||p||"/",t=st(v,{type:Ut,payload:d},f,0,h)),K&&(t=Q(K,t,i,y));var g=void 0;if((y||t.type===Ut)&&t.meta&&(g=tt(x,R,t)),!g){var b=w(t);return(y||t.type===Ut)&&et(x,y,b),b}}}},enhancer:function(u){return function(t,e,n){!ht()&&e&&U(e)&&(U(e).routesMap=S);var r=u(t,e,n),o=r.getState(),i=o&&U(o);if(!i||!i.pathname)throw new Error("[redux-first-router] you must provide the key of the location\n reducer state and properly assigned the location reducer to that key.");if(R.listen(rt.bind(null,r)),!i.hasSSR||ht())!(ot=function(){var t=Ot(M,S,C,R,"load",k);r.dispatch(t)})!==c&&ot();else{var a=S[(C=i).type];"object"===("undefined"===typeof a?"undefined":Lt(a))&&a.confirmLeave&&(it=xt(a.confirmLeave,r,U,R,k,function(){return it=null}))}return ht()||setTimeout(function(){return Rt(!1)}),r}},thunk:z,initialDispatch:function(){return ot&&ot()},_middlewareAttemptChangeUrl:nt,_afterRouteChange:et,_historyAttemptDispatchAction:rt,windowDocument:J,history:At=R}},At=void 0,_t=void 0,Rt=void 0,Mt=void 0,Ct=void 0,m=function(t){return At.push(t)},g=function(t){return At.replace(t)},b=function(){return At.goBack()},w=function(){return At.goForward()},x=function(t){return At.go(t)},S=function(t){return At.canGo(t)},E=function(){return!(!At.entries||!At.entries[At.index-1])},L=function(){return!(!At.entries||!At.entries[At.index+1])},T=function(){var t=At.entries[At.index-1];return t&&t.pathname},A=function(){var t=At.entries[At.index+1];return t&&t.pathname},_=function(){return At},R=function(){return _t},M=function(){return Rt&&Rt()},C=function(t){return Mt(t)},U=function(){return Ct||{}},q=function(t,e){return t.meta=t.meta||{},t.meta.location=t.meta.location||{},t.meta.location.kind=e,t},B=function(t,e,n){return t=q(t,"redirect"),e&&(t.type=e),n&&(t.payload=n),t},F=function(e){return function(t){return t({type:qt,payload:{routes:e}})}};n.d(e,"NOT_FOUND",function(){return Ut}),n.d(e,"ADD_ROUTES",function(){return qt}),n.d(e,"connectRoutes",function(){return y}),n.d(e,"push",function(){return m}),n.d(e,"replace",function(){return g}),n.d(e,"back",function(){return b}),n.d(e,"next",function(){return w}),n.d(e,"go",function(){return x}),n.d(e,"canGo",function(){return S}),n.d(e,"canGoBack",function(){return E}),n.d(e,"canGoForward",function(){return L}),n.d(e,"prevPath",function(){return T}),n.d(e,"nextPath",function(){return A}),n.d(e,"history",function(){return _}),n.d(e,"scrollBehavior",function(){return R}),n.d(e,"updateScroll",function(){return M}),n.d(e,"selectLocationState",function(){return C}),n.d(e,"getOptions",function(){return U}),n.d(e,"redirect",function(){return B}),n.d(e,"actionToPath",function(){return kt}),n.d(e,"pathToAction",function(){return ft}),n.d(e,"isLocationAction",function(){return lt}),n.d(e,"setKind",function(){return q}),n.d(e,"addRoutes",function(){return F});var Ut="@@redux-first-router/NOT_FOUND",qt="@@redux-first-router/ADD_ROUTES"}])});