history
Advanced tools
Comparing version 3.0.0 to 3.1.0
113
CHANGES.md
@@ -0,1 +1,6 @@ | ||
## [HEAD] | ||
- Added `hashType` option to hash history for supporting different | ||
hash URL schemes including "hashbang" and no leading slash | ||
- **Bugfix:** Fix URL restoration on canceled popstate transitions | ||
## [v3.0.0] | ||
@@ -10,6 +15,6 @@ > May 30, 2016 | ||
[v3.0.0]: https://github.com/mjackson/history/compare/v3.0.0-2...v3.0.0 | ||
[#243]: https://github.com/mjackson/history/issues/243 | ||
[#295]: https://github.com/mjackson/history/issues/295 | ||
[#126]: https://github.com/mjackson/history/issues/126 | ||
[v3.0.0]: https://github.com/ReactTraining/history/compare/v3.0.0-2...v3.0.0 | ||
[#243]: https://github.com/ReactTraining/history/issues/243 | ||
[#295]: https://github.com/ReactTraining/history/issues/295 | ||
[#126]: https://github.com/ReactTraining/history/issues/126 | ||
@@ -21,3 +26,3 @@ ## [v3.0.0-2] | ||
[v3.0.0-2]: https://github.com/mjackson/history/compare/v3.0.0-1...v3.0.0-2 | ||
[v3.0.0-2]: https://github.com/ReactTraining/history/compare/v3.0.0-1...v3.0.0-2 | ||
@@ -31,4 +36,4 @@ ## [v3.0.0-1] | ||
[v3.0.0-1]: https://github.com/mjackson/history/compare/v3.0.0-0...v3.0.0-1 | ||
[#94]: https://github.com/mjackson/history/issues/94 | ||
[v3.0.0-1]: https://github.com/ReactTraining/history/compare/v3.0.0-0...v3.0.0-1 | ||
[#94]: https://github.com/ReactTraining/history/issues/94 | ||
@@ -53,4 +58,4 @@ ## [3.0.0-0] | ||
[3.0.0-0]: https://github.com/mjackson/history/compare/v2.0.0...v3.0.0-0 | ||
[#163]: https://github.com/mjackson/history/issues/163 | ||
[3.0.0-0]: https://github.com/ReactTraining/history/compare/v2.0.0...v3.0.0-0 | ||
[#163]: https://github.com/ReactTraining/history/issues/163 | ||
@@ -63,5 +68,5 @@ ## [v2.0.0] | ||
[v2.0.0]: https://github.com/mjackson/history/compare/v2.0.0-rc3...v2.0.0 | ||
[#221]: https://github.com/mjackson/history/issues/221 | ||
[#223]: https://github.com/mjackson/history/pull/223 | ||
[v2.0.0]: https://github.com/ReactTraining/history/compare/v2.0.0-rc3...v2.0.0 | ||
[#221]: https://github.com/ReactTraining/history/issues/221 | ||
[#223]: https://github.com/ReactTraining/history/pull/223 | ||
@@ -75,6 +80,6 @@ ## [v2.0.0-rc3] | ||
[v2.0.0-rc3]: https://github.com/mjackson/history/compare/v2.0.0-rc2...v2.0.0-rc3 | ||
[#179]: https://github.com/mjackson/history/pull/179 | ||
[#208]: https://github.com/mjackson/history/pull/208 | ||
[#200]: https://github.com/mjackson/history/pull/200 | ||
[v2.0.0-rc3]: https://github.com/ReactTraining/history/compare/v2.0.0-rc2...v2.0.0-rc3 | ||
[#179]: https://github.com/ReactTraining/history/pull/179 | ||
[#208]: https://github.com/ReactTraining/history/pull/208 | ||
[#200]: https://github.com/ReactTraining/history/pull/200 | ||
@@ -86,3 +91,3 @@ ## [v2.0.0-rc2] | ||
[v2.0.0-rc2]: https://github.com/mjackson/history/compare/v2.0.0-rc1...v2.0.0-rc2 | ||
[v2.0.0-rc2]: https://github.com/ReactTraining/history/compare/v2.0.0-rc1...v2.0.0-rc2 | ||
@@ -94,4 +99,4 @@ ## [v2.0.0-rc1] | ||
[v2.0.0-rc1]: https://github.com/mjackson/history/compare/v1.17.0...v2.0.0-rc1 | ||
[#177]: https://github.com/mjackson/history/pull/177 | ||
[v2.0.0-rc1]: https://github.com/ReactTraining/history/compare/v1.17.0...v2.0.0-rc1 | ||
[#177]: https://github.com/ReactTraining/history/pull/177 | ||
@@ -104,5 +109,5 @@ ## [v1.17.0] | ||
[v1.17.0]: https://github.com/mjackson/history/compare/v1.16.0...v1.17.0 | ||
[#170]: https://github.com/mjackson/history/pull/170 | ||
[#189]: https://github.com/mjackson/history/pull/189 | ||
[v1.17.0]: https://github.com/ReactTraining/history/compare/v1.16.0...v1.17.0 | ||
[#170]: https://github.com/ReactTraining/history/pull/170 | ||
[#189]: https://github.com/ReactTraining/history/pull/189 | ||
@@ -116,3 +121,3 @@ ## [v1.16.0] | ||
[v1.16.0]: https://github.com/mjackson/history/compare/v1.15.0...v1.16.0 | ||
[v1.16.0]: https://github.com/ReactTraining/history/compare/v1.15.0...v1.16.0 | ||
[reactjs/react-router#2682]: https://github.com/reactjs/react-router/issues/2682 | ||
@@ -126,4 +131,4 @@ | ||
[v1.15.0]: https://github.com/mjackson/history/compare/v1.14.0...v1.15.0 | ||
[#173]: https://github.com/mjackson/history/pull/173 | ||
[v1.15.0]: https://github.com/ReactTraining/history/compare/v1.14.0...v1.15.0 | ||
[#173]: https://github.com/ReactTraining/history/pull/173 | ||
@@ -140,9 +145,9 @@ ## [v1.14.0] | ||
[v1.14.0]: https://github.com/mjackson/history/compare/v1.13.1...v1.14.0 | ||
[#121]: https://github.com/mjackson/history/issues/121 | ||
[#141]: https://github.com/mjackson/history/pull/141 | ||
[#146]: https://github.com/mjackson/history/pull/146 | ||
[#152]: https://github.com/mjackson/history/pull/152 | ||
[#167]: https://github.com/mjackson/history/pull/167 | ||
[#168]: https://github.com/mjackson/history/pull/168 | ||
[v1.14.0]: https://github.com/ReactTraining/history/compare/v1.13.1...v1.14.0 | ||
[#121]: https://github.com/ReactTraining/history/issues/121 | ||
[#141]: https://github.com/ReactTraining/history/pull/141 | ||
[#146]: https://github.com/ReactTraining/history/pull/146 | ||
[#152]: https://github.com/ReactTraining/history/pull/152 | ||
[#167]: https://github.com/ReactTraining/history/pull/167 | ||
[#168]: https://github.com/ReactTraining/history/pull/168 | ||
@@ -156,5 +161,5 @@ ## [v1.13.1] | ||
[v1.13.1]: https://github.com/mjackson/history/compare/v1.13.0...v1.13.1 | ||
[#43]: https://github.com/mjackson/history/pull/43 | ||
[#139]: https://github.com/mjackson/history/pull/139 | ||
[v1.13.1]: https://github.com/ReactTraining/history/compare/v1.13.0...v1.13.1 | ||
[#43]: https://github.com/ReactTraining/history/pull/43 | ||
[#139]: https://github.com/ReactTraining/history/pull/139 | ||
@@ -168,5 +173,5 @@ ## [v1.13.0] | ||
[v1.13.0]: https://github.com/mjackson/history/compare/v1.12.6...v1.13.0 | ||
[#108]: https://github.com/mjackson/history/pull/108 | ||
[#94]: https://github.com/mjackson/history/issues/94 | ||
[v1.13.0]: https://github.com/ReactTraining/history/compare/v1.12.6...v1.13.0 | ||
[#108]: https://github.com/ReactTraining/history/pull/108 | ||
[#94]: https://github.com/ReactTraining/history/issues/94 | ||
@@ -179,4 +184,4 @@ ## [v1.12.6] | ||
[v1.12.6]: https://github.com/mjackson/history/compare/v1.12.5...v1.12.6 | ||
[#95]: https://github.com/mjackson/history/issues/95 | ||
[v1.12.6]: https://github.com/ReactTraining/history/compare/v1.12.5...v1.12.6 | ||
[#95]: https://github.com/ReactTraining/history/issues/95 | ||
@@ -191,4 +196,4 @@ ## [v1.12.5] | ||
[v1.12.5]: https://github.com/mjackson/history/compare/v1.12.4...v1.12.5 | ||
[#93]: https://github.com/mjackson/history/issues/93 | ||
[v1.12.5]: https://github.com/ReactTraining/history/compare/v1.12.4...v1.12.5 | ||
[#93]: https://github.com/ReactTraining/history/issues/93 | ||
@@ -200,4 +205,4 @@ ## [v1.12.4] | ||
[v1.12.4]: https://github.com/mjackson/history/compare/v1.12.3...v1.12.4 | ||
[#62]: https://github.com/mjackson/history/issues/62 | ||
[v1.12.4]: https://github.com/ReactTraining/history/compare/v1.12.3...v1.12.4 | ||
[#62]: https://github.com/ReactTraining/history/issues/62 | ||
@@ -210,5 +215,5 @@ ## [v1.12.3] | ||
[v1.12.3]: https://github.com/mjackson/history/compare/v1.12.2...v1.12.3 | ||
[#71]: https://github.com/mjackson/history/issues/71 | ||
[#42]: https://github.com/mjackson/history/issues/42 | ||
[v1.12.3]: https://github.com/ReactTraining/history/compare/v1.12.2...v1.12.3 | ||
[#71]: https://github.com/ReactTraining/history/issues/71 | ||
[#42]: https://github.com/ReactTraining/history/issues/42 | ||
@@ -220,4 +225,4 @@ ## [v1.12.2] | ||
[v1.12.2]: https://github.com/mjackson/history/compare/v1.12.1...v1.12.2 | ||
[#51-comments]: https://github.com/mjackson/history/pull/51#issuecomment-143189672 | ||
[v1.12.2]: https://github.com/ReactTraining/history/compare/v1.12.1...v1.12.2 | ||
[#51-comments]: https://github.com/ReactTraining/history/pull/51#issuecomment-143189672 | ||
@@ -230,3 +235,3 @@ ## [v1.12.1] | ||
[v1.12.1]: https://github.com/mjackson/history/compare/v1.12.0...v1.12.1 | ||
[v1.12.1]: https://github.com/ReactTraining/history/compare/v1.12.0...v1.12.1 | ||
@@ -239,3 +244,3 @@ ## [v1.12.0] | ||
[v1.12.0]: https://github.com/mjackson/history/compare/v1.11.1...v1.12.0 | ||
[v1.12.0]: https://github.com/ReactTraining/history/compare/v1.11.1...v1.12.0 | ||
@@ -248,4 +253,4 @@ ## [v1.11.1] | ||
[v1.11.1]: https://github.com/mjackson/history/compare/v1.11.0...v1.11.1 | ||
[#68]: https://github.com/mjackson/history/issues/68 | ||
[v1.11.1]: https://github.com/ReactTraining/history/compare/v1.11.0...v1.11.1 | ||
[#68]: https://github.com/ReactTraining/history/issues/68 | ||
@@ -262,2 +267,2 @@ ## [v1.11.0] | ||
[v1.11.0]: https://github.com/mjackson/history/compare/v1.10.2...v1.11.0 | ||
[v1.11.0]: https://github.com/ReactTraining/history/compare/v1.10.2...v1.11.0 |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
/** | ||
@@ -7,0 +5,0 @@ * Indicates that navigation was caused by a call to history.push. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
exports.__esModule = true; | ||
var loopAsync = exports.loopAsync = function loopAsync(turns, work, callback) { | ||
@@ -50,3 +45,3 @@ var currentTurn = 0, | ||
// This means the loop finished synchronously. | ||
callback.apply(undefined, _toConsumableArray(doneArgs)); | ||
callback.apply(undefined, doneArgs); | ||
return; | ||
@@ -53,0 +48,0 @@ } |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.go = exports.replaceLocation = exports.pushLocation = exports.startListener = exports.getUserConfirmation = exports.getCurrentLocation = undefined; | ||
@@ -16,7 +14,7 @@ | ||
/* eslint-disable no-alert */ | ||
var PopStateEvent = 'popstate'; | ||
var HashChangeEvent = 'hashchange'; | ||
var needsHashchangeListener = !(0, _DOMUtils.supportsPopstateOnHashchange)(); | ||
var PopStateEvent = 'popstate'; | ||
var _createLocation = function _createLocation(historyState) { | ||
@@ -39,3 +37,3 @@ var key = historyState && historyState.key; | ||
// IE 11 sometimes throws when accessing window.history.state | ||
// See https://github.com/mjackson/history/pull/289 | ||
// See https://github.com/ReactTraining/history/pull/289 | ||
historyState = {}; | ||
@@ -49,3 +47,3 @@ } | ||
return callback(window.confirm(message)); | ||
}; | ||
}; // eslint-disable-line no-alert | ||
@@ -60,4 +58,16 @@ var startListener = exports.startListener = function startListener(listener) { | ||
var handleUnpoppedHashChange = function handleUnpoppedHashChange() { | ||
return listener(getCurrentLocation()); | ||
}; | ||
if (needsHashchangeListener) { | ||
(0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleUnpoppedHashChange); | ||
} | ||
return function () { | ||
return (0, _DOMUtils.removeEventListener)(window, PopStateEvent, handlePopState); | ||
(0, _DOMUtils.removeEventListener)(window, PopStateEvent, handlePopState); | ||
if (needsHashchangeListener) { | ||
(0, _DOMUtils.removeEventListener)(window, HashChangeEvent, handleUnpoppedHashChange); | ||
} | ||
}; | ||
@@ -64,0 +74,0 @@ }; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -35,2 +33,27 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var addLeadingSlash = function addLeadingSlash(path) { | ||
return path.charAt(0) === '/' ? path : '/' + path; | ||
}; | ||
var HashPathCoders = { | ||
hashbang: { | ||
encodePath: function encodePath(path) { | ||
return path.charAt(0) === '!' ? path : '!' + path; | ||
}, | ||
decodePath: function decodePath(path) { | ||
return path.charAt(0) === '!' ? path.substring(1) : path; | ||
} | ||
}, | ||
noslash: { | ||
encodePath: function encodePath(path) { | ||
return path.charAt(0) === '/' ? path.substring(1) : path; | ||
}, | ||
decodePath: addLeadingSlash | ||
}, | ||
slash: { | ||
encodePath: addLeadingSlash, | ||
decodePath: addLeadingSlash | ||
} | ||
}; | ||
var createHashHistory = function createHashHistory() { | ||
@@ -42,2 +65,3 @@ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var queryKey = options.queryKey; | ||
var hashType = options.hashType; | ||
@@ -49,2 +73,12 @@ | ||
if (hashType == null) hashType = 'slash'; | ||
if (!(hashType in HashPathCoders)) { | ||
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, 'Invalid hash type: %s', hashType) : void 0; | ||
hashType = 'slash'; | ||
} | ||
var pathCoder = HashPathCoders[hashType]; | ||
var getUserConfirmation = HashProtocol.getUserConfirmation; | ||
@@ -54,11 +88,11 @@ | ||
var getCurrentLocation = function getCurrentLocation() { | ||
return HashProtocol.getCurrentLocation(queryKey); | ||
return HashProtocol.getCurrentLocation(pathCoder, queryKey); | ||
}; | ||
var pushLocation = function pushLocation(location) { | ||
return HashProtocol.pushLocation(location, queryKey); | ||
return HashProtocol.pushLocation(location, pathCoder, queryKey); | ||
}; | ||
var replaceLocation = function replaceLocation(location) { | ||
return HashProtocol.replaceLocation(location, queryKey); | ||
return HashProtocol.replaceLocation(location, pathCoder, queryKey); | ||
}; | ||
@@ -78,3 +112,3 @@ | ||
var startListener = function startListener(listener, before) { | ||
if (++listenerCount === 1) stopListener = HashProtocol.startListener(history.transitionTo, queryKey); | ||
if (++listenerCount === 1) stopListener = HashProtocol.startListener(history.transitionTo, pathCoder, queryKey); | ||
@@ -107,3 +141,3 @@ var unlisten = before ? history.listenBefore(listener) : history.listen(listener); | ||
var createHref = function createHref(path) { | ||
return '#' + history.createHref(path); | ||
return '#' + pathCoder.encodePath(history.createHref(path)); | ||
}; | ||
@@ -110,0 +144,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -21,4 +19,2 @@ var _AsyncUtils = require('./AsyncUtils'); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
var createHistory = function createHistory() { | ||
@@ -49,8 +45,8 @@ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var updateLocation = function updateLocation(nextLocation) { | ||
var currentIndex = getCurrentIndex(); | ||
currentLocation = nextLocation; | ||
var currentIndex = getCurrentIndex(); | ||
if (currentLocation.action === _Actions.PUSH) { | ||
allKeys = [].concat(_toConsumableArray(allKeys.slice(0, currentIndex + 1)), [currentLocation.key]); | ||
allKeys = [].concat(allKeys.slice(0, currentIndex + 1), [currentLocation.key]); | ||
} else if (currentLocation.action === _Actions.REPLACE) { | ||
@@ -57,0 +53,0 @@ allKeys[currentIndex] = currentLocation.key; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.readState = exports.saveState = undefined; | ||
@@ -14,6 +12,11 @@ | ||
var QuotaExceededErrors = ['QuotaExceededError', 'QUOTA_EXCEEDED_ERR']; /* eslint-disable no-empty */ | ||
var QuotaExceededErrors = { | ||
QuotaExceededError: true, | ||
QUOTA_EXCEEDED_ERR: true | ||
}; | ||
var SecurityErrors = { | ||
SecurityError: true | ||
}; | ||
var SecurityError = 'SecurityError'; | ||
var KeyPrefix = '@@History/'; | ||
@@ -30,2 +33,3 @@ | ||
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, '[history] Unable to save state; sessionStorage is not available') : void 0; | ||
return; | ||
@@ -41,3 +45,3 @@ } | ||
} catch (error) { | ||
if (error.name === SecurityError) { | ||
if (SecurityErrors[error.name]) { | ||
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any | ||
@@ -50,3 +54,3 @@ // attempt to access window.sessionStorage. | ||
if (QuotaExceededErrors.indexOf(error.name) >= 0 && window.sessionStorage.length === 0) { | ||
if (QuotaExceededErrors[error.name] && window.sessionStorage.length === 0) { | ||
// Safari "private mode" throws QuotaExceededError. | ||
@@ -67,3 +71,3 @@ process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : void 0; | ||
} catch (error) { | ||
if (error.name === SecurityError) { | ||
if (SecurityErrors[error.name]) { | ||
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any | ||
@@ -70,0 +74,0 @@ // attempt to access window.sessionStorage. |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
var addEventListener = exports.addEventListener = function addEventListener(node, event, listener) { | ||
@@ -34,2 +32,10 @@ return node.addEventListener ? node.addEventListener(event, listener, false) : node.attachEvent('on' + event, listener); | ||
return window.navigator.userAgent.indexOf('Firefox') === -1; | ||
}; | ||
/** | ||
* Returns true if browser fires popstate on hash change. | ||
* IE10 and IE11 do not. | ||
*/ | ||
var supportsPopstateOnHashchange = exports.supportsPopstateOnHashchange = function supportsPopstateOnHashchange() { | ||
return window.navigator.userAgent.indexOf('Trident') === -1; | ||
}; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
var canUseDOM = exports.canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.replaceLocation = exports.pushLocation = exports.startListener = exports.getCurrentLocation = exports.go = exports.getUserConfirmation = undefined; | ||
@@ -43,4 +41,4 @@ | ||
var href = window.location.href; | ||
var index = href.indexOf('#'); | ||
return index === -1 ? '' : href.substring(index + 1); | ||
var hashIndex = href.indexOf('#'); | ||
return hashIndex === -1 ? '' : href.substring(hashIndex + 1); | ||
}; | ||
@@ -53,19 +51,9 @@ | ||
var replaceHashPath = function replaceHashPath(path) { | ||
var i = window.location.href.indexOf('#'); | ||
var hashIndex = window.location.href.indexOf('#'); | ||
window.location.replace(window.location.href.slice(0, i >= 0 ? i : 0) + '#' + path); | ||
window.location.replace(window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path); | ||
}; | ||
var ensureSlash = function ensureSlash() { | ||
var path = getHashPath(); | ||
if ((0, _PathUtils.isAbsolutePath)(path)) return true; | ||
replaceHashPath('/' + path); | ||
return false; | ||
}; | ||
var getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation(queryKey) { | ||
var path = getHashPath(); | ||
var getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation(pathCoder, queryKey) { | ||
var path = pathCoder.decodePath(getHashPath()); | ||
var key = (0, _PathUtils.getQueryStringValueFromPath)(path, queryKey); | ||
@@ -87,16 +75,27 @@ | ||
var startListener = exports.startListener = function startListener(listener, queryKey) { | ||
var startListener = exports.startListener = function startListener(listener, pathCoder, queryKey) { | ||
var handleHashChange = function handleHashChange() { | ||
if (!ensureSlash()) return; // Hash path must always begin with a / | ||
var path = getHashPath(); | ||
var encodedPath = pathCoder.encodePath(path); | ||
var currentLocation = getCurrentLocation(queryKey); | ||
if (path !== encodedPath) { | ||
// Always be sure we have a properly-encoded hash. | ||
replaceHashPath(encodedPath); | ||
} else { | ||
var currentLocation = getCurrentLocation(pathCoder, queryKey); | ||
if (prevLocation && currentLocation.key && prevLocation.key === currentLocation.key) return; // Ignore extraneous hashchange events | ||
if (prevLocation && currentLocation.key && prevLocation.key === currentLocation.key) return; // Ignore extraneous hashchange events | ||
prevLocation = currentLocation; | ||
prevLocation = currentLocation; | ||
listener(currentLocation); | ||
listener(currentLocation); | ||
} | ||
}; | ||
ensureSlash(); | ||
// Ensure the hash is encoded properly. | ||
var path = getHashPath(); | ||
var encodedPath = pathCoder.encodePath(path); | ||
if (path !== encodedPath) replaceHashPath(encodedPath); | ||
(0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleHashChange); | ||
@@ -109,8 +108,9 @@ | ||
var updateLocation = function updateLocation(location, queryKey, updateHash) { | ||
var updateLocation = function updateLocation(location, pathCoder, queryKey, updateHash) { | ||
var state = location.state; | ||
var key = location.key; | ||
var path = (0, _PathUtils.createPath)(location); | ||
var path = pathCoder.encodePath((0, _PathUtils.createPath)(location)); | ||
if (state !== undefined) { | ||
@@ -126,4 +126,4 @@ path = (0, _PathUtils.addQueryStringValueToPath)(path, queryKey, key); | ||
var pushLocation = exports.pushLocation = function pushLocation(location, queryKey) { | ||
return updateLocation(location, queryKey, function (path) { | ||
var pushLocation = exports.pushLocation = function pushLocation(location, pathCoder, queryKey) { | ||
return updateLocation(location, pathCoder, queryKey, function (path) { | ||
if (getHashPath() !== path) { | ||
@@ -137,6 +137,6 @@ pushHashPath(path); | ||
var replaceLocation = exports.replaceLocation = function replaceLocation(location, queryKey) { | ||
return updateLocation(location, queryKey, function (path) { | ||
var replaceLocation = exports.replaceLocation = function replaceLocation(location, pathCoder, queryKey) { | ||
return updateLocation(location, pathCoder, queryKey, function (path) { | ||
if (getHashPath() !== path) replaceHashPath(path); | ||
}); | ||
}; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.locationsAreEqual = exports.Actions = exports.useQueries = exports.useBeforeUnload = exports.useBasename = exports.createMemoryHistory = exports.createHashHistory = exports.createHistory = undefined; | ||
@@ -43,4 +41,6 @@ | ||
var _Actions3 = _interopRequireDefault(_Actions2); | ||
var _Actions = _interopRequireWildcard(_Actions2); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -54,2 +54,2 @@ | ||
exports.useQueries = _useQueries3.default; | ||
exports.Actions = _Actions3.default; | ||
exports.Actions = _Actions; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.locationsAreEqual = exports.statesAreEqual = exports.createLocation = exports.createQuery = undefined; | ||
@@ -16,2 +14,6 @@ | ||
var _warning = require('warning'); | ||
var _warning2 = _interopRequireDefault(_warning); | ||
var _PathUtils = require('./PathUtils'); | ||
@@ -34,2 +36,4 @@ | ||
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(!object.path, 'Location descriptor objects should have a `pathname`, not a `path`.') : void 0; | ||
var pathname = object.pathname || '/'; | ||
@@ -68,5 +72,9 @@ var search = object.search || ''; | ||
if (!Array.isArray(a)) return Object.keys(a).every(function (key) { | ||
return statesAreEqual(a[key], b[key]); | ||
}); | ||
if (!Array.isArray(a)) { | ||
var keysofA = Object.keys(a); | ||
var keysofB = Object.keys(b); | ||
return keysofA.length === keysofB.length && keysofA.every(function (key) { | ||
return statesAreEqual(a[key], b[key]); | ||
}); | ||
} | ||
@@ -73,0 +81,0 @@ return Array.isArray(b) && a.length === b.length && a.every(function (item, index) { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.createPath = exports.parsePath = exports.getQueryStringValueFromPath = exports.stripQueryStringValueFromPath = exports.addQueryStringValueToPath = exports.isAbsolutePath = undefined; | ||
exports.__esModule = true; | ||
exports.createPath = exports.parsePath = exports.getQueryStringValueFromPath = exports.stripQueryStringValueFromPath = exports.addQueryStringValueToPath = undefined; | ||
@@ -14,6 +12,2 @@ var _warning = require('warning'); | ||
var isAbsolutePath = exports.isAbsolutePath = function isAbsolutePath(path) { | ||
return typeof path === 'string' && path.charAt(0) === '/'; | ||
}; | ||
var addQueryStringValueToPath = exports.addQueryStringValueToPath = function addQueryStringValueToPath(path, key, value) { | ||
@@ -20,0 +14,0 @@ var _parsePath = parsePath(path); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.replaceLocation = exports.pushLocation = exports.getCurrentLocation = exports.go = exports.getUserConfirmation = undefined; | ||
@@ -7,0 +5,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _warning = require('warning'); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -51,3 +49,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
return _extends({}, location, { | ||
return _extends({}, object, { | ||
pathname: pathname | ||
@@ -54,0 +52,0 @@ }); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; |
{ | ||
"name": "history", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Manage browser history with JavaScript", | ||
"repository": "ReactTraining/history", | ||
"author": "Michael Jackson", | ||
"license": "MIT", | ||
"main": "lib", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mjackson/history.git" | ||
}, | ||
"files": [ | ||
@@ -28,36 +25,41 @@ "lib", | ||
"dependencies": { | ||
"invariant": "^2.0.0", | ||
"query-string": "^4.1.0", | ||
"warning": "^2.0.0" | ||
"invariant": "^2.2.1", | ||
"query-string": "^4.2.2", | ||
"warning": "^3.0.0", | ||
"loose-envify": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.8.0", | ||
"babel-eslint": "^6.0.0", | ||
"babel-cli": "^6.10.1", | ||
"babel-core": "^6.9.1", | ||
"babel-eslint": "^6.0.4", | ||
"babel-loader": "^6.2.4", | ||
"babel-plugin-dev-expression": "^0.2.1", | ||
"babel-plugin-transform-object-assign": "^6.8.0", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-es2015-loose": "^7.0.0", | ||
"babel-preset-stage-1": "^6.5.0", | ||
"eslint": "^2.5.1", | ||
"eslint-config-airbnb": "^9.0.1", | ||
"eslint": "^3.3.0", | ||
"eslint-plugin-import": "^1.8.1", | ||
"eslint-plugin-jsx-a11y": "^1.2.2", | ||
"eslint-plugin-react": "^5.1.1", | ||
"expect": "^1.20.1", | ||
"gzip-size": "^3.0.0", | ||
"in-publish": "^2.0.0", | ||
"karma": "^0.13.3", | ||
"karma-browserstack-launcher": "^1.0.0", | ||
"karma-chrome-launcher": "^1.0.1", | ||
"karma": "^1.2.0", | ||
"karma-browserstack-launcher": "^1.0.1", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-mocha": "^1.0.1", | ||
"karma-mocha-reporter": "^2.0.3", | ||
"karma-sourcemap-loader": "^0.3.5", | ||
"karma-mocha-reporter": "^2.0.4", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-webpack": "^1.7.0", | ||
"mocha": "^2.0.1", | ||
"pretty-bytes": "^3.0.1", | ||
"readline-sync": "^1.4.1", | ||
"rimraf": "^2.4.2", | ||
"webpack": "^1.4.13", | ||
"webpack-dev-server": "^1.10.1" | ||
"mocha": "^3.0.2", | ||
"pretty-bytes": "^4.0.2", | ||
"readline-sync": "^1.4.4", | ||
"rimraf": "^2.5.2", | ||
"webpack": "^1.13.1", | ||
"webpack-dev-server": "^1.14.1" | ||
}, | ||
"browserify": { | ||
"transform": [ | ||
"loose-envify" | ||
] | ||
}, | ||
"tags": [ | ||
@@ -70,13 +72,3 @@ "history", | ||
"location" | ||
], | ||
"babel": { | ||
"presets": [ | ||
"es2015", | ||
"stage-1" | ||
], | ||
"plugins": [ | ||
"dev-expression", | ||
"transform-object-assign" | ||
] | ||
} | ||
] | ||
} |
@@ -59,5 +59,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.locationsAreEqual = exports.Actions = exports.useQueries = exports.useBeforeUnload = exports.useBasename = exports.createMemoryHistory = exports.createHashHistory = exports.createHistory = undefined; | ||
@@ -100,4 +98,6 @@ | ||
var _Actions3 = _interopRequireDefault(_Actions2); | ||
var _Actions = _interopRequireWildcard(_Actions2); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -111,3 +111,3 @@ | ||
exports.useQueries = _useQueries3.default; | ||
exports.Actions = _Actions3.default; | ||
exports.Actions = _Actions; | ||
@@ -120,5 +120,3 @@ /***/ }, | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.locationsAreEqual = exports.statesAreEqual = exports.createLocation = exports.createQuery = undefined; | ||
@@ -134,4 +132,8 @@ | ||
var _PathUtils = __webpack_require__(3); | ||
var _warning = __webpack_require__(3); | ||
var _warning2 = _interopRequireDefault(_warning); | ||
var _PathUtils = __webpack_require__(4); | ||
var _Actions = __webpack_require__(5); | ||
@@ -152,2 +154,4 @@ | ||
false ? (0, _warning2.default)(!object.path, 'Location descriptor objects should have a `pathname`, not a `path`.') : void 0; | ||
var pathname = object.pathname || '/'; | ||
@@ -186,5 +190,9 @@ var search = object.search || ''; | ||
if (!Array.isArray(a)) return Object.keys(a).every(function (key) { | ||
return statesAreEqual(a[key], b[key]); | ||
}); | ||
if (!Array.isArray(a)) { | ||
var keysofA = Object.keys(a); | ||
var keysofB = Object.keys(b); | ||
return keysofA.length === keysofB.length && keysofA.every(function (key) { | ||
return statesAreEqual(a[key], b[key]); | ||
}); | ||
} | ||
@@ -268,11 +276,75 @@ return Array.isArray(b) && a.length === b.length && a.every(function (item, index) { | ||
/** | ||
* Copyright 2014-2015, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.createPath = exports.parsePath = exports.getQueryStringValueFromPath = exports.stripQueryStringValueFromPath = exports.addQueryStringValueToPath = exports.isAbsolutePath = undefined; | ||
/** | ||
* Similar to invariant but only logs a warning if the condition is not met. | ||
* This can be used to log issues in development environments in critical | ||
* paths. Removing the logging code for production environments will keep the | ||
* same logic and follow the same code paths. | ||
*/ | ||
var _warning = __webpack_require__(4); | ||
var warning = function() {}; | ||
if (false) { | ||
warning = function(condition, format, args) { | ||
var len = arguments.length; | ||
args = new Array(len > 2 ? len - 2 : 0); | ||
for (var key = 2; key < len; key++) { | ||
args[key - 2] = arguments[key]; | ||
} | ||
if (format === undefined) { | ||
throw new Error( | ||
'`warning(condition, format, ...args)` requires a warning ' + | ||
'message argument' | ||
); | ||
} | ||
if (format.length < 10 || (/^[s\W]*$/).test(format)) { | ||
throw new Error( | ||
'The warning format should be able to uniquely identify this ' + | ||
'warning. Please, use a more descriptive format than: ' + format | ||
); | ||
} | ||
if (!condition) { | ||
var argIndex = 0; | ||
var message = 'Warning: ' + | ||
format.replace(/%s/g, function() { | ||
return args[argIndex++]; | ||
}); | ||
if (typeof console !== 'undefined') { | ||
console.error(message); | ||
} | ||
try { | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch(x) {} | ||
} | ||
}; | ||
} | ||
module.exports = warning; | ||
/***/ }, | ||
/* 4 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
exports.__esModule = true; | ||
exports.createPath = exports.parsePath = exports.getQueryStringValueFromPath = exports.stripQueryStringValueFromPath = exports.addQueryStringValueToPath = undefined; | ||
var _warning = __webpack_require__(3); | ||
var _warning2 = _interopRequireDefault(_warning); | ||
@@ -282,6 +354,2 @@ | ||
var isAbsolutePath = exports.isAbsolutePath = function isAbsolutePath(path) { | ||
return typeof path === 'string' && path.charAt(0) === '/'; | ||
}; | ||
var addQueryStringValueToPath = exports.addQueryStringValueToPath = function addQueryStringValueToPath(path, key, value) { | ||
@@ -379,68 +447,2 @@ var _parsePath = parsePath(path); | ||
/***/ }, | ||
/* 4 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/** | ||
* Copyright 2014-2015, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
'use strict'; | ||
/** | ||
* Similar to invariant but only logs a warning if the condition is not met. | ||
* This can be used to log issues in development environments in critical | ||
* paths. Removing the logging code for production environments will keep the | ||
* same logic and follow the same code paths. | ||
*/ | ||
var warning = function() {}; | ||
if (false) { | ||
warning = function(condition, format, args) { | ||
var len = arguments.length; | ||
args = new Array(len > 2 ? len - 2 : 0); | ||
for (var key = 2; key < len; key++) { | ||
args[key - 2] = arguments[key]; | ||
} | ||
if (format === undefined) { | ||
throw new Error( | ||
'`warning(condition, format, ...args)` requires a warning ' + | ||
'message argument' | ||
); | ||
} | ||
if (format.length < 10 || (/^[s\W]*$/).test(format)) { | ||
throw new Error( | ||
'The warning format should be able to uniquely identify this ' + | ||
'warning. Please, use a more descriptive format than: ' + format | ||
); | ||
} | ||
if (!condition) { | ||
var argIndex = 0; | ||
var message = 'Warning: ' + | ||
format.replace(/%s/g, function() { | ||
return args[argIndex++]; | ||
}); | ||
if (typeof console !== 'undefined') { | ||
console.error(message); | ||
} | ||
try { | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch(x) {} | ||
} | ||
}; | ||
} | ||
module.exports = warning; | ||
/***/ }, | ||
/* 5 */ | ||
@@ -451,5 +453,3 @@ /***/ function(module, exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
/** | ||
@@ -481,5 +481,3 @@ * Indicates that navigation was caused by a call to history.push. | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -582,5 +580,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
var canUseDOM = exports.canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | ||
@@ -594,5 +590,3 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.go = exports.replaceLocation = exports.pushLocation = exports.startListener = exports.getUserConfirmation = exports.getCurrentLocation = undefined; | ||
@@ -606,9 +600,9 @@ | ||
var _PathUtils = __webpack_require__(3); | ||
var _PathUtils = __webpack_require__(4); | ||
/* eslint-disable no-alert */ | ||
var PopStateEvent = 'popstate'; | ||
var HashChangeEvent = 'hashchange'; | ||
var needsHashchangeListener = !(0, _DOMUtils.supportsPopstateOnHashchange)(); | ||
var PopStateEvent = 'popstate'; | ||
var _createLocation = function _createLocation(historyState) { | ||
@@ -631,3 +625,3 @@ var key = historyState && historyState.key; | ||
// IE 11 sometimes throws when accessing window.history.state | ||
// See https://github.com/mjackson/history/pull/289 | ||
// See https://github.com/ReactTraining/history/pull/289 | ||
historyState = {}; | ||
@@ -641,3 +635,3 @@ } | ||
return callback(window.confirm(message)); | ||
}; | ||
}; // eslint-disable-line no-alert | ||
@@ -652,4 +646,16 @@ var startListener = exports.startListener = function startListener(listener) { | ||
var handleUnpoppedHashChange = function handleUnpoppedHashChange() { | ||
return listener(getCurrentLocation()); | ||
}; | ||
if (needsHashchangeListener) { | ||
(0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleUnpoppedHashChange); | ||
} | ||
return function () { | ||
return (0, _DOMUtils.removeEventListener)(window, PopStateEvent, handlePopState); | ||
(0, _DOMUtils.removeEventListener)(window, PopStateEvent, handlePopState); | ||
if (needsHashchangeListener) { | ||
(0, _DOMUtils.removeEventListener)(window, HashChangeEvent, handleUnpoppedHashChange); | ||
} | ||
}; | ||
@@ -690,5 +696,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
var addEventListener = exports.addEventListener = function addEventListener(node, event, listener) { | ||
@@ -724,2 +728,10 @@ return node.addEventListener ? node.addEventListener(event, listener, false) : node.attachEvent('on' + event, listener); | ||
/** | ||
* Returns true if browser fires popstate on hash change. | ||
* IE10 and IE11 do not. | ||
*/ | ||
var supportsPopstateOnHashchange = exports.supportsPopstateOnHashchange = function supportsPopstateOnHashchange() { | ||
return window.navigator.userAgent.indexOf('Trident') === -1; | ||
}; | ||
/***/ }, | ||
@@ -731,8 +743,6 @@ /* 10 */ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.readState = exports.saveState = undefined; | ||
var _warning = __webpack_require__(4); | ||
var _warning = __webpack_require__(3); | ||
@@ -743,6 +753,11 @@ var _warning2 = _interopRequireDefault(_warning); | ||
var QuotaExceededErrors = ['QuotaExceededError', 'QUOTA_EXCEEDED_ERR']; /* eslint-disable no-empty */ | ||
var QuotaExceededErrors = { | ||
QuotaExceededError: true, | ||
QUOTA_EXCEEDED_ERR: true | ||
}; | ||
var SecurityErrors = { | ||
SecurityError: true | ||
}; | ||
var SecurityError = 'SecurityError'; | ||
var KeyPrefix = '@@History/'; | ||
@@ -759,2 +774,3 @@ | ||
false ? (0, _warning2.default)(false, '[history] Unable to save state; sessionStorage is not available') : void 0; | ||
return; | ||
@@ -770,3 +786,3 @@ } | ||
} catch (error) { | ||
if (error.name === SecurityError) { | ||
if (SecurityErrors[error.name]) { | ||
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any | ||
@@ -779,3 +795,3 @@ // attempt to access window.sessionStorage. | ||
if (QuotaExceededErrors.indexOf(error.name) >= 0 && window.sessionStorage.length === 0) { | ||
if (QuotaExceededErrors[error.name] && window.sessionStorage.length === 0) { | ||
// Safari "private mode" throws QuotaExceededError. | ||
@@ -796,3 +812,3 @@ false ? (0, _warning2.default)(false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : void 0; | ||
} catch (error) { | ||
if (error.name === SecurityError) { | ||
if (SecurityErrors[error.name]) { | ||
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any | ||
@@ -823,5 +839,3 @@ // attempt to access window.sessionStorage. | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.replaceLocation = exports.pushLocation = exports.getCurrentLocation = exports.go = exports.getUserConfirmation = undefined; | ||
@@ -846,3 +860,3 @@ | ||
var _PathUtils = __webpack_require__(3); | ||
var _PathUtils = __webpack_require__(4); | ||
@@ -869,9 +883,7 @@ var getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation() { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
var _AsyncUtils = __webpack_require__(13); | ||
var _PathUtils = __webpack_require__(3); | ||
var _PathUtils = __webpack_require__(4); | ||
@@ -888,4 +900,2 @@ var _runTransitionHook = __webpack_require__(14); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
var createHistory = function createHistory() { | ||
@@ -916,8 +926,8 @@ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var updateLocation = function updateLocation(nextLocation) { | ||
var currentIndex = getCurrentIndex(); | ||
currentLocation = nextLocation; | ||
var currentIndex = getCurrentIndex(); | ||
if (currentLocation.action === _Actions.PUSH) { | ||
allKeys = [].concat(_toConsumableArray(allKeys.slice(0, currentIndex + 1)), [currentLocation.key]); | ||
allKeys = [].concat(allKeys.slice(0, currentIndex + 1), [currentLocation.key]); | ||
} else if (currentLocation.action === _Actions.REPLACE) { | ||
@@ -1057,8 +1067,3 @@ allKeys[currentIndex] = currentLocation.key; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
exports.__esModule = true; | ||
var loopAsync = exports.loopAsync = function loopAsync(turns, work, callback) { | ||
@@ -1105,3 +1110,3 @@ var currentTurn = 0, | ||
// This means the loop finished synchronously. | ||
callback.apply(undefined, _toConsumableArray(doneArgs)); | ||
callback.apply(undefined, doneArgs); | ||
return; | ||
@@ -1125,7 +1130,5 @@ } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
var _warning = __webpack_require__(4); | ||
var _warning = __webpack_require__(3); | ||
@@ -1156,9 +1159,7 @@ var _warning2 = _interopRequireDefault(_warning); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _warning = __webpack_require__(4); | ||
var _warning = __webpack_require__(3); | ||
@@ -1189,2 +1190,27 @@ var _warning2 = _interopRequireDefault(_warning); | ||
var addLeadingSlash = function addLeadingSlash(path) { | ||
return path.charAt(0) === '/' ? path : '/' + path; | ||
}; | ||
var HashPathCoders = { | ||
hashbang: { | ||
encodePath: function encodePath(path) { | ||
return path.charAt(0) === '!' ? path : '!' + path; | ||
}, | ||
decodePath: function decodePath(path) { | ||
return path.charAt(0) === '!' ? path.substring(1) : path; | ||
} | ||
}, | ||
noslash: { | ||
encodePath: function encodePath(path) { | ||
return path.charAt(0) === '/' ? path.substring(1) : path; | ||
}, | ||
decodePath: addLeadingSlash | ||
}, | ||
slash: { | ||
encodePath: addLeadingSlash, | ||
decodePath: addLeadingSlash | ||
} | ||
}; | ||
var createHashHistory = function createHashHistory() { | ||
@@ -1196,2 +1222,3 @@ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var queryKey = options.queryKey; | ||
var hashType = options.hashType; | ||
@@ -1203,2 +1230,12 @@ | ||
if (hashType == null) hashType = 'slash'; | ||
if (!(hashType in HashPathCoders)) { | ||
false ? (0, _warning2.default)(false, 'Invalid hash type: %s', hashType) : void 0; | ||
hashType = 'slash'; | ||
} | ||
var pathCoder = HashPathCoders[hashType]; | ||
var getUserConfirmation = HashProtocol.getUserConfirmation; | ||
@@ -1208,11 +1245,11 @@ | ||
var getCurrentLocation = function getCurrentLocation() { | ||
return HashProtocol.getCurrentLocation(queryKey); | ||
return HashProtocol.getCurrentLocation(pathCoder, queryKey); | ||
}; | ||
var pushLocation = function pushLocation(location) { | ||
return HashProtocol.pushLocation(location, queryKey); | ||
return HashProtocol.pushLocation(location, pathCoder, queryKey); | ||
}; | ||
var replaceLocation = function replaceLocation(location) { | ||
return HashProtocol.replaceLocation(location, queryKey); | ||
return HashProtocol.replaceLocation(location, pathCoder, queryKey); | ||
}; | ||
@@ -1232,3 +1269,3 @@ | ||
var startListener = function startListener(listener, before) { | ||
if (++listenerCount === 1) stopListener = HashProtocol.startListener(history.transitionTo, queryKey); | ||
if (++listenerCount === 1) stopListener = HashProtocol.startListener(history.transitionTo, pathCoder, queryKey); | ||
@@ -1261,3 +1298,3 @@ var unlisten = before ? history.listenBefore(listener) : history.listen(listener); | ||
var createHref = function createHref(path) { | ||
return '#' + history.createHref(path); | ||
return '#' + pathCoder.encodePath(history.createHref(path)); | ||
}; | ||
@@ -1281,5 +1318,3 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.replaceLocation = exports.pushLocation = exports.startListener = exports.getCurrentLocation = exports.go = exports.getUserConfirmation = undefined; | ||
@@ -1302,3 +1337,3 @@ | ||
var _warning = __webpack_require__(4); | ||
var _warning = __webpack_require__(3); | ||
@@ -1313,3 +1348,3 @@ var _warning2 = _interopRequireDefault(_warning); | ||
var _PathUtils = __webpack_require__(3); | ||
var _PathUtils = __webpack_require__(4); | ||
@@ -1324,4 +1359,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var href = window.location.href; | ||
var index = href.indexOf('#'); | ||
return index === -1 ? '' : href.substring(index + 1); | ||
var hashIndex = href.indexOf('#'); | ||
return hashIndex === -1 ? '' : href.substring(hashIndex + 1); | ||
}; | ||
@@ -1334,19 +1369,9 @@ | ||
var replaceHashPath = function replaceHashPath(path) { | ||
var i = window.location.href.indexOf('#'); | ||
var hashIndex = window.location.href.indexOf('#'); | ||
window.location.replace(window.location.href.slice(0, i >= 0 ? i : 0) + '#' + path); | ||
window.location.replace(window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path); | ||
}; | ||
var ensureSlash = function ensureSlash() { | ||
var path = getHashPath(); | ||
if ((0, _PathUtils.isAbsolutePath)(path)) return true; | ||
replaceHashPath('/' + path); | ||
return false; | ||
}; | ||
var getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation(queryKey) { | ||
var path = getHashPath(); | ||
var getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation(pathCoder, queryKey) { | ||
var path = pathCoder.decodePath(getHashPath()); | ||
var key = (0, _PathUtils.getQueryStringValueFromPath)(path, queryKey); | ||
@@ -1368,16 +1393,27 @@ | ||
var startListener = exports.startListener = function startListener(listener, queryKey) { | ||
var startListener = exports.startListener = function startListener(listener, pathCoder, queryKey) { | ||
var handleHashChange = function handleHashChange() { | ||
if (!ensureSlash()) return; // Hash path must always begin with a / | ||
var path = getHashPath(); | ||
var encodedPath = pathCoder.encodePath(path); | ||
var currentLocation = getCurrentLocation(queryKey); | ||
if (path !== encodedPath) { | ||
// Always be sure we have a properly-encoded hash. | ||
replaceHashPath(encodedPath); | ||
} else { | ||
var currentLocation = getCurrentLocation(pathCoder, queryKey); | ||
if (prevLocation && currentLocation.key && prevLocation.key === currentLocation.key) return; // Ignore extraneous hashchange events | ||
if (prevLocation && currentLocation.key && prevLocation.key === currentLocation.key) return; // Ignore extraneous hashchange events | ||
prevLocation = currentLocation; | ||
prevLocation = currentLocation; | ||
listener(currentLocation); | ||
listener(currentLocation); | ||
} | ||
}; | ||
ensureSlash(); | ||
// Ensure the hash is encoded properly. | ||
var path = getHashPath(); | ||
var encodedPath = pathCoder.encodePath(path); | ||
if (path !== encodedPath) replaceHashPath(encodedPath); | ||
(0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleHashChange); | ||
@@ -1390,8 +1426,9 @@ | ||
var updateLocation = function updateLocation(location, queryKey, updateHash) { | ||
var updateLocation = function updateLocation(location, pathCoder, queryKey, updateHash) { | ||
var state = location.state; | ||
var key = location.key; | ||
var path = (0, _PathUtils.createPath)(location); | ||
var path = pathCoder.encodePath((0, _PathUtils.createPath)(location)); | ||
if (state !== undefined) { | ||
@@ -1407,4 +1444,4 @@ path = (0, _PathUtils.addQueryStringValueToPath)(path, queryKey, key); | ||
var pushLocation = exports.pushLocation = function pushLocation(location, queryKey) { | ||
return updateLocation(location, queryKey, function (path) { | ||
var pushLocation = exports.pushLocation = function pushLocation(location, pathCoder, queryKey) { | ||
return updateLocation(location, pathCoder, queryKey, function (path) { | ||
if (getHashPath() !== path) { | ||
@@ -1418,4 +1455,4 @@ pushHashPath(path); | ||
var replaceLocation = exports.replaceLocation = function replaceLocation(location, queryKey) { | ||
return updateLocation(location, queryKey, function (path) { | ||
var replaceLocation = exports.replaceLocation = function replaceLocation(location, pathCoder, queryKey) { | ||
return updateLocation(location, pathCoder, queryKey, function (path) { | ||
if (getHashPath() !== path) replaceHashPath(path); | ||
@@ -1431,9 +1468,7 @@ }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _warning = __webpack_require__(4); | ||
var _warning = __webpack_require__(3); | ||
@@ -1448,3 +1483,3 @@ var _warning2 = _interopRequireDefault(_warning); | ||
var _PathUtils = __webpack_require__(3); | ||
var _PathUtils = __webpack_require__(4); | ||
@@ -1578,5 +1613,3 @@ var _createHistory = __webpack_require__(12); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -1589,3 +1622,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _PathUtils = __webpack_require__(3); | ||
var _PathUtils = __webpack_require__(4); | ||
@@ -1628,3 +1661,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
return _extends({}, location, { | ||
return _extends({}, object, { | ||
pathname: pathname | ||
@@ -1697,5 +1730,3 @@ }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -1783,5 +1814,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -1798,3 +1827,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _PathUtils = __webpack_require__(3); | ||
var _PathUtils = __webpack_require__(4); | ||
@@ -1983,3 +2012,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
if (val === null) { | ||
return key; | ||
return encode(key, opts); | ||
} | ||
@@ -1990,3 +2019,3 @@ | ||
val.slice().sort().forEach(function (val2) { | ||
val.slice().forEach(function (val2) { | ||
if (val2 === undefined) { | ||
@@ -1993,0 +2022,0 @@ return; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.History=t():e.History=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.locationsAreEqual=t.Actions=t.useQueries=t.useBeforeUnload=t.useBasename=t.createMemoryHistory=t.createHashHistory=t.createHistory=void 0;var o=n(2);Object.defineProperty(t,"locationsAreEqual",{enumerable:!0,get:function(){return o.locationsAreEqual}});var i=n(15),a=r(i),u=n(16),c=r(u),f=n(17),s=r(f),l=n(18),d=r(l),p=n(19),v=r(p),h=n(20),y=r(h),g=n(6),m=r(g);t.createHistory=a["default"],t.createHashHistory=c["default"],t.createMemoryHistory=s["default"],t.useBasename=d["default"],t.useBeforeUnload=v["default"],t.useQueries=y["default"],t.Actions=m["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.createPath=t.parsePath=t.getQueryStringValueFromPath=t.stripQueryStringValueFromPath=t.addQueryStringValueToPath=t.isAbsolutePath=void 0;var o=n(3),i=(r(o),t.isAbsolutePath=function(e){return"string"==typeof e&&"/"===e.charAt(0)},t.addQueryStringValueToPath=function(e,t,n){var r=a(e),o=r.pathname,i=r.search,c=r.hash;return u({pathname:o,search:i+(-1===i.indexOf("?")?"?":"&")+t+"="+n,hash:c})},t.stripQueryStringValueFromPath=function(e,t){var n=a(e),r=n.pathname,o=n.search,i=n.hash;return u({pathname:r,search:o.replace(new RegExp("([?&])"+t+"=[a-zA-Z0-9]+(&?)"),function(e,t,n){return"?"===t?t:n}),hash:i})},t.getQueryStringValueFromPath=function(e,t){var n=a(e),r=n.search,o=r.match(new RegExp("[?&]"+t+"=([a-zA-Z0-9]+)"));return o&&o[1]},function(e){var t=e.match(/^(https?:)?\/\/[^\/]*/);return null==t?e:e.substring(t[0].length)}),a=t.parsePath=function(e){var t=i(e),n="",r="",o=t.indexOf("#");-1!==o&&(r=t.substring(o),t=t.substring(0,o));var a=t.indexOf("?");return-1!==a&&(n=t.substring(a),t=t.substring(0,a)),""===t&&(t="/"),{pathname:t,search:n,hash:r}},u=t.createPath=function(e){if(null==e||"string"==typeof e)return e;var t=e.basename,n=e.pathname,r=e.search,o=e.hash,i=(t||"")+n;return r&&"?"!==r&&(i+=r),o&&(i+=o),i}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.locationsAreEqual=t.statesAreEqual=t.createLocation=t.createQuery=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(5),u=r(a),c=n(1),f=n(6),s=(t.createQuery=function(e){return i(Object.create(null),e)},t.createLocation=function(){var e=arguments.length<=0||void 0===arguments[0]?"/":arguments[0],t=arguments.length<=1||void 0===arguments[1]?f.POP:arguments[1],n=arguments.length<=2||void 0===arguments[2]?null:arguments[2],r="string"==typeof e?(0,c.parsePath)(e):e,o=r.pathname||"/",i=r.search||"",a=r.hash||"",u=r.state;return{pathname:o,search:i,hash:a,state:u,action:t,key:n}},function(e){return"[object Date]"===Object.prototype.toString.call(e)}),l=t.statesAreEqual=function d(e,t){if(e===t)return!0;var n="undefined"==typeof e?"undefined":o(e),r="undefined"==typeof t?"undefined":o(t);return n!==r?!1:("function"===n?(0,u["default"])(!1):void 0,"object"===n?(s(e)&&s(t)?(0,u["default"])(!1):void 0,Array.isArray(e)?Array.isArray(t)&&e.length===t.length&&e.every(function(e,n){return d(e,t[n])}):Object.keys(e).every(function(n){return d(e[n],t[n])})):!1)};t.locationsAreEqual=function(e,t){return e.key===t.key&&e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&l(e.state,t.state)}},function(e,t,n){"use strict";var r=function(){};e.exports=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.addEventListener=function(e,t,n){return e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},t.removeEventListener=function(e,t,n){return e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n)},t.supportsHistory=function(){var e=window.navigator.userAgent;return-1===e.indexOf("Android 2.")&&-1===e.indexOf("Android 4.0")||-1===e.indexOf("Mobile Safari")||-1!==e.indexOf("Chrome")||-1!==e.indexOf("Windows Phone")?window.history&&"pushState"in window.history:!1},t.supportsGoWithoutReloadUsingHash=function(){return-1===window.navigator.userAgent.indexOf("Firefox")}},function(e,t,n){"use strict";var r=function(e,t,n,r,o,i,a,u){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 f=[n,r,o,i,a,u],s=0;c=new Error(t.replace(/%s/g,function(){return f[s++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};e.exports=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PUSH="PUSH",t.REPLACE="REPLACE",t.POP="POP"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.go=t.replaceLocation=t.pushLocation=t.startListener=t.getUserConfirmation=t.getCurrentLocation=void 0;var r=n(2),o=n(4),i=n(11),a=n(1),u="popstate",c=function(e){var t=e&&e.key;return(0,r.createLocation)({pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,state:t?(0,i.readState)(t):void 0},void 0,t)},f=(t.getCurrentLocation=function(){var e=void 0;try{e=window.history.state||{}}catch(t){e={}}return c(e)},t.getUserConfirmation=function(e,t){return t(window.confirm(e))},t.startListener=function(e){var t=function(t){void 0!==t.state&&e(c(t.state))};return(0,o.addEventListener)(window,u,t),function(){return(0,o.removeEventListener)(window,u,t)}},function(e,t){var n=e.state,r=e.key;void 0!==n&&(0,i.saveState)(r,n),t({key:r},(0,a.createPath)(e))});t.pushLocation=function(e){return f(e,function(e,t){return window.history.pushState(e,null,t)})},t.replaceLocation=function(e){return f(e,function(e,t){return window.history.replaceState(e,null,t)})},t.go=function(e){e&&window.history.go(e)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(12),a=n(1),u=n(10),c=r(u),f=n(6),s=n(2),l=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.getCurrentLocation,n=e.getUserConfirmation,r=e.pushLocation,u=e.replaceLocation,l=e.go,d=e.keyLength,p=void 0,v=void 0,h=[],y=[],g=[],m=function(){return v&&v.action===f.POP?g.indexOf(v.key):p?g.indexOf(p.key):-1},O=function(e){p=e;var t=m();p.action===f.PUSH?g=[].concat(o(g.slice(0,t+1)),[p.key]):p.action===f.REPLACE&&(g[t]=p.key),y.forEach(function(e){return e(p)})},b=function(e){return h.push(e),function(){return h=h.filter(function(t){return t!==e})}},P=function(e){return y.push(e),function(){return y=y.filter(function(t){return t!==e})}},w=function(e,t){(0,i.loopAsync)(h.length,function(t,n,r){(0,c["default"])(h[t],e,function(e){return null!=e?r(e):n()})},function(e){n&&"string"==typeof e?n(e,function(e){return t(e!==!1)}):t(e!==!1)})},L=function(e){p&&(0,s.locationsAreEqual)(p,e)||v&&(0,s.locationsAreEqual)(v,e)||(v=e,w(e,function(t){if(v===e)if(v=null,t){if(e.action===f.PUSH){var n=(0,a.createPath)(p),o=(0,a.createPath)(e);o===n&&(0,s.statesAreEqual)(p.state,e.state)&&(e.action=f.REPLACE)}e.action===f.POP?O(e):e.action===f.PUSH?r(e)!==!1&&O(e):e.action===f.REPLACE&&u(e)!==!1&&O(e)}else if(p&&e.action===f.POP){var i=g.indexOf(p.key),c=g.indexOf(e.key);-1!==i&&-1!==c&&l(i-c)}}))},_=function(e){return L(M(e,f.PUSH))},j=function(e){return L(M(e,f.REPLACE))},A=function(){return l(-1)},E=function(){return l(1)},S=function(){return Math.random().toString(36).substr(2,d||6)},C=function(e){return(0,a.createPath)(e)},M=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?S():arguments[2];return(0,s.createLocation)(e,t,n)};return{getCurrentLocation:t,listenBefore:b,listen:P,transitionTo:L,push:_,replace:j,go:l,goBack:A,goForward:E,createKey:S,createPath:a.createPath,createHref:C,createLocation:M}};t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=(r(o),function(e,t,n){var r=e(t,n);e.length<2&&n(r)});t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.readState=t.saveState=void 0;var o=n(3),i=(r(o),["QuotaExceededError","QUOTA_EXCEEDED_ERR"]),a="SecurityError",u="@@History/",c=function(e){return u+e};t.saveState=function(e,t){if(window.sessionStorage)try{null==t?window.sessionStorage.removeItem(c(e)):window.sessionStorage.setItem(c(e),JSON.stringify(t))}catch(n){if(n.name===a)return;if(i.indexOf(n.name)>=0&&0===window.sessionStorage.length)return;throw n}},t.readState=function(e){var t=void 0;try{t=window.sessionStorage.getItem(c(e))}catch(n){if(n.name===a)return}if(t)try{return JSON.parse(t)}catch(n){}}},function(e,t){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});t.loopAsync=function(e,t,r){var o=0,i=!1,a=!1,u=!1,c=void 0,f=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return i=!0,a?void(c=t):void r.apply(void 0,t)},s=function l(){if(!i&&(u=!0,!a)){for(a=!0;!i&&e>o&&u;)u=!1,t(o++,l,f);return a=!1,i?void r.apply(void 0,n(c)):void(o>=e&&u&&(i=!0,r()))}};s()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.replaceLocation=t.pushLocation=t.startListener=t.getCurrentLocation=t.go=t.getUserConfirmation=void 0;var o=n(7);Object.defineProperty(t,"getUserConfirmation",{enumerable:!0,get:function(){return o.getUserConfirmation}}),Object.defineProperty(t,"go",{enumerable:!0,get:function(){return o.go}});var i=n(3),a=(r(i),n(2)),u=n(4),c=n(11),f=n(1),s="hashchange",l=function(){var e=window.location.href,t=e.indexOf("#");return-1===t?"":e.substring(t+1)},d=function(e){return window.location.hash=e},p=function(e){var t=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,t>=0?t:0)+"#"+e)},v=function(){var e=l();return(0,f.isAbsolutePath)(e)?!0:(p("/"+e),!1)},h=t.getCurrentLocation=function(e){var t=l(),n=(0,f.getQueryStringValueFromPath)(t,e),r=void 0;n&&(t=(0,f.stripQueryStringValueFromPath)(t,e),r=(0,c.readState)(n));var o=(0,f.parsePath)(t);return o.state=r,(0,a.createLocation)(o,void 0,n)},y=void 0,g=(t.startListener=function(e,t){var n=function(){if(v()){var n=h(t);y&&n.key&&y.key===n.key||(y=n,e(n))}};return v(),(0,u.addEventListener)(window,s,n),function(){return(0,u.removeEventListener)(window,s,n)}},function(e,t,n){var r=e.state,o=e.key,i=(0,f.createPath)(e);void 0!==r&&(i=(0,f.addQueryStringValueToPath)(i,t,o),(0,c.saveState)(o,r)),y=e,n(i)});t.pushLocation=function(e,t){return g(e,t,function(e){l()!==e&&d(e)})},t.replaceLocation=function(e,t){return g(e,t,function(e){l()!==e&&p(e)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.replaceLocation=t.pushLocation=t.getCurrentLocation=t.go=t.getUserConfirmation=void 0;var r=n(7);Object.defineProperty(t,"getUserConfirmation",{enumerable:!0,get:function(){return r.getUserConfirmation}}),Object.defineProperty(t,"go",{enumerable:!0,get:function(){return r.go}});var o=n(2),i=n(1);t.getCurrentLocation=function(){return(0,o.createLocation)(window.location)},t.pushLocation=function(e){return window.location.href=(0,i.createPath)(e),!1},t.replaceLocation=function(e){return window.location.replace((0,i.createPath)(e)),!1}},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(5),u=o(a),c=n(8),f=n(7),s=r(f),l=n(14),d=r(l),p=n(4),v=n(9),h=o(v),y=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];c.canUseDOM?void 0:(0,u["default"])(!1);var t=e.forceRefresh||!(0,p.supportsHistory)(),n=t?d:s,r=n.getUserConfirmation,o=n.getCurrentLocation,a=n.pushLocation,f=n.replaceLocation,l=n.go,v=(0,h["default"])(i({getUserConfirmation:r},e,{getCurrentLocation:o,pushLocation:a,replaceLocation:f,go:l})),y=0,g=void 0,m=function(e,t){1===++y&&(g=s.startListener(v.transitionTo));var n=t?v.listenBefore(e):v.listen(e);return function(){n(),0===--y&&g()}},O=function(e){return m(e,!0)},b=function(e){return m(e,!1)};return i({},v,{listenBefore:O,listen:b})};t["default"]=y},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(3),u=(o(a),n(5)),c=o(u),f=n(8),s=n(4),l=n(13),d=r(l),p=n(9),v=o(p),h="_k",y=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];f.canUseDOM?void 0:(0,c["default"])(!1);var t=e.queryKey;"string"!=typeof t&&(t=h);var n=d.getUserConfirmation,r=function(){return d.getCurrentLocation(t)},o=function(e){return d.pushLocation(e,t)},a=function(e){return d.replaceLocation(e,t)},u=(0,v["default"])(i({getUserConfirmation:n},e,{getCurrentLocation:r,pushLocation:o,replaceLocation:a,go:d.go})),l=0,p=void 0,y=function(e,n){1===++l&&(p=d.startListener(u.transitionTo,t));var r=n?u.listenBefore(e):u.listen(e);return function(){r(),0===--l&&p()}},g=function(e){return y(e,!0)},m=function(e){return y(e,!1)},O=((0,s.supportsGoWithoutReloadUsingHash)(),function(e){u.go(e)}),b=function(e){return"#"+u.createHref(e)};return i({},u,{listenBefore:g,listen:m,go:O,createHref:b})};t["default"]=y},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(3),a=(r(i),n(5)),u=r(a),c=n(2),f=n(1),s=n(9),l=r(s),d=n(6),p=function(e){return e.filter(function(e){return e.state}).reduce(function(e,t){return e[t.key]=t.state,e},{})},v=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];Array.isArray(e)?e={entries:e}:"string"==typeof e&&(e={entries:[e]});var t=function(){var e=h[y],t=(0,f.createPath)(e),n=void 0,r=void 0;e.key&&(n=e.key,r=O(n));var i=(0,f.parsePath)(t);return(0,c.createLocation)(o({},i,{state:r}),void 0,n)},n=function(e){var t=y+e;return t>=0&&t<h.length},r=function(e){if(e&&n(e)){y+=e;var r=t();s.transitionTo(o({},r,{action:d.POP}))}},i=function(e){y+=1,y<h.length&&h.splice(y),h.push(e),m(e.key,e.state)},a=function(e){h[y]=e,m(e.key,e.state)},s=(0,l["default"])(o({},e,{getCurrentLocation:t,pushLocation:i,replaceLocation:a,go:r})),v=e,h=v.entries,y=v.current;"string"==typeof h?h=[h]:Array.isArray(h)||(h=["/"]),h=h.map(function(e){return(0,c.createLocation)(e)}),null==y?y=h.length-1:y>=0&&y<h.length?void 0:(0,u["default"])(!1);var g=p(h),m=function(e,t){return g[e]=t},O=function(e){return g[e]};return s};t["default"]=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(10),a=r(i),u=n(1),c=function(e){return function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e(t),r=t.basename,i=function(e){return e?(r&&null==e.basename&&(0===e.pathname.indexOf(r)?(e.pathname=e.pathname.substring(r.length),e.basename=r,""===e.pathname&&(e.pathname="/")):e.basename=""),e):e},c=function(e){if(!r)return e;var t="string"==typeof e?(0,u.parsePath)(e):e,n=t.pathname,i="/"===r.slice(-1)?r:r+"/",a="/"===n.charAt(0)?n.slice(1):n,c=i+a;return o({},e,{pathname:c})},f=function(){return i(n.getCurrentLocation())},s=function(e){return n.listenBefore(function(t,n){return(0,a["default"])(e,i(t),n)})},l=function(e){return n.listen(function(t){return e(i(t))})},d=function(e){return n.push(c(e))},p=function(e){return n.replace(c(e))},v=function(e){return n.createPath(c(e))},h=function(e){return n.createHref(c(e))},y=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;t>o;o++)r[o-1]=arguments[o];return i(n.createLocation.apply(n,[c(e)].concat(r)))};return o({},n,{getCurrentLocation:f,listenBefore:s,listen:l,push:d,replace:p,createPath:v,createHref:h,createLocation:y})}};t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(5),a=r(i),u=n(4),c=n(8),f=function(e){var t=function(t){var n=e();return"string"==typeof n?((t||window.event).returnValue=n,n):void 0};return(0,u.addEventListener)(window,"beforeunload",t),function(){return(0,u.removeEventListener)(window,"beforeunload",t)}},s=function(e){return c.canUseDOM?void 0:(0,a["default"])(!1),function(t){var n=e(t),r=[],i=void 0,a=function(){for(var e=void 0,t=0,n=r.length;null==e&&n>t;++t)e=r[t].call();return e},u=function(e){return 1===r.push(e)&&(i=f(a)),function(){r=r.filter(function(t){return t!==e}),0===r.length&&i&&(i(),i=null)}};return o({},n,{listenBeforeUnload:u})}};t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(22),a=n(10),u=r(a),c=n(2),f=n(1),s=function(e){return(0,i.stringify)(e).replace(/%20/g,"+")},l=i.parse,d=function(e){return function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e(t),r=t.stringifyQuery,i=t.parseQueryString;"function"!=typeof r&&(r=s),"function"!=typeof i&&(i=l);var a=function(e){return e?(null==e.query&&(e.query=i(e.search.substring(1))),e):e},d=function(e,t){if(null==t)return e;var n="string"==typeof e?(0,f.parsePath)(e):e,i=r(t),a=i?"?"+i:"";return o({},n,{search:a})},p=function(){return a(n.getCurrentLocation())},v=function(e){return n.listenBefore(function(t,n){return(0,u["default"])(e,a(t),n)})},h=function(e){return n.listen(function(t){return e(a(t))})},y=function(e){return n.push(d(e,e.query))},g=function(e){return n.replace(d(e,e.query))},m=function(e){return n.createPath(d(e,e.query))},O=function(e){return n.createHref(d(e,e.query))},b=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;t>o;o++)r[o-1]=arguments[o];var i=n.createLocation.apply(n,[d(e,e.query)].concat(r));return e.query&&(i.query=(0,c.createQuery)(e.query)),a(i)};return o({},n,{getCurrentLocation:p,listenBefore:v,listen:h,push:y,replace:g,createPath:m,createHref:O,createLocation:b})}};t["default"]=d},function(e,t){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){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={},n=0;10>n;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(i){return!1}}var o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,a,u=n(e),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var f in r)o.call(r,f)&&(u[f]=r[f]);if(Object.getOwnPropertySymbols){a=Object.getOwnPropertySymbols(r);for(var s=0;s<a.length;s++)i.call(r,a[s])&&(u[a[s]]=r[a[s]])}}return u}},function(e,t,n){"use strict";function r(e,t){return t.encode?t.strict?o(e):encodeURIComponent(e):e}var o=n(23),i=n(21);t.extract=function(e){return e.split("?")[1]||""},t.parse=function(e){var t=Object.create(null);return"string"!=typeof e?t:(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var n=e.replace(/\+/g," ").split("="),r=n.shift(),o=n.length>0?n.join("="):void 0;r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),void 0===t[r]?t[r]=o:Array.isArray(t[r])?t[r].push(o):t[r]=[t[r],o]}),t):t},t.stringify=function(e,t){var n={encode:!0,strict:!0};return t=i(n,t),e?Object.keys(e).sort().map(function(n){var o=e[n];if(void 0===o)return"";if(null===o)return n;if(Array.isArray(o)){var i=[];return o.slice().sort().forEach(function(e){void 0!==e&&(null===e?i.push(r(n,t)):i.push(r(n,t)+"="+r(e,t)))}),i.join("&")}return r(n,t)+"="+r(o,t)}).filter(function(e){return e.length>0}).join("&"):""}},function(e,t){"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.History=e():t.History=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0,e.locationsAreEqual=e.Actions=e.useQueries=e.useBeforeUnload=e.useBasename=e.createMemoryHistory=e.createHashHistory=e.createHistory=void 0;var i=n(2);Object.defineProperty(e,"locationsAreEqual",{enumerable:!0,get:function(){return i.locationsAreEqual}});var a=n(15),u=o(a),c=n(16),s=o(c),f=n(17),l=o(f),d=n(18),h=o(d),p=n(19),v=o(p),g=n(20),y=o(g),m=n(6),w=r(m);e.createHistory=u["default"],e.createHashHistory=s["default"],e.createMemoryHistory=l["default"],e.useBasename=h["default"],e.useBeforeUnload=v["default"],e.useQueries=y["default"],e.Actions=w},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0,e.createPath=e.parsePath=e.getQueryStringValueFromPath=e.stripQueryStringValueFromPath=e.addQueryStringValueToPath=void 0;var o=n(3),i=(r(o),e.addQueryStringValueToPath=function(t,e,n){var r=a(t),o=r.pathname,i=r.search,c=r.hash;return u({pathname:o,search:i+(i.indexOf("?")===-1?"?":"&")+e+"="+n,hash:c})},e.stripQueryStringValueFromPath=function(t,e){var n=a(t),r=n.pathname,o=n.search,i=n.hash;return u({pathname:r,search:o.replace(new RegExp("([?&])"+e+"=[a-zA-Z0-9]+(&?)"),function(t,e,n){return"?"===e?e:n}),hash:i})},e.getQueryStringValueFromPath=function(t,e){var n=a(t),r=n.search,o=r.match(new RegExp("[?&]"+e+"=([a-zA-Z0-9]+)"));return o&&o[1]},function(t){var e=t.match(/^(https?:)?\/\/[^\/]*/);return null==e?t:t.substring(e[0].length)}),a=e.parsePath=function(t){var e=i(t),n="",r="",o=e.indexOf("#");o!==-1&&(r=e.substring(o),e=e.substring(0,o));var a=e.indexOf("?");return a!==-1&&(n=e.substring(a),e=e.substring(0,a)),""===e&&(e="/"),{pathname:e,search:n,hash:r}},u=e.createPath=function(t){if(null==t||"string"==typeof t)return t;var e=t.basename,n=t.pathname,r=t.search,o=t.hash,i=(e||"")+n;return r&&"?"!==r&&(i+=r),o&&(i+=o),i}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0,e.locationsAreEqual=e.statesAreEqual=e.createLocation=e.createQuery=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},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=n(5),u=r(a),c=n(3),s=(r(c),n(1)),f=n(6),l=(e.createQuery=function(t){return i(Object.create(null),t)},e.createLocation=function(){var t=arguments.length<=0||void 0===arguments[0]?"/":arguments[0],e=arguments.length<=1||void 0===arguments[1]?f.POP:arguments[1],n=arguments.length<=2||void 0===arguments[2]?null:arguments[2],r="string"==typeof t?(0,s.parsePath)(t):t,o=r.pathname||"/",i=r.search||"",a=r.hash||"",u=r.state;return{pathname:o,search:i,hash:a,state:u,action:e,key:n}},function(t){return"[object Date]"===Object.prototype.toString.call(t)}),d=e.statesAreEqual=function h(t,e){if(t===e)return!0;var n="undefined"==typeof t?"undefined":o(t),r="undefined"==typeof e?"undefined":o(e);if(n!==r)return!1;if("function"===n?(0,u["default"])(!1):void 0,"object"===n){if(l(t)&&l(e)?(0,u["default"])(!1):void 0,!Array.isArray(t)){var i=Object.keys(t),a=Object.keys(e);return i.length===a.length&&i.every(function(n){return h(t[n],e[n])})}return Array.isArray(e)&&t.length===e.length&&t.every(function(t,n){return h(t,e[n])})}return!1};e.locationsAreEqual=function(t,e){return t.key===e.key&&t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&d(t.state,e.state)}},function(t,e,n){"use strict";var r=function(){};t.exports=r},function(t,e){"use strict";e.__esModule=!0;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.supportsHistory=function(){var t=window.navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history)},e.supportsGoWithoutReloadUsingHash=function(){return window.navigator.userAgent.indexOf("Firefox")===-1},e.supportsPopstateOnHashchange=function(){return window.navigator.userAgent.indexOf("Trident")===-1}},function(t,e,n){"use strict";var r=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 s=[n,r,o,i,a,u],f=0;c=new Error(e.replace(/%s/g,function(){return s[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};t.exports=r},function(t,e){"use strict";e.__esModule=!0;e.PUSH="PUSH",e.REPLACE="REPLACE",e.POP="POP"},function(t,e,n){"use strict";e.__esModule=!0,e.go=e.replaceLocation=e.pushLocation=e.startListener=e.getUserConfirmation=e.getCurrentLocation=void 0;var r=n(2),o=n(4),i=n(11),a=n(1),u="popstate",c="hashchange",s=!(0,o.supportsPopstateOnHashchange)(),f=function(t){var e=t&&t.key;return(0,r.createLocation)({pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,state:e?(0,i.readState)(e):void 0},void 0,e)},l=e.getCurrentLocation=function(){var t=void 0;try{t=window.history.state||{}}catch(e){t={}}return f(t)},d=(e.getUserConfirmation=function(t,e){return e(window.confirm(t))},e.startListener=function(t){var e=function(e){void 0!==e.state&&t(f(e.state))};(0,o.addEventListener)(window,u,e);var n=function(){return t(l())};return s&&(0,o.addEventListener)(window,c,n),function(){(0,o.removeEventListener)(window,u,e),s&&(0,o.removeEventListener)(window,c,n)}},function(t,e){var n=t.state,r=t.key;void 0!==n&&(0,i.saveState)(r,n),e({key:r},(0,a.createPath)(t))});e.pushLocation=function(t){return d(t,function(t,e){return window.history.pushState(t,null,e)})},e.replaceLocation=function(t){return d(t,function(t,e){return window.history.replaceState(t,null,e)})},e.go=function(t){t&&window.history.go(t)}},function(t,e){"use strict";e.__esModule=!0;e.canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=n(12),i=n(1),a=n(10),u=r(a),c=n(6),s=n(2),f=function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=t.getCurrentLocation,n=t.getUserConfirmation,r=t.pushLocation,a=t.replaceLocation,f=t.go,l=t.keyLength,d=void 0,h=void 0,p=[],v=[],g=[],y=function(){return h&&h.action===c.POP?g.indexOf(h.key):d?g.indexOf(d.key):-1},m=function(t){var e=y();d=t,d.action===c.PUSH?g=[].concat(g.slice(0,e+1),[d.key]):d.action===c.REPLACE&&(g[e]=d.key),v.forEach(function(t){return t(d)})},w=function(t){return p.push(t),function(){return p=p.filter(function(e){return e!==t})}},P=function(t){return v.push(t),function(){return v=v.filter(function(e){return e!==t})}},O=function(t,e){(0,o.loopAsync)(p.length,function(e,n,r){(0,u["default"])(p[e],t,function(t){return null!=t?r(t):n()})},function(t){n&&"string"==typeof t?n(t,function(t){return e(t!==!1)}):e(t!==!1)})},b=function(t){d&&(0,s.locationsAreEqual)(d,t)||h&&(0,s.locationsAreEqual)(h,t)||(h=t,O(t,function(e){if(h===t)if(h=null,e){if(t.action===c.PUSH){var n=(0,i.createPath)(d),o=(0,i.createPath)(t);o===n&&(0,s.statesAreEqual)(d.state,t.state)&&(t.action=c.REPLACE)}t.action===c.POP?m(t):t.action===c.PUSH?r(t)!==!1&&m(t):t.action===c.REPLACE&&a(t)!==!1&&m(t)}else if(d&&t.action===c.POP){var u=g.indexOf(d.key),l=g.indexOf(t.key);u!==-1&&l!==-1&&f(u-l)}}))},L=function(t){return b(C(t,c.PUSH))},_=function(t){return b(C(t,c.REPLACE))},E=function(){return f(-1)},j=function(){return f(1)},A=function(){return Math.random().toString(36).substr(2,l||6)},S=function(t){return(0,i.createPath)(t)},C=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?A():arguments[2];return(0,s.createLocation)(t,e,n)};return{getCurrentLocation:e,listenBefore:w,listen:P,transitionTo:b,push:L,replace:_,go:f,goBack:E,goForward:j,createKey:A,createPath:i.createPath,createHref:S,createLocation:C}};e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=n(3),i=(r(o),function(t,e,n){var r=t(e,n);t.length<2&&n(r)});e["default"]=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0,e.readState=e.saveState=void 0;var o=n(3),i=(r(o),{QuotaExceededError:!0,QUOTA_EXCEEDED_ERR:!0}),a={SecurityError:!0},u="@@History/",c=function(t){return u+t};e.saveState=function(t,e){if(window.sessionStorage)try{null==e?window.sessionStorage.removeItem(c(t)):window.sessionStorage.setItem(c(t),JSON.stringify(e))}catch(n){if(a[n.name])return;if(i[n.name]&&0===window.sessionStorage.length)return;throw n}},e.readState=function(t){var e=void 0;try{e=window.sessionStorage.getItem(c(t))}catch(n){if(a[n.name])return}if(e)try{return JSON.parse(e)}catch(n){}}},function(t,e){"use strict";e.__esModule=!0;e.loopAsync=function(t,e,n){var r=0,o=!1,i=!1,a=!1,u=void 0,c=function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return o=!0,i?void(u=e):void n.apply(void 0,e)},s=function f(){if(!o&&(a=!0,!i)){for(i=!0;!o&&r<t&&a;)a=!1,e(r++,f,c);return i=!1,o?void n.apply(void 0,u):void(r>=t&&a&&(o=!0,n()))}};s()}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0,e.replaceLocation=e.pushLocation=e.startListener=e.getCurrentLocation=e.go=e.getUserConfirmation=void 0;var o=n(7);Object.defineProperty(e,"getUserConfirmation",{enumerable:!0,get:function(){return o.getUserConfirmation}}),Object.defineProperty(e,"go",{enumerable:!0,get:function(){return o.go}});var i=n(3),a=(r(i),n(2)),u=n(4),c=n(11),s=n(1),f="hashchange",l=function(){var t=window.location.href,e=t.indexOf("#");return e===-1?"":t.substring(e+1)},d=function(t){return window.location.hash=t},h=function(t){var e=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,e>=0?e:0)+"#"+t)},p=e.getCurrentLocation=function(t,e){var n=t.decodePath(l()),r=(0,s.getQueryStringValueFromPath)(n,e),o=void 0;r&&(n=(0,s.stripQueryStringValueFromPath)(n,e),o=(0,c.readState)(r));var i=(0,s.parsePath)(n);return i.state=o,(0,a.createLocation)(i,void 0,r)},v=void 0,g=(e.startListener=function(t,e,n){var r=function(){var r=l(),o=e.encodePath(r);if(r!==o)h(o);else{var i=p(e,n);if(v&&i.key&&v.key===i.key)return;v=i,t(i)}},o=l(),i=e.encodePath(o);return o!==i&&h(i),(0,u.addEventListener)(window,f,r),function(){return(0,u.removeEventListener)(window,f,r)}},function(t,e,n,r){var o=t.state,i=t.key,a=e.encodePath((0,s.createPath)(t));void 0!==o&&(a=(0,s.addQueryStringValueToPath)(a,n,i),(0,c.saveState)(i,o)),v=t,r(a)});e.pushLocation=function(t,e,n){return g(t,e,n,function(t){l()!==t&&d(t)})},e.replaceLocation=function(t,e,n){return g(t,e,n,function(t){l()!==t&&h(t)})}},function(t,e,n){"use strict";e.__esModule=!0,e.replaceLocation=e.pushLocation=e.getCurrentLocation=e.go=e.getUserConfirmation=void 0;var r=n(7);Object.defineProperty(e,"getUserConfirmation",{enumerable:!0,get:function(){return r.getUserConfirmation}}),Object.defineProperty(e,"go",{enumerable:!0,get:function(){return r.go}});var o=n(2),i=n(1);e.getCurrentLocation=function(){return(0,o.createLocation)(window.location)},e.pushLocation=function(t){return window.location.href=(0,i.createPath)(t),!1},e.replaceLocation=function(t){return window.location.replace((0,i.createPath)(t)),!1}},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!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=n(5),u=o(a),c=n(8),s=n(7),f=r(s),l=n(14),d=r(l),h=n(4),p=n(9),v=o(p),g=function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];c.canUseDOM?void 0:(0,u["default"])(!1);var e=t.forceRefresh||!(0,h.supportsHistory)(),n=e?d:f,r=n.getUserConfirmation,o=n.getCurrentLocation,a=n.pushLocation,s=n.replaceLocation,l=n.go,p=(0,v["default"])(i({getUserConfirmation:r},t,{getCurrentLocation:o,pushLocation:a,replaceLocation:s,go:l})),g=0,y=void 0,m=function(t,e){1===++g&&(y=f.startListener(p.transitionTo));var n=e?p.listenBefore(t):p.listen(t);return function(){n(),0===--g&&y()}},w=function(t){return m(t,!0)},P=function(t){return m(t,!1)};return i({},p,{listenBefore:w,listen:P})};e["default"]=g},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!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=n(3),u=(o(a),n(5)),c=o(u),s=n(8),f=n(4),l=n(13),d=r(l),h=n(9),p=o(h),v="_k",g=function(t){return"/"===t.charAt(0)?t:"/"+t},y={hashbang:{encodePath:function(t){return"!"===t.charAt(0)?t:"!"+t},decodePath:function(t){return"!"===t.charAt(0)?t.substring(1):t}},noslash:{encodePath:function(t){return"/"===t.charAt(0)?t.substring(1):t},decodePath:g},slash:{encodePath:g,decodePath:g}},m=function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];s.canUseDOM?void 0:(0,c["default"])(!1);var e=t.queryKey,n=t.hashType;"string"!=typeof e&&(e=v),null==n&&(n="slash"),n in y||(n="slash");var r=y[n],o=d.getUserConfirmation,a=function(){return d.getCurrentLocation(r,e)},u=function(t){return d.pushLocation(t,r,e)},l=function(t){return d.replaceLocation(t,r,e)},h=(0,p["default"])(i({getUserConfirmation:o},t,{getCurrentLocation:a,pushLocation:u,replaceLocation:l,go:d.go})),g=0,m=void 0,w=function(t,n){1===++g&&(m=d.startListener(h.transitionTo,r,e));var o=n?h.listenBefore(t):h.listen(t);return function(){o(),0===--g&&m()}},P=function(t){return w(t,!0)},O=function(t){return w(t,!1)},b=((0,f.supportsGoWithoutReloadUsingHash)(),function(t){h.go(t)}),L=function(t){return"#"+r.encodePath(h.createHref(t))};return i({},h,{listenBefore:P,listen:O,go:b,createHref:L})};e["default"]=m},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=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},i=n(3),a=(r(i),n(5)),u=r(a),c=n(2),s=n(1),f=n(9),l=r(f),d=n(6),h=function(t){return t.filter(function(t){return t.state}).reduce(function(t,e){return t[e.key]=e.state,t},{})},p=function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];Array.isArray(t)?t={entries:t}:"string"==typeof t&&(t={entries:[t]});var e=function(){var t=v[g],e=(0,s.createPath)(t),n=void 0,r=void 0;t.key&&(n=t.key,r=w(n));var i=(0,s.parsePath)(e);return(0,c.createLocation)(o({},i,{state:r}),void 0,n)},n=function(t){var e=g+t;return e>=0&&e<v.length},r=function(t){if(t&&n(t)){g+=t;var r=e();f.transitionTo(o({},r,{action:d.POP}))}},i=function(t){g+=1,g<v.length&&v.splice(g),v.push(t),m(t.key,t.state)},a=function(t){v[g]=t,m(t.key,t.state)},f=(0,l["default"])(o({},t,{getCurrentLocation:e,pushLocation:i,replaceLocation:a,go:r})),p=t,v=p.entries,g=p.current;"string"==typeof v?v=[v]:Array.isArray(v)||(v=["/"]),v=v.map(function(t){return(0,c.createLocation)(t)}),null==g?g=v.length-1:g>=0&&g<v.length?void 0:(0,u["default"])(!1);var y=h(v),m=function(t,e){return y[t]=e},w=function(t){return y[t]};return f};e["default"]=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=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},i=n(10),a=r(i),u=n(1),c=function(t){return function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=t(e),r=e.basename,i=function(t){return t?(r&&null==t.basename&&(0===t.pathname.indexOf(r)?(t.pathname=t.pathname.substring(r.length),t.basename=r,""===t.pathname&&(t.pathname="/")):t.basename=""),t):t},c=function(t){if(!r)return t;var e="string"==typeof t?(0,u.parsePath)(t):t,n=e.pathname,i="/"===r.slice(-1)?r:r+"/",a="/"===n.charAt(0)?n.slice(1):n,c=i+a;return o({},e,{pathname:c})},s=function(){return i(n.getCurrentLocation())},f=function(t){return n.listenBefore(function(e,n){return(0,a["default"])(t,i(e),n)})},l=function(t){return n.listen(function(e){return t(i(e))})},d=function(t){return n.push(c(t))},h=function(t){return n.replace(c(t))},p=function(t){return n.createPath(c(t))},v=function(t){return n.createHref(c(t))},g=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return i(n.createLocation.apply(n,[c(t)].concat(r)))};return o({},n,{getCurrentLocation:s,listenBefore:f,listen:l,push:d,replace:h,createPath:p,createHref:v,createLocation:g})}};e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=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},i=n(5),a=r(i),u=n(4),c=n(8),s=function(t){var e=function(e){var n=t();if("string"==typeof n)return(e||window.event).returnValue=n,n};return(0,u.addEventListener)(window,"beforeunload",e),function(){return(0,u.removeEventListener)(window,"beforeunload",e)}},f=function(t){return c.canUseDOM?void 0:(0,a["default"])(!1),function(e){var n=t(e),r=[],i=void 0,a=function(){for(var t=void 0,e=0,n=r.length;null==t&&e<n;++e)t=r[e].call();return t},u=function(t){return 1===r.push(t)&&(i=s(a)),function(){r=r.filter(function(e){return e!==t}),0===r.length&&i&&(i(),i=null)}};return o({},n,{listenBeforeUnload:u})}};e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=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},i=n(22),a=n(10),u=r(a),c=n(2),s=n(1),f=function(t){return(0,i.stringify)(t).replace(/%20/g,"+")},l=i.parse,d=function(t){return function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=t(e),r=e.stringifyQuery,i=e.parseQueryString;"function"!=typeof r&&(r=f),"function"!=typeof i&&(i=l);var a=function(t){return t?(null==t.query&&(t.query=i(t.search.substring(1))),t):t},d=function(t,e){if(null==e)return t;var n="string"==typeof t?(0,s.parsePath)(t):t,i=r(e),a=i?"?"+i:"";return o({},n,{search:a})},h=function(){return a(n.getCurrentLocation())},p=function(t){return n.listenBefore(function(e,n){return(0,u["default"])(t,a(e),n)})},v=function(t){return n.listen(function(e){return t(a(e))})},g=function(t){return n.push(d(t,t.query))},y=function(t){return n.replace(d(t,t.query))},m=function(t){return n.createPath(d(t,t.query))},w=function(t){return n.createHref(d(t,t.query))},P=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];var i=n.createLocation.apply(n,[d(t,t.query)].concat(r));return t.query&&(i.query=(0,c.createQuery)(t.query)),a(i)};return o({},n,{getCurrentLocation:h,listenBefore:p,listen:v,push:g,replace:y,createPath:m,createHref:w,createLocation:P})}};e["default"]=d},function(t,e){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function r(){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;var r=Object.getOwnPropertyNames(e).map(function(t){return e[t]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(i){return!1}}var o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;t.exports=r()?Object.assign:function(t,e){for(var r,a,u=n(t),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var s in r)o.call(r,s)&&(u[s]=r[s]);if(Object.getOwnPropertySymbols){a=Object.getOwnPropertySymbols(r);for(var f=0;f<a.length;f++)i.call(r,a[f])&&(u[a[f]]=r[a[f]])}}return u}},function(t,e,n){"use strict";function r(t,e){return e.encode?e.strict?o(t):encodeURIComponent(t):t}var o=n(23),i=n(21);e.extract=function(t){return t.split("?")[1]||""},e.parse=function(t){var e=Object.create(null);return"string"!=typeof t?e:(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=n.shift(),o=n.length>0?n.join("="):void 0;r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]}),e):e},e.stringify=function(t,e){var n={encode:!0,strict:!0};return e=i(n,e),t?Object.keys(t).sort().map(function(n){var o=t[n];if(void 0===o)return"";if(null===o)return r(n,e);if(Array.isArray(o)){var i=[];return o.slice().forEach(function(t){void 0!==t&&(null===t?i.push(r(n,e)):i.push(r(n,e)+"="+r(t,e)))}),i.join("&")}return r(n,e)+"="+r(o,e)}).filter(function(t){return t.length>0}).join("&"):""}},function(t,e){"use strict";t.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}}])}); |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
152436
27
25
2695
0
78
4
18
+ Addedloose-envify@^1.2.0
+ Addedwarning@3.0.0(transitive)
- Removedwarning@2.1.0(transitive)
Updatedinvariant@^2.2.1
Updatedquery-string@^4.2.2
Updatedwarning@^3.0.0