diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..100bd13 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +ko-component-router.js linguist-generated=true +ko-component-router.min.js linguist-generated=true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 561d713..fe006a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,10 @@ .DS_Store -npm-debug.log -npm-debug.log.* + +*.log .cache/ .chrome/ .vscode/ coverage/ -node_modules/ - dist/ +node_modules/ diff --git a/.travis.yml b/.travis.yml index a5120b5..cdd4adb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,13 +13,13 @@ cache: directories: - node_modules before_install: -- yarn global add greenkeeper-lockfile@1 +- yarn global add coveralls greenkeeper-lockfile@1 before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - greenkeeper-lockfile-update after_script: -- "./node_modules/coveralls/bin/coveralls.js < coverage/lcov.info" +- coveralls < coverage/lcov.info - greenkeeper-lockfile-upload notifications: email: false diff --git a/LICENSE.md b/LICENSE.md index 866e95a..2a064b0 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 -Copyright (C) 2004 Sam Hocevar +Copyright (C) 2017 Casey Webb Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long diff --git a/bower.json b/bower.json index 9cacea1..1b276d3 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "ko-component-router", "description": "Component-based routing for KnockoutJS", - "main": "dist/ko-component-router.js", + "main": "ko-component-router.js", "authors": [ "Casey Webb " ], diff --git a/examples/.eslintrc b/examples/.eslintrc new file mode 100644 index 0000000..434001c --- /dev/null +++ b/examples/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": "profiscience", + "parserOptions": { + "sourceType": "module" + } +} \ No newline at end of file diff --git a/examples/lazy-loading/plugins/lazy-component-loader.js b/examples/lazy-loading/plugins/lazy-component-loader.js index 2abd6ad..d6d142f 100644 --- a/examples/lazy-loading/plugins/lazy-component-loader.js +++ b/examples/lazy-loading/plugins/lazy-component-loader.js @@ -7,7 +7,7 @@ export default function plugin(componentName) { componentName, // then some middleware to load that component... - (ctx) => { + () => { // bail if already loaded if (ko.components.isRegistered(componentName)) { return @@ -16,6 +16,7 @@ export default function plugin(componentName) { // https://webpack.js.org/guides/code-splitting-import/ return import('../views/' + componentName + '/index.js') .then((exports) => ko.components.register(componentName, exports)) + // eslint-disable-next-line no-console .catch((err) => console.error('Error fetching component', componentName, err)) } ] diff --git a/examples/webpack.config.js b/examples/webpack.config.js index 8500e46..cc45ec9 100644 --- a/examples/webpack.config.js +++ b/examples/webpack.config.js @@ -1,4 +1,4 @@ -'use strict' +'use strict' // eslint-disable-line strict const path = require('path') diff --git a/flyfile.js b/flyfile.js deleted file mode 100644 index 3d4b13e..0000000 --- a/flyfile.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict' - -const { extend } = require('lodash') - -extend(exports, require('./tasks/test')) -exports.bundle = require('./tasks/bundle') -exports.modules = require('./tasks/modules') -exports.stats = require('./tasks/stats') -exports.typings = require('./tasks/typings') -exports.umd = require('./tasks/umd') - -exports.build = function * (fly) { - yield fly.parallel(['modules', 'umd', 'typings']) - yield fly.start('bundle') - yield fly.start('stats') -} - -exports.watch = function * (fly) { - yield fly.start('build') - yield fly.watch('src/*.ts', 'build') -} diff --git a/ko-component-router.js b/ko-component-router.js new file mode 100644 index 0000000..e4ede61 --- /dev/null +++ b/ko-component-router.js @@ -0,0 +1,5434 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('knockout')) : + typeof define === 'function' && define.amd ? define(['exports', 'knockout'], factory) : + (factory((global.ko = global.ko || {}, global.ko.router = {}),global.ko)); +}(this, (function (exports,ko) { 'use strict'; + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global Reflect, Promise */ + + + + + + + + + + + + + +function __awaiter(thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + + + +function __values(o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +} + +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} + +var _global = createCommonjsModule(function (module) { +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef +}); + +var _core = createCommonjsModule(function (module) { +var core = module.exports = { version: '2.5.1' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef +}); + +var _library = false; + +var SHARED = '__core-js_shared__'; +var store = _global[SHARED] || (_global[SHARED] = {}); +var _shared = function (key) { + return store[key] || (store[key] = {}); +}; + +var id = 0; +var px = Math.random(); +var _uid = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + +var _wks = createCommonjsModule(function (module) { +var store = _shared('wks'); + +var Symbol = _global.Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name)); +}; + +$exports.store = store; +}); + +var f = _wks; + +var _wksExt = { + f: f +}; + +var _isObject = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + +var _anObject = function (it) { + if (!_isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + +var _fails = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + +// Thank's IE8 for his funny defineProperty +var _descriptors = !_fails(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); + +var document$1 = _global.document; +// typeof document.createElement is 'object' in old IE +var is = _isObject(document$1) && _isObject(document$1.createElement); +var _domCreate = function (it) { + return is ? document$1.createElement(it) : {}; +}; + +var _ie8DomDefine = !_descriptors && !_fails(function () { + return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7; +}); + +// 7.1.1 ToPrimitive(input [, PreferredType]) + +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +var _toPrimitive = function (it, S) { + if (!_isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + +var dP = Object.defineProperty; + +var f$1 = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { + _anObject(O); + P = _toPrimitive(P, true); + _anObject(Attributes); + if (_ie8DomDefine) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; + +var _objectDp = { + f: f$1 +}; + +var defineProperty = _objectDp.f; +var _wksDefine = function (name) { + var $Symbol = _core.Symbol || (_core.Symbol = _library ? {} : _global.Symbol || {}); + if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) }); +}; + +_wksDefine('asyncIterator'); + +_wksDefine('observable'); + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** Built-in value references. */ +var Symbol$1 = root.Symbol; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** Built-in value references. */ +var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined; + +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag$1), + tag = value[symToStringTag$1]; + + try { + value[symToStringTag$1] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag$1] = tag; + } else { + delete value[symToStringTag$1]; + } + } + return result; +} + +/** Used for built-in method references. */ +var objectProto$1 = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString$1 = objectProto$1.toString; + +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ +function objectToString(value) { + return nativeObjectToString$1.call(value); +} + +/** `Object#toString` result references. */ +var nullTag = '[object Null]'; +var undefinedTag = '[object Undefined]'; + +/** Built-in value references. */ +var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined; + +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject$1(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); +} + +/** `Object#toString` result references. */ +var asyncTag = '[object AsyncFunction]'; +var funcTag = '[object Function]'; +var genTag = '[object GeneratorFunction]'; +var proxyTag = '[object Proxy]'; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + if (!isObject$1(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +} + +/** + * Checks if `value` is `undefined`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + * @example + * + * _.isUndefined(void 0); + * // => true + * + * _.isUndefined(null); + * // => false + */ +function isUndefined(value) { + return value === undefined; +} + +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + +/** Built-in value references. */ +var getPrototype = overArg(Object.getPrototypeOf, Object); + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return value != null && typeof value == 'object'; +} + +/** `Object#toString` result references. */ +var objectTag = '[object Object]'; + +/** Used for built-in method references. */ +var funcProto = Function.prototype; +var objectProto$2 = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty$1 = objectProto$2.hasOwnProperty; + +/** Used to infer the `Object` constructor. */ +var objectCtorString = funcToString.call(Object); + +/** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ +function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty$1.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; +} + +/** + * This method returns `undefined`. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Util + * @example + * + * _.times(2, _.noop); + * // => [undefined, undefined] + */ +function noop() { + // No operation performed. +} + +/** + * The base implementation of `_.clamp` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + */ +function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined) { + number = number <= upper ? number : upper; + } + if (lower !== undefined) { + number = number >= lower ? number : lower; + } + } + return number; +} + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); +} + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined; +var symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +/** Used as references for various `Number` constants. */ +var NAN = 0 / 0; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject$1(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject$1(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +/** Used as references for various `Number` constants. */ +var INFINITY$1 = 1 / 0; +var MAX_INTEGER = 1.7976931348623157e+308; + +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY$1 || value === -INFINITY$1) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; +} + +/** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ +function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; +} + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +/** + * Checks if `string` starts with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=0] The position to search from. + * @returns {boolean} Returns `true` if `string` starts with `target`, + * else `false`. + * @example + * + * _.startsWith('abc', 'a'); + * // => true + * + * _.startsWith('abc', 'b'); + * // => false + * + * _.startsWith('abc', 'b', 1); + * // => true + */ +function startsWith(string, target, position) { + string = toString(string); + position = position == null + ? 0 + : baseClamp(toInteger(position), 0, string.length); + + target = baseToString(target); + return string.slice(position, position + target.length) == target; +} + +/** `Object#toString` result references. */ +var boolTag = '[object Boolean]'; + +/** + * Checks if `value` is classified as a boolean primitive or object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. + * @example + * + * _.isBoolean(false); + * // => true + * + * _.isBoolean(null); + * // => false + */ +function isBoolean(value) { + return value === true || value === false || + (isObjectLike(value) && baseGetTag(value) == boolTag); +} + +/** `Object#toString` result references. */ +var stringTag = '[object String]'; + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); +} + +/** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ +function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; +} + +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ +function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; +} + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]'; + +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ +function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; +} + +/** Used for built-in method references. */ +var objectProto$3 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$2 = objectProto$3.hasOwnProperty; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto$3.propertyIsEnumerable; + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty$2.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); +}; + +/** Built-in value references. */ +var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : undefined; + +/** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); +} + +/** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ +function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; +} + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + +/** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to concatenate. + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ +function concat() { + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), + array = arguments[0], + index = length; + + while (index--) { + args[index - 1] = arguments[index]; + } + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); +} + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** Used for built-in method references. */ +var funcProto$2 = Function.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString$2 = funcProto$2.toString; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString$2.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used for built-in method references. */ +var funcProto$1 = Function.prototype; +var objectProto$5 = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString$1 = funcProto$1.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty$4 = objectProto$5.hasOwnProperty; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString$1.call(hasOwnProperty$4).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject$1(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +var defineProperty$1 = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} +}()); + +/** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty$1) { + defineProperty$1(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +/** Used for built-in method references. */ +var objectProto$4 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$3 = objectProto$4.hasOwnProperty; + +/** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty$3.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } +} + +/** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. + */ +function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : undefined; + + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; +} + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ +function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; +} + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + +/** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var baseSetToString = !defineProperty$1 ? identity : function(func, string) { + return defineProperty$1(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); +}; + +/** Used to detect hot functions by number of calls within a span of milliseconds. */ +var HOT_COUNT = 800; +var HOT_SPAN = 16; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeNow = Date.now; + +/** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ +function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; +} + +/** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var setToString = shortOut(baseSetToString); + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); +} + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER$1 = 9007199254740991; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER$1 : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject$1(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; +} + +/** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ +function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +/** + * This method returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ +function stubFalse() { + return false; +} + +/** Detect free variable `exports`. */ +var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; + +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ +var isBuffer = nativeIsBuffer || stubFalse; + +/** `Object#toString` result references. */ +var argsTag$1 = '[object Arguments]'; +var arrayTag = '[object Array]'; +var boolTag$1 = '[object Boolean]'; +var dateTag = '[object Date]'; +var errorTag = '[object Error]'; +var funcTag$1 = '[object Function]'; +var mapTag = '[object Map]'; +var numberTag = '[object Number]'; +var objectTag$1 = '[object Object]'; +var regexpTag = '[object RegExp]'; +var setTag = '[object Set]'; +var stringTag$1 = '[object String]'; +var weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]'; +var dataViewTag = '[object DataView]'; +var float32Tag = '[object Float32Array]'; +var float64Tag = '[object Float64Array]'; +var int8Tag = '[object Int8Array]'; +var int16Tag = '[object Int16Array]'; +var int32Tag = '[object Int32Array]'; +var uint8Tag = '[object Uint8Array]'; +var uint8ClampedTag = '[object Uint8ClampedArray]'; +var uint16Tag = '[object Uint16Array]'; +var uint32Tag = '[object Uint32Array]'; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag$1] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag$1] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag$1] = +typedArrayTags[weakMapTag] = false; + +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ +function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; +} + +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} + +/** Detect free variable `exports`. */ +var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1; + +/** Detect free variable `process` from Node.js. */ +var freeProcess = moduleExports$1 && freeGlobal.process; + +/** Used to access faster Node.js helpers. */ +var nodeUtil = (function() { + try { + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} +}()); + +/* Node.js helper references. */ +var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + +/** Used for built-in method references. */ +var objectProto$6 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$5 = objectProto$6.hasOwnProperty; + +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty$5.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; +} + +/** Used for built-in method references. */ +var objectProto$8 = Object.prototype; + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8; + + return value === proto; +} + +/** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; +} + +/** Used for built-in method references. */ +var objectProto$7 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$6 = objectProto$7.hasOwnProperty; + +/** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeysIn(object) { + if (!isObject$1(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; + + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty$6.call(object, key)))) { + result.push(key); + } + } + return result; +} + +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ +function keysIn(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); +} + +/** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assign + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assignIn({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } + */ +var assignIn = createAssigner(function(object, source) { + copyObject(source, keysIn(source), object); +}); + +/** + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ +var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); +}); + +/** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ +function arrayFilter(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; +} + +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; +} + +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseFor = createBaseFor(); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeKeys = overArg(Object.keys, Object); + +/** Used for built-in method references. */ +var objectProto$9 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$7 = objectProto$9.hasOwnProperty; + +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty$7.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +} + +/** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ +function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); +} + +/** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; +} + +/** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ +var baseEach = createBaseEach(baseForOwn); + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; + this.size = 0; +} + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + +/** Used for built-in method references. */ +var arrayProto = Array.prototype; + +/** Built-in value references. */ +var splice = arrayProto.splice; + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache; + this.size = 0; +} + +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; +} + +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key) { + return this.__data__.get(key); +} + +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key) { + return this.__data__.has(key); +} + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'); + +/* Built-in method references that are verified to be native. */ +var nativeCreate = getNative(Object, 'create'); + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** Used for built-in method references. */ +var objectProto$10 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$8 = objectProto$10.hasOwnProperty; + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty$8.call(data, key) ? data[key] : undefined; +} + +/** Used for built-in method references. */ +var objectProto$11 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$9 = objectProto$11.hasOwnProperty; + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$9.call(data, key); +} + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'; + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value; + return this; +} + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; +} + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ +function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; +} + +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; +} + +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED$2 = '__lodash_hash_undefined__'; + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED$2); + return this; +} + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); +} + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; + +/** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ +function arraySome(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; +} + +/** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function cacheHas(cache, key) { + return cache.has(key); +} + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG$2 = 1; +var COMPARE_UNORDERED_FLAG$1 = 2; + +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ +function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked && stack.get(other)) { + return stacked == other; + } + var index = -1, + result = true, + seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache : undefined; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { + result = false; + break; + } + } + stack['delete'](array); + stack['delete'](other); + return result; +} + +/** Built-in value references. */ +var Uint8Array = root.Uint8Array; + +/** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ +function mapToArray(map) { + var index = -1, + result = Array(map.size); + + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; +} + +/** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ +function setToArray(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = value; + }); + return result; +} + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG$3 = 1; +var COMPARE_UNORDERED_FLAG$2 = 2; + +/** `Object#toString` result references. */ +var boolTag$2 = '[object Boolean]'; +var dateTag$1 = '[object Date]'; +var errorTag$1 = '[object Error]'; +var mapTag$1 = '[object Map]'; +var numberTag$1 = '[object Number]'; +var regexpTag$1 = '[object RegExp]'; +var setTag$1 = '[object Set]'; +var stringTag$2 = '[object String]'; +var symbolTag$1 = '[object Symbol]'; + +var arrayBufferTag$1 = '[object ArrayBuffer]'; +var dataViewTag$1 = '[object DataView]'; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined; +var symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined; + +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag$1: + if ((object.byteLength != other.byteLength) || + (object.byteOffset != other.byteOffset)) { + return false; + } + object = object.buffer; + other = other.buffer; + + case arrayBufferTag$1: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag$2: + case dateTag$1: + case numberTag$1: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + + case errorTag$1: + return object.name == other.name && object.message == other.message; + + case regexpTag$1: + case stringTag$2: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == (other + ''); + + case mapTag$1: + var convert = mapToArray; + + case setTag$1: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG$2; + + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack['delete'](object); + return result; + + case symbolTag$1: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; +} + +/** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ +function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); +} + +/** + * This method returns a new empty array. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Array} Returns the new empty array. + * @example + * + * var arrays = _.times(2, _.stubArray); + * + * console.log(arrays); + * // => [[], []] + * + * console.log(arrays[0] === arrays[1]); + * // => false + */ +function stubArray() { + return []; +} + +/** Used for built-in method references. */ +var objectProto$14 = Object.prototype; + +/** Built-in value references. */ +var propertyIsEnumerable$1 = objectProto$14.propertyIsEnumerable; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetSymbols = Object.getOwnPropertySymbols; + +/** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ +var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable$1.call(object, symbol); + }); +}; + +/** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ +function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); +} + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG$4 = 1; + +/** Used for built-in method references. */ +var objectProto$13 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$11 = objectProto$13.hasOwnProperty; + +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4, + objProps = getAllKeys(object), + objLength = objProps.length, + othProps = getAllKeys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty$11.call(other, key))) { + return false; + } + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked && stack.get(other)) { + return stacked == other; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + stack['delete'](object); + stack['delete'](other); + return result; +} + +/* Built-in method references that are verified to be native. */ +var DataView = getNative(root, 'DataView'); + +/* Built-in method references that are verified to be native. */ +var Promise$1 = getNative(root, 'Promise'); + +/* Built-in method references that are verified to be native. */ +var Set = getNative(root, 'Set'); + +/* Built-in method references that are verified to be native. */ +var WeakMap = getNative(root, 'WeakMap'); + +/** `Object#toString` result references. */ +var mapTag$2 = '[object Map]'; +var objectTag$3 = '[object Object]'; +var promiseTag = '[object Promise]'; +var setTag$2 = '[object Set]'; +var weakMapTag$1 = '[object WeakMap]'; + +var dataViewTag$2 = '[object DataView]'; + +/** Used to detect maps, sets, and weakmaps. */ +var dataViewCtorString = toSource(DataView); +var mapCtorString = toSource(Map); +var promiseCtorString = toSource(Promise$1); +var setCtorString = toSource(Set); +var weakMapCtorString = toSource(WeakMap); + +/** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +var getTag = baseGetTag; + +// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. +if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$2) || + (Map && getTag(new Map) != mapTag$2) || + (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag$2) || + (WeakMap && getTag(new WeakMap) != weakMapTag$1)) { + getTag = function(value) { + var result = baseGetTag(value), + Ctor = result == objectTag$3 ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: return dataViewTag$2; + case mapCtorString: return mapTag$2; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag$2; + case weakMapCtorString: return weakMapTag$1; + } + } + return result; + }; +} + +var getTag$1 = getTag; + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG$1 = 1; + +/** `Object#toString` result references. */ +var argsTag$2 = '[object Arguments]'; +var arrayTag$1 = '[object Array]'; +var objectTag$2 = '[object Object]'; + +/** Used for built-in method references. */ +var objectProto$12 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$10 = objectProto$12.hasOwnProperty; + +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = objIsArr ? arrayTag$1 : getTag$1(object), + othTag = othIsArr ? arrayTag$1 : getTag$1(other); + + objTag = objTag == argsTag$2 ? objectTag$2 : objTag; + othTag = othTag == argsTag$2 ? objectTag$2 : othTag; + + var objIsObj = objTag == objectTag$2, + othIsObj = othTag == objectTag$2, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG$1)) { + var objIsWrapped = objIsObj && hasOwnProperty$10.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty$10.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); +} + +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ +function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); +} + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1; +var COMPARE_UNORDERED_FLAG = 2; + +/** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ +function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { + return false; + } + } + } + return true; +} + +/** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ +function isStrictComparable(value) { + return value === value && !isObject$1(value); +} + +/** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ +function getMatchData(object) { + var result = keys(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; + } + return result; +} + +/** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && + (srcValue !== undefined || (key in Object(object))); + }; +} + +/** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ +function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; +} + +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; +var reIsPlainProp = /^\w*$/; + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); +} + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ +function memoize(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; +} + +// Expose `MapCache`. +memoize.Cache = MapCache; + +/** Used as the maximum memoize cache size. */ +var MAX_MEMOIZE_SIZE = 500; + +/** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ +function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; +} + +/** Used to match property names within property paths. */ +var reLeadingDot = /^\./; +var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ +var stringToPath = memoizeCapped(function(string) { + var result = []; + if (reLeadingDot.test(string)) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +}); + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ +function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); +} + +/** Used as references for various `Number` constants. */ +var INFINITY$2 = 1 / 0; + +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ +function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY$2) ? '-0' : result; +} + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; +} + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + +/** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHasIn(object, key) { + return object != null && key in Object(object); +} + +/** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ +function hasPath(object, path, hasFunc) { + path = castPath(path, object); + + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object == null ? 0 : object.length; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isArguments(object)); +} + +/** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ +function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); +} + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG$5 = 1; +var COMPARE_UNORDERED_FLAG$3 = 2; + +/** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function(object) { + var objValue = get(object, path); + return (objValue === undefined && objValue === srcValue) + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$5 | COMPARE_UNORDERED_FLAG$3); + }; +} + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); + }; +} + +/** + * Creates a function that returns the value at `path` of a given object. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + * @example + * + * var objects = [ + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } + * ]; + * + * _.map(objects, _.property('a.b')); + * // => [2, 1] + * + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); + * // => [1, 2] + */ +function property(path) { + return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); +} + +/** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ +function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); +} + +/** + * The base implementation of `_.map` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; +} + +/** + * Creates an array of values by running each element in `collection` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, + * `template`, `trim`, `trimEnd`, `trimStart`, and `words` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + * @example + * + * function square(n) { + * return n * n; + * } + * + * _.map([4, 8], square); + * // => [16, 64] + * + * _.map({ 'a': 4, 'b': 8 }, square); + * // => [16, 64] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // The `_.property` iteratee shorthand. + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ +function map(collection, iteratee) { + var func = isArray(collection) ? arrayMap : baseMap; + return func(collection, baseIteratee(iteratee, 3)); +} + +/** + * Creates a flattened array of values by running each element in `collection` + * thru `iteratee` and flattening the mapped results. The iteratee is invoked + * with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [n, n]; + * } + * + * _.flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ +function flatMap(collection, iteratee) { + return baseFlatten(map(collection, iteratee), 1); +} + +/** + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, key, object). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapKeys + * @example + * + * var users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * + * _.mapValues(users, function(o) { return o.age; }); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + * + * // The `_.property` iteratee shorthand. + * _.mapValues(users, 'age'); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + */ +function mapValues(object, iteratee) { + var result = {}; + iteratee = baseIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, key, iteratee(value, key, object)); + }); + return result; +} + +/** + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ +function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, + length = array == null ? 0 : array.length; + + if (initAccum && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; +} + +/** + * The base implementation of `_.reduce` and `_.reduceRight`, without support + * for iteratee shorthands, which iterates over `collection` using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the accumulated value. + */ +function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection, function(value, index, collection) { + accumulator = initAccum + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); + }); + return accumulator; +} + +/** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` thru `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not given, the first element of `collection` is used as the initial + * value. The iteratee is invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, + * and `sortBy` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduceRight + * @example + * + * _.reduce([1, 2], function(sum, n) { + * return sum + n; + * }, 0); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * return result; + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) + */ +function reduce(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduce : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEach); +} + +function sequence(callbacks) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function () { + var count, success, callbacks_1, callbacks_1_1, _fn, ret, e_1_1, e_1, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + count = 0; + success = true; + _b.label = 1; + case 1: + _b.trys.push([1, 6, 7, 8]); + callbacks_1 = __values(callbacks), callbacks_1_1 = callbacks_1.next(); + _b.label = 2; + case 2: + if (!!callbacks_1_1.done) return [3 /*break*/, 5]; + _fn = callbacks_1_1.value; + count++; + return [4 /*yield*/, promisify(_fn).apply(void 0, __spread(args))]; + case 3: + ret = _b.sent(); + if (ret === false) { + success = false; + return [3 /*break*/, 5]; + } + _b.label = 4; + case 4: + callbacks_1_1 = callbacks_1.next(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 8]; + case 6: + e_1_1 = _b.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 8]; + case 7: + try { + if (callbacks_1_1 && !callbacks_1_1.done && (_a = callbacks_1.return)) _a.call(callbacks_1); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 8: return [2 /*return*/, { count: count, success: success }]; + } + }); + }); +} +function traversePath(router, path) { + if (path.indexOf('//') === 0) { + path = path.replace('//', '/'); + while (!router.isRoot) { + router = router.ctx.$parent.router; + } + } + else { + if (path.indexOf('./') === 0) { + path = path.replace('./', '/'); + router = router.ctx.$child.router; + } + while (path && path.match(/\/?\.\./i) && !router.isRoot) { + router = router.ctx.$parent.router; + path = path.replace(/\/?\.\./i, ''); + } + } + return { router: router, path: path }; +} +function resolveHref(_a) { + var router = _a.router, path = _a.path; + return router.ctx.base + path; +} +function isActivePath(_a) { + var router = _a.router, path = _a.path; + var ctx = router.ctx; + while (ctx) { + // create dependency on isNavigating so that this works with nested routes + // inside a computed + ctx.router.isNavigating(); + if (ctx.$child ? startsWith(path, ctx.pathname) : path === ctx.pathname) { + path = path.substr(ctx.pathname.length) || '/'; + ctx = ctx.$child; + } + else { + return false; + } + } + return true; +} +function isGenerator(x) { + return x.constructor.name === 'GeneratorFunction'; +} +function isThenable(x) { + return !isUndefined(x) && isFunction(x.then); +} +function promisify(_fn) { + var _this = this; + if (_fn === void 0) { _fn = noop; } + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(_this, void 0, void 0, function () { + var fn, ret, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + fn = function () { + return _fn.length === args.length + 1 + ? new Promise(function (r) { + _fn.apply(void 0, __spread(args, [r])); + }) + : _fn.apply(void 0, __spread(args)); + }; + ret = fn(); + if (!isThenable(ret)) return [3 /*break*/, 2]; + return [4 /*yield*/, ret]; + case 1: + _a = _b.sent(); + return [3 /*break*/, 3]; + case 2: + _a = ret; + _b.label = 3; + case 3: return [2 /*return*/, _a]; + } + }); + }); + }; +} +function generatorify(fn) { + return isGenerator(fn) + ? fn + : function (ctx) { + return __asyncGenerator(this, arguments, function () { + var ret; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, __await(promisify(fn)(ctx))]; + case 1: + ret = _a.sent(); + if (!isPlainObject(ret)) return [3 /*break*/, 10]; + return [4 /*yield*/, __await(promisify(ret.beforeRender)())]; + case 2: return [4 /*yield*/, _a.sent()]; + case 3: + _a.sent(); + return [4 /*yield*/, __await(promisify(ret.afterRender)())]; + case 4: return [4 /*yield*/, _a.sent()]; + case 5: + _a.sent(); + return [4 /*yield*/, __await(promisify(ret.beforeDispose)())]; + case 6: return [4 /*yield*/, _a.sent()]; + case 7: + _a.sent(); + return [4 /*yield*/, __await(promisify(ret.afterDispose)())]; + case 8: return [4 /*yield*/, _a.sent()]; + case 9: + _a.sent(); + return [3 /*break*/, 12]; + case 10: return [4 /*yield*/, ret]; + case 11: + _a.sent(); + _a.label = 12; + case 12: return [2 /*return*/]; + } + }); + }); + }; +} + +var Context = /** @class */ (function () { + function Context(router, $parent, path, _with) { + if (_with === void 0) { _with = {}; } + this._queue = []; + this._beforeNavigateCallbacks = []; + this._appMiddlewareDownstream = []; + this._routeMiddlewareDownstream = []; + var route = router.resolveRoute(path); + var _a = __read(route.parse(path), 3), params = _a[0], pathname = _a[1], childPath = _a[2]; + assignIn(this, { + $parent: $parent, + params: params, + path: path, + pathname: pathname, + route: route, + router: router + }, _with); + if ($parent) { + $parent.$child = this; + } + if (childPath) { + // tslint:disable-next-line no-unused-expression + new Router(childPath, this).ctx; + } + } + Context.prototype.addBeforeNavigateCallback = function (cb) { + this._beforeNavigateCallbacks.unshift(cb); + }; + Object.defineProperty(Context.prototype, "base", { + get: function () { + return this.router.isRoot + ? Router.base + : this.$parent.base + this.$parent.pathname; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Context.prototype, "canonicalPath", { + // full path w/o base + get: function () { + return this.base.replace(new RegExp(this.$root.base, 'i'), '') + this.pathname; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Context.prototype, "$root", { + get: function () { + var ctx = this; + while (ctx) { + if (ctx.$parent) { + ctx = ctx.$parent; + } + else { + return ctx; + } + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Context.prototype, "$parents", { + get: function () { + var parents = []; + var parent = this.$parent; + while (parent) { + parents.push(parent); + parent = parent.$parent; + } + return parents; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Context.prototype, "$children", { + get: function () { + var children = []; + var child = this.$child; + while (child) { + children.push(child); + child = child.$child; + } + return children; + }, + enumerable: true, + configurable: true + }); + Context.prototype.queue = function (promise) { + this._queue.push(promise); + }; + Context.prototype.redirect = function (path, args) { + if (args === void 0) { args = {}; } + this._redirect = path; + this._redirectArgs = assignIn({}, args, { push: false }); + }; + Context.prototype.runBeforeNavigateCallbacks = function () { + return __awaiter(this, void 0, void 0, function () { + var ctx, callbacks, success; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + ctx = this; + callbacks = []; + while (ctx) { + callbacks = __spread(ctx._beforeNavigateCallbacks, callbacks); + ctx = ctx.$child; + } + return [4 /*yield*/, sequence(callbacks)]; + case 1: + success = (_a.sent()).success; + return [2 /*return*/, success]; + } + }); + }); + }; + Context.prototype.render = function () { + var ctx = this; + while (ctx) { + if (isUndefined(ctx._redirect)) { + ctx.router.component(ctx.route.component); + } + ctx = ctx.$child; + } + ko.tasks.runEarly(); + }; + Context.prototype.runBeforeRender = function (flush) { + if (flush === void 0) { flush = true; } + return __awaiter(this, void 0, void 0, function () { + var appMiddlewareDownstream, routeMiddlewareDownstream, numAppMiddlewareRanPreRedirect, numRouteMiddlewareRanPreRedirect; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + appMiddlewareDownstream = Context.runMiddleware(Router.middleware, this); + routeMiddlewareDownstream = Context.runMiddleware(this.route.middleware, this); + return [4 /*yield*/, sequence(appMiddlewareDownstream)]; + case 1: + numAppMiddlewareRanPreRedirect = (_a.sent()).count; + return [4 /*yield*/, sequence(routeMiddlewareDownstream)]; + case 2: + numRouteMiddlewareRanPreRedirect = (_a.sent()).count; + this._appMiddlewareDownstream = appMiddlewareDownstream.slice(0, numAppMiddlewareRanPreRedirect); + this._routeMiddlewareDownstream = routeMiddlewareDownstream.slice(0, numRouteMiddlewareRanPreRedirect); + if (!(this.$child && isUndefined(this._redirect))) return [3 /*break*/, 4]; + return [4 /*yield*/, this.$child.runBeforeRender(false)]; + case 3: + _a.sent(); + _a.label = 4; + case 4: + if (!flush) return [3 /*break*/, 6]; + return [4 /*yield*/, this.flushQueue()]; + case 5: + _a.sent(); + _a.label = 6; + case 6: return [2 /*return*/]; + } + }); + }); + }; + Context.prototype.runAfterRender = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, sequence(concat(this._appMiddlewareDownstream, this._routeMiddlewareDownstream))]; + case 1: + _a.sent(); + return [4 /*yield*/, this.flushQueue()]; + case 2: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + Context.prototype.runBeforeDispose = function (flush) { + if (flush === void 0) { flush = true; } + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(this.$child && isUndefined(this._redirect))) return [3 /*break*/, 2]; + return [4 /*yield*/, this.$child.runBeforeDispose(false)]; + case 1: + _a.sent(); + _a.label = 2; + case 2: return [4 /*yield*/, sequence(concat(this._routeMiddlewareDownstream, this._appMiddlewareDownstream))]; + case 3: + _a.sent(); + if (!flush) return [3 /*break*/, 5]; + return [4 /*yield*/, this.flushQueue()]; + case 4: + _a.sent(); + _a.label = 5; + case 5: return [2 /*return*/]; + } + }); + }); + }; + Context.prototype.runAfterDispose = function (flush) { + if (flush === void 0) { flush = true; } + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(this.$child && isUndefined(this._redirect))) return [3 /*break*/, 2]; + return [4 /*yield*/, this.$child.runAfterDispose(false)]; + case 1: + _a.sent(); + _a.label = 2; + case 2: return [4 /*yield*/, sequence(concat(this._routeMiddlewareDownstream, this._appMiddlewareDownstream))]; + case 3: + _a.sent(); + if (!flush) return [3 /*break*/, 5]; + return [4 /*yield*/, this.flushQueue()]; + case 4: + _a.sent(); + _a.label = 5; + case 5: return [2 /*return*/]; + } + }); + }); + }; + Context.prototype.flushQueue = function () { + return __awaiter(this, void 0, void 0, function () { + var _this = this; + var thisQueue, childQueues; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + thisQueue = Promise.all(this._queue).then(function () { + _this._queue = []; + }); + childQueues = map(this.$children, function (c) { return c.flushQueue(); }); + return [4 /*yield*/, Promise.all(__spread([thisQueue], childQueues))]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + Context.runMiddleware = function (middleware, ctx) { + var _this = this; + return map(middleware, function (fn) { + var runner = generatorify(fn)(ctx); + var beforeRender = true; + return function () { return __awaiter(_this, void 0, void 0, function () { + var ret; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + ret = runner.next() || {}; + if (!isThenable(ret)) return [3 /*break*/, 2]; + return [4 /*yield*/, ret]; + case 1: + _a.sent(); + return [3 /*break*/, 4]; + case 2: + if (!isThenable(ret.value)) return [3 /*break*/, 4]; + return [4 /*yield*/, ret.value]; + case 3: + _a.sent(); + _a.label = 4; + case 4: + if (beforeRender) { + // this should only block the sequence for the first call, + // and allow cleanup after the redirect + beforeRender = false; + return [2 /*return*/, isUndefined(ctx._redirect)]; + } + else { + return [2 /*return*/, true]; + } + return [2 /*return*/]; + } + }); + }); }; + }); + }; + return Context; +}()); + +/** + * Expose `pathToRegexp`. + */ +var pathToRegexp_1 = pathToRegexp; +var parse_1 = parse; +var compile_1 = compile; +var tokensToFunction_1 = tokensToFunction; +var tokensToRegExp_1 = tokensToRegExp; + +/** + * Default configs. + */ +var DEFAULT_DELIMITER = '/'; +var DEFAULT_DELIMITERS = './'; + +/** + * The main path matching regexp utility. + * + * @type {RegExp} + */ +var PATH_REGEXP = new RegExp([ + // Match escaped characters that would otherwise appear in future matches. + // This allows the user to escape special characters that won't transform. + '(\\\\.)', + // Match Express-style parameters and un-named parameters with a prefix + // and optional suffixes. Matches appear as: + // + // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?"] + // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined] + '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?' +].join('|'), 'g'); + +/** + * Parse a string for the raw tokens. + * + * @param {string} str + * @param {Object=} options + * @return {!Array} + */ +function parse (str, options) { + var tokens = []; + var key = 0; + var index = 0; + var path = ''; + var defaultDelimiter = (options && options.delimiter) || DEFAULT_DELIMITER; + var delimiters = (options && options.delimiters) || DEFAULT_DELIMITERS; + var pathEscaped = false; + var res; + + while ((res = PATH_REGEXP.exec(str)) !== null) { + var m = res[0]; + var escaped = res[1]; + var offset = res.index; + path += str.slice(index, offset); + index = offset + m.length; + + // Ignore already escaped sequences. + if (escaped) { + path += escaped[1]; + pathEscaped = true; + continue + } + + var prev = ''; + var next = str[index]; + var name = res[2]; + var capture = res[3]; + var group = res[4]; + var modifier = res[5]; + + if (!pathEscaped && path.length) { + var k = path.length - 1; + + if (delimiters.indexOf(path[k]) > -1) { + prev = path[k]; + path = path.slice(0, k); + } + } + + // Push the current path onto the tokens. + if (path) { + tokens.push(path); + path = ''; + pathEscaped = false; + } + + var partial = prev !== '' && next !== undefined && next !== prev; + var repeat = modifier === '+' || modifier === '*'; + var optional = modifier === '?' || modifier === '*'; + var delimiter = prev || defaultDelimiter; + var pattern = capture || group; + + tokens.push({ + name: name || key++, + prefix: prev, + delimiter: delimiter, + optional: optional, + repeat: repeat, + partial: partial, + pattern: pattern ? escapeGroup(pattern) : '[^' + escapeString(delimiter) + ']+?' + }); + } + + // Push any remaining characters. + if (path || index < str.length) { + tokens.push(path + str.substr(index)); + } + + return tokens +} + +/** + * Compile a string to a template function for the path. + * + * @param {string} str + * @param {Object=} options + * @return {!function(Object=, Object=)} + */ +function compile (str, options) { + return tokensToFunction(parse(str, options)) +} + +/** + * Expose a method for transforming tokens into the path function. + */ +function tokensToFunction (tokens) { + // Compile all the tokens into regexps. + var matches = new Array(tokens.length); + + // Compile all the patterns before compilation. + for (var i = 0; i < tokens.length; i++) { + if (typeof tokens[i] === 'object') { + matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$'); + } + } + + return function (data, options) { + var path = ''; + var encode = (options && options.encode) || encodeURIComponent; + + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + + if (typeof token === 'string') { + path += token; + continue + } + + var value = data ? data[token.name] : undefined; + var segment; + + if (Array.isArray(value)) { + if (!token.repeat) { + throw new TypeError('Expected "' + token.name + '" to not repeat, but got array') + } + + if (value.length === 0) { + if (token.optional) continue + + throw new TypeError('Expected "' + token.name + '" to not be empty') + } + + for (var j = 0; j < value.length; j++) { + segment = encode(value[j]); + + if (!matches[i].test(segment)) { + throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '"') + } + + path += (j === 0 ? token.prefix : token.delimiter) + segment; + } + + continue + } + + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + segment = encode(String(value)); + + if (!matches[i].test(segment)) { + throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but got "' + segment + '"') + } + + path += token.prefix + segment; + continue + } + + if (token.optional) { + // Prepend partial segment prefixes. + if (token.partial) path += token.prefix; + + continue + } + + throw new TypeError('Expected "' + token.name + '" to be ' + (token.repeat ? 'an array' : 'a string')) + } + + return path + } +} + +/** + * Escape a regular expression string. + * + * @param {string} str + * @return {string} + */ +function escapeString (str) { + return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1') +} + +/** + * Escape the capturing group by escaping special characters and meaning. + * + * @param {string} group + * @return {string} + */ +function escapeGroup (group) { + return group.replace(/([=!:$/()])/g, '\\$1') +} + +/** + * Get the flags for a regexp from the options. + * + * @param {Object} options + * @return {string} + */ +function flags (options) { + return options && options.sensitive ? '' : 'i' +} + +/** + * Pull out keys from a regexp. + * + * @param {!RegExp} path + * @param {Array=} keys + * @return {!RegExp} + */ +function regexpToRegexp (path, keys) { + if (!keys) return path + + // Use a negative lookahead to match only capturing groups. + var groups = path.source.match(/\((?!\?)/g); + + if (groups) { + for (var i = 0; i < groups.length; i++) { + keys.push({ + name: i, + prefix: null, + delimiter: null, + optional: false, + repeat: false, + partial: false, + pattern: null + }); + } + } + + return path +} + +/** + * Transform an array into a regexp. + * + * @param {!Array} path + * @param {Array=} keys + * @param {Object=} options + * @return {!RegExp} + */ +function arrayToRegexp (path, keys, options) { + var parts = []; + + for (var i = 0; i < path.length; i++) { + parts.push(pathToRegexp(path[i], keys, options).source); + } + + return new RegExp('(?:' + parts.join('|') + ')', flags(options)) +} + +/** + * Create a path regexp from string input. + * + * @param {string} path + * @param {Array=} keys + * @param {Object=} options + * @return {!RegExp} + */ +function stringToRegexp (path, keys, options) { + return tokensToRegExp(parse(path, options), keys, options) +} + +/** + * Expose a function for taking tokens and returning a RegExp. + * + * @param {!Array} tokens + * @param {Array=} keys + * @param {Object=} options + * @return {!RegExp} + */ +function tokensToRegExp (tokens, keys, options) { + options = options || {}; + + var strict = options.strict; + var end = options.end !== false; + var delimiter = escapeString(options.delimiter || DEFAULT_DELIMITER); + var delimiters = options.delimiters || DEFAULT_DELIMITERS; + var endsWith = [].concat(options.endsWith || []).map(escapeString).concat('$').join('|'); + var route = ''; + var isEndDelimited = false; + + // Iterate over the tokens and create our regexp string. + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + + if (typeof token === 'string') { + route += escapeString(token); + isEndDelimited = i === tokens.length - 1 && delimiters.indexOf(token[token.length - 1]) > -1; + } else { + var prefix = escapeString(token.prefix); + var capture = token.repeat + ? '(?:' + token.pattern + ')(?:' + prefix + '(?:' + token.pattern + '))*' + : token.pattern; + + if (keys) keys.push(token); + + if (token.optional) { + if (token.partial) { + route += prefix + '(' + capture + ')?'; + } else { + route += '(?:' + prefix + '(' + capture + '))?'; + } + } else { + route += prefix + '(' + capture + ')'; + } + } + } + + if (end) { + if (!strict) route += '(?:' + delimiter + ')?'; + + route += endsWith === '$' ? '$' : '(?=' + endsWith + ')'; + } else { + if (!strict) route += '(?:' + delimiter + '(?=' + endsWith + '))?'; + if (!isEndDelimited) route += '(?=' + delimiter + '|' + endsWith + ')'; + } + + return new RegExp('^' + route, flags(options)) +} + +/** + * Normalize the given path string, returning a regular expression. + * + * An empty array can be passed in for the keys, which will hold the + * placeholder key descriptions. For example, using `/user/:id`, `keys` will + * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. + * + * @param {(string|RegExp|Array)} path + * @param {Array=} keys + * @param {Object=} options + * @return {!RegExp} + */ +function pathToRegexp (path, keys, options) { + if (path instanceof RegExp) { + return regexpToRegexp(path, keys) + } + + if (Array.isArray(path)) { + return arrayToRegexp(/** @type {!Array} */ (path), keys, options) + } + + return stringToRegexp(/** @type {string} */ (path), keys, options) +} + +pathToRegexp_1.parse = parse_1; +pathToRegexp_1.compile = compile_1; +pathToRegexp_1.tokensToFunction = tokensToFunction_1; +pathToRegexp_1.tokensToRegExp = tokensToRegExp_1; + +var Route = /** @class */ (function () { + function Route(path, config) { + var _a = __read(Route.parseConfig(config), 3), component = _a[0], middleware = _a[1], children = _a[2]; + this.path = path; + this.component = component; + this.middleware = middleware; + this.children = children; + var _b = __read(Route.parsePath(path, !isUndefined(children)), 2), keys = _b[0], regexp = _b[1]; + this.keys = keys; + this.regexp = regexp; + } + Route.prototype.matches = function (path) { + var matches = this.regexp.exec(path); + if (matches === null) { + return false; + } + if (this.children) { + try { + for (var _a = __values(this.children), _b = _a.next(); !_b.done; _b = _a.next()) { + var childRoute = _b.value; + var childPath = '/' + (matches[matches.length - 1] || ''); + if (childRoute.matches(childPath)) { + return true; + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_b && !_b.done && (_c = _a.return)) _c.call(_a); + } + finally { if (e_1) throw e_1.error; } + } + return false; + } + return true; + var e_1, _c; + }; + Route.prototype.parse = function (path) { + var childPath; + var params = {}; + var matches = this.regexp.exec(path); + for (var i = 1, len = matches.length; i < len; ++i) { + var k = this.keys[i - 1]; + var v = matches[i] || ''; + if (k.name === '__child_path__') { + childPath = '/' + v; + path = path.replace(new RegExp(childPath + '$'), ''); + } + else { + params[k.name] = v; + } + } + return [params, path, childPath]; + }; + Route.parseConfig = function (config) { + var component; + var children; + var middleware = reduce(config, function (accum, m) { + if (isString(m)) { + m = m; + component = m; + } + else if (isPlainObject(m)) { + m = m; + children = map(m, function (routeConfig, path) { return new Route(path, routeConfig); }); + if (!component) { + component = 'ko-component-router'; + } + } + else if (isFunction(m)) { + m = m; + accum.push(m); + } + return accum; + }, []); + return [component, middleware, children]; + }; + Route.parsePath = function (path, hasChildren) { + if (hasChildren) { + path = path.replace(/\/?!?$/, '/!'); + } + if (path[path.length - 1] === '!') { + path = path.replace('!', ':__child_path__(.*)?'); + } + else { + path = path.replace(/\(?\*\)?/, '(.*)'); + } + var keys = []; + var regexp = pathToRegexp_1(path, keys); + return [keys, regexp]; + }; + return Route; +}()); + +var Router = /** @class */ (function () { + function Router(url, $parentCtx, _with) { + if (_with === void 0) { _with = {}; } + this.onInit = []; + this.component = ko.observable(null); + this.isNavigating = ko.observable(true); + this.isRoot = isUndefined($parentCtx); + this.routes = this.isRoot + ? Router.createRoutes(Router.routes) + : $parentCtx.route.children; + if (this.isRoot) { + Router.head = this; + document.addEventListener(Router.events.click, Router.onclick); + window.addEventListener(Router.events.popstate, Router.onpopstate); + } + this.ctx = new Context(this, $parentCtx, Router.getPath(url), _with); + } + Object.defineProperty(Router.prototype, "initialized", { + get: function () { + var _this = this; + if (this.isNavigating()) { + return new Promise(function (resolve) { return _this.onInit.push(resolve); }); + } + else { + return Promise.resolve(this); + } + }, + enumerable: true, + configurable: true + }); + Router.prototype.init = function () { + var _this = this; + this.isNavigating(false); + this.ctx.runAfterRender().then(function () { + var resolveRouter = function (router) { return function (resolve) { return resolve(router); }; }; + var ctx = _this.ctx; + while (ctx) { + map(ctx.router.onInit, resolveRouter(ctx.router)); + ctx = ctx.$child; + } + }); + }; + Router.prototype.update = function (url, _args) { + return __awaiter(this, void 0, void 0, function () { + var args, fromCtx, _a, search, hash, path, route, _b, pathname, childPath, samePage, toCtx, shouldNavigate, _c, r, p; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + if (isBoolean(_args)) { + args = { push: _args }; + } + else if (isUndefined(_args)) { + args = {}; + } + else { + args = _args; + } + if (isUndefined(args.push)) { + args.push = true; + } + if (isUndefined(args.with)) { + args.with = {}; + } + fromCtx = this.ctx; + _a = Router.parseUrl(url), search = _a.search, hash = _a.hash; + path = Router.getPath(url); + route = this.resolveRoute(path); + _b = __read(route.parse(path), 3), pathname = _b[1], childPath = _b[2]; + samePage = fromCtx.pathname === pathname; + if (!(fromCtx.$child && samePage && !args.force)) return [3 /*break*/, 2]; + return [4 /*yield*/, fromCtx.$child.router.update(childPath + search + hash, args)]; + case 1: return [2 /*return*/, _d.sent()]; + case 2: + toCtx = new Context(this, this.ctx.$parent, path, args.with); + if (!toCtx.route) { + return [2 /*return*/, false]; + } + return [4 /*yield*/, fromCtx.runBeforeNavigateCallbacks()]; + case 3: + shouldNavigate = _d.sent(); + if (shouldNavigate === false) { + return [2 /*return*/, false]; + } + this.isNavigating(true); + return [4 /*yield*/, fromCtx.runBeforeDispose()]; + case 4: + _d.sent(); + history[args.push ? 'pushState' : 'replaceState'](history.state, document.title, toCtx.base + toCtx.path + search + hash); + return [4 /*yield*/, toCtx.runBeforeRender()]; + case 5: + _d.sent(); + if (isUndefined(toCtx._redirect)) { + this.component(null); + ko.tasks.runEarly(); + } + this.ctx = toCtx; + return [4 /*yield*/, fromCtx.runAfterDispose()]; + case 6: + _d.sent(); + toCtx.render(); + if (!!isUndefined(toCtx._redirect)) return [3 /*break*/, 8]; + return [4 /*yield*/, toCtx.runAfterRender()]; + case 7: + _d.sent(); + _c = traversePath(toCtx.router, toCtx._redirect), r = _c.router, p = _c.path; + r.update(p, toCtx._redirectArgs); + _d.label = 8; + case 8: return [2 /*return*/, true]; + } + }); + }); + }; + Router.prototype.resolveRoute = function (path) { + var matchingRouteWithFewestDynamicSegments; + var fewestMatchingSegments = Infinity; + for (var rn in this.routes) { + if (this.routes.hasOwnProperty(rn)) { + var r = this.routes[rn]; + if (r.matches(path)) { + if (r.keys.length === 0) { + return r; + } + else if (fewestMatchingSegments === Infinity || + (r.keys.length < fewestMatchingSegments && r.keys[0].pattern !== '.*')) { + fewestMatchingSegments = r.keys.length; + matchingRouteWithFewestDynamicSegments = r; + } + } + } + } + return matchingRouteWithFewestDynamicSegments; + }; + Router.prototype.dispose = function () { + if (this.isRoot) { + document.removeEventListener(Router.events.click, Router.onclick, false); + window.removeEventListener(Router.events.popstate, Router.onpopstate, false); + delete Router.head; + } + }; + Object.defineProperty(Router, "initialized", { + get: function () { + var _this = this; + if (Router.head) { + return Promise.resolve(Router.head); + } + else { + return new Promise(function (resolve) { return _this.onInit.push(resolve); }); + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Router, "base", { + get: function () { + return Router.config.base + (Router.config.hashbang ? '/#!' : ''); + }, + enumerable: true, + configurable: true + }); + Router.setConfig = function (_a) { + var base = _a.base, hashbang = _a.hashbang, activePathCSSClass = _a.activePathCSSClass; + assignInWith(Router.config, { + base: base, + hashbang: hashbang, + activePathCSSClass: activePathCSSClass + }, function (_default, v) { return isUndefined(v) ? _default : v; }); + }; + Router.use = function () { + var fns = []; + for (var _i = 0; _i < arguments.length; _i++) { + fns[_i] = arguments[_i]; + } + (_a = Router.middleware).push.apply(_a, __spread(fns)); + var _a; + }; + Router.usePlugin = function () { + var fns = []; + for (var _i = 0; _i < arguments.length; _i++) { + fns[_i] = arguments[_i]; + } + (_a = Router.plugins).push.apply(_a, __spread(fns)); + var _a; + }; + Router.useRoutes = function (routes) { + assignIn(Router.routes, Router.normalizeRoutes(routes)); + }; + Router.get = function (i) { + var router = Router.head; + while (i-- > 0) { + router = router.ctx.$child.router; + } + return router; + }; + Router.update = function (url, _args) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, Router.head.update(url, _args)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + Router.getPathFromLocation = function () { + var path = location.pathname + location.search + location.hash; + var baseWithOrWithoutHashbangRegexp = Router.config.base.replace('#!', '#?!?'); + return path.replace(new RegExp(baseWithOrWithoutHashbangRegexp, 'i'), ''); + }; + Router.onclick = function (e) { + if (e.defaultPrevented) { + return; + } + var el = e.target; + while (el && el.nodeName !== 'A') { + el = el.parentNode; + } + if (!el || el.nodeName !== 'A') { + return; + } + var pathname = el.pathname, search = el.search, _a = el.hash, hash = _a === void 0 ? '' : _a; + var path = (pathname + search + hash).replace(new RegExp(Router.base, 'i'), ''); + var isValidRoute = Router.hasRoute(path); + var isCrossOrigin = !Router.sameOrigin(el.href); + var isDoubleClick = Router.which(e) !== 1; + var isDownload = el.hasAttribute('download'); + var isEmptyHash = el.getAttribute('href') === '#'; + var isMailto = (el.getAttribute('href') || '').indexOf('mailto:') === 0; + var hasExternalRel = el.getAttribute('rel') === 'external'; + var hasModifier = e.metaKey || e.ctrlKey || e.shiftKey; + var hasOtherTarget = el.hasAttribute('target'); + if (!isValidRoute || + isCrossOrigin || + isDoubleClick || + isDownload || + isEmptyHash || + isMailto || + hasExternalRel || + hasModifier || + hasOtherTarget) { + return; + } + Router.update(path); + e.preventDefault(); + }; + Router.onpopstate = function (e) { + Router.update(Router.getPathFromLocation(), false); + e.preventDefault(); + }; + Router.canonicalizePath = function (path) { + return path.replace(new RegExp('/?#?!?/?'), '/'); + }; + Router.parseUrl = function (url) { + var parser = document.createElement('a'); + var b = Router.base.toLowerCase(); + if (b && url.toLowerCase().indexOf(b) === 0) { + url = url.replace(new RegExp(b, 'i'), '') || '/'; + } + parser.href = Router.canonicalizePath(url); + return { + hash: parser.hash, + pathname: (parser.pathname.charAt(0) === '/') + ? parser.pathname + : '/' + parser.pathname, + search: parser.search + }; + }; + Router.getPath = function (url) { + return Router.parseUrl(url).pathname; + }; + Router.hasRoute = function (path) { + return !isUndefined(Router.head.resolveRoute(Router.getPath(path))); + }; + Router.createRoutes = function (routes) { + return map(routes, function (config, path) { return new Route(path, config); }); + }; + Router.normalizeRoutes = function (routes) { + return mapValues(routes, function (c) { + return map(Router.runPlugins(c), function (routeConfig) { + return isPlainObject(routeConfig) + ? Router.normalizeRoutes(routeConfig) + : routeConfig; + }); + }); + }; + Router.runPlugins = function (config) { + return flatMap(castArray(config), function (rc) { + var routeConfig = reduce(Router.plugins, function (accum, plugin) { + var prc = plugin(rc); + return isUndefined(prc) ? accum : accum.concat(castArray(prc)); + }, []); + return routeConfig.length > 0 + ? routeConfig + : rc; + }); + }; + Router.sameOrigin = function (href) { + var hostname = location.hostname, port = location.port, protocol = location.protocol; + var origin = protocol + '//' + hostname; + if (port) { + origin += ':' + port; + } + return href && href.indexOf(origin) === 0; + }; + Router.which = function (e) { + e = e || window.event; + return e.which === null ? e.button : e.which; + }; + Router.onInit = []; + Router.middleware = []; + Router.plugins = []; + Router.config = { + base: '', + hashbang: false, + activePathCSSClass: 'active-path' + }; + Router.routes = {}; + Router.events = { + click: document.ontouchstart ? 'touchstart' : 'click', + popstate: 'popstate' + }; + return Router; +}()); + +ko.bindingHandlers.path = { + init: function (el, valueAccessor, allBindings, viewModel, bindingCtx) { + var activePathCSSClass = allBindings.get('pathActiveClass') || Router.config.activePathCSSClass; + Router.initialized.then(function () { + var route = ko.pureComputed(function () { return traversePath(getRouter(bindingCtx), ko.unwrap(valueAccessor())); }); + ko.applyBindingsToNode(el, { + attr: { + href: ko.pureComputed(function () { return resolveHref(route()); }) + }, + css: (_a = {}, + _a[activePathCSSClass] = ko.pureComputed(function () { return isActivePath(route()); }), + _a) + }); + var _a; + }); + } +}; +function getRouter(bindingCtx) { + while (!isUndefined(bindingCtx)) { + if (!isUndefined(bindingCtx.$router)) { + return bindingCtx.$router; + } + bindingCtx = bindingCtx.$parentContext; + } + return Router.head; +} + +ko.components.register('ko-component-router', { + synchronous: true, + viewModel: { createViewModel: createViewModel }, + template: "
\n
\n
" +}); +ko.bindingHandlers.__ko_component_router__ = { + init: function (el, valueAccessor, allBindings, viewModel, bindingCtx) { + var $router = bindingCtx.$rawData; + ko.applyBindingsToNode(el, { + css: $router.component, + component: { + name: $router.component, + params: $router.ctx + } + }, bindingCtx.extend({ $router: $router })); + if ($router.isRoot) { + $router.init(); + } + else { + $router.ctx.$parent.router.initialized.then(function () { return $router.init(); }); + } + return { controlsDescendantBindings: true }; + } +}; +function createViewModel(params) { + var router = Router.head; + if (!router) { + router = new Router(Router.getPathFromLocation(), undefined, params); + } + else { + while (router.bound) { + router = router.ctx.$child.router; + } + } + router.bound = true; + if (router.isRoot) { + router.ctx.runBeforeRender() + .then(function () { + if (router.ctx._redirect) { + router.ctx.runAfterRender().then(function () { + var _a = traversePath(router, router.ctx._redirect), r = _a.router, p = _a.path; + r.update(p, router.ctx._redirectArgs); + }); + } + else { + router.ctx.render(); + map(Router.onInit, function (resolve) { return resolve(router); }); + } + }); + } + else if (router.ctx._redirect) { + var _a = traversePath(router, router.ctx._redirect), r_1 = _a.router, p_1 = _a.path; + setTimeout(function () { return r_1.update(p_1, router.ctx._redirectArgs); }); + } + return router; +} + +exports.Context = Context; +exports.Route = Route; +exports.Router = Router; +exports.isActivePath = isActivePath; +exports.resolveHref = resolveHref; + +Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/ko-component-router.min.js b/ko-component-router.min.js new file mode 100644 index 0000000..ff79830 --- /dev/null +++ b/ko-component-router.min.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("knockout")):"function"==typeof define&&define.amd?define(["exports","knockout"],e):e((t.ko=t.ko||{},t.ko.router={}),t.ko)}(this,function(t,e){"use strict";function r(t,e,r,n){return new(r||(r=Promise))(function(o,i){function u(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(u,a)}c((n=n.apply(t,e||[])).next())})}function n(t,e){function r(t){return function(e){return n([t,e])}}function n(r){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,i&&(u=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(u=u.call(i,r[1])).done)return u;switch(i=0,u&&(r=[0,u.value]),r[0]){case 0:case 1:u=r;break;case 4:return c.label++,{value:r[1],done:!1};case 5:c.label++,i=r[1],r=[0];continue;case 7:r=c.ops.pop(),c.trys.pop();continue;default:if(u=c.trys,!(u=u.length>0&&u[u.length-1])&&(6===r[0]||2===r[0])){c=0;continue}if(3===r[0]&&(!u||r[1]>u[0]&&r[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function i(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function u(){for(var t=[],e=0;e1||o(t,e)})})}function o(t,e){try{i(l[t](e))}catch(t){s(h[0][3],t)}}function i(t){t.value instanceof a?Promise.resolve(t.value.v).then(u,c):s(h[0][2],t)}function u(t){o("next",t)}function c(t){o("throw",t)}function s(t,e){t(e),h.shift(),h.length&&o(h[0][0],h[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var f,l=r.apply(t,e||[]),h=[];return f={},n("next"),n("throw"),n("return"),f[Symbol.asyncIterator]=function(){return this},f}function s(t,e){return e={exports:{}},t(e,e.exports),e.exports}function f(t){var e=Pr.call(t,Ar),r=t[Ar];try{t[Ar]=void 0;var n=!0}catch(t){}var o=$r.call(t);return n&&(e?t[Ar]=r:delete t[Ar]),o}function l(t){return Sr.call(t)}function h(t){return null==t?void 0===t?Er:Rr:zr&&zr in Object(t)?f(t):l(t)}function p(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function d(t){if(!p(t))return!1;var e=h(t);return e==Mr||e==Dr||e==Cr||e==Tr}function v(t){return void 0===t}function b(t,e){return function(r){return t(e(r))}}function y(t){return null!=t&&"object"==typeof t}function g(t){if(!y(t)||h(t)!=Nr)return!1;var e=Br(t);if(null===e)return!0;var r=Ur.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Lr.call(r)==qr}function _(){}function m(t,e,r){return t===t&&(void 0!==r&&(t=t<=r?t:r),void 0!==e&&(t=t>=e?t:e)),t}function w(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r0&&r(a)?e>1?D(a,e-1,r,n,o):z(o,a):n||(o[o.length]=a)}return o}function T(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r-1&&t%1==0&&t<=zn}function Z(t){return null!=t&&Y(t.length)&&!d(t)}function tt(t,e){return!!(e=null==e?Cn:e)&&("number"==typeof t||Mn.test(t))&&t>-1&&t%1==0&&t1?r[o-1]:void 0,u=o>2?r[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,u&&et(r[0],r[1],u)&&(i=o<3?void 0:i,o=1),e=Object(e);++n-1}function mt(t,e){var r=this.__data__,n=bt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function wt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++ea))return!1;var s=i.get(t);if(s&&i.get(e))return s==e;var f=-1,l=!0,h=r&wo?new Qt:void 0;for(i.set(t,e),i.set(e,t);++f-1&&(p=u[_],u=u.slice(0,_))}u&&(n.push(u),u="",s=!1);var m=""!==p&&void 0!==d&&d!==p,w="+"===g||"*"===g,j="?"===g||"*"===g,x=p||a,O=b||y;n.push({name:v||o++,prefix:p,delimiter:x,optional:j,repeat:w,partial:m,pattern:O?Le(O):"[^"+Fe(x)+"]+?"})}}return(u||i-1;else{var h=Fe(l.prefix),p=l.repeat?"(?:"+l.pattern+")(?:"+h+"(?:"+l.pattern+"))*":l.pattern;e&&e.push(l),l.optional?l.partial?c+=h+"("+p+")?":c+="(?:"+h+"("+p+"))?":c+=h+"("+p+")"}}return o?(n||(c+="(?:"+i+")?"),c+="$"===a?"$":"(?="+a+")"):(n||(c+="(?:"+i+"(?="+a+"))?"),s||(c+="(?="+i+"|"+a+")")),new RegExp("^"+c,Ue(r))}function Ge(t,e,r){return t instanceof RegExp?qe(t,e):Array.isArray(t)?Qe(t,e,r):Ve(t,e,r)}function He(t){for(;!v(t);){if(!v(t.$router))return t.$router;t=t.$parentContext}return Ei.head}function Ke(t){var e=Ei.head;if(e)for(;e.bound;)e=e.ctx.$child.router;else e=new Ei(Ei.getPathFromLocation(),void 0,t);if(e.bound=!0,e.isRoot)e.ctx.runBeforeRender().then(function(){e.ctx._redirect?e.ctx.runAfterRender().then(function(){var t=Re(e,e.ctx._redirect),r=t.router,n=t.path;r.update(n,e.ctx._redirectArgs)}):(e.ctx.render(),xe(Ei.onInit,function(t){return t(e)}))});else if(e.ctx._redirect){var r=Re(e,e.ctx._redirect),n=r.router,o=r.path;setTimeout(function(){return n.update(o,e.ctx._redirectArgs)})}return e}var Je=s(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),Xe=s(function(t){var e=t.exports={version:"2.5.1"};"number"==typeof __e&&(__e=e)}),Ye=Je["__core-js_shared__"]||(Je["__core-js_shared__"]={}),Ze=function(t){return Ye[t]||(Ye[t]={})},tr=0,er=Math.random(),rr=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++tr+er).toString(36))},nr=s(function(t){var e=Ze("wks"),r=Je.Symbol,n="function"==typeof r;(t.exports=function(t){return e[t]||(e[t]=n&&r[t]||(n?r:rr)("Symbol."+t))}).store=e}),or=nr,ir={f:or},ur=function(t){return"object"==typeof t?null!==t:"function"==typeof t},ar=function(t){if(!ur(t))throw TypeError(t+" is not an object!");return t},cr=function(t){try{return!!t()}catch(t){return!0}},sr=!cr(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),fr=Je.document,lr=ur(fr)&&ur(fr.createElement),hr=function(t){return lr?fr.createElement(t):{}},pr=!sr&&!cr(function(){return 7!=Object.defineProperty(hr("div"),"a",{get:function(){return 7}}).a}),dr=function(t,e){if(!ur(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!ur(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!ur(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!ur(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},vr=Object.defineProperty,br=sr?Object.defineProperty:function(t,e,r){if(ar(t),e=dr(e,!0),ar(r),pr)try{return vr(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t},yr={f:br},gr=yr.f,_r=function(t){var e=Xe.Symbol||(Xe.Symbol=Je.Symbol||{});"_"==t.charAt(0)||t in e||gr(e,t,{value:ir.f(t)})};_r("asyncIterator"),_r("observable");var mr="object"==typeof global&&global&&global.Object===Object&&global,wr="object"==typeof self&&self&&self.Object===Object&&self,jr=mr||wr||Function("return this")(),xr=jr.Symbol,Or=Object.prototype,Pr=Or.hasOwnProperty,$r=Or.toString,Ar=xr?xr.toStringTag:void 0,kr=Object.prototype,Sr=kr.toString,Rr="[object Null]",Er="[object Undefined]",zr=xr?xr.toStringTag:void 0,Cr="[object AsyncFunction]",Mr="[object Function]",Dr="[object GeneratorFunction]",Tr="[object Proxy]",Br=b(Object.getPrototypeOf,Object),Nr="[object Object]",Ir=Function.prototype,Fr=Object.prototype,Lr=Ir.toString,Ur=Fr.hasOwnProperty,qr=Lr.call(Object),Qr=Array.isArray,Vr="[object Symbol]",Wr=1/0,Gr=xr?xr.prototype:void 0,Hr=Gr?Gr.toString:void 0,Kr=NaN,Jr=/^\s+|\s+$/g,Xr=/^[-+]0x[0-9a-f]+$/i,Yr=/^0b[01]+$/i,Zr=/^0o[0-7]+$/i,tn=parseInt,en=1/0,rn=1.7976931348623157e308,nn="[object Boolean]",on="[object String]",un="[object Arguments]",an=Object.prototype,cn=an.hasOwnProperty,sn=an.propertyIsEnumerable,fn=C(function(){return arguments}())?C:function(t){return y(t)&&cn.call(t,"callee")&&!sn.call(t,"callee")},ln=xr?xr.isConcatSpreadable:void 0,hn=jr["__core-js_shared__"],pn=function(){var t=/[^.]+$/.exec(hn&&hn.keys&&hn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),dn=Function.prototype,vn=dn.toString,bn=/[\\^$.*+?()[\]{}|]/g,yn=/^\[object .+?Constructor\]$/,gn=Function.prototype,_n=Object.prototype,mn=gn.toString,wn=_n.hasOwnProperty,jn=RegExp("^"+mn.call(wn).replace(bn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xn=function(){try{var t=U(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),On=Object.prototype,Pn=On.hasOwnProperty,$n=Math.max,An=xn?function(t,e){return xn(t,"toString",{configurable:!0,enumerable:!1,value:J(e),writable:!0})}:G,kn=800,Sn=16,Rn=Date.now,En=function(t){var e=0,r=0;return function(){var n=Rn(),o=Sn-(n-r);if(r=n,o>0){if(++e>=kn)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(An),zn=9007199254740991,Cn=9007199254740991,Mn=/^(?:0|[1-9]\d*)$/,Dn="object"==typeof t&&t&&!t.nodeType&&t,Tn=Dn&&"object"==typeof module&&module&&!module.nodeType&&module,Bn=Tn&&Tn.exports===Dn,Nn=Bn?jr.Buffer:void 0,In=Nn?Nn.isBuffer:void 0,Fn=In||ot,Ln={};Ln["[object Float32Array]"]=Ln["[object Float64Array]"]=Ln["[object Int8Array]"]=Ln["[object Int16Array]"]=Ln["[object Int32Array]"]=Ln["[object Uint8Array]"]=Ln["[object Uint8ClampedArray]"]=Ln["[object Uint16Array]"]=Ln["[object Uint32Array]"]=!0,Ln["[object Arguments]"]=Ln["[object Array]"]=Ln["[object ArrayBuffer]"]=Ln["[object Boolean]"]=Ln["[object DataView]"]=Ln["[object Date]"]=Ln["[object Error]"]=Ln["[object Function]"]=Ln["[object Map]"]=Ln["[object Number]"]=Ln["[object Object]"]=Ln["[object RegExp]"]=Ln["[object Set]"]=Ln["[object String]"]=Ln["[object WeakMap]"]=!1;var Un="object"==typeof t&&t&&!t.nodeType&&t,qn=Un&&"object"==typeof module&&module&&!module.nodeType&&module,Qn=qn&&qn.exports===Un,Vn=Qn&&mr.process,Wn=function(){try{return Vn&&Vn.binding&&Vn.binding("util")}catch(t){}}(),Gn=Wn&&Wn.isTypedArray,Hn=Gn?function(t){return function(e){return t(e)}}(Gn):it,Kn=Object.prototype,Jn=Kn.hasOwnProperty,Xn=Object.prototype,Yn=Object.prototype,Zn=Yn.hasOwnProperty,to=rt(function(t,e){W(e,ft(e),t)}),eo=rt(function(t,e,r,n){W(e,ft(e),t,n)}),ro=function(t){return function(e,r,n){for(var o=-1,i=Object(e),u=n(e),a=u.length;a--;){var c=u[t?a:++o];if(!1===r(i[c],c,i))break}return e}}(),no=b(Object.keys,Object),oo=Object.prototype,io=oo.hasOwnProperty,uo=function(t,e){return function(r,n){if(null==r)return r;if(!Z(r))return t(r,n);for(var o=r.length,i=e?o:-1,u=Object(r);(e?i--:++i0;)r=r.ctx.$child.router;return r},t.update=function(e,o){return r(this,void 0,void 0,function(){return n(this,function(r){switch(r.label){case 0:return[4,t.head.update(e,o)];case 1:return[2,r.sent()]}})})},t.getPathFromLocation=function(){var e=location.pathname+location.search+location.hash,r=t.config.base.replace("#!","#?!?");return e.replace(new RegExp(r,"i"),"")},t.onclick=function(e){if(!e.defaultPrevented){for(var r=e.target;r&&"A"!==r.nodeName;)r=r.parentNode;if(r&&"A"===r.nodeName){var n=r.pathname,o=r.search,i=r.hash,u=void 0===i?"":i,a=(n+o+u).replace(new RegExp(t.base,"i"),""),c=t.hasRoute(a),s=!t.sameOrigin(r.href),f=1!==t.which(e),l=r.hasAttribute("download"),h="#"===r.getAttribute("href"),p=0===(r.getAttribute("href")||"").indexOf("mailto:"),d="external"===r.getAttribute("rel"),v=e.metaKey||e.ctrlKey||e.shiftKey,b=r.hasAttribute("target");!c||s||f||l||h||p||d||v||b||(t.update(a),e.preventDefault())}}},t.onpopstate=function(e){t.update(t.getPathFromLocation(),!1),e.preventDefault()},t.canonicalizePath=function(t){return t.replace(new RegExp("/?#?!?/?"),"/")},t.parseUrl=function(e){var r=document.createElement("a"),n=t.base.toLowerCase();return n&&0===e.toLowerCase().indexOf(n)&&(e=e.replace(new RegExp(n,"i"),"")||"/"),r.href=t.canonicalizePath(e),{hash:r.hash,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname,search:r.search}},t.getPath=function(e){return t.parseUrl(e).pathname},t.hasRoute=function(e){return!v(t.head.resolveRoute(t.getPath(e)))},t.createRoutes=function(t){return xe(t,function(t,e){return new Ri(e,t)})},t.normalizeRoutes=function(e){return Pe(e,function(e){return xe(t.runPlugins(e),function(e){return g(e)?t.normalizeRoutes(e):e})})},t.runPlugins=function(e){return Oe(E(e),function(e){var r=ke(t.plugins,function(t,r){var n=r(e);return v(n)?t:t.concat(E(n))},[]);return r.length>0?r:e})},t.sameOrigin=function(t){var e=location.hostname,r=location.port,n=location.protocol,o=n+"//"+e;return r&&(o+=":"+r),t&&0===t.indexOf(o)},t.which=function(t){return t=t||window.event,null===t.which?t.button:t.which},t.onInit=[],t.middleware=[],t.plugins=[],t.config={base:"",hashbang:!1,activePathCSSClass:"active-path"},t.routes={},t.events={click:document.ontouchstart?"touchstart":"click",popstate:"popstate"},t}();e.bindingHandlers.path={init:function(t,r,n,o,i){var u=n.get("pathActiveClass")||Ei.config.activePathCSSClass;Ei.initialized.then(function(){var n=e.pureComputed(function(){return Re(He(i),e.unwrap(r()))});e.applyBindingsToNode(t,{attr:{href:e.pureComputed(function(){return Ee(n())})},css:(o={},o[u]=e.pureComputed(function(){return ze(n())}),o)});var o})}},e.components.register("ko-component-router",{synchronous:!0,viewModel:{createViewModel:Ke},template:'
\n
\n
'}),e.bindingHandlers.__ko_component_router__={init:function(t,r,n,o,i){var u=i.$rawData;return e.applyBindingsToNode(t,{css:u.component,component:{name:u.component,params:u.ctx}},i.extend({$router:u})),u.isRoot?u.init():u.ctx.$parent.router.initialized.then(function(){return u.init()}),{controlsDescendantBindings:!0}}},t.Context=wi,t.Route=Ri,t.Router=Ei,t.isActivePath=ze,t.resolveHref=Ee,Object.defineProperty(t,"__esModule",{value:!0})}); \ No newline at end of file diff --git a/package.json b/package.json index c888d82..34dc85c 100644 --- a/package.json +++ b/package.json @@ -7,19 +7,20 @@ "homepage": "https://github.com/Profiscience/ko-component-router", "bugs": "https://github.com/Profiscience/ko-component-router/issues", "repository": "Profiscience/ko-component-router", - "main": "dist/umd/index.js", - "jsnext:main": "dist/modules/index.js", - "module": "dist/modules/index.js", - "typings": "dist/typings/index.d.ts", + "main": "ko-component-router.js", + "jsnext:main": "dist/index.js", + "module": "dist/index.js", + "typings": "dist/index.d.ts", "files": [ - "dist" + "dist/", + "ko-component-router.js" ], "scripts": { - "build": "fly build", - "watch": "fly watch", - "test": "fly test", - "test:watch": "fly test:watch", - "prepublish": "npm run build" + "build": "taskr build", + "watch": "taskr watch", + "test": "taskr test", + "test:watch": "taskr test:watch", + "prepublish": "yarn build" }, "keywords": [ "knockoutjs", @@ -28,29 +29,28 @@ "component", "router", "routing", - "spa" + "spa", + "framework" ], "dependencies": { - "core-js": "^2.4.1", - "lodash-es": "^4.17.4", + "core-js": "^2.3.0", + "lodash-es": "^4.14.0", "path-to-regexp": "^2.0.0", - "tslib": "^1.7.0", - "typescript": "^2.4.0" + "tslib": "^1.7.0" }, "peerDependencies": { "knockout": "^3.4.0" }, "devDependencies": { + "@taskr/clear": "^1.1.0", + "@taskr/uglify": "^1.1.0", + "@taskr/watch": "^1.1.0", "@types/knockout": "^3.4.0", "@types/lodash-es": "^4.14.4", "chalk": "^2.0.0", - "coveralls": "^3.0.0", - "cross-spawn": "^5.1.0", - "fly": "^2.0.5", - "fly-rename": "^0.1.1", - "fly-rollup": "^2.0.0", - "fly-uglify": "^2.1.1", - "fly-watch": "^1.1.1", + "eslint": "^4.9.0", + "eslint-config-profiscience": "^2.0.4", + "execa": "^0.8.0", "jquery": "^3.1.1", "karma": "^1.6.0", "karma-chrome-launcher": "^2.0.0", @@ -69,6 +69,11 @@ "rollup-plugin-node-globals": "^1.1.0", "rollup-plugin-node-resolve": "^3.0.0", "tape": "^4.8.0", - "tslint": "^5.8.0" + "taskr": "^1.1.0", + "taskr-rename": "^0.0.1", + "taskr-rollup": "^0.0.2", + "ts-node": "^3.3.0", + "tslint": "^5.8.0", + "typescript": "^2.5.3" } } diff --git a/taskfile.js b/taskfile.js new file mode 100644 index 0000000..7846ea2 --- /dev/null +++ b/taskfile.js @@ -0,0 +1,16 @@ +'use strict' + +Object.assign(exports, require('./tasks/test')) +Object.assign(exports, require('./tasks/bundle')) +exports.compile = require('./tasks/compile') +exports.stats = require('./tasks/stats') + +exports.build = function* (task) { + yield task.clear('dist') + yield task.serial(['compile', 'bundle', 'stats']) +} + +exports.watch = function * (task) { + yield task.start('build') + yield task.watch('src/*.ts', 'build') +} diff --git a/tasks/.eslintrc b/tasks/.eslintrc new file mode 100644 index 0000000..0294d6b --- /dev/null +++ b/tasks/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": "profiscience", + "parserOptions": { + "sourceType": "script" + } +} \ No newline at end of file diff --git a/tasks/bundle.js b/tasks/bundle.js index ad5eef8..718155a 100644 --- a/tasks/bundle.js +++ b/tasks/bundle.js @@ -6,35 +6,33 @@ const commonjs = require('rollup-plugin-commonjs') let cache -module.exports = function * (fly) { - yield fly.source(path.resolve(__dirname, '../dist/modules/index.js')) - .rollup({ - rollup: { +module.exports = { + * 'bundle'(task) { + yield task + .source(path.resolve(__dirname, '../dist/index.js')) + .rollup({ cache, + external: ['knockout'], plugins: [ nodeResolve({ preferBuiltins: false }), commonjs() ], - external: ['knockout'] - }, - bundle: { - format: 'umd', - moduleName: 'ko.router', - globals: { - knockout: 'ko' - }, + output: { + file: 'ko-component-router.js', + format: 'umd', + exports: 'named', // const { Router, Route, Context, ... } = ko.router + globals: { + knockout: 'ko' + }, + name: 'ko.router' + } + }) + .target(path.resolve(__dirname, '../')) - // const { Router, Route, Context } = ko.router - exports: 'named' - } - }) - - .rename({ basename: 'ko-component-router', extname: '.js' }) - .target(path.resolve(__dirname, '../dist')) - - .uglify() - .rename({ suffix: '.min' }) - .target(path.resolve(__dirname, '../dist')) -} + .uglify() + .rename({ suffix: '.min' }) + .target(path.resolve(__dirname, '../')) + } +} \ No newline at end of file diff --git a/tasks/compile.js b/tasks/compile.js new file mode 100644 index 0000000..5cc14d7 --- /dev/null +++ b/tasks/compile.js @@ -0,0 +1,7 @@ +'use strict' + +const execa = require('execa') + +module.exports = function* () { + yield execa('tsc', { stdio: 'inherit' }) +} diff --git a/tasks/modules.js b/tasks/modules.js deleted file mode 100644 index 42ce482..0000000 --- a/tasks/modules.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -const path = require('path') -const spawn = require('cross-spawn') - -module.exports = function * () { - yield new Promise((resolve) => { - const tsc = spawn('tsc', [ - '--module', 'es2015', - '--outDir', path.resolve(__dirname, '../dist/modules') - ], { stdio: 'inherit' }) - tsc.on('close', resolve) - }) -} diff --git a/tasks/stats.js b/tasks/stats.js index a5ff9ea..a2b4c08 100644 --- a/tasks/stats.js +++ b/tasks/stats.js @@ -2,13 +2,15 @@ const path = require('path') const { gzip } = require('zlib') -const { each, padEnd, round } = require('lodash') +const _ = require('lodash') const { green } = require('chalk') +const { padEnd, padStart, round } = _ -module.exports = function * (fly) { +module.exports = function * (task) { const stats = [] - yield fly.source(path.resolve(__dirname, '../dist/ko-component-router.*')) + yield task + .source(path.resolve(__dirname, '../ko-component-router.*')) .run({ every: true }, function * ({ base: name, data }) { const gzipped = yield new Promise((resolve) => gzip(data, (_, result) => resolve(result))) const kilobytes = round(Buffer.byteLength(data, 'utf8') / 1000) @@ -16,17 +18,18 @@ module.exports = function * (fly) { stats.push([name, kilobytes, compressedKilobytes]) }) - .run({ every: false }, function * () { + .run({ every: false }, function * () { // eslint-disable-line require-yield const border = '-------------------------------------------------------------' - console.log(green(border)) - each(stats, ([name, raw, gzipped]) => - console.log(green( - '|', - padEnd( - (padEnd(name, 'dist/ko-component-router.min.js'.length) + `\t~${raw}kb\t~${gzipped}kb gzipped`), - border.length - 5 - ), - '|'))) - console.log(green(border)) + const padLeftWidth = 'ko-component-router.min.js'.length + 3 + const padRightWidth = border.length - 4 - padLeftWidth + console.log(green(border)) // eslint-disable-line no-console + _(stats) + .sortBy(([name]) => name) + .each(([name, raw, gzipped]) => + console.log(green( // eslint-disable-line no-console + '|', + (padEnd(name, padLeftWidth) + padStart(`~${raw}kb ~${gzipped}kb gzipped`, padRightWidth)), + '|'))) + console.log(green(border)) // eslint-disable-line no-console }) } diff --git a/tasks/test.js b/tasks/test.js index b13bdd8..b799c3b 100644 --- a/tasks/test.js +++ b/tasks/test.js @@ -1,7 +1,6 @@ 'use strict' const path = require('path') -const spawn = require('cross-spawn') const { Server } = require('karma') const nodeResolve = require('rollup-plugin-node-resolve') const nodeBuiltins = require('rollup-plugin-node-builtins') @@ -13,37 +12,26 @@ const rollupIstanbul = require('rollup-plugin-istanbul') let cache, watch, coverage module.exports = { - * test(fly) { - watch = false + * test(task) { coverage = true + watch = false - yield fly.serial(['test:build', 'karma']) + yield task.serial(['compile', 'karma']) }, - * 'test:watch'(fly) { + * 'test:watch'(task) { coverage = false watch = true - yield fly.watch(path.resolve(__dirname, '../src/**/*.ts'), 'test:build') - yield fly.serial(['test:build', 'karma']) - }, - * 'test:build'() { - yield new Promise((resolve) => { - const tsc = spawn('tsc', [ - '--target', coverage ? 'es5' : 'es2017', - '--module', 'es2015', - '--outDir', path.resolve(__dirname, '../dist/test') - ], { stdio: 'inherit' }) - tsc.on('close', resolve) - }) + yield task.watch(path.resolve(__dirname, '../src/**/*.ts'), 'compile') + yield task.serial(['compile', 'karma']) }, - * karma() { + * karma() { // eslint-disable-line require-yield const config = { basePath: path.resolve(__dirname, '..'), frameworks: ['tap'], files: [ - { pattern: 'dist/test/**/*.js', included: false }, 'test/index.js' ], @@ -117,7 +105,6 @@ module.exports = { } } - const server = new Server(config, (code) => process.exit(code)) - server.start() + new Server(config, (code) => process.exit(code)).start() } } diff --git a/tasks/typings.js b/tasks/typings.js deleted file mode 100644 index 14f73b3..0000000 --- a/tasks/typings.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -const path = require('path') -const spawn = require('cross-spawn') - -module.exports = function * () { - yield new Promise((resolve) => { - const tsc = spawn('tsc', [ - '--declaration', 'true', - '--declarationDir', path.resolve(__dirname, '../dist/typings') - ], { stdio: 'inherit' }) - tsc.on('close', resolve) - }) -} diff --git a/tasks/umd.js b/tasks/umd.js deleted file mode 100644 index 12002ac..0000000 --- a/tasks/umd.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -const path = require('path') -const spawn = require('cross-spawn') - -module.exports = function * () { - yield new Promise((resolve) => { - const tsc = spawn('tsc', [ - '--module', 'umd', - '--outDir', path.resolve(__dirname, '../dist/umd') - ], { stdio: 'inherit' }) - tsc.on('close', resolve) - }) -} diff --git a/test/.eslintrc b/test/.eslintrc new file mode 100644 index 0000000..434001c --- /dev/null +++ b/test/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": "profiscience", + "parserOptions": { + "sourceType": "module" + } +} \ No newline at end of file diff --git a/test/anchor.js b/test/anchor.js index 573e818..fa00068 100644 --- a/test/anchor.js +++ b/test/anchor.js @@ -1,7 +1,7 @@ import { map } from 'lodash-es' import ko from 'knockout' -import { Router } from '../dist/test' +import { Router } from '../' const ignoredAnchors = [ 'x-origin', diff --git a/test/basepath.js b/test/basepath.js index 8195ead..2b97762 100644 --- a/test/basepath.js +++ b/test/basepath.js @@ -1,7 +1,7 @@ import ko from 'knockout' import $ from 'jquery' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('basepath', { template: ` diff --git a/test/before-navigate-callbacks.js b/test/before-navigate-callbacks.js index 8d7f695..e860da7 100644 --- a/test/before-navigate-callbacks.js +++ b/test/before-navigate-callbacks.js @@ -1,6 +1,6 @@ import ko from 'knockout' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('before-navigate-callbacks', { template: '', diff --git a/test/binding.js b/test/binding.js index 97b76a7..ca35c95 100644 --- a/test/binding.js +++ b/test/binding.js @@ -1,7 +1,7 @@ import ko from 'knockout' import $ from 'jquery' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('binding', { template: ` diff --git a/test/force-update.js b/test/force-update.js index 93d5aa8..d52ee7b 100644 --- a/test/force-update.js +++ b/test/force-update.js @@ -1,6 +1,6 @@ import ko from 'knockout' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('force-update', { template: '', diff --git a/test/hashbang.js b/test/hashbang.js index 5072e90..dd9ccfb 100644 --- a/test/hashbang.js +++ b/test/hashbang.js @@ -1,7 +1,7 @@ import ko from 'knockout' import $ from 'jquery' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('hashbang', { template: ` diff --git a/test/history.js b/test/history.js index e25b3ec..f92f16c 100644 --- a/test/history.js +++ b/test/history.js @@ -1,6 +1,6 @@ import ko from 'knockout' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('history', { template: '', diff --git a/test/middleware.js b/test/middleware.js index 905ad51..cef0ee7 100644 --- a/test/middleware.js +++ b/test/middleware.js @@ -1,6 +1,6 @@ import ko from 'knockout' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('middleware', { template: '', diff --git a/test/plugins.js b/test/plugins.js index e3f7ddf..308510b 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -1,7 +1,7 @@ import { isPlainObject, merge } from 'lodash-es' import ko from 'knockout' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('plugins', { template: '', @@ -29,9 +29,11 @@ ko.components.register('plugins', { '/component': { component: 'component' }, + // eslint-disable-next-line formatting/newline-object-in-array '/data': ['data', { data: Promise.resolve(true) }], + // eslint-disable-next-line formatting/newline-object-in-array '/data-multi': ['data-multi', { data: { true: Promise.resolve(true), diff --git a/test/queue.js b/test/queue.js index be83c68..cfa7eed 100644 --- a/test/queue.js +++ b/test/queue.js @@ -1,6 +1,6 @@ import ko from 'knockout' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('queue', { template: '', diff --git a/test/redirect.js b/test/redirect.js index f6e36a0..30af46b 100644 --- a/test/redirect.js +++ b/test/redirect.js @@ -1,6 +1,6 @@ import ko from 'knockout' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('redirect', { template: '', diff --git a/test/routing/index.js b/test/routing/index.js index 181a84c..c336832 100644 --- a/test/routing/index.js +++ b/test/routing/index.js @@ -1,7 +1,7 @@ import ko from 'knockout' import { extend, map } from 'lodash-es' -import { Router } from '../../dist/test' +import { Router } from '../../' import * as init from './init' import * as basic from './basic' diff --git a/test/routing/nested.js b/test/routing/nested.js index af1bd71..6dbf999 100644 --- a/test/routing/nested.js +++ b/test/routing/nested.js @@ -1,6 +1,6 @@ import ko from 'knockout' -import { Router } from '../../dist/test' +import { Router } from '../../' ko.components.register('nested', { template: '', @@ -58,7 +58,7 @@ ko.components.register('nested', { constructor(ctx) { t.pass('works with implied router component (no specified component)') - t.equals(ctx.$root.$child.router, Router.get(1), 'Router.get(n) works') + t.equals(ctx.$root.$child.router, Router.get(1), 'Router.get(n) works') t.equals(ctx.$root, Router.head.ctx, 'ctx.$root is Router.head.ctx') t.equals(Router.head.ctx.$parent, undefined, 'root ctx.$parent is undefined') diff --git a/test/with.js b/test/with.js index 1696163..04363ef 100644 --- a/test/with.js +++ b/test/with.js @@ -1,6 +1,6 @@ import ko from 'knockout' -import { Router } from '../dist/test' +import { Router } from '../' ko.components.register('with', { template: '', diff --git a/tsconfig.json b/tsconfig.json index fe4c3c2..cc33f12 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,11 +4,13 @@ "importHelpers": true, "moduleResolution": "node", "target": "es5", - "module": "umd", - "sourceMap": true, + "module": "es2015", + "declaration": true, "rootDir": "./src", "baseUrl": "./src", - "outDir": "./dist/umd", + "sourceMap": true, + "inlineSources": true, + "outDir": "./dist", "lib": [ "dom", "es5", diff --git a/yarn.lock b/yarn.lock index 0e3e3d0..5163dd0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,19 +2,38 @@ # yarn lockfile v1 +"@taskr/clear@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@taskr/clear/-/clear-1.1.0.tgz#0a88d180bed2f91f310136375a72c00b50834fd1" + dependencies: + bluebird "^3.5.0" + rimraf "^2.5.4" + +"@taskr/uglify@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@taskr/uglify/-/uglify-1.1.0.tgz#0c8b292e3decaffe0a4cf41aec711611859bc998" + dependencies: + uglify-js "^2.8.0" + +"@taskr/watch@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@taskr/watch/-/watch-1.1.0.tgz#bf447178cfac71fc99b250ff46c40ad3f96173d6" + dependencies: + chokidar "^1.7.0" + "@types/knockout@^3.4.0": version "3.4.46" resolved "https://registry.yarnpkg.com/@types/knockout/-/knockout-3.4.46.tgz#e8bf3c356524f4b4b6b4e4159da363e49e826468" "@types/lodash-es@^4.14.4": - version "4.14.7" - resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.14.7.tgz#5eac6eff541ff352e5c818be326588230616c8f1" + version "4.17.0" + resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.0.tgz#ed9044d62ee36a93e0650b112701986b1c74c766" dependencies: "@types/lodash" "*" "@types/lodash@*": - version "4.14.78" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.78.tgz#f26a0b38a44a832c652964803c7e48be05939d3f" + version "4.14.80" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.80.tgz#a6b8b7900e6a7dcbc2e90d9b6dfbe3f6a7f69951" abbrev@1: version "1.1.1" @@ -37,11 +56,21 @@ accepts@1.3.3: mime-types "~2.1.11" negotiator "0.6.1" +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + dependencies: + acorn "^3.0.4" + +acorn@^3.0.4: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + acorn@^4.0.1: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" -acorn@^5.1.2: +acorn@^5.1.1, acorn@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7" @@ -49,6 +78,10 @@ after@0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" +ajv-keywords@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.0.tgz#a296e17f7bfae7c1ce4f7e0de53d29cb32162df0" + ajv@^4.9.1: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" @@ -56,7 +89,7 @@ ajv@^4.9.1: co "^4.6.0" json-stable-stringify "^1.0.1" -ajv@^5.1.0: +ajv@^5.2.0, ajv@^5.2.3: version "5.3.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.3.0.tgz#4414ff74a50879c208ee5fdc826e32c303549eda" dependencies: @@ -77,6 +110,10 @@ amdefine@>=0.0.4, amdefine@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" +ansi-escapes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -141,7 +178,13 @@ array-slice@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5" -array-uniq@^1.0.2: +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1, array-uniq@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" @@ -153,7 +196,7 @@ arraybuffer.slice@0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz#f33b2159f0532a3f3107a272c0ccfbd1ad2979ca" -arrify@^1.0.1: +arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" @@ -193,14 +236,18 @@ aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - -aws4@^1.2.1, aws4@^1.6.0: +aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" +babel-code-frame@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-beta.0.tgz#418a7b5f3f7dc9a4670e61b1158b4c5661bec98d" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" @@ -209,6 +256,69 @@ babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" +babel-eslint@^8.0.0: + version "8.0.1" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.0.1.tgz#5d718be7a328625d006022eb293ed3008cbd6346" + dependencies: + babel-code-frame "7.0.0-beta.0" + babel-traverse "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + babylon "7.0.0-beta.22" + +babel-helper-function-name@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-beta.0.tgz#d1b6779b647e5c5c31ebeb05e13b998e4d352d56" + dependencies: + babel-helper-get-function-arity "7.0.0-beta.0" + babel-template "7.0.0-beta.0" + babel-traverse "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + +babel-helper-get-function-arity@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-beta.0.tgz#9d1ab7213bb5efe1ef1638a8ea1489969b5a8b6e" + dependencies: + babel-types "7.0.0-beta.0" + +babel-messages@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-beta.0.tgz#6df01296e49fc8fbd0637394326a167f36da817b" + +babel-template@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-beta.0.tgz#85083cf9e4395d5e48bf5154d7a8d6991cafecfb" + dependencies: + babel-traverse "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + babylon "7.0.0-beta.22" + lodash "^4.2.0" + +babel-traverse@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-beta.0.tgz#da14be9b762f62a2f060db464eaafdd8cd072a41" + dependencies: + babel-code-frame "7.0.0-beta.0" + babel-helper-function-name "7.0.0-beta.0" + babel-messages "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + babylon "7.0.0-beta.22" + debug "^3.0.1" + globals "^10.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +babel-types@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-beta.0.tgz#eb8b6e556470e6dcc4aef982d79ad229469b5169" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^2.0.0" + +babylon@7.0.0-beta.22: + version "7.0.0-beta.22" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.22.tgz#74f0ad82ed7c7c3cfeab74cf684f815104161b65" + backo2@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947" @@ -294,18 +404,6 @@ boom@2.x.x: dependencies: hoek "2.x.x" -boom@4.x.x: - version "4.3.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" - dependencies: - hoek "4.x.x" - -boom@5.x.x: - version "5.2.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" - dependencies: - hoek "4.x.x" - brace-expansion@^1.1.7: version "1.1.8" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" @@ -410,10 +508,20 @@ bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + dependencies: + callsites "^0.2.0" + callsite@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/callsite/-/callsite-1.0.0.tgz#280398e5d664bd74038b6f0905153e6e8af1bc20" +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + camelcase-keys@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" @@ -458,7 +566,7 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0: escape-string-regexp "^1.0.5" supports-color "^4.0.0" -chokidar@^1.4.1, chokidar@^1.6.1, chokidar@^1.7.0: +chokidar@^1.4.1, chokidar@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" dependencies: @@ -479,6 +587,20 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: dependencies: inherits "^2.0.1" +circular-json@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + cliui@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" @@ -499,9 +621,9 @@ clone@~0.1.9: version "0.1.19" resolved "https://registry.yarnpkg.com/clone/-/clone-0.1.19.tgz#613fb68639b26a494ac53253e15b1a6bd88ada85" -clor@^5.0.1: - version "5.1.0" - resolved "https://registry.yarnpkg.com/clor/-/clor-5.1.0.tgz#8d320650d7193add04ebf891d79dee4cabc80c2c" +clor@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/clor/-/clor-5.2.0.tgz#9ddc74e7e86728cfcd05a80546ba58d317b81035" co@^4.6.0: version "4.6.0" @@ -561,7 +683,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.4.4: +concat-stream@^1.4.4, concat-stream@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -590,7 +712,7 @@ cookie@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" -core-js@^2.2.0, core-js@^2.4.1: +core-js@^2.2.0, core-js@^2.3.0: version "2.5.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b" @@ -598,16 +720,6 @@ core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" -coveralls@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.0.tgz#22ef730330538080d29b8c151dc9146afde88a99" - dependencies: - js-yaml "^3.6.1" - lcov-parse "^0.0.10" - log-driver "^1.2.5" - minimist "^1.2.0" - request "^2.79.0" - create-ecdh@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.0.tgz#888c723596cdf7612f6498233eebd7a35301737d" @@ -635,7 +747,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-spawn@^5.1.0: +cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" dependencies: @@ -649,12 +761,6 @@ cryptiles@2.x.x: dependencies: boom "2.x.x" -cryptiles@3.x.x: - version "3.1.2" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" - dependencies: - boom "5.x.x" - crypto-browserify@^3.11.0: version "3.11.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.11.0.tgz#3652a0906ab9b2a7e0c3ce66a408e957a2485522" @@ -711,6 +817,12 @@ debug@2.6.9, debug@^2.2.0: dependencies: ms "2.0.0" +debug@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + decamelize@^1.0.0, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -744,6 +856,18 @@ defined@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" +del@^2.0.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" + dependencies: + globby "^5.0.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + rimraf "^2.2.8" + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" @@ -767,7 +891,7 @@ di@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/di/-/di-0.0.1.tgz#806649326ceaa7caa3306d75d985ea2748ba913c" -diff@^3.2.0: +diff@^3.1.0, diff@^3.2.0: version "3.4.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c" @@ -779,6 +903,13 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" +doctrine@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + dom-serialize@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/dom-serialize/-/dom-serialize-2.2.1.tgz#562ae8999f44be5ea3076f5419dcd59eb43ac95b" @@ -911,6 +1042,73 @@ escodegen@1.8.x: optionalDependencies: source-map "~0.2.0" +eslint-config-profiscience@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/eslint-config-profiscience/-/eslint-config-profiscience-2.0.4.tgz#bd97aee68721e8caf39c7503f48782da25f9a742" + dependencies: + babel-eslint "^8.0.0" + eslint-plugin-formatting "0.0.4" + +eslint-plugin-formatting@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-formatting/-/eslint-plugin-formatting-0.0.4.tgz#0e9b0fb478f6890c2e460c669698411d922ddd44" + +eslint-scope@^3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint@^4.9.0: + version "4.9.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.9.0.tgz#76879d274068261b191fe0f2f56c74c2f4208e8b" + dependencies: + ajv "^5.2.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.0.1" + doctrine "^2.0.0" + eslint-scope "^3.7.1" + espree "^3.5.1" + esquery "^1.0.0" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^9.17.0" + ignore "^3.3.3" + imurmurhash "^0.1.4" + inquirer "^3.0.6" + is-resolvable "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" + strip-json-comments "~2.0.1" + table "^4.0.1" + text-table "~0.2.0" + +espree@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.1.tgz#0c988b8ab46db53100a1954ae4ba995ddd27d87e" + dependencies: + acorn "^5.1.1" + acorn-jsx "^3.0.0" + esprima@2.7.x, esprima@^2.7.1: version "2.7.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" @@ -923,10 +1121,27 @@ esprima@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" +esquery@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" + dependencies: + estraverse "^4.1.0" + object-assign "^4.0.1" + estraverse@^1.9.1: version "1.9.3" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + estree-walker@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e" @@ -953,6 +1168,18 @@ evp_bytestokey@^1.0.0: dependencies: create-hash "^1.1.1" +execa@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + expand-braces@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/expand-braces/-/expand-braces-0.1.2.tgz#488b1d1d2451cb3d3a6b192cfc030f44c5855fea" @@ -980,10 +1207,18 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" -extend@^3.0.0, extend@~3.0.0, extend@~3.0.1: +extend@^3.0.0, extend@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" +external-editor@^2.0.4: + version "2.0.5" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.5.tgz#52c249a3981b9ba187c7cacf5beb50bf1d91a6bc" + dependencies: + iconv-lite "^0.4.17" + jschardet "^1.4.2" + tmp "^0.0.33" + extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" @@ -1013,6 +1248,19 @@ fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" @@ -1046,38 +1294,14 @@ find-up@^1.0.0: path-exists "^2.0.0" pinkie-promise "^2.0.0" -fly-rename@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/fly-rename/-/fly-rename-0.1.1.tgz#d27ced37ac9b78fc17920e514f15951f1681b742" - -fly-rollup@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fly-rollup/-/fly-rollup-2.1.0.tgz#f1466289317f36e90b3561e47ce9bce5a287ead0" - dependencies: - rollup "^0.41.4" - -fly-uglify@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/fly-uglify/-/fly-uglify-2.1.1.tgz#6ab2358abf6c1eff4d6838e0c59ca948351b84cb" - dependencies: - uglify-js "^2.7.0" - -fly-watch@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/fly-watch/-/fly-watch-1.1.1.tgz#2870081e80826faa5239379b4df97ae10aebae8d" - dependencies: - arrify "^1.0.1" - chokidar "^1.6.1" - -fly@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fly/-/fly-2.0.6.tgz#77aa3c94e8e30ed235e06e91973f135dd55e03bd" +flat-cache@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" dependencies: - bluebird "^3.5.0" - clor "^5.0.1" - glob "^7.1.1" - minimist "^1.2.0" - mkdirp "^0.5.1" + circular-json "^0.3.1" + del "^2.0.2" + graceful-fs "^4.1.2" + write "^0.2.1" for-each@~0.3.2: version "0.3.2" @@ -1111,14 +1335,6 @@ form-data@~2.1.1: combined-stream "^1.0.5" mime-types "^2.1.12" -form-data@~2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.1.tgz#6fb94fbd71885306d73d15cc497fe4cc4ecd44bf" - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.5" - mime-types "^2.1.12" - fs-access@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/fs-access/-/fs-access-1.0.1.tgz#d6a87f262271cefebec30c553407fb995da8777a" @@ -1157,6 +1373,10 @@ function-bind@^1.0.2, function-bind@^1.1.0, function-bind@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + fwd-stream@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/fwd-stream/-/fwd-stream-1.0.4.tgz#ed281cabed46feecf921ee32dc4c50b372ac7cfa" @@ -1180,6 +1400,10 @@ get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" @@ -1209,7 +1433,7 @@ glob@^5.0.15: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.5, glob@^7.1.1, glob@~7.1.2: +glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@~7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -1220,6 +1444,25 @@ glob@^7.0.5, glob@^7.1.1, glob@~7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" +globals@^10.0.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-10.1.0.tgz#4425a1881be0d336b4a823a82a7be725d5dd987c" + +globals@^9.17.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + +globby@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + glogg@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.0.tgz#7fe0f199f57ac906cf512feead8f90ee4a284fc5" @@ -1273,10 +1516,6 @@ har-schema@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - har-validator@~4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" @@ -1284,13 +1523,6 @@ har-validator@~4.2.1: ajv "^4.9.1" har-schema "^1.0.5" -har-validator@~5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" - dependencies: - ajv "^5.1.0" - har-schema "^2.0.0" - has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" @@ -1352,15 +1584,6 @@ hawk@3.1.3, hawk@~3.1.3: hoek "2.x.x" sntp "1.x.x" -hawk@~6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" - dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - sntp "2.x.x" - hmac-drbg@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -1373,9 +1596,11 @@ hoek@2.x.x: version "2.16.3" resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" -hoek@4.x.x: - version "4.2.0" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" +homedir-polyfill@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc" + dependencies: + parse-passwd "^1.0.0" hosted-git-info@^2.1.4: version "2.4.2" @@ -1405,15 +1630,7 @@ http-signature@~1.1.0: jsprim "^1.2.2" sshpk "^1.7.0" -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -iconv-lite@0.4.19: +iconv-lite@0.4.19, iconv-lite@^0.4.17: version "0.4.19" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" @@ -1421,6 +1638,14 @@ idb-wrapper@^1.5.0: version "1.7.1" resolved "https://registry.yarnpkg.com/idb-wrapper/-/idb-wrapper-1.7.1.tgz#6a32670122e173a84ecc5cfa9668fa2ceb221b04" +ignore@^3.3.3: + version "3.3.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.6.tgz#b6f3196b38ed92f0c86e52f6f79b7fc4c8266c8d" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + indent-string@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" @@ -1446,6 +1671,31 @@ ini@~1.3.0: version "1.3.4" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" +inquirer@^3.0.6: + version "3.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^2.0.4" + figures "^2.0.0" + lodash "^4.3.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.1.0" + strip-ansi "^4.0.0" + through "^2.3.6" + +invariant@^2.2.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + dependencies: + loose-envify "^1.0.0" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -1504,6 +1754,10 @@ is-fullwidth-code-point@^1.0.0: dependencies: number-is-nan "^1.0.0" +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + is-function@~1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.1.tgz#12cfb98b65b57dd3d193a3121f5f6e2f437602b5" @@ -1538,6 +1792,22 @@ is-object@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/is-object/-/is-object-0.1.2.tgz#00efbc08816c33cfc4ac8251d132e10dc65098d7" +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + dependencies: + path-is-inside "^1.0.1" + is-posix-bracket@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" @@ -1546,12 +1816,26 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + is-regex@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" dependencies: has "^1.0.1" +is-resolvable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" + dependencies: + tryit "^1.0.1" + +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + is-symbol@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" @@ -1572,7 +1856,7 @@ isarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" -isarray@1.0.0, isarray@~1.0.0: +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -1632,7 +1916,7 @@ js-yaml@3.x: argparse "^1.0.7" esprima "^3.1.1" -js-yaml@^3.6.1: +js-yaml@^3.9.1: version "3.10.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" dependencies: @@ -1643,6 +1927,10 @@ jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" +jschardet@^1.4.2: + version "1.5.1" + resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.5.1.tgz#c519f629f86b3a5bedba58a88d311309eec097f9" + json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" @@ -1767,10 +2055,6 @@ lazy-cache@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" -lcov-parse@^0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3" - level-blobs@^0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/level-blobs/-/level-blobs-0.1.7.tgz#9ab9b97bb99f1edbf9f78a3433e21ed56386bdaf" @@ -1847,7 +2131,7 @@ levelup@^0.18.2: semver "~2.3.1" xtend "~3.0.0" -levn@~0.3.0: +levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" dependencies: @@ -1864,7 +2148,7 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" -lodash-es@^4.17.4: +lodash-es@^4.14.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.4.tgz#dcc1d7552e150a0640073ba9cb31d70f032950e7" @@ -1955,14 +2239,10 @@ lodash@^3.8.0: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" -lodash@^4.17.4, lodash@^4.5.0: +lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" -log-driver@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.5.tgz#7ae4ec257302fd790d557cb10c97100d857b0056" - log-symbols@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.1.0.tgz#f35fa60e278832b538dc4dddcbb478a45d3e3be6" @@ -1980,6 +2260,12 @@ longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" +loose-envify@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + dependencies: + js-tokens "^3.0.0" + loud-rejection@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" @@ -2014,6 +2300,10 @@ magic-string@^0.22.4: dependencies: vlq "^0.2.1" +make-error@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.0.tgz#52ad3a339ccf10ce62b4040b708fe707244b8b96" + map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" @@ -2066,7 +2356,7 @@ mime-db@~1.30.0: version "1.30.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" -mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.15, mime-types@~2.1.17, mime-types@~2.1.7: +mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.15, mime-types@~2.1.7: version "2.1.17" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" dependencies: @@ -2076,6 +2366,10 @@ mime@^1.3.4: version "1.4.1" resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" +mimic-fn@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + minimalistic-assert@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3" @@ -2102,12 +2396,20 @@ minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" +mk-dirs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/mk-dirs/-/mk-dirs-1.0.0.tgz#44ee67f82341c6762718e88e85e577882e1f67fd" + mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: minimist "0.0.8" +mri@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.0.tgz#5c0a3f29c8ccffbbb1ec941dcec09d71fa32f36a" + ms@0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" @@ -2126,10 +2428,18 @@ multipipe@^0.1.2: dependencies: duplexer2 "0.0.2" +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + nan@^2.3.0: version "2.7.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46" +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + negotiator@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" @@ -2177,6 +2487,12 @@ normalize-path@^2.0.0, normalize-path@^2.0.1: dependencies: remove-trailing-separator "^1.0.1" +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" @@ -2194,7 +2510,7 @@ number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" -oauth-sign@~0.8.1, oauth-sign@~0.8.2: +oauth-sign@~0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" @@ -2257,6 +2573,12 @@ once@1.x, once@^1.3.0, once@^1.3.3: dependencies: wrappy "1" +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + dependencies: + mimic-fn "^1.0.0" + optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" @@ -2264,7 +2586,7 @@ optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -optionator@^0.8.1: +optionator@^0.8.1, optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" dependencies: @@ -2294,6 +2616,10 @@ osenv@^0.1.4: os-homedir "^1.0.0" os-tmpdir "^1.0.0" +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + parse-asn1@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.0.tgz#37c4f9b7ed3ab65c74817b5f2480937fbf97c712" @@ -2319,6 +2645,10 @@ parse-json@^2.2.0: dependencies: error-ex "^1.2.0" +parse-passwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" + parsejson@0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/parsejson/-/parsejson-0.0.3.tgz#ab7e3759f209ece99437973f7d0f1f64ae0e64ab" @@ -2351,6 +2681,14 @@ path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" +path-is-inside@^1.0.1, path-is-inside@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" @@ -2381,10 +2719,6 @@ performance-now@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -2399,6 +2733,10 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -2415,6 +2753,10 @@ process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + prr@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" @@ -2441,7 +2783,7 @@ qjobs@^1.1.4: version "1.1.5" resolved "https://registry.yarnpkg.com/qjobs/-/qjobs-1.1.5.tgz#659de9f2cf8dcc27a1481276f205377272382e73" -qs@6.5.1, qs@~6.5.1: +qs@6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" @@ -2636,37 +2978,21 @@ request@2.81.0: tunnel-agent "^0.6.0" uuid "^3.0.0" -request@^2.79.0: - version "2.83.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" +require-uncached@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.6.0" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.1" - forever-agent "~0.6.1" - form-data "~2.3.1" - har-validator "~5.0.3" - hawk "~6.0.2" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.17" - oauth-sign "~0.8.2" - performance-now "^2.1.0" - qs "~6.5.1" - safe-buffer "^5.1.1" - stringstream "~0.0.5" - tough-cookie "~2.3.3" - tunnel-agent "^0.6.0" - uuid "^3.1.0" + caller-path "^0.1.0" + resolve-from "^1.0.0" requires-port@1.x.x: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + resolve@1.1.7, resolve@1.1.x: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" @@ -2681,6 +3007,13 @@ resolve@^1.3.2, resolve@^1.4.0, resolve@~1.4.0: dependencies: path-parse "^1.0.5" +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + resumer@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" @@ -2693,7 +3026,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.5.1, rimraf@^2.6.0, rimraf@^2.6.1: +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.0, rimraf@^2.6.1: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: @@ -2772,17 +3105,27 @@ rollup-pluginutils@^2.0.1: estree-walker "^0.3.0" micromatch "^2.3.11" -rollup@^0.41.4: - version "0.41.6" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.41.6.tgz#e0d05497877a398c104d816d2733a718a7a94e2a" - dependencies: - source-map-support "^0.4.0" - rollup@^0.50.0: version "0.50.0" resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.50.0.tgz#4c158f4e780e6cb33ff0dbfc184a52cc58cd5f3b" -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + dependencies: + is-promise "^2.1.0" + +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + dependencies: + rx-lite "*" + +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" + +safe-buffer@^5.0.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -2830,22 +3173,22 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" -signal-exit@^3.0.0: +signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + dependencies: + is-fullwidth-code-point "^2.0.0" + sntp@1.x.x: version "1.0.9" resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" dependencies: hoek "2.x.x" -sntp@2.x.x: - version "2.0.2" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.0.2.tgz#5064110f0af85f7cfdb7d6b67a40028ce52b4b2b" - dependencies: - hoek "4.x.x" - socket.io-adapter@0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-0.5.0.tgz#cb6d4bb8bec81e1078b99677f9ced0046066bb8b" @@ -2891,12 +3234,12 @@ socket.io@1.7.3: socket.io-parser "2.3.1" source-map-support@^0.4.0: - version "0.4.15" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1" + version "0.4.18" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" dependencies: source-map "^0.5.6" -source-map@>=0.5.6, source-map@^0.5.6, source-map@~0.5.1: +source-map@>=0.5.6, source-map@~0.5.1: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" @@ -2906,7 +3249,7 @@ source-map@^0.4.4: dependencies: amdefine ">=0.0.4" -source-map@^0.5.3: +source-map@^0.5.3, source-map@^0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -2972,6 +3315,13 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +string-width@^2.1.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + string.prototype.trim@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" @@ -2990,7 +3340,7 @@ string_decoder@~1.0.0, string_decoder@~1.0.3: dependencies: safe-buffer "~5.1.0" -stringstream@~0.0.4, stringstream@~0.0.5: +stringstream@~0.0.4: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -3012,13 +3362,21 @@ strip-bom@^2.0.0: dependencies: is-utf8 "^0.2.0" +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + strip-indent@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" dependencies: get-stdin "^4.0.1" -strip-json-comments@~2.0.1: +strip-json-comments@^2.0.0, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -3038,6 +3396,17 @@ supports-color@^4.0.0: dependencies: has-flag "^2.0.0" +table@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" + dependencies: + ajv "^5.2.3" + ajv-keywords "^2.1.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" + tape@^4.8.0: version "4.8.0" resolved "https://registry.yarnpkg.com/tape/-/tape-4.8.0.tgz#f6a9fec41cc50a1de50fa33603ab580991f6068e" @@ -3077,6 +3446,29 @@ tar@^2.2.1: fstream "^1.0.2" inherits "2" +taskr-rename@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/taskr-rename/-/taskr-rename-0.0.1.tgz#6d332848aabf1e6378e2fa78abbabc9f7c411b6b" + +taskr-rollup@^0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/taskr-rollup/-/taskr-rollup-0.0.2.tgz#48a91f3d8e4e86020a3faa32a161b8013f740f70" + +taskr@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/taskr/-/taskr-1.1.0.tgz#4f29d0ace26f4deae9a478eabf9aa0432e884438" + dependencies: + bluebird "^3.5.0" + clor "^5.1.0" + glob "^7.1.2" + mk-dirs "^1.0.0" + mri "^1.1.0" + tinydate "^1.0.0" + +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + through2@2.0.1, through2@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.1.tgz#384e75314d49f32de12eebb8136b8eb6b5d59da9" @@ -3084,7 +3476,7 @@ through2@2.0.1, through2@^2.0.0: readable-stream "~2.0.0" xtend "~4.0.0" -through@~2.3.4, through@~2.3.8: +through@^2.3.6, through@~2.3.4, through@~2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -3092,13 +3484,17 @@ time-stamp@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" +tinydate@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/tinydate/-/tinydate-1.0.0.tgz#20f31756a13959ef8c57ec133ba29b5ade042cac" + tmp@0.0.31: version "0.0.31" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7" dependencies: os-tmpdir "~1.0.1" -tmp@0.0.x: +tmp@0.0.x, tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" dependencies: @@ -3108,7 +3504,11 @@ to-array@0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/to-array/-/to-array-0.1.4.tgz#17e6c11f73dd4f3d74cda7a4ff3238e9ad9bf890" -tough-cookie@~2.3.0, tough-cookie@~2.3.3: +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + +tough-cookie@~2.3.0: version "2.3.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" dependencies: @@ -3118,6 +3518,32 @@ trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" +tryit@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" + +ts-node@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-3.3.0.tgz#c13c6a3024e30be1180dd53038fc209289d4bf69" + dependencies: + arrify "^1.0.0" + chalk "^2.0.0" + diff "^3.1.0" + make-error "^1.1.1" + minimist "^1.2.0" + mkdirp "^0.5.1" + source-map-support "^0.4.0" + tsconfig "^6.0.0" + v8flags "^3.0.0" + yn "^2.0.0" + +tsconfig@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-6.0.0.tgz#6b0e8376003d7af1864f8df8f89dd0059ffcd032" + dependencies: + strip-bom "^3.0.0" + strip-json-comments "^2.0.0" + tslib@^1.7.0, tslib@^1.7.1: version "1.8.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.0.tgz#dc604ebad64bcbf696d613da6c954aa0e7ea1eb6" @@ -3175,11 +3601,11 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript@^2.4.0: +typescript@^2.5.3: version "2.5.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.3.tgz#df3dcdc38f3beb800d4bc322646b04a3f6ca7f0d" -uglify-js@^2.6, uglify-js@^2.7.0: +uglify-js@^2.6: version "2.8.27" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.27.tgz#47787f912b0f242e5b984343be8e35e95f694c9c" dependencies: @@ -3188,6 +3614,15 @@ uglify-js@^2.6, uglify-js@^2.7.0: optionalDependencies: uglify-to-browserify "~1.0.0" +uglify-js@^2.8.0: + version "2.8.29" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" + dependencies: + source-map "~0.5.1" + yargs "~3.10.0" + optionalDependencies: + uglify-to-browserify "~1.0.0" + uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" @@ -3219,10 +3654,16 @@ utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" -uuid@^3.0.0, uuid@^3.1.0: +uuid@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" +v8flags@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.1.tgz#dce8fc379c17d9f2c9e9ed78d89ce00052b1b76b" + dependencies: + homedir-polyfill "^1.0.1" + validate-npm-package-license@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" @@ -3292,6 +3733,12 @@ wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + dependencies: + mkdirp "^0.5.1" + ws@1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/ws/-/ws-1.1.2.tgz#8a244fa052401e08c9886cf44a85189e1fd4067f" @@ -3348,3 +3795,7 @@ yargs@~3.10.0: yeast@0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419" + +yn@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a"