diff --git a/.gitignore b/.gitignore index 3b3a7a1e8..d20dde2f8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ .nyc_output/ @rerun.txt coverage/ -dist/browser-example.js html-formatter.html lib/ messages.ndjson diff --git a/.travis.yml b/.travis.yml index f2beb994a..f6b0929f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ notifications: matrix: include: - node_js: "14" - script: "yarn test-coverage && yarn test-browser-example && yarn audit" + script: "yarn test-coverage && yarn audit" after_success: "nyc report --reporter=text-lcov | coveralls" - node_js: "12" script: "yarn test" diff --git a/CHANGELOG.md b/CHANGELOG.md index 43c93dfa4..06de609ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO ### Removed +* Support for running Cucumber in web browsers has been removed ([#1508](https://github.com/cucumber/cucumber-js/pull/1508)). This feature was increasingly difficult to support and seldom used. Node.js will now be the only support runtime for Cucumber itself; of course as before you can still use tools like WebDriver and Puppeteer to instrument testing of browser-based software. See [the discussion in #1437](https://github.com/cucumber/cucumber-js/issues/1437) for more about why this change is happening. + ### Fixed * Wrong version in meta message [#1439](https://github.com/cucumber/cucumber-js/issues/1439) [#1442](https://github.com/cucumber/cucumber-js/pull/1442) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 42c316e43..23639d003 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,14 +22,6 @@ See the `package.json` scripts section for how to run the tests. * feature tests * cucumber-js tests itself -## Test browser example locally - -* Run `yarn build-browser-example` -* Run `node scripts/server.js` -* Visit `localhost:9797`. - -The published browser example is only updated when releasing a new version. - ## Internals ### Project Structure diff --git a/README.md b/README.md index b9506093e..d2f7f91cd 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ written in plain language, they can be read by anyone on your team. Because they read by anyone, you can use them to help improve communication, collaboration and trust on your team. -Cucumber.js is the JavaScript implementation of Cucumber and runs on the [maintained Node.js versions](https://github.com/nodejs/Release) and *modern* web browsers. +Cucumber.js is the JavaScript implementation of Cucumber and runs on the [maintained Node.js versions](https://github.com/nodejs/Release). ## Try it now diff --git a/dependency-lint.yml b/dependency-lint.yml index c35742677..636d2f56c 100644 --- a/dependency-lint.yml +++ b/dependency-lint.yml @@ -36,7 +36,6 @@ ignoreErrors: - eslint-plugin-standard # peer dependency of eslint-config-standard-with-typescript - prettier # peer dependency of eslint-plugin-prettier - ts-node # .mocharc.yml / cucumber.js - - tsify # package.json - scripts - build-browser-example, build-release requiredModules: files: diff --git a/dist/cucumber.js b/dist/cucumber.js deleted file mode 100644 index 5eeaa5d7f..000000000 --- a/dist/cucumber.js +++ /dev/null @@ -1,80053 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cucumber = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i Array#indexOf -// true -> Array#includes -var toIObject = require('./_to-iobject'); -var toLength = require('./_to-length'); -var toAbsoluteIndex = require('./_to-absolute-index'); -module.exports = function (IS_INCLUDES) { - return function ($this, el, fromIndex) { - var O = toIObject($this); - var length = toLength(O.length); - var index = toAbsoluteIndex(fromIndex, length); - var value; - // Array#includes uses SameValueZero equality algorithm - // eslint-disable-next-line no-self-compare - if (IS_INCLUDES && el != el) while (length > index) { - value = O[index++]; - // eslint-disable-next-line no-self-compare - if (value != value) return true; - // Array#indexOf ignores holes, Array#includes - not - } else for (;length > index; index++) if (IS_INCLUDES || index in O) { - if (O[index] === el) return IS_INCLUDES || index || 0; - } return !IS_INCLUDES && -1; - }; -}; - -},{"./_to-absolute-index":58,"./_to-iobject":60,"./_to-length":61}],20:[function(require,module,exports){ -// getting tag from 19.1.3.6 Object.prototype.toString() -var cof = require('./_cof'); -var TAG = require('./_wks')('toStringTag'); -// ES3 wrong here -var ARG = cof(function () { return arguments; }()) == 'Arguments'; - -// fallback for IE11 Script Access Denied error -var tryGet = function (it, key) { - try { - return it[key]; - } catch (e) { /* empty */ } -}; - -module.exports = function (it) { - var O, T, B; - return it === undefined ? 'Undefined' : it === null ? 'Null' - // @@toStringTag case - : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T - // builtinTag case - : ARG ? cof(O) - // ES3 arguments fallback - : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; -}; - -},{"./_cof":21,"./_wks":65}],21:[function(require,module,exports){ -var toString = {}.toString; - -module.exports = function (it) { - return toString.call(it).slice(8, -1); -}; - -},{}],22:[function(require,module,exports){ -var core = module.exports = { version: '2.6.9' }; -if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef - -},{}],23:[function(require,module,exports){ -// optional / simple context binding -var aFunction = require('./_a-function'); -module.exports = function (fn, that, length) { - aFunction(fn); - if (that === undefined) return fn; - switch (length) { - case 1: return function (a) { - return fn.call(that, a); - }; - case 2: return function (a, b) { - return fn.call(that, a, b); - }; - case 3: return function (a, b, c) { - return fn.call(that, a, b, c); - }; - } - return function (/* ...args */) { - return fn.apply(that, arguments); - }; -}; - -},{"./_a-function":16}],24:[function(require,module,exports){ -// 7.2.1 RequireObjectCoercible(argument) -module.exports = function (it) { - if (it == undefined) throw TypeError("Can't call method on " + it); - return it; -}; - -},{}],25:[function(require,module,exports){ -// Thank's IE8 for his funny defineProperty -module.exports = !require('./_fails')(function () { - return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; -}); - -},{"./_fails":29}],26:[function(require,module,exports){ -var isObject = require('./_is-object'); -var document = require('./_global').document; -// typeof document.createElement is 'object' in old IE -var is = isObject(document) && isObject(document.createElement); -module.exports = function (it) { - return is ? document.createElement(it) : {}; -}; - -},{"./_global":30,"./_is-object":37}],27:[function(require,module,exports){ -// IE 8- don't enum bug keys -module.exports = ( - 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' -).split(','); - -},{}],28:[function(require,module,exports){ -var global = require('./_global'); -var core = require('./_core'); -var ctx = require('./_ctx'); -var hide = require('./_hide'); -var has = require('./_has'); -var PROTOTYPE = 'prototype'; - -var $export = function (type, name, source) { - var IS_FORCED = type & $export.F; - var IS_GLOBAL = type & $export.G; - var IS_STATIC = type & $export.S; - var IS_PROTO = type & $export.P; - var IS_BIND = type & $export.B; - var IS_WRAP = type & $export.W; - var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); - var expProto = exports[PROTOTYPE]; - var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; - var key, own, out; - if (IS_GLOBAL) source = name; - for (key in source) { - // contains in native - own = !IS_FORCED && target && target[key] !== undefined; - if (own && has(exports, key)) continue; - // export native or passed - out = own ? target[key] : source[key]; - // prevent global pollution for namespaces - exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] - // bind timers to global for call from export context - : IS_BIND && own ? ctx(out, global) - // wrap global constructors for prevent change them in library - : IS_WRAP && target[key] == out ? (function (C) { - var F = function (a, b, c) { - if (this instanceof C) { - switch (arguments.length) { - case 0: return new C(); - case 1: return new C(a); - case 2: return new C(a, b); - } return new C(a, b, c); - } return C.apply(this, arguments); - }; - F[PROTOTYPE] = C[PROTOTYPE]; - return F; - // make static versions for prototype methods - })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% - if (IS_PROTO) { - (exports.virtual || (exports.virtual = {}))[key] = out; - // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% - if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); - } - } -}; -// type bitmap -$export.F = 1; // forced -$export.G = 2; // global -$export.S = 4; // static -$export.P = 8; // proto -$export.B = 16; // bind -$export.W = 32; // wrap -$export.U = 64; // safe -$export.R = 128; // real proto method for `library` -module.exports = $export; - -},{"./_core":22,"./_ctx":23,"./_global":30,"./_has":31,"./_hide":32}],29:[function(require,module,exports){ -module.exports = function (exec) { - try { - return !!exec(); - } catch (e) { - return true; - } -}; - -},{}],30:[function(require,module,exports){ -// 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 - -},{}],31:[function(require,module,exports){ -var hasOwnProperty = {}.hasOwnProperty; -module.exports = function (it, key) { - return hasOwnProperty.call(it, key); -}; - -},{}],32:[function(require,module,exports){ -var dP = require('./_object-dp'); -var createDesc = require('./_property-desc'); -module.exports = require('./_descriptors') ? function (object, key, value) { - return dP.f(object, key, createDesc(1, value)); -} : function (object, key, value) { - object[key] = value; - return object; -}; - -},{"./_descriptors":25,"./_object-dp":44,"./_property-desc":50}],33:[function(require,module,exports){ -var document = require('./_global').document; -module.exports = document && document.documentElement; - -},{"./_global":30}],34:[function(require,module,exports){ -module.exports = !require('./_descriptors') && !require('./_fails')(function () { - return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7; -}); - -},{"./_descriptors":25,"./_dom-create":26,"./_fails":29}],35:[function(require,module,exports){ -// fallback for non-array-like ES3 and non-enumerable old V8 strings -var cof = require('./_cof'); -// eslint-disable-next-line no-prototype-builtins -module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { - return cof(it) == 'String' ? it.split('') : Object(it); -}; - -},{"./_cof":21}],36:[function(require,module,exports){ -// 7.2.2 IsArray(argument) -var cof = require('./_cof'); -module.exports = Array.isArray || function isArray(arg) { - return cof(arg) == 'Array'; -}; - -},{"./_cof":21}],37:[function(require,module,exports){ -module.exports = function (it) { - return typeof it === 'object' ? it !== null : typeof it === 'function'; -}; - -},{}],38:[function(require,module,exports){ -'use strict'; -var create = require('./_object-create'); -var descriptor = require('./_property-desc'); -var setToStringTag = require('./_set-to-string-tag'); -var IteratorPrototype = {}; - -// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() -require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; }); - -module.exports = function (Constructor, NAME, next) { - Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); - setToStringTag(Constructor, NAME + ' Iterator'); -}; - -},{"./_hide":32,"./_object-create":43,"./_property-desc":50,"./_set-to-string-tag":52,"./_wks":65}],39:[function(require,module,exports){ -'use strict'; -var LIBRARY = require('./_library'); -var $export = require('./_export'); -var redefine = require('./_redefine'); -var hide = require('./_hide'); -var Iterators = require('./_iterators'); -var $iterCreate = require('./_iter-create'); -var setToStringTag = require('./_set-to-string-tag'); -var getPrototypeOf = require('./_object-gpo'); -var ITERATOR = require('./_wks')('iterator'); -var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` -var FF_ITERATOR = '@@iterator'; -var KEYS = 'keys'; -var VALUES = 'values'; - -var returnThis = function () { return this; }; - -module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { - $iterCreate(Constructor, NAME, next); - var getMethod = function (kind) { - if (!BUGGY && kind in proto) return proto[kind]; - switch (kind) { - case KEYS: return function keys() { return new Constructor(this, kind); }; - case VALUES: return function values() { return new Constructor(this, kind); }; - } return function entries() { return new Constructor(this, kind); }; - }; - var TAG = NAME + ' Iterator'; - var DEF_VALUES = DEFAULT == VALUES; - var VALUES_BUG = false; - var proto = Base.prototype; - var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; - var $default = $native || getMethod(DEFAULT); - var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; - var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; - var methods, key, IteratorPrototype; - // Fix native - if ($anyNative) { - IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); - if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { - // Set @@toStringTag to native iterators - setToStringTag(IteratorPrototype, TAG, true); - // fix for some old engines - if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); - } - } - // fix Array#{values, @@iterator}.name in V8 / FF - if (DEF_VALUES && $native && $native.name !== VALUES) { - VALUES_BUG = true; - $default = function values() { return $native.call(this); }; - } - // Define iterator - if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { - hide(proto, ITERATOR, $default); - } - // Plug for library - Iterators[NAME] = $default; - Iterators[TAG] = returnThis; - if (DEFAULT) { - methods = { - values: DEF_VALUES ? $default : getMethod(VALUES), - keys: IS_SET ? $default : getMethod(KEYS), - entries: $entries - }; - if (FORCED) for (key in methods) { - if (!(key in proto)) redefine(proto, key, methods[key]); - } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); - } - return methods; -}; - -},{"./_export":28,"./_hide":32,"./_iter-create":38,"./_iterators":41,"./_library":42,"./_object-gpo":46,"./_redefine":51,"./_set-to-string-tag":52,"./_wks":65}],40:[function(require,module,exports){ -module.exports = function (done, value) { - return { value: value, done: !!done }; -}; - -},{}],41:[function(require,module,exports){ -module.exports = {}; - -},{}],42:[function(require,module,exports){ -module.exports = true; - -},{}],43:[function(require,module,exports){ -// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) -var anObject = require('./_an-object'); -var dPs = require('./_object-dps'); -var enumBugKeys = require('./_enum-bug-keys'); -var IE_PROTO = require('./_shared-key')('IE_PROTO'); -var Empty = function () { /* empty */ }; -var PROTOTYPE = 'prototype'; - -// Create object with fake `null` prototype: use iframe Object with cleared prototype -var createDict = function () { - // Thrash, waste and sodomy: IE GC bug - var iframe = require('./_dom-create')('iframe'); - var i = enumBugKeys.length; - var lt = '<'; - var gt = '>'; - var iframeDocument; - iframe.style.display = 'none'; - require('./_html').appendChild(iframe); - iframe.src = 'javascript:'; // eslint-disable-line no-script-url - // createDict = iframe.contentWindow.Object; - // html.removeChild(iframe); - iframeDocument = iframe.contentWindow.document; - iframeDocument.open(); - iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); - iframeDocument.close(); - createDict = iframeDocument.F; - while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; - return createDict(); -}; - -module.exports = Object.create || function create(O, Properties) { - var result; - if (O !== null) { - Empty[PROTOTYPE] = anObject(O); - result = new Empty(); - Empty[PROTOTYPE] = null; - // add "__proto__" for Object.getPrototypeOf polyfill - result[IE_PROTO] = O; - } else result = createDict(); - return Properties === undefined ? result : dPs(result, Properties); -}; - -},{"./_an-object":18,"./_dom-create":26,"./_enum-bug-keys":27,"./_html":33,"./_object-dps":45,"./_shared-key":53}],44:[function(require,module,exports){ -var anObject = require('./_an-object'); -var IE8_DOM_DEFINE = require('./_ie8-dom-define'); -var toPrimitive = require('./_to-primitive'); -var dP = Object.defineProperty; - -exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) { - anObject(O); - P = toPrimitive(P, true); - anObject(Attributes); - if (IE8_DOM_DEFINE) 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; -}; - -},{"./_an-object":18,"./_descriptors":25,"./_ie8-dom-define":34,"./_to-primitive":63}],45:[function(require,module,exports){ -var dP = require('./_object-dp'); -var anObject = require('./_an-object'); -var getKeys = require('./_object-keys'); - -module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) { - anObject(O); - var keys = getKeys(Properties); - var length = keys.length; - var i = 0; - var P; - while (length > i) dP.f(O, P = keys[i++], Properties[P]); - return O; -}; - -},{"./_an-object":18,"./_descriptors":25,"./_object-dp":44,"./_object-keys":48}],46:[function(require,module,exports){ -// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) -var has = require('./_has'); -var toObject = require('./_to-object'); -var IE_PROTO = require('./_shared-key')('IE_PROTO'); -var ObjectProto = Object.prototype; - -module.exports = Object.getPrototypeOf || function (O) { - O = toObject(O); - if (has(O, IE_PROTO)) return O[IE_PROTO]; - if (typeof O.constructor == 'function' && O instanceof O.constructor) { - return O.constructor.prototype; - } return O instanceof Object ? ObjectProto : null; -}; - -},{"./_has":31,"./_shared-key":53,"./_to-object":62}],47:[function(require,module,exports){ -var has = require('./_has'); -var toIObject = require('./_to-iobject'); -var arrayIndexOf = require('./_array-includes')(false); -var IE_PROTO = require('./_shared-key')('IE_PROTO'); - -module.exports = function (object, names) { - var O = toIObject(object); - var i = 0; - var result = []; - var key; - for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); - // Don't enum bug & hidden keys - while (names.length > i) if (has(O, key = names[i++])) { - ~arrayIndexOf(result, key) || result.push(key); - } - return result; -}; - -},{"./_array-includes":19,"./_has":31,"./_shared-key":53,"./_to-iobject":60}],48:[function(require,module,exports){ -// 19.1.2.14 / 15.2.3.14 Object.keys(O) -var $keys = require('./_object-keys-internal'); -var enumBugKeys = require('./_enum-bug-keys'); - -module.exports = Object.keys || function keys(O) { - return $keys(O, enumBugKeys); -}; - -},{"./_enum-bug-keys":27,"./_object-keys-internal":47}],49:[function(require,module,exports){ -var $parseInt = require('./_global').parseInt; -var $trim = require('./_string-trim').trim; -var ws = require('./_string-ws'); -var hex = /^[-+]?0[xX]/; - -module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix) { - var string = $trim(String(str), 3); - return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10)); -} : $parseInt; - -},{"./_global":30,"./_string-trim":56,"./_string-ws":57}],50:[function(require,module,exports){ -module.exports = function (bitmap, value) { - return { - enumerable: !(bitmap & 1), - configurable: !(bitmap & 2), - writable: !(bitmap & 4), - value: value - }; -}; - -},{}],51:[function(require,module,exports){ -module.exports = require('./_hide'); - -},{"./_hide":32}],52:[function(require,module,exports){ -var def = require('./_object-dp').f; -var has = require('./_has'); -var TAG = require('./_wks')('toStringTag'); - -module.exports = function (it, tag, stat) { - if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); -}; - -},{"./_has":31,"./_object-dp":44,"./_wks":65}],53:[function(require,module,exports){ -var shared = require('./_shared')('keys'); -var uid = require('./_uid'); -module.exports = function (key) { - return shared[key] || (shared[key] = uid(key)); -}; - -},{"./_shared":54,"./_uid":64}],54:[function(require,module,exports){ -var core = require('./_core'); -var global = require('./_global'); -var SHARED = '__core-js_shared__'; -var store = global[SHARED] || (global[SHARED] = {}); - -(module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); -})('versions', []).push({ - version: core.version, - mode: require('./_library') ? 'pure' : 'global', - copyright: '© 2019 Denis Pushkarev (zloirock.ru)' -}); - -},{"./_core":22,"./_global":30,"./_library":42}],55:[function(require,module,exports){ -var toInteger = require('./_to-integer'); -var defined = require('./_defined'); -// true -> String#at -// false -> String#codePointAt -module.exports = function (TO_STRING) { - return function (that, pos) { - var s = String(defined(that)); - var i = toInteger(pos); - var l = s.length; - var a, b; - if (i < 0 || i >= l) return TO_STRING ? '' : undefined; - a = s.charCodeAt(i); - return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff - ? TO_STRING ? s.charAt(i) : a - : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; - }; -}; - -},{"./_defined":24,"./_to-integer":59}],56:[function(require,module,exports){ -var $export = require('./_export'); -var defined = require('./_defined'); -var fails = require('./_fails'); -var spaces = require('./_string-ws'); -var space = '[' + spaces + ']'; -var non = '\u200b\u0085'; -var ltrim = RegExp('^' + space + space + '*'); -var rtrim = RegExp(space + space + '*$'); - -var exporter = function (KEY, exec, ALIAS) { - var exp = {}; - var FORCE = fails(function () { - return !!spaces[KEY]() || non[KEY]() != non; - }); - var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; - if (ALIAS) exp[ALIAS] = fn; - $export($export.P + $export.F * FORCE, 'String', exp); -}; - -// 1 -> String#trimLeft -// 2 -> String#trimRight -// 3 -> String#trim -var trim = exporter.trim = function (string, TYPE) { - string = String(defined(string)); - if (TYPE & 1) string = string.replace(ltrim, ''); - if (TYPE & 2) string = string.replace(rtrim, ''); - return string; -}; - -module.exports = exporter; - -},{"./_defined":24,"./_export":28,"./_fails":29,"./_string-ws":57}],57:[function(require,module,exports){ -module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + - '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; - -},{}],58:[function(require,module,exports){ -var toInteger = require('./_to-integer'); -var max = Math.max; -var min = Math.min; -module.exports = function (index, length) { - index = toInteger(index); - return index < 0 ? max(index + length, 0) : min(index, length); -}; - -},{"./_to-integer":59}],59:[function(require,module,exports){ -// 7.1.4 ToInteger -var ceil = Math.ceil; -var floor = Math.floor; -module.exports = function (it) { - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); -}; - -},{}],60:[function(require,module,exports){ -// to indexed object, toObject with fallback for non-array-like ES3 strings -var IObject = require('./_iobject'); -var defined = require('./_defined'); -module.exports = function (it) { - return IObject(defined(it)); -}; - -},{"./_defined":24,"./_iobject":35}],61:[function(require,module,exports){ -// 7.1.15 ToLength -var toInteger = require('./_to-integer'); -var min = Math.min; -module.exports = function (it) { - return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 -}; - -},{"./_to-integer":59}],62:[function(require,module,exports){ -// 7.1.13 ToObject(argument) -var defined = require('./_defined'); -module.exports = function (it) { - return Object(defined(it)); -}; - -},{"./_defined":24}],63:[function(require,module,exports){ -// 7.1.1 ToPrimitive(input [, PreferredType]) -var isObject = require('./_is-object'); -// instead of the ES6 spec version, we didn't implement @@toPrimitive case -// and the second argument - flag - preferred type is a string -module.exports = 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"); -}; - -},{"./_is-object":37}],64:[function(require,module,exports){ -var id = 0; -var px = Math.random(); -module.exports = function (key) { - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); -}; - -},{}],65:[function(require,module,exports){ -var store = require('./_shared')('wks'); -var uid = require('./_uid'); -var Symbol = require('./_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; - -},{"./_global":30,"./_shared":54,"./_uid":64}],66:[function(require,module,exports){ -var classof = require('./_classof'); -var ITERATOR = require('./_wks')('iterator'); -var Iterators = require('./_iterators'); -module.exports = require('./_core').getIteratorMethod = function (it) { - if (it != undefined) return it[ITERATOR] - || it['@@iterator'] - || Iterators[classof(it)]; -}; - -},{"./_classof":20,"./_core":22,"./_iterators":41,"./_wks":65}],67:[function(require,module,exports){ -var anObject = require('./_an-object'); -var get = require('./core.get-iterator-method'); -module.exports = require('./_core').getIterator = function (it) { - var iterFn = get(it); - if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!'); - return anObject(iterFn.call(it)); -}; - -},{"./_an-object":18,"./_core":22,"./core.get-iterator-method":66}],68:[function(require,module,exports){ -var classof = require('./_classof'); -var ITERATOR = require('./_wks')('iterator'); -var Iterators = require('./_iterators'); -module.exports = require('./_core').isIterable = function (it) { - var O = Object(it); - return O[ITERATOR] !== undefined - || '@@iterator' in O - // eslint-disable-next-line no-prototype-builtins - || Iterators.hasOwnProperty(classof(O)); -}; - -},{"./_classof":20,"./_core":22,"./_iterators":41,"./_wks":65}],69:[function(require,module,exports){ -// 22.1.2.2 / 15.4.3.2 Array.isArray(arg) -var $export = require('./_export'); - -$export($export.S, 'Array', { isArray: require('./_is-array') }); - -},{"./_export":28,"./_is-array":36}],70:[function(require,module,exports){ -'use strict'; -var addToUnscopables = require('./_add-to-unscopables'); -var step = require('./_iter-step'); -var Iterators = require('./_iterators'); -var toIObject = require('./_to-iobject'); - -// 22.1.3.4 Array.prototype.entries() -// 22.1.3.13 Array.prototype.keys() -// 22.1.3.29 Array.prototype.values() -// 22.1.3.30 Array.prototype[@@iterator]() -module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) { - this._t = toIObject(iterated); // target - this._i = 0; // next index - this._k = kind; // kind -// 22.1.5.2.1 %ArrayIteratorPrototype%.next() -}, function () { - var O = this._t; - var kind = this._k; - var index = this._i++; - if (!O || index >= O.length) { - this._t = undefined; - return step(1); - } - if (kind == 'keys') return step(0, index); - if (kind == 'values') return step(0, O[index]); - return step(0, [index, O[index]]); -}, 'values'); - -// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) -Iterators.Arguments = Iterators.Array; - -addToUnscopables('keys'); -addToUnscopables('values'); -addToUnscopables('entries'); - -},{"./_add-to-unscopables":17,"./_iter-define":39,"./_iter-step":40,"./_iterators":41,"./_to-iobject":60}],71:[function(require,module,exports){ -var $export = require('./_export'); -// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) -$export($export.S, 'Object', { create: require('./_object-create') }); - -},{"./_export":28,"./_object-create":43}],72:[function(require,module,exports){ -var $export = require('./_export'); -var $parseInt = require('./_parse-int'); -// 18.2.5 parseInt(string, radix) -$export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt }); - -},{"./_export":28,"./_parse-int":49}],73:[function(require,module,exports){ -'use strict'; -var $at = require('./_string-at')(true); - -// 21.1.3.27 String.prototype[@@iterator]() -require('./_iter-define')(String, 'String', function (iterated) { - this._t = String(iterated); // target - this._i = 0; // next index -// 21.1.5.2.1 %StringIteratorPrototype%.next() -}, function () { - var O = this._t; - var index = this._i; - var point; - if (index >= O.length) return { value: undefined, done: true }; - point = $at(O, index); - this._i += point.length; - return { value: point, done: false }; -}); - -},{"./_iter-define":39,"./_string-at":55}],74:[function(require,module,exports){ -require('./es6.array.iterator'); -var global = require('./_global'); -var hide = require('./_hide'); -var Iterators = require('./_iterators'); -var TO_STRING_TAG = require('./_wks')('toStringTag'); - -var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' + - 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' + - 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' + - 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' + - 'TextTrackList,TouchList').split(','); - -for (var i = 0; i < DOMIterables.length; i++) { - var NAME = DOMIterables[i]; - var Collection = global[NAME]; - var proto = Collection && Collection.prototype; - if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); - Iterators[NAME] = Iterators.Array; -} - -},{"./_global":30,"./_hide":32,"./_iterators":41,"./_wks":65,"./es6.array.iterator":70}],75:[function(require,module,exports){ -module.exports = require('./register')().Promise - -},{"./register":77}],76:[function(require,module,exports){ -"use strict" - // global key for user preferred registration -var REGISTRATION_KEY = '@@any-promise/REGISTRATION', - // Prior registration (preferred or detected) - registered = null - -/** - * Registers the given implementation. An implementation must - * be registered prior to any call to `require("any-promise")`, - * typically on application load. - * - * If called with no arguments, will return registration in - * following priority: - * - * For Node.js: - * - * 1. Previous registration - * 2. global.Promise if node.js version >= 0.12 - * 3. Auto detected promise based on first sucessful require of - * known promise libraries. Note this is a last resort, as the - * loaded library is non-deterministic. node.js >= 0.12 will - * always use global.Promise over this priority list. - * 4. Throws error. - * - * For Browser: - * - * 1. Previous registration - * 2. window.Promise - * 3. Throws error. - * - * Options: - * - * Promise: Desired Promise constructor - * global: Boolean - Should the registration be cached in a global variable to - * allow cross dependency/bundle registration? (default true) - */ -module.exports = function(root, loadImplementation){ - return function register(implementation, opts){ - implementation = implementation || null - opts = opts || {} - // global registration unless explicitly {global: false} in options (default true) - var registerGlobal = opts.global !== false; - - // load any previous global registration - if(registered === null && registerGlobal){ - registered = root[REGISTRATION_KEY] || null - } - - if(registered !== null - && implementation !== null - && registered.implementation !== implementation){ - // Throw error if attempting to redefine implementation - throw new Error('any-promise already defined as "'+registered.implementation+ - '". You can only register an implementation before the first '+ - ' call to require("any-promise") and an implementation cannot be changed') - } - - if(registered === null){ - // use provided implementation - if(implementation !== null && typeof opts.Promise !== 'undefined'){ - registered = { - Promise: opts.Promise, - implementation: implementation - } - } else { - // require implementation if implementation is specified but not provided - registered = loadImplementation(implementation) - } - - if(registerGlobal){ - // register preference globally in case multiple installations - root[REGISTRATION_KEY] = registered - } - } - - return registered - } -} - -},{}],77:[function(require,module,exports){ -"use strict"; -module.exports = require('./loader')(window, loadImplementation) - -/** - * Browser specific loadImplementation. Always uses `window.Promise` - * - * To register a custom implementation, must register with `Promise` option. - */ -function loadImplementation(){ - if(typeof window.Promise === 'undefined'){ - throw new Error("any-promise browser requires a polyfill or explicit registration"+ - " e.g: require('any-promise/register/bluebird')") - } - return { - Promise: window.Promise, - implementation: 'window.Promise' - } -} - -},{"./loader":76}],78:[function(require,module,exports){ -(function (Buffer,process){ -// Copyright (c) 2012, Mark Cavage. All rights reserved. -// Copyright 2015 Joyent, Inc. - -var assert = require('assert'); -var Stream = require('stream').Stream; -var util = require('util'); - - -///--- Globals - -/* JSSTYLED */ -var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/; - - -///--- Internal - -function _capitalize(str) { - return (str.charAt(0).toUpperCase() + str.slice(1)); -} - -function _toss(name, expected, oper, arg, actual) { - throw new assert.AssertionError({ - message: util.format('%s (%s) is required', name, expected), - actual: (actual === undefined) ? typeof (arg) : actual(arg), - expected: expected, - operator: oper || '===', - stackStartFunction: _toss.caller - }); -} - -function _getClass(arg) { - return (Object.prototype.toString.call(arg).slice(8, -1)); -} - -function noop() { - // Why even bother with asserts? -} - - -///--- Exports - -var types = { - bool: { - check: function (arg) { return typeof (arg) === 'boolean'; } - }, - func: { - check: function (arg) { return typeof (arg) === 'function'; } - }, - string: { - check: function (arg) { return typeof (arg) === 'string'; } - }, - object: { - check: function (arg) { - return typeof (arg) === 'object' && arg !== null; - } - }, - number: { - check: function (arg) { - return typeof (arg) === 'number' && !isNaN(arg); - } - }, - finite: { - check: function (arg) { - return typeof (arg) === 'number' && !isNaN(arg) && isFinite(arg); - } - }, - buffer: { - check: function (arg) { return Buffer.isBuffer(arg); }, - operator: 'Buffer.isBuffer' - }, - array: { - check: function (arg) { return Array.isArray(arg); }, - operator: 'Array.isArray' - }, - stream: { - check: function (arg) { return arg instanceof Stream; }, - operator: 'instanceof', - actual: _getClass - }, - date: { - check: function (arg) { return arg instanceof Date; }, - operator: 'instanceof', - actual: _getClass - }, - regexp: { - check: function (arg) { return arg instanceof RegExp; }, - operator: 'instanceof', - actual: _getClass - }, - uuid: { - check: function (arg) { - return typeof (arg) === 'string' && UUID_REGEXP.test(arg); - }, - operator: 'isUUID' - } -}; - -function _setExports(ndebug) { - var keys = Object.keys(types); - var out; - - /* re-export standard assert */ - if (process.env.NODE_NDEBUG) { - out = noop; - } else { - out = function (arg, msg) { - if (!arg) { - _toss(msg, 'true', arg); - } - }; - } - - /* standard checks */ - keys.forEach(function (k) { - if (ndebug) { - out[k] = noop; - return; - } - var type = types[k]; - out[k] = function (arg, msg) { - if (!type.check(arg)) { - _toss(msg, k, type.operator, arg, type.actual); - } - }; - }); - - /* optional checks */ - keys.forEach(function (k) { - var name = 'optional' + _capitalize(k); - if (ndebug) { - out[name] = noop; - return; - } - var type = types[k]; - out[name] = function (arg, msg) { - if (arg === undefined || arg === null) { - return; - } - if (!type.check(arg)) { - _toss(msg, k, type.operator, arg, type.actual); - } - }; - }); - - /* arrayOf checks */ - keys.forEach(function (k) { - var name = 'arrayOf' + _capitalize(k); - if (ndebug) { - out[name] = noop; - return; - } - var type = types[k]; - var expected = '[' + k + ']'; - out[name] = function (arg, msg) { - if (!Array.isArray(arg)) { - _toss(msg, expected, type.operator, arg, type.actual); - } - var i; - for (i = 0; i < arg.length; i++) { - if (!type.check(arg[i])) { - _toss(msg, expected, type.operator, arg, type.actual); - } - } - }; - }); - - /* optionalArrayOf checks */ - keys.forEach(function (k) { - var name = 'optionalArrayOf' + _capitalize(k); - if (ndebug) { - out[name] = noop; - return; - } - var type = types[k]; - var expected = '[' + k + ']'; - out[name] = function (arg, msg) { - if (arg === undefined || arg === null) { - return; - } - if (!Array.isArray(arg)) { - _toss(msg, expected, type.operator, arg, type.actual); - } - var i; - for (i = 0; i < arg.length; i++) { - if (!type.check(arg[i])) { - _toss(msg, expected, type.operator, arg, type.actual); - } - } - }; - }); - - /* re-export built-in assertions */ - Object.keys(assert).forEach(function (k) { - if (k === 'AssertionError') { - out[k] = assert[k]; - return; - } - if (ndebug) { - out[k] = noop; - return; - } - out[k] = assert[k]; - }); - - /* export ourselves (for unit tests _only_) */ - out._setExports = _setExports; - - return out; -} - -module.exports = _setExports(process.env.NODE_NDEBUG); - -}).call(this,{"isBuffer":require("../is-buffer/index.js")},require('_process')) - -},{"../is-buffer/index.js":549,"_process":571,"assert":79,"stream":615,"util":634}],79:[function(require,module,exports){ -(function (global){ -'use strict'; - -var objectAssign = require('object-assign'); - -// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js -// original notice: - -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -function compare(a, b) { - if (a === b) { - return 0; - } - - var x = a.length; - var y = b.length; - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - - if (x < y) { - return -1; - } - if (y < x) { - return 1; - } - return 0; -} -function isBuffer(b) { - if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { - return global.Buffer.isBuffer(b); - } - return !!(b != null && b._isBuffer); -} - -// based on node assert, original notice: -// NB: The URL to the CommonJS spec is kept just for tradition. -// node-assert has evolved a lot since then, both in API and behavior. - -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -var util = require('util/'); -var hasOwn = Object.prototype.hasOwnProperty; -var pSlice = Array.prototype.slice; -var functionsHaveNames = (function () { - return function foo() {}.name === 'foo'; -}()); -function pToString (obj) { - return Object.prototype.toString.call(obj); -} -function isView(arrbuf) { - if (isBuffer(arrbuf)) { - return false; - } - if (typeof global.ArrayBuffer !== 'function') { - return false; - } - if (typeof ArrayBuffer.isView === 'function') { - return ArrayBuffer.isView(arrbuf); - } - if (!arrbuf) { - return false; - } - if (arrbuf instanceof DataView) { - return true; - } - if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { - return true; - } - return false; -} -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -var regex = /\s*function\s+([^\(\s]*)\s*/; -// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js -function getName(func) { - if (!util.isFunction(func)) { - return; - } - if (functionsHaveNames) { - return func.name; - } - var str = func.toString(); - var match = str.match(regex); - return match && match[1]; -} -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = getName(stackStartFunction); - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function truncate(s, n) { - if (typeof s === 'string') { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} -function inspect(something) { - if (functionsHaveNames || !util.isFunction(something)) { - return util.inspect(something); - } - var rawname = getName(something); - var name = rawname ? ': ' + rawname : ''; - return '[Function' + name + ']'; -} -function getMessage(self) { - return truncate(inspect(self.actual), 128) + ' ' + - self.operator + ' ' + - truncate(inspect(self.expected), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); - } -}; - -function _deepEqual(actual, expected, strict, memos) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - } else if (isBuffer(actual) && isBuffer(expected)) { - return compare(actual, expected) === 0; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if ((actual === null || typeof actual !== 'object') && - (expected === null || typeof expected !== 'object')) { - return strict ? actual === expected : actual == expected; - - // If both values are instances of typed arrays, wrap their underlying - // ArrayBuffers in a Buffer each to increase performance - // This optimization requires the arrays to have the same type as checked by - // Object.prototype.toString (aka pToString). Never perform binary - // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their - // bit patterns are not identical. - } else if (isView(actual) && isView(expected) && - pToString(actual) === pToString(expected) && - !(actual instanceof Float32Array || - actual instanceof Float64Array)) { - return compare(new Uint8Array(actual.buffer), - new Uint8Array(expected.buffer)) === 0; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else if (isBuffer(actual) !== isBuffer(expected)) { - return false; - } else { - memos = memos || {actual: [], expected: []}; - - var actualIndex = memos.actual.indexOf(actual); - if (actualIndex !== -1) { - if (actualIndex === memos.expected.indexOf(expected)) { - return true; - } - } - - memos.actual.push(actual); - memos.expected.push(expected); - - return objEquiv(actual, expected, strict, memos); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b, strict, actualVisitedObjects) { - if (a === null || a === undefined || b === null || b === undefined) - return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) - return a === b; - if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) - return false; - var aIsArgs = isArguments(a); - var bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b, strict); - } - var ka = objectKeys(a); - var kb = objectKeys(b); - var key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length !== kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] !== kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) - return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -assert.notDeepStrictEqual = notDeepStrictEqual; -function notDeepStrictEqual(actual, expected, message) { - if (_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); - } -} - - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } - - try { - if (actual instanceof expected) { - return true; - } - } catch (e) { - // Ignore. The instanceof check doesn't work for arrow functions. - } - - if (Error.isPrototypeOf(expected)) { - return false; - } - - return expected.call({}, actual) === true; -} - -function _tryBlock(block) { - var error; - try { - block(); - } catch (e) { - error = e; - } - return error; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (typeof block !== 'function') { - throw new TypeError('"block" argument must be a function'); - } - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - actual = _tryBlock(block); - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - var userProvidedMessage = typeof message === 'string'; - var isUnwantedException = !shouldThrow && util.isError(actual); - var isUnexpectedException = !shouldThrow && actual && !expected; - - if ((isUnwantedException && - userProvidedMessage && - expectedException(actual, expected)) || - isUnexpectedException) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws(true, block, error, message); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws(false, block, error, message); -}; - -assert.ifError = function(err) { if (err) throw err; }; - -// Expose a strict only variant of assert -function strict(value, message) { - if (!value) fail(value, true, message, '==', strict); -} -assert.strict = objectAssign(strict, assert, { - equal: assert.strictEqual, - deepEqual: assert.deepStrictEqual, - notEqual: assert.notStrictEqual, - notDeepEqual: assert.notDeepStrictEqual -}); -assert.strict.strict = assert.strict; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"object-assign":563,"util/":82}],80:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - -},{}],81:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],82:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = require('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"./support/isBuffer":81,"_process":571,"inherits":80}],83:[function(require,module,exports){ -"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = canonicalize;var _has_property = _interopRequireDefault(require("./has_property")); -var _type = _interopRequireDefault(require("./type"));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} - -function canonicalize(value, stack) { - stack = stack || []; - - function withStack(fn) { - stack.push(value); - const result = fn(); - stack.pop(); - return result; - } - - if (stack.indexOf(value) !== -1) { - return '[Circular]'; - } - - switch ((0, _type.default)(value)) { - case 'array': - return withStack(function () { - return value.map(function (item) { - return canonicalize(item, stack); - }); - }); - case 'function': - if (!(0, _has_property.default)(value)) { - return '[Function]'; - } - /* falls through */ - case 'object': - return withStack(function () { - const canonicalizedObj = {}; - Object.keys(value). - sort(). - map(function (key) { - canonicalizedObj[key] = canonicalize(value[key], stack); - }); - return canonicalizedObj; - }); - case 'boolean': - case 'buffer': - case 'date': - case 'null': - case 'number': - case 'regexp': - case 'symbol': - case 'undefined': - return value; - default: - return value.toString();} - -} -},{"./has_property":84,"./type":88}],84:[function(require,module,exports){ -"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = hasProperty;function hasProperty(obj) { - for (const prop in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop)) { - return true; - } - } - return false; -} -},{}],85:[function(require,module,exports){ -"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = inlineDiff;var _diff = require("diff"); -var _padRight = _interopRequireDefault(require("pad-right"));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} - -function inlineDiff(actual, expected, colorFns) { - let msg = errorDiff(actual, expected, colorFns); - - // linenos - const lines = msg.split('\n'); - if (lines.length > 4) { - const width = String(lines.length).length; - msg = lines. - map(function (str, i) { - return (0, _padRight.default)(i + 1, width, ' ') + '|' + ' ' + str; - }). - join('\n'); - } - - // legend - msg = - '\n ' + - colorFns.diffRemoved('actual') + - ' ' + - colorFns.diffAdded('expected') + - '\n\n' + - msg.replace(/^/gm, ' ') + - '\n'; - - return msg; -} - -function errorDiff(actual, expected, colorFns) { - return (0, _diff.diffWordsWithSpace)(actual, expected). - map(function (str) { - if (str.added) { - return colorFns.diffAdded(str.value); - } - if (str.removed) { - return colorFns.diffRemoved(str.value); - } - return str.value; - }). - join(''); -} -},{"diff":91,"pad-right":566}],86:[function(require,module,exports){ -"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = jsonStringify;var _repeatString = _interopRequireDefault(require("repeat-string")); -var _type = _interopRequireDefault(require("./type"));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} - -function jsonStringify(object, depth) { - depth = depth || 1; - - switch ((0, _type.default)(object)) { - case 'boolean': - case 'regexp': - case 'symbol': - return object.toString(); - case 'null': - case 'undefined': - return '[' + object + ']'; - case 'array': - case 'object': - return jsonStringifyProperties(object, depth); - case 'number': - if (object === 0 && 1 / object === -Infinity) { - return '-0'; - } else { - return object.toString(); - } - case 'date': - return jsonStringifyDate(object); - case 'buffer': - return jsonStringifyBuffer(object, depth); - default: - if (object === '[Function]' || object === '[Circular]') { - return object; - } else { - return JSON.stringify(object); // string - }} - -} - -function jsonStringifyBuffer(object, depth) { - const { data } = object.toJSON(); - return '[Buffer: ' + jsonStringify(data, depth) + ']'; -} - -function jsonStringifyDate(object) { - let str; - if (isNaN(object.getTime())) { - str = object.toString(); - } else { - str = object.toISOString(); - } - return '[Date: ' + str + ']'; -} - -function jsonStringifyProperties(object, depth) { - const space = 2 * depth; - const start = (0, _type.default)(object) === 'array' ? '[' : '{'; - const end = (0, _type.default)(object) === 'array' ? ']' : '}'; - const length = - typeof object.length === 'number' ? - object.length : - Object.keys(object).length; - let addedProperties = 0; - let str = start; - - for (const prop in object) { - if (Object.prototype.hasOwnProperty.call(object, prop)) { - addedProperties += 1; - str += - '\n' + - (0, _repeatString.default)(' ', space) + ( - (0, _type.default)(object) === 'array' ? '' : '"' + prop + '": ') + - jsonStringify(object[prop], depth + 1) + ( - addedProperties === length ? '' : ','); - } - } - - if (str.length !== 1) { - str += '\n' + (0, _repeatString.default)(' ', space - 2); - } - - return str + end; -} -},{"./type":88,"repeat-string":590}],87:[function(require,module,exports){ -"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = stringify;var _canonicalize = _interopRequireDefault(require("./canonicalize")); -var _json_stringify = _interopRequireDefault(require("./json_stringify"));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} - -function stringify(value) { - return (0, _json_stringify.default)((0, _canonicalize.default)(value)).replace(/,(\n|$)/g, '$1'); -} -},{"./canonicalize":83,"./json_stringify":86}],88:[function(require,module,exports){ -(function (Buffer){ -"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = type;function type(value) { - if (value === undefined) { - return 'undefined'; - } else if (value === null) { - return 'null'; - } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - return 'buffer'; - } - return Object.prototype.toString. - call(value). - replace(/^\[.+\s(.+?)\]$/, '$1'). - toLowerCase(); -} -}).call(this,require("buffer").Buffer) - -},{"buffer":99}],89:[function(require,module,exports){ -"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = unifiedDiff;var _diff = require("diff"); - -function unifiedDiff(actual, expected, colorFns) { - const indent = ' '; - function cleanUp(line) { - if (line.length === 0) { - return ''; - } - if (line[0] === '+') { - return indent + colorFns.diffAdded(line); - } - if (line[0] === '-') { - return indent + colorFns.diffRemoved(line); - } - if (line.match(/@@/)) { - return null; - } - if (line.match(/\\ No newline/)) { - return null; - } - return indent + line; - } - function notBlank(line) { - return typeof line !== 'undefined' && line !== null; - } - const msg = (0, _diff.createPatch)('string', actual, expected); - const lines = msg.split('\n').splice(4); - return ( - '\n' + - indent + - colorFns.diffAdded('+ expected') + - ' ' + - colorFns.diffRemoved('- actual') + - '\n\n' + - lines. - map(cleanUp). - filter(notBlank). - join('\n')); - -} -},{"diff":91}],90:[function(require,module,exports){ -"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.format = format;var _inline_diff = _interopRequireDefault(require("./helpers/inline_diff")); -var _stringify = _interopRequireDefault(require("./helpers/stringify")); -var _type = _interopRequireDefault(require("./helpers/type")); -var _unified_diff = _interopRequireDefault(require("./helpers/unified_diff"));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} - -function identity(x) { - return x; -} - -function format(err, options) { - if (!options) { - options = {}; - } - if (!options.colorFns) { - options.colorFns = {}; - } - ['diffAdded', 'diffRemoved', 'errorMessage', 'errorStack'].forEach(function ( - key) - { - if (!options.colorFns[key]) { - options.colorFns[key] = identity; - } - }); - - let message; - if (err.message && typeof err.message.toString === 'function') { - message = err.message + ''; - } else if (typeof err.inspect === 'function') { - message = err.inspect() + ''; - } else if (typeof err === 'string') { - message = err; - } else { - message = JSON.stringify(err); - } - - let stack = err.stack || message; - const startOfMessageIndex = stack.indexOf(message); - if (startOfMessageIndex === -1) { - stack = '\n' + stack; - } else { - const endOfMessageIndex = startOfMessageIndex + message.length; - message = stack.slice(0, endOfMessageIndex); - stack = stack.slice(endOfMessageIndex); // remove message from stack - } - - if (err.uncaught) { - message = 'Uncaught ' + message; - } - - let actual = err.actual; - let expected = err.expected; - - if ( - err.showDiff !== false && - (0, _type.default)(actual) === (0, _type.default)(expected) && - expected !== undefined) - { - if (!((0, _type.default)(actual) === 'string' && (0, _type.default)(expected) === 'string')) { - actual = (0, _stringify.default)(actual); - expected = (0, _stringify.default)(expected); - } - - const match = message.match(/^([^:]+): expected/); - message = options.colorFns.errorMessage(match ? match[1] : message); - - if (options.inlineDiff) { - message += (0, _inline_diff.default)(actual, expected, options.colorFns); - } else { - message += (0, _unified_diff.default)(actual, expected, options.colorFns); - } - } else { - message = options.colorFns.errorMessage(message); - } - - if (stack) { - stack = options.colorFns.errorStack(stack); - } - - return message + stack; -} -},{"./helpers/inline_diff":85,"./helpers/stringify":87,"./helpers/type":88,"./helpers/unified_diff":89}],91:[function(require,module,exports){ -/*! - - diff v4.0.1 - -Software License Agreement (BSD License) - -Copyright (c) 2009-2015, Kevin Decker - -All rights reserved. - -Redistribution and use of this software in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. - -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -* Neither the name of Kevin Decker nor the names of its - contributors may be used to endorse or promote products - derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -@license -*/ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.Diff = {})); -}(this, function (exports) { 'use strict'; - - function Diff() {} - Diff.prototype = { - diff: function diff(oldString, newString) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var callback = options.callback; - - if (typeof options === 'function') { - callback = options; - options = {}; - } - - this.options = options; - var self = this; - - function done(value) { - if (callback) { - setTimeout(function () { - callback(undefined, value); - }, 0); - return true; - } else { - return value; - } - } // Allow subclasses to massage the input prior to running - - - oldString = this.castInput(oldString); - newString = this.castInput(newString); - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); - var newLen = newString.length, - oldLen = oldString.length; - var editLength = 1; - var maxEditLength = newLen + oldLen; - var bestPath = [{ - newPos: -1, - components: [] - }]; // Seed editLength = 0, i.e. the content starts with the same values - - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - - if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { - // Identity per the equality and tokenizer - return done([{ - value: this.join(newString), - count: newString.length - }]); - } // Main worker method. checks all permutations of a given edit length for acceptance. - - - function execEditLength() { - for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { - var basePath = void 0; - - var addPath = bestPath[diagonalPath - 1], - removePath = bestPath[diagonalPath + 1], - _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - - if (addPath) { - // No one else is going to attempt to use this value, clear it - bestPath[diagonalPath - 1] = undefined; - } - - var canAdd = addPath && addPath.newPos + 1 < newLen, - canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; - - if (!canAdd && !canRemove) { - // If this path is a terminal then prune - bestPath[diagonalPath] = undefined; - continue; - } // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin - // and does not pass the bounds of the diff graph - - - if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { - basePath = clonePath(removePath); - self.pushComponent(basePath.components, undefined, true); - } else { - basePath = addPath; // No need to clone, we've pulled it from the list - - basePath.newPos++; - self.pushComponent(basePath.components, true, undefined); - } - - _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done - - if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { - return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); - } else { - // Otherwise track this path as a potential candidate and continue. - bestPath[diagonalPath] = basePath; - } - } - - editLength++; - } // Performs the length of edit iteration. Is a bit fugly as this has to support the - // sync and async mode which is never fun. Loops over execEditLength until a value - // is produced. - - - if (callback) { - (function exec() { - setTimeout(function () { - // This should not happen, but we want to be safe. - - /* istanbul ignore next */ - if (editLength > maxEditLength) { - return callback(); - } - - if (!execEditLength()) { - exec(); - } - }, 0); - })(); - } else { - while (editLength <= maxEditLength) { - var ret = execEditLength(); - - if (ret) { - return ret; - } - } - } - }, - pushComponent: function pushComponent(components, added, removed) { - var last = components[components.length - 1]; - - if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length - 1] = { - count: last.count + 1, - added: added, - removed: removed - }; - } else { - components.push({ - count: 1, - added: added, - removed: removed - }); - } - }, - extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, - oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath, - commonCount = 0; - - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { - newPos++; - oldPos++; - commonCount++; - } - - if (commonCount) { - basePath.components.push({ - count: commonCount - }); - } - - basePath.newPos = newPos; - return oldPos; - }, - equals: function equals(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); - } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); - } - }, - removeEmpty: function removeEmpty(array) { - var ret = []; - - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - - return ret; - }, - castInput: function castInput(value) { - return value; - }, - tokenize: function tokenize(value) { - return value.split(''); - }, - join: function join(chars) { - return chars.join(''); - } - }; - - function buildValues(diff, components, newString, oldString, useLongestToken) { - var componentPos = 0, - componentLen = components.length, - newPos = 0, - oldPos = 0; - - for (; componentPos < componentLen; componentPos++) { - var component = components[componentPos]; - - if (!component.removed) { - if (!component.added && useLongestToken) { - var value = newString.slice(newPos, newPos + component.count); - value = value.map(function (value, i) { - var oldValue = oldString[oldPos + i]; - return oldValue.length > value.length ? oldValue : value; - }); - component.value = diff.join(value); - } else { - component.value = diff.join(newString.slice(newPos, newPos + component.count)); - } - - newPos += component.count; // Common case - - if (!component.added) { - oldPos += component.count; - } - } else { - component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; // Reverse add and remove so removes are output first to match common convention - // The diffing algorithm is tied to add then remove output and this is the simplest - // route to get the desired output with minimal overhead. - - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } - } - } // Special case handle for when one terminal is ignored (i.e. whitespace). - // For this case we merge the terminal into the prior string and drop the change. - // This is only available for string mode. - - - var lastComponent = components[componentLen - 1]; - - if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { - components[componentLen - 2].value += lastComponent.value; - components.pop(); - } - - return components; - } - - function clonePath(path) { - return { - newPos: path.newPos, - components: path.components.slice(0) - }; - } - - var characterDiff = new Diff(); - function diffChars(oldStr, newStr, options) { - return characterDiff.diff(oldStr, newStr, options); - } - - function generateOptions(options, defaults) { - if (typeof options === 'function') { - defaults.callback = options; - } else if (options) { - for (var name in options) { - /* istanbul ignore else */ - if (options.hasOwnProperty(name)) { - defaults[name] = options[name]; - } - } - } - - return defaults; - } - - // - // Ranges and exceptions: - // Latin-1 Supplement, 0080–00FF - // - U+00D7 × Multiplication sign - // - U+00F7 ÷ Division sign - // Latin Extended-A, 0100–017F - // Latin Extended-B, 0180–024F - // IPA Extensions, 0250–02AF - // Spacing Modifier Letters, 02B0–02FF - // - U+02C7 ˇ ˇ Caron - // - U+02D8 ˘ ˘ Breve - // - U+02D9 ˙ ˙ Dot Above - // - U+02DA ˚ ˚ Ring Above - // - U+02DB ˛ ˛ Ogonek - // - U+02DC ˜ ˜ Small Tilde - // - U+02DD ˝ ˝ Double Acute Accent - // Latin Extended Additional, 1E00–1EFF - - var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; - var reWhitespace = /\S/; - var wordDiff = new Diff(); - - wordDiff.equals = function (left, right) { - if (this.options.ignoreCase) { - left = left.toLowerCase(); - right = right.toLowerCase(); - } - - return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); - }; - - wordDiff.tokenize = function (value) { - var tokens = value.split(/(\s+|[()[\]{}'"]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. - - for (var i = 0; i < tokens.length - 1; i++) { - // If we have an empty string in the next field and we have only word chars before and after, merge - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; - } - } - - return tokens; - }; - - function diffWords(oldStr, newStr, options) { - options = generateOptions(options, { - ignoreWhitespace: true - }); - return wordDiff.diff(oldStr, newStr, options); - } - function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff.diff(oldStr, newStr, options); - } - - var lineDiff = new Diff(); - - lineDiff.tokenize = function (value) { - var retLines = [], - linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line - - if (!linesAndNewlines[linesAndNewlines.length - 1]) { - linesAndNewlines.pop(); - } // Merge the content and line separators into single tokens - - - for (var i = 0; i < linesAndNewlines.length; i++) { - var line = linesAndNewlines[i]; - - if (i % 2 && !this.options.newlineIsToken) { - retLines[retLines.length - 1] += line; - } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - - retLines.push(line); - } - } - - return retLines; - }; - - function diffLines(oldStr, newStr, callback) { - return lineDiff.diff(oldStr, newStr, callback); - } - function diffTrimmedLines(oldStr, newStr, callback) { - var options = generateOptions(callback, { - ignoreWhitespace: true - }); - return lineDiff.diff(oldStr, newStr, options); - } - - var sentenceDiff = new Diff(); - - sentenceDiff.tokenize = function (value) { - return value.split(/(\S.+?[.!?])(?=\s+|$)/); - }; - - function diffSentences(oldStr, newStr, callback) { - return sentenceDiff.diff(oldStr, newStr, callback); - } - - var cssDiff = new Diff(); - - cssDiff.tokenize = function (value) { - return value.split(/([{}:;,]|\s+)/); - }; - - function diffCss(oldStr, newStr, callback) { - return cssDiff.diff(oldStr, newStr, callback); - } - - function _typeof(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); - } - - function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); - } - - function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } - } - - function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); - } - - function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); - } - - var objectPrototypeToString = Object.prototype.toString; - var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a - // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - - jsonDiff.useLongestToken = true; - jsonDiff.tokenize = lineDiff.tokenize; - - jsonDiff.castInput = function (value) { - var _this$options = this.options, - undefinedReplacement = _this$options.undefinedReplacement, - _this$options$stringi = _this$options.stringifyReplacer, - stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) { - return typeof v === 'undefined' ? undefinedReplacement : v; - } : _this$options$stringi; - return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); - }; - - jsonDiff.equals = function (left, right) { - return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); - }; - - function diffJson(oldObj, newObj, options) { - return jsonDiff.diff(oldObj, newObj, options); - } // This function handles the presence of circular references by bailing out when encountering an - // object that is already on the "stack" of items being processed. Accepts an optional replacer - - function canonicalize(obj, stack, replacementStack, replacer, key) { - stack = stack || []; - replacementStack = replacementStack || []; - - if (replacer) { - obj = replacer(key, obj); - } - - var i; - - for (i = 0; i < stack.length; i += 1) { - if (stack[i] === obj) { - return replacementStack[i]; - } - } - - var canonicalizedObj; - - if ('[object Array]' === objectPrototypeToString.call(obj)) { - stack.push(obj); - canonicalizedObj = new Array(obj.length); - replacementStack.push(canonicalizedObj); - - for (i = 0; i < obj.length; i += 1) { - canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); - } - - stack.pop(); - replacementStack.pop(); - return canonicalizedObj; - } - - if (obj && obj.toJSON) { - obj = obj.toJSON(); - } - - if (_typeof(obj) === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - replacementStack.push(canonicalizedObj); - - var sortedKeys = [], - _key; - - for (_key in obj) { - /* istanbul ignore else */ - if (obj.hasOwnProperty(_key)) { - sortedKeys.push(_key); - } - } - - sortedKeys.sort(); - - for (i = 0; i < sortedKeys.length; i += 1) { - _key = sortedKeys[i]; - canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); - } - - stack.pop(); - replacementStack.pop(); - } else { - canonicalizedObj = obj; - } - - return canonicalizedObj; - } - - var arrayDiff = new Diff(); - - arrayDiff.tokenize = function (value) { - return value.slice(); - }; - - arrayDiff.join = arrayDiff.removeEmpty = function (value) { - return value; - }; - - function diffArrays(oldArr, newArr, callback) { - return arrayDiff.diff(oldArr, newArr, callback); - } - - function parsePatch(uniDiff) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], - list = [], - i = 0; - - function parseIndex() { - var index = {}; - list.push(index); // Parse diff metadata - - while (i < diffstr.length) { - var line = diffstr[i]; // File header found, end parsing diff metadata - - if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { - break; - } // Diff index - - - var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); - - if (header) { - index.index = header[1]; - } - - i++; - } // Parse file headers if they are defined. Unified diff requires them, but - // there's no technical issues to have an isolated hunk without file header - - - parseFileHeader(index); - parseFileHeader(index); // Parse hunks - - index.hunks = []; - - while (i < diffstr.length) { - var _line = diffstr[i]; - - if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { - break; - } else if (/^@@/.test(_line)) { - index.hunks.push(parseHunk()); - } else if (_line && options.strict) { - // Ignore unexpected content unless in strict mode - throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); - } else { - i++; - } - } - } // Parses the --- and +++ headers, if none are found, no lines - // are consumed. - - - function parseFileHeader(index) { - var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]); - - if (fileHeader) { - var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; - var data = fileHeader[2].split('\t', 2); - var fileName = data[0].replace(/\\\\/g, '\\'); - - if (/^".*"$/.test(fileName)) { - fileName = fileName.substr(1, fileName.length - 2); - } - - index[keyPrefix + 'FileName'] = fileName; - index[keyPrefix + 'Header'] = (data[1] || '').trim(); - i++; - } - } // Parses a hunk - // This assumes that we are at the start of a hunk. - - - function parseHunk() { - var chunkHeaderIndex = i, - chunkHeaderLine = diffstr[i++], - chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); - var hunk = { - oldStart: +chunkHeader[1], - oldLines: +chunkHeader[2] || 1, - newStart: +chunkHeader[3], - newLines: +chunkHeader[4] || 1, - lines: [], - linedelimiters: [] - }; - var addCount = 0, - removeCount = 0; - - for (; i < diffstr.length; i++) { - // Lines starting with '---' could be mistaken for the "remove line" operation - // But they could be the header for the next file. Therefore prune such cases out. - if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { - break; - } - - var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; - - if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { - hunk.lines.push(diffstr[i]); - hunk.linedelimiters.push(delimiters[i] || '\n'); - - if (operation === '+') { - addCount++; - } else if (operation === '-') { - removeCount++; - } else if (operation === ' ') { - addCount++; - removeCount++; - } - } else { - break; - } - } // Handle the empty block count case - - - if (!addCount && hunk.newLines === 1) { - hunk.newLines = 0; - } - - if (!removeCount && hunk.oldLines === 1) { - hunk.oldLines = 0; - } // Perform optional sanity checking - - - if (options.strict) { - if (addCount !== hunk.newLines) { - throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - - if (removeCount !== hunk.oldLines) { - throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - } - - return hunk; - } - - while (i < diffstr.length) { - parseIndex(); - } - - return list; - } - - // Iterator that traverses in the range of [min, max], stepping - // by distance from a given start position. I.e. for [0, 4], with - // start of 2, this will iterate 2, 3, 1, 4, 0. - function distanceIterator (start, minLine, maxLine) { - var wantForward = true, - backwardExhausted = false, - forwardExhausted = false, - localOffset = 1; - return function iterator() { - if (wantForward && !forwardExhausted) { - if (backwardExhausted) { - localOffset++; - } else { - wantForward = false; - } // Check if trying to fit beyond text length, and if not, check it fits - // after offset location (or desired location on first iteration) - - - if (start + localOffset <= maxLine) { - return localOffset; - } - - forwardExhausted = true; - } - - if (!backwardExhausted) { - if (!forwardExhausted) { - wantForward = true; - } // Check if trying to fit before text beginning, and if not, check it fits - // before offset location - - - if (minLine <= start - localOffset) { - return -localOffset++; - } - - backwardExhausted = true; - return iterator(); - } // We tried to fit hunk before text beginning and beyond text length, then - // hunk can't fit on the text. Return undefined - - }; - } - - function applyPatch(source, uniDiff) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - if (typeof uniDiff === 'string') { - uniDiff = parsePatch(uniDiff); - } - - if (Array.isArray(uniDiff)) { - if (uniDiff.length > 1) { - throw new Error('applyPatch only works with a single input.'); - } - - uniDiff = uniDiff[0]; - } // Apply the diff to the input - - - var lines = source.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], - hunks = uniDiff.hunks, - compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { - return line === patchContent; - }, - errorCount = 0, - fuzzFactor = options.fuzzFactor || 0, - minLine = 0, - offset = 0, - removeEOFNL, - addEOFNL; - /** - * Checks if the hunk exactly fits on the provided location - */ - - - function hunkFits(hunk, toPos) { - for (var j = 0; j < hunk.lines.length; j++) { - var line = hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line; - - if (operation === ' ' || operation === '-') { - // Context sanity check - if (!compareLine(toPos + 1, lines[toPos], operation, content)) { - errorCount++; - - if (errorCount > fuzzFactor) { - return false; - } - } - - toPos++; - } - } - - return true; - } // Search best fit offsets for each hunk based on the previous ones - - - for (var i = 0; i < hunks.length; i++) { - var hunk = hunks[i], - maxLine = lines.length - hunk.oldLines, - localOffset = 0, - toPos = offset + hunk.oldStart - 1; - var iterator = distanceIterator(toPos, minLine, maxLine); - - for (; localOffset !== undefined; localOffset = iterator()) { - if (hunkFits(hunk, toPos + localOffset)) { - hunk.offset = offset += localOffset; - break; - } - } - - if (localOffset === undefined) { - return false; - } // Set lower text limit to end of the current hunk, so next ones don't try - // to fit over already patched text - - - minLine = hunk.offset + hunk.oldStart + hunk.oldLines; - } // Apply patch hunks - - - var diffOffset = 0; - - for (var _i = 0; _i < hunks.length; _i++) { - var _hunk = hunks[_i], - _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; - - diffOffset += _hunk.newLines - _hunk.oldLines; - - if (_toPos < 0) { - // Creating a new file - _toPos = 0; - } - - for (var j = 0; j < _hunk.lines.length; j++) { - var line = _hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters[j]; - - if (operation === ' ') { - _toPos++; - } else if (operation === '-') { - lines.splice(_toPos, 1); - delimiters.splice(_toPos, 1); - /* istanbul ignore else */ - } else if (operation === '+') { - lines.splice(_toPos, 0, content); - delimiters.splice(_toPos, 0, delimiter); - _toPos++; - } else if (operation === '\\') { - var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; - - if (previousOperation === '+') { - removeEOFNL = true; - } else if (previousOperation === '-') { - addEOFNL = true; - } - } - } - } // Handle EOFNL insertion/removal - - - if (removeEOFNL) { - while (!lines[lines.length - 1]) { - lines.pop(); - delimiters.pop(); - } - } else if (addEOFNL) { - lines.push(''); - delimiters.push('\n'); - } - - for (var _k = 0; _k < lines.length - 1; _k++) { - lines[_k] = lines[_k] + delimiters[_k]; - } - - return lines.join(''); - } // Wrapper that supports multiple file patches via callbacks. - - function applyPatches(uniDiff, options) { - if (typeof uniDiff === 'string') { - uniDiff = parsePatch(uniDiff); - } - - var currentIndex = 0; - - function processIndex() { - var index = uniDiff[currentIndex++]; - - if (!index) { - return options.complete(); - } - - options.loadFile(index, function (err, data) { - if (err) { - return options.complete(err); - } - - var updatedContent = applyPatch(data, index, options); - options.patched(index, updatedContent, function (err) { - if (err) { - return options.complete(err); - } - - processIndex(); - }); - }); - } - - processIndex(); - } - - function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - if (!options) { - options = {}; - } - - if (typeof options.context === 'undefined') { - options.context = 4; - } - - var diff = diffLines(oldStr, newStr, options); - diff.push({ - value: '', - lines: [] - }); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function (entry) { - return ' ' + entry; - }); - } - - var hunks = []; - var oldRangeStart = 0, - newRangeStart = 0, - curRange = [], - oldLine = 1, - newLine = 1; - - var _loop = function _loop(i) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - var _curRange; - - // If we have previous context, start with that - if (!oldRangeStart) { - var prev = diff[i - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; - } - } // Output our changes - - - (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { - return (current.added ? '+' : '-') + entry; - }))); // Track the updated file position - - - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - // Identical context lines. Track line changes - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= options.context * 2 && i < diff.length - 2) { - var _curRange2; - - // Overlapping - (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); - } else { - var _curRange3; - - // end the range and output - var contextSize = Math.min(lines.length, options.context); - - (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); - - var hunk = { - oldStart: oldRangeStart, - oldLines: oldLine - oldRangeStart + contextSize, - newStart: newRangeStart, - newLines: newLine - newRangeStart + contextSize, - lines: curRange - }; - - if (i >= diff.length - 2 && lines.length <= options.context) { - // EOF is inside this hunk - var oldEOFNewline = /\n$/.test(oldStr); - var newEOFNewline = /\n$/.test(newStr); - var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; - - if (!oldEOFNewline && noNlBeforeAdds) { - // special case: old has no eol and no trailing context; no-nl can end up before adds - curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); - } - - if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { - curRange.push('\\ No newline at end of file'); - } - } - - hunks.push(hunk); - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; - } - } - - oldLine += lines.length; - newLine += lines.length; - } - }; - - for (var i = 0; i < diff.length; i++) { - _loop(i); - } - - return { - oldFileName: oldFileName, - newFileName: newFileName, - oldHeader: oldHeader, - newHeader: newHeader, - hunks: hunks - }; - } - function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); - var ret = []; - - if (oldFileName == newFileName) { - ret.push('Index: ' + oldFileName); - } - - ret.push('==================================================================='); - ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); - ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); - - for (var i = 0; i < diff.hunks.length; i++) { - var hunk = diff.hunks[i]; - ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); - ret.push.apply(ret, hunk.lines); - } - - return ret.join('\n') + '\n'; - } - function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { - return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); - } - - function arrayEqual(a, b) { - if (a.length !== b.length) { - return false; - } - - return arrayStartsWith(a, b); - } - function arrayStartsWith(array, start) { - if (start.length > array.length) { - return false; - } - - for (var i = 0; i < start.length; i++) { - if (start[i] !== array[i]) { - return false; - } - } - - return true; - } - - function calcLineCount(hunk) { - var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), - oldLines = _calcOldNewLineCount.oldLines, - newLines = _calcOldNewLineCount.newLines; - - if (oldLines !== undefined) { - hunk.oldLines = oldLines; - } else { - delete hunk.oldLines; - } - - if (newLines !== undefined) { - hunk.newLines = newLines; - } else { - delete hunk.newLines; - } - } - function merge(mine, theirs, base) { - mine = loadPatch(mine, base); - theirs = loadPatch(theirs, base); - var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. - // Leaving sanity checks on this to the API consumer that may know more about the - // meaning in their own context. - - if (mine.index || theirs.index) { - ret.index = mine.index || theirs.index; - } - - if (mine.newFileName || theirs.newFileName) { - if (!fileNameChanged(mine)) { - // No header or no change in ours, use theirs (and ours if theirs does not exist) - ret.oldFileName = theirs.oldFileName || mine.oldFileName; - ret.newFileName = theirs.newFileName || mine.newFileName; - ret.oldHeader = theirs.oldHeader || mine.oldHeader; - ret.newHeader = theirs.newHeader || mine.newHeader; - } else if (!fileNameChanged(theirs)) { - // No header or no change in theirs, use ours - ret.oldFileName = mine.oldFileName; - ret.newFileName = mine.newFileName; - ret.oldHeader = mine.oldHeader; - ret.newHeader = mine.newHeader; - } else { - // Both changed... figure it out - ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); - ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); - ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); - ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); - } - } - - ret.hunks = []; - var mineIndex = 0, - theirsIndex = 0, - mineOffset = 0, - theirsOffset = 0; - - while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { - var mineCurrent = mine.hunks[mineIndex] || { - oldStart: Infinity - }, - theirsCurrent = theirs.hunks[theirsIndex] || { - oldStart: Infinity - }; - - if (hunkBefore(mineCurrent, theirsCurrent)) { - // This patch does not overlap with any of the others, yay. - ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); - mineIndex++; - theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; - } else if (hunkBefore(theirsCurrent, mineCurrent)) { - // This patch does not overlap with any of the others, yay. - ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); - theirsIndex++; - mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; - } else { - // Overlap, merge as best we can - var mergedHunk = { - oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), - oldLines: 0, - newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), - newLines: 0, - lines: [] - }; - mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); - theirsIndex++; - mineIndex++; - ret.hunks.push(mergedHunk); - } - } - - return ret; - } - - function loadPatch(param, base) { - if (typeof param === 'string') { - if (/^@@/m.test(param) || /^Index:/m.test(param)) { - return parsePatch(param)[0]; - } - - if (!base) { - throw new Error('Must provide a base reference or pass in a patch'); - } - - return structuredPatch(undefined, undefined, base, param); - } - - return param; - } - - function fileNameChanged(patch) { - return patch.newFileName && patch.newFileName !== patch.oldFileName; - } - - function selectField(index, mine, theirs) { - if (mine === theirs) { - return mine; - } else { - index.conflict = true; - return { - mine: mine, - theirs: theirs - }; - } - } - - function hunkBefore(test, check) { - return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; - } - - function cloneHunk(hunk, offset) { - return { - oldStart: hunk.oldStart, - oldLines: hunk.oldLines, - newStart: hunk.newStart + offset, - newLines: hunk.newLines, - lines: hunk.lines - }; - } - - function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { - // This will generally result in a conflicted hunk, but there are cases where the context - // is the only overlap where we can successfully merge the content here. - var mine = { - offset: mineOffset, - lines: mineLines, - index: 0 - }, - their = { - offset: theirOffset, - lines: theirLines, - index: 0 - }; // Handle any leading content - - insertLeading(hunk, mine, their); - insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. - - while (mine.index < mine.lines.length && their.index < their.lines.length) { - var mineCurrent = mine.lines[mine.index], - theirCurrent = their.lines[their.index]; - - if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { - // Both modified ... - mutualChange(hunk, mine, their); - } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { - var _hunk$lines; - - // Mine inserted - (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); - } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { - var _hunk$lines2; - - // Theirs inserted - (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); - } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { - // Mine removed or edited - removal(hunk, mine, their); - } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { - // Their removed or edited - removal(hunk, their, mine, true); - } else if (mineCurrent === theirCurrent) { - // Context identity - hunk.lines.push(mineCurrent); - mine.index++; - their.index++; - } else { - // Context mismatch - conflict(hunk, collectChange(mine), collectChange(their)); - } - } // Now push anything that may be remaining - - - insertTrailing(hunk, mine); - insertTrailing(hunk, their); - calcLineCount(hunk); - } - - function mutualChange(hunk, mine, their) { - var myChanges = collectChange(mine), - theirChanges = collectChange(their); - - if (allRemoves(myChanges) && allRemoves(theirChanges)) { - // Special case for remove changes that are supersets of one another - if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { - var _hunk$lines3; - - (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); - - return; - } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { - var _hunk$lines4; - - (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); - - return; - } - } else if (arrayEqual(myChanges, theirChanges)) { - var _hunk$lines5; - - (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); - - return; - } - - conflict(hunk, myChanges, theirChanges); - } - - function removal(hunk, mine, their, swap) { - var myChanges = collectChange(mine), - theirChanges = collectContext(their, myChanges); - - if (theirChanges.merged) { - var _hunk$lines6; - - (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); - } else { - conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); - } - } - - function conflict(hunk, mine, their) { - hunk.conflict = true; - hunk.lines.push({ - conflict: true, - mine: mine, - theirs: their - }); - } - - function insertLeading(hunk, insert, their) { - while (insert.offset < their.offset && insert.index < insert.lines.length) { - var line = insert.lines[insert.index++]; - hunk.lines.push(line); - insert.offset++; - } - } - - function insertTrailing(hunk, insert) { - while (insert.index < insert.lines.length) { - var line = insert.lines[insert.index++]; - hunk.lines.push(line); - } - } - - function collectChange(state) { - var ret = [], - operation = state.lines[state.index][0]; - - while (state.index < state.lines.length) { - var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. - - if (operation === '-' && line[0] === '+') { - operation = '+'; - } - - if (operation === line[0]) { - ret.push(line); - state.index++; - } else { - break; - } - } - - return ret; - } - - function collectContext(state, matchChanges) { - var changes = [], - merged = [], - matchIndex = 0, - contextChanges = false, - conflicted = false; - - while (matchIndex < matchChanges.length && state.index < state.lines.length) { - var change = state.lines[state.index], - match = matchChanges[matchIndex]; // Once we've hit our add, then we are done - - if (match[0] === '+') { - break; - } - - contextChanges = contextChanges || change[0] !== ' '; - merged.push(match); - matchIndex++; // Consume any additions in the other block as a conflict to attempt - // to pull in the remaining context after this - - if (change[0] === '+') { - conflicted = true; - - while (change[0] === '+') { - changes.push(change); - change = state.lines[++state.index]; - } - } - - if (match.substr(1) === change.substr(1)) { - changes.push(change); - state.index++; - } else { - conflicted = true; - } - } - - if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { - conflicted = true; - } - - if (conflicted) { - return changes; - } - - while (matchIndex < matchChanges.length) { - merged.push(matchChanges[matchIndex++]); - } - - return { - merged: merged, - changes: changes - }; - } - - function allRemoves(changes) { - return changes.reduce(function (prev, change) { - return prev && change[0] === '-'; - }, true); - } - - function skipRemoveSuperset(state, removeChanges, delta) { - for (var i = 0; i < delta; i++) { - var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); - - if (state.lines[state.index + i] !== ' ' + changeContent) { - return false; - } - } - - state.index += delta; - return true; - } - - function calcOldNewLineCount(lines) { - var oldLines = 0; - var newLines = 0; - lines.forEach(function (line) { - if (typeof line !== 'string') { - var myCount = calcOldNewLineCount(line.mine); - var theirCount = calcOldNewLineCount(line.theirs); - - if (oldLines !== undefined) { - if (myCount.oldLines === theirCount.oldLines) { - oldLines += myCount.oldLines; - } else { - oldLines = undefined; - } - } - - if (newLines !== undefined) { - if (myCount.newLines === theirCount.newLines) { - newLines += myCount.newLines; - } else { - newLines = undefined; - } - } - } else { - if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { - newLines++; - } - - if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { - oldLines++; - } - } - }); - return { - oldLines: oldLines, - newLines: newLines - }; - } - - // See: http://code.google.com/p/google-diff-match-patch/wiki/API - function convertChangesToDMP(changes) { - var ret = [], - change, - operation; - - for (var i = 0; i < changes.length; i++) { - change = changes[i]; - - if (change.added) { - operation = 1; - } else if (change.removed) { - operation = -1; - } else { - operation = 0; - } - - ret.push([operation, change.value]); - } - - return ret; - } - - function convertChangesToXML(changes) { - var ret = []; - - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - - ret.push(escapeHTML(change.value)); - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - } - - return ret.join(''); - } - - function escapeHTML(s) { - var n = s; - n = n.replace(/&/g, '&'); - n = n.replace(//g, '>'); - n = n.replace(/"/g, '"'); - return n; - } - - /* See LICENSE file for terms of use */ - - exports.Diff = Diff; - exports.diffChars = diffChars; - exports.diffWords = diffWords; - exports.diffWordsWithSpace = diffWordsWithSpace; - exports.diffLines = diffLines; - exports.diffTrimmedLines = diffTrimmedLines; - exports.diffSentences = diffSentences; - exports.diffCss = diffCss; - exports.diffJson = diffJson; - exports.diffArrays = diffArrays; - exports.structuredPatch = structuredPatch; - exports.createTwoFilesPatch = createTwoFilesPatch; - exports.createPatch = createPatch; - exports.applyPatch = applyPatch; - exports.applyPatches = applyPatches; - exports.parsePatch = parsePatch; - exports.merge = merge; - exports.convertChangesToDMP = convertChangesToDMP; - exports.convertChangesToXML = convertChangesToXML; - exports.canonicalize = canonicalize; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); - -},{}],92:[function(require,module,exports){ -'use strict'; -module.exports = balanced; -function balanced(a, b, str) { - if (a instanceof RegExp) a = maybeMatch(a, str); - if (b instanceof RegExp) b = maybeMatch(b, str); - - var r = range(a, b, str); - - return r && { - start: r[0], - end: r[1], - pre: str.slice(0, r[0]), - body: str.slice(r[0] + a.length, r[1]), - post: str.slice(r[1] + b.length) - }; -} - -function maybeMatch(reg, str) { - var m = str.match(reg); - return m ? m[0] : null; -} - -balanced.range = range; -function range(a, b, str) { - var begs, beg, left, right, result; - var ai = str.indexOf(a); - var bi = str.indexOf(b, ai + 1); - var i = ai; - - if (ai >= 0 && bi > 0) { - begs = []; - left = str.length; - - while (i >= 0 && !result) { - if (i == ai) { - begs.push(i); - ai = str.indexOf(a, i + 1); - } else if (begs.length == 1) { - result = [ begs.pop(), bi ]; - } else { - beg = begs.pop(); - if (beg < left) { - left = beg; - right = bi; - } - - bi = str.indexOf(b, i + 1); - } - - i = ai < bi && ai >= 0 ? ai : bi; - } - - if (begs.length) { - result = [ left, right ]; - } - } - - return result; -} - -},{}],93:[function(require,module,exports){ -'use strict' - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - -},{}],94:[function(require,module,exports){ -/* - * Copyright (c) 2017. becke.ch - All Rights Reserved. - * Use is subject to (MIT-style) License terms. - * You may obtain a copy of the License at http://becke.ch/tool/becke-ch--regex--s0-v1/becke-ch--regex--s0-v1--license.txt - */ - -/** - * Created by raoul-becke--s0-v1 on 08.12.16. A JavaScript Regular Expression library, extending the standard RegExp - * class with missing functionality. - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp - * @see http://www.ecma-international.org/ecma-262/6.0/#sec-regexp-regular-expression-objects - */ - -//Fixes issue for browsers (IE, Safari - respective in general WebKit based browsers e.g. JavaFX) not supporting -// JavaScript "Symbol" -Symbol = (typeof Symbol === "undefined") ? [] : Symbol; - -/** - * This class is an extension of the standard {@linkcode RegExp} class adding missing functionality. - * For further descriptions see the corresponding overridden methods. - * @param {string|RegExp} [pattern] - * @param {string} [options] - * @constructor - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp - * @see http://www.ecma-international.org/ecma-262/6.0/#sec-regexp-regular-expression-objects - */ -function Regex(pattern, options) { - var patternInstanceofRegExp = false; - if (pattern instanceof RegExp) { - pattern = pattern.source; - patternInstanceofRegExp = true; - } - if (pattern) { - this.regexGroupStructure = getRegexCompleteGroupingStructure(pattern); - if (patternInstanceofRegExp) { - this.source = pattern; - } else { - this.source = this.regexGroupStructure[2][0]; - } - try { - this.regex = new RegExp(this.regexGroupStructure[0][2], options); - } catch (e) { - new RegExp(pattern, options); - } - } else { - this.regex = new RegExp(pattern, options); - this.source = this.regex.source; - } - this.flags = this.regex.flags; - this.global = this.regex.global; - this.ignoreCase = this.regex.ignoreCase; - this.multiline = this.regex.multiline; - this.sticky = this.regex.sticky; - this.unicode = this.regex.unicode; - this.lastIndex = this.regex.lastIndex; -} - -Regex.prototype = Object.create(RegExp.prototype, { - flags: { - value: null, - enumerable: true, - configurable: true, - writable: true - }, - global: { - value: null, - enumerable: true, - configurable: true, - writable: true - }, - ignoreCase: { - value: null, - enumerable: true, - configurable: true, - writable: true - }, - multiline: { - value: null, - enumerable: true, - configurable: true, - writable: true - }, - source: { - value: null, - enumerable: true, - configurable: true, - writable: true - }, - sticky: { - value: null, - enumerable: true, - configurable: true, - writable: true - }, - unicode: { - value: null, - enumerable: true, - configurable: true, - writable: true - } -}); - -Regex.prototype.constructor = Regex; - -/** - * Returns the same string format as {@linkcode RegExp#toString} for the initial pattern that was provided to the - * {@linkcode Regex} constructor.
- * The string is constructed as follows: "/"+{@linkcode Regex#source}+"/"+{@linkcode Regex#flags} - * @return {string} - */ -Regex.prototype.toString = function () { - return ('/' + this.source + '/' + this.flags); -} - -/** - * Simply invokes the inherited method {@linkcode RegExp#test}. - * @param {string} [str] - * @return {boolean} - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test - * @see http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.test - */ -Regex.prototype.test = function (str) { - return this.regex.test(str); -} - -/** - * Simply invokes the inherited method {@linkcode RegExp[Symbol.search]}. - * @param {string} str - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/@@search - * @see http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype-@@search - * @alias Regex.search - */ -Regex.prototype[Symbol.search] = function (str) { - return this.regex[Symbol.search](str); -} - -/** - * Simply invokes the inherited method {@linkcode RegExp[Symbol.split]}. - * @param {string} str - * @param {number} [limit] - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/@@split - * @see http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype-@@split - * @alias Regex.split - */ -Regex.prototype[Symbol.split] = function (str, limit) { - return this.regex[Symbol.split](str); -} - -/** - * Full indexed exec method: Based on {@linkcode RegExp#exec} but instead of simply getting "index" in the return which - * only tells the starting of the first group (0 group) we are getting "index[0..n]" which tells us the starting index - * of each matching group.
- * - * Syntax: (new Regex(pattern, flags)).exec(string) = {string[0..n], index:number[0..n], input:string}
- * Example:
- * //Retrieve content and position of: opening-, closing tags and body content for: non-nested html-tags. - * var pattern = '(<([^ >]+)[^>]*>)([^<]*)(<\\/\\2>)';
- * var str = '<html><code class="html plain">first</code><div class="content">second</div></html>';
- * var regex = new Regex(pattern, 'g');
- * var result = regex.exec(str);
- *
- * console.log(5 === result.length);
- * console.log('<code class="html plain">first</code>'=== result[0]);
- * console.log('<code class="html plain">'=== result[1]);
- * console.log('first'=== result[3]);
- * console.log('</code>'=== result[4]);
- * console.log(5=== result.index.length);
- * console.log(6=== result.index[0]);
- * console.log(6=== result.index[1]);
- * console.log(31=== result.index[3]);
- * console.log(36=== result.index[4]);
- *
- *
- * @param {string} [str] - * @return {Object} {string[0..n], index:number[0..n], input:string} - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec - * @see http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.exec - */ -Regex.prototype.exec = function (str) { - var result = []; - result.index = []; - var resultRegex = this.regex.exec(str); - this.lastIndex = this.regex.lastIndex; - - if (!resultRegex) { - return resultRegex; - } - result[0] = resultRegex[0]; - result.index[0] = resultRegex.index; - result.input = str; - - var execInternal = function (strPosition, regexGroupStructureChildren) { - var currentStrPos = strPosition; - for (var i = 0; i < regexGroupStructureChildren.length; i++) { - var index = regexGroupStructureChildren[i][0]; - var originalIndex = regexGroupStructureChildren[i][1]; - if (originalIndex) { - result[originalIndex] = resultRegex[index]; - if (typeof result[originalIndex] === "undefined") { - result.index[originalIndex] = undefined; - } else { - result.index[originalIndex] = currentStrPos; - } - } - if (regexGroupStructureChildren[i][3]) { - execInternal(currentStrPos, regexGroupStructureChildren[i][3]); - } - if (typeof resultRegex[index] !== "undefined") { - currentStrPos += resultRegex[index].length; - } - } - }; - if (this.regexGroupStructure && this.regexGroupStructure[0][3]) { - execInternal(resultRegex.index, this.regexGroupStructure[0][3]); - } - return result; -}; - -/** - * Full detailed match. Based on {@linkcode RegExp[Symbol.match]} with some improvements regarding the return value. Analogue to the base - * method {@linkcode RegExp[Symbol.match]} internally the method {@linkcode Regex#exec} is called. And there are 2 - * improvements related to this: First improvement is that {@linkcode Regex#exec} returns the index for all matching - * groups and Second improvement is that we always return a 2-dimensional array independent of whether the global 'g' - * flag is set or not. If the 'g' flag is not set then first dimension only contains one element which is the result - * of {@linkcode Regex#exec} and if the flag is set the size of the first dimension equals the number of matches we had - * and each match contains the {@linkcode Regex#exec} result for the corresponding execution. - * @param [str] {String} - * @return {Object} Array[{string[0..n], index:number[0..n], input:string}] - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/@@match - * @see http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype-@@match - * @alias Regex.match - */ -Regex.prototype[Symbol.match] = function (str) { - this.lastIndex = 0; - this.regex.lastIndex = 0; - - var resultExec = this.exec(str); - if (!resultExec) { - return null; - } - - var resultExecArray = []; - - while (resultExec) { - resultExecArray.push(resultExec); - if (resultExec[0].length === 0) { - this.regex.lastIndex++; - } - if (!this.global) { - break; - } - resultExec = this.exec(str); - } - - this.lastIndex = 0; - this.regex.lastIndex = 0; - return resultExecArray; -} - -/** - * Group based search & replace. Based on {@linkcode Regex.prototype[Symbol.replace]} but instead of only being able to provide a - * single "replacement substring" or "replacement function" for replacement of the entire match (aka matching-group[0]) - * we can provide an array [0..n] of "replacement substring" or "replacement function" elements for replacement of - * each matching group [0..n]. - *
- * Important: If we don't want a group to be replaced we provide the corresponding "replacement substring/function" - * array element as undefined or null! - *
- * Important: If we provide a "replacement substring/function" for a parent group-element then (obviously) no - * replacement is performed on its child-group-elements. E.g. if we provide a "replacement substring/function" - * for group 0 then the entire match is replaced and (obviously) no replacement of the further child-groups - * takes place! - *
- *
- * - * Syntax: (new Regex(pattern))[Symbol.replace](string, [array of replacement strings])
- * Alternative Syntax: For browsers supporting "Symbol": Chrome & Firefox: string.replace(new Regex(pattern), [array of replacement strings])
- * Example:
- * //Convert plain text to html: Replace special characters (multiple spaces, tabs, ...) in plain text with their html "equivalent":
- * var CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN = "( {2})|(\t)|(&)|(<)|(>)|(\n)";
- * var CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN_REPLACE_STRING = [undefined, "&nbsp;&nbsp;", "&emsp;", "&amp;", "&lt;", "&gt;", "<br>"];
- * var regex = new Regex(CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN, 'g');
- * var result = regex[Symbol.replace](myPlainText,CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN_REPLACE_STRING);
- * //Alternative Syntax: For browsers supporting "Symbol": Chrome & Firefox
- * var resultAlternative = myPlainText.replace(regex,CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN_REPLACE_STRING); - *
- *
- *
- * Special (in addition to the standard search and replace): We support in the "new substring" as well $0 as replacement - * pattern which is basically the entire match. - * And accordingly for the "new function" we call it as well with p0 as parameter which is the entire match. - * - * @param [str] {String} - * @param [newSubstringFunctionArray] {String[]|function[]|String|function} - * @return {string} - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/@@replace - * @see http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype-@@replace - * @alias Regex.replace - */ -Regex.prototype[Symbol.replace] = function (str, newSubstringFunctionArray) { - this.lastIndex = 0; - this.regex.lastIndex = 0; - if (!str) { - return str; - } - // if (!newSubstringFunctionArray && newSubstringFunctionArray !== "") { - // return newSubstringFunctionArray; - // // newSubstringFunctionArray = '' + newSubstringFunctionArray; - // // console.log(newSubstringFunctionArray); - // } - - var resultExec = this.exec(str); - if (!resultExec) { - return str; - } - - if (!(newSubstringFunctionArray instanceof Array)) { - newSubstringFunctionArray = [newSubstringFunctionArray]; - } - - var resultString = ''; - var resultStringPosition = 0; - - var computeSubstringFunction = function (newSubstringFunctionIndex) { - var computedString = ''; - var charAt = ''; - var newSubstringFunction = newSubstringFunctionArray[newSubstringFunctionIndex]; - // if(!newSubstringFunction){ - // newSubstringFunction += ''; - // } - if (typeof newSubstringFunction === 'string') { - for (var i = 0; i < newSubstringFunction.length; i++) { - charAt = newSubstringFunction.charAt(i); - if (charAt === '$') { - i++; - charAt = newSubstringFunction.charAt(i); - if (charAt === '$') { - computedString += '$'; - } else if (charAt === '&') { - computedString += resultExec[newSubstringFunctionIndex]; - } else if (charAt === '`') { - computedString += str.substring(0, resultExec.index[newSubstringFunctionIndex]); - } else if (charAt === "'") { - computedString += str.substring(resultExec.index[newSubstringFunctionIndex] + resultExec[newSubstringFunctionIndex].length); - } else if (charAt >= '0' && charAt <= '9') { - var int = charAt; - i++; - charAt = newSubstringFunction.charAt(i); - while (charAt >= '0' && charAt <= '9') { - int += charAt; - i++; - charAt = newSubstringFunction.charAt(i); - } - i--; - if (resultExec[int]) { - computedString += resultExec[int]; - } else { - computedString += '$' + int; - } - } else { - //strange not sure whether this is correct - initially it was: computedString += charAt; - //but unit tests in NPM told differently!... - computedString += '$' + charAt; - } - } else { - computedString += charAt; - } - } - } else if (newSubstringFunction instanceof Function) { - var args = [resultExec[newSubstringFunctionIndex]]; - for (var j = 0; j < resultExec.length; j++) { - args.push(resultExec[j]); - } - for (var k = 0; j < resultExec.index.length; k++) { - args.push(resultExec.index[k]); - } - args.push(str); - computedString += newSubstringFunction.apply(this, args); - } - return computedString; - } - - var traverseRegexGroupStructure = function (regexGroupStructureChildren) { - for (var i = 0; i < regexGroupStructureChildren.length; i++) { - var originalIndex = regexGroupStructureChildren[i][1]; - if (originalIndex) { - if (newSubstringFunctionArray[originalIndex] || newSubstringFunctionArray[originalIndex] === "") { - if (resultExec[originalIndex] || resultExec[originalIndex] === "") { - resultString += str.substring(resultStringPosition, resultExec.index[originalIndex]) + computeSubstringFunction(originalIndex); - resultStringPosition = resultExec.index[originalIndex] + resultExec[originalIndex].length; - } - } else if (regexGroupStructureChildren[i][3]) { - traverseRegexGroupStructure(regexGroupStructureChildren[i][3]); - } - } else { - traverseRegexGroupStructure(regexGroupStructureChildren[i][3]); - } - } - }; - while (resultExec) { - if (newSubstringFunctionArray[0] || newSubstringFunctionArray[0] === "") { - resultString += str.substring(resultStringPosition, resultExec.index[0]) + computeSubstringFunction(0); - resultStringPosition = resultExec.index[0] + resultExec[0].length; - } else if (this.regexGroupStructure && this.regexGroupStructure[0][3]) { - traverseRegexGroupStructure(this.regexGroupStructure[0][3]); - } - // 20170415 - avoid infinite loop according to specification! - if (resultExec[0].length === 0) { - this.regex.lastIndex++; - } - if (!this.global) { - break; - } - resultExec = this.exec(str); - } - - this.lastIndex = 0; - this.regex.lastIndex = 0; - return resultString + str.substring(resultStringPosition, str.length); -} - -/** - * Takes the regular expression "regex" as input and puts all the non-grouped regex characters before a group - * opening "(") into additional groups: "(xyz)" so in the end all relevant parts of the regular expression - * (relevant in the sense that they are required to calculate the starting position of each group) are grouped. - * AND finally returns the group structure of this regex: - * [[index, originalIndex, 'regexForThisGroup', [[child01Index, child01OriginalIndex, 'regexForThisChild01Group', [...]], [child02Index, child02OriginalIndex, ..., [...]], ...]]]. - * The array elements are: - * - index: This is the group index in the regular expression - * - originalIndex: This is the groups index in the initial/original regular expression. "originalIndex" is "undefined" - * if this group was the result of the group completion. - * - regexForThisGroup: The regular expression of this group including its parantheses - * - child-array: An array containing the child regular expressions - * - * SPECIAL: indexMap: The first element contains one more array element: [1]: indexMap: This array maps the - * original-index [0..n] to the actual-index [0..m] - * - * SPECIAL: source: The first element contains one more array element: [2]: source: This is the initial regular - * expression pattern and the only reason this is required is because in RegExp.source the slash "/" needs to be - * escaped. - * - * Rule for group parsing: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp - * And: http://www.ecma-international.org/ecma-262/6.0/#sec-regexp-regular-expression-objects - * The capturing groups are numbered according to the order of left parentheses of capturing groups, starting from 1. - * The matched substring can be recalled from the resulting array's elements [1], ..., [n] or from the predefined - * RegExp object's properties $1, ..., $9. - * The good thing is that the regular expression rules around groups (and as well in most other parts of the regular - * expression) did not change between the different ECMA Script versions respective did not have any impact on the - * group parsing and therefore this function is compatible between the different browsers! - * - * @param {String} [regex] - * @returns {*} - */ -function getRegexCompleteGroupingStructure(regex) { - if (!regex) { - console.error('The "regex" is empty! Returning empty array!'); - return []; - } - var indexMap = []; - var source = ['']; - var containsBackReference = []; - containsBackReference[0] = false; - var getRegexCompleteGroupingStructureInternalResult = getRegexCompleteGroupingStructureInternal(regex, [0, 0, 0], true, indexMap, source, containsBackReference); - if (containsBackReference[0]) { - var fixIndexOnGroupingStructure = function (groupingStructureElement) { - var regexForThisGroup = ''; - var charAt; - for (var i = 0; i < groupingStructureElement[2].length; i++) { - charAt = groupingStructureElement[2].charAt(i); - regexForThisGroup += charAt; - if (charAt === '\\') { - if (i + 1 === groupingStructureElement[2].length) { - continue; - } - i++; - charAt = groupingStructureElement[2].charAt(i); - var int = ''; - while (charAt >= '0' && charAt <= '9') { - int += charAt; - i++; - charAt = groupingStructureElement[2].charAt(i); - } - if (int) { - regexForThisGroup += indexMap[int]; - i--; - } else { - regexForThisGroup += charAt; - } - continue; - } - if (charAt === '[') { - if (i + 1 === groupingStructureElement[2].length) { - continue; - } - i++; - charAt = groupingStructureElement[2].charAt(i); - while ((charAt !== ']' || (groupingStructureElement[2].charAt(i - 1) === '\\' && groupingStructureElement[2].charAt(i - 2) !== '\\')) && i < groupingStructureElement[2].length) { - regexForThisGroup += charAt; - i++; - charAt = groupingStructureElement[2].charAt(i); - } - regexForThisGroup += charAt; - continue; - } - } - groupingStructureElement[2] = regexForThisGroup; - for (var j = 0; j < groupingStructureElement[3].length; j++) { - fixIndexOnGroupingStructure(groupingStructureElement[3][j]); - } - } - fixIndexOnGroupingStructure(getRegexCompleteGroupingStructureInternalResult); - } - return [getRegexCompleteGroupingStructureInternalResult, indexMap, source]; -} -/** - * Description see getRegexCompleteGroupingStructure. - * @param regex - * @param posIndexOrigIndex - this array has 3 values: - * [0]:position: while iterating through the regular expression the parsing position is incremented starting at 0 - * [1]:index: the index of the current group we are parsing - * [2]:original index: the original index the group had before we added additional groups - * @param isCapturingGroup - tells us whether this group of characters enclosed within parantheses is a capturing group - * or not. If not it could be a non capturing group (?:xyz) or an assertion which starts as well with a group bracket - * "(" character but is followed with a "?=" or "?!" and tells us that this is not a capturing group - * @param indexMap this array maps the original-index [0..n] to the actual-index [0..m] - * @param source This is the initial regular expression pattern and the only reason this is required is because in - * RegExp.source the slash "/" needs to be escaped. - * @returns {*} - */ -function getRegexCompleteGroupingStructureInternal(regex, posIndexOrigIndex, isCapturingGroup, indexMap, source, containsBackReference) { - var groupStructure; - if (isCapturingGroup) { - groupStructure = [posIndexOrigIndex[1], posIndexOrigIndex[2], '', []]; - indexMap[posIndexOrigIndex[2]] = posIndexOrigIndex[1]; - } else { - groupStructure = [undefined, undefined, '', []]; - } - var tmpStr = ''; - var charAt; - for (posIndexOrigIndex[0]; posIndexOrigIndex[0] < regex.length; posIndexOrigIndex[0]++) { - charAt = regex.charAt(posIndexOrigIndex[0]); - if (charAt === '\\') { - //handle escape character - if (posIndexOrigIndex[0] + 1 === regex.length) { - tmpStr += '\\'; - source[0] += '\\'; - continue; - } - posIndexOrigIndex[0]++; - charAt = regex.charAt(posIndexOrigIndex[0]); - //check whether we have a back-reference and adjust it according to the shift in the index-map - var int = ''; - //Back references above \9 behave strange and different in every language. In - // Java-Script they are treated as back-reference if the group is existing otherwise they are treated - // as character escape sequence. - while (charAt >= '0' && charAt <= '9') { - int += charAt; - posIndexOrigIndex[0]++; - charAt = regex.charAt(posIndexOrigIndex[0]); - } - if (int) { - if (indexMap[int]) { - //if a group exists then back-reference to the group - //20170416 - bug the index map can change later if additional surrounding paranthesis are added - //Therefore this calculation needs to be done in the end! - //tmpStr += '\\' + indexMap[int]; - tmpStr += '\\' + int; - containsBackReference[0] = true; - } else { - if (int.indexOf('8') >= 0 || int.indexOf('9') >= 0) { - //if it is a non octal digit then treat it as simple number - tmpStr += int; - } else { - //otherwise it is a character escape - tmpStr += '\\' + 'x' + ("0" + (parseInt(int, 8).toString(16))).slice(-2).toUpperCase(); - } - } - source[0] += '\\' + int; - posIndexOrigIndex[0]--; - } else { - tmpStr += '\\' + charAt; - source[0] += '\\' + charAt; - } - continue; - } - if (charAt === '[') { - //parse character set - tmpStr += '['; - source[0] += '['; - if (posIndexOrigIndex[0] + 1 === regex.length) { - continue; - } - posIndexOrigIndex[0]++; - charAt = regex.charAt(posIndexOrigIndex[0]); - while ((charAt !== ']' || (regex.charAt(posIndexOrigIndex[0] - 1) === '\\' && regex.charAt(posIndexOrigIndex[0] - 2) !== '\\')) && posIndexOrigIndex[0] < regex.length) { - tmpStr += charAt; - source[0] += charAt; - posIndexOrigIndex[0]++; - charAt = regex.charAt(posIndexOrigIndex[0]); - } - tmpStr += charAt; - source[0] += charAt; - continue; - } - if (charAt === '|') { - //finalize pending tmp group string if any - //20170327 - this is not necessary - // if (tmpStr && groupStructure[3].length > 0) { - // //complete grouping: put trailing and pending characters sequences into groups - // posIndexOrigIndex[1]++; - // tmpStr = '(' + tmpStr + ')'; - // groupStructure[3].push([posIndexOrigIndex[1], , tmpStr, []]); - // } - groupStructure[2] += tmpStr + '|'; - tmpStr = ''; - source[0] += '|'; - continue; - } - if (charAt === ')') { - //handle group ending - //20170327 - not required to group here because it is already contained in a parent group - // if (tmpStr && groupStructure[3].length > 0) { - // //complete grouping: put trailing and pending characters sequences into groups - // posIndexOrigIndex[1]++; - // tmpStr = '(' + tmpStr + ')'; - // groupStructure[3].push([posIndexOrigIndex[1], , tmpStr, []]); - // } - groupStructure[2] += tmpStr + ')'; - source[0] += ')'; - return groupStructure; - } - if (charAt === '(') { - //handle group start - if (tmpStr) { - //complete grouping: put trailing and pending characters sequences into non remembering groups - posIndexOrigIndex[1]++; - tmpStr = '(' + tmpStr + ')'; - groupStructure[3].push([posIndexOrigIndex[1], undefined, tmpStr, []]); - } - posIndexOrigIndex[0]++; - var regexGroupStructureInternal; - var idx = posIndexOrigIndex[1] + 1; - isCapturingGroup = true; - // check whether group is an assertion - if (regex.charAt(posIndexOrigIndex[0]) === '?' && posIndexOrigIndex[0] + 1 < regex.length && (regex.charAt(posIndexOrigIndex[0] + 1) === '=' || regex.charAt(posIndexOrigIndex[0] + 1) === '!' || regex.charAt(posIndexOrigIndex[0] + 1) === ':')) { - //Handle assertion - posIndexOrigIndex[0]++; - var assertionChar = regex.charAt(posIndexOrigIndex[0]); - posIndexOrigIndex[0]++; - //we only set isCapturingGroup to false in case it is a non capturing group. For assertion groups - //i.e. positive-/negative-lookahead the parser steps back after the parsing of the lookahead and - //therefore (see if statement further down) we don't need to set the assertion groups into additional - //paranthesis. - //In other words at the end of a lookahead or a lookbehind, the regex engine hasn't moved on the string. - // You can chain three more lookaheads after the first, and the regex engine still won't move. - if (assertionChar === ':') { - isCapturingGroup = false; - } - source[0] += '(?' + assertionChar; - regexGroupStructureInternal = getRegexCompleteGroupingStructureInternal(regex, posIndexOrigIndex, false, indexMap, source, containsBackReference); - regexGroupStructureInternal[2] = '(?' + assertionChar + regexGroupStructureInternal[2]; - } else { - posIndexOrigIndex[1]++; - posIndexOrigIndex[2]++; - source[0] += '('; - regexGroupStructureInternal = getRegexCompleteGroupingStructureInternal(regex, posIndexOrigIndex, true, indexMap, source, containsBackReference); - regexGroupStructureInternal[2] = '(' + regexGroupStructureInternal[2]; - } - - //20170327 - special handling if we have a capturing group with a quantifier then we need to - //put the quantified group into additional paranthesis otherwise only the first group matches! - var quantifierStart = posIndexOrigIndex[0]; - var quantifierString = ''; - if (posIndexOrigIndex[0] + 1 < regex.length) { - //parse quantifier - charAt = regex.charAt(posIndexOrigIndex[0] + 1); - if (charAt === '*') { - posIndexOrigIndex[0]++; - quantifierString = '*'; - } else if (charAt === '+') { - posIndexOrigIndex[0]++; - quantifierString = '+'; - } else if (charAt === '?') { - posIndexOrigIndex[0]++; - quantifierString = '?'; - } else if (charAt === '{') { - posIndexOrigIndex[0]++; - quantifierString = '{'; - posIndexOrigIndex[0]++; - charAt = regex.charAt(posIndexOrigIndex[0]); - while (charAt >= '0' && charAt <= '9' && posIndexOrigIndex[0] < regex.length) { - quantifierString += charAt; - posIndexOrigIndex[0]++; - charAt = regex.charAt(posIndexOrigIndex[0]); - } - if (charAt === '}') { - quantifierString += '}'; - } else { - if (charAt === ',') { - quantifierString += ','; - posIndexOrigIndex[0]++; - charAt = regex.charAt(posIndexOrigIndex[0]); - while (charAt >= '0' && charAt <= '9' && posIndexOrigIndex[0] < regex.length) { - quantifierString += charAt; - posIndexOrigIndex[0]++; - charAt = regex.charAt(posIndexOrigIndex[0]); - } - if (charAt === '}') { - quantifierString += '}'; - } else { - quantifierString = ''; - } - } else { - quantifierString = ''; - } - } - } - if (quantifierString.length > 0) { - regexGroupStructureInternal[2] += quantifierString; - source[0] += quantifierString; - if (regex.charAt(posIndexOrigIndex[0] + 1) === '?') { - posIndexOrigIndex[0]++; - regexGroupStructureInternal[2] += '?'; - source[0] += '?'; - } - } else { - posIndexOrigIndex[0] = quantifierStart; - } - } - //20170327 - special handling if we have a non capturing group then we need to put this group into - // additional paranthesis otherwise we don't know the size of the group ! - if (quantifierString.length > 0 || !isCapturingGroup) { - incrementRegexGroupStructureIndex(regexGroupStructureInternal, indexMap); - regexGroupStructureInternal = [idx, undefined, '(' + regexGroupStructureInternal[2] + ')', [regexGroupStructureInternal]]; - posIndexOrigIndex[1]++; - } - - groupStructure[2] += tmpStr + regexGroupStructureInternal[2]; - groupStructure[3].push(regexGroupStructureInternal); - tmpStr = ''; - } else { - charAt = regex.charAt(posIndexOrigIndex[0]); - tmpStr += charAt; - if (charAt === '/') { - source[0] += '\\' + charAt; - } else { - source[0] += charAt; - } - } - } - //we only get here in the top-most iteration i.e. for matching group 0 which has no enclosing paranthesis - groupStructure[2] += tmpStr; - return groupStructure; -} - -function incrementRegexGroupStructureIndex(regexGroupStructure, indexMap) { - if (regexGroupStructure[0]) { - regexGroupStructure[0]++; - if (regexGroupStructure[1]) { - indexMap[regexGroupStructure[1]] = regexGroupStructure[0]; - } - } - for (var i = 0; i < regexGroupStructure[3].length; i++) { - incrementRegexGroupStructureIndex(regexGroupStructure[3][i], indexMap); - } -} - -function initialize() { - if (!(typeof module === "undefined")) { - module.exports = Regex; - } -} -initialize(); -},{}],95:[function(require,module,exports){ -(function (process,global,setImmediate){ -/* @preserve - * The MIT License (MIT) - * - * Copyright (c) 2013-2018 Petka Antonov - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ -/** - * bluebird build version 3.5.5 - * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each -*/ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o 0) { - _drainQueueStep(queue); - } -} - -function _drainQueueStep(queue) { - var fn = queue.shift(); - if (typeof fn !== "function") { - fn._settlePromises(); - } else { - var receiver = queue.shift(); - var arg = queue.shift(); - fn.call(receiver, arg); - } -} - -Async.prototype._drainQueues = function () { - _drainQueue(this._normalQueue); - this._reset(); - this._haveDrainedQueues = true; - _drainQueue(this._lateQueue); -}; - -Async.prototype._queueTick = function () { - if (!this._isTickUsed) { - this._isTickUsed = true; - this._schedule(this.drainQueues); - } -}; - -Async.prototype._reset = function () { - this._isTickUsed = false; -}; - -module.exports = Async; -module.exports.firstLineError = firstLineError; - -},{"./queue":26,"./schedule":29,"./util":36}],3:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { -var calledBind = false; -var rejectThis = function(_, e) { - this._reject(e); -}; - -var targetRejected = function(e, context) { - context.promiseRejectionQueued = true; - context.bindingPromise._then(rejectThis, rejectThis, null, this, e); -}; - -var bindingResolved = function(thisArg, context) { - if (((this._bitField & 50397184) === 0)) { - this._resolveCallback(context.target); - } -}; - -var bindingRejected = function(e, context) { - if (!context.promiseRejectionQueued) this._reject(e); -}; - -Promise.prototype.bind = function (thisArg) { - if (!calledBind) { - calledBind = true; - Promise.prototype._propagateFrom = debug.propagateFromFunction(); - Promise.prototype._boundValue = debug.boundValueFunction(); - } - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - ret._propagateFrom(this, 1); - var target = this._target(); - ret._setBoundTo(maybePromise); - if (maybePromise instanceof Promise) { - var context = { - promiseRejectionQueued: false, - promise: ret, - target: target, - bindingPromise: maybePromise - }; - target._then(INTERNAL, targetRejected, undefined, ret, context); - maybePromise._then( - bindingResolved, bindingRejected, undefined, ret, context); - ret._setOnCancel(maybePromise); - } else { - ret._resolveCallback(target); - } - return ret; -}; - -Promise.prototype._setBoundTo = function (obj) { - if (obj !== undefined) { - this._bitField = this._bitField | 2097152; - this._boundTo = obj; - } else { - this._bitField = this._bitField & (~2097152); - } -}; - -Promise.prototype._isBound = function () { - return (this._bitField & 2097152) === 2097152; -}; - -Promise.bind = function (thisArg, value) { - return Promise.resolve(value).bind(thisArg); -}; -}; - -},{}],4:[function(_dereq_,module,exports){ -"use strict"; -var old; -if (typeof Promise !== "undefined") old = Promise; -function noConflict() { - try { if (Promise === bluebird) Promise = old; } - catch (e) {} - return bluebird; -} -var bluebird = _dereq_("./promise")(); -bluebird.noConflict = noConflict; -module.exports = bluebird; - -},{"./promise":22}],5:[function(_dereq_,module,exports){ -"use strict"; -var cr = Object.create; -if (cr) { - var callerCache = cr(null); - var getterCache = cr(null); - callerCache[" size"] = getterCache[" size"] = 0; -} - -module.exports = function(Promise) { -var util = _dereq_("./util"); -var canEvaluate = util.canEvaluate; -var isIdentifier = util.isIdentifier; - -var getMethodCaller; -var getGetter; -if (!true) { -var makeMethodCaller = function (methodName) { - return new Function("ensureMethod", " \n\ - return function(obj) { \n\ - 'use strict' \n\ - var len = this.length; \n\ - ensureMethod(obj, 'methodName'); \n\ - switch(len) { \n\ - case 1: return obj.methodName(this[0]); \n\ - case 2: return obj.methodName(this[0], this[1]); \n\ - case 3: return obj.methodName(this[0], this[1], this[2]); \n\ - case 0: return obj.methodName(); \n\ - default: \n\ - return obj.methodName.apply(obj, this); \n\ - } \n\ - }; \n\ - ".replace(/methodName/g, methodName))(ensureMethod); -}; - -var makeGetter = function (propertyName) { - return new Function("obj", " \n\ - 'use strict'; \n\ - return obj.propertyName; \n\ - ".replace("propertyName", propertyName)); -}; - -var getCompiled = function(name, compiler, cache) { - var ret = cache[name]; - if (typeof ret !== "function") { - if (!isIdentifier(name)) { - return null; - } - ret = compiler(name); - cache[name] = ret; - cache[" size"]++; - if (cache[" size"] > 512) { - var keys = Object.keys(cache); - for (var i = 0; i < 256; ++i) delete cache[keys[i]]; - cache[" size"] = keys.length - 256; - } - } - return ret; -}; - -getMethodCaller = function(name) { - return getCompiled(name, makeMethodCaller, callerCache); -}; - -getGetter = function(name) { - return getCompiled(name, makeGetter, getterCache); -}; -} - -function ensureMethod(obj, methodName) { - var fn; - if (obj != null) fn = obj[methodName]; - if (typeof fn !== "function") { - var message = "Object " + util.classString(obj) + " has no method '" + - util.toString(methodName) + "'"; - throw new Promise.TypeError(message); - } - return fn; -} - -function caller(obj) { - var methodName = this.pop(); - var fn = ensureMethod(obj, methodName); - return fn.apply(obj, this); -} -Promise.prototype.call = function (methodName) { - var args = [].slice.call(arguments, 1);; - if (!true) { - if (canEvaluate) { - var maybeCaller = getMethodCaller(methodName); - if (maybeCaller !== null) { - return this._then( - maybeCaller, undefined, undefined, args, undefined); - } - } - } - args.push(methodName); - return this._then(caller, undefined, undefined, args, undefined); -}; - -function namedGetter(obj) { - return obj[this]; -} -function indexedGetter(obj) { - var index = +this; - if (index < 0) index = Math.max(0, index + obj.length); - return obj[index]; -} -Promise.prototype.get = function (propertyName) { - var isIndex = (typeof propertyName === "number"); - var getter; - if (!isIndex) { - if (canEvaluate) { - var maybeGetter = getGetter(propertyName); - getter = maybeGetter !== null ? maybeGetter : namedGetter; - } else { - getter = namedGetter; - } - } else { - getter = indexedGetter; - } - return this._then(getter, undefined, undefined, propertyName, undefined); -}; -}; - -},{"./util":36}],6:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, PromiseArray, apiRejection, debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var async = Promise._async; - -Promise.prototype["break"] = Promise.prototype.cancel = function() { - if (!debug.cancellation()) return this._warn("cancellation is disabled"); - - var promise = this; - var child = promise; - while (promise._isCancellable()) { - if (!promise._cancelBy(child)) { - if (child._isFollowing()) { - child._followee().cancel(); - } else { - child._cancelBranched(); - } - break; - } - - var parent = promise._cancellationParent; - if (parent == null || !parent._isCancellable()) { - if (promise._isFollowing()) { - promise._followee().cancel(); - } else { - promise._cancelBranched(); - } - break; - } else { - if (promise._isFollowing()) promise._followee().cancel(); - promise._setWillBeCancelled(); - child = promise; - promise = parent; - } - } -}; - -Promise.prototype._branchHasCancelled = function() { - this._branchesRemainingToCancel--; -}; - -Promise.prototype._enoughBranchesHaveCancelled = function() { - return this._branchesRemainingToCancel === undefined || - this._branchesRemainingToCancel <= 0; -}; - -Promise.prototype._cancelBy = function(canceller) { - if (canceller === this) { - this._branchesRemainingToCancel = 0; - this._invokeOnCancel(); - return true; - } else { - this._branchHasCancelled(); - if (this._enoughBranchesHaveCancelled()) { - this._invokeOnCancel(); - return true; - } - } - return false; -}; - -Promise.prototype._cancelBranched = function() { - if (this._enoughBranchesHaveCancelled()) { - this._cancel(); - } -}; - -Promise.prototype._cancel = function() { - if (!this._isCancellable()) return; - this._setCancelled(); - async.invoke(this._cancelPromises, this, undefined); -}; - -Promise.prototype._cancelPromises = function() { - if (this._length() > 0) this._settlePromises(); -}; - -Promise.prototype._unsetOnCancel = function() { - this._onCancelField = undefined; -}; - -Promise.prototype._isCancellable = function() { - return this.isPending() && !this._isCancelled(); -}; - -Promise.prototype.isCancellable = function() { - return this.isPending() && !this.isCancelled(); -}; - -Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) { - if (util.isArray(onCancelCallback)) { - for (var i = 0; i < onCancelCallback.length; ++i) { - this._doInvokeOnCancel(onCancelCallback[i], internalOnly); - } - } else if (onCancelCallback !== undefined) { - if (typeof onCancelCallback === "function") { - if (!internalOnly) { - var e = tryCatch(onCancelCallback).call(this._boundValue()); - if (e === errorObj) { - this._attachExtraTrace(e.e); - async.throwLater(e.e); - } - } - } else { - onCancelCallback._resultCancelled(this); - } - } -}; - -Promise.prototype._invokeOnCancel = function() { - var onCancelCallback = this._onCancel(); - this._unsetOnCancel(); - async.invoke(this._doInvokeOnCancel, this, onCancelCallback); -}; - -Promise.prototype._invokeInternalOnCancel = function() { - if (this._isCancellable()) { - this._doInvokeOnCancel(this._onCancel(), true); - this._unsetOnCancel(); - } -}; - -Promise.prototype._resultCancelled = function() { - this.cancel(); -}; - -}; - -},{"./util":36}],7:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(NEXT_FILTER) { -var util = _dereq_("./util"); -var getKeys = _dereq_("./es5").keys; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function catchFilter(instances, cb, promise) { - return function(e) { - var boundTo = promise._boundValue(); - predicateLoop: for (var i = 0; i < instances.length; ++i) { - var item = instances[i]; - - if (item === Error || - (item != null && item.prototype instanceof Error)) { - if (e instanceof item) { - return tryCatch(cb).call(boundTo, e); - } - } else if (typeof item === "function") { - var matchesPredicate = tryCatch(item).call(boundTo, e); - if (matchesPredicate === errorObj) { - return matchesPredicate; - } else if (matchesPredicate) { - return tryCatch(cb).call(boundTo, e); - } - } else if (util.isObject(e)) { - var keys = getKeys(item); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; - if (item[key] != e[key]) { - continue predicateLoop; - } - } - return tryCatch(cb).call(boundTo, e); - } - } - return NEXT_FILTER; - }; -} - -return catchFilter; -}; - -},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var longStackTraces = false; -var contextStack = []; - -Promise.prototype._promiseCreated = function() {}; -Promise.prototype._pushContext = function() {}; -Promise.prototype._popContext = function() {return null;}; -Promise._peekContext = Promise.prototype._peekContext = function() {}; - -function Context() { - this._trace = new Context.CapturedTrace(peekContext()); -} -Context.prototype._pushContext = function () { - if (this._trace !== undefined) { - this._trace._promiseCreated = null; - contextStack.push(this._trace); - } -}; - -Context.prototype._popContext = function () { - if (this._trace !== undefined) { - var trace = contextStack.pop(); - var ret = trace._promiseCreated; - trace._promiseCreated = null; - return ret; - } - return null; -}; - -function createContext() { - if (longStackTraces) return new Context(); -} - -function peekContext() { - var lastIndex = contextStack.length - 1; - if (lastIndex >= 0) { - return contextStack[lastIndex]; - } - return undefined; -} -Context.CapturedTrace = null; -Context.create = createContext; -Context.deactivateLongStackTraces = function() {}; -Context.activateLongStackTraces = function() { - var Promise_pushContext = Promise.prototype._pushContext; - var Promise_popContext = Promise.prototype._popContext; - var Promise_PeekContext = Promise._peekContext; - var Promise_peekContext = Promise.prototype._peekContext; - var Promise_promiseCreated = Promise.prototype._promiseCreated; - Context.deactivateLongStackTraces = function() { - Promise.prototype._pushContext = Promise_pushContext; - Promise.prototype._popContext = Promise_popContext; - Promise._peekContext = Promise_PeekContext; - Promise.prototype._peekContext = Promise_peekContext; - Promise.prototype._promiseCreated = Promise_promiseCreated; - longStackTraces = false; - }; - longStackTraces = true; - Promise.prototype._pushContext = Context.prototype._pushContext; - Promise.prototype._popContext = Context.prototype._popContext; - Promise._peekContext = Promise.prototype._peekContext = peekContext; - Promise.prototype._promiseCreated = function() { - var ctx = this._peekContext(); - if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; - }; -}; -return Context; -}; - -},{}],9:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, Context) { -var getDomain = Promise._getDomain; -var async = Promise._async; -var Warning = _dereq_("./errors").Warning; -var util = _dereq_("./util"); -var es5 = _dereq_("./es5"); -var canAttachTrace = util.canAttachTrace; -var unhandledRejectionHandled; -var possiblyUnhandledRejection; -var bluebirdFramePattern = - /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; -var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; -var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; -var stackFramePattern = null; -var formatStack = null; -var indentStackFrames = false; -var printWarning; -var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && - (true || - util.env("BLUEBIRD_DEBUG") || - util.env("NODE_ENV") === "development")); - -var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && - (debugging || util.env("BLUEBIRD_WARNINGS"))); - -var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && - (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES"))); - -var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && - (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); - -Promise.prototype.suppressUnhandledRejections = function() { - var target = this._target(); - target._bitField = ((target._bitField & (~1048576)) | - 524288); -}; - -Promise.prototype._ensurePossibleRejectionHandled = function () { - if ((this._bitField & 524288) !== 0) return; - this._setRejectionIsUnhandled(); - var self = this; - setTimeout(function() { - self._notifyUnhandledRejection(); - }, 1); -}; - -Promise.prototype._notifyUnhandledRejectionIsHandled = function () { - fireRejectionEvent("rejectionHandled", - unhandledRejectionHandled, undefined, this); -}; - -Promise.prototype._setReturnedNonUndefined = function() { - this._bitField = this._bitField | 268435456; -}; - -Promise.prototype._returnedNonUndefined = function() { - return (this._bitField & 268435456) !== 0; -}; - -Promise.prototype._notifyUnhandledRejection = function () { - if (this._isRejectionUnhandled()) { - var reason = this._settledValue(); - this._setUnhandledRejectionIsNotified(); - fireRejectionEvent("unhandledRejection", - possiblyUnhandledRejection, reason, this); - } -}; - -Promise.prototype._setUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField | 262144; -}; - -Promise.prototype._unsetUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField & (~262144); -}; - -Promise.prototype._isUnhandledRejectionNotified = function () { - return (this._bitField & 262144) > 0; -}; - -Promise.prototype._setRejectionIsUnhandled = function () { - this._bitField = this._bitField | 1048576; -}; - -Promise.prototype._unsetRejectionIsUnhandled = function () { - this._bitField = this._bitField & (~1048576); - if (this._isUnhandledRejectionNotified()) { - this._unsetUnhandledRejectionIsNotified(); - this._notifyUnhandledRejectionIsHandled(); - } -}; - -Promise.prototype._isRejectionUnhandled = function () { - return (this._bitField & 1048576) > 0; -}; - -Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { - return warn(message, shouldUseOwnTrace, promise || this); -}; - -Promise.onPossiblyUnhandledRejection = function (fn) { - var domain = getDomain(); - possiblyUnhandledRejection = - typeof fn === "function" ? (domain === null ? - fn : util.domainBind(domain, fn)) - : undefined; -}; - -Promise.onUnhandledRejectionHandled = function (fn) { - var domain = getDomain(); - unhandledRejectionHandled = - typeof fn === "function" ? (domain === null ? - fn : util.domainBind(domain, fn)) - : undefined; -}; - -var disableLongStackTraces = function() {}; -Promise.longStackTraces = function () { - if (async.haveItemsQueued() && !config.longStackTraces) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - if (!config.longStackTraces && longStackTracesIsSupported()) { - var Promise_captureStackTrace = Promise.prototype._captureStackTrace; - var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace; - var Promise_dereferenceTrace = Promise.prototype._dereferenceTrace; - config.longStackTraces = true; - disableLongStackTraces = function() { - if (async.haveItemsQueued() && !config.longStackTraces) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - Promise.prototype._captureStackTrace = Promise_captureStackTrace; - Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; - Promise.prototype._dereferenceTrace = Promise_dereferenceTrace; - Context.deactivateLongStackTraces(); - async.enableTrampoline(); - config.longStackTraces = false; - }; - Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; - Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; - Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace; - Context.activateLongStackTraces(); - async.disableTrampolineIfNecessary(); - } -}; - -Promise.hasLongStackTraces = function () { - return config.longStackTraces && longStackTracesIsSupported(); -}; - -var fireDomEvent = (function() { - try { - if (typeof CustomEvent === "function") { - var event = new CustomEvent("CustomEvent"); - util.global.dispatchEvent(event); - return function(name, event) { - var eventData = { - detail: event, - cancelable: true - }; - es5.defineProperty( - eventData, "promise", {value: event.promise}); - es5.defineProperty(eventData, "reason", {value: event.reason}); - var domEvent = new CustomEvent(name.toLowerCase(), eventData); - return !util.global.dispatchEvent(domEvent); - }; - } else if (typeof Event === "function") { - var event = new Event("CustomEvent"); - util.global.dispatchEvent(event); - return function(name, event) { - var domEvent = new Event(name.toLowerCase(), { - cancelable: true - }); - domEvent.detail = event; - es5.defineProperty(domEvent, "promise", {value: event.promise}); - es5.defineProperty(domEvent, "reason", {value: event.reason}); - return !util.global.dispatchEvent(domEvent); - }; - } else { - var event = document.createEvent("CustomEvent"); - event.initCustomEvent("testingtheevent", false, true, {}); - util.global.dispatchEvent(event); - return function(name, event) { - var domEvent = document.createEvent("CustomEvent"); - domEvent.initCustomEvent(name.toLowerCase(), false, true, - event); - return !util.global.dispatchEvent(domEvent); - }; - } - } catch (e) {} - return function() { - return false; - }; -})(); - -var fireGlobalEvent = (function() { - if (util.isNode) { - return function() { - return process.emit.apply(process, arguments); - }; - } else { - if (!util.global) { - return function() { - return false; - }; - } - return function(name) { - var methodName = "on" + name.toLowerCase(); - var method = util.global[methodName]; - if (!method) return false; - method.apply(util.global, [].slice.call(arguments, 1)); - return true; - }; - } -})(); - -function generatePromiseLifecycleEventObject(name, promise) { - return {promise: promise}; -} - -var eventToObjectGenerator = { - promiseCreated: generatePromiseLifecycleEventObject, - promiseFulfilled: generatePromiseLifecycleEventObject, - promiseRejected: generatePromiseLifecycleEventObject, - promiseResolved: generatePromiseLifecycleEventObject, - promiseCancelled: generatePromiseLifecycleEventObject, - promiseChained: function(name, promise, child) { - return {promise: promise, child: child}; - }, - warning: function(name, warning) { - return {warning: warning}; - }, - unhandledRejection: function (name, reason, promise) { - return {reason: reason, promise: promise}; - }, - rejectionHandled: generatePromiseLifecycleEventObject -}; - -var activeFireEvent = function (name) { - var globalEventFired = false; - try { - globalEventFired = fireGlobalEvent.apply(null, arguments); - } catch (e) { - async.throwLater(e); - globalEventFired = true; - } - - var domEventFired = false; - try { - domEventFired = fireDomEvent(name, - eventToObjectGenerator[name].apply(null, arguments)); - } catch (e) { - async.throwLater(e); - domEventFired = true; - } - - return domEventFired || globalEventFired; -}; - -Promise.config = function(opts) { - opts = Object(opts); - if ("longStackTraces" in opts) { - if (opts.longStackTraces) { - Promise.longStackTraces(); - } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) { - disableLongStackTraces(); - } - } - if ("warnings" in opts) { - var warningsOption = opts.warnings; - config.warnings = !!warningsOption; - wForgottenReturn = config.warnings; - - if (util.isObject(warningsOption)) { - if ("wForgottenReturn" in warningsOption) { - wForgottenReturn = !!warningsOption.wForgottenReturn; - } - } - } - if ("cancellation" in opts && opts.cancellation && !config.cancellation) { - if (async.haveItemsQueued()) { - throw new Error( - "cannot enable cancellation after promises are in use"); - } - Promise.prototype._clearCancellationData = - cancellationClearCancellationData; - Promise.prototype._propagateFrom = cancellationPropagateFrom; - Promise.prototype._onCancel = cancellationOnCancel; - Promise.prototype._setOnCancel = cancellationSetOnCancel; - Promise.prototype._attachCancellationCallback = - cancellationAttachCancellationCallback; - Promise.prototype._execute = cancellationExecute; - propagateFromFunction = cancellationPropagateFrom; - config.cancellation = true; - } - if ("monitoring" in opts) { - if (opts.monitoring && !config.monitoring) { - config.monitoring = true; - Promise.prototype._fireEvent = activeFireEvent; - } else if (!opts.monitoring && config.monitoring) { - config.monitoring = false; - Promise.prototype._fireEvent = defaultFireEvent; - } - } - return Promise; -}; - -function defaultFireEvent() { return false; } - -Promise.prototype._fireEvent = defaultFireEvent; -Promise.prototype._execute = function(executor, resolve, reject) { - try { - executor(resolve, reject); - } catch (e) { - return e; - } -}; -Promise.prototype._onCancel = function () {}; -Promise.prototype._setOnCancel = function (handler) { ; }; -Promise.prototype._attachCancellationCallback = function(onCancel) { - ; -}; -Promise.prototype._captureStackTrace = function () {}; -Promise.prototype._attachExtraTrace = function () {}; -Promise.prototype._dereferenceTrace = function () {}; -Promise.prototype._clearCancellationData = function() {}; -Promise.prototype._propagateFrom = function (parent, flags) { - ; - ; -}; - -function cancellationExecute(executor, resolve, reject) { - var promise = this; - try { - executor(resolve, reject, function(onCancel) { - if (typeof onCancel !== "function") { - throw new TypeError("onCancel must be a function, got: " + - util.toString(onCancel)); - } - promise._attachCancellationCallback(onCancel); - }); - } catch (e) { - return e; - } -} - -function cancellationAttachCancellationCallback(onCancel) { - if (!this._isCancellable()) return this; - - var previousOnCancel = this._onCancel(); - if (previousOnCancel !== undefined) { - if (util.isArray(previousOnCancel)) { - previousOnCancel.push(onCancel); - } else { - this._setOnCancel([previousOnCancel, onCancel]); - } - } else { - this._setOnCancel(onCancel); - } -} - -function cancellationOnCancel() { - return this._onCancelField; -} - -function cancellationSetOnCancel(onCancel) { - this._onCancelField = onCancel; -} - -function cancellationClearCancellationData() { - this._cancellationParent = undefined; - this._onCancelField = undefined; -} - -function cancellationPropagateFrom(parent, flags) { - if ((flags & 1) !== 0) { - this._cancellationParent = parent; - var branchesRemainingToCancel = parent._branchesRemainingToCancel; - if (branchesRemainingToCancel === undefined) { - branchesRemainingToCancel = 0; - } - parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; - } - if ((flags & 2) !== 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -} - -function bindingPropagateFrom(parent, flags) { - if ((flags & 2) !== 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -} -var propagateFromFunction = bindingPropagateFrom; - -function boundValueFunction() { - var ret = this._boundTo; - if (ret !== undefined) { - if (ret instanceof Promise) { - if (ret.isFulfilled()) { - return ret.value(); - } else { - return undefined; - } - } - } - return ret; -} - -function longStackTracesCaptureStackTrace() { - this._trace = new CapturedTrace(this._peekContext()); -} - -function longStackTracesAttachExtraTrace(error, ignoreSelf) { - if (canAttachTrace(error)) { - var trace = this._trace; - if (trace !== undefined) { - if (ignoreSelf) trace = trace._parent; - } - if (trace !== undefined) { - trace.attachExtraTrace(error); - } else if (!error.__stackCleaned__) { - var parsed = parseStackAndMessage(error); - util.notEnumerableProp(error, "stack", - parsed.message + "\n" + parsed.stack.join("\n")); - util.notEnumerableProp(error, "__stackCleaned__", true); - } - } -} - -function longStackTracesDereferenceTrace() { - this._trace = undefined; -} - -function checkForgottenReturns(returnValue, promiseCreated, name, promise, - parent) { - if (returnValue === undefined && promiseCreated !== null && - wForgottenReturn) { - if (parent !== undefined && parent._returnedNonUndefined()) return; - if ((promise._bitField & 65535) === 0) return; - - if (name) name = name + " "; - var handlerLine = ""; - var creatorLine = ""; - if (promiseCreated._trace) { - var traceLines = promiseCreated._trace.stack.split("\n"); - var stack = cleanStack(traceLines); - for (var i = stack.length - 1; i >= 0; --i) { - var line = stack[i]; - if (!nodeFramePattern.test(line)) { - var lineMatches = line.match(parseLinePattern); - if (lineMatches) { - handlerLine = "at " + lineMatches[1] + - ":" + lineMatches[2] + ":" + lineMatches[3] + " "; - } - break; - } - } - - if (stack.length > 0) { - var firstUserLine = stack[0]; - for (var i = 0; i < traceLines.length; ++i) { - - if (traceLines[i] === firstUserLine) { - if (i > 0) { - creatorLine = "\n" + traceLines[i - 1]; - } - break; - } - } - - } - } - var msg = "a promise was created in a " + name + - "handler " + handlerLine + "but was not returned from it, " + - "see http://goo.gl/rRqMUw" + - creatorLine; - promise._warn(msg, true, promiseCreated); - } -} - -function deprecated(name, replacement) { - var message = name + - " is deprecated and will be removed in a future version."; - if (replacement) message += " Use " + replacement + " instead."; - return warn(message); -} - -function warn(message, shouldUseOwnTrace, promise) { - if (!config.warnings) return; - var warning = new Warning(message); - var ctx; - if (shouldUseOwnTrace) { - promise._attachExtraTrace(warning); - } else if (config.longStackTraces && (ctx = Promise._peekContext())) { - ctx.attachExtraTrace(warning); - } else { - var parsed = parseStackAndMessage(warning); - warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); - } - - if (!activeFireEvent("warning", warning)) { - formatAndLogError(warning, "", true); - } -} - -function reconstructStack(message, stacks) { - for (var i = 0; i < stacks.length - 1; ++i) { - stacks[i].push("From previous event:"); - stacks[i] = stacks[i].join("\n"); - } - if (i < stacks.length) { - stacks[i] = stacks[i].join("\n"); - } - return message + "\n" + stacks.join("\n"); -} - -function removeDuplicateOrEmptyJumps(stacks) { - for (var i = 0; i < stacks.length; ++i) { - if (stacks[i].length === 0 || - ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { - stacks.splice(i, 1); - i--; - } - } -} - -function removeCommonRoots(stacks) { - var current = stacks[0]; - for (var i = 1; i < stacks.length; ++i) { - var prev = stacks[i]; - var currentLastIndex = current.length - 1; - var currentLastLine = current[currentLastIndex]; - var commonRootMeetPoint = -1; - - for (var j = prev.length - 1; j >= 0; --j) { - if (prev[j] === currentLastLine) { - commonRootMeetPoint = j; - break; - } - } - - for (var j = commonRootMeetPoint; j >= 0; --j) { - var line = prev[j]; - if (current[currentLastIndex] === line) { - current.pop(); - currentLastIndex--; - } else { - break; - } - } - current = prev; - } -} - -function cleanStack(stack) { - var ret = []; - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - var isTraceLine = " (No stack trace)" === line || - stackFramePattern.test(line); - var isInternalFrame = isTraceLine && shouldIgnore(line); - if (isTraceLine && !isInternalFrame) { - if (indentStackFrames && line.charAt(0) !== " ") { - line = " " + line; - } - ret.push(line); - } - } - return ret; -} - -function stackFramesAsArray(error) { - var stack = error.stack.replace(/\s+$/g, "").split("\n"); - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - if (" (No stack trace)" === line || stackFramePattern.test(line)) { - break; - } - } - if (i > 0 && error.name != "SyntaxError") { - stack = stack.slice(i); - } - return stack; -} - -function parseStackAndMessage(error) { - var stack = error.stack; - var message = error.toString(); - stack = typeof stack === "string" && stack.length > 0 - ? stackFramesAsArray(error) : [" (No stack trace)"]; - return { - message: message, - stack: error.name == "SyntaxError" ? stack : cleanStack(stack) - }; -} - -function formatAndLogError(error, title, isSoft) { - if (typeof console !== "undefined") { - var message; - if (util.isObject(error)) { - var stack = error.stack; - message = title + formatStack(stack, error); - } else { - message = title + String(error); - } - if (typeof printWarning === "function") { - printWarning(message, isSoft); - } else if (typeof console.log === "function" || - typeof console.log === "object") { - console.log(message); - } - } -} - -function fireRejectionEvent(name, localHandler, reason, promise) { - var localEventFired = false; - try { - if (typeof localHandler === "function") { - localEventFired = true; - if (name === "rejectionHandled") { - localHandler(promise); - } else { - localHandler(reason, promise); - } - } - } catch (e) { - async.throwLater(e); - } - - if (name === "unhandledRejection") { - if (!activeFireEvent(name, reason, promise) && !localEventFired) { - formatAndLogError(reason, "Unhandled rejection "); - } - } else { - activeFireEvent(name, promise); - } -} - -function formatNonError(obj) { - var str; - if (typeof obj === "function") { - str = "[function " + - (obj.name || "anonymous") + - "]"; - } else { - str = obj && typeof obj.toString === "function" - ? obj.toString() : util.toString(obj); - var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; - if (ruselessToString.test(str)) { - try { - var newStr = JSON.stringify(obj); - str = newStr; - } - catch(e) { - - } - } - if (str.length === 0) { - str = "(empty array)"; - } - } - return ("(<" + snip(str) + ">, no stack trace)"); -} - -function snip(str) { - var maxChars = 41; - if (str.length < maxChars) { - return str; - } - return str.substr(0, maxChars - 3) + "..."; -} - -function longStackTracesIsSupported() { - return typeof captureStackTrace === "function"; -} - -var shouldIgnore = function() { return false; }; -var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; -function parseLineInfo(line) { - var matches = line.match(parseLineInfoRegex); - if (matches) { - return { - fileName: matches[1], - line: parseInt(matches[2], 10) - }; - } -} - -function setBounds(firstLineError, lastLineError) { - if (!longStackTracesIsSupported()) return; - var firstStackLines = (firstLineError.stack || "").split("\n"); - var lastStackLines = (lastLineError.stack || "").split("\n"); - var firstIndex = -1; - var lastIndex = -1; - var firstFileName; - var lastFileName; - for (var i = 0; i < firstStackLines.length; ++i) { - var result = parseLineInfo(firstStackLines[i]); - if (result) { - firstFileName = result.fileName; - firstIndex = result.line; - break; - } - } - for (var i = 0; i < lastStackLines.length; ++i) { - var result = parseLineInfo(lastStackLines[i]); - if (result) { - lastFileName = result.fileName; - lastIndex = result.line; - break; - } - } - if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || - firstFileName !== lastFileName || firstIndex >= lastIndex) { - return; - } - - shouldIgnore = function(line) { - if (bluebirdFramePattern.test(line)) return true; - var info = parseLineInfo(line); - if (info) { - if (info.fileName === firstFileName && - (firstIndex <= info.line && info.line <= lastIndex)) { - return true; - } - } - return false; - }; -} - -function CapturedTrace(parent) { - this._parent = parent; - this._promisesCreated = 0; - var length = this._length = 1 + (parent === undefined ? 0 : parent._length); - captureStackTrace(this, CapturedTrace); - if (length > 32) this.uncycle(); -} -util.inherits(CapturedTrace, Error); -Context.CapturedTrace = CapturedTrace; - -CapturedTrace.prototype.uncycle = function() { - var length = this._length; - if (length < 2) return; - var nodes = []; - var stackToIndex = {}; - - for (var i = 0, node = this; node !== undefined; ++i) { - nodes.push(node); - node = node._parent; - } - length = this._length = i; - for (var i = length - 1; i >= 0; --i) { - var stack = nodes[i].stack; - if (stackToIndex[stack] === undefined) { - stackToIndex[stack] = i; - } - } - for (var i = 0; i < length; ++i) { - var currentStack = nodes[i].stack; - var index = stackToIndex[currentStack]; - if (index !== undefined && index !== i) { - if (index > 0) { - nodes[index - 1]._parent = undefined; - nodes[index - 1]._length = 1; - } - nodes[i]._parent = undefined; - nodes[i]._length = 1; - var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; - - if (index < length - 1) { - cycleEdgeNode._parent = nodes[index + 1]; - cycleEdgeNode._parent.uncycle(); - cycleEdgeNode._length = - cycleEdgeNode._parent._length + 1; - } else { - cycleEdgeNode._parent = undefined; - cycleEdgeNode._length = 1; - } - var currentChildLength = cycleEdgeNode._length + 1; - for (var j = i - 2; j >= 0; --j) { - nodes[j]._length = currentChildLength; - currentChildLength++; - } - return; - } - } -}; - -CapturedTrace.prototype.attachExtraTrace = function(error) { - if (error.__stackCleaned__) return; - this.uncycle(); - var parsed = parseStackAndMessage(error); - var message = parsed.message; - var stacks = [parsed.stack]; - - var trace = this; - while (trace !== undefined) { - stacks.push(cleanStack(trace.stack.split("\n"))); - trace = trace._parent; - } - removeCommonRoots(stacks); - removeDuplicateOrEmptyJumps(stacks); - util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); - util.notEnumerableProp(error, "__stackCleaned__", true); -}; - -var captureStackTrace = (function stackDetection() { - var v8stackFramePattern = /^\s*at\s*/; - var v8stackFormatter = function(stack, error) { - if (typeof stack === "string") return stack; - - if (error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - if (typeof Error.stackTraceLimit === "number" && - typeof Error.captureStackTrace === "function") { - Error.stackTraceLimit += 6; - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - var captureStackTrace = Error.captureStackTrace; - - shouldIgnore = function(line) { - return bluebirdFramePattern.test(line); - }; - return function(receiver, ignoreUntil) { - Error.stackTraceLimit += 6; - captureStackTrace(receiver, ignoreUntil); - Error.stackTraceLimit -= 6; - }; - } - var err = new Error(); - - if (typeof err.stack === "string" && - err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { - stackFramePattern = /@/; - formatStack = v8stackFormatter; - indentStackFrames = true; - return function captureStackTrace(o) { - o.stack = new Error().stack; - }; - } - - var hasStackAfterThrow; - try { throw new Error(); } - catch(e) { - hasStackAfterThrow = ("stack" in e); - } - if (!("stack" in err) && hasStackAfterThrow && - typeof Error.stackTraceLimit === "number") { - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - return function captureStackTrace(o) { - Error.stackTraceLimit += 6; - try { throw new Error(); } - catch(e) { o.stack = e.stack; } - Error.stackTraceLimit -= 6; - }; - } - - formatStack = function(stack, error) { - if (typeof stack === "string") return stack; - - if ((typeof error === "object" || - typeof error === "function") && - error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - return null; - -})([]); - -if (typeof console !== "undefined" && typeof console.warn !== "undefined") { - printWarning = function (message) { - console.warn(message); - }; - if (util.isNode && process.stderr.isTTY) { - printWarning = function(message, isSoft) { - var color = isSoft ? "\u001b[33m" : "\u001b[31m"; - console.warn(color + message + "\u001b[0m\n"); - }; - } else if (!util.isNode && typeof (new Error().stack) === "string") { - printWarning = function(message, isSoft) { - console.warn("%c" + message, - isSoft ? "color: darkorange" : "color: red"); - }; - } -} - -var config = { - warnings: warnings, - longStackTraces: false, - cancellation: false, - monitoring: false -}; - -if (longStackTraces) Promise.longStackTraces(); - -return { - longStackTraces: function() { - return config.longStackTraces; - }, - warnings: function() { - return config.warnings; - }, - cancellation: function() { - return config.cancellation; - }, - monitoring: function() { - return config.monitoring; - }, - propagateFromFunction: function() { - return propagateFromFunction; - }, - boundValueFunction: function() { - return boundValueFunction; - }, - checkForgottenReturns: checkForgottenReturns, - setBounds: setBounds, - warn: warn, - deprecated: deprecated, - CapturedTrace: CapturedTrace, - fireDomEvent: fireDomEvent, - fireGlobalEvent: fireGlobalEvent -}; -}; - -},{"./errors":12,"./es5":13,"./util":36}],10:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -function returner() { - return this.value; -} -function thrower() { - throw this.reason; -} - -Promise.prototype["return"] = -Promise.prototype.thenReturn = function (value) { - if (value instanceof Promise) value.suppressUnhandledRejections(); - return this._then( - returner, undefined, undefined, {value: value}, undefined); -}; - -Promise.prototype["throw"] = -Promise.prototype.thenThrow = function (reason) { - return this._then( - thrower, undefined, undefined, {reason: reason}, undefined); -}; - -Promise.prototype.catchThrow = function (reason) { - if (arguments.length <= 1) { - return this._then( - undefined, thrower, undefined, {reason: reason}, undefined); - } else { - var _reason = arguments[1]; - var handler = function() {throw _reason;}; - return this.caught(reason, handler); - } -}; - -Promise.prototype.catchReturn = function (value) { - if (arguments.length <= 1) { - if (value instanceof Promise) value.suppressUnhandledRejections(); - return this._then( - undefined, returner, undefined, {value: value}, undefined); - } else { - var _value = arguments[1]; - if (_value instanceof Promise) _value.suppressUnhandledRejections(); - var handler = function() {return _value;}; - return this.caught(value, handler); - } -}; -}; - -},{}],11:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseReduce = Promise.reduce; -var PromiseAll = Promise.all; - -function promiseAllThis() { - return PromiseAll(this); -} - -function PromiseMapSeries(promises, fn) { - return PromiseReduce(promises, fn, INTERNAL, INTERNAL); -} - -Promise.prototype.each = function (fn) { - return PromiseReduce(this, fn, INTERNAL, 0) - ._then(promiseAllThis, undefined, undefined, this, undefined); -}; - -Promise.prototype.mapSeries = function (fn) { - return PromiseReduce(this, fn, INTERNAL, INTERNAL); -}; - -Promise.each = function (promises, fn) { - return PromiseReduce(promises, fn, INTERNAL, 0) - ._then(promiseAllThis, undefined, undefined, promises, undefined); -}; - -Promise.mapSeries = PromiseMapSeries; -}; - - -},{}],12:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5"); -var Objectfreeze = es5.freeze; -var util = _dereq_("./util"); -var inherits = util.inherits; -var notEnumerableProp = util.notEnumerableProp; - -function subError(nameProperty, defaultMessage) { - function SubError(message) { - if (!(this instanceof SubError)) return new SubError(message); - notEnumerableProp(this, "message", - typeof message === "string" ? message : defaultMessage); - notEnumerableProp(this, "name", nameProperty); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - Error.call(this); - } - } - inherits(SubError, Error); - return SubError; -} - -var _TypeError, _RangeError; -var Warning = subError("Warning", "warning"); -var CancellationError = subError("CancellationError", "cancellation error"); -var TimeoutError = subError("TimeoutError", "timeout error"); -var AggregateError = subError("AggregateError", "aggregate error"); -try { - _TypeError = TypeError; - _RangeError = RangeError; -} catch(e) { - _TypeError = subError("TypeError", "type error"); - _RangeError = subError("RangeError", "range error"); -} - -var methods = ("join pop push shift unshift slice filter forEach some " + - "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); - -for (var i = 0; i < methods.length; ++i) { - if (typeof Array.prototype[methods[i]] === "function") { - AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; - } -} - -es5.defineProperty(AggregateError.prototype, "length", { - value: 0, - configurable: false, - writable: true, - enumerable: true -}); -AggregateError.prototype["isOperational"] = true; -var level = 0; -AggregateError.prototype.toString = function() { - var indent = Array(level * 4 + 1).join(" "); - var ret = "\n" + indent + "AggregateError of:" + "\n"; - level++; - indent = Array(level * 4 + 1).join(" "); - for (var i = 0; i < this.length; ++i) { - var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; - var lines = str.split("\n"); - for (var j = 0; j < lines.length; ++j) { - lines[j] = indent + lines[j]; - } - str = lines.join("\n"); - ret += str + "\n"; - } - level--; - return ret; -}; - -function OperationalError(message) { - if (!(this instanceof OperationalError)) - return new OperationalError(message); - notEnumerableProp(this, "name", "OperationalError"); - notEnumerableProp(this, "message", message); - this.cause = message; - this["isOperational"] = true; - - if (message instanceof Error) { - notEnumerableProp(this, "message", message.message); - notEnumerableProp(this, "stack", message.stack); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } - -} -inherits(OperationalError, Error); - -var errorTypes = Error["__BluebirdErrorTypes__"]; -if (!errorTypes) { - errorTypes = Objectfreeze({ - CancellationError: CancellationError, - TimeoutError: TimeoutError, - OperationalError: OperationalError, - RejectionError: OperationalError, - AggregateError: AggregateError - }); - es5.defineProperty(Error, "__BluebirdErrorTypes__", { - value: errorTypes, - writable: false, - enumerable: false, - configurable: false - }); -} - -module.exports = { - Error: Error, - TypeError: _TypeError, - RangeError: _RangeError, - CancellationError: errorTypes.CancellationError, - OperationalError: errorTypes.OperationalError, - TimeoutError: errorTypes.TimeoutError, - AggregateError: errorTypes.AggregateError, - Warning: Warning -}; - -},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){ -var isES5 = (function(){ - "use strict"; - return this === undefined; -})(); - -if (isES5) { - module.exports = { - freeze: Object.freeze, - defineProperty: Object.defineProperty, - getDescriptor: Object.getOwnPropertyDescriptor, - keys: Object.keys, - names: Object.getOwnPropertyNames, - getPrototypeOf: Object.getPrototypeOf, - isArray: Array.isArray, - isES5: isES5, - propertyIsWritable: function(obj, prop) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop); - return !!(!descriptor || descriptor.writable || descriptor.set); - } - }; -} else { - var has = {}.hasOwnProperty; - var str = {}.toString; - var proto = {}.constructor.prototype; - - var ObjectKeys = function (o) { - var ret = []; - for (var key in o) { - if (has.call(o, key)) { - ret.push(key); - } - } - return ret; - }; - - var ObjectGetDescriptor = function(o, key) { - return {value: o[key]}; - }; - - var ObjectDefineProperty = function (o, key, desc) { - o[key] = desc.value; - return o; - }; - - var ObjectFreeze = function (obj) { - return obj; - }; - - var ObjectGetPrototypeOf = function (obj) { - try { - return Object(obj).constructor.prototype; - } - catch (e) { - return proto; - } - }; - - var ArrayIsArray = function (obj) { - try { - return str.call(obj) === "[object Array]"; - } - catch(e) { - return false; - } - }; - - module.exports = { - isArray: ArrayIsArray, - keys: ObjectKeys, - names: ObjectKeys, - defineProperty: ObjectDefineProperty, - getDescriptor: ObjectGetDescriptor, - freeze: ObjectFreeze, - getPrototypeOf: ObjectGetPrototypeOf, - isES5: isES5, - propertyIsWritable: function() { - return true; - } - }; -} - -},{}],14:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseMap = Promise.map; - -Promise.prototype.filter = function (fn, options) { - return PromiseMap(this, fn, options, INTERNAL); -}; - -Promise.filter = function (promises, fn, options) { - return PromiseMap(promises, fn, options, INTERNAL); -}; -}; - -},{}],15:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) { -var util = _dereq_("./util"); -var CancellationError = Promise.CancellationError; -var errorObj = util.errorObj; -var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); - -function PassThroughHandlerContext(promise, type, handler) { - this.promise = promise; - this.type = type; - this.handler = handler; - this.called = false; - this.cancelPromise = null; -} - -PassThroughHandlerContext.prototype.isFinallyHandler = function() { - return this.type === 0; -}; - -function FinallyHandlerCancelReaction(finallyHandler) { - this.finallyHandler = finallyHandler; -} - -FinallyHandlerCancelReaction.prototype._resultCancelled = function() { - checkCancel(this.finallyHandler); -}; - -function checkCancel(ctx, reason) { - if (ctx.cancelPromise != null) { - if (arguments.length > 1) { - ctx.cancelPromise._reject(reason); - } else { - ctx.cancelPromise._cancel(); - } - ctx.cancelPromise = null; - return true; - } - return false; -} - -function succeed() { - return finallyHandler.call(this, this.promise._target()._settledValue()); -} -function fail(reason) { - if (checkCancel(this, reason)) return; - errorObj.e = reason; - return errorObj; -} -function finallyHandler(reasonOrValue) { - var promise = this.promise; - var handler = this.handler; - - if (!this.called) { - this.called = true; - var ret = this.isFinallyHandler() - ? handler.call(promise._boundValue()) - : handler.call(promise._boundValue(), reasonOrValue); - if (ret === NEXT_FILTER) { - return ret; - } else if (ret !== undefined) { - promise._setReturnedNonUndefined(); - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - if (this.cancelPromise != null) { - if (maybePromise._isCancelled()) { - var reason = - new CancellationError("late cancellation observer"); - promise._attachExtraTrace(reason); - errorObj.e = reason; - return errorObj; - } else if (maybePromise.isPending()) { - maybePromise._attachCancellationCallback( - new FinallyHandlerCancelReaction(this)); - } - } - return maybePromise._then( - succeed, fail, undefined, this, undefined); - } - } - } - - if (promise.isRejected()) { - checkCancel(this); - errorObj.e = reasonOrValue; - return errorObj; - } else { - checkCancel(this); - return reasonOrValue; - } -} - -Promise.prototype._passThrough = function(handler, type, success, fail) { - if (typeof handler !== "function") return this.then(); - return this._then(success, - fail, - undefined, - new PassThroughHandlerContext(this, type, handler), - undefined); -}; - -Promise.prototype.lastly = -Promise.prototype["finally"] = function (handler) { - return this._passThrough(handler, - 0, - finallyHandler, - finallyHandler); -}; - - -Promise.prototype.tap = function (handler) { - return this._passThrough(handler, 1, finallyHandler); -}; - -Promise.prototype.tapCatch = function (handlerOrPredicate) { - var len = arguments.length; - if(len === 1) { - return this._passThrough(handlerOrPredicate, - 1, - undefined, - finallyHandler); - } else { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (util.isObject(item)) { - catchInstances[j++] = item; - } else { - return Promise.reject(new TypeError( - "tapCatch statement predicate: " - + "expecting an object but got " + util.classString(item) - )); - } - } - catchInstances.length = j; - var handler = arguments[i]; - return this._passThrough(catchFilter(catchInstances, handler, this), - 1, - undefined, - finallyHandler); - } - -}; - -return PassThroughHandlerContext; -}; - -},{"./catch_filter":7,"./util":36}],16:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - apiRejection, - INTERNAL, - tryConvertToPromise, - Proxyable, - debug) { -var errors = _dereq_("./errors"); -var TypeError = errors.TypeError; -var util = _dereq_("./util"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -var yieldHandlers = []; - -function promiseFromYieldHandler(value, yieldHandlers, traceParent) { - for (var i = 0; i < yieldHandlers.length; ++i) { - traceParent._pushContext(); - var result = tryCatch(yieldHandlers[i])(value); - traceParent._popContext(); - if (result === errorObj) { - traceParent._pushContext(); - var ret = Promise.reject(errorObj.e); - traceParent._popContext(); - return ret; - } - var maybePromise = tryConvertToPromise(result, traceParent); - if (maybePromise instanceof Promise) return maybePromise; - } - return null; -} - -function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { - if (debug.cancellation()) { - var internal = new Promise(INTERNAL); - var _finallyPromise = this._finallyPromise = new Promise(INTERNAL); - this._promise = internal.lastly(function() { - return _finallyPromise; - }); - internal._captureStackTrace(); - internal._setOnCancel(this); - } else { - var promise = this._promise = new Promise(INTERNAL); - promise._captureStackTrace(); - } - this._stack = stack; - this._generatorFunction = generatorFunction; - this._receiver = receiver; - this._generator = undefined; - this._yieldHandlers = typeof yieldHandler === "function" - ? [yieldHandler].concat(yieldHandlers) - : yieldHandlers; - this._yieldedPromise = null; - this._cancellationPhase = false; -} -util.inherits(PromiseSpawn, Proxyable); - -PromiseSpawn.prototype._isResolved = function() { - return this._promise === null; -}; - -PromiseSpawn.prototype._cleanup = function() { - this._promise = this._generator = null; - if (debug.cancellation() && this._finallyPromise !== null) { - this._finallyPromise._fulfill(); - this._finallyPromise = null; - } -}; - -PromiseSpawn.prototype._promiseCancelled = function() { - if (this._isResolved()) return; - var implementsReturn = typeof this._generator["return"] !== "undefined"; - - var result; - if (!implementsReturn) { - var reason = new Promise.CancellationError( - "generator .return() sentinel"); - Promise.coroutine.returnSentinel = reason; - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - result = tryCatch(this._generator["throw"]).call(this._generator, - reason); - this._promise._popContext(); - } else { - this._promise._pushContext(); - result = tryCatch(this._generator["return"]).call(this._generator, - undefined); - this._promise._popContext(); - } - this._cancellationPhase = true; - this._yieldedPromise = null; - this._continue(result); -}; - -PromiseSpawn.prototype._promiseFulfilled = function(value) { - this._yieldedPromise = null; - this._promise._pushContext(); - var result = tryCatch(this._generator.next).call(this._generator, value); - this._promise._popContext(); - this._continue(result); -}; - -PromiseSpawn.prototype._promiseRejected = function(reason) { - this._yieldedPromise = null; - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - var result = tryCatch(this._generator["throw"]) - .call(this._generator, reason); - this._promise._popContext(); - this._continue(result); -}; - -PromiseSpawn.prototype._resultCancelled = function() { - if (this._yieldedPromise instanceof Promise) { - var promise = this._yieldedPromise; - this._yieldedPromise = null; - promise.cancel(); - } -}; - -PromiseSpawn.prototype.promise = function () { - return this._promise; -}; - -PromiseSpawn.prototype._run = function () { - this._generator = this._generatorFunction.call(this._receiver); - this._receiver = - this._generatorFunction = undefined; - this._promiseFulfilled(undefined); -}; - -PromiseSpawn.prototype._continue = function (result) { - var promise = this._promise; - if (result === errorObj) { - this._cleanup(); - if (this._cancellationPhase) { - return promise.cancel(); - } else { - return promise._rejectCallback(result.e, false); - } - } - - var value = result.value; - if (result.done === true) { - this._cleanup(); - if (this._cancellationPhase) { - return promise.cancel(); - } else { - return promise._resolveCallback(value); - } - } else { - var maybePromise = tryConvertToPromise(value, this._promise); - if (!(maybePromise instanceof Promise)) { - maybePromise = - promiseFromYieldHandler(maybePromise, - this._yieldHandlers, - this._promise); - if (maybePromise === null) { - this._promiseRejected( - new TypeError( - "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) + - "From coroutine:\u000a" + - this._stack.split("\n").slice(1, -7).join("\n") - ) - ); - return; - } - } - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - this._yieldedPromise = maybePromise; - maybePromise._proxy(this, null); - } else if (((bitField & 33554432) !== 0)) { - Promise._async.invoke( - this._promiseFulfilled, this, maybePromise._value() - ); - } else if (((bitField & 16777216) !== 0)) { - Promise._async.invoke( - this._promiseRejected, this, maybePromise._reason() - ); - } else { - this._promiseCancelled(); - } - } -}; - -Promise.coroutine = function (generatorFunction, options) { - if (typeof generatorFunction !== "function") { - throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - var yieldHandler = Object(options).yieldHandler; - var PromiseSpawn$ = PromiseSpawn; - var stack = new Error().stack; - return function () { - var generator = generatorFunction.apply(this, arguments); - var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, - stack); - var ret = spawn.promise(); - spawn._generator = generator; - spawn._promiseFulfilled(undefined); - return ret; - }; -}; - -Promise.coroutine.addYieldHandler = function(fn) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); - } - yieldHandlers.push(fn); -}; - -Promise.spawn = function (generatorFunction) { - debug.deprecated("Promise.spawn()", "Promise.coroutine()"); - if (typeof generatorFunction !== "function") { - return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - var spawn = new PromiseSpawn(generatorFunction, this); - var ret = spawn.promise(); - spawn._run(Promise.spawn); - return ret; -}; -}; - -},{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, - getDomain) { -var util = _dereq_("./util"); -var canEvaluate = util.canEvaluate; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var reject; - -if (!true) { -if (canEvaluate) { - var thenCallback = function(i) { - return new Function("value", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = value; \n\ - holder.checkFulfillment(this); \n\ - ".replace(/Index/g, i)); - }; - - var promiseSetter = function(i) { - return new Function("promise", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = promise; \n\ - ".replace(/Index/g, i)); - }; - - var generateHolderClass = function(total) { - var props = new Array(total); - for (var i = 0; i < props.length; ++i) { - props[i] = "this.p" + (i+1); - } - var assignment = props.join(" = ") + " = null;"; - var cancellationCode= "var promise;\n" + props.map(function(prop) { - return " \n\ - promise = " + prop + "; \n\ - if (promise instanceof Promise) { \n\ - promise.cancel(); \n\ - } \n\ - "; - }).join("\n"); - var passedArguments = props.join(", "); - var name = "Holder$" + total; - - - var code = "return function(tryCatch, errorObj, Promise, async) { \n\ - 'use strict'; \n\ - function [TheName](fn) { \n\ - [TheProperties] \n\ - this.fn = fn; \n\ - this.asyncNeeded = true; \n\ - this.now = 0; \n\ - } \n\ - \n\ - [TheName].prototype._callFunction = function(promise) { \n\ - promise._pushContext(); \n\ - var ret = tryCatch(this.fn)([ThePassedArguments]); \n\ - promise._popContext(); \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(ret.e, false); \n\ - } else { \n\ - promise._resolveCallback(ret); \n\ - } \n\ - }; \n\ - \n\ - [TheName].prototype.checkFulfillment = function(promise) { \n\ - var now = ++this.now; \n\ - if (now === [TheTotal]) { \n\ - if (this.asyncNeeded) { \n\ - async.invoke(this._callFunction, this, promise); \n\ - } else { \n\ - this._callFunction(promise); \n\ - } \n\ - \n\ - } \n\ - }; \n\ - \n\ - [TheName].prototype._resultCancelled = function() { \n\ - [CancellationCode] \n\ - }; \n\ - \n\ - return [TheName]; \n\ - }(tryCatch, errorObj, Promise, async); \n\ - "; - - code = code.replace(/\[TheName\]/g, name) - .replace(/\[TheTotal\]/g, total) - .replace(/\[ThePassedArguments\]/g, passedArguments) - .replace(/\[TheProperties\]/g, assignment) - .replace(/\[CancellationCode\]/g, cancellationCode); - - return new Function("tryCatch", "errorObj", "Promise", "async", code) - (tryCatch, errorObj, Promise, async); - }; - - var holderClasses = []; - var thenCallbacks = []; - var promiseSetters = []; - - for (var i = 0; i < 8; ++i) { - holderClasses.push(generateHolderClass(i + 1)); - thenCallbacks.push(thenCallback(i + 1)); - promiseSetters.push(promiseSetter(i + 1)); - } - - reject = function (reason) { - this._reject(reason); - }; -}} - -Promise.join = function () { - var last = arguments.length - 1; - var fn; - if (last > 0 && typeof arguments[last] === "function") { - fn = arguments[last]; - if (!true) { - if (last <= 8 && canEvaluate) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var HolderClass = holderClasses[last - 1]; - var holder = new HolderClass(fn); - var callbacks = thenCallbacks; - - for (var i = 0; i < last; ++i) { - var maybePromise = tryConvertToPromise(arguments[i], ret); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - maybePromise._then(callbacks[i], reject, - undefined, ret, holder); - promiseSetters[i](maybePromise, holder); - holder.asyncNeeded = false; - } else if (((bitField & 33554432) !== 0)) { - callbacks[i].call(ret, - maybePromise._value(), holder); - } else if (((bitField & 16777216) !== 0)) { - ret._reject(maybePromise._reason()); - } else { - ret._cancel(); - } - } else { - callbacks[i].call(ret, maybePromise, holder); - } - } - - if (!ret._isFateSealed()) { - if (holder.asyncNeeded) { - var domain = getDomain(); - if (domain !== null) { - holder.fn = util.domainBind(domain, holder.fn); - } - } - ret._setAsyncGuaranteed(); - ret._setOnCancel(holder); - } - return ret; - } - } - } - var args = [].slice.call(arguments);; - if (fn) args.pop(); - var ret = new PromiseArray(args).promise(); - return fn !== undefined ? ret.spread(fn) : ret; -}; - -}; - -},{"./util":36}],18:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL, - debug) { -var getDomain = Promise._getDomain; -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var async = Promise._async; - -function MappingPromiseArray(promises, fn, limit, _filter) { - this.constructor$(promises); - this._promise._captureStackTrace(); - var domain = getDomain(); - this._callback = domain === null ? fn : util.domainBind(domain, fn); - this._preservedValues = _filter === INTERNAL - ? new Array(this.length()) - : null; - this._limit = limit; - this._inFlight = 0; - this._queue = []; - async.invoke(this._asyncInit, this, undefined); -} -util.inherits(MappingPromiseArray, PromiseArray); - -MappingPromiseArray.prototype._asyncInit = function() { - this._init$(undefined, -2); -}; - -MappingPromiseArray.prototype._init = function () {}; - -MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - var length = this.length(); - var preservedValues = this._preservedValues; - var limit = this._limit; - - if (index < 0) { - index = (index * -1) - 1; - values[index] = value; - if (limit >= 1) { - this._inFlight--; - this._drainQueue(); - if (this._isResolved()) return true; - } - } else { - if (limit >= 1 && this._inFlight >= limit) { - values[index] = value; - this._queue.push(index); - return false; - } - if (preservedValues !== null) preservedValues[index] = value; - - var promise = this._promise; - var callback = this._callback; - var receiver = promise._boundValue(); - promise._pushContext(); - var ret = tryCatch(callback).call(receiver, value, index, length); - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, - promiseCreated, - preservedValues !== null ? "Promise.filter" : "Promise.map", - promise - ); - if (ret === errorObj) { - this._reject(ret.e); - return true; - } - - var maybePromise = tryConvertToPromise(ret, this._promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - if (limit >= 1) this._inFlight++; - values[index] = maybePromise; - maybePromise._proxy(this, (index + 1) * -1); - return false; - } else if (((bitField & 33554432) !== 0)) { - ret = maybePromise._value(); - } else if (((bitField & 16777216) !== 0)) { - this._reject(maybePromise._reason()); - return true; - } else { - this._cancel(); - return true; - } - } - values[index] = ret; - } - var totalResolved = ++this._totalResolved; - if (totalResolved >= length) { - if (preservedValues !== null) { - this._filter(values, preservedValues); - } else { - this._resolve(values); - } - return true; - } - return false; -}; - -MappingPromiseArray.prototype._drainQueue = function () { - var queue = this._queue; - var limit = this._limit; - var values = this._values; - while (queue.length > 0 && this._inFlight < limit) { - if (this._isResolved()) return; - var index = queue.pop(); - this._promiseFulfilled(values[index], index); - } -}; - -MappingPromiseArray.prototype._filter = function (booleans, values) { - var len = values.length; - var ret = new Array(len); - var j = 0; - for (var i = 0; i < len; ++i) { - if (booleans[i]) ret[j++] = values[i]; - } - ret.length = j; - this._resolve(ret); -}; - -MappingPromiseArray.prototype.preservedValues = function () { - return this._preservedValues; -}; - -function map(promises, fn, options, _filter) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - - var limit = 0; - if (options !== undefined) { - if (typeof options === "object" && options !== null) { - if (typeof options.concurrency !== "number") { - return Promise.reject( - new TypeError("'concurrency' must be a number but it is " + - util.classString(options.concurrency))); - } - limit = options.concurrency; - } else { - return Promise.reject(new TypeError( - "options argument must be an object but it is " + - util.classString(options))); - } - } - limit = typeof limit === "number" && - isFinite(limit) && limit >= 1 ? limit : 0; - return new MappingPromiseArray(promises, fn, limit, _filter).promise(); -} - -Promise.prototype.map = function (fn, options) { - return map(this, fn, options, null); -}; - -Promise.map = function (promises, fn, options, _filter) { - return map(promises, fn, options, _filter); -}; - - -}; - -},{"./util":36}],19:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; - -Promise.method = function (fn) { - if (typeof fn !== "function") { - throw new Promise.TypeError("expecting a function but got " + util.classString(fn)); - } - return function () { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = tryCatch(fn).apply(this, arguments); - var promiseCreated = ret._popContext(); - debug.checkForgottenReturns( - value, promiseCreated, "Promise.method", ret); - ret._resolveFromSyncValue(value); - return ret; - }; -}; - -Promise.attempt = Promise["try"] = function (fn) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value; - if (arguments.length > 1) { - debug.deprecated("calling Promise.try with more than 1 argument"); - var arg = arguments[1]; - var ctx = arguments[2]; - value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg) - : tryCatch(fn).call(ctx, arg); - } else { - value = tryCatch(fn)(); - } - var promiseCreated = ret._popContext(); - debug.checkForgottenReturns( - value, promiseCreated, "Promise.try", ret); - ret._resolveFromSyncValue(value); - return ret; -}; - -Promise.prototype._resolveFromSyncValue = function (value) { - if (value === util.errorObj) { - this._rejectCallback(value.e, false); - } else { - this._resolveCallback(value, true); - } -}; -}; - -},{"./util":36}],20:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util"); -var maybeWrapAsError = util.maybeWrapAsError; -var errors = _dereq_("./errors"); -var OperationalError = errors.OperationalError; -var es5 = _dereq_("./es5"); - -function isUntypedError(obj) { - return obj instanceof Error && - es5.getPrototypeOf(obj) === Error.prototype; -} - -var rErrorKey = /^(?:name|message|stack|cause)$/; -function wrapAsOperationalError(obj) { - var ret; - if (isUntypedError(obj)) { - ret = new OperationalError(obj); - ret.name = obj.name; - ret.message = obj.message; - ret.stack = obj.stack; - var keys = es5.keys(obj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!rErrorKey.test(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - util.markAsOriginatingFromRejection(obj); - return obj; -} - -function nodebackForPromise(promise, multiArgs) { - return function(err, value) { - if (promise === null) return; - if (err) { - var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); - promise._attachExtraTrace(wrapped); - promise._reject(wrapped); - } else if (!multiArgs) { - promise._fulfill(value); - } else { - var args = [].slice.call(arguments, 1);; - promise._fulfill(args); - } - promise = null; - }; -} - -module.exports = nodebackForPromise; - -},{"./errors":12,"./es5":13,"./util":36}],21:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var util = _dereq_("./util"); -var async = Promise._async; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function spreadAdapter(val, nodeback) { - var promise = this; - if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); - var ret = - tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val)); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -function successAdapter(val, nodeback) { - var promise = this; - var receiver = promise._boundValue(); - var ret = val === undefined - ? tryCatch(nodeback).call(receiver, null) - : tryCatch(nodeback).call(receiver, null, val); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} -function errorAdapter(reason, nodeback) { - var promise = this; - if (!reason) { - var newReason = new Error(reason + ""); - newReason.cause = reason; - reason = newReason; - } - var ret = tryCatch(nodeback).call(promise._boundValue(), reason); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, - options) { - if (typeof nodeback == "function") { - var adapter = successAdapter; - if (options !== undefined && Object(options).spread) { - adapter = spreadAdapter; - } - this._then( - adapter, - errorAdapter, - undefined, - this, - nodeback - ); - } - return this; -}; -}; - -},{"./util":36}],22:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function() { -var makeSelfResolutionError = function () { - return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a"); -}; -var reflectHandler = function() { - return new Promise.PromiseInspection(this._target()); -}; -var apiRejection = function(msg) { - return Promise.reject(new TypeError(msg)); -}; -function Proxyable() {} -var UNDEFINED_BINDING = {}; -var util = _dereq_("./util"); - -var getDomain; -if (util.isNode) { - getDomain = function() { - var ret = process.domain; - if (ret === undefined) ret = null; - return ret; - }; -} else { - getDomain = function() { - return null; - }; -} -util.notEnumerableProp(Promise, "_getDomain", getDomain); - -var es5 = _dereq_("./es5"); -var Async = _dereq_("./async"); -var async = new Async(); -es5.defineProperty(Promise, "_async", {value: async}); -var errors = _dereq_("./errors"); -var TypeError = Promise.TypeError = errors.TypeError; -Promise.RangeError = errors.RangeError; -var CancellationError = Promise.CancellationError = errors.CancellationError; -Promise.TimeoutError = errors.TimeoutError; -Promise.OperationalError = errors.OperationalError; -Promise.RejectionError = errors.OperationalError; -Promise.AggregateError = errors.AggregateError; -var INTERNAL = function(){}; -var APPLY = {}; -var NEXT_FILTER = {}; -var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL); -var PromiseArray = - _dereq_("./promise_array")(Promise, INTERNAL, - tryConvertToPromise, apiRejection, Proxyable); -var Context = _dereq_("./context")(Promise); - /*jshint unused:false*/ -var createContext = Context.create; -var debug = _dereq_("./debuggability")(Promise, Context); -var CapturedTrace = debug.CapturedTrace; -var PassThroughHandlerContext = - _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); -var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); -var nodebackForPromise = _dereq_("./nodeback"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -function check(self, executor) { - if (self == null || self.constructor !== Promise) { - throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - if (typeof executor !== "function") { - throw new TypeError("expecting a function but got " + util.classString(executor)); - } - -} - -function Promise(executor) { - if (executor !== INTERNAL) { - check(this, executor); - } - this._bitField = 0; - this._fulfillmentHandler0 = undefined; - this._rejectionHandler0 = undefined; - this._promise0 = undefined; - this._receiver0 = undefined; - this._resolveFromExecutor(executor); - this._promiseCreated(); - this._fireEvent("promiseCreated", this); -} - -Promise.prototype.toString = function () { - return "[object Promise]"; -}; - -Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { - var len = arguments.length; - if (len > 1) { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (util.isObject(item)) { - catchInstances[j++] = item; - } else { - return apiRejection("Catch statement predicate: " + - "expecting an object but got " + util.classString(item)); - } - } - catchInstances.length = j; - fn = arguments[i]; - - if (typeof fn !== "function") { - throw new TypeError("The last argument to .catch() " + - "must be a function, got " + util.toString(fn)); - } - return this.then(undefined, catchFilter(catchInstances, fn, this)); - } - return this.then(undefined, fn); -}; - -Promise.prototype.reflect = function () { - return this._then(reflectHandler, - reflectHandler, undefined, this, undefined); -}; - -Promise.prototype.then = function (didFulfill, didReject) { - if (debug.warnings() && arguments.length > 0 && - typeof didFulfill !== "function" && - typeof didReject !== "function") { - var msg = ".then() only accepts functions but was passed: " + - util.classString(didFulfill); - if (arguments.length > 1) { - msg += ", " + util.classString(didReject); - } - this._warn(msg); - } - return this._then(didFulfill, didReject, undefined, undefined, undefined); -}; - -Promise.prototype.done = function (didFulfill, didReject) { - var promise = - this._then(didFulfill, didReject, undefined, undefined, undefined); - promise._setIsFinal(); -}; - -Promise.prototype.spread = function (fn) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - return this.all()._then(fn, undefined, undefined, APPLY, undefined); -}; - -Promise.prototype.toJSON = function () { - var ret = { - isFulfilled: false, - isRejected: false, - fulfillmentValue: undefined, - rejectionReason: undefined - }; - if (this.isFulfilled()) { - ret.fulfillmentValue = this.value(); - ret.isFulfilled = true; - } else if (this.isRejected()) { - ret.rejectionReason = this.reason(); - ret.isRejected = true; - } - return ret; -}; - -Promise.prototype.all = function () { - if (arguments.length > 0) { - this._warn(".all() was passed arguments but it does not take any"); - } - return new PromiseArray(this).promise(); -}; - -Promise.prototype.error = function (fn) { - return this.caught(util.originatesFromRejection, fn); -}; - -Promise.getNewLibraryCopy = module.exports; - -Promise.is = function (val) { - return val instanceof Promise; -}; - -Promise.fromNode = Promise.fromCallback = function(fn) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs - : false; - var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs)); - if (result === errorObj) { - ret._rejectCallback(result.e, true); - } - if (!ret._isFateSealed()) ret._setAsyncGuaranteed(); - return ret; -}; - -Promise.all = function (promises) { - return new PromiseArray(promises).promise(); -}; - -Promise.cast = function (obj) { - var ret = tryConvertToPromise(obj); - if (!(ret instanceof Promise)) { - ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._setFulfilled(); - ret._rejectionHandler0 = obj; - } - return ret; -}; - -Promise.resolve = Promise.fulfilled = Promise.cast; - -Promise.reject = Promise.rejected = function (reason) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._rejectCallback(reason, true); - return ret; -}; - -Promise.setScheduler = function(fn) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); - } - return async.setScheduler(fn); -}; - -Promise.prototype._then = function ( - didFulfill, - didReject, - _, receiver, - internalData -) { - var haveInternalData = internalData !== undefined; - var promise = haveInternalData ? internalData : new Promise(INTERNAL); - var target = this._target(); - var bitField = target._bitField; - - if (!haveInternalData) { - promise._propagateFrom(this, 3); - promise._captureStackTrace(); - if (receiver === undefined && - ((this._bitField & 2097152) !== 0)) { - if (!((bitField & 50397184) === 0)) { - receiver = this._boundValue(); - } else { - receiver = target === this ? undefined : this._boundTo; - } - } - this._fireEvent("promiseChained", this, promise); - } - - var domain = getDomain(); - if (!((bitField & 50397184) === 0)) { - var handler, value, settler = target._settlePromiseCtx; - if (((bitField & 33554432) !== 0)) { - value = target._rejectionHandler0; - handler = didFulfill; - } else if (((bitField & 16777216) !== 0)) { - value = target._fulfillmentHandler0; - handler = didReject; - target._unsetRejectionIsUnhandled(); - } else { - settler = target._settlePromiseLateCancellationObserver; - value = new CancellationError("late cancellation observer"); - target._attachExtraTrace(value); - handler = didReject; - } - - async.invoke(settler, target, { - handler: domain === null ? handler - : (typeof handler === "function" && - util.domainBind(domain, handler)), - promise: promise, - receiver: receiver, - value: value - }); - } else { - target._addCallbacks(didFulfill, didReject, promise, receiver, domain); - } - - return promise; -}; - -Promise.prototype._length = function () { - return this._bitField & 65535; -}; - -Promise.prototype._isFateSealed = function () { - return (this._bitField & 117506048) !== 0; -}; - -Promise.prototype._isFollowing = function () { - return (this._bitField & 67108864) === 67108864; -}; - -Promise.prototype._setLength = function (len) { - this._bitField = (this._bitField & -65536) | - (len & 65535); -}; - -Promise.prototype._setFulfilled = function () { - this._bitField = this._bitField | 33554432; - this._fireEvent("promiseFulfilled", this); -}; - -Promise.prototype._setRejected = function () { - this._bitField = this._bitField | 16777216; - this._fireEvent("promiseRejected", this); -}; - -Promise.prototype._setFollowing = function () { - this._bitField = this._bitField | 67108864; - this._fireEvent("promiseResolved", this); -}; - -Promise.prototype._setIsFinal = function () { - this._bitField = this._bitField | 4194304; -}; - -Promise.prototype._isFinal = function () { - return (this._bitField & 4194304) > 0; -}; - -Promise.prototype._unsetCancelled = function() { - this._bitField = this._bitField & (~65536); -}; - -Promise.prototype._setCancelled = function() { - this._bitField = this._bitField | 65536; - this._fireEvent("promiseCancelled", this); -}; - -Promise.prototype._setWillBeCancelled = function() { - this._bitField = this._bitField | 8388608; -}; - -Promise.prototype._setAsyncGuaranteed = function() { - if (async.hasCustomScheduler()) return; - this._bitField = this._bitField | 134217728; -}; - -Promise.prototype._receiverAt = function (index) { - var ret = index === 0 ? this._receiver0 : this[ - index * 4 - 4 + 3]; - if (ret === UNDEFINED_BINDING) { - return undefined; - } else if (ret === undefined && this._isBound()) { - return this._boundValue(); - } - return ret; -}; - -Promise.prototype._promiseAt = function (index) { - return this[ - index * 4 - 4 + 2]; -}; - -Promise.prototype._fulfillmentHandlerAt = function (index) { - return this[ - index * 4 - 4 + 0]; -}; - -Promise.prototype._rejectionHandlerAt = function (index) { - return this[ - index * 4 - 4 + 1]; -}; - -Promise.prototype._boundValue = function() {}; - -Promise.prototype._migrateCallback0 = function (follower) { - var bitField = follower._bitField; - var fulfill = follower._fulfillmentHandler0; - var reject = follower._rejectionHandler0; - var promise = follower._promise0; - var receiver = follower._receiverAt(0); - if (receiver === undefined) receiver = UNDEFINED_BINDING; - this._addCallbacks(fulfill, reject, promise, receiver, null); -}; - -Promise.prototype._migrateCallbackAt = function (follower, index) { - var fulfill = follower._fulfillmentHandlerAt(index); - var reject = follower._rejectionHandlerAt(index); - var promise = follower._promiseAt(index); - var receiver = follower._receiverAt(index); - if (receiver === undefined) receiver = UNDEFINED_BINDING; - this._addCallbacks(fulfill, reject, promise, receiver, null); -}; - -Promise.prototype._addCallbacks = function ( - fulfill, - reject, - promise, - receiver, - domain -) { - var index = this._length(); - - if (index >= 65535 - 4) { - index = 0; - this._setLength(0); - } - - if (index === 0) { - this._promise0 = promise; - this._receiver0 = receiver; - if (typeof fulfill === "function") { - this._fulfillmentHandler0 = - domain === null ? fulfill : util.domainBind(domain, fulfill); - } - if (typeof reject === "function") { - this._rejectionHandler0 = - domain === null ? reject : util.domainBind(domain, reject); - } - } else { - var base = index * 4 - 4; - this[base + 2] = promise; - this[base + 3] = receiver; - if (typeof fulfill === "function") { - this[base + 0] = - domain === null ? fulfill : util.domainBind(domain, fulfill); - } - if (typeof reject === "function") { - this[base + 1] = - domain === null ? reject : util.domainBind(domain, reject); - } - } - this._setLength(index + 1); - return index; -}; - -Promise.prototype._proxy = function (proxyable, arg) { - this._addCallbacks(undefined, undefined, arg, proxyable, null); -}; - -Promise.prototype._resolveCallback = function(value, shouldBind) { - if (((this._bitField & 117506048) !== 0)) return; - if (value === this) - return this._rejectCallback(makeSelfResolutionError(), false); - var maybePromise = tryConvertToPromise(value, this); - if (!(maybePromise instanceof Promise)) return this._fulfill(value); - - if (shouldBind) this._propagateFrom(maybePromise, 2); - - var promise = maybePromise._target(); - - if (promise === this) { - this._reject(makeSelfResolutionError()); - return; - } - - var bitField = promise._bitField; - if (((bitField & 50397184) === 0)) { - var len = this._length(); - if (len > 0) promise._migrateCallback0(this); - for (var i = 1; i < len; ++i) { - promise._migrateCallbackAt(this, i); - } - this._setFollowing(); - this._setLength(0); - this._setFollowee(promise); - } else if (((bitField & 33554432) !== 0)) { - this._fulfill(promise._value()); - } else if (((bitField & 16777216) !== 0)) { - this._reject(promise._reason()); - } else { - var reason = new CancellationError("late cancellation observer"); - promise._attachExtraTrace(reason); - this._reject(reason); - } -}; - -Promise.prototype._rejectCallback = -function(reason, synchronous, ignoreNonErrorWarnings) { - var trace = util.ensureErrorObject(reason); - var hasStack = trace === reason; - if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) { - var message = "a promise was rejected with a non-error: " + - util.classString(reason); - this._warn(message, true); - } - this._attachExtraTrace(trace, synchronous ? hasStack : false); - this._reject(reason); -}; - -Promise.prototype._resolveFromExecutor = function (executor) { - if (executor === INTERNAL) return; - var promise = this; - this._captureStackTrace(); - this._pushContext(); - var synchronous = true; - var r = this._execute(executor, function(value) { - promise._resolveCallback(value); - }, function (reason) { - promise._rejectCallback(reason, synchronous); - }); - synchronous = false; - this._popContext(); - - if (r !== undefined) { - promise._rejectCallback(r, true); - } -}; - -Promise.prototype._settlePromiseFromHandler = function ( - handler, receiver, value, promise -) { - var bitField = promise._bitField; - if (((bitField & 65536) !== 0)) return; - promise._pushContext(); - var x; - if (receiver === APPLY) { - if (!value || typeof value.length !== "number") { - x = errorObj; - x.e = new TypeError("cannot .spread() a non-array: " + - util.classString(value)); - } else { - x = tryCatch(handler).apply(this._boundValue(), value); - } - } else { - x = tryCatch(handler).call(receiver, value); - } - var promiseCreated = promise._popContext(); - bitField = promise._bitField; - if (((bitField & 65536) !== 0)) return; - - if (x === NEXT_FILTER) { - promise._reject(value); - } else if (x === errorObj) { - promise._rejectCallback(x.e, false); - } else { - debug.checkForgottenReturns(x, promiseCreated, "", promise, this); - promise._resolveCallback(x); - } -}; - -Promise.prototype._target = function() { - var ret = this; - while (ret._isFollowing()) ret = ret._followee(); - return ret; -}; - -Promise.prototype._followee = function() { - return this._rejectionHandler0; -}; - -Promise.prototype._setFollowee = function(promise) { - this._rejectionHandler0 = promise; -}; - -Promise.prototype._settlePromise = function(promise, handler, receiver, value) { - var isPromise = promise instanceof Promise; - var bitField = this._bitField; - var asyncGuaranteed = ((bitField & 134217728) !== 0); - if (((bitField & 65536) !== 0)) { - if (isPromise) promise._invokeInternalOnCancel(); - - if (receiver instanceof PassThroughHandlerContext && - receiver.isFinallyHandler()) { - receiver.cancelPromise = promise; - if (tryCatch(handler).call(receiver, value) === errorObj) { - promise._reject(errorObj.e); - } - } else if (handler === reflectHandler) { - promise._fulfill(reflectHandler.call(receiver)); - } else if (receiver instanceof Proxyable) { - receiver._promiseCancelled(promise); - } else if (isPromise || promise instanceof PromiseArray) { - promise._cancel(); - } else { - receiver.cancel(); - } - } else if (typeof handler === "function") { - if (!isPromise) { - handler.call(receiver, value, promise); - } else { - if (asyncGuaranteed) promise._setAsyncGuaranteed(); - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (receiver instanceof Proxyable) { - if (!receiver._isResolved()) { - if (((bitField & 33554432) !== 0)) { - receiver._promiseFulfilled(value, promise); - } else { - receiver._promiseRejected(value, promise); - } - } - } else if (isPromise) { - if (asyncGuaranteed) promise._setAsyncGuaranteed(); - if (((bitField & 33554432) !== 0)) { - promise._fulfill(value); - } else { - promise._reject(value); - } - } -}; - -Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) { - var handler = ctx.handler; - var promise = ctx.promise; - var receiver = ctx.receiver; - var value = ctx.value; - if (typeof handler === "function") { - if (!(promise instanceof Promise)) { - handler.call(receiver, value, promise); - } else { - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (promise instanceof Promise) { - promise._reject(value); - } -}; - -Promise.prototype._settlePromiseCtx = function(ctx) { - this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value); -}; - -Promise.prototype._settlePromise0 = function(handler, value, bitField) { - var promise = this._promise0; - var receiver = this._receiverAt(0); - this._promise0 = undefined; - this._receiver0 = undefined; - this._settlePromise(promise, handler, receiver, value); -}; - -Promise.prototype._clearCallbackDataAtIndex = function(index) { - var base = index * 4 - 4; - this[base + 2] = - this[base + 3] = - this[base + 0] = - this[base + 1] = undefined; -}; - -Promise.prototype._fulfill = function (value) { - var bitField = this._bitField; - if (((bitField & 117506048) >>> 16)) return; - if (value === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._reject(err); - } - this._setFulfilled(); - this._rejectionHandler0 = value; - - if ((bitField & 65535) > 0) { - if (((bitField & 134217728) !== 0)) { - this._settlePromises(); - } else { - async.settlePromises(this); - } - this._dereferenceTrace(); - } -}; - -Promise.prototype._reject = function (reason) { - var bitField = this._bitField; - if (((bitField & 117506048) >>> 16)) return; - this._setRejected(); - this._fulfillmentHandler0 = reason; - - if (this._isFinal()) { - return async.fatalError(reason, util.isNode); - } - - if ((bitField & 65535) > 0) { - async.settlePromises(this); - } else { - this._ensurePossibleRejectionHandled(); - } -}; - -Promise.prototype._fulfillPromises = function (len, value) { - for (var i = 1; i < len; i++) { - var handler = this._fulfillmentHandlerAt(i); - var promise = this._promiseAt(i); - var receiver = this._receiverAt(i); - this._clearCallbackDataAtIndex(i); - this._settlePromise(promise, handler, receiver, value); - } -}; - -Promise.prototype._rejectPromises = function (len, reason) { - for (var i = 1; i < len; i++) { - var handler = this._rejectionHandlerAt(i); - var promise = this._promiseAt(i); - var receiver = this._receiverAt(i); - this._clearCallbackDataAtIndex(i); - this._settlePromise(promise, handler, receiver, reason); - } -}; - -Promise.prototype._settlePromises = function () { - var bitField = this._bitField; - var len = (bitField & 65535); - - if (len > 0) { - if (((bitField & 16842752) !== 0)) { - var reason = this._fulfillmentHandler0; - this._settlePromise0(this._rejectionHandler0, reason, bitField); - this._rejectPromises(len, reason); - } else { - var value = this._rejectionHandler0; - this._settlePromise0(this._fulfillmentHandler0, value, bitField); - this._fulfillPromises(len, value); - } - this._setLength(0); - } - this._clearCancellationData(); -}; - -Promise.prototype._settledValue = function() { - var bitField = this._bitField; - if (((bitField & 33554432) !== 0)) { - return this._rejectionHandler0; - } else if (((bitField & 16777216) !== 0)) { - return this._fulfillmentHandler0; - } -}; - -if (typeof Symbol !== "undefined" && Symbol.toStringTag) { - es5.defineProperty(Promise.prototype, Symbol.toStringTag, { - get: function () { - return "Object"; - } - }); -} - -function deferResolve(v) {this.promise._resolveCallback(v);} -function deferReject(v) {this.promise._rejectCallback(v, false);} - -Promise.defer = Promise.pending = function() { - debug.deprecated("Promise.defer", "new Promise"); - var promise = new Promise(INTERNAL); - return { - promise: promise, - resolve: deferResolve, - reject: deferReject - }; -}; - -util.notEnumerableProp(Promise, - "_makeSelfResolutionError", - makeSelfResolutionError); - -_dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection, - debug); -_dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug); -_dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug); -_dereq_("./direct_resolve")(Promise); -_dereq_("./synchronous_inspection")(Promise); -_dereq_("./join")( - Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); -Promise.Promise = Promise; -Promise.version = "3.5.5"; -_dereq_('./call_get.js')(Promise); -_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); -_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); -_dereq_('./nodeify.js')(Promise); -_dereq_('./promisify.js')(Promise, INTERNAL); -_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); -_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); -_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); -_dereq_('./settle.js')(Promise, PromiseArray, debug); -_dereq_('./some.js')(Promise, PromiseArray, apiRejection); -_dereq_('./timers.js')(Promise, INTERNAL, debug); -_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); -_dereq_('./any.js')(Promise); -_dereq_('./each.js')(Promise, INTERNAL); -_dereq_('./filter.js')(Promise, INTERNAL); - - util.toFastProperties(Promise); - util.toFastProperties(Promise.prototype); - function fillTypes(value) { - var p = new Promise(INTERNAL); - p._fulfillmentHandler0 = value; - p._rejectionHandler0 = value; - p._promise0 = value; - p._receiver0 = value; - } - // Complete slack tracking, opt out of field-type tracking and - // stabilize map - fillTypes({a: 1}); - fillTypes({b: 2}); - fillTypes({c: 3}); - fillTypes(1); - fillTypes(function(){}); - fillTypes(undefined); - fillTypes(false); - fillTypes(new Promise(INTERNAL)); - debug.setBounds(Async.firstLineError, util.lastLineError); - return Promise; - -}; - -},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, - apiRejection, Proxyable) { -var util = _dereq_("./util"); -var isArray = util.isArray; - -function toResolutionValue(val) { - switch(val) { - case -2: return []; - case -3: return {}; - case -6: return new Map(); - } -} - -function PromiseArray(values) { - var promise = this._promise = new Promise(INTERNAL); - if (values instanceof Promise) { - promise._propagateFrom(values, 3); - } - promise._setOnCancel(this); - this._values = values; - this._length = 0; - this._totalResolved = 0; - this._init(undefined, -2); -} -util.inherits(PromiseArray, Proxyable); - -PromiseArray.prototype.length = function () { - return this._length; -}; - -PromiseArray.prototype.promise = function () { - return this._promise; -}; - -PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { - var values = tryConvertToPromise(this._values, this._promise); - if (values instanceof Promise) { - values = values._target(); - var bitField = values._bitField; - ; - this._values = values; - - if (((bitField & 50397184) === 0)) { - this._promise._setAsyncGuaranteed(); - return values._then( - init, - this._reject, - undefined, - this, - resolveValueIfEmpty - ); - } else if (((bitField & 33554432) !== 0)) { - values = values._value(); - } else if (((bitField & 16777216) !== 0)) { - return this._reject(values._reason()); - } else { - return this._cancel(); - } - } - values = util.asArray(values); - if (values === null) { - var err = apiRejection( - "expecting an array or an iterable object but got " + util.classString(values)).reason(); - this._promise._rejectCallback(err, false); - return; - } - - if (values.length === 0) { - if (resolveValueIfEmpty === -5) { - this._resolveEmptyArray(); - } - else { - this._resolve(toResolutionValue(resolveValueIfEmpty)); - } - return; - } - this._iterate(values); -}; - -PromiseArray.prototype._iterate = function(values) { - var len = this.getActualLength(values.length); - this._length = len; - this._values = this.shouldCopyValues() ? new Array(len) : this._values; - var result = this._promise; - var isResolved = false; - var bitField = null; - for (var i = 0; i < len; ++i) { - var maybePromise = tryConvertToPromise(values[i], result); - - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - bitField = maybePromise._bitField; - } else { - bitField = null; - } - - if (isResolved) { - if (bitField !== null) { - maybePromise.suppressUnhandledRejections(); - } - } else if (bitField !== null) { - if (((bitField & 50397184) === 0)) { - maybePromise._proxy(this, i); - this._values[i] = maybePromise; - } else if (((bitField & 33554432) !== 0)) { - isResolved = this._promiseFulfilled(maybePromise._value(), i); - } else if (((bitField & 16777216) !== 0)) { - isResolved = this._promiseRejected(maybePromise._reason(), i); - } else { - isResolved = this._promiseCancelled(i); - } - } else { - isResolved = this._promiseFulfilled(maybePromise, i); - } - } - if (!isResolved) result._setAsyncGuaranteed(); -}; - -PromiseArray.prototype._isResolved = function () { - return this._values === null; -}; - -PromiseArray.prototype._resolve = function (value) { - this._values = null; - this._promise._fulfill(value); -}; - -PromiseArray.prototype._cancel = function() { - if (this._isResolved() || !this._promise._isCancellable()) return; - this._values = null; - this._promise._cancel(); -}; - -PromiseArray.prototype._reject = function (reason) { - this._values = null; - this._promise._rejectCallback(reason, false); -}; - -PromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - return true; - } - return false; -}; - -PromiseArray.prototype._promiseCancelled = function() { - this._cancel(); - return true; -}; - -PromiseArray.prototype._promiseRejected = function (reason) { - this._totalResolved++; - this._reject(reason); - return true; -}; - -PromiseArray.prototype._resultCancelled = function() { - if (this._isResolved()) return; - var values = this._values; - this._cancel(); - if (values instanceof Promise) { - values.cancel(); - } else { - for (var i = 0; i < values.length; ++i) { - if (values[i] instanceof Promise) { - values[i].cancel(); - } - } - } -}; - -PromiseArray.prototype.shouldCopyValues = function () { - return true; -}; - -PromiseArray.prototype.getActualLength = function (len) { - return len; -}; - -return PromiseArray; -}; - -},{"./util":36}],24:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var THIS = {}; -var util = _dereq_("./util"); -var nodebackForPromise = _dereq_("./nodeback"); -var withAppended = util.withAppended; -var maybeWrapAsError = util.maybeWrapAsError; -var canEvaluate = util.canEvaluate; -var TypeError = _dereq_("./errors").TypeError; -var defaultSuffix = "Async"; -var defaultPromisified = {__isPromisified__: true}; -var noCopyProps = [ - "arity", "length", - "name", - "arguments", - "caller", - "callee", - "prototype", - "__isPromisified__" -]; -var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"); - -var defaultFilter = function(name) { - return util.isIdentifier(name) && - name.charAt(0) !== "_" && - name !== "constructor"; -}; - -function propsFilter(key) { - return !noCopyPropsPattern.test(key); -} - -function isPromisified(fn) { - try { - return fn.__isPromisified__ === true; - } - catch (e) { - return false; - } -} - -function hasPromisified(obj, key, suffix) { - var val = util.getDataPropertyOrDefault(obj, key + suffix, - defaultPromisified); - return val ? isPromisified(val) : false; -} -function checkValid(ret, suffix, suffixRegexp) { - for (var i = 0; i < ret.length; i += 2) { - var key = ret[i]; - if (suffixRegexp.test(key)) { - var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); - for (var j = 0; j < ret.length; j += 2) { - if (ret[j] === keyWithoutAsyncSuffix) { - throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a" - .replace("%s", suffix)); - } - } - } - } -} - -function promisifiableMethods(obj, suffix, suffixRegexp, filter) { - var keys = util.inheritedDataKeys(obj); - var ret = []; - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var value = obj[key]; - var passesDefaultFilter = filter === defaultFilter - ? true : defaultFilter(key, value, obj); - if (typeof value === "function" && - !isPromisified(value) && - !hasPromisified(obj, key, suffix) && - filter(key, value, obj, passesDefaultFilter)) { - ret.push(key, value); - } - } - checkValid(ret, suffix, suffixRegexp); - return ret; -} - -var escapeIdentRegex = function(str) { - return str.replace(/([$])/, "\\$"); -}; - -var makeNodePromisifiedEval; -if (!true) { -var switchCaseArgumentOrder = function(likelyArgumentCount) { - var ret = [likelyArgumentCount]; - var min = Math.max(0, likelyArgumentCount - 1 - 3); - for(var i = likelyArgumentCount - 1; i >= min; --i) { - ret.push(i); - } - for(var i = likelyArgumentCount + 1; i <= 3; ++i) { - ret.push(i); - } - return ret; -}; - -var argumentSequence = function(argumentCount) { - return util.filledRange(argumentCount, "_arg", ""); -}; - -var parameterDeclaration = function(parameterCount) { - return util.filledRange( - Math.max(parameterCount, 3), "_arg", ""); -}; - -var parameterCount = function(fn) { - if (typeof fn.length === "number") { - return Math.max(Math.min(fn.length, 1023 + 1), 0); - } - return 0; -}; - -makeNodePromisifiedEval = -function(callback, receiver, originalName, fn, _, multiArgs) { - var newParameterCount = Math.max(0, parameterCount(fn) - 1); - var argumentOrder = switchCaseArgumentOrder(newParameterCount); - var shouldProxyThis = typeof callback === "string" || receiver === THIS; - - function generateCallForArgumentCount(count) { - var args = argumentSequence(count).join(", "); - var comma = count > 0 ? ", " : ""; - var ret; - if (shouldProxyThis) { - ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; - } else { - ret = receiver === undefined - ? "ret = callback({{args}}, nodeback); break;\n" - : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; - } - return ret.replace("{{args}}", args).replace(", ", comma); - } - - function generateArgumentSwitchCase() { - var ret = ""; - for (var i = 0; i < argumentOrder.length; ++i) { - ret += "case " + argumentOrder[i] +":" + - generateCallForArgumentCount(argumentOrder[i]); - } - - ret += " \n\ - default: \n\ - var args = new Array(len + 1); \n\ - var i = 0; \n\ - for (var i = 0; i < len; ++i) { \n\ - args[i] = arguments[i]; \n\ - } \n\ - args[i] = nodeback; \n\ - [CodeForCall] \n\ - break; \n\ - ".replace("[CodeForCall]", (shouldProxyThis - ? "ret = callback.apply(this, args);\n" - : "ret = callback.apply(receiver, args);\n")); - return ret; - } - - var getFunctionCode = typeof callback === "string" - ? ("this != null ? this['"+callback+"'] : fn") - : "fn"; - var body = "'use strict'; \n\ - var ret = function (Parameters) { \n\ - 'use strict'; \n\ - var len = arguments.length; \n\ - var promise = new Promise(INTERNAL); \n\ - promise._captureStackTrace(); \n\ - var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\ - var ret; \n\ - var callback = tryCatch([GetFunctionCode]); \n\ - switch(len) { \n\ - [CodeForSwitchCase] \n\ - } \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ - } \n\ - if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\ - return promise; \n\ - }; \n\ - notEnumerableProp(ret, '__isPromisified__', true); \n\ - return ret; \n\ - ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) - .replace("[GetFunctionCode]", getFunctionCode); - body = body.replace("Parameters", parameterDeclaration(newParameterCount)); - return new Function("Promise", - "fn", - "receiver", - "withAppended", - "maybeWrapAsError", - "nodebackForPromise", - "tryCatch", - "errorObj", - "notEnumerableProp", - "INTERNAL", - body)( - Promise, - fn, - receiver, - withAppended, - maybeWrapAsError, - nodebackForPromise, - util.tryCatch, - util.errorObj, - util.notEnumerableProp, - INTERNAL); -}; -} - -function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) { - var defaultThis = (function() {return this;})(); - var method = callback; - if (typeof method === "string") { - callback = fn; - } - function promisified() { - var _receiver = receiver; - if (receiver === THIS) _receiver = this; - var promise = new Promise(INTERNAL); - promise._captureStackTrace(); - var cb = typeof method === "string" && this !== defaultThis - ? this[method] : callback; - var fn = nodebackForPromise(promise, multiArgs); - try { - cb.apply(_receiver, withAppended(arguments, fn)); - } catch(e) { - promise._rejectCallback(maybeWrapAsError(e), true, true); - } - if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); - return promise; - } - util.notEnumerableProp(promisified, "__isPromisified__", true); - return promisified; -} - -var makeNodePromisified = canEvaluate - ? makeNodePromisifiedEval - : makeNodePromisifiedClosure; - -function promisifyAll(obj, suffix, filter, promisifier, multiArgs) { - var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); - var methods = - promisifiableMethods(obj, suffix, suffixRegexp, filter); - - for (var i = 0, len = methods.length; i < len; i+= 2) { - var key = methods[i]; - var fn = methods[i+1]; - var promisifiedKey = key + suffix; - if (promisifier === makeNodePromisified) { - obj[promisifiedKey] = - makeNodePromisified(key, THIS, key, fn, suffix, multiArgs); - } else { - var promisified = promisifier(fn, function() { - return makeNodePromisified(key, THIS, key, - fn, suffix, multiArgs); - }); - util.notEnumerableProp(promisified, "__isPromisified__", true); - obj[promisifiedKey] = promisified; - } - } - util.toFastProperties(obj); - return obj; -} - -function promisify(callback, receiver, multiArgs) { - return makeNodePromisified(callback, receiver, undefined, - callback, null, multiArgs); -} - -Promise.promisify = function (fn, options) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); - } - if (isPromisified(fn)) { - return fn; - } - options = Object(options); - var receiver = options.context === undefined ? THIS : options.context; - var multiArgs = !!options.multiArgs; - var ret = promisify(fn, receiver, multiArgs); - util.copyDescriptors(fn, ret, propsFilter); - return ret; -}; - -Promise.promisifyAll = function (target, options) { - if (typeof target !== "function" && typeof target !== "object") { - throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - options = Object(options); - var multiArgs = !!options.multiArgs; - var suffix = options.suffix; - if (typeof suffix !== "string") suffix = defaultSuffix; - var filter = options.filter; - if (typeof filter !== "function") filter = defaultFilter; - var promisifier = options.promisifier; - if (typeof promisifier !== "function") promisifier = makeNodePromisified; - - if (!util.isIdentifier(suffix)) { - throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - - var keys = util.inheritedDataKeys(target); - for (var i = 0; i < keys.length; ++i) { - var value = target[keys[i]]; - if (keys[i] !== "constructor" && - util.isClass(value)) { - promisifyAll(value.prototype, suffix, filter, promisifier, - multiArgs); - promisifyAll(value, suffix, filter, promisifier, multiArgs); - } - } - - return promisifyAll(target, suffix, filter, promisifier, multiArgs); -}; -}; - - -},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function( - Promise, PromiseArray, tryConvertToPromise, apiRejection) { -var util = _dereq_("./util"); -var isObject = util.isObject; -var es5 = _dereq_("./es5"); -var Es6Map; -if (typeof Map === "function") Es6Map = Map; - -var mapToEntries = (function() { - var index = 0; - var size = 0; - - function extractEntry(value, key) { - this[index] = value; - this[index + size] = key; - index++; - } - - return function mapToEntries(map) { - size = map.size; - index = 0; - var ret = new Array(map.size * 2); - map.forEach(extractEntry, ret); - return ret; - }; -})(); - -var entriesToMap = function(entries) { - var ret = new Es6Map(); - var length = entries.length / 2 | 0; - for (var i = 0; i < length; ++i) { - var key = entries[length + i]; - var value = entries[i]; - ret.set(key, value); - } - return ret; -}; - -function PropertiesPromiseArray(obj) { - var isMap = false; - var entries; - if (Es6Map !== undefined && obj instanceof Es6Map) { - entries = mapToEntries(obj); - isMap = true; - } else { - var keys = es5.keys(obj); - var len = keys.length; - entries = new Array(len * 2); - for (var i = 0; i < len; ++i) { - var key = keys[i]; - entries[i] = obj[key]; - entries[i + len] = key; - } - } - this.constructor$(entries); - this._isMap = isMap; - this._init$(undefined, isMap ? -6 : -3); -} -util.inherits(PropertiesPromiseArray, PromiseArray); - -PropertiesPromiseArray.prototype._init = function () {}; - -PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - var val; - if (this._isMap) { - val = entriesToMap(this._values); - } else { - val = {}; - var keyOffset = this.length(); - for (var i = 0, len = this.length(); i < len; ++i) { - val[this._values[i + keyOffset]] = this._values[i]; - } - } - this._resolve(val); - return true; - } - return false; -}; - -PropertiesPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; - -PropertiesPromiseArray.prototype.getActualLength = function (len) { - return len >> 1; -}; - -function props(promises) { - var ret; - var castValue = tryConvertToPromise(promises); - - if (!isObject(castValue)) { - return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } else if (castValue instanceof Promise) { - ret = castValue._then( - Promise.props, undefined, undefined, undefined, undefined); - } else { - ret = new PropertiesPromiseArray(castValue).promise(); - } - - if (castValue instanceof Promise) { - ret._propagateFrom(castValue, 2); - } - return ret; -} - -Promise.prototype.props = function () { - return props(this); -}; - -Promise.props = function (promises) { - return props(promises); -}; -}; - -},{"./es5":13,"./util":36}],26:[function(_dereq_,module,exports){ -"use strict"; -function arrayMove(src, srcIndex, dst, dstIndex, len) { - for (var j = 0; j < len; ++j) { - dst[j + dstIndex] = src[j + srcIndex]; - src[j + srcIndex] = void 0; - } -} - -function Queue(capacity) { - this._capacity = capacity; - this._length = 0; - this._front = 0; -} - -Queue.prototype._willBeOverCapacity = function (size) { - return this._capacity < size; -}; - -Queue.prototype._pushOne = function (arg) { - var length = this.length(); - this._checkCapacity(length + 1); - var i = (this._front + length) & (this._capacity - 1); - this[i] = arg; - this._length = length + 1; -}; - -Queue.prototype.push = function (fn, receiver, arg) { - var length = this.length() + 3; - if (this._willBeOverCapacity(length)) { - this._pushOne(fn); - this._pushOne(receiver); - this._pushOne(arg); - return; - } - var j = this._front + length - 3; - this._checkCapacity(length); - var wrapMask = this._capacity - 1; - this[(j + 0) & wrapMask] = fn; - this[(j + 1) & wrapMask] = receiver; - this[(j + 2) & wrapMask] = arg; - this._length = length; -}; - -Queue.prototype.shift = function () { - var front = this._front, - ret = this[front]; - - this[front] = undefined; - this._front = (front + 1) & (this._capacity - 1); - this._length--; - return ret; -}; - -Queue.prototype.length = function () { - return this._length; -}; - -Queue.prototype._checkCapacity = function (size) { - if (this._capacity < size) { - this._resizeTo(this._capacity << 1); - } -}; - -Queue.prototype._resizeTo = function (capacity) { - var oldCapacity = this._capacity; - this._capacity = capacity; - var front = this._front; - var length = this._length; - var moveItemsCount = (front + length) & (oldCapacity - 1); - arrayMove(this, 0, this, oldCapacity, moveItemsCount); -}; - -module.exports = Queue; - -},{}],27:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function( - Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var util = _dereq_("./util"); - -var raceLater = function (promise) { - return promise.then(function(array) { - return race(array, promise); - }); -}; - -function race(promises, parent) { - var maybePromise = tryConvertToPromise(promises); - - if (maybePromise instanceof Promise) { - return raceLater(maybePromise); - } else { - promises = util.asArray(promises); - if (promises === null) - return apiRejection("expecting an array or an iterable object but got " + util.classString(promises)); - } - - var ret = new Promise(INTERNAL); - if (parent !== undefined) { - ret._propagateFrom(parent, 3); - } - var fulfill = ret._fulfill; - var reject = ret._reject; - for (var i = 0, len = promises.length; i < len; ++i) { - var val = promises[i]; - - if (val === undefined && !(i in promises)) { - continue; - } - - Promise.cast(val)._then(fulfill, reject, undefined, ret, null); - } - return ret; -} - -Promise.race = function (promises) { - return race(promises, undefined); -}; - -Promise.prototype.race = function () { - return race(this, undefined); -}; - -}; - -},{"./util":36}],28:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL, - debug) { -var getDomain = Promise._getDomain; -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; - -function ReductionPromiseArray(promises, fn, initialValue, _each) { - this.constructor$(promises); - var domain = getDomain(); - this._fn = domain === null ? fn : util.domainBind(domain, fn); - if (initialValue !== undefined) { - initialValue = Promise.resolve(initialValue); - initialValue._attachCancellationCallback(this); - } - this._initialValue = initialValue; - this._currentCancellable = null; - if(_each === INTERNAL) { - this._eachValues = Array(this._length); - } else if (_each === 0) { - this._eachValues = null; - } else { - this._eachValues = undefined; - } - this._promise._captureStackTrace(); - this._init$(undefined, -5); -} -util.inherits(ReductionPromiseArray, PromiseArray); - -ReductionPromiseArray.prototype._gotAccum = function(accum) { - if (this._eachValues !== undefined && - this._eachValues !== null && - accum !== INTERNAL) { - this._eachValues.push(accum); - } -}; - -ReductionPromiseArray.prototype._eachComplete = function(value) { - if (this._eachValues !== null) { - this._eachValues.push(value); - } - return this._eachValues; -}; - -ReductionPromiseArray.prototype._init = function() {}; - -ReductionPromiseArray.prototype._resolveEmptyArray = function() { - this._resolve(this._eachValues !== undefined ? this._eachValues - : this._initialValue); -}; - -ReductionPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; - -ReductionPromiseArray.prototype._resolve = function(value) { - this._promise._resolveCallback(value); - this._values = null; -}; - -ReductionPromiseArray.prototype._resultCancelled = function(sender) { - if (sender === this._initialValue) return this._cancel(); - if (this._isResolved()) return; - this._resultCancelled$(); - if (this._currentCancellable instanceof Promise) { - this._currentCancellable.cancel(); - } - if (this._initialValue instanceof Promise) { - this._initialValue.cancel(); - } -}; - -ReductionPromiseArray.prototype._iterate = function (values) { - this._values = values; - var value; - var i; - var length = values.length; - if (this._initialValue !== undefined) { - value = this._initialValue; - i = 0; - } else { - value = Promise.resolve(values[0]); - i = 1; - } - - this._currentCancellable = value; - - if (!value.isRejected()) { - for (; i < length; ++i) { - var ctx = { - accum: null, - value: values[i], - index: i, - length: length, - array: this - }; - value = value._then(gotAccum, undefined, undefined, ctx, undefined); - } - } - - if (this._eachValues !== undefined) { - value = value - ._then(this._eachComplete, undefined, undefined, this, undefined); - } - value._then(completed, completed, undefined, value, this); -}; - -Promise.prototype.reduce = function (fn, initialValue) { - return reduce(this, fn, initialValue, null); -}; - -Promise.reduce = function (promises, fn, initialValue, _each) { - return reduce(promises, fn, initialValue, _each); -}; - -function completed(valueOrReason, array) { - if (this.isFulfilled()) { - array._resolve(valueOrReason); - } else { - array._reject(valueOrReason); - } -} - -function reduce(promises, fn, initialValue, _each) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var array = new ReductionPromiseArray(promises, fn, initialValue, _each); - return array.promise(); -} - -function gotAccum(accum) { - this.accum = accum; - this.array._gotAccum(accum); - var value = tryConvertToPromise(this.value, this.array._promise); - if (value instanceof Promise) { - this.array._currentCancellable = value; - return value._then(gotValue, undefined, undefined, this, undefined); - } else { - return gotValue.call(this, value); - } -} - -function gotValue(value) { - var array = this.array; - var promise = array._promise; - var fn = tryCatch(array._fn); - promise._pushContext(); - var ret; - if (array._eachValues !== undefined) { - ret = fn.call(promise._boundValue(), value, this.index, this.length); - } else { - ret = fn.call(promise._boundValue(), - this.accum, value, this.index, this.length); - } - if (ret instanceof Promise) { - array._currentCancellable = ret; - } - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, - promiseCreated, - array._eachValues !== undefined ? "Promise.each" : "Promise.reduce", - promise - ); - return ret; -} -}; - -},{"./util":36}],29:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util"); -var schedule; -var noAsyncScheduler = function() { - throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); -}; -var NativePromise = util.getNativePromise(); -if (util.isNode && typeof MutationObserver === "undefined") { - var GlobalSetImmediate = global.setImmediate; - var ProcessNextTick = process.nextTick; - schedule = util.isRecentNode - ? function(fn) { GlobalSetImmediate.call(global, fn); } - : function(fn) { ProcessNextTick.call(process, fn); }; -} else if (typeof NativePromise === "function" && - typeof NativePromise.resolve === "function") { - var nativePromise = NativePromise.resolve(); - schedule = function(fn) { - nativePromise.then(fn); - }; -} else if ((typeof MutationObserver !== "undefined") && - !(typeof window !== "undefined" && - window.navigator && - (window.navigator.standalone || window.cordova)) && - ("classList" in document.documentElement)) { - schedule = (function() { - var div = document.createElement("div"); - var opts = {attributes: true}; - var toggleScheduled = false; - var div2 = document.createElement("div"); - var o2 = new MutationObserver(function() { - div.classList.toggle("foo"); - toggleScheduled = false; - }); - o2.observe(div2, opts); - - var scheduleToggle = function() { - if (toggleScheduled) return; - toggleScheduled = true; - div2.classList.toggle("foo"); - }; - - return function schedule(fn) { - var o = new MutationObserver(function() { - o.disconnect(); - fn(); - }); - o.observe(div, opts); - scheduleToggle(); - }; - })(); -} else if (typeof setImmediate !== "undefined") { - schedule = function (fn) { - setImmediate(fn); - }; -} else if (typeof setTimeout !== "undefined") { - schedule = function (fn) { - setTimeout(fn, 0); - }; -} else { - schedule = noAsyncScheduler; -} -module.exports = schedule; - -},{"./util":36}],30:[function(_dereq_,module,exports){ -"use strict"; -module.exports = - function(Promise, PromiseArray, debug) { -var PromiseInspection = Promise.PromiseInspection; -var util = _dereq_("./util"); - -function SettledPromiseArray(values) { - this.constructor$(values); -} -util.inherits(SettledPromiseArray, PromiseArray); - -SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { - this._values[index] = inspection; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - return true; - } - return false; -}; - -SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { - var ret = new PromiseInspection(); - ret._bitField = 33554432; - ret._settledValueField = value; - return this._promiseResolved(index, ret); -}; -SettledPromiseArray.prototype._promiseRejected = function (reason, index) { - var ret = new PromiseInspection(); - ret._bitField = 16777216; - ret._settledValueField = reason; - return this._promiseResolved(index, ret); -}; - -Promise.settle = function (promises) { - debug.deprecated(".settle()", ".reflect()"); - return new SettledPromiseArray(promises).promise(); -}; - -Promise.prototype.settle = function () { - return Promise.settle(this); -}; -}; - -},{"./util":36}],31:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, apiRejection) { -var util = _dereq_("./util"); -var RangeError = _dereq_("./errors").RangeError; -var AggregateError = _dereq_("./errors").AggregateError; -var isArray = util.isArray; -var CANCELLATION = {}; - - -function SomePromiseArray(values) { - this.constructor$(values); - this._howMany = 0; - this._unwrap = false; - this._initialized = false; -} -util.inherits(SomePromiseArray, PromiseArray); - -SomePromiseArray.prototype._init = function () { - if (!this._initialized) { - return; - } - if (this._howMany === 0) { - this._resolve([]); - return; - } - this._init$(undefined, -5); - var isArrayResolved = isArray(this._values); - if (!this._isResolved() && - isArrayResolved && - this._howMany > this._canPossiblyFulfill()) { - this._reject(this._getRangeError(this.length())); - } -}; - -SomePromiseArray.prototype.init = function () { - this._initialized = true; - this._init(); -}; - -SomePromiseArray.prototype.setUnwrap = function () { - this._unwrap = true; -}; - -SomePromiseArray.prototype.howMany = function () { - return this._howMany; -}; - -SomePromiseArray.prototype.setHowMany = function (count) { - this._howMany = count; -}; - -SomePromiseArray.prototype._promiseFulfilled = function (value) { - this._addFulfilled(value); - if (this._fulfilled() === this.howMany()) { - this._values.length = this.howMany(); - if (this.howMany() === 1 && this._unwrap) { - this._resolve(this._values[0]); - } else { - this._resolve(this._values); - } - return true; - } - return false; - -}; -SomePromiseArray.prototype._promiseRejected = function (reason) { - this._addRejected(reason); - return this._checkOutcome(); -}; - -SomePromiseArray.prototype._promiseCancelled = function () { - if (this._values instanceof Promise || this._values == null) { - return this._cancel(); - } - this._addRejected(CANCELLATION); - return this._checkOutcome(); -}; - -SomePromiseArray.prototype._checkOutcome = function() { - if (this.howMany() > this._canPossiblyFulfill()) { - var e = new AggregateError(); - for (var i = this.length(); i < this._values.length; ++i) { - if (this._values[i] !== CANCELLATION) { - e.push(this._values[i]); - } - } - if (e.length > 0) { - this._reject(e); - } else { - this._cancel(); - } - return true; - } - return false; -}; - -SomePromiseArray.prototype._fulfilled = function () { - return this._totalResolved; -}; - -SomePromiseArray.prototype._rejected = function () { - return this._values.length - this.length(); -}; - -SomePromiseArray.prototype._addRejected = function (reason) { - this._values.push(reason); -}; - -SomePromiseArray.prototype._addFulfilled = function (value) { - this._values[this._totalResolved++] = value; -}; - -SomePromiseArray.prototype._canPossiblyFulfill = function () { - return this.length() - this._rejected(); -}; - -SomePromiseArray.prototype._getRangeError = function (count) { - var message = "Input array must contain at least " + - this._howMany + " items but contains only " + count + " items"; - return new RangeError(message); -}; - -SomePromiseArray.prototype._resolveEmptyArray = function () { - this._reject(this._getRangeError(0)); -}; - -function some(promises, howMany) { - if ((howMany | 0) !== howMany || howMany < 0) { - return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(howMany); - ret.init(); - return promise; -} - -Promise.some = function (promises, howMany) { - return some(promises, howMany); -}; - -Promise.prototype.some = function (howMany) { - return some(this, howMany); -}; - -Promise._SomePromiseArray = SomePromiseArray; -}; - -},{"./errors":12,"./util":36}],32:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -function PromiseInspection(promise) { - if (promise !== undefined) { - promise = promise._target(); - this._bitField = promise._bitField; - this._settledValueField = promise._isFateSealed() - ? promise._settledValue() : undefined; - } - else { - this._bitField = 0; - this._settledValueField = undefined; - } -} - -PromiseInspection.prototype._settledValue = function() { - return this._settledValueField; -}; - -var value = PromiseInspection.prototype.value = function () { - if (!this.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - return this._settledValue(); -}; - -var reason = PromiseInspection.prototype.error = -PromiseInspection.prototype.reason = function () { - if (!this.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - return this._settledValue(); -}; - -var isFulfilled = PromiseInspection.prototype.isFulfilled = function() { - return (this._bitField & 33554432) !== 0; -}; - -var isRejected = PromiseInspection.prototype.isRejected = function () { - return (this._bitField & 16777216) !== 0; -}; - -var isPending = PromiseInspection.prototype.isPending = function () { - return (this._bitField & 50397184) === 0; -}; - -var isResolved = PromiseInspection.prototype.isResolved = function () { - return (this._bitField & 50331648) !== 0; -}; - -PromiseInspection.prototype.isCancelled = function() { - return (this._bitField & 8454144) !== 0; -}; - -Promise.prototype.__isCancelled = function() { - return (this._bitField & 65536) === 65536; -}; - -Promise.prototype._isCancelled = function() { - return this._target().__isCancelled(); -}; - -Promise.prototype.isCancelled = function() { - return (this._target()._bitField & 8454144) !== 0; -}; - -Promise.prototype.isPending = function() { - return isPending.call(this._target()); -}; - -Promise.prototype.isRejected = function() { - return isRejected.call(this._target()); -}; - -Promise.prototype.isFulfilled = function() { - return isFulfilled.call(this._target()); -}; - -Promise.prototype.isResolved = function() { - return isResolved.call(this._target()); -}; - -Promise.prototype.value = function() { - return value.call(this._target()); -}; - -Promise.prototype.reason = function() { - var target = this._target(); - target._unsetRejectionIsUnhandled(); - return reason.call(target); -}; - -Promise.prototype._value = function() { - return this._settledValue(); -}; - -Promise.prototype._reason = function() { - this._unsetRejectionIsUnhandled(); - return this._settledValue(); -}; - -Promise.PromiseInspection = PromiseInspection; -}; - -},{}],33:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = _dereq_("./util"); -var errorObj = util.errorObj; -var isObject = util.isObject; - -function tryConvertToPromise(obj, context) { - if (isObject(obj)) { - if (obj instanceof Promise) return obj; - var then = getThen(obj); - if (then === errorObj) { - if (context) context._pushContext(); - var ret = Promise.reject(then.e); - if (context) context._popContext(); - return ret; - } else if (typeof then === "function") { - if (isAnyBluebirdPromise(obj)) { - var ret = new Promise(INTERNAL); - obj._then( - ret._fulfill, - ret._reject, - undefined, - ret, - null - ); - return ret; - } - return doThenable(obj, then, context); - } - } - return obj; -} - -function doGetThen(obj) { - return obj.then; -} - -function getThen(obj) { - try { - return doGetThen(obj); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} - -var hasProp = {}.hasOwnProperty; -function isAnyBluebirdPromise(obj) { - try { - return hasProp.call(obj, "_promise0"); - } catch (e) { - return false; - } -} - -function doThenable(x, then, context) { - var promise = new Promise(INTERNAL); - var ret = promise; - if (context) context._pushContext(); - promise._captureStackTrace(); - if (context) context._popContext(); - var synchronous = true; - var result = util.tryCatch(then).call(x, resolve, reject); - synchronous = false; - - if (promise && result === errorObj) { - promise._rejectCallback(result.e, true, true); - promise = null; - } - - function resolve(value) { - if (!promise) return; - promise._resolveCallback(value); - promise = null; - } - - function reject(reason) { - if (!promise) return; - promise._rejectCallback(reason, synchronous, true); - promise = null; - } - return ret; -} - -return tryConvertToPromise; -}; - -},{"./util":36}],34:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, debug) { -var util = _dereq_("./util"); -var TimeoutError = Promise.TimeoutError; - -function HandleWrapper(handle) { - this.handle = handle; -} - -HandleWrapper.prototype._resultCancelled = function() { - clearTimeout(this.handle); -}; - -var afterValue = function(value) { return delay(+this).thenReturn(value); }; -var delay = Promise.delay = function (ms, value) { - var ret; - var handle; - if (value !== undefined) { - ret = Promise.resolve(value) - ._then(afterValue, null, null, ms, undefined); - if (debug.cancellation() && value instanceof Promise) { - ret._setOnCancel(value); - } - } else { - ret = new Promise(INTERNAL); - handle = setTimeout(function() { ret._fulfill(); }, +ms); - if (debug.cancellation()) { - ret._setOnCancel(new HandleWrapper(handle)); - } - ret._captureStackTrace(); - } - ret._setAsyncGuaranteed(); - return ret; -}; - -Promise.prototype.delay = function (ms) { - return delay(ms, this); -}; - -var afterTimeout = function (promise, message, parent) { - var err; - if (typeof message !== "string") { - if (message instanceof Error) { - err = message; - } else { - err = new TimeoutError("operation timed out"); - } - } else { - err = new TimeoutError(message); - } - util.markAsOriginatingFromRejection(err); - promise._attachExtraTrace(err); - promise._reject(err); - - if (parent != null) { - parent.cancel(); - } -}; - -function successClear(value) { - clearTimeout(this.handle); - return value; -} - -function failureClear(reason) { - clearTimeout(this.handle); - throw reason; -} - -Promise.prototype.timeout = function (ms, message) { - ms = +ms; - var ret, parent; - - var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() { - if (ret.isPending()) { - afterTimeout(ret, message, parent); - } - }, ms)); - - if (debug.cancellation()) { - parent = this.then(); - ret = parent._then(successClear, failureClear, - undefined, handleWrapper, undefined); - ret._setOnCancel(handleWrapper); - } else { - ret = this._then(successClear, failureClear, - undefined, handleWrapper, undefined); - } - - return ret; -}; - -}; - -},{"./util":36}],35:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function (Promise, apiRejection, tryConvertToPromise, - createContext, INTERNAL, debug) { - var util = _dereq_("./util"); - var TypeError = _dereq_("./errors").TypeError; - var inherits = _dereq_("./util").inherits; - var errorObj = util.errorObj; - var tryCatch = util.tryCatch; - var NULL = {}; - - function thrower(e) { - setTimeout(function(){throw e;}, 0); - } - - function castPreservingDisposable(thenable) { - var maybePromise = tryConvertToPromise(thenable); - if (maybePromise !== thenable && - typeof thenable._isDisposable === "function" && - typeof thenable._getDisposer === "function" && - thenable._isDisposable()) { - maybePromise._setDisposable(thenable._getDisposer()); - } - return maybePromise; - } - function dispose(resources, inspection) { - var i = 0; - var len = resources.length; - var ret = new Promise(INTERNAL); - function iterator() { - if (i >= len) return ret._fulfill(); - var maybePromise = castPreservingDisposable(resources[i++]); - if (maybePromise instanceof Promise && - maybePromise._isDisposable()) { - try { - maybePromise = tryConvertToPromise( - maybePromise._getDisposer().tryDispose(inspection), - resources.promise); - } catch (e) { - return thrower(e); - } - if (maybePromise instanceof Promise) { - return maybePromise._then(iterator, thrower, - null, null, null); - } - } - iterator(); - } - iterator(); - return ret; - } - - function Disposer(data, promise, context) { - this._data = data; - this._promise = promise; - this._context = context; - } - - Disposer.prototype.data = function () { - return this._data; - }; - - Disposer.prototype.promise = function () { - return this._promise; - }; - - Disposer.prototype.resource = function () { - if (this.promise().isFulfilled()) { - return this.promise().value(); - } - return NULL; - }; - - Disposer.prototype.tryDispose = function(inspection) { - var resource = this.resource(); - var context = this._context; - if (context !== undefined) context._pushContext(); - var ret = resource !== NULL - ? this.doDispose(resource, inspection) : null; - if (context !== undefined) context._popContext(); - this._promise._unsetDisposable(); - this._data = null; - return ret; - }; - - Disposer.isDisposer = function (d) { - return (d != null && - typeof d.resource === "function" && - typeof d.tryDispose === "function"); - }; - - function FunctionDisposer(fn, promise, context) { - this.constructor$(fn, promise, context); - } - inherits(FunctionDisposer, Disposer); - - FunctionDisposer.prototype.doDispose = function (resource, inspection) { - var fn = this.data(); - return fn.call(resource, resource, inspection); - }; - - function maybeUnwrapDisposer(value) { - if (Disposer.isDisposer(value)) { - this.resources[this.index]._setDisposable(value); - return value.promise(); - } - return value; - } - - function ResourceList(length) { - this.length = length; - this.promise = null; - this[length-1] = null; - } - - ResourceList.prototype._resultCancelled = function() { - var len = this.length; - for (var i = 0; i < len; ++i) { - var item = this[i]; - if (item instanceof Promise) { - item.cancel(); - } - } - }; - - Promise.using = function () { - var len = arguments.length; - if (len < 2) return apiRejection( - "you must pass at least 2 arguments to Promise.using"); - var fn = arguments[len - 1]; - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var input; - var spreadArgs = true; - if (len === 2 && Array.isArray(arguments[0])) { - input = arguments[0]; - len = input.length; - spreadArgs = false; - } else { - input = arguments; - len--; - } - var resources = new ResourceList(len); - for (var i = 0; i < len; ++i) { - var resource = input[i]; - if (Disposer.isDisposer(resource)) { - var disposer = resource; - resource = resource.promise(); - resource._setDisposable(disposer); - } else { - var maybePromise = tryConvertToPromise(resource); - if (maybePromise instanceof Promise) { - resource = - maybePromise._then(maybeUnwrapDisposer, null, null, { - resources: resources, - index: i - }, undefined); - } - } - resources[i] = resource; - } - - var reflectedResources = new Array(resources.length); - for (var i = 0; i < reflectedResources.length; ++i) { - reflectedResources[i] = Promise.resolve(resources[i]).reflect(); - } - - var resultPromise = Promise.all(reflectedResources) - .then(function(inspections) { - for (var i = 0; i < inspections.length; ++i) { - var inspection = inspections[i]; - if (inspection.isRejected()) { - errorObj.e = inspection.error(); - return errorObj; - } else if (!inspection.isFulfilled()) { - resultPromise.cancel(); - return; - } - inspections[i] = inspection.value(); - } - promise._pushContext(); - - fn = tryCatch(fn); - var ret = spreadArgs - ? fn.apply(undefined, inspections) : fn(inspections); - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, promiseCreated, "Promise.using", promise); - return ret; - }); - - var promise = resultPromise.lastly(function() { - var inspection = new Promise.PromiseInspection(resultPromise); - return dispose(resources, inspection); - }); - resources.promise = promise; - promise._setOnCancel(resources); - return promise; - }; - - Promise.prototype._setDisposable = function (disposer) { - this._bitField = this._bitField | 131072; - this._disposer = disposer; - }; - - Promise.prototype._isDisposable = function () { - return (this._bitField & 131072) > 0; - }; - - Promise.prototype._getDisposer = function () { - return this._disposer; - }; - - Promise.prototype._unsetDisposable = function () { - this._bitField = this._bitField & (~131072); - this._disposer = undefined; - }; - - Promise.prototype.disposer = function (fn) { - if (typeof fn === "function") { - return new FunctionDisposer(fn, this, createContext()); - } - throw new TypeError(); - }; - -}; - -},{"./errors":12,"./util":36}],36:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5"); -var canEvaluate = typeof navigator == "undefined"; - -var errorObj = {e: {}}; -var tryCatchTarget; -var globalObject = typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : - typeof global !== "undefined" ? global : - this !== undefined ? this : null; - -function tryCatcher() { - try { - var target = tryCatchTarget; - tryCatchTarget = null; - return target.apply(this, arguments); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} -function tryCatch(fn) { - tryCatchTarget = fn; - return tryCatcher; -} - -var inherits = function(Child, Parent) { - var hasProp = {}.hasOwnProperty; - - function T() { - this.constructor = Child; - this.constructor$ = Parent; - for (var propertyName in Parent.prototype) { - if (hasProp.call(Parent.prototype, propertyName) && - propertyName.charAt(propertyName.length-1) !== "$" - ) { - this[propertyName + "$"] = Parent.prototype[propertyName]; - } - } - } - T.prototype = Parent.prototype; - Child.prototype = new T(); - return Child.prototype; -}; - - -function isPrimitive(val) { - return val == null || val === true || val === false || - typeof val === "string" || typeof val === "number"; - -} - -function isObject(value) { - return typeof value === "function" || - typeof value === "object" && value !== null; -} - -function maybeWrapAsError(maybeError) { - if (!isPrimitive(maybeError)) return maybeError; - - return new Error(safeToString(maybeError)); -} - -function withAppended(target, appendee) { - var len = target.length; - var ret = new Array(len + 1); - var i; - for (i = 0; i < len; ++i) { - ret[i] = target[i]; - } - ret[i] = appendee; - return ret; -} - -function getDataPropertyOrDefault(obj, key, defaultValue) { - if (es5.isES5) { - var desc = Object.getOwnPropertyDescriptor(obj, key); - - if (desc != null) { - return desc.get == null && desc.set == null - ? desc.value - : defaultValue; - } - } else { - return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; - } -} - -function notEnumerableProp(obj, name, value) { - if (isPrimitive(obj)) return obj; - var descriptor = { - value: value, - configurable: true, - enumerable: false, - writable: true - }; - es5.defineProperty(obj, name, descriptor); - return obj; -} - -function thrower(r) { - throw r; -} - -var inheritedDataKeys = (function() { - var excludedPrototypes = [ - Array.prototype, - Object.prototype, - Function.prototype - ]; - - var isExcludedProto = function(val) { - for (var i = 0; i < excludedPrototypes.length; ++i) { - if (excludedPrototypes[i] === val) { - return true; - } - } - return false; - }; - - if (es5.isES5) { - var getKeys = Object.getOwnPropertyNames; - return function(obj) { - var ret = []; - var visitedKeys = Object.create(null); - while (obj != null && !isExcludedProto(obj)) { - var keys; - try { - keys = getKeys(obj); - } catch (e) { - return ret; - } - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (visitedKeys[key]) continue; - visitedKeys[key] = true; - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null && desc.get == null && desc.set == null) { - ret.push(key); - } - } - obj = es5.getPrototypeOf(obj); - } - return ret; - }; - } else { - var hasProp = {}.hasOwnProperty; - return function(obj) { - if (isExcludedProto(obj)) return []; - var ret = []; - - /*jshint forin:false */ - enumeration: for (var key in obj) { - if (hasProp.call(obj, key)) { - ret.push(key); - } else { - for (var i = 0; i < excludedPrototypes.length; ++i) { - if (hasProp.call(excludedPrototypes[i], key)) { - continue enumeration; - } - } - ret.push(key); - } - } - return ret; - }; - } - -})(); - -var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; -function isClass(fn) { - try { - if (typeof fn === "function") { - var keys = es5.names(fn.prototype); - - var hasMethods = es5.isES5 && keys.length > 1; - var hasMethodsOtherThanConstructor = keys.length > 0 && - !(keys.length === 1 && keys[0] === "constructor"); - var hasThisAssignmentAndStaticMethods = - thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; - - if (hasMethods || hasMethodsOtherThanConstructor || - hasThisAssignmentAndStaticMethods) { - return true; - } - } - return false; - } catch (e) { - return false; - } -} - -function toFastProperties(obj) { - /*jshint -W027,-W055,-W031*/ - function FakeConstructor() {} - FakeConstructor.prototype = obj; - var receiver = new FakeConstructor(); - function ic() { - return typeof receiver.foo; - } - ic(); - ic(); - return obj; - eval(obj); -} - -var rident = /^[a-z$_][a-z$_0-9]*$/i; -function isIdentifier(str) { - return rident.test(str); -} - -function filledRange(count, prefix, suffix) { - var ret = new Array(count); - for(var i = 0; i < count; ++i) { - ret[i] = prefix + i + suffix; - } - return ret; -} - -function safeToString(obj) { - try { - return obj + ""; - } catch (e) { - return "[no string representation]"; - } -} - -function isError(obj) { - return obj instanceof Error || - (obj !== null && - typeof obj === "object" && - typeof obj.message === "string" && - typeof obj.name === "string"); -} - -function markAsOriginatingFromRejection(e) { - try { - notEnumerableProp(e, "isOperational", true); - } - catch(ignore) {} -} - -function originatesFromRejection(e) { - if (e == null) return false; - return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || - e["isOperational"] === true); -} - -function canAttachTrace(obj) { - return isError(obj) && es5.propertyIsWritable(obj, "stack"); -} - -var ensureErrorObject = (function() { - if (!("stack" in new Error())) { - return function(value) { - if (canAttachTrace(value)) return value; - try {throw new Error(safeToString(value));} - catch(err) {return err;} - }; - } else { - return function(value) { - if (canAttachTrace(value)) return value; - return new Error(safeToString(value)); - }; - } -})(); - -function classString(obj) { - return {}.toString.call(obj); -} - -function copyDescriptors(from, to, filter) { - var keys = es5.names(from); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (filter(key)) { - try { - es5.defineProperty(to, key, es5.getDescriptor(from, key)); - } catch (ignore) {} - } - } -} - -var asArray = function(v) { - if (es5.isArray(v)) { - return v; - } - return null; -}; - -if (typeof Symbol !== "undefined" && Symbol.iterator) { - var ArrayFrom = typeof Array.from === "function" ? function(v) { - return Array.from(v); - } : function(v) { - var ret = []; - var it = v[Symbol.iterator](); - var itResult; - while (!((itResult = it.next()).done)) { - ret.push(itResult.value); - } - return ret; - }; - - asArray = function(v) { - if (es5.isArray(v)) { - return v; - } else if (v != null && typeof v[Symbol.iterator] === "function") { - return ArrayFrom(v); - } - return null; - }; -} - -var isNode = typeof process !== "undefined" && - classString(process).toLowerCase() === "[object process]"; - -var hasEnvVariables = typeof process !== "undefined" && - typeof process.env !== "undefined"; - -function env(key) { - return hasEnvVariables ? process.env[key] : undefined; -} - -function getNativePromise() { - if (typeof Promise === "function") { - try { - var promise = new Promise(function(){}); - if ({}.toString.call(promise) === "[object Promise]") { - return Promise; - } - } catch (e) {} - } -} - -function domainBind(self, cb) { - return self.bind(cb); -} - -var ret = { - isClass: isClass, - isIdentifier: isIdentifier, - inheritedDataKeys: inheritedDataKeys, - getDataPropertyOrDefault: getDataPropertyOrDefault, - thrower: thrower, - isArray: es5.isArray, - asArray: asArray, - notEnumerableProp: notEnumerableProp, - isPrimitive: isPrimitive, - isObject: isObject, - isError: isError, - canEvaluate: canEvaluate, - errorObj: errorObj, - tryCatch: tryCatch, - inherits: inherits, - withAppended: withAppended, - maybeWrapAsError: maybeWrapAsError, - toFastProperties: toFastProperties, - filledRange: filledRange, - toString: safeToString, - canAttachTrace: canAttachTrace, - ensureErrorObject: ensureErrorObject, - originatesFromRejection: originatesFromRejection, - markAsOriginatingFromRejection: markAsOriginatingFromRejection, - classString: classString, - copyDescriptors: copyDescriptors, - hasDevTools: typeof chrome !== "undefined" && chrome && - typeof chrome.loadTimes === "function", - isNode: isNode, - hasEnvVariables: hasEnvVariables, - env: env, - global: globalObject, - getNativePromise: getNativePromise, - domainBind: domainBind -}; -ret.isRecentNode = ret.isNode && (function() { - var version; - if (process.versions && process.versions.node) { - version = process.versions.node.split(".").map(Number); - } else if (process.version) { - version = process.version.split(".").map(Number); - } - return (version[0] === 0 && version[1] > 10) || (version[0] > 0); -})(); - -if (ret.isNode) ret.toFastProperties(process); - -try {throw new Error(); } catch (e) {ret.lastLineError = e;} -module.exports = ret; - -},{"./es5":13}]},{},[4])(4) -}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) - -},{"_process":571,"timers":622}],96:[function(require,module,exports){ -var concatMap = require('concat-map'); -var balanced = require('balanced-match'); - -module.exports = expandTop; - -var escSlash = '\0SLASH'+Math.random()+'\0'; -var escOpen = '\0OPEN'+Math.random()+'\0'; -var escClose = '\0CLOSE'+Math.random()+'\0'; -var escComma = '\0COMMA'+Math.random()+'\0'; -var escPeriod = '\0PERIOD'+Math.random()+'\0'; - -function numeric(str) { - return parseInt(str, 10) == str - ? parseInt(str, 10) - : str.charCodeAt(0); -} - -function escapeBraces(str) { - return str.split('\\\\').join(escSlash) - .split('\\{').join(escOpen) - .split('\\}').join(escClose) - .split('\\,').join(escComma) - .split('\\.').join(escPeriod); -} - -function unescapeBraces(str) { - return str.split(escSlash).join('\\') - .split(escOpen).join('{') - .split(escClose).join('}') - .split(escComma).join(',') - .split(escPeriod).join('.'); -} - - -// Basically just str.split(","), but handling cases -// where we have nested braced sections, which should be -// treated as individual members, like {a,{b,c},d} -function parseCommaParts(str) { - if (!str) - return ['']; - - var parts = []; - var m = balanced('{', '}', str); - - if (!m) - return str.split(','); - - var pre = m.pre; - var body = m.body; - var post = m.post; - var p = pre.split(','); - - p[p.length-1] += '{' + body + '}'; - var postParts = parseCommaParts(post); - if (post.length) { - p[p.length-1] += postParts.shift(); - p.push.apply(p, postParts); - } - - parts.push.apply(parts, p); - - return parts; -} - -function expandTop(str) { - if (!str) - return []; - - // I don't know why Bash 4.3 does this, but it does. - // Anything starting with {} will have the first two bytes preserved - // but *only* at the top level, so {},a}b will not expand to anything, - // but a{},b}c will be expanded to [a}c,abc]. - // One could argue that this is a bug in Bash, but since the goal of - // this module is to match Bash's rules, we escape a leading {} - if (str.substr(0, 2) === '{}') { - str = '\\{\\}' + str.substr(2); - } - - return expand(escapeBraces(str), true).map(unescapeBraces); -} - -function identity(e) { - return e; -} - -function embrace(str) { - return '{' + str + '}'; -} -function isPadded(el) { - return /^-?0\d/.test(el); -} - -function lte(i, y) { - return i <= y; -} -function gte(i, y) { - return i >= y; -} - -function expand(str, isTop) { - var expansions = []; - - var m = balanced('{', '}', str); - if (!m || /\$$/.test(m.pre)) return [str]; - - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = m.body.indexOf(',') >= 0; - if (!isSequence && !isOptions) { - // {a},b} - if (m.post.match(/,.*\}/)) { - str = m.pre + '{' + m.body + escClose + m.post; - return expand(str); - } - return [str]; - } - - var n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - // x{{a,b}}y ==> x{a}y x{b}y - n = expand(n[0], false).map(embrace); - if (n.length === 1) { - var post = m.post.length - ? expand(m.post, false) - : ['']; - return post.map(function(p) { - return m.pre + n[0] + p; - }); - } - } - } - - // at this point, n is the parts, and we know it's not a comma set - // with a single entry. - - // no need to expand pre, since it is guaranteed to be free of brace-sets - var pre = m.pre; - var post = m.post.length - ? expand(m.post, false) - : ['']; - - var N; - - if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length) - var incr = n.length == 3 - ? Math.abs(numeric(n[2])) - : 1; - var test = lte; - var reverse = y < x; - if (reverse) { - incr *= -1; - test = gte; - } - var pad = n.some(isPadded); - - N = []; - - for (var i = x; test(i, y); i += incr) { - var c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === '\\') - c = ''; - } else { - c = String(i); - if (pad) { - var need = width - c.length; - if (need > 0) { - var z = new Array(need + 1).join('0'); - if (i < 0) - c = '-' + z + c.slice(1); - else - c = z + c; - } - } - } - N.push(c); - } - } else { - N = concatMap(n, function(el) { return expand(el, false) }); - } - - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) - expansions.push(expansion); - } - } - - return expansions; -} - - -},{"balanced-match":92,"concat-map":117}],97:[function(require,module,exports){ - -},{}],98:[function(require,module,exports){ -arguments[4][97][0].apply(exports,arguments) -},{"dup":97}],99:[function(require,module,exports){ -(function (Buffer){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' - -var base64 = require('base64-js') -var ieee754 = require('ieee754') -var customInspectSymbol = - (typeof Symbol === 'function' && typeof Symbol.for === 'function') - ? Symbol.for('nodejs.util.inspect.custom') - : null - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -var K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ -Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() - -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && - typeof console.error === 'function') { - console.error( - 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' - ) -} - -function typedArraySupport () { - // Can typed array instances can be augmented? - try { - var arr = new Uint8Array(1) - var proto = { foo: function () { return 42 } } - Object.setPrototypeOf(proto, Uint8Array.prototype) - Object.setPrototypeOf(arr, proto) - return arr.foo() === 42 - } catch (e) { - return false - } -} - -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) - -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) - -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') - } - // Return an augmented `Uint8Array` instance - var buf = new Uint8Array(length) - Object.setPrototypeOf(buf, Buffer.prototype) - return buf -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) - } - return from(arg, encodingOrOffset, length) -} - -// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species != null && - Buffer[Symbol.species] === Buffer) { - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true, - enumerable: false, - writable: false - }) -} - -Buffer.poolSize = 8192 // not used by this implementation - -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - if (ArrayBuffer.isView(value)) { - return fromArrayLike(value) - } - - if (value == null) { - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } - - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) - } - - var valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) - } - - var b = fromObject(value) - if (b) return b - - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from( - value[Symbol.toPrimitive]('string'), encodingOrOffset, length - ) - } - - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length) -} - -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) -Object.setPrototypeOf(Buffer, Uint8Array) - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} - -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(size).fill(fill, encoding) - : createBuffer(size).fill(fill) - } - return createBuffer(size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} - -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(size) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - - var length = byteLength(string, encoding) | 0 - var buf = createBuffer(length) - - var actual = buf.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual) - } - - return buf -} - -function fromArrayLike (array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - var buf = createBuffer(length) - for (var i = 0; i < length; i += 1) { - buf[i] = array[i] & 255 - } - return buf -} - -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') - } - - var buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) - } else { - buf = new Uint8Array(array, byteOffset, length) - } - - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype) - - return buf -} - -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - var buf = createBuffer(len) - - if (buf.length === 0) { - return buf - } - - obj.copy(buf, 0, 0, len) - return buf - } - - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) - } - return fromArrayLike(obj) - } - - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} - -function checked (length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false -} - -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (isInstance(buf, Uint8Array)) { - buf = Buffer.from(buf) - } - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) - } - - var len = string.length - var mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.toLocaleString = Buffer.prototype.toString - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} -if (customInspectSymbol) { - Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (numberIsNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - var strLen = string.length - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (numberIsNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0 - if (isFinite(length)) { - length = length >>> 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype) - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (var i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } else if (typeof val === 'number') { - val = val & 255 - } else if (typeof val === 'boolean') { - val = Number(val) - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : Buffer.from(val, encoding) - var len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -}).call(this,require("buffer").Buffer) - -},{"base64-js":93,"buffer":99,"ieee754":545}],100:[function(require,module,exports){ -module.exports = require('./src/table'); -},{"./src/table":103}],101:[function(require,module,exports){ -const utils = require('./utils'); - -class Cell { - /** - * A representation of a cell within the table. - * Implementations must have `init` and `draw` methods, - * as well as `colSpan`, `rowSpan`, `desiredHeight` and `desiredWidth` properties. - * @param options - * @constructor - */ - constructor(options) { - this.setOptions(options); - - /** - * Each cell will have it's `x` and `y` values set by the `layout-manager` prior to - * `init` being called; - * @type {Number} - */ - this.x = null; - this.y = null; - } - - setOptions(options) { - if (['boolean', 'number', 'string'].indexOf(typeof options) !== -1) { - options = { content: '' + options }; - } - options = options || {}; - this.options = options; - let content = options.content; - if (['boolean', 'number', 'string'].indexOf(typeof content) !== -1) { - this.content = String(content); - } else if (!content) { - this.content = ''; - } else { - throw new Error('Content needs to be a primitive, got: ' + typeof content); - } - this.colSpan = options.colSpan || 1; - this.rowSpan = options.rowSpan || 1; - } - - mergeTableOptions(tableOptions, cells) { - this.cells = cells; - - let optionsChars = this.options.chars || {}; - let tableChars = tableOptions.chars; - let chars = (this.chars = {}); - CHAR_NAMES.forEach(function(name) { - setOption(optionsChars, tableChars, name, chars); - }); - - this.truncate = this.options.truncate || tableOptions.truncate; - - let style = (this.options.style = this.options.style || {}); - let tableStyle = tableOptions.style; - setOption(style, tableStyle, 'padding-left', this); - setOption(style, tableStyle, 'padding-right', this); - this.head = style.head || tableStyle.head; - this.border = style.border || tableStyle.border; - - let fixedWidth = tableOptions.colWidths[this.x]; - if (tableOptions.wordWrap && fixedWidth) { - fixedWidth -= this.paddingLeft + this.paddingRight; - if (this.colSpan) { - let i = 1; - while (i < this.colSpan) { - fixedWidth += tableOptions.colWidths[this.x + i]; - i++; - } - } - this.lines = utils.colorizeLines(utils.wordWrap(fixedWidth, this.content)); - } else { - this.lines = utils.colorizeLines(this.content.split('\n')); - } - - this.desiredWidth = utils.strlen(this.content) + this.paddingLeft + this.paddingRight; - this.desiredHeight = this.lines.length; - } - - /** - * Initializes the Cells data structure. - * - * @param tableOptions - A fully populated set of tableOptions. - * In addition to the standard default values, tableOptions must have fully populated the - * `colWidths` and `rowWidths` arrays. Those arrays must have lengths equal to the number - * of columns or rows (respectively) in this table, and each array item must be a Number. - * - */ - init(tableOptions) { - let x = this.x; - let y = this.y; - this.widths = tableOptions.colWidths.slice(x, x + this.colSpan); - this.heights = tableOptions.rowHeights.slice(y, y + this.rowSpan); - this.width = this.widths.reduce(sumPlusOne, -1); - this.height = this.heights.reduce(sumPlusOne, -1); - - this.hAlign = this.options.hAlign || tableOptions.colAligns[x]; - this.vAlign = this.options.vAlign || tableOptions.rowAligns[y]; - - this.drawRight = x + this.colSpan == tableOptions.colWidths.length; - } - - /** - * Draws the given line of the cell. - * This default implementation defers to methods `drawTop`, `drawBottom`, `drawLine` and `drawEmpty`. - * @param lineNum - can be `top`, `bottom` or a numerical line number. - * @param spanningCell - will be a number if being called from a RowSpanCell, and will represent how - * many rows below it's being called from. Otherwise it's undefined. - * @returns {String} The representation of this line. - */ - draw(lineNum, spanningCell) { - if (lineNum == 'top') return this.drawTop(this.drawRight); - if (lineNum == 'bottom') return this.drawBottom(this.drawRight); - let padLen = Math.max(this.height - this.lines.length, 0); - let padTop; - switch (this.vAlign) { - case 'center': - padTop = Math.ceil(padLen / 2); - break; - case 'bottom': - padTop = padLen; - break; - default: - padTop = 0; - } - if (lineNum < padTop || lineNum >= padTop + this.lines.length) { - return this.drawEmpty(this.drawRight, spanningCell); - } - let forceTruncation = this.lines.length > this.height && lineNum + 1 >= this.height; - return this.drawLine(lineNum - padTop, this.drawRight, forceTruncation, spanningCell); - } - - /** - * Renders the top line of the cell. - * @param drawRight - true if this method should render the right edge of the cell. - * @returns {String} - */ - drawTop(drawRight) { - let content = []; - if (this.cells) { - //TODO: cells should always exist - some tests don't fill it in though - this.widths.forEach(function(width, index) { - content.push(this._topLeftChar(index)); - content.push(utils.repeat(this.chars[this.y == 0 ? 'top' : 'mid'], width)); - }, this); - } else { - content.push(this._topLeftChar(0)); - content.push(utils.repeat(this.chars[this.y == 0 ? 'top' : 'mid'], this.width)); - } - if (drawRight) { - content.push(this.chars[this.y == 0 ? 'topRight' : 'rightMid']); - } - return this.wrapWithStyleColors('border', content.join('')); - } - - _topLeftChar(offset) { - let x = this.x + offset; - let leftChar; - if (this.y == 0) { - leftChar = x == 0 ? 'topLeft' : offset == 0 ? 'topMid' : 'top'; - } else { - if (x == 0) { - leftChar = 'leftMid'; - } else { - leftChar = offset == 0 ? 'midMid' : 'bottomMid'; - if (this.cells) { - //TODO: cells should always exist - some tests don't fill it in though - let spanAbove = this.cells[this.y - 1][x] instanceof Cell.ColSpanCell; - if (spanAbove) { - leftChar = offset == 0 ? 'topMid' : 'mid'; - } - if (offset == 0) { - let i = 1; - while (this.cells[this.y][x - i] instanceof Cell.ColSpanCell) { - i++; - } - if (this.cells[this.y][x - i] instanceof Cell.RowSpanCell) { - leftChar = 'leftMid'; - } - } - } - } - } - return this.chars[leftChar]; - } - - wrapWithStyleColors(styleProperty, content) { - if (this[styleProperty] && this[styleProperty].length) { - try { - let colors = require('colors/safe'); - for (let i = this[styleProperty].length - 1; i >= 0; i--) { - colors = colors[this[styleProperty][i]]; - } - return colors(content); - } catch (e) { - return content; - } - } else { - return content; - } - } - - /** - * Renders a line of text. - * @param lineNum - Which line of text to render. This is not necessarily the line within the cell. - * There may be top-padding above the first line of text. - * @param drawRight - true if this method should render the right edge of the cell. - * @param forceTruncationSymbol - `true` if the rendered text should end with the truncation symbol even - * if the text fits. This is used when the cell is vertically truncated. If `false` the text should - * only include the truncation symbol if the text will not fit horizontally within the cell width. - * @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined. - * @returns {String} - */ - drawLine(lineNum, drawRight, forceTruncationSymbol, spanningCell) { - let left = this.chars[this.x == 0 ? 'left' : 'middle']; - if (this.x && spanningCell && this.cells) { - let cellLeft = this.cells[this.y + spanningCell][this.x - 1]; - while (cellLeft instanceof ColSpanCell) { - cellLeft = this.cells[cellLeft.y][cellLeft.x - 1]; - } - if (!(cellLeft instanceof RowSpanCell)) { - left = this.chars['rightMid']; - } - } - let leftPadding = utils.repeat(' ', this.paddingLeft); - let right = drawRight ? this.chars['right'] : ''; - let rightPadding = utils.repeat(' ', this.paddingRight); - let line = this.lines[lineNum]; - let len = this.width - (this.paddingLeft + this.paddingRight); - if (forceTruncationSymbol) line += this.truncate || '…'; - let content = utils.truncate(line, len, this.truncate); - content = utils.pad(content, len, ' ', this.hAlign); - content = leftPadding + content + rightPadding; - return this.stylizeLine(left, content, right); - } - - stylizeLine(left, content, right) { - left = this.wrapWithStyleColors('border', left); - right = this.wrapWithStyleColors('border', right); - if (this.y === 0) { - content = this.wrapWithStyleColors('head', content); - } - return left + content + right; - } - - /** - * Renders the bottom line of the cell. - * @param drawRight - true if this method should render the right edge of the cell. - * @returns {String} - */ - drawBottom(drawRight) { - let left = this.chars[this.x == 0 ? 'bottomLeft' : 'bottomMid']; - let content = utils.repeat(this.chars.bottom, this.width); - let right = drawRight ? this.chars['bottomRight'] : ''; - return this.wrapWithStyleColors('border', left + content + right); - } - - /** - * Renders a blank line of text within the cell. Used for top and/or bottom padding. - * @param drawRight - true if this method should render the right edge of the cell. - * @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined. - * @returns {String} - */ - drawEmpty(drawRight, spanningCell) { - let left = this.chars[this.x == 0 ? 'left' : 'middle']; - if (this.x && spanningCell && this.cells) { - let cellLeft = this.cells[this.y + spanningCell][this.x - 1]; - while (cellLeft instanceof ColSpanCell) { - cellLeft = this.cells[cellLeft.y][cellLeft.x - 1]; - } - if (!(cellLeft instanceof RowSpanCell)) { - left = this.chars['rightMid']; - } - } - let right = drawRight ? this.chars['right'] : ''; - let content = utils.repeat(' ', this.width); - return this.stylizeLine(left, content, right); - } -} - -class ColSpanCell { - /** - * A Cell that doesn't do anything. It just draws empty lines. - * Used as a placeholder in column spanning. - * @constructor - */ - constructor() {} - - draw() { - return ''; - } - - init() {} - - mergeTableOptions() {} -} - -class RowSpanCell { - /** - * A placeholder Cell for a Cell that spans multiple rows. - * It delegates rendering to the original cell, but adds the appropriate offset. - * @param originalCell - * @constructor - */ - constructor(originalCell) { - this.originalCell = originalCell; - } - - init(tableOptions) { - let y = this.y; - let originalY = this.originalCell.y; - this.cellOffset = y - originalY; - this.offset = findDimension(tableOptions.rowHeights, originalY, this.cellOffset); - } - - draw(lineNum) { - if (lineNum == 'top') { - return this.originalCell.draw(this.offset, this.cellOffset); - } - if (lineNum == 'bottom') { - return this.originalCell.draw('bottom'); - } - return this.originalCell.draw(this.offset + 1 + lineNum); - } - - mergeTableOptions() {} -} - -// HELPER FUNCTIONS -function setOption(objA, objB, nameB, targetObj) { - let nameA = nameB.split('-'); - if (nameA.length > 1) { - nameA[1] = nameA[1].charAt(0).toUpperCase() + nameA[1].substr(1); - nameA = nameA.join(''); - targetObj[nameA] = objA[nameA] || objA[nameB] || objB[nameA] || objB[nameB]; - } else { - targetObj[nameB] = objA[nameB] || objB[nameB]; - } -} - -function findDimension(dimensionTable, startingIndex, span) { - let ret = dimensionTable[startingIndex]; - for (let i = 1; i < span; i++) { - ret += 1 + dimensionTable[startingIndex + i]; - } - return ret; -} - -function sumPlusOne(a, b) { - return a + b + 1; -} - -let CHAR_NAMES = [ - 'top', - 'top-mid', - 'top-left', - 'top-right', - 'bottom', - 'bottom-mid', - 'bottom-left', - 'bottom-right', - 'left', - 'left-mid', - 'mid', - 'mid-mid', - 'right', - 'right-mid', - 'middle', -]; -module.exports = Cell; -module.exports.ColSpanCell = ColSpanCell; -module.exports.RowSpanCell = RowSpanCell; - -},{"./utils":104,"colors/safe":115}],102:[function(require,module,exports){ -const objectAssign = require('object-assign'); -const Cell = require('./cell'); -const { ColSpanCell, RowSpanCell } = Cell; - -(function() { - function layoutTable(table) { - table.forEach(function(row, rowIndex) { - row.forEach(function(cell, columnIndex) { - cell.y = rowIndex; - cell.x = columnIndex; - for (let y = rowIndex; y >= 0; y--) { - let row2 = table[y]; - let xMax = y === rowIndex ? columnIndex : row2.length; - for (let x = 0; x < xMax; x++) { - let cell2 = row2[x]; - while (cellsConflict(cell, cell2)) { - cell.x++; - } - } - } - }); - }); - } - - function maxWidth(table) { - let mw = 0; - table.forEach(function(row) { - row.forEach(function(cell) { - mw = Math.max(mw, cell.x + (cell.colSpan || 1)); - }); - }); - return mw; - } - - function maxHeight(table) { - return table.length; - } - - function cellsConflict(cell1, cell2) { - let yMin1 = cell1.y; - let yMax1 = cell1.y - 1 + (cell1.rowSpan || 1); - let yMin2 = cell2.y; - let yMax2 = cell2.y - 1 + (cell2.rowSpan || 1); - let yConflict = !(yMin1 > yMax2 || yMin2 > yMax1); - - let xMin1 = cell1.x; - let xMax1 = cell1.x - 1 + (cell1.colSpan || 1); - let xMin2 = cell2.x; - let xMax2 = cell2.x - 1 + (cell2.colSpan || 1); - let xConflict = !(xMin1 > xMax2 || xMin2 > xMax1); - - return yConflict && xConflict; - } - - function conflictExists(rows, x, y) { - let i_max = Math.min(rows.length - 1, y); - let cell = { x: x, y: y }; - for (let i = 0; i <= i_max; i++) { - let row = rows[i]; - for (let j = 0; j < row.length; j++) { - if (cellsConflict(cell, row[j])) { - return true; - } - } - } - return false; - } - - function allBlank(rows, y, xMin, xMax) { - for (let x = xMin; x < xMax; x++) { - if (conflictExists(rows, x, y)) { - return false; - } - } - return true; - } - - function addRowSpanCells(table) { - table.forEach(function(row, rowIndex) { - row.forEach(function(cell) { - for (let i = 1; i < cell.rowSpan; i++) { - let rowSpanCell = new RowSpanCell(cell); - rowSpanCell.x = cell.x; - rowSpanCell.y = cell.y + i; - rowSpanCell.colSpan = cell.colSpan; - insertCell(rowSpanCell, table[rowIndex + i]); - } - }); - }); - } - - function addColSpanCells(cellRows) { - for (let rowIndex = cellRows.length - 1; rowIndex >= 0; rowIndex--) { - let cellColumns = cellRows[rowIndex]; - for (let columnIndex = 0; columnIndex < cellColumns.length; columnIndex++) { - let cell = cellColumns[columnIndex]; - for (let k = 1; k < cell.colSpan; k++) { - let colSpanCell = new ColSpanCell(); - colSpanCell.x = cell.x + k; - colSpanCell.y = cell.y; - cellColumns.splice(columnIndex + 1, 0, colSpanCell); - } - } - } - } - - function insertCell(cell, row) { - let x = 0; - while (x < row.length && row[x].x < cell.x) { - x++; - } - row.splice(x, 0, cell); - } - - function fillInTable(table) { - let h_max = maxHeight(table); - let w_max = maxWidth(table); - for (let y = 0; y < h_max; y++) { - for (let x = 0; x < w_max; x++) { - if (!conflictExists(table, x, y)) { - let opts = { x: x, y: y, colSpan: 1, rowSpan: 1 }; - x++; - while (x < w_max && !conflictExists(table, x, y)) { - opts.colSpan++; - x++; - } - let y2 = y + 1; - while (y2 < h_max && allBlank(table, y2, opts.x, opts.x + opts.colSpan)) { - opts.rowSpan++; - y2++; - } - - let cell = new Cell(opts); - cell.x = opts.x; - cell.y = opts.y; - insertCell(cell, table[y]); - } - } - } - } - - function generateCells(rows) { - return rows.map(function(row) { - if (!Array.isArray(row)) { - let key = Object.keys(row)[0]; - row = row[key]; - if (Array.isArray(row)) { - row = row.slice(); - row.unshift(key); - } else { - row = [key, row]; - } - } - return row.map(function(cell) { - return new Cell(cell); - }); - }); - } - - function makeTableLayout(rows) { - let cellRows = generateCells(rows); - layoutTable(cellRows); - fillInTable(cellRows); - addRowSpanCells(cellRows); - addColSpanCells(cellRows); - return cellRows; - } - - module.exports = { - makeTableLayout: makeTableLayout, - layoutTable: layoutTable, - addRowSpanCells: addRowSpanCells, - maxWidth: maxWidth, - fillInTable: fillInTable, - computeWidths: makeComputeWidths('colSpan', 'desiredWidth', 'x', 1), - computeHeights: makeComputeWidths('rowSpan', 'desiredHeight', 'y', 1), - }; -})(); - -function makeComputeWidths(colSpan, desiredWidth, x, forcedMin) { - return function(vals, table) { - let result = []; - let spanners = []; - table.forEach(function(row) { - row.forEach(function(cell) { - if ((cell[colSpan] || 1) > 1) { - spanners.push(cell); - } else { - result[cell[x]] = Math.max(result[cell[x]] || 0, cell[desiredWidth] || 0, forcedMin); - } - }); - }); - - vals.forEach(function(val, index) { - if (typeof val === 'number') { - result[index] = val; - } - }); - - //spanners.forEach(function(cell){ - for (let k = spanners.length - 1; k >= 0; k--) { - let cell = spanners[k]; - let span = cell[colSpan]; - let col = cell[x]; - let existingWidth = result[col]; - let editableCols = typeof vals[col] === 'number' ? 0 : 1; - for (let i = 1; i < span; i++) { - existingWidth += 1 + result[col + i]; - if (typeof vals[col + i] !== 'number') { - editableCols++; - } - } - if (cell[desiredWidth] > existingWidth) { - let i = 0; - while (editableCols > 0 && cell[desiredWidth] > existingWidth) { - if (typeof vals[col + i] !== 'number') { - let dif = Math.round((cell[desiredWidth] - existingWidth) / editableCols); - existingWidth += dif; - result[col + i] += dif; - editableCols--; - } - i++; - } - } - } - - objectAssign(vals, result); - for (let j = 0; j < vals.length; j++) { - vals[j] = Math.max(forcedMin, vals[j] || 0); - } - }; -} - -},{"./cell":101,"object-assign":563}],103:[function(require,module,exports){ -const utils = require('./utils'); -const tableLayout = require('./layout-manager'); - -class Table extends Array { - constructor(options) { - super(); - - this.options = utils.mergeOptions(options); - } - - toString() { - let array = this; - let headersPresent = this.options.head && this.options.head.length; - if (headersPresent) { - array = [this.options.head]; - if (this.length) { - array.push.apply(array, this); - } - } else { - this.options.style.head = []; - } - - let cells = tableLayout.makeTableLayout(array); - - cells.forEach(function(row) { - row.forEach(function(cell) { - cell.mergeTableOptions(this.options, cells); - }, this); - }, this); - - tableLayout.computeWidths(this.options.colWidths, cells); - tableLayout.computeHeights(this.options.rowHeights, cells); - - cells.forEach(function(row) { - row.forEach(function(cell) { - cell.init(this.options); - }, this); - }, this); - - let result = []; - - for (let rowIndex = 0; rowIndex < cells.length; rowIndex++) { - let row = cells[rowIndex]; - let heightOfRow = this.options.rowHeights[rowIndex]; - - if (rowIndex === 0 || !this.options.style.compact || (rowIndex == 1 && headersPresent)) { - doDraw(row, 'top', result); - } - - for (let lineNum = 0; lineNum < heightOfRow; lineNum++) { - doDraw(row, lineNum, result); - } - - if (rowIndex + 1 == cells.length) { - doDraw(row, 'bottom', result); - } - } - - return result.join('\n'); - } - - get width() { - let str = this.toString().split('\n'); - return str[0].length; - } -} - -function doDraw(row, lineNum, result) { - let line = []; - row.forEach(function(cell) { - line.push(cell.draw(lineNum)); - }); - let str = line.join(''); - if (str.length) result.push(str); -} - -module.exports = Table; - -},{"./layout-manager":102,"./utils":104}],104:[function(require,module,exports){ -const objectAssign = require('object-assign'); -const stringWidth = require('string-width'); - -function codeRegex(capture) { - return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g; -} - -function strlen(str) { - let code = codeRegex(); - let stripped = ('' + str).replace(code, ''); - let split = stripped.split('\n'); - return split.reduce(function(memo, s) { - return stringWidth(s) > memo ? stringWidth(s) : memo; - }, 0); -} - -function repeat(str, times) { - return Array(times + 1).join(str); -} - -function pad(str, len, pad, dir) { - let length = strlen(str); - if (len + 1 >= length) { - let padlen = len - length; - switch (dir) { - case 'right': { - str = repeat(pad, padlen) + str; - break; - } - case 'center': { - let right = Math.ceil(padlen / 2); - let left = padlen - right; - str = repeat(pad, left) + str + repeat(pad, right); - break; - } - default: { - str = str + repeat(pad, padlen); - break; - } - } - } - return str; -} - -let codeCache = {}; - -function addToCodeCache(name, on, off) { - on = '\u001b[' + on + 'm'; - off = '\u001b[' + off + 'm'; - codeCache[on] = { set: name, to: true }; - codeCache[off] = { set: name, to: false }; - codeCache[name] = { on: on, off: off }; -} - -//https://github.com/Marak/colors.js/blob/master/lib/styles.js -addToCodeCache('bold', 1, 22); -addToCodeCache('italics', 3, 23); -addToCodeCache('underline', 4, 24); -addToCodeCache('inverse', 7, 27); -addToCodeCache('strikethrough', 9, 29); - -function updateState(state, controlChars) { - let controlCode = controlChars[1] ? parseInt(controlChars[1].split(';')[0]) : 0; - if ((controlCode >= 30 && controlCode <= 39) || (controlCode >= 90 && controlCode <= 97)) { - state.lastForegroundAdded = controlChars[0]; - return; - } - if ((controlCode >= 40 && controlCode <= 49) || (controlCode >= 100 && controlCode <= 107)) { - state.lastBackgroundAdded = controlChars[0]; - return; - } - if (controlCode === 0) { - for (let i in state) { - /* istanbul ignore else */ - if (state.hasOwnProperty(i)) { - delete state[i]; - } - } - return; - } - let info = codeCache[controlChars[0]]; - if (info) { - state[info.set] = info.to; - } -} - -function readState(line) { - let code = codeRegex(true); - let controlChars = code.exec(line); - let state = {}; - while (controlChars !== null) { - updateState(state, controlChars); - controlChars = code.exec(line); - } - return state; -} - -function unwindState(state, ret) { - let lastBackgroundAdded = state.lastBackgroundAdded; - let lastForegroundAdded = state.lastForegroundAdded; - - delete state.lastBackgroundAdded; - delete state.lastForegroundAdded; - - Object.keys(state).forEach(function(key) { - if (state[key]) { - ret += codeCache[key].off; - } - }); - - if (lastBackgroundAdded && lastBackgroundAdded != '\u001b[49m') { - ret += '\u001b[49m'; - } - if (lastForegroundAdded && lastForegroundAdded != '\u001b[39m') { - ret += '\u001b[39m'; - } - - return ret; -} - -function rewindState(state, ret) { - let lastBackgroundAdded = state.lastBackgroundAdded; - let lastForegroundAdded = state.lastForegroundAdded; - - delete state.lastBackgroundAdded; - delete state.lastForegroundAdded; - - Object.keys(state).forEach(function(key) { - if (state[key]) { - ret = codeCache[key].on + ret; - } - }); - - if (lastBackgroundAdded && lastBackgroundAdded != '\u001b[49m') { - ret = lastBackgroundAdded + ret; - } - if (lastForegroundAdded && lastForegroundAdded != '\u001b[39m') { - ret = lastForegroundAdded + ret; - } - - return ret; -} - -function truncateWidth(str, desiredLength) { - if (str.length === strlen(str)) { - return str.substr(0, desiredLength); - } - - while (strlen(str) > desiredLength) { - str = str.slice(0, -1); - } - - return str; -} - -function truncateWidthWithAnsi(str, desiredLength) { - let code = codeRegex(true); - let split = str.split(codeRegex()); - let splitIndex = 0; - let retLen = 0; - let ret = ''; - let myArray; - let state = {}; - - while (retLen < desiredLength) { - myArray = code.exec(str); - let toAdd = split[splitIndex]; - splitIndex++; - if (retLen + strlen(toAdd) > desiredLength) { - toAdd = truncateWidth(toAdd, desiredLength - retLen); - } - ret += toAdd; - retLen += strlen(toAdd); - - if (retLen < desiredLength) { - if (!myArray) { - break; - } // full-width chars may cause a whitespace which cannot be filled - ret += myArray[0]; - updateState(state, myArray); - } - } - - return unwindState(state, ret); -} - -function truncate(str, desiredLength, truncateChar) { - truncateChar = truncateChar || '…'; - let lengthOfStr = strlen(str); - if (lengthOfStr <= desiredLength) { - return str; - } - desiredLength -= strlen(truncateChar); - - let ret = truncateWidthWithAnsi(str, desiredLength); - - return ret + truncateChar; -} - -function defaultOptions() { - return { - chars: { - top: '─', - 'top-mid': '┬', - 'top-left': '┌', - 'top-right': '┐', - bottom: '─', - 'bottom-mid': '┴', - 'bottom-left': '└', - 'bottom-right': '┘', - left: '│', - 'left-mid': '├', - mid: '─', - 'mid-mid': '┼', - right: '│', - 'right-mid': '┤', - middle: '│', - }, - truncate: '…', - colWidths: [], - rowHeights: [], - colAligns: [], - rowAligns: [], - style: { - 'padding-left': 1, - 'padding-right': 1, - head: ['red'], - border: ['grey'], - compact: false, - }, - head: [], - }; -} - -function mergeOptions(options, defaults) { - options = options || {}; - defaults = defaults || defaultOptions(); - let ret = objectAssign({}, defaults, options); - ret.chars = objectAssign({}, defaults.chars, options.chars); - ret.style = objectAssign({}, defaults.style, options.style); - return ret; -} - -function wordWrap(maxLength, input) { - let lines = []; - let split = input.split(/(\s+)/g); - let line = []; - let lineLength = 0; - let whitespace; - for (let i = 0; i < split.length; i += 2) { - let word = split[i]; - let newLength = lineLength + strlen(word); - if (lineLength > 0 && whitespace) { - newLength += whitespace.length; - } - if (newLength > maxLength) { - if (lineLength !== 0) { - lines.push(line.join('')); - } - line = [word]; - lineLength = strlen(word); - } else { - line.push(whitespace || '', word); - lineLength = newLength; - } - whitespace = split[i + 1]; - } - if (lineLength) { - lines.push(line.join('')); - } - return lines; -} - -function multiLineWordWrap(maxLength, input) { - let output = []; - input = input.split('\n'); - for (let i = 0; i < input.length; i++) { - output.push.apply(output, wordWrap(maxLength, input[i])); - } - return output; -} - -function colorizeLines(input) { - let state = {}; - let output = []; - for (let i = 0; i < input.length; i++) { - let line = rewindState(state, input[i]); - state = readState(line); - let temp = objectAssign({}, state); - output.push(unwindState(temp, line)); - } - return output; -} - -module.exports = { - strlen: strlen, - repeat: repeat, - pad: pad, - truncate: truncate, - mergeOptions: mergeOptions, - wordWrap: multiLineWordWrap, - colorizeLines: colorizeLines, -}; - -},{"object-assign":563,"string-width":617}],105:[function(require,module,exports){ -/* - -The MIT License (MIT) - -Original Library - - Copyright (c) Marak Squires - -Additional functionality - - Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -var colors = {}; -module['exports'] = colors; - -colors.themes = {}; - -var util = require('util'); -var ansiStyles = colors.styles = require('./styles'); -var defineProps = Object.defineProperties; -var newLineRegex = new RegExp(/[\r\n]+/g); - -colors.supportsColor = require('./system/supports-colors').supportsColor; - -if (typeof colors.enabled === 'undefined') { - colors.enabled = colors.supportsColor() !== false; -} - -colors.enable = function() { - colors.enabled = true; -}; - -colors.disable = function() { - colors.enabled = false; -}; - -colors.stripColors = colors.strip = function(str) { - return ('' + str).replace(/\x1B\[\d+m/g, ''); -}; - -// eslint-disable-next-line no-unused-vars -var stylize = colors.stylize = function stylize(str, style) { - if (!colors.enabled) { - return str+''; - } - - return ansiStyles[style].open + str + ansiStyles[style].close; -}; - -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; -var escapeStringRegexp = function(str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - return str.replace(matchOperatorsRe, '\\$&'); -}; - -function build(_styles) { - var builder = function builder() { - return applyStyle.apply(builder, arguments); - }; - builder._styles = _styles; - // __proto__ is used because we must return a function, but there is - // no way to create a function with a different prototype. - builder.__proto__ = proto; - return builder; -} - -var styles = (function() { - var ret = {}; - ansiStyles.grey = ansiStyles.gray; - Object.keys(ansiStyles).forEach(function(key) { - ansiStyles[key].closeRe = - new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - ret[key] = { - get: function() { - return build(this._styles.concat(key)); - }, - }; - }); - return ret; -})(); - -var proto = defineProps(function colors() {}, styles); - -function applyStyle() { - var args = Array.prototype.slice.call(arguments); - - var str = args.map(function(arg) { - if (arg !== undefined && arg.constructor === String) { - return arg; - } else { - return util.inspect(arg); - } - }).join(' '); - - if (!colors.enabled || !str) { - return str; - } - - var newLinesPresent = str.indexOf('\n') != -1; - - var nestedStyles = this._styles; - - var i = nestedStyles.length; - while (i--) { - var code = ansiStyles[nestedStyles[i]]; - str = code.open + str.replace(code.closeRe, code.open) + code.close; - if (newLinesPresent) { - str = str.replace(newLineRegex, function(match) { - return code.close + match + code.open; - }); - } - } - - return str; -} - -colors.setTheme = function(theme) { - if (typeof theme === 'string') { - console.log('colors.setTheme now only accepts an object, not a string. ' + - 'If you are trying to set a theme from a file, it is now your (the ' + - 'caller\'s) responsibility to require the file. The old syntax ' + - 'looked like colors.setTheme(__dirname + ' + - '\'/../themes/generic-logging.js\'); The new syntax looks like '+ - 'colors.setTheme(require(__dirname + ' + - '\'/../themes/generic-logging.js\'));'); - return; - } - for (var style in theme) { - (function(style) { - colors[style] = function(str) { - if (typeof theme[style] === 'object') { - var out = str; - for (var i in theme[style]) { - out = colors[theme[style][i]](out); - } - return out; - } - return colors[theme[style]](str); - }; - })(style); - } -}; - -function init() { - var ret = {}; - Object.keys(styles).forEach(function(name) { - ret[name] = { - get: function() { - return build([name]); - }, - }; - }); - return ret; -} - -var sequencer = function sequencer(map, str) { - var exploded = str.split(''); - exploded = exploded.map(map); - return exploded.join(''); -}; - -// custom formatter methods -colors.trap = require('./custom/trap'); -colors.zalgo = require('./custom/zalgo'); - -// maps -colors.maps = {}; -colors.maps.america = require('./maps/america')(colors); -colors.maps.zebra = require('./maps/zebra')(colors); -colors.maps.rainbow = require('./maps/rainbow')(colors); -colors.maps.random = require('./maps/random')(colors); - -for (var map in colors.maps) { - (function(map) { - colors[map] = function(str) { - return sequencer(colors.maps[map], str); - }; - })(map); -} - -defineProps(colors, init()); - -},{"./custom/trap":106,"./custom/zalgo":107,"./maps/america":108,"./maps/rainbow":109,"./maps/random":110,"./maps/zebra":111,"./styles":112,"./system/supports-colors":114,"util":634}],106:[function(require,module,exports){ -module['exports'] = function runTheTrap(text, options) { - var result = ''; - text = text || 'Run the trap, drop the bass'; - text = text.split(''); - var trap = { - a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'], - b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'], - c: ['\u00a9', '\u023b', '\u03fe'], - d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'], - e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc', - '\u0a6c'], - f: ['\u04fa'], - g: ['\u0262'], - h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'], - i: ['\u0f0f'], - j: ['\u0134'], - k: ['\u0138', '\u04a0', '\u04c3', '\u051e'], - l: ['\u0139'], - m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'], - n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'], - o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd', - '\u06dd', '\u0e4f'], - p: ['\u01f7', '\u048e'], - q: ['\u09cd'], - r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'], - s: ['\u00a7', '\u03de', '\u03df', '\u03e8'], - t: ['\u0141', '\u0166', '\u0373'], - u: ['\u01b1', '\u054d'], - v: ['\u05d8'], - w: ['\u0428', '\u0460', '\u047c', '\u0d70'], - x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'], - y: ['\u00a5', '\u04b0', '\u04cb'], - z: ['\u01b5', '\u0240'], - }; - text.forEach(function(c) { - c = c.toLowerCase(); - var chars = trap[c] || [' ']; - var rand = Math.floor(Math.random() * chars.length); - if (typeof trap[c] !== 'undefined') { - result += trap[c][rand]; - } else { - result += c; - } - }); - return result; -}; - -},{}],107:[function(require,module,exports){ -// please no -module['exports'] = function zalgo(text, options) { - text = text || ' he is here '; - var soul = { - 'up': [ - '̍', '̎', '̄', '̅', - '̿', '̑', '̆', '̐', - '͒', '͗', '͑', '̇', - '̈', '̊', '͂', '̓', - '̈', '͊', '͋', '͌', - '̃', '̂', '̌', '͐', - '̀', '́', '̋', '̏', - '̒', '̓', '̔', '̽', - '̉', 'ͣ', 'ͤ', 'ͥ', - 'ͦ', 'ͧ', 'ͨ', 'ͩ', - 'ͪ', 'ͫ', 'ͬ', 'ͭ', - 'ͮ', 'ͯ', '̾', '͛', - '͆', '̚', - ], - 'down': [ - '̖', '̗', '̘', '̙', - '̜', '̝', '̞', '̟', - '̠', '̤', '̥', '̦', - '̩', '̪', '̫', '̬', - '̭', '̮', '̯', '̰', - '̱', '̲', '̳', '̹', - '̺', '̻', '̼', 'ͅ', - '͇', '͈', '͉', '͍', - '͎', '͓', '͔', '͕', - '͖', '͙', '͚', '̣', - ], - 'mid': [ - '̕', '̛', '̀', '́', - '͘', '̡', '̢', '̧', - '̨', '̴', '̵', '̶', - '͜', '͝', '͞', - '͟', '͠', '͢', '̸', - '̷', '͡', ' ҉', - ], - }; - var all = [].concat(soul.up, soul.down, soul.mid); - - function randomNumber(range) { - var r = Math.floor(Math.random() * range); - return r; - } - - function isChar(character) { - var bool = false; - all.filter(function(i) { - bool = (i === character); - }); - return bool; - } - - - function heComes(text, options) { - var result = ''; - var counts; - var l; - options = options || {}; - options['up'] = - typeof options['up'] !== 'undefined' ? options['up'] : true; - options['mid'] = - typeof options['mid'] !== 'undefined' ? options['mid'] : true; - options['down'] = - typeof options['down'] !== 'undefined' ? options['down'] : true; - options['size'] = - typeof options['size'] !== 'undefined' ? options['size'] : 'maxi'; - text = text.split(''); - for (l in text) { - if (isChar(l)) { - continue; - } - result = result + text[l]; - counts = {'up': 0, 'down': 0, 'mid': 0}; - switch (options.size) { - case 'mini': - counts.up = randomNumber(8); - counts.mid = randomNumber(2); - counts.down = randomNumber(8); - break; - case 'maxi': - counts.up = randomNumber(16) + 3; - counts.mid = randomNumber(4) + 1; - counts.down = randomNumber(64) + 3; - break; - default: - counts.up = randomNumber(8) + 1; - counts.mid = randomNumber(6) / 2; - counts.down = randomNumber(8) + 1; - break; - } - - var arr = ['up', 'mid', 'down']; - for (var d in arr) { - var index = arr[d]; - for (var i = 0; i <= counts[index]; i++) { - if (options[index]) { - result = result + soul[index][randomNumber(soul[index].length)]; - } - } - } - } - return result; - } - // don't summon him - return heComes(text, options); -}; - - -},{}],108:[function(require,module,exports){ -module['exports'] = function(colors) { - return function(letter, i, exploded) { - if (letter === ' ') return letter; - switch (i%3) { - case 0: return colors.red(letter); - case 1: return colors.white(letter); - case 2: return colors.blue(letter); - } - }; -}; - -},{}],109:[function(require,module,exports){ -module['exports'] = function(colors) { - // RoY G BiV - var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; - return function(letter, i, exploded) { - if (letter === ' ') { - return letter; - } else { - return colors[rainbowColors[i++ % rainbowColors.length]](letter); - } - }; -}; - - -},{}],110:[function(require,module,exports){ -module['exports'] = function(colors) { - var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', - 'blue', 'white', 'cyan', 'magenta']; - return function(letter, i, exploded) { - return letter === ' ' ? letter : - colors[ - available[Math.round(Math.random() * (available.length - 2))] - ](letter); - }; -}; - -},{}],111:[function(require,module,exports){ -module['exports'] = function(colors) { - return function(letter, i, exploded) { - return i % 2 === 0 ? letter : colors.inverse(letter); - }; -}; - -},{}],112:[function(require,module,exports){ -/* -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -var styles = {}; -module['exports'] = styles; - -var codes = { - reset: [0, 0], - - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29], - - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39], - grey: [90, 39], - - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - - // legacy styles for colors pre v1.0.0 - blackBG: [40, 49], - redBG: [41, 49], - greenBG: [42, 49], - yellowBG: [43, 49], - blueBG: [44, 49], - magentaBG: [45, 49], - cyanBG: [46, 49], - whiteBG: [47, 49], - -}; - -Object.keys(codes).forEach(function(key) { - var val = codes[key]; - var style = styles[key] = []; - style.open = '\u001b[' + val[0] + 'm'; - style.close = '\u001b[' + val[1] + 'm'; -}); - -},{}],113:[function(require,module,exports){ -(function (process){ -/* -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -'use strict'; - -module.exports = function(flag, argv) { - argv = argv || process.argv; - - var terminatorPos = argv.indexOf('--'); - var prefix = /^-{1,2}/.test(flag) ? '' : '--'; - var pos = argv.indexOf(prefix + flag); - - return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); -}; - -}).call(this,require('_process')) - -},{"_process":571}],114:[function(require,module,exports){ -(function (process){ -/* -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -'use strict'; - -var os = require('os'); -var hasFlag = require('./has-flag.js'); - -var env = process.env; - -var forceColor = void 0; -if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { - forceColor = false; -} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') - || hasFlag('color=always')) { - forceColor = true; -} -if ('FORCE_COLOR' in env) { - forceColor = env.FORCE_COLOR.length === 0 - || parseInt(env.FORCE_COLOR, 10) !== 0; -} - -function translateLevel(level) { - if (level === 0) { - return false; - } - - return { - level: level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3, - }; -} - -function supportsColor(stream) { - if (forceColor === false) { - return 0; - } - - if (hasFlag('color=16m') || hasFlag('color=full') - || hasFlag('color=truecolor')) { - return 3; - } - - if (hasFlag('color=256')) { - return 2; - } - - if (stream && !stream.isTTY && forceColor !== true) { - return 0; - } - - var min = forceColor ? 1 : 0; - - if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first - // Windows release that supports 256 colors. Windows 10 build 14931 is the - // first release that supports 16m/TrueColor. - var osRelease = os.release().split('.'); - if (Number(process.versions.node.split('.')[0]) >= 8 - && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } - - return 1; - } - - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) { - return sign in env; - }) || env.CI_NAME === 'codeship') { - return 1; - } - - return min; - } - - if ('TEAMCITY_VERSION' in env) { - return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0 - ); - } - - if ('TERM_PROGRAM' in env) { - var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Hyper': - return 3; - case 'Apple_Terminal': - return 2; - // No default - } - } - - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } - - if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } - - if ('COLORTERM' in env) { - return 1; - } - - if (env.TERM === 'dumb') { - return min; - } - - return min; -} - -function getSupportLevel(stream) { - var level = supportsColor(stream); - return translateLevel(level); -} - -module.exports = { - supportsColor: getSupportLevel, - stdout: getSupportLevel(process.stdout), - stderr: getSupportLevel(process.stderr), -}; - -}).call(this,require('_process')) - -},{"./has-flag.js":113,"_process":571,"os":565}],115:[function(require,module,exports){ -// -// Remark: Requiring this file will use the "safe" colors API, -// which will not touch String.prototype. -// -// var colors = require('colors/safe'); -// colors.red("foo") -// -// -var colors = require('./lib/colors'); -module['exports'] = colors; - -},{"./lib/colors":105}],116:[function(require,module,exports){ -(function (Buffer,process){ -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var spawn = require('child_process').spawn; -var path = require('path'); -var dirname = path.dirname; -var basename = path.basename; -var fs = require('fs'); - -/** - * Inherit `Command` from `EventEmitter.prototype`. - */ - -require('util').inherits(Command, EventEmitter); - -/** - * Expose the root command. - */ - -exports = module.exports = new Command(); - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = flags.indexOf('<') >= 0; - this.optional = flags.indexOf('[') >= 0; - this.negate = flags.indexOf('-no-') !== -1; - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description || ''; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function() { - return this.long.replace(/^--/, ''); -}; - -/** - * Return option name, in a camelcase format that can be used - * as a object attribute key. - * - * @return {String} - * @api private - */ - -Option.prototype.attributeName = function() { - return camelcase(this.name().replace(/^no-/, '')); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg) { - return this.short === arg || this.long === arg; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this._execs = {}; - this._allowUnknownOption = false; - this._args = []; - this._name = name || ''; - - this._helpFlags = '-h, --help'; - this._helpDescription = 'output usage information'; - this._helpShortFlag = '-h'; - this._helpLongFlag = '--help'; -} - -/** - * Define a command. - * - * There are two styles of command: pay attention to where to put the description. - * - * Examples: - * - * // Command implemented using action handler (description is supplied separately to `.command`) - * program - * .command('clone [destination]') - * .description('clone a repository into a newly created directory') - * .action((source, destination) => { - * console.log('clone command called'); - * }); - * - * // Command implemented using separate executable file (description is second parameter to `.command`) - * program - * .command('start ', 'start named service') - * .command('stop [service]', 'stop named serice, or all if no name supplied'); - * - * @param {string} nameAndArgs - command name and arguments, args are `` or `[optional]` and last may also be `variadic...` - * @param {Object|string} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) - * @param {Object} [execOpts] - configuration options (for executable) - * @return {Command} returns new command for action handler, or top-level command for executable command - * @api public - */ - -Command.prototype.command = function(nameAndArgs, actionOptsOrExecDesc, execOpts) { - var desc = actionOptsOrExecDesc; - var opts = execOpts; - if (typeof desc === 'object' && desc !== null) { - opts = desc; - desc = null; - } - opts = opts || {}; - var args = nameAndArgs.split(/ +/); - var cmd = new Command(args.shift()); - - if (desc) { - cmd.description(desc); - this.executables = true; - this._execs[cmd._name] = true; - if (opts.isDefault) this.defaultExecutable = cmd._name; - } - cmd._noHelp = !!opts.noHelp; - cmd._helpFlags = this._helpFlags; - cmd._helpDescription = this._helpDescription; - cmd._helpShortFlag = this._helpShortFlag; - cmd._helpLongFlag = this._helpLongFlag; - cmd._executableFile = opts.executableFile; // Custom name for executable file - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - - if (desc) return this; - return cmd; -}; - -/** - * Define argument syntax for the top-level command. - * - * @api public - */ - -Command.prototype.arguments = function(desc) { - return this.parseExpectedArgs(desc.split(/ +/)); -}; - -/** - * Add an implicit `help [cmd]` subcommand - * which invokes `--help` for the given command. - * - * @api private - */ - -Command.prototype.addImplicitHelpCommand = function() { - this.command('help [cmd]', 'display help for [cmd]'); -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args) { - if (!args.length) return; - var self = this; - args.forEach(function(arg) { - var argDetails = { - required: false, - name: '', - variadic: false - }; - - switch (arg[0]) { - case '<': - argDetails.required = true; - argDetails.name = arg.slice(1, -1); - break; - case '[': - argDetails.name = arg.slice(1, -1); - break; - } - - if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') { - argDetails.variadic = true; - argDetails.name = argDetails.name.slice(0, -3); - } - if (argDetails.name) { - self._args.push(argDetails); - } - }); - return this; -}; - -/** - * Register callback `fn` for the command. - * - * Examples: - * - * program - * .command('help') - * .description('display verbose help') - * .action(function() { - * // output help here - * }); - * - * @param {Function} fn - * @return {Command} for chaining - * @api public - */ - -Command.prototype.action = function(fn) { - var self = this; - var listener = function(args, unknown) { - // Parse any so-far unknown options - args = args || []; - unknown = unknown || []; - - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - // Leftover arguments need to be pushed back. Fixes issue #56 - if (parsed.args.length) args = parsed.args.concat(args); - - self._args.forEach(function(arg, i) { - if (arg.required && args[i] == null) { - self.missingArgument(arg.name); - } else if (arg.variadic) { - if (i !== self._args.length - 1) { - self.variadicArgNotLast(arg.name); - } - - args[i] = args.splice(i); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self._args.length) { - args[self._args.length] = self; - } else { - args.push(self); - } - - fn.apply(self, args); - }; - var parent = this.parent || this; - var name = parent === this ? '*' : this._name; - parent.on('command:' + name, listener); - if (this._alias) parent.on('command:' + this._alias, listener); - return this; -}; - -/** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * Examples: - * - * // simple boolean defaulting to undefined - * program.option('-p, --pepper', 'add pepper'); - * - * program.pepper - * // => undefined - * - * --pepper - * program.pepper - * // => true - * - * // simple boolean defaulting to true (unless non-negated option is also defined) - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {String} flags - * @param {String} description - * @param {Function|*} [fn] or default - * @param {*} [defaultValue] - * @return {Command} for chaining - * @api public - */ - -Command.prototype.option = function(flags, description, fn, defaultValue) { - var self = this, - option = new Option(flags, description), - oname = option.name(), - name = option.attributeName(); - - // default as 3rd arg - if (typeof fn !== 'function') { - if (fn instanceof RegExp) { - // This is a bit simplistic (especially no error messages), and probably better handled by caller using custom option processing. - // No longer documented in README, but still present for backwards compatibility. - var regex = fn; - fn = function(val, def) { - var m = regex.exec(val); - return m ? m[0] : def; - }; - } else { - defaultValue = fn; - fn = null; - } - } - - // preassign default value for --no-*, [optional], , or plain flag if boolean value - if (option.negate || option.optional || option.required || typeof defaultValue === 'boolean') { - // when --no-foo we make sure default is true, unless a --foo option is already defined - if (option.negate) { - var opts = self.opts(); - defaultValue = Object.prototype.hasOwnProperty.call(opts, name) ? opts[name] : true; - } - // preassign only if we have a default - if (defaultValue !== undefined) { - self[name] = defaultValue; - option.defaultValue = defaultValue; - } - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on('option:' + oname, function(val) { - // coercion - if (val !== null && fn) { - val = fn(val, self[name] === undefined ? defaultValue : self[name]); - } - - // unassigned or boolean value - if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') { - // if no value, negate false, and we have a default, then use it! - if (val == null) { - self[name] = option.negate - ? false - : defaultValue || true; - } else { - self[name] = val; - } - } else if (val !== null) { - // reassign - self[name] = option.negate ? false : val; - } - }); - - return this; -}; - -/** - * Allow unknown options on the command line. - * - * @param {Boolean} arg if `true` or omitted, no error will be thrown - * for unknown options. - * @api public - */ -Command.prototype.allowUnknownOption = function(arg) { - this._allowUnknownOption = arguments.length === 0 || arg; - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv) { - // implicit help - if (this.executables) this.addImplicitHelpCommand(); - - // store raw args - this.rawArgs = argv; - - // guess name - this._name = this._name || basename(argv[1], '.js'); - - // github-style sub-commands with no sub-command - if (this.executables && argv.length < 3 && !this.defaultExecutable) { - // this user needs help - argv.push(this._helpLongFlag); - } - - // process argv - var normalized = this.normalize(argv.slice(2)); - var parsed = this.parseOptions(normalized); - var args = this.args = parsed.args; - - var result = this.parseArgs(this.args, parsed.unknown); - - if (args[0] === 'help' && args.length === 1) this.help(); - - // --help - if (args[0] === 'help') { - args[0] = args[1]; - args[1] = this._helpLongFlag; - } - - // executable sub-commands - // (Debugging note for future: args[0] is not right if an action has been called) - var name = result.args[0]; - var subCommand = null; - - // Look for subcommand - if (name) { - subCommand = this.commands.find(function(command) { - return command._name === name; - }); - } - - // Look for alias - if (!subCommand && name) { - subCommand = this.commands.find(function(command) { - return command.alias() === name; - }); - if (subCommand) { - name = subCommand._name; - args[0] = name; - } - } - - // Look for default subcommand - if (!subCommand && this.defaultExecutable) { - name = this.defaultExecutable; - args.unshift(name); - subCommand = this.commands.find(function(command) { - return command._name === name; - }); - } - - if (this._execs[name] && typeof this._execs[name] !== 'function') { - return this.executeSubCommand(argv, args, parsed.unknown, subCommand ? subCommand._executableFile : undefined); - } - - return result; -}; - -/** - * Execute a sub-command executable. - * - * @param {Array} argv - * @param {Array} args - * @param {Array} unknown - * @param {String} specifySubcommand - * @api private - */ - -Command.prototype.executeSubCommand = function(argv, args, unknown, executableFile) { - args = args.concat(unknown); - - if (!args.length) this.help(); - - var isExplicitJS = false; // Whether to use node to launch "executable" - - // executable - var pm = argv[1]; - // name of the subcommand, like `pm-install` - var bin = basename(pm, path.extname(pm)) + '-' + args[0]; - if (executableFile != null) { - bin = executableFile; - // Check for same extensions as we scan for below so get consistent launch behaviour. - var executableExt = path.extname(executableFile); - isExplicitJS = executableExt === '.js' || executableExt === '.ts' || executableExt === '.mjs'; - } - - // In case of globally installed, get the base dir where executable - // subcommand file should be located at - var baseDir; - - var resolvedLink = fs.realpathSync(pm); - - baseDir = dirname(resolvedLink); - - // prefer local `./` to bin in the $PATH - var localBin = path.join(baseDir, bin); - - // whether bin file is a js script with explicit `.js` or `.ts` extension - if (exists(localBin + '.js')) { - bin = localBin + '.js'; - isExplicitJS = true; - } else if (exists(localBin + '.ts')) { - bin = localBin + '.ts'; - isExplicitJS = true; - } else if (exists(localBin + '.mjs')) { - bin = localBin + '.mjs'; - isExplicitJS = true; - } else if (exists(localBin)) { - bin = localBin; - } - - args = args.slice(1); - - var proc; - if (process.platform !== 'win32') { - if (isExplicitJS) { - args.unshift(bin); - // add executable arguments to spawn - args = incrementNodeInspectorPort(process.execArgv).concat(args); - - proc = spawn(process.argv[0], args, { stdio: 'inherit', customFds: [0, 1, 2] }); - } else { - proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] }); - } - } else { - args.unshift(bin); - // add executable arguments to spawn - args = incrementNodeInspectorPort(process.execArgv).concat(args); - proc = spawn(process.execPath, args, { stdio: 'inherit' }); - } - - var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP']; - signals.forEach(function(signal) { - process.on(signal, function() { - if (proc.killed === false && proc.exitCode === null) { - proc.kill(signal); - } - }); - }); - proc.on('close', process.exit.bind(process)); - proc.on('error', function(err) { - if (err.code === 'ENOENT') { - console.error('error: %s(1) does not exist, try --help', bin); - } else if (err.code === 'EACCES') { - console.error('error: %s(1) not executable. try chmod or run with root', bin); - } - process.exit(1); - }); - - // Store the reference to the child process - this.runningCommand = proc; -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * This also normalizes equal sign and splits "--abc=def" into "--abc def". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args) { - var ret = [], - arg, - lastOpt, - index, - short, - opt; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - if (i > 0) { - lastOpt = this.optionFor(args[i - 1]); - } - - if (arg === '--') { - // Honor option terminator - ret = ret.concat(args.slice(i)); - break; - } else if (lastOpt && lastOpt.required) { - ret.push(arg); - } else if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') { - short = arg.slice(0, 2); - opt = this.optionFor(short); - if (opt && (opt.required || opt.optional)) { - ret.push(short); - ret.push(arg.slice(2)); - } else { - arg.slice(1).split('').forEach(function(c) { - ret.push('-' + c); - }); - } - } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) { - ret.push(arg.slice(0, index), arg.slice(index + 1)); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown) { - var name; - - if (args.length) { - name = args[0]; - if (this.listeners('command:' + name).length) { - this.emit('command:' + args.shift(), args, unknown); - } else { - this.emit('command:*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - if (this.commands.length === 0 && - this._args.filter(function(a) { return a.required; }).length === 0) { - this.emit('command:*'); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg) { - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv) { - var args = [], - len = argv.length, - literal, - option, - arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if (literal) { - args.push(arg); - continue; - } - - if (arg === '--') { - literal = true; - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (arg == null) return this.optionMissingArgument(option); - this.emit('option:' + option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i + 1]; - if (arg == null || (arg[0] === '-' && arg !== '-')) { - arg = null; - } else { - ++i; - } - this.emit('option:' + option.name(), arg); - // flag - } else { - this.emit('option:' + option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && arg[0] === '-') { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if ((i + 1) < argv.length && (argv[i + 1][0] !== '-' || argv[i + 1] === '-')) { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Return an object containing options as key-value pairs - * - * @return {Object} - * @api public - */ -Command.prototype.opts = function() { - var result = {}, - len = this.options.length; - - for (var i = 0; i < len; i++) { - var key = this.options[i].attributeName(); - result[key] = key === this._versionOptionName ? this._version : this[key]; - } - return result; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name) { - console.error("error: missing required argument '%s'", name); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag) { - if (flag) { - console.error("error: option '%s' argument missing, got '%s'", option.flags, flag); - } else { - console.error("error: option '%s' argument missing", option.flags); - } - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag) { - if (this._allowUnknownOption) return; - console.error("error: unknown option '%s'", flag); - process.exit(1); -}; - -/** - * Variadic argument with `name` is not the last argument as required. - * - * @param {String} name - * @api private - */ - -Command.prototype.variadicArgNotLast = function(name) { - console.error("error: variadic arguments must be last '%s'", name); - process.exit(1); -}; - -/** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * You can optionally supply the flags and description to override the defaults. - * - * @param {String} str - * @param {String} [flags] - * @param {String} [description] - * @return {Command} for chaining - * @api public - */ - -Command.prototype.version = function(str, flags, description) { - if (arguments.length === 0) return this._version; - this._version = str; - flags = flags || '-V, --version'; - description = description || 'output the version number'; - var versionOption = new Option(flags, description); - this._versionOptionName = versionOption.long.substr(2) || 'version'; - this.options.push(versionOption); - this.on('option:' + this._versionOptionName, function() { - process.stdout.write(str + '\n'); - process.exit(0); - }); - return this; -}; - -/** - * Set the description to `str`. - * - * @param {String} str - * @param {Object} argsDescription - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str, argsDescription) { - if (arguments.length === 0) return this._description; - this._description = str; - this._argsDescription = argsDescription; - return this; -}; - -/** - * Set an alias for the command - * - * @param {String} alias - * @return {String|Command} - * @api public - */ - -Command.prototype.alias = function(alias) { - var command = this; - if (this.commands.length !== 0) { - command = this.commands[this.commands.length - 1]; - } - - if (arguments.length === 0) return command._alias; - - if (alias === command._name) throw new Error('Command alias can\'t be the same as its name'); - - command._alias = alias; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str) { - var args = this._args.map(function(arg) { - return humanReadableArgName(arg); - }); - - var usage = '[options]' + - (this.commands.length ? ' [command]' : '') + - (this._args.length ? ' ' + args.join(' ') : ''); - - if (arguments.length === 0) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Get or set the name of the command - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.name = function(str) { - if (arguments.length === 0) return this._name; - this._name = str; - return this; -}; - -/** - * Return prepared commands. - * - * @return {Array} - * @api private - */ - -Command.prototype.prepareCommands = function() { - return this.commands.filter(function(cmd) { - return !cmd._noHelp; - }).map(function(cmd) { - var args = cmd._args.map(function(arg) { - return humanReadableArgName(arg); - }).join(' '); - - return [ - cmd._name + - (cmd._alias ? '|' + cmd._alias : '') + - (cmd.options.length ? ' [options]' : '') + - (args ? ' ' + args : ''), - cmd._description - ]; - }); -}; - -/** - * Return the largest command length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestCommandLength = function() { - var commands = this.prepareCommands(); - return commands.reduce(function(max, command) { - return Math.max(max, command[0].length); - }, 0); -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function() { - var options = [].slice.call(this.options); - options.push({ - flags: this._helpFlags - }); - - return options.reduce(function(max, option) { - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return the largest arg length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestArgLength = function() { - return this._args.reduce(function(max, arg) { - return Math.max(max, arg.name.length); - }, 0); -}; - -/** - * Return the pad width. - * - * @return {Number} - * @api private - */ - -Command.prototype.padWidth = function() { - var width = this.largestOptionLength(); - if (this._argsDescription && this._args.length) { - if (this.largestArgLength() > width) { - width = this.largestArgLength(); - } - } - - if (this.commands && this.commands.length) { - if (this.largestCommandLength() > width) { - width = this.largestCommandLength(); - } - } - - return width; -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function() { - var width = this.padWidth(); - - // Append the help information - return this.options.map(function(option) { - return pad(option.flags, width) + ' ' + option.description + - ((!option.negate && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : ''); - }).concat([pad(this._helpFlags, width) + ' ' + this._helpDescription]) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function() { - if (!this.commands.length) return ''; - - var commands = this.prepareCommands(); - var width = this.padWidth(); - - return [ - 'Commands:', - commands.map(function(cmd) { - var desc = cmd[1] ? ' ' + cmd[1] : ''; - return (desc ? pad(cmd[0], width) : cmd[0]) + desc; - }).join('\n').replace(/^/gm, ' '), - '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function() { - var desc = []; - if (this._description) { - desc = [ - this._description, - '' - ]; - - var argsDescription = this._argsDescription; - if (argsDescription && this._args.length) { - var width = this.padWidth(); - desc.push('Arguments:'); - desc.push(''); - this._args.forEach(function(arg) { - desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]); - }); - desc.push(''); - } - } - - var cmdName = this._name; - if (this._alias) { - cmdName = cmdName + '|' + this._alias; - } - var parentCmdNames = ''; - for (var parentCmd = this.parent; parentCmd; parentCmd = parentCmd.parent) { - parentCmdNames = parentCmd.name() + ' ' + parentCmdNames; - } - var usage = [ - 'Usage: ' + parentCmdNames + cmdName + ' ' + this.usage(), - '' - ]; - - var cmds = []; - var commandHelp = this.commandHelp(); - if (commandHelp) cmds = [commandHelp]; - - var options = [ - 'Options:', - '' + this.optionHelp().replace(/^/gm, ' '), - '' - ]; - - return usage - .concat(desc) - .concat(options) - .concat(cmds) - .join('\n'); -}; - -/** - * Output help information for this command. - * - * When listener(s) are available for the helpLongFlag - * those callbacks are invoked. - * - * @api public - */ - -Command.prototype.outputHelp = function(cb) { - if (!cb) { - cb = function(passthru) { - return passthru; - }; - } - const cbOutput = cb(this.helpInformation()); - if (typeof cbOutput !== 'string' && !Buffer.isBuffer(cbOutput)) { - throw new Error('outputHelp callback must return a string or a Buffer'); - } - process.stdout.write(cbOutput); - this.emit(this._helpLongFlag); -}; - -/** - * You can pass in flags and a description to override the help - * flags and help description for your command. - * - * @param {String} [flags] - * @param {String} [description] - * @return {Command} - * @api public - */ - -Command.prototype.helpOption = function(flags, description) { - this._helpFlags = flags || this._helpFlags; - this._helpDescription = description || this._helpDescription; - - var splitFlags = this._helpFlags.split(/[ ,|]+/); - - if (splitFlags.length > 1) this._helpShortFlag = splitFlags.shift(); - - this._helpLongFlag = splitFlags.shift(); - - return this; -}; - -/** - * Output help information and exit. - * - * @param {Function} [cb] - * @api public - */ - -Command.prototype.help = function(cb) { - this.outputHelp(cb); - process.exit(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word) { - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - - for (var i = 0; i < options.length; i++) { - if (options[i] === cmd._helpLongFlag || options[i] === cmd._helpShortFlag) { - cmd.outputHelp(); - process.exit(0); - } - } -} - -/** - * Takes an argument and returns its human readable equivalent for help usage. - * - * @param {Object} arg - * @return {String} - * @api private - */ - -function humanReadableArgName(arg) { - var nameOutput = arg.name + (arg.variadic === true ? '...' : ''); - - return arg.required - ? '<' + nameOutput + '>' - : '[' + nameOutput + ']'; -} - -// for versions before node v0.8 when there weren't `fs.existsSync` -function exists(file) { - try { - if (fs.statSync(file).isFile()) { - return true; - } - } catch (e) { - return false; - } -} - -/** - * Scan arguments and increment port number for inspect calls (to avoid conflicts when spawning new command). - * - * @param {string[]} args - array of arguments from node.execArgv - * @returns {string[]} - * @api private - */ - -function incrementNodeInspectorPort(args) { - // Testing for these options: - // --inspect[=[host:]port] - // --inspect-brk[=[host:]port] - // --inspect-port=[host:]port - return args.map((arg) => { - var result = arg; - if (arg.indexOf('--inspect') === 0) { - var debugOption; - var debugHost = '127.0.0.1'; - var debugPort = '9229'; - var match; - if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) { - // e.g. --inspect - debugOption = match[1]; - } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) { - debugOption = match[1]; - if (/^\d+$/.test(match[3])) { - // e.g. --inspect=1234 - debugPort = match[3]; - } else { - // e.g. --inspect=localhost - debugHost = match[3]; - } - } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) { - // e.g. --inspect=localhost:1234 - debugOption = match[1]; - debugHost = match[3]; - debugPort = match[4]; - } - - if (debugOption && debugPort !== '0') { - result = `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`; - } - } - return result; - }); -} - -}).call(this,{"isBuffer":require("../is-buffer/index.js")},require('_process')) - -},{"../is-buffer/index.js":549,"_process":571,"child_process":98,"events":518,"fs":98,"path":567,"util":634}],117:[function(require,module,exports){ -module.exports = function (xs, fn) { - var res = []; - for (var i = 0; i < xs.length; i++) { - var x = fn(xs[i], i); - if (isArray(x)) res.push.apply(res, x); - else res.push(x); - } - return res; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -},{}],118:[function(require,module,exports){ -module.exports={ - "O_RDONLY": 0, - "O_WRONLY": 1, - "O_RDWR": 2, - "S_IFMT": 61440, - "S_IFREG": 32768, - "S_IFDIR": 16384, - "S_IFCHR": 8192, - "S_IFBLK": 24576, - "S_IFIFO": 4096, - "S_IFLNK": 40960, - "S_IFSOCK": 49152, - "O_CREAT": 512, - "O_EXCL": 2048, - "O_NOCTTY": 131072, - "O_TRUNC": 1024, - "O_APPEND": 8, - "O_DIRECTORY": 1048576, - "O_NOFOLLOW": 256, - "O_SYNC": 128, - "O_SYMLINK": 2097152, - "O_NONBLOCK": 4, - "S_IRWXU": 448, - "S_IRUSR": 256, - "S_IWUSR": 128, - "S_IXUSR": 64, - "S_IRWXG": 56, - "S_IRGRP": 32, - "S_IWGRP": 16, - "S_IXGRP": 8, - "S_IRWXO": 7, - "S_IROTH": 4, - "S_IWOTH": 2, - "S_IXOTH": 1, - "E2BIG": 7, - "EACCES": 13, - "EADDRINUSE": 48, - "EADDRNOTAVAIL": 49, - "EAFNOSUPPORT": 47, - "EAGAIN": 35, - "EALREADY": 37, - "EBADF": 9, - "EBADMSG": 94, - "EBUSY": 16, - "ECANCELED": 89, - "ECHILD": 10, - "ECONNABORTED": 53, - "ECONNREFUSED": 61, - "ECONNRESET": 54, - "EDEADLK": 11, - "EDESTADDRREQ": 39, - "EDOM": 33, - "EDQUOT": 69, - "EEXIST": 17, - "EFAULT": 14, - "EFBIG": 27, - "EHOSTUNREACH": 65, - "EIDRM": 90, - "EILSEQ": 92, - "EINPROGRESS": 36, - "EINTR": 4, - "EINVAL": 22, - "EIO": 5, - "EISCONN": 56, - "EISDIR": 21, - "ELOOP": 62, - "EMFILE": 24, - "EMLINK": 31, - "EMSGSIZE": 40, - "EMULTIHOP": 95, - "ENAMETOOLONG": 63, - "ENETDOWN": 50, - "ENETRESET": 52, - "ENETUNREACH": 51, - "ENFILE": 23, - "ENOBUFS": 55, - "ENODATA": 96, - "ENODEV": 19, - "ENOENT": 2, - "ENOEXEC": 8, - "ENOLCK": 77, - "ENOLINK": 97, - "ENOMEM": 12, - "ENOMSG": 91, - "ENOPROTOOPT": 42, - "ENOSPC": 28, - "ENOSR": 98, - "ENOSTR": 99, - "ENOSYS": 78, - "ENOTCONN": 57, - "ENOTDIR": 20, - "ENOTEMPTY": 66, - "ENOTSOCK": 38, - "ENOTSUP": 45, - "ENOTTY": 25, - "ENXIO": 6, - "EOPNOTSUPP": 102, - "EOVERFLOW": 84, - "EPERM": 1, - "EPIPE": 32, - "EPROTO": 100, - "EPROTONOSUPPORT": 43, - "EPROTOTYPE": 41, - "ERANGE": 34, - "EROFS": 30, - "ESPIPE": 29, - "ESRCH": 3, - "ESTALE": 70, - "ETIME": 101, - "ETIMEDOUT": 60, - "ETXTBSY": 26, - "EWOULDBLOCK": 35, - "EXDEV": 18, - "SIGHUP": 1, - "SIGINT": 2, - "SIGQUIT": 3, - "SIGILL": 4, - "SIGTRAP": 5, - "SIGABRT": 6, - "SIGIOT": 6, - "SIGBUS": 10, - "SIGFPE": 8, - "SIGKILL": 9, - "SIGUSR1": 30, - "SIGSEGV": 11, - "SIGUSR2": 31, - "SIGPIPE": 13, - "SIGALRM": 14, - "SIGTERM": 15, - "SIGCHLD": 20, - "SIGCONT": 19, - "SIGSTOP": 17, - "SIGTSTP": 18, - "SIGTTIN": 21, - "SIGTTOU": 22, - "SIGURG": 16, - "SIGXCPU": 24, - "SIGXFSZ": 25, - "SIGVTALRM": 26, - "SIGPROF": 27, - "SIGWINCH": 28, - "SIGIO": 23, - "SIGSYS": 12, - "SSL_OP_ALL": 2147486719, - "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION": 262144, - "SSL_OP_CIPHER_SERVER_PREFERENCE": 4194304, - "SSL_OP_CISCO_ANYCONNECT": 32768, - "SSL_OP_COOKIE_EXCHANGE": 8192, - "SSL_OP_CRYPTOPRO_TLSEXT_BUG": 2147483648, - "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS": 2048, - "SSL_OP_EPHEMERAL_RSA": 0, - "SSL_OP_LEGACY_SERVER_CONNECT": 4, - "SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER": 32, - "SSL_OP_MICROSOFT_SESS_ID_BUG": 1, - "SSL_OP_MSIE_SSLV2_RSA_PADDING": 0, - "SSL_OP_NETSCAPE_CA_DN_BUG": 536870912, - "SSL_OP_NETSCAPE_CHALLENGE_BUG": 2, - "SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG": 1073741824, - "SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG": 8, - "SSL_OP_NO_COMPRESSION": 131072, - "SSL_OP_NO_QUERY_MTU": 4096, - "SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION": 65536, - "SSL_OP_NO_SSLv2": 16777216, - "SSL_OP_NO_SSLv3": 33554432, - "SSL_OP_NO_TICKET": 16384, - "SSL_OP_NO_TLSv1": 67108864, - "SSL_OP_NO_TLSv1_1": 268435456, - "SSL_OP_NO_TLSv1_2": 134217728, - "SSL_OP_PKCS1_CHECK_1": 0, - "SSL_OP_PKCS1_CHECK_2": 0, - "SSL_OP_SINGLE_DH_USE": 1048576, - "SSL_OP_SINGLE_ECDH_USE": 524288, - "SSL_OP_SSLEAY_080_CLIENT_DH_BUG": 128, - "SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG": 0, - "SSL_OP_TLS_BLOCK_PADDING_BUG": 512, - "SSL_OP_TLS_D5_BUG": 256, - "SSL_OP_TLS_ROLLBACK_BUG": 8388608, - "ENGINE_METHOD_DSA": 2, - "ENGINE_METHOD_DH": 4, - "ENGINE_METHOD_RAND": 8, - "ENGINE_METHOD_ECDH": 16, - "ENGINE_METHOD_ECDSA": 32, - "ENGINE_METHOD_CIPHERS": 64, - "ENGINE_METHOD_DIGESTS": 128, - "ENGINE_METHOD_STORE": 256, - "ENGINE_METHOD_PKEY_METHS": 512, - "ENGINE_METHOD_PKEY_ASN1_METHS": 1024, - "ENGINE_METHOD_ALL": 65535, - "ENGINE_METHOD_NONE": 0, - "DH_CHECK_P_NOT_SAFE_PRIME": 2, - "DH_CHECK_P_NOT_PRIME": 1, - "DH_UNABLE_TO_CHECK_GENERATOR": 4, - "DH_NOT_SUITABLE_GENERATOR": 8, - "NPN_ENABLED": 1, - "RSA_PKCS1_PADDING": 1, - "RSA_SSLV23_PADDING": 2, - "RSA_NO_PADDING": 3, - "RSA_PKCS1_OAEP_PADDING": 4, - "RSA_X931_PADDING": 5, - "RSA_PKCS1_PSS_PADDING": 6, - "POINT_CONVERSION_COMPRESSED": 2, - "POINT_CONVERSION_UNCOMPRESSED": 4, - "POINT_CONVERSION_HYBRID": 6, - "F_OK": 0, - "R_OK": 4, - "W_OK": 2, - "X_OK": 1, - "UV_UDP_REUSEADDR": 4 -} - -},{}],119:[function(require,module,exports){ -module.exports = function (it) { - if (typeof it != 'function') { - throw TypeError(String(it) + ' is not a function'); - } return it; -}; - -},{}],120:[function(require,module,exports){ -var isObject = require('../internals/is-object'); - -module.exports = function (it) { - if (!isObject(it) && it !== null) { - throw TypeError("Can't set " + String(it) + ' as a prototype'); - } return it; -}; - -},{"../internals/is-object":188}],121:[function(require,module,exports){ -var wellKnownSymbol = require('../internals/well-known-symbol'); -var create = require('../internals/object-create'); -var hide = require('../internals/hide'); - -var UNSCOPABLES = wellKnownSymbol('unscopables'); -var ArrayPrototype = Array.prototype; - -// Array.prototype[@@unscopables] -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -if (ArrayPrototype[UNSCOPABLES] == undefined) { - hide(ArrayPrototype, UNSCOPABLES, create(null)); -} - -// add a key to Array.prototype[@@unscopables] -module.exports = function (key) { - ArrayPrototype[UNSCOPABLES][key] = true; -}; - -},{"../internals/hide":176,"../internals/object-create":207,"../internals/well-known-symbol":262}],122:[function(require,module,exports){ -'use strict'; -var charAt = require('../internals/string-multibyte').charAt; - -// `AdvanceStringIndex` abstract operation -// https://tc39.github.io/ecma262/#sec-advancestringindex -module.exports = function (S, index, unicode) { - return index + (unicode ? charAt(S, index).length : 1); -}; - -},{"../internals/string-multibyte":242}],123:[function(require,module,exports){ -module.exports = function (it, Constructor, name) { - if (!(it instanceof Constructor)) { - throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); - } return it; -}; - -},{}],124:[function(require,module,exports){ -var isObject = require('../internals/is-object'); - -module.exports = function (it) { - if (!isObject(it)) { - throw TypeError(String(it) + ' is not an object'); - } return it; -}; - -},{"../internals/is-object":188}],125:[function(require,module,exports){ -'use strict'; -var DESCRIPTORS = require('../internals/descriptors'); -var global = require('../internals/global'); -var isObject = require('../internals/is-object'); -var has = require('../internals/has'); -var classof = require('../internals/classof'); -var hide = require('../internals/hide'); -var redefine = require('../internals/redefine'); -var defineProperty = require('../internals/object-define-property').f; -var getPrototypeOf = require('../internals/object-get-prototype-of'); -var setPrototypeOf = require('../internals/object-set-prototype-of'); -var wellKnownSymbol = require('../internals/well-known-symbol'); -var uid = require('../internals/uid'); - -var DataView = global.DataView; -var DataViewPrototype = DataView && DataView.prototype; -var Int8Array = global.Int8Array; -var Int8ArrayPrototype = Int8Array && Int8Array.prototype; -var Uint8ClampedArray = global.Uint8ClampedArray; -var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype; -var TypedArray = Int8Array && getPrototypeOf(Int8Array); -var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype); -var ObjectPrototype = Object.prototype; -var isPrototypeOf = ObjectPrototype.isPrototypeOf; - -var TO_STRING_TAG = wellKnownSymbol('toStringTag'); -var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); -var NATIVE_ARRAY_BUFFER = !!(global.ArrayBuffer && DataView); -// Fixing native typed arrays in Opera Presto crashes the browser, see #595 -var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera'; -var TYPED_ARRAY_TAG_REQIRED = false; -var NAME; - -var TypedArrayConstructorsList = { - Int8Array: 1, - Uint8Array: 1, - Uint8ClampedArray: 1, - Int16Array: 2, - Uint16Array: 2, - Int32Array: 4, - Uint32Array: 4, - Float32Array: 4, - Float64Array: 8 -}; - -var isView = function isView(it) { - var klass = classof(it); - return klass === 'DataView' || has(TypedArrayConstructorsList, klass); -}; - -var isTypedArray = function (it) { - return isObject(it) && has(TypedArrayConstructorsList, classof(it)); -}; - -var aTypedArray = function (it) { - if (isTypedArray(it)) return it; - throw TypeError('Target is not a typed array'); -}; - -var aTypedArrayConstructor = function (C) { - if (setPrototypeOf) { - if (isPrototypeOf.call(TypedArray, C)) return C; - } else for (var ARRAY in TypedArrayConstructorsList) if (has(TypedArrayConstructorsList, NAME)) { - var TypedArrayConstructor = global[ARRAY]; - if (TypedArrayConstructor && (C === TypedArrayConstructor || isPrototypeOf.call(TypedArrayConstructor, C))) { - return C; - } - } throw TypeError('Target is not a typed array constructor'); -}; - -var exportProto = function (KEY, property, forced) { - if (!DESCRIPTORS) return; - if (forced) for (var ARRAY in TypedArrayConstructorsList) { - var TypedArrayConstructor = global[ARRAY]; - if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) { - delete TypedArrayConstructor.prototype[KEY]; - } - } - if (!TypedArrayPrototype[KEY] || forced) { - redefine(TypedArrayPrototype, KEY, forced ? property - : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property); - } -}; - -var exportStatic = function (KEY, property, forced) { - var ARRAY, TypedArrayConstructor; - if (!DESCRIPTORS) return; - if (setPrototypeOf) { - if (forced) for (ARRAY in TypedArrayConstructorsList) { - TypedArrayConstructor = global[ARRAY]; - if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) { - delete TypedArrayConstructor[KEY]; - } - } - if (!TypedArray[KEY] || forced) { - // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable - try { - return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY] || property); - } catch (error) { /* empty */ } - } else return; - } - for (ARRAY in TypedArrayConstructorsList) { - TypedArrayConstructor = global[ARRAY]; - if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) { - redefine(TypedArrayConstructor, KEY, property); - } - } -}; - -for (NAME in TypedArrayConstructorsList) { - if (!global[NAME]) NATIVE_ARRAY_BUFFER_VIEWS = false; -} - -// WebKit bug - typed arrays constructors prototype is Object.prototype -if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) { - // eslint-disable-next-line no-shadow - TypedArray = function TypedArray() { - throw TypeError('Incorrect invocation'); - }; - if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { - if (global[NAME]) setPrototypeOf(global[NAME], TypedArray); - } -} - -if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) { - TypedArrayPrototype = TypedArray.prototype; - if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { - if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype); - } -} - -// WebKit bug - one more object in Uint8ClampedArray prototype chain -if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) { - setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype); -} - -if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) { - TYPED_ARRAY_TAG_REQIRED = true; - defineProperty(TypedArrayPrototype, TO_STRING_TAG, { get: function () { - return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined; - } }); - for (NAME in TypedArrayConstructorsList) if (global[NAME]) { - hide(global[NAME], TYPED_ARRAY_TAG, NAME); - } -} - -// WebKit bug - the same parent prototype for typed arrays and data view -if (NATIVE_ARRAY_BUFFER && setPrototypeOf && getPrototypeOf(DataViewPrototype) !== ObjectPrototype) { - setPrototypeOf(DataViewPrototype, ObjectPrototype); -} - -module.exports = { - NATIVE_ARRAY_BUFFER: NATIVE_ARRAY_BUFFER, - NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS, - TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG, - aTypedArray: aTypedArray, - aTypedArrayConstructor: aTypedArrayConstructor, - exportProto: exportProto, - exportStatic: exportStatic, - isView: isView, - isTypedArray: isTypedArray, - TypedArray: TypedArray, - TypedArrayPrototype: TypedArrayPrototype -}; - -},{"../internals/classof":141,"../internals/descriptors":156,"../internals/global":173,"../internals/has":174,"../internals/hide":176,"../internals/is-object":188,"../internals/object-define-property":209,"../internals/object-get-prototype-of":214,"../internals/object-set-prototype-of":218,"../internals/redefine":229,"../internals/uid":259,"../internals/well-known-symbol":262}],126:[function(require,module,exports){ -'use strict'; -var global = require('../internals/global'); -var DESCRIPTORS = require('../internals/descriptors'); -var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER; -var hide = require('../internals/hide'); -var redefineAll = require('../internals/redefine-all'); -var fails = require('../internals/fails'); -var anInstance = require('../internals/an-instance'); -var toInteger = require('../internals/to-integer'); -var toLength = require('../internals/to-length'); -var toIndex = require('../internals/to-index'); -var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; -var defineProperty = require('../internals/object-define-property').f; -var arrayFill = require('../internals/array-fill'); -var setToStringTag = require('../internals/set-to-string-tag'); -var InternalStateModule = require('../internals/internal-state'); - -var getInternalState = InternalStateModule.get; -var setInternalState = InternalStateModule.set; -var ARRAY_BUFFER = 'ArrayBuffer'; -var DATA_VIEW = 'DataView'; -var PROTOTYPE = 'prototype'; -var WRONG_LENGTH = 'Wrong length'; -var WRONG_INDEX = 'Wrong index'; -var NativeArrayBuffer = global[ARRAY_BUFFER]; -var $ArrayBuffer = NativeArrayBuffer; -var $DataView = global[DATA_VIEW]; -var Math = global.Math; -var RangeError = global.RangeError; -// eslint-disable-next-line no-shadow-restricted-names -var Infinity = 1 / 0; -var abs = Math.abs; -var pow = Math.pow; -var floor = Math.floor; -var log = Math.log; -var LN2 = Math.LN2; - -// IEEE754 conversions based on https://github.com/feross/ieee754 -var packIEEE754 = function (number, mantissaLength, bytes) { - var buffer = new Array(bytes); - var exponentLength = bytes * 8 - mantissaLength - 1; - var eMax = (1 << exponentLength) - 1; - var eBias = eMax >> 1; - var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0; - var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0; - var index = 0; - var exponent, mantissa, c; - number = abs(number); - // eslint-disable-next-line no-self-compare - if (number != number || number === Infinity) { - // eslint-disable-next-line no-self-compare - mantissa = number != number ? 1 : 0; - exponent = eMax; - } else { - exponent = floor(log(number) / LN2); - if (number * (c = pow(2, -exponent)) < 1) { - exponent--; - c *= 2; - } - if (exponent + eBias >= 1) { - number += rt / c; - } else { - number += rt * pow(2, 1 - eBias); - } - if (number * c >= 2) { - exponent++; - c /= 2; - } - if (exponent + eBias >= eMax) { - mantissa = 0; - exponent = eMax; - } else if (exponent + eBias >= 1) { - mantissa = (number * c - 1) * pow(2, mantissaLength); - exponent = exponent + eBias; - } else { - mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength); - exponent = 0; - } - } - for (; mantissaLength >= 8; buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8); - exponent = exponent << mantissaLength | mantissa; - exponentLength += mantissaLength; - for (; exponentLength > 0; buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8); - buffer[--index] |= sign * 128; - return buffer; -}; - -var unpackIEEE754 = function (buffer, mantissaLength) { - var bytes = buffer.length; - var exponentLength = bytes * 8 - mantissaLength - 1; - var eMax = (1 << exponentLength) - 1; - var eBias = eMax >> 1; - var nBits = exponentLength - 7; - var index = bytes - 1; - var sign = buffer[index--]; - var exponent = sign & 127; - var mantissa; - sign >>= 7; - for (; nBits > 0; exponent = exponent * 256 + buffer[index], index--, nBits -= 8); - mantissa = exponent & (1 << -nBits) - 1; - exponent >>= -nBits; - nBits += mantissaLength; - for (; nBits > 0; mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8); - if (exponent === 0) { - exponent = 1 - eBias; - } else if (exponent === eMax) { - return mantissa ? NaN : sign ? -Infinity : Infinity; - } else { - mantissa = mantissa + pow(2, mantissaLength); - exponent = exponent - eBias; - } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength); -}; - -var unpackInt32 = function (buffer) { - return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0]; -}; - -var packInt8 = function (number) { - return [number & 0xFF]; -}; - -var packInt16 = function (number) { - return [number & 0xFF, number >> 8 & 0xFF]; -}; - -var packInt32 = function (number) { - return [number & 0xFF, number >> 8 & 0xFF, number >> 16 & 0xFF, number >> 24 & 0xFF]; -}; - -var packFloat32 = function (number) { - return packIEEE754(number, 23, 4); -}; - -var packFloat64 = function (number) { - return packIEEE754(number, 52, 8); -}; - -var addGetter = function (Constructor, key) { - defineProperty(Constructor[PROTOTYPE], key, { get: function () { return getInternalState(this)[key]; } }); -}; - -var get = function (view, count, index, isLittleEndian) { - var numIndex = +index; - var intIndex = toIndex(numIndex); - var store = getInternalState(view); - if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX); - var bytes = getInternalState(store.buffer).bytes; - var start = intIndex + store.byteOffset; - var pack = bytes.slice(start, start + count); - return isLittleEndian ? pack : pack.reverse(); -}; - -var set = function (view, count, index, conversion, value, isLittleEndian) { - var numIndex = +index; - var intIndex = toIndex(numIndex); - var store = getInternalState(view); - if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX); - var bytes = getInternalState(store.buffer).bytes; - var start = intIndex + store.byteOffset; - var pack = conversion(+value); - for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1]; -}; - -if (!NATIVE_ARRAY_BUFFER) { - $ArrayBuffer = function ArrayBuffer(length) { - anInstance(this, $ArrayBuffer, ARRAY_BUFFER); - var byteLength = toIndex(length); - setInternalState(this, { - bytes: arrayFill.call(new Array(byteLength), 0), - byteLength: byteLength - }); - if (!DESCRIPTORS) this.byteLength = byteLength; - }; - - $DataView = function DataView(buffer, byteOffset, byteLength) { - anInstance(this, $DataView, DATA_VIEW); - anInstance(buffer, $ArrayBuffer, DATA_VIEW); - var bufferLength = getInternalState(buffer).byteLength; - var offset = toInteger(byteOffset); - if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset'); - byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); - if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH); - setInternalState(this, { - buffer: buffer, - byteLength: byteLength, - byteOffset: offset - }); - if (!DESCRIPTORS) { - this.buffer = buffer; - this.byteLength = byteLength; - this.byteOffset = offset; - } - }; - - if (DESCRIPTORS) { - addGetter($ArrayBuffer, 'byteLength'); - addGetter($DataView, 'buffer'); - addGetter($DataView, 'byteLength'); - addGetter($DataView, 'byteOffset'); - } - - redefineAll($DataView[PROTOTYPE], { - getInt8: function getInt8(byteOffset) { - return get(this, 1, byteOffset)[0] << 24 >> 24; - }, - getUint8: function getUint8(byteOffset) { - return get(this, 1, byteOffset)[0]; - }, - getInt16: function getInt16(byteOffset /* , littleEndian */) { - var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined); - return (bytes[1] << 8 | bytes[0]) << 16 >> 16; - }, - getUint16: function getUint16(byteOffset /* , littleEndian */) { - var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined); - return bytes[1] << 8 | bytes[0]; - }, - getInt32: function getInt32(byteOffset /* , littleEndian */) { - return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)); - }, - getUint32: function getUint32(byteOffset /* , littleEndian */) { - return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0; - }, - getFloat32: function getFloat32(byteOffset /* , littleEndian */) { - return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23); - }, - getFloat64: function getFloat64(byteOffset /* , littleEndian */) { - return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52); - }, - setInt8: function setInt8(byteOffset, value) { - set(this, 1, byteOffset, packInt8, value); - }, - setUint8: function setUint8(byteOffset, value) { - set(this, 1, byteOffset, packInt8, value); - }, - setInt16: function setInt16(byteOffset, value /* , littleEndian */) { - set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined); - }, - setUint16: function setUint16(byteOffset, value /* , littleEndian */) { - set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined); - }, - setInt32: function setInt32(byteOffset, value /* , littleEndian */) { - set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined); - }, - setUint32: function setUint32(byteOffset, value /* , littleEndian */) { - set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined); - }, - setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) { - set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined); - }, - setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) { - set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined); - } - }); -} else { - if (!fails(function () { - NativeArrayBuffer(1); - }) || !fails(function () { - new NativeArrayBuffer(-1); // eslint-disable-line no-new - }) || fails(function () { - new NativeArrayBuffer(); // eslint-disable-line no-new - new NativeArrayBuffer(1.5); // eslint-disable-line no-new - new NativeArrayBuffer(NaN); // eslint-disable-line no-new - return NativeArrayBuffer.name != ARRAY_BUFFER; - })) { - $ArrayBuffer = function ArrayBuffer(length) { - anInstance(this, $ArrayBuffer); - return new NativeArrayBuffer(toIndex(length)); - }; - var ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE] = NativeArrayBuffer[PROTOTYPE]; - for (var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key; keys.length > j;) { - if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, NativeArrayBuffer[key]); - } - ArrayBufferPrototype.constructor = $ArrayBuffer; - } - // iOS Safari 7.x bug - var testView = new $DataView(new $ArrayBuffer(2)); - var nativeSetInt8 = $DataView[PROTOTYPE].setInt8; - testView.setInt8(0, 2147483648); - testView.setInt8(1, 2147483649); - if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataView[PROTOTYPE], { - setInt8: function setInt8(byteOffset, value) { - nativeSetInt8.call(this, byteOffset, value << 24 >> 24); - }, - setUint8: function setUint8(byteOffset, value) { - nativeSetInt8.call(this, byteOffset, value << 24 >> 24); - } - }, { unsafe: true }); -} - -setToStringTag($ArrayBuffer, ARRAY_BUFFER); -setToStringTag($DataView, DATA_VIEW); -exports[ARRAY_BUFFER] = $ArrayBuffer; -exports[DATA_VIEW] = $DataView; - -},{"../internals/an-instance":123,"../internals/array-buffer-view-core":125,"../internals/array-fill":128,"../internals/descriptors":156,"../internals/fails":161,"../internals/global":173,"../internals/hide":176,"../internals/internal-state":183,"../internals/object-define-property":209,"../internals/object-get-own-property-names":212,"../internals/redefine-all":228,"../internals/set-to-string-tag":237,"../internals/to-index":249,"../internals/to-integer":251,"../internals/to-length":252}],127:[function(require,module,exports){ -'use strict'; -var toObject = require('../internals/to-object'); -var toAbsoluteIndex = require('../internals/to-absolute-index'); -var toLength = require('../internals/to-length'); - -var min = Math.min; - -// `Array.prototype.copyWithin` method implementation -// https://tc39.github.io/ecma262/#sec-array.prototype.copywithin -module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { - var O = toObject(this); - var len = toLength(O.length); - var to = toAbsoluteIndex(target, len); - var from = toAbsoluteIndex(start, len); - var end = arguments.length > 2 ? arguments[2] : undefined; - var count = min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to); - var inc = 1; - if (from < to && to < from + count) { - inc = -1; - from += count - 1; - to += count - 1; - } - while (count-- > 0) { - if (from in O) O[to] = O[from]; - else delete O[to]; - to += inc; - from += inc; - } return O; -}; - -},{"../internals/to-absolute-index":248,"../internals/to-length":252,"../internals/to-object":253}],128:[function(require,module,exports){ -'use strict'; -var toObject = require('../internals/to-object'); -var toAbsoluteIndex = require('../internals/to-absolute-index'); -var toLength = require('../internals/to-length'); - -// `Array.prototype.fill` method implementation -// https://tc39.github.io/ecma262/#sec-array.prototype.fill -module.exports = function fill(value /* , start = 0, end = @length */) { - var O = toObject(this); - var length = toLength(O.length); - var argumentsLength = arguments.length; - var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length); - var end = argumentsLength > 2 ? arguments[2] : undefined; - var endPos = end === undefined ? length : toAbsoluteIndex(end, length); - while (endPos > index) O[index++] = value; - return O; -}; - -},{"../internals/to-absolute-index":248,"../internals/to-length":252,"../internals/to-object":253}],129:[function(require,module,exports){ -'use strict'; -var $forEach = require('../internals/array-iteration').forEach; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); - -// `Array.prototype.forEach` method implementation -// https://tc39.github.io/ecma262/#sec-array.prototype.foreach -module.exports = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) { - return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); -} : [].forEach; - -},{"../internals/array-iteration":132,"../internals/sloppy-array-method":240}],130:[function(require,module,exports){ -'use strict'; -var bind = require('../internals/bind-context'); -var toObject = require('../internals/to-object'); -var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); -var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); -var toLength = require('../internals/to-length'); -var createProperty = require('../internals/create-property'); -var getIteratorMethod = require('../internals/get-iterator-method'); - -// `Array.from` method implementation -// https://tc39.github.io/ecma262/#sec-array.from -module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { - var O = toObject(arrayLike); - var C = typeof this == 'function' ? this : Array; - var argumentsLength = arguments.length; - var mapfn = argumentsLength > 1 ? arguments[1] : undefined; - var mapping = mapfn !== undefined; - var index = 0; - var iteratorMethod = getIteratorMethod(O); - var length, result, step, iterator; - if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); - // if the target is not iterable or it's an array with the default iterator - use a simple case - if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) { - iterator = iteratorMethod.call(O); - result = new C(); - for (;!(step = iterator.next()).done; index++) { - createProperty(result, index, mapping - ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) - : step.value - ); - } - } else { - length = toLength(O.length); - result = new C(length); - for (;length > index; index++) { - createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); - } - } - result.length = index; - return result; -}; - -},{"../internals/bind-context":137,"../internals/call-with-safe-iteration-closing":138,"../internals/create-property":151,"../internals/get-iterator-method":171,"../internals/is-array-iterator-method":184,"../internals/to-length":252,"../internals/to-object":253}],131:[function(require,module,exports){ -var toIndexedObject = require('../internals/to-indexed-object'); -var toLength = require('../internals/to-length'); -var toAbsoluteIndex = require('../internals/to-absolute-index'); - -// `Array.prototype.{ indexOf, includes }` methods implementation -var createMethod = function (IS_INCLUDES) { - return function ($this, el, fromIndex) { - var O = toIndexedObject($this); - var length = toLength(O.length); - var index = toAbsoluteIndex(fromIndex, length); - var value; - // Array#includes uses SameValueZero equality algorithm - // eslint-disable-next-line no-self-compare - if (IS_INCLUDES && el != el) while (length > index) { - value = O[index++]; - // eslint-disable-next-line no-self-compare - if (value != value) return true; - // Array#indexOf ignores holes, Array#includes - not - } else for (;length > index; index++) { - if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; - } return !IS_INCLUDES && -1; - }; -}; - -module.exports = { - // `Array.prototype.includes` method - // https://tc39.github.io/ecma262/#sec-array.prototype.includes - includes: createMethod(true), - // `Array.prototype.indexOf` method - // https://tc39.github.io/ecma262/#sec-array.prototype.indexof - indexOf: createMethod(false) -}; - -},{"../internals/to-absolute-index":248,"../internals/to-indexed-object":250,"../internals/to-length":252}],132:[function(require,module,exports){ -var bind = require('../internals/bind-context'); -var IndexedObject = require('../internals/indexed-object'); -var toObject = require('../internals/to-object'); -var toLength = require('../internals/to-length'); -var arraySpeciesCreate = require('../internals/array-species-create'); - -var push = [].push; - -// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation -var createMethod = function (TYPE) { - var IS_MAP = TYPE == 1; - var IS_FILTER = TYPE == 2; - var IS_SOME = TYPE == 3; - var IS_EVERY = TYPE == 4; - var IS_FIND_INDEX = TYPE == 6; - var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; - return function ($this, callbackfn, that, specificCreate) { - var O = toObject($this); - var self = IndexedObject(O); - var boundFunction = bind(callbackfn, that, 3); - var length = toLength(self.length); - var index = 0; - var create = specificCreate || arraySpeciesCreate; - var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; - var value, result; - for (;length > index; index++) if (NO_HOLES || index in self) { - value = self[index]; - result = boundFunction(value, index, O); - if (TYPE) { - if (IS_MAP) target[index] = result; // map - else if (result) switch (TYPE) { - case 3: return true; // some - case 5: return value; // find - case 6: return index; // findIndex - case 2: push.call(target, value); // filter - } else if (IS_EVERY) return false; // every - } - } - return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; - }; -}; - -module.exports = { - // `Array.prototype.forEach` method - // https://tc39.github.io/ecma262/#sec-array.prototype.foreach - forEach: createMethod(0), - // `Array.prototype.map` method - // https://tc39.github.io/ecma262/#sec-array.prototype.map - map: createMethod(1), - // `Array.prototype.filter` method - // https://tc39.github.io/ecma262/#sec-array.prototype.filter - filter: createMethod(2), - // `Array.prototype.some` method - // https://tc39.github.io/ecma262/#sec-array.prototype.some - some: createMethod(3), - // `Array.prototype.every` method - // https://tc39.github.io/ecma262/#sec-array.prototype.every - every: createMethod(4), - // `Array.prototype.find` method - // https://tc39.github.io/ecma262/#sec-array.prototype.find - find: createMethod(5), - // `Array.prototype.findIndex` method - // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex - findIndex: createMethod(6) -}; - -},{"../internals/array-species-create":136,"../internals/bind-context":137,"../internals/indexed-object":180,"../internals/to-length":252,"../internals/to-object":253}],133:[function(require,module,exports){ -'use strict'; -var toIndexedObject = require('../internals/to-indexed-object'); -var toInteger = require('../internals/to-integer'); -var toLength = require('../internals/to-length'); -var sloppyArrayMethod = require('../internals/sloppy-array-method'); - -var min = Math.min; -var nativeLastIndexOf = [].lastIndexOf; -var NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0; -var SLOPPY_METHOD = sloppyArrayMethod('lastIndexOf'); - -// `Array.prototype.lastIndexOf` method implementation -// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof -module.exports = (NEGATIVE_ZERO || SLOPPY_METHOD) ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { - // convert -0 to +0 - if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0; - var O = toIndexedObject(this); - var length = toLength(O.length); - var index = length - 1; - if (arguments.length > 1) index = min(index, toInteger(arguments[1])); - if (index < 0) index = length + index; - for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0; - return -1; -} : nativeLastIndexOf; - -},{"../internals/sloppy-array-method":240,"../internals/to-indexed-object":250,"../internals/to-integer":251,"../internals/to-length":252}],134:[function(require,module,exports){ -var fails = require('../internals/fails'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var SPECIES = wellKnownSymbol('species'); - -module.exports = function (METHOD_NAME) { - return !fails(function () { - var array = []; - var constructor = array.constructor = {}; - constructor[SPECIES] = function () { - return { foo: 1 }; - }; - return array[METHOD_NAME](Boolean).foo !== 1; - }); -}; - -},{"../internals/fails":161,"../internals/well-known-symbol":262}],135:[function(require,module,exports){ -var aFunction = require('../internals/a-function'); -var toObject = require('../internals/to-object'); -var IndexedObject = require('../internals/indexed-object'); -var toLength = require('../internals/to-length'); - -// `Array.prototype.{ reduce, reduceRight }` methods implementation -var createMethod = function (IS_RIGHT) { - return function (that, callbackfn, argumentsLength, memo) { - aFunction(callbackfn); - var O = toObject(that); - var self = IndexedObject(O); - var length = toLength(O.length); - var index = IS_RIGHT ? length - 1 : 0; - var i = IS_RIGHT ? -1 : 1; - if (argumentsLength < 2) while (true) { - if (index in self) { - memo = self[index]; - index += i; - break; - } - index += i; - if (IS_RIGHT ? index < 0 : length <= index) { - throw TypeError('Reduce of empty array with no initial value'); - } - } - for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) { - memo = callbackfn(memo, self[index], index, O); - } - return memo; - }; -}; - -module.exports = { - // `Array.prototype.reduce` method - // https://tc39.github.io/ecma262/#sec-array.prototype.reduce - left: createMethod(false), - // `Array.prototype.reduceRight` method - // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright - right: createMethod(true) -}; - -},{"../internals/a-function":119,"../internals/indexed-object":180,"../internals/to-length":252,"../internals/to-object":253}],136:[function(require,module,exports){ -var isObject = require('../internals/is-object'); -var isArray = require('../internals/is-array'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var SPECIES = wellKnownSymbol('species'); - -// `ArraySpeciesCreate` abstract operation -// https://tc39.github.io/ecma262/#sec-arrayspeciescreate -module.exports = function (originalArray, length) { - var C; - if (isArray(originalArray)) { - C = originalArray.constructor; - // cross-realm fallback - if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; - else if (isObject(C)) { - C = C[SPECIES]; - if (C === null) C = undefined; - } - } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); -}; - -},{"../internals/is-array":185,"../internals/is-object":188,"../internals/well-known-symbol":262}],137:[function(require,module,exports){ -var aFunction = require('../internals/a-function'); - -// optional / simple context binding -module.exports = function (fn, that, length) { - aFunction(fn); - if (that === undefined) return fn; - switch (length) { - case 0: return function () { - return fn.call(that); - }; - case 1: return function (a) { - return fn.call(that, a); - }; - case 2: return function (a, b) { - return fn.call(that, a, b); - }; - case 3: return function (a, b, c) { - return fn.call(that, a, b, c); - }; - } - return function (/* ...args */) { - return fn.apply(that, arguments); - }; -}; - -},{"../internals/a-function":119}],138:[function(require,module,exports){ -var anObject = require('../internals/an-object'); - -// call something on iterator step with safe closing on error -module.exports = function (iterator, fn, value, ENTRIES) { - try { - return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); - // 7.4.6 IteratorClose(iterator, completion) - } catch (error) { - var returnMethod = iterator['return']; - if (returnMethod !== undefined) anObject(returnMethod.call(iterator)); - throw error; - } -}; - -},{"../internals/an-object":124}],139:[function(require,module,exports){ -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var ITERATOR = wellKnownSymbol('iterator'); -var SAFE_CLOSING = false; - -try { - var called = 0; - var iteratorWithReturn = { - next: function () { - return { done: !!called++ }; - }, - 'return': function () { - SAFE_CLOSING = true; - } - }; - iteratorWithReturn[ITERATOR] = function () { - return this; - }; - // eslint-disable-next-line no-throw-literal - Array.from(iteratorWithReturn, function () { throw 2; }); -} catch (error) { /* empty */ } - -module.exports = function (exec, SKIP_CLOSING) { - if (!SKIP_CLOSING && !SAFE_CLOSING) return false; - var ITERATION_SUPPORT = false; - try { - var object = {}; - object[ITERATOR] = function () { - return { - next: function () { - return { done: ITERATION_SUPPORT = true }; - } - }; - }; - exec(object); - } catch (error) { /* empty */ } - return ITERATION_SUPPORT; -}; - -},{"../internals/well-known-symbol":262}],140:[function(require,module,exports){ -arguments[4][21][0].apply(exports,arguments) -},{"dup":21}],141:[function(require,module,exports){ -var classofRaw = require('../internals/classof-raw'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var TO_STRING_TAG = wellKnownSymbol('toStringTag'); -// ES3 wrong here -var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; - -// fallback for IE11 Script Access Denied error -var tryGet = function (it, key) { - try { - return it[key]; - } catch (error) { /* empty */ } -}; - -// getting tag from ES6+ `Object.prototype.toString` -module.exports = function (it) { - var O, tag, result; - return it === undefined ? 'Undefined' : it === null ? 'Null' - // @@toStringTag case - : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag - // builtinTag case - : CORRECT_ARGUMENTS ? classofRaw(O) - // ES3 arguments fallback - : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; -}; - -},{"../internals/classof-raw":140,"../internals/well-known-symbol":262}],142:[function(require,module,exports){ -'use strict'; -var defineProperty = require('../internals/object-define-property').f; -var create = require('../internals/object-create'); -var redefineAll = require('../internals/redefine-all'); -var bind = require('../internals/bind-context'); -var anInstance = require('../internals/an-instance'); -var iterate = require('../internals/iterate'); -var defineIterator = require('../internals/define-iterator'); -var setSpecies = require('../internals/set-species'); -var DESCRIPTORS = require('../internals/descriptors'); -var fastKey = require('../internals/internal-metadata').fastKey; -var InternalStateModule = require('../internals/internal-state'); - -var setInternalState = InternalStateModule.set; -var internalStateGetterFor = InternalStateModule.getterFor; - -module.exports = { - getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { - var C = wrapper(function (that, iterable) { - anInstance(that, C, CONSTRUCTOR_NAME); - setInternalState(that, { - type: CONSTRUCTOR_NAME, - index: create(null), - first: undefined, - last: undefined, - size: 0 - }); - if (!DESCRIPTORS) that.size = 0; - if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP); - }); - - var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); - - var define = function (that, key, value) { - var state = getInternalState(that); - var entry = getEntry(that, key); - var previous, index; - // change existing entry - if (entry) { - entry.value = value; - // create new entry - } else { - state.last = entry = { - index: index = fastKey(key, true), - key: key, - value: value, - previous: previous = state.last, - next: undefined, - removed: false - }; - if (!state.first) state.first = entry; - if (previous) previous.next = entry; - if (DESCRIPTORS) state.size++; - else that.size++; - // add to index - if (index !== 'F') state.index[index] = entry; - } return that; - }; - - var getEntry = function (that, key) { - var state = getInternalState(that); - // fast case - var index = fastKey(key); - var entry; - if (index !== 'F') return state.index[index]; - // frozen object case - for (entry = state.first; entry; entry = entry.next) { - if (entry.key == key) return entry; - } - }; - - redefineAll(C.prototype, { - // 23.1.3.1 Map.prototype.clear() - // 23.2.3.2 Set.prototype.clear() - clear: function clear() { - var that = this; - var state = getInternalState(that); - var data = state.index; - var entry = state.first; - while (entry) { - entry.removed = true; - if (entry.previous) entry.previous = entry.previous.next = undefined; - delete data[entry.index]; - entry = entry.next; - } - state.first = state.last = undefined; - if (DESCRIPTORS) state.size = 0; - else that.size = 0; - }, - // 23.1.3.3 Map.prototype.delete(key) - // 23.2.3.4 Set.prototype.delete(value) - 'delete': function (key) { - var that = this; - var state = getInternalState(that); - var entry = getEntry(that, key); - if (entry) { - var next = entry.next; - var prev = entry.previous; - delete state.index[entry.index]; - entry.removed = true; - if (prev) prev.next = next; - if (next) next.previous = prev; - if (state.first == entry) state.first = next; - if (state.last == entry) state.last = prev; - if (DESCRIPTORS) state.size--; - else that.size--; - } return !!entry; - }, - // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) - // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) - forEach: function forEach(callbackfn /* , that = undefined */) { - var state = getInternalState(this); - var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); - var entry; - while (entry = entry ? entry.next : state.first) { - boundFunction(entry.value, entry.key, this); - // revert to the last existing entry - while (entry && entry.removed) entry = entry.previous; - } - }, - // 23.1.3.7 Map.prototype.has(key) - // 23.2.3.7 Set.prototype.has(value) - has: function has(key) { - return !!getEntry(this, key); - } - }); - - redefineAll(C.prototype, IS_MAP ? { - // 23.1.3.6 Map.prototype.get(key) - get: function get(key) { - var entry = getEntry(this, key); - return entry && entry.value; - }, - // 23.1.3.9 Map.prototype.set(key, value) - set: function set(key, value) { - return define(this, key === 0 ? 0 : key, value); - } - } : { - // 23.2.3.1 Set.prototype.add(value) - add: function add(value) { - return define(this, value = value === 0 ? 0 : value, value); - } - }); - if (DESCRIPTORS) defineProperty(C.prototype, 'size', { - get: function () { - return getInternalState(this).size; - } - }); - return C; - }, - setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) { - var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; - var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); - var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME); - // add .keys, .values, .entries, [@@iterator] - // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 - defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) { - setInternalState(this, { - type: ITERATOR_NAME, - target: iterated, - state: getInternalCollectionState(iterated), - kind: kind, - last: undefined - }); - }, function () { - var state = getInternalIteratorState(this); - var kind = state.kind; - var entry = state.last; - // revert to the last existing entry - while (entry && entry.removed) entry = entry.previous; - // get next entry - if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { - // or finish the iteration - state.target = undefined; - return { value: undefined, done: true }; - } - // return step by kind - if (kind == 'keys') return { value: entry.key, done: false }; - if (kind == 'values') return { value: entry.value, done: false }; - return { value: [entry.key, entry.value], done: false }; - }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); - - // add [@@species], 23.1.2.2, 23.2.2.2 - setSpecies(CONSTRUCTOR_NAME); - } -}; - -},{"../internals/an-instance":123,"../internals/bind-context":137,"../internals/define-iterator":154,"../internals/descriptors":156,"../internals/internal-metadata":182,"../internals/internal-state":183,"../internals/iterate":191,"../internals/object-create":207,"../internals/object-define-property":209,"../internals/redefine-all":228,"../internals/set-species":236}],143:[function(require,module,exports){ -'use strict'; -var redefineAll = require('../internals/redefine-all'); -var getWeakData = require('../internals/internal-metadata').getWeakData; -var anObject = require('../internals/an-object'); -var isObject = require('../internals/is-object'); -var anInstance = require('../internals/an-instance'); -var iterate = require('../internals/iterate'); -var ArrayIterationModule = require('../internals/array-iteration'); -var $has = require('../internals/has'); -var InternalStateModule = require('../internals/internal-state'); - -var setInternalState = InternalStateModule.set; -var internalStateGetterFor = InternalStateModule.getterFor; -var find = ArrayIterationModule.find; -var findIndex = ArrayIterationModule.findIndex; -var id = 0; - -// fallback for uncaught frozen keys -var uncaughtFrozenStore = function (store) { - return store.frozen || (store.frozen = new UncaughtFrozenStore()); -}; - -var UncaughtFrozenStore = function () { - this.entries = []; -}; - -var findUncaughtFrozen = function (store, key) { - return find(store.entries, function (it) { - return it[0] === key; - }); -}; - -UncaughtFrozenStore.prototype = { - get: function (key) { - var entry = findUncaughtFrozen(this, key); - if (entry) return entry[1]; - }, - has: function (key) { - return !!findUncaughtFrozen(this, key); - }, - set: function (key, value) { - var entry = findUncaughtFrozen(this, key); - if (entry) entry[1] = value; - else this.entries.push([key, value]); - }, - 'delete': function (key) { - var index = findIndex(this.entries, function (it) { - return it[0] === key; - }); - if (~index) this.entries.splice(index, 1); - return !!~index; - } -}; - -module.exports = { - getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { - var C = wrapper(function (that, iterable) { - anInstance(that, C, CONSTRUCTOR_NAME); - setInternalState(that, { - type: CONSTRUCTOR_NAME, - id: id++, - frozen: undefined - }); - if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP); - }); - - var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); - - var define = function (that, key, value) { - var state = getInternalState(that); - var data = getWeakData(anObject(key), true); - if (data === true) uncaughtFrozenStore(state).set(key, value); - else data[state.id] = value; - return that; - }; - - redefineAll(C.prototype, { - // 23.3.3.2 WeakMap.prototype.delete(key) - // 23.4.3.3 WeakSet.prototype.delete(value) - 'delete': function (key) { - var state = getInternalState(this); - if (!isObject(key)) return false; - var data = getWeakData(key); - if (data === true) return uncaughtFrozenStore(state)['delete'](key); - return data && $has(data, state.id) && delete data[state.id]; - }, - // 23.3.3.4 WeakMap.prototype.has(key) - // 23.4.3.4 WeakSet.prototype.has(value) - has: function has(key) { - var state = getInternalState(this); - if (!isObject(key)) return false; - var data = getWeakData(key); - if (data === true) return uncaughtFrozenStore(state).has(key); - return data && $has(data, state.id); - } - }); - - redefineAll(C.prototype, IS_MAP ? { - // 23.3.3.3 WeakMap.prototype.get(key) - get: function get(key) { - var state = getInternalState(this); - if (isObject(key)) { - var data = getWeakData(key); - if (data === true) return uncaughtFrozenStore(state).get(key); - return data ? data[state.id] : undefined; - } - }, - // 23.3.3.5 WeakMap.prototype.set(key, value) - set: function set(key, value) { - return define(this, key, value); - } - } : { - // 23.4.3.1 WeakSet.prototype.add(value) - add: function add(value) { - return define(this, value, true); - } - }); - - return C; - } -}; - -},{"../internals/an-instance":123,"../internals/an-object":124,"../internals/array-iteration":132,"../internals/has":174,"../internals/internal-metadata":182,"../internals/internal-state":183,"../internals/is-object":188,"../internals/iterate":191,"../internals/redefine-all":228}],144:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var global = require('../internals/global'); -var isForced = require('../internals/is-forced'); -var redefine = require('../internals/redefine'); -var InternalMetadataModule = require('../internals/internal-metadata'); -var iterate = require('../internals/iterate'); -var anInstance = require('../internals/an-instance'); -var isObject = require('../internals/is-object'); -var fails = require('../internals/fails'); -var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); -var setToStringTag = require('../internals/set-to-string-tag'); -var inheritIfRequired = require('../internals/inherit-if-required'); - -module.exports = function (CONSTRUCTOR_NAME, wrapper, common, IS_MAP, IS_WEAK) { - var NativeConstructor = global[CONSTRUCTOR_NAME]; - var NativePrototype = NativeConstructor && NativeConstructor.prototype; - var Constructor = NativeConstructor; - var ADDER = IS_MAP ? 'set' : 'add'; - var exported = {}; - - var fixMethod = function (KEY) { - var nativeMethod = NativePrototype[KEY]; - redefine(NativePrototype, KEY, - KEY == 'add' ? function add(value) { - nativeMethod.call(this, value === 0 ? 0 : value); - return this; - } : KEY == 'delete' ? function (key) { - return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); - } : KEY == 'get' ? function get(key) { - return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key); - } : KEY == 'has' ? function has(key) { - return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); - } : function set(key, value) { - nativeMethod.call(this, key === 0 ? 0 : key, value); - return this; - } - ); - }; - - // eslint-disable-next-line max-len - if (isForced(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () { - new NativeConstructor().entries().next(); - })))) { - // create collection constructor - Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); - InternalMetadataModule.REQUIRED = true; - } else if (isForced(CONSTRUCTOR_NAME, true)) { - var instance = new Constructor(); - // early implementations not supports chaining - var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; - // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false - var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); }); - // most early implementations doesn't supports iterables, most modern - not close it correctly - // eslint-disable-next-line no-new - var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); }); - // for early implementations -0 and +0 not the same - var BUGGY_ZERO = !IS_WEAK && fails(function () { - // V8 ~ Chromium 42- fails only with 5+ elements - var $instance = new NativeConstructor(); - var index = 5; - while (index--) $instance[ADDER](index, index); - return !$instance.has(-0); - }); - - if (!ACCEPT_ITERABLES) { - Constructor = wrapper(function (dummy, iterable) { - anInstance(dummy, Constructor, CONSTRUCTOR_NAME); - var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); - if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP); - return that; - }); - Constructor.prototype = NativePrototype; - NativePrototype.constructor = Constructor; - } - - if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { - fixMethod('delete'); - fixMethod('has'); - IS_MAP && fixMethod('get'); - } - - if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); - - // weak collections should not contains .clear method - if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear; - } - - exported[CONSTRUCTOR_NAME] = Constructor; - $({ global: true, forced: Constructor != NativeConstructor }, exported); - - setToStringTag(Constructor, CONSTRUCTOR_NAME); - - if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); - - return Constructor; -}; - -},{"../internals/an-instance":123,"../internals/check-correctness-of-iteration":139,"../internals/export":160,"../internals/fails":161,"../internals/global":173,"../internals/inherit-if-required":181,"../internals/internal-metadata":182,"../internals/is-forced":186,"../internals/is-object":188,"../internals/iterate":191,"../internals/redefine":229,"../internals/set-to-string-tag":237}],145:[function(require,module,exports){ -var has = require('../internals/has'); -var ownKeys = require('../internals/own-keys'); -var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); -var definePropertyModule = require('../internals/object-define-property'); - -module.exports = function (target, source) { - var keys = ownKeys(source); - var defineProperty = definePropertyModule.f; - var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); - } -}; - -},{"../internals/has":174,"../internals/object-define-property":209,"../internals/object-get-own-property-descriptor":210,"../internals/own-keys":221}],146:[function(require,module,exports){ -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var MATCH = wellKnownSymbol('match'); - -module.exports = function (METHOD_NAME) { - var regexp = /./; - try { - '/./'[METHOD_NAME](regexp); - } catch (e) { - try { - regexp[MATCH] = false; - return '/./'[METHOD_NAME](regexp); - } catch (f) { /* empty */ } - } return false; -}; - -},{"../internals/well-known-symbol":262}],147:[function(require,module,exports){ -var fails = require('../internals/fails'); - -module.exports = !fails(function () { - function F() { /* empty */ } - F.prototype.constructor = null; - return Object.getPrototypeOf(new F()) !== F.prototype; -}); - -},{"../internals/fails":161}],148:[function(require,module,exports){ -var requireObjectCoercible = require('../internals/require-object-coercible'); - -var quot = /"/g; - -// B.2.3.2.1 CreateHTML(string, tag, attribute, value) -// https://tc39.github.io/ecma262/#sec-createhtml -module.exports = function (string, tag, attribute, value) { - var S = String(requireObjectCoercible(string)); - var p1 = '<' + tag; - if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; - return p1 + '>' + S + ''; -}; - -},{"../internals/require-object-coercible":233}],149:[function(require,module,exports){ -'use strict'; -var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype; -var create = require('../internals/object-create'); -var createPropertyDescriptor = require('../internals/create-property-descriptor'); -var setToStringTag = require('../internals/set-to-string-tag'); -var Iterators = require('../internals/iterators'); - -var returnThis = function () { return this; }; - -module.exports = function (IteratorConstructor, NAME, next) { - var TO_STRING_TAG = NAME + ' Iterator'; - IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) }); - setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true); - Iterators[TO_STRING_TAG] = returnThis; - return IteratorConstructor; -}; - -},{"../internals/create-property-descriptor":150,"../internals/iterators":193,"../internals/iterators-core":192,"../internals/object-create":207,"../internals/set-to-string-tag":237}],150:[function(require,module,exports){ -arguments[4][50][0].apply(exports,arguments) -},{"dup":50}],151:[function(require,module,exports){ -'use strict'; -var toPrimitive = require('../internals/to-primitive'); -var definePropertyModule = require('../internals/object-define-property'); -var createPropertyDescriptor = require('../internals/create-property-descriptor'); - -module.exports = function (object, key, value) { - var propertyKey = toPrimitive(key); - if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value)); - else object[propertyKey] = value; -}; - -},{"../internals/create-property-descriptor":150,"../internals/object-define-property":209,"../internals/to-primitive":255}],152:[function(require,module,exports){ -'use strict'; -var fails = require('../internals/fails'); -var padStart = require('../internals/string-pad').start; - -var abs = Math.abs; -var DatePrototype = Date.prototype; -var getTime = DatePrototype.getTime; -var nativeDateToISOString = DatePrototype.toISOString; - -// `Date.prototype.toISOString` method implementation -// https://tc39.github.io/ecma262/#sec-date.prototype.toisostring -// PhantomJS / old WebKit fails here: -module.exports = (fails(function () { - return nativeDateToISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; -}) || !fails(function () { - nativeDateToISOString.call(new Date(NaN)); -})) ? function toISOString() { - if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value'); - var date = this; - var year = date.getUTCFullYear(); - var milliseconds = date.getUTCMilliseconds(); - var sign = year < 0 ? '-' : year > 9999 ? '+' : ''; - return sign + padStart(abs(year), sign ? 6 : 4, 0) + - '-' + padStart(date.getUTCMonth() + 1, 2, 0) + - '-' + padStart(date.getUTCDate(), 2, 0) + - 'T' + padStart(date.getUTCHours(), 2, 0) + - ':' + padStart(date.getUTCMinutes(), 2, 0) + - ':' + padStart(date.getUTCSeconds(), 2, 0) + - '.' + padStart(milliseconds, 3, 0) + - 'Z'; -} : nativeDateToISOString; - -},{"../internals/fails":161,"../internals/string-pad":243}],153:[function(require,module,exports){ -'use strict'; -var anObject = require('../internals/an-object'); -var toPrimitive = require('../internals/to-primitive'); - -module.exports = function (hint) { - if (hint !== 'string' && hint !== 'number' && hint !== 'default') { - throw TypeError('Incorrect hint'); - } return toPrimitive(anObject(this), hint !== 'number'); -}; - -},{"../internals/an-object":124,"../internals/to-primitive":255}],154:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createIteratorConstructor = require('../internals/create-iterator-constructor'); -var getPrototypeOf = require('../internals/object-get-prototype-of'); -var setPrototypeOf = require('../internals/object-set-prototype-of'); -var setToStringTag = require('../internals/set-to-string-tag'); -var hide = require('../internals/hide'); -var redefine = require('../internals/redefine'); -var wellKnownSymbol = require('../internals/well-known-symbol'); -var IS_PURE = require('../internals/is-pure'); -var Iterators = require('../internals/iterators'); -var IteratorsCore = require('../internals/iterators-core'); - -var IteratorPrototype = IteratorsCore.IteratorPrototype; -var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; -var ITERATOR = wellKnownSymbol('iterator'); -var KEYS = 'keys'; -var VALUES = 'values'; -var ENTRIES = 'entries'; - -var returnThis = function () { return this; }; - -module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { - createIteratorConstructor(IteratorConstructor, NAME, next); - - var getIterationMethod = function (KIND) { - if (KIND === DEFAULT && defaultIterator) return defaultIterator; - if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND]; - switch (KIND) { - case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; - case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; - case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; - } return function () { return new IteratorConstructor(this); }; - }; - - var TO_STRING_TAG = NAME + ' Iterator'; - var INCORRECT_VALUES_NAME = false; - var IterablePrototype = Iterable.prototype; - var nativeIterator = IterablePrototype[ITERATOR] - || IterablePrototype['@@iterator'] - || DEFAULT && IterablePrototype[DEFAULT]; - var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); - var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; - var CurrentIteratorPrototype, methods, KEY; - - // fix native - if (anyNativeIterator) { - CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); - if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { - if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { - if (setPrototypeOf) { - setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); - } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') { - hide(CurrentIteratorPrototype, ITERATOR, returnThis); - } - } - // Set @@toStringTag to native iterators - setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); - if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; - } - } - - // fix Array#{values, @@iterator}.name in V8 / FF - if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { - INCORRECT_VALUES_NAME = true; - defaultIterator = function values() { return nativeIterator.call(this); }; - } - - // define iterator - if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { - hide(IterablePrototype, ITERATOR, defaultIterator); - } - Iterators[NAME] = defaultIterator; - - // export additional methods - if (DEFAULT) { - methods = { - values: getIterationMethod(VALUES), - keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), - entries: getIterationMethod(ENTRIES) - }; - if (FORCED) for (KEY in methods) { - if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { - redefine(IterablePrototype, KEY, methods[KEY]); - } - } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); - } - - return methods; -}; - -},{"../internals/create-iterator-constructor":149,"../internals/export":160,"../internals/hide":176,"../internals/is-pure":189,"../internals/iterators":193,"../internals/iterators-core":192,"../internals/object-get-prototype-of":214,"../internals/object-set-prototype-of":218,"../internals/redefine":229,"../internals/set-to-string-tag":237,"../internals/well-known-symbol":262}],155:[function(require,module,exports){ -var path = require('../internals/path'); -var has = require('../internals/has'); -var wrappedWellKnownSymbolModule = require('../internals/wrapped-well-known-symbol'); -var defineProperty = require('../internals/object-define-property').f; - -module.exports = function (NAME) { - var Symbol = path.Symbol || (path.Symbol = {}); - if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, { - value: wrappedWellKnownSymbolModule.f(NAME) - }); -}; - -},{"../internals/has":174,"../internals/object-define-property":209,"../internals/path":224,"../internals/wrapped-well-known-symbol":264}],156:[function(require,module,exports){ -var fails = require('../internals/fails'); - -// Thank's IE8 for his funny defineProperty -module.exports = !fails(function () { - return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; -}); - -},{"../internals/fails":161}],157:[function(require,module,exports){ -var global = require('../internals/global'); -var isObject = require('../internals/is-object'); - -var document = global.document; -// typeof document.createElement is 'object' in old IE -var EXISTS = isObject(document) && isObject(document.createElement); - -module.exports = function (it) { - return EXISTS ? document.createElement(it) : {}; -}; - -},{"../internals/global":173,"../internals/is-object":188}],158:[function(require,module,exports){ -// iterable DOM collections -// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods -module.exports = { - CSSRuleList: 0, - CSSStyleDeclaration: 0, - CSSValueList: 0, - ClientRectList: 0, - DOMRectList: 0, - DOMStringList: 0, - DOMTokenList: 1, - DataTransferItemList: 0, - FileList: 0, - HTMLAllCollection: 0, - HTMLCollection: 0, - HTMLFormElement: 0, - HTMLSelectElement: 0, - MediaList: 0, - MimeTypeArray: 0, - NamedNodeMap: 0, - NodeList: 1, - PaintRequestList: 0, - Plugin: 0, - PluginArray: 0, - SVGLengthList: 0, - SVGNumberList: 0, - SVGPathSegList: 0, - SVGPointList: 0, - SVGStringList: 0, - SVGTransformList: 0, - SourceBufferList: 0, - StyleSheetList: 0, - TextTrackCueList: 0, - TextTrackList: 0, - TouchList: 0 -}; - -},{}],159:[function(require,module,exports){ -// IE8- don't enum bug keys -module.exports = [ - 'constructor', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'toLocaleString', - 'toString', - 'valueOf' -]; - -},{}],160:[function(require,module,exports){ -var global = require('../internals/global'); -var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; -var hide = require('../internals/hide'); -var redefine = require('../internals/redefine'); -var setGlobal = require('../internals/set-global'); -var copyConstructorProperties = require('../internals/copy-constructor-properties'); -var isForced = require('../internals/is-forced'); - -/* - options.target - name of the target object - options.global - target is the global object - options.stat - export as static methods of target - options.proto - export as prototype methods of target - options.real - real prototype method for the `pure` version - options.forced - export even if the native feature is available - options.bind - bind methods to the target, required for the `pure` version - options.wrap - wrap constructors to preventing global pollution, required for the `pure` version - options.unsafe - use the simple assignment of property instead of delete + defineProperty - options.sham - add a flag to not completely full polyfills - options.enumerable - export as enumerable property - options.noTargetGet - prevent calling a getter on target -*/ -module.exports = function (options, source) { - var TARGET = options.target; - var GLOBAL = options.global; - var STATIC = options.stat; - var FORCED, target, key, targetProperty, sourceProperty, descriptor; - if (GLOBAL) { - target = global; - } else if (STATIC) { - target = global[TARGET] || setGlobal(TARGET, {}); - } else { - target = (global[TARGET] || {}).prototype; - } - if (target) for (key in source) { - sourceProperty = source[key]; - if (options.noTargetGet) { - descriptor = getOwnPropertyDescriptor(target, key); - targetProperty = descriptor && descriptor.value; - } else targetProperty = target[key]; - FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); - // contained in target - if (!FORCED && targetProperty !== undefined) { - if (typeof sourceProperty === typeof targetProperty) continue; - copyConstructorProperties(sourceProperty, targetProperty); - } - // add a flag to not completely full polyfills - if (options.sham || (targetProperty && targetProperty.sham)) { - hide(sourceProperty, 'sham', true); - } - // extend global - redefine(target, key, sourceProperty, options); - } -}; - -},{"../internals/copy-constructor-properties":145,"../internals/global":173,"../internals/hide":176,"../internals/is-forced":186,"../internals/object-get-own-property-descriptor":210,"../internals/redefine":229,"../internals/set-global":235}],161:[function(require,module,exports){ -module.exports = function (exec) { - try { - return !!exec(); - } catch (error) { - return true; - } -}; - -},{}],162:[function(require,module,exports){ -'use strict'; -var hide = require('../internals/hide'); -var redefine = require('../internals/redefine'); -var fails = require('../internals/fails'); -var wellKnownSymbol = require('../internals/well-known-symbol'); -var regexpExec = require('../internals/regexp-exec'); - -var SPECIES = wellKnownSymbol('species'); - -var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { - // #replace needs built-in support for named groups. - // #match works fine because it just return the exec results, even if it has - // a "grops" property. - var re = /./; - re.exec = function () { - var result = []; - result.groups = { a: '7' }; - return result; - }; - return ''.replace(re, '$') !== '7'; -}); - -// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec -// Weex JS has frozen built-in prototypes, so use try / catch wrapper -var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { - var re = /(?:)/; - var originalExec = re.exec; - re.exec = function () { return originalExec.apply(this, arguments); }; - var result = 'ab'.split(re); - return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; -}); - -module.exports = function (KEY, length, exec, sham) { - var SYMBOL = wellKnownSymbol(KEY); - - var DELEGATES_TO_SYMBOL = !fails(function () { - // String methods call symbol-named RegEp methods - var O = {}; - O[SYMBOL] = function () { return 7; }; - return ''[KEY](O) != 7; - }); - - var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () { - // Symbol-named RegExp methods call .exec - var execCalled = false; - var re = /a/; - re.exec = function () { execCalled = true; return null; }; - - if (KEY === 'split') { - // RegExp[@@split] doesn't call the regex's exec method, but first creates - // a new one. We need to return the patched regex when creating the new one. - re.constructor = {}; - re.constructor[SPECIES] = function () { return re; }; - } - - re[SYMBOL](''); - return !execCalled; - }); - - if ( - !DELEGATES_TO_SYMBOL || - !DELEGATES_TO_EXEC || - (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) || - (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) - ) { - var nativeRegExpMethod = /./[SYMBOL]; - var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { - if (regexp.exec === regexpExec) { - if (DELEGATES_TO_SYMBOL && !forceStringMethod) { - // The native String method already delegates to @@method (this - // polyfilled function), leasing to infinite recursion. - // We avoid it by directly calling the native @@method method. - return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; - } - return { done: true, value: nativeMethod.call(str, regexp, arg2) }; - } - return { done: false }; - }); - var stringMethod = methods[0]; - var regexMethod = methods[1]; - - redefine(String.prototype, KEY, stringMethod); - redefine(RegExp.prototype, SYMBOL, length == 2 - // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) - // 21.2.5.11 RegExp.prototype[@@split](string, limit) - ? function (string, arg) { return regexMethod.call(string, this, arg); } - // 21.2.5.6 RegExp.prototype[@@match](string) - // 21.2.5.9 RegExp.prototype[@@search](string) - : function (string) { return regexMethod.call(string, this); } - ); - if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true); - } -}; - -},{"../internals/fails":161,"../internals/hide":176,"../internals/redefine":229,"../internals/regexp-exec":231,"../internals/well-known-symbol":262}],163:[function(require,module,exports){ -'use strict'; -var isArray = require('../internals/is-array'); -var toLength = require('../internals/to-length'); -var bind = require('../internals/bind-context'); - -// `FlattenIntoArray` abstract operation -// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray -var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) { - var targetIndex = start; - var sourceIndex = 0; - var mapFn = mapper ? bind(mapper, thisArg, 3) : false; - var element; - - while (sourceIndex < sourceLen) { - if (sourceIndex in source) { - element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; - - if (depth > 0 && isArray(element)) { - targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1; - } else { - if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length'); - target[targetIndex] = element; - } - - targetIndex++; - } - sourceIndex++; - } - return targetIndex; -}; - -module.exports = flattenIntoArray; - -},{"../internals/bind-context":137,"../internals/is-array":185,"../internals/to-length":252}],164:[function(require,module,exports){ -'use strict'; -var IS_PURE = require('../internals/is-pure'); -var global = require('../internals/global'); -var fails = require('../internals/fails'); - -// Forced replacement object prototype accessors methods -module.exports = IS_PURE || !fails(function () { - var key = Math.random(); - // In FF throws only define methods - // eslint-disable-next-line no-undef, no-useless-call - __defineSetter__.call(null, key, function () { /* empty */ }); - delete global[key]; -}); - -},{"../internals/fails":161,"../internals/global":173,"../internals/is-pure":189}],165:[function(require,module,exports){ -var fails = require('../internals/fails'); - -// check the existence of a method, lowercase -// of a tag and escaping quotes in arguments -module.exports = function (METHOD_NAME) { - return fails(function () { - var test = ''[METHOD_NAME]('"'); - return test !== test.toLowerCase() || test.split('"').length > 3; - }); -}; - -},{"../internals/fails":161}],166:[function(require,module,exports){ -var fails = require('../internals/fails'); -var whitespaces = require('../internals/whitespaces'); - -var non = '\u200B\u0085\u180E'; - -// check that a method works with the correct list -// of whitespaces and has a correct name -module.exports = function (METHOD_NAME) { - return fails(function () { - return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME; - }); -}; - -},{"../internals/fails":161,"../internals/whitespaces":263}],167:[function(require,module,exports){ -var fails = require('../internals/fails'); - -module.exports = !fails(function () { - return Object.isExtensible(Object.preventExtensions({})); -}); - -},{"../internals/fails":161}],168:[function(require,module,exports){ -'use strict'; -var aFunction = require('../internals/a-function'); -var isObject = require('../internals/is-object'); - -var slice = [].slice; -var factories = {}; - -var construct = function (C, argsLength, args) { - if (!(argsLength in factories)) { - for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; - // eslint-disable-next-line no-new-func - factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')'); - } return factories[argsLength](C, args); -}; - -// `Function.prototype.bind` method implementation -// https://tc39.github.io/ecma262/#sec-function.prototype.bind -module.exports = Function.bind || function bind(that /* , ...args */) { - var fn = aFunction(this); - var partArgs = slice.call(arguments, 1); - var boundFunction = function bound(/* args... */) { - var args = partArgs.concat(slice.call(arguments)); - return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args); - }; - if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype; - return boundFunction; -}; - -},{"../internals/a-function":119,"../internals/is-object":188}],169:[function(require,module,exports){ -var shared = require('../internals/shared'); - -module.exports = shared('native-function-to-string', Function.toString); - -},{"../internals/shared":239}],170:[function(require,module,exports){ -var path = require('../internals/path'); -var global = require('../internals/global'); - -var aFunction = function (variable) { - return typeof variable == 'function' ? variable : undefined; -}; - -module.exports = function (namespace, method) { - return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) - : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method]; -}; - -},{"../internals/global":173,"../internals/path":224}],171:[function(require,module,exports){ -var classof = require('../internals/classof'); -var Iterators = require('../internals/iterators'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var ITERATOR = wellKnownSymbol('iterator'); - -module.exports = function (it) { - if (it != undefined) return it[ITERATOR] - || it['@@iterator'] - || Iterators[classof(it)]; -}; - -},{"../internals/classof":141,"../internals/iterators":193,"../internals/well-known-symbol":262}],172:[function(require,module,exports){ -var anObject = require('../internals/an-object'); -var getIteratorMethod = require('../internals/get-iterator-method'); - -module.exports = function (it) { - var iteratorMethod = getIteratorMethod(it); - if (typeof iteratorMethod != 'function') { - throw TypeError(String(it) + ' is not iterable'); - } return anObject(iteratorMethod.call(it)); -}; - -},{"../internals/an-object":124,"../internals/get-iterator-method":171}],173:[function(require,module,exports){ -(function (global){ -var O = 'object'; -var check = function (it) { - return it && it.Math == Math && it; -}; - -// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 -module.exports = - // eslint-disable-next-line no-undef - check(typeof globalThis == O && globalThis) || - check(typeof window == O && window) || - check(typeof self == O && self) || - check(typeof global == O && global) || - // eslint-disable-next-line no-new-func - Function('return this')(); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{}],174:[function(require,module,exports){ -var hasOwnProperty = {}.hasOwnProperty; - -module.exports = function (it, key) { - return hasOwnProperty.call(it, key); -}; - -},{}],175:[function(require,module,exports){ -arguments[4][41][0].apply(exports,arguments) -},{"dup":41}],176:[function(require,module,exports){ -var DESCRIPTORS = require('../internals/descriptors'); -var definePropertyModule = require('../internals/object-define-property'); -var createPropertyDescriptor = require('../internals/create-property-descriptor'); - -module.exports = DESCRIPTORS ? function (object, key, value) { - return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); -} : function (object, key, value) { - object[key] = value; - return object; -}; - -},{"../internals/create-property-descriptor":150,"../internals/descriptors":156,"../internals/object-define-property":209}],177:[function(require,module,exports){ -var global = require('../internals/global'); - -module.exports = function (a, b) { - var console = global.console; - if (console && console.error) { - arguments.length === 1 ? console.error(a) : console.error(a, b); - } -}; - -},{"../internals/global":173}],178:[function(require,module,exports){ -var getBuiltIn = require('../internals/get-built-in'); - -module.exports = getBuiltIn('document', 'documentElement'); - -},{"../internals/get-built-in":170}],179:[function(require,module,exports){ -var DESCRIPTORS = require('../internals/descriptors'); -var fails = require('../internals/fails'); -var createElement = require('../internals/document-create-element'); - -// Thank's IE8 for his funny defineProperty -module.exports = !DESCRIPTORS && !fails(function () { - return Object.defineProperty(createElement('div'), 'a', { - get: function () { return 7; } - }).a != 7; -}); - -},{"../internals/descriptors":156,"../internals/document-create-element":157,"../internals/fails":161}],180:[function(require,module,exports){ -var fails = require('../internals/fails'); -var classof = require('../internals/classof-raw'); - -var split = ''.split; - -// fallback for non-array-like ES3 and non-enumerable old V8 strings -module.exports = fails(function () { - // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 - // eslint-disable-next-line no-prototype-builtins - return !Object('z').propertyIsEnumerable(0); -}) ? function (it) { - return classof(it) == 'String' ? split.call(it, '') : Object(it); -} : Object; - -},{"../internals/classof-raw":140,"../internals/fails":161}],181:[function(require,module,exports){ -var isObject = require('../internals/is-object'); -var setPrototypeOf = require('../internals/object-set-prototype-of'); - -// makes subclassing work correct for wrapped built-ins -module.exports = function ($this, dummy, Wrapper) { - var NewTarget, NewTargetPrototype; - if ( - // it can work only with native `setPrototypeOf` - setPrototypeOf && - // we haven't completely correct pre-ES6 way for getting `new.target`, so use this - typeof (NewTarget = dummy.constructor) == 'function' && - NewTarget !== Wrapper && - isObject(NewTargetPrototype = NewTarget.prototype) && - NewTargetPrototype !== Wrapper.prototype - ) setPrototypeOf($this, NewTargetPrototype); - return $this; -}; - -},{"../internals/is-object":188,"../internals/object-set-prototype-of":218}],182:[function(require,module,exports){ -var hiddenKeys = require('../internals/hidden-keys'); -var isObject = require('../internals/is-object'); -var has = require('../internals/has'); -var defineProperty = require('../internals/object-define-property').f; -var uid = require('../internals/uid'); -var FREEZING = require('../internals/freezing'); - -var METADATA = uid('meta'); -var id = 0; - -var isExtensible = Object.isExtensible || function () { - return true; -}; - -var setMetadata = function (it) { - defineProperty(it, METADATA, { value: { - objectID: 'O' + ++id, // object ID - weakData: {} // weak collections IDs - } }); -}; - -var fastKey = function (it, create) { - // return a primitive with prefix - if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!has(it, METADATA)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return 'F'; - // not necessary to add metadata - if (!create) return 'E'; - // add missing metadata - setMetadata(it); - // return object ID - } return it[METADATA].objectID; -}; - -var getWeakData = function (it, create) { - if (!has(it, METADATA)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return true; - // not necessary to add metadata - if (!create) return false; - // add missing metadata - setMetadata(it); - // return the store of weak collections IDs - } return it[METADATA].weakData; -}; - -// add metadata on freeze-family methods calling -var onFreeze = function (it) { - if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it); - return it; -}; - -var meta = module.exports = { - REQUIRED: false, - fastKey: fastKey, - getWeakData: getWeakData, - onFreeze: onFreeze -}; - -hiddenKeys[METADATA] = true; - -},{"../internals/freezing":167,"../internals/has":174,"../internals/hidden-keys":175,"../internals/is-object":188,"../internals/object-define-property":209,"../internals/uid":259}],183:[function(require,module,exports){ -var NATIVE_WEAK_MAP = require('../internals/native-weak-map'); -var global = require('../internals/global'); -var isObject = require('../internals/is-object'); -var hide = require('../internals/hide'); -var objectHas = require('../internals/has'); -var sharedKey = require('../internals/shared-key'); -var hiddenKeys = require('../internals/hidden-keys'); - -var WeakMap = global.WeakMap; -var set, get, has; - -var enforce = function (it) { - return has(it) ? get(it) : set(it, {}); -}; - -var getterFor = function (TYPE) { - return function (it) { - var state; - if (!isObject(it) || (state = get(it)).type !== TYPE) { - throw TypeError('Incompatible receiver, ' + TYPE + ' required'); - } return state; - }; -}; - -if (NATIVE_WEAK_MAP) { - var store = new WeakMap(); - var wmget = store.get; - var wmhas = store.has; - var wmset = store.set; - set = function (it, metadata) { - wmset.call(store, it, metadata); - return metadata; - }; - get = function (it) { - return wmget.call(store, it) || {}; - }; - has = function (it) { - return wmhas.call(store, it); - }; -} else { - var STATE = sharedKey('state'); - hiddenKeys[STATE] = true; - set = function (it, metadata) { - hide(it, STATE, metadata); - return metadata; - }; - get = function (it) { - return objectHas(it, STATE) ? it[STATE] : {}; - }; - has = function (it) { - return objectHas(it, STATE); - }; -} - -module.exports = { - set: set, - get: get, - has: has, - enforce: enforce, - getterFor: getterFor -}; - -},{"../internals/global":173,"../internals/has":174,"../internals/hidden-keys":175,"../internals/hide":176,"../internals/is-object":188,"../internals/native-weak-map":202,"../internals/shared-key":238}],184:[function(require,module,exports){ -var wellKnownSymbol = require('../internals/well-known-symbol'); -var Iterators = require('../internals/iterators'); - -var ITERATOR = wellKnownSymbol('iterator'); -var ArrayPrototype = Array.prototype; - -// check on default Array iterator -module.exports = function (it) { - return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); -}; - -},{"../internals/iterators":193,"../internals/well-known-symbol":262}],185:[function(require,module,exports){ -var classof = require('../internals/classof-raw'); - -// `IsArray` abstract operation -// https://tc39.github.io/ecma262/#sec-isarray -module.exports = Array.isArray || function isArray(arg) { - return classof(arg) == 'Array'; -}; - -},{"../internals/classof-raw":140}],186:[function(require,module,exports){ -var fails = require('../internals/fails'); - -var replacement = /#|\.prototype\./; - -var isForced = function (feature, detection) { - var value = data[normalize(feature)]; - return value == POLYFILL ? true - : value == NATIVE ? false - : typeof detection == 'function' ? fails(detection) - : !!detection; -}; - -var normalize = isForced.normalize = function (string) { - return String(string).replace(replacement, '.').toLowerCase(); -}; - -var data = isForced.data = {}; -var NATIVE = isForced.NATIVE = 'N'; -var POLYFILL = isForced.POLYFILL = 'P'; - -module.exports = isForced; - -},{"../internals/fails":161}],187:[function(require,module,exports){ -var isObject = require('../internals/is-object'); - -var floor = Math.floor; - -// `Number.isInteger` method implementation -// https://tc39.github.io/ecma262/#sec-number.isinteger -module.exports = function isInteger(it) { - return !isObject(it) && isFinite(it) && floor(it) === it; -}; - -},{"../internals/is-object":188}],188:[function(require,module,exports){ -arguments[4][37][0].apply(exports,arguments) -},{"dup":37}],189:[function(require,module,exports){ -module.exports = false; - -},{}],190:[function(require,module,exports){ -var isObject = require('../internals/is-object'); -var classof = require('../internals/classof-raw'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var MATCH = wellKnownSymbol('match'); - -// `IsRegExp` abstract operation -// https://tc39.github.io/ecma262/#sec-isregexp -module.exports = function (it) { - var isRegExp; - return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp'); -}; - -},{"../internals/classof-raw":140,"../internals/is-object":188,"../internals/well-known-symbol":262}],191:[function(require,module,exports){ -var anObject = require('../internals/an-object'); -var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); -var toLength = require('../internals/to-length'); -var bind = require('../internals/bind-context'); -var getIteratorMethod = require('../internals/get-iterator-method'); -var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); - -var Result = function (stopped, result) { - this.stopped = stopped; - this.result = result; -}; - -var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) { - var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1); - var iterator, iterFn, index, length, result, step; - - if (IS_ITERATOR) { - iterator = iterable; - } else { - iterFn = getIteratorMethod(iterable); - if (typeof iterFn != 'function') throw TypeError('Target is not iterable'); - // optimisation for array iterators - if (isArrayIteratorMethod(iterFn)) { - for (index = 0, length = toLength(iterable.length); length > index; index++) { - result = AS_ENTRIES - ? boundFunction(anObject(step = iterable[index])[0], step[1]) - : boundFunction(iterable[index]); - if (result && result instanceof Result) return result; - } return new Result(false); - } - iterator = iterFn.call(iterable); - } - - while (!(step = iterator.next()).done) { - result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES); - if (result && result instanceof Result) return result; - } return new Result(false); -}; - -iterate.stop = function (result) { - return new Result(true, result); -}; - -},{"../internals/an-object":124,"../internals/bind-context":137,"../internals/call-with-safe-iteration-closing":138,"../internals/get-iterator-method":171,"../internals/is-array-iterator-method":184,"../internals/to-length":252}],192:[function(require,module,exports){ -'use strict'; -var getPrototypeOf = require('../internals/object-get-prototype-of'); -var hide = require('../internals/hide'); -var has = require('../internals/has'); -var wellKnownSymbol = require('../internals/well-known-symbol'); -var IS_PURE = require('../internals/is-pure'); - -var ITERATOR = wellKnownSymbol('iterator'); -var BUGGY_SAFARI_ITERATORS = false; - -var returnThis = function () { return this; }; - -// `%IteratorPrototype%` object -// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object -var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; - -if ([].keys) { - arrayIterator = [].keys(); - // Safari 8 has buggy iterators w/o `next` - if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; - else { - PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); - if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; - } -} - -if (IteratorPrototype == undefined) IteratorPrototype = {}; - -// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() -if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); - -module.exports = { - IteratorPrototype: IteratorPrototype, - BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS -}; - -},{"../internals/has":174,"../internals/hide":176,"../internals/is-pure":189,"../internals/object-get-prototype-of":214,"../internals/well-known-symbol":262}],193:[function(require,module,exports){ -arguments[4][41][0].apply(exports,arguments) -},{"dup":41}],194:[function(require,module,exports){ -var nativeExpm1 = Math.expm1; -var exp = Math.exp; - -// `Math.expm1` method implementation -// https://tc39.github.io/ecma262/#sec-math.expm1 -module.exports = (!nativeExpm1 - // Old FF bug - || nativeExpm1(10) > 22025.465794806719 || nativeExpm1(10) < 22025.4657948067165168 - // Tor Browser bug - || nativeExpm1(-2e-17) != -2e-17 -) ? function expm1(x) { - return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1; -} : nativeExpm1; - -},{}],195:[function(require,module,exports){ -var sign = require('../internals/math-sign'); - -var abs = Math.abs; -var pow = Math.pow; -var EPSILON = pow(2, -52); -var EPSILON32 = pow(2, -23); -var MAX32 = pow(2, 127) * (2 - EPSILON32); -var MIN32 = pow(2, -126); - -var roundTiesToEven = function (n) { - return n + 1 / EPSILON - 1 / EPSILON; -}; - -// `Math.fround` method implementation -// https://tc39.github.io/ecma262/#sec-math.fround -module.exports = Math.fround || function fround(x) { - var $abs = abs(x); - var $sign = sign(x); - var a, result; - if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; - a = (1 + EPSILON32 / EPSILON) * $abs; - result = a - (a - $abs); - // eslint-disable-next-line no-self-compare - if (result > MAX32 || result != result) return $sign * Infinity; - return $sign * result; -}; - -},{"../internals/math-sign":197}],196:[function(require,module,exports){ -var log = Math.log; - -// `Math.log1p` method implementation -// https://tc39.github.io/ecma262/#sec-math.log1p -module.exports = Math.log1p || function log1p(x) { - return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x); -}; - -},{}],197:[function(require,module,exports){ -// `Math.sign` method implementation -// https://tc39.github.io/ecma262/#sec-math.sign -module.exports = Math.sign || function sign(x) { - // eslint-disable-next-line no-self-compare - return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; -}; - -},{}],198:[function(require,module,exports){ -var global = require('../internals/global'); -var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; -var classof = require('../internals/classof-raw'); -var macrotask = require('../internals/task').set; -var userAgent = require('../internals/user-agent'); - -var MutationObserver = global.MutationObserver || global.WebKitMutationObserver; -var process = global.process; -var Promise = global.Promise; -var IS_NODE = classof(process) == 'process'; -// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` -var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask'); -var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; - -var flush, head, last, notify, toggle, node, promise, then; - -// modern engines have queueMicrotask method -if (!queueMicrotask) { - flush = function () { - var parent, fn; - if (IS_NODE && (parent = process.domain)) parent.exit(); - while (head) { - fn = head.fn; - head = head.next; - try { - fn(); - } catch (error) { - if (head) notify(); - else last = undefined; - throw error; - } - } last = undefined; - if (parent) parent.enter(); - }; - - // Node.js - if (IS_NODE) { - notify = function () { - process.nextTick(flush); - }; - // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339 - } else if (MutationObserver && !/(iphone|ipod|ipad).*applewebkit/i.test(userAgent)) { - toggle = true; - node = document.createTextNode(''); - new MutationObserver(flush).observe(node, { characterData: true }); // eslint-disable-line no-new - notify = function () { - node.data = toggle = !toggle; - }; - // environments with maybe non-completely correct, but existent Promise - } else if (Promise && Promise.resolve) { - // Promise.resolve without an argument throws an error in LG WebOS 2 - promise = Promise.resolve(undefined); - then = promise.then; - notify = function () { - then.call(promise, flush); - }; - // for other environments - macrotask based on: - // - setImmediate - // - MessageChannel - // - window.postMessag - // - onreadystatechange - // - setTimeout - } else { - notify = function () { - // strange IE + webpack dev server bug - use .call(global) - macrotask.call(global, flush); - }; - } -} - -module.exports = queueMicrotask || function (fn) { - var task = { fn: fn, next: undefined }; - if (last) last.next = task; - if (!head) { - head = task; - notify(); - } last = task; -}; - -},{"../internals/classof-raw":140,"../internals/global":173,"../internals/object-get-own-property-descriptor":210,"../internals/task":246,"../internals/user-agent":260}],199:[function(require,module,exports){ -var global = require('../internals/global'); - -module.exports = global.Promise; - -},{"../internals/global":173}],200:[function(require,module,exports){ -var fails = require('../internals/fails'); - -module.exports = !!Object.getOwnPropertySymbols && !fails(function () { - // Chrome 38 Symbol has incorrect toString conversion - // eslint-disable-next-line no-undef - return !String(Symbol()); -}); - -},{"../internals/fails":161}],201:[function(require,module,exports){ -var fails = require('../internals/fails'); -var wellKnownSymbol = require('../internals/well-known-symbol'); -var IS_PURE = require('../internals/is-pure'); - -var ITERATOR = wellKnownSymbol('iterator'); - -module.exports = !fails(function () { - var url = new URL('b?e=1', 'http://a'); - var searchParams = url.searchParams; - url.pathname = 'c%20d'; - return (IS_PURE && !url.toJSON) - || !searchParams.sort - || url.href !== 'http://a/c%20d?e=1' - || searchParams.get('e') !== '1' - || String(new URLSearchParams('?a=1')) !== 'a=1' - || !searchParams[ITERATOR] - // throws in Edge - || new URL('https://a@b').username !== 'a' - || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' - // not punycoded in Edge - || new URL('http://тест').host !== 'xn--e1aybc' - // not escaped in Chrome 62- - || new URL('http://a#б').hash !== '#%D0%B1'; -}); - -},{"../internals/fails":161,"../internals/is-pure":189,"../internals/well-known-symbol":262}],202:[function(require,module,exports){ -var global = require('../internals/global'); -var nativeFunctionToString = require('../internals/function-to-string'); - -var WeakMap = global.WeakMap; - -module.exports = typeof WeakMap === 'function' && /native code/.test(nativeFunctionToString.call(WeakMap)); - -},{"../internals/function-to-string":169,"../internals/global":173}],203:[function(require,module,exports){ -'use strict'; -var aFunction = require('../internals/a-function'); - -var PromiseCapability = function (C) { - var resolve, reject; - this.promise = new C(function ($$resolve, $$reject) { - if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); - resolve = $$resolve; - reject = $$reject; - }); - this.resolve = aFunction(resolve); - this.reject = aFunction(reject); -}; - -// 25.4.1.5 NewPromiseCapability(C) -module.exports.f = function (C) { - return new PromiseCapability(C); -}; - -},{"../internals/a-function":119}],204:[function(require,module,exports){ -var isRegExp = require('../internals/is-regexp'); - -module.exports = function (it) { - if (isRegExp(it)) { - throw TypeError("The method doesn't accept regular expressions"); - } return it; -}; - -},{"../internals/is-regexp":190}],205:[function(require,module,exports){ -var global = require('../internals/global'); - -var globalIsFinite = global.isFinite; - -// `Number.isFinite` method -// https://tc39.github.io/ecma262/#sec-number.isfinite -module.exports = Number.isFinite || function isFinite(it) { - return typeof it == 'number' && globalIsFinite(it); -}; - -},{"../internals/global":173}],206:[function(require,module,exports){ -'use strict'; -var DESCRIPTORS = require('../internals/descriptors'); -var fails = require('../internals/fails'); -var objectKeys = require('../internals/object-keys'); -var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols'); -var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); -var toObject = require('../internals/to-object'); -var IndexedObject = require('../internals/indexed-object'); - -var nativeAssign = Object.assign; - -// `Object.assign` method -// https://tc39.github.io/ecma262/#sec-object.assign -// should work with symbols and should have deterministic property order (V8 bug) -module.exports = !nativeAssign || fails(function () { - var A = {}; - var B = {}; - // eslint-disable-next-line no-undef - var symbol = Symbol(); - var alphabet = 'abcdefghijklmnopqrst'; - A[symbol] = 7; - alphabet.split('').forEach(function (chr) { B[chr] = chr; }); - return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; -}) ? function assign(target, source) { // eslint-disable-line no-unused-vars - var T = toObject(target); - var argumentsLength = arguments.length; - var index = 1; - var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; - var propertyIsEnumerable = propertyIsEnumerableModule.f; - while (argumentsLength > index) { - var S = IndexedObject(arguments[index++]); - var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); - var length = keys.length; - var j = 0; - var key; - while (length > j) { - key = keys[j++]; - if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key]; - } - } return T; -} : nativeAssign; - -},{"../internals/descriptors":156,"../internals/fails":161,"../internals/indexed-object":180,"../internals/object-get-own-property-symbols":213,"../internals/object-keys":216,"../internals/object-property-is-enumerable":217,"../internals/to-object":253}],207:[function(require,module,exports){ -var anObject = require('../internals/an-object'); -var defineProperties = require('../internals/object-define-properties'); -var enumBugKeys = require('../internals/enum-bug-keys'); -var hiddenKeys = require('../internals/hidden-keys'); -var html = require('../internals/html'); -var documentCreateElement = require('../internals/document-create-element'); -var sharedKey = require('../internals/shared-key'); -var IE_PROTO = sharedKey('IE_PROTO'); - -var PROTOTYPE = 'prototype'; -var Empty = function () { /* empty */ }; - -// Create object with fake `null` prototype: use iframe Object with cleared prototype -var createDict = function () { - // Thrash, waste and sodomy: IE GC bug - var iframe = documentCreateElement('iframe'); - var length = enumBugKeys.length; - var lt = '<'; - var script = 'script'; - var gt = '>'; - var js = 'java' + script + ':'; - var iframeDocument; - iframe.style.display = 'none'; - html.appendChild(iframe); - iframe.src = String(js); - iframeDocument = iframe.contentWindow.document; - iframeDocument.open(); - iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt); - iframeDocument.close(); - createDict = iframeDocument.F; - while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]]; - return createDict(); -}; - -// `Object.create` method -// https://tc39.github.io/ecma262/#sec-object.create -module.exports = Object.create || function create(O, Properties) { - var result; - if (O !== null) { - Empty[PROTOTYPE] = anObject(O); - result = new Empty(); - Empty[PROTOTYPE] = null; - // add "__proto__" for Object.getPrototypeOf polyfill - result[IE_PROTO] = O; - } else result = createDict(); - return Properties === undefined ? result : defineProperties(result, Properties); -}; - -hiddenKeys[IE_PROTO] = true; - -},{"../internals/an-object":124,"../internals/document-create-element":157,"../internals/enum-bug-keys":159,"../internals/hidden-keys":175,"../internals/html":178,"../internals/object-define-properties":208,"../internals/shared-key":238}],208:[function(require,module,exports){ -var DESCRIPTORS = require('../internals/descriptors'); -var definePropertyModule = require('../internals/object-define-property'); -var anObject = require('../internals/an-object'); -var objectKeys = require('../internals/object-keys'); - -// `Object.defineProperties` method -// https://tc39.github.io/ecma262/#sec-object.defineproperties -module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) { - anObject(O); - var keys = objectKeys(Properties); - var length = keys.length; - var index = 0; - var key; - while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]); - return O; -}; - -},{"../internals/an-object":124,"../internals/descriptors":156,"../internals/object-define-property":209,"../internals/object-keys":216}],209:[function(require,module,exports){ -var DESCRIPTORS = require('../internals/descriptors'); -var IE8_DOM_DEFINE = require('../internals/ie8-dom-define'); -var anObject = require('../internals/an-object'); -var toPrimitive = require('../internals/to-primitive'); - -var nativeDefineProperty = Object.defineProperty; - -// `Object.defineProperty` method -// https://tc39.github.io/ecma262/#sec-object.defineproperty -exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) { - anObject(O); - P = toPrimitive(P, true); - anObject(Attributes); - if (IE8_DOM_DEFINE) try { - return nativeDefineProperty(O, P, Attributes); - } catch (error) { /* empty */ } - if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); - if ('value' in Attributes) O[P] = Attributes.value; - return O; -}; - -},{"../internals/an-object":124,"../internals/descriptors":156,"../internals/ie8-dom-define":179,"../internals/to-primitive":255}],210:[function(require,module,exports){ -var DESCRIPTORS = require('../internals/descriptors'); -var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); -var createPropertyDescriptor = require('../internals/create-property-descriptor'); -var toIndexedObject = require('../internals/to-indexed-object'); -var toPrimitive = require('../internals/to-primitive'); -var has = require('../internals/has'); -var IE8_DOM_DEFINE = require('../internals/ie8-dom-define'); - -var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; - -// `Object.getOwnPropertyDescriptor` method -// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor -exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { - O = toIndexedObject(O); - P = toPrimitive(P, true); - if (IE8_DOM_DEFINE) try { - return nativeGetOwnPropertyDescriptor(O, P); - } catch (error) { /* empty */ } - if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); -}; - -},{"../internals/create-property-descriptor":150,"../internals/descriptors":156,"../internals/has":174,"../internals/ie8-dom-define":179,"../internals/object-property-is-enumerable":217,"../internals/to-indexed-object":250,"../internals/to-primitive":255}],211:[function(require,module,exports){ -var toIndexedObject = require('../internals/to-indexed-object'); -var nativeGetOwnPropertyNames = require('../internals/object-get-own-property-names').f; - -var toString = {}.toString; - -var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames - ? Object.getOwnPropertyNames(window) : []; - -var getWindowNames = function (it) { - try { - return nativeGetOwnPropertyNames(it); - } catch (error) { - return windowNames.slice(); - } -}; - -// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window -module.exports.f = function getOwnPropertyNames(it) { - return windowNames && toString.call(it) == '[object Window]' - ? getWindowNames(it) - : nativeGetOwnPropertyNames(toIndexedObject(it)); -}; - -},{"../internals/object-get-own-property-names":212,"../internals/to-indexed-object":250}],212:[function(require,module,exports){ -var internalObjectKeys = require('../internals/object-keys-internal'); -var enumBugKeys = require('../internals/enum-bug-keys'); - -var hiddenKeys = enumBugKeys.concat('length', 'prototype'); - -// `Object.getOwnPropertyNames` method -// https://tc39.github.io/ecma262/#sec-object.getownpropertynames -exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { - return internalObjectKeys(O, hiddenKeys); -}; - -},{"../internals/enum-bug-keys":159,"../internals/object-keys-internal":215}],213:[function(require,module,exports){ -exports.f = Object.getOwnPropertySymbols; - -},{}],214:[function(require,module,exports){ -var has = require('../internals/has'); -var toObject = require('../internals/to-object'); -var sharedKey = require('../internals/shared-key'); -var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter'); - -var IE_PROTO = sharedKey('IE_PROTO'); -var ObjectPrototype = Object.prototype; - -// `Object.getPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-object.getprototypeof -module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) { - O = toObject(O); - if (has(O, IE_PROTO)) return O[IE_PROTO]; - if (typeof O.constructor == 'function' && O instanceof O.constructor) { - return O.constructor.prototype; - } return O instanceof Object ? ObjectPrototype : null; -}; - -},{"../internals/correct-prototype-getter":147,"../internals/has":174,"../internals/shared-key":238,"../internals/to-object":253}],215:[function(require,module,exports){ -var has = require('../internals/has'); -var toIndexedObject = require('../internals/to-indexed-object'); -var indexOf = require('../internals/array-includes').indexOf; -var hiddenKeys = require('../internals/hidden-keys'); - -module.exports = function (object, names) { - var O = toIndexedObject(object); - var i = 0; - var result = []; - var key; - for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); - // Don't enum bug & hidden keys - while (names.length > i) if (has(O, key = names[i++])) { - ~indexOf(result, key) || result.push(key); - } - return result; -}; - -},{"../internals/array-includes":131,"../internals/has":174,"../internals/hidden-keys":175,"../internals/to-indexed-object":250}],216:[function(require,module,exports){ -var internalObjectKeys = require('../internals/object-keys-internal'); -var enumBugKeys = require('../internals/enum-bug-keys'); - -// `Object.keys` method -// https://tc39.github.io/ecma262/#sec-object.keys -module.exports = Object.keys || function keys(O) { - return internalObjectKeys(O, enumBugKeys); -}; - -},{"../internals/enum-bug-keys":159,"../internals/object-keys-internal":215}],217:[function(require,module,exports){ -'use strict'; -var nativePropertyIsEnumerable = {}.propertyIsEnumerable; -var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; - -// Nashorn ~ JDK8 bug -var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); - -// `Object.prototype.propertyIsEnumerable` method implementation -// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable -exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { - var descriptor = getOwnPropertyDescriptor(this, V); - return !!descriptor && descriptor.enumerable; -} : nativePropertyIsEnumerable; - -},{}],218:[function(require,module,exports){ -var anObject = require('../internals/an-object'); -var aPossiblePrototype = require('../internals/a-possible-prototype'); - -// `Object.setPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-object.setprototypeof -// Works with __proto__ only. Old v8 can't work with null proto objects. -/* eslint-disable no-proto */ -module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { - var CORRECT_SETTER = false; - var test = {}; - var setter; - try { - setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; - setter.call(test, []); - CORRECT_SETTER = test instanceof Array; - } catch (error) { /* empty */ } - return function setPrototypeOf(O, proto) { - anObject(O); - aPossiblePrototype(proto); - if (CORRECT_SETTER) setter.call(O, proto); - else O.__proto__ = proto; - return O; - }; -}() : undefined); - -},{"../internals/a-possible-prototype":120,"../internals/an-object":124}],219:[function(require,module,exports){ -var DESCRIPTORS = require('../internals/descriptors'); -var objectKeys = require('../internals/object-keys'); -var toIndexedObject = require('../internals/to-indexed-object'); -var propertyIsEnumerable = require('../internals/object-property-is-enumerable').f; - -// `Object.{ entries, values }` methods implementation -var createMethod = function (TO_ENTRIES) { - return function (it) { - var O = toIndexedObject(it); - var keys = objectKeys(O); - var length = keys.length; - var i = 0; - var result = []; - var key; - while (length > i) { - key = keys[i++]; - if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) { - result.push(TO_ENTRIES ? [key, O[key]] : O[key]); - } - } - return result; - }; -}; - -module.exports = { - // `Object.entries` method - // https://tc39.github.io/ecma262/#sec-object.entries - entries: createMethod(true), - // `Object.values` method - // https://tc39.github.io/ecma262/#sec-object.values - values: createMethod(false) -}; - -},{"../internals/descriptors":156,"../internals/object-keys":216,"../internals/object-property-is-enumerable":217,"../internals/to-indexed-object":250}],220:[function(require,module,exports){ -'use strict'; -var classof = require('../internals/classof'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var TO_STRING_TAG = wellKnownSymbol('toStringTag'); -var test = {}; - -test[TO_STRING_TAG] = 'z'; - -// `Object.prototype.toString` method implementation -// https://tc39.github.io/ecma262/#sec-object.prototype.tostring -module.exports = String(test) !== '[object z]' ? function toString() { - return '[object ' + classof(this) + ']'; -} : test.toString; - -},{"../internals/classof":141,"../internals/well-known-symbol":262}],221:[function(require,module,exports){ -var getBuiltIn = require('../internals/get-built-in'); -var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names'); -var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols'); -var anObject = require('../internals/an-object'); - -// all object keys, includes non-enumerable and symbols -module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { - var keys = getOwnPropertyNamesModule.f(anObject(it)); - var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; - return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; -}; - -},{"../internals/an-object":124,"../internals/get-built-in":170,"../internals/object-get-own-property-names":212,"../internals/object-get-own-property-symbols":213}],222:[function(require,module,exports){ -var global = require('../internals/global'); -var trim = require('../internals/string-trim').trim; -var whitespaces = require('../internals/whitespaces'); - -var nativeParseFloat = global.parseFloat; -var FORCED = 1 / nativeParseFloat(whitespaces + '-0') !== -Infinity; - -// `parseFloat` method -// https://tc39.github.io/ecma262/#sec-parsefloat-string -module.exports = FORCED ? function parseFloat(string) { - var trimmedString = trim(String(string)); - var result = nativeParseFloat(trimmedString); - return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result; -} : nativeParseFloat; - -},{"../internals/global":173,"../internals/string-trim":245,"../internals/whitespaces":263}],223:[function(require,module,exports){ -var global = require('../internals/global'); -var trim = require('../internals/string-trim').trim; -var whitespaces = require('../internals/whitespaces'); - -var nativeParseInt = global.parseInt; -var hex = /^[+-]?0[Xx]/; -var FORCED = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22; - -// `parseInt` method -// https://tc39.github.io/ecma262/#sec-parseint-string-radix -module.exports = FORCED ? function parseInt(string, radix) { - var S = trim(String(string)); - return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10)); -} : nativeParseInt; - -},{"../internals/global":173,"../internals/string-trim":245,"../internals/whitespaces":263}],224:[function(require,module,exports){ -module.exports = require('../internals/global'); - -},{"../internals/global":173}],225:[function(require,module,exports){ -module.exports = function (exec) { - try { - return { error: false, value: exec() }; - } catch (error) { - return { error: true, value: error }; - } -}; - -},{}],226:[function(require,module,exports){ -var anObject = require('../internals/an-object'); -var isObject = require('../internals/is-object'); -var newPromiseCapability = require('../internals/new-promise-capability'); - -module.exports = function (C, x) { - anObject(C); - if (isObject(x) && x.constructor === C) return x; - var promiseCapability = newPromiseCapability.f(C); - var resolve = promiseCapability.resolve; - resolve(x); - return promiseCapability.promise; -}; - -},{"../internals/an-object":124,"../internals/is-object":188,"../internals/new-promise-capability":203}],227:[function(require,module,exports){ -'use strict'; -// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js -var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 -var base = 36; -var tMin = 1; -var tMax = 26; -var skew = 38; -var damp = 700; -var initialBias = 72; -var initialN = 128; // 0x80 -var delimiter = '-'; // '\x2D' -var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars -var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators -var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process'; -var baseMinusTMin = base - tMin; -var floor = Math.floor; -var stringFromCharCode = String.fromCharCode; - -/** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - */ -var ucs2decode = function (string) { - var output = []; - var counter = 0; - var length = string.length; - while (counter < length) { - var value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // It's a high surrogate, and there is a next character. - var extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // Low surrogate. - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // It's an unmatched surrogate; only append this code unit, in case the - // next code unit is the high surrogate of a surrogate pair. - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; -}; - -/** - * Converts a digit/integer into a basic code point. - */ -var digitToBasic = function (digit) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26); -}; - -/** - * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 - */ -var adapt = function (delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); -}; - -/** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - */ -// eslint-disable-next-line max-statements -var encode = function (input) { - var output = []; - - // Convert the input in UCS-2 to an array of Unicode code points. - input = ucs2decode(input); - - // Cache the length. - var inputLength = input.length; - - // Initialize the state. - var n = initialN; - var delta = 0; - var bias = initialBias; - var i, currentValue; - - // Handle the basic code points. - for (i = 0; i < input.length; i++) { - currentValue = input[i]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - var basicLength = output.length; // number of basic code points. - var handledCPCount = basicLength; // number of code points that have been handled; - - // Finish the basic string with a delimiter unless it's empty. - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - // All non-basic code points < n have been handled already. Find the next larger one: - var m = maxInt; - for (i = 0; i < input.length; i++) { - currentValue = input[i]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , but guard against overflow. - var handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - throw RangeError(OVERFLOW_ERROR); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (i = 0; i < input.length; i++) { - currentValue = input[i]; - if (currentValue < n && ++delta > maxInt) { - throw RangeError(OVERFLOW_ERROR); - } - if (currentValue == n) { - // Represent delta as a generalized variable-length integer. - var q = delta; - for (var k = base; /* no condition */; k += base) { - var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) break; - var qMinusT = q - t; - var baseMinusT = base - t; - output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT))); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - } - return output.join(''); -}; - -module.exports = function (input) { - var encoded = []; - var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.'); - var i, label; - for (i = 0; i < labels.length; i++) { - label = labels[i]; - encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label); - } - return encoded.join('.'); -}; - -},{}],228:[function(require,module,exports){ -var redefine = require('../internals/redefine'); - -module.exports = function (target, src, options) { - for (var key in src) redefine(target, key, src[key], options); - return target; -}; - -},{"../internals/redefine":229}],229:[function(require,module,exports){ -var global = require('../internals/global'); -var shared = require('../internals/shared'); -var hide = require('../internals/hide'); -var has = require('../internals/has'); -var setGlobal = require('../internals/set-global'); -var nativeFunctionToString = require('../internals/function-to-string'); -var InternalStateModule = require('../internals/internal-state'); - -var getInternalState = InternalStateModule.get; -var enforceInternalState = InternalStateModule.enforce; -var TEMPLATE = String(nativeFunctionToString).split('toString'); - -shared('inspectSource', function (it) { - return nativeFunctionToString.call(it); -}); - -(module.exports = function (O, key, value, options) { - var unsafe = options ? !!options.unsafe : false; - var simple = options ? !!options.enumerable : false; - var noTargetGet = options ? !!options.noTargetGet : false; - if (typeof value == 'function') { - if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key); - enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : ''); - } - if (O === global) { - if (simple) O[key] = value; - else setGlobal(key, value); - return; - } else if (!unsafe) { - delete O[key]; - } else if (!noTargetGet && O[key]) { - simple = true; - } - if (simple) O[key] = value; - else hide(O, key, value); -// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative -})(Function.prototype, 'toString', function toString() { - return typeof this == 'function' && getInternalState(this).source || nativeFunctionToString.call(this); -}); - -},{"../internals/function-to-string":169,"../internals/global":173,"../internals/has":174,"../internals/hide":176,"../internals/internal-state":183,"../internals/set-global":235,"../internals/shared":239}],230:[function(require,module,exports){ -var classof = require('./classof-raw'); -var regexpExec = require('./regexp-exec'); - -// `RegExpExec` abstract operation -// https://tc39.github.io/ecma262/#sec-regexpexec -module.exports = function (R, S) { - var exec = R.exec; - if (typeof exec === 'function') { - var result = exec.call(R, S); - if (typeof result !== 'object') { - throw TypeError('RegExp exec method returned something other than an Object or null'); - } - return result; - } - - if (classof(R) !== 'RegExp') { - throw TypeError('RegExp#exec called on incompatible receiver'); - } - - return regexpExec.call(R, S); -}; - - -},{"./classof-raw":140,"./regexp-exec":231}],231:[function(require,module,exports){ -'use strict'; -var regexpFlags = require('./regexp-flags'); - -var nativeExec = RegExp.prototype.exec; -// This always refers to the native implementation, because the -// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, -// which loads this file before patching the method. -var nativeReplace = String.prototype.replace; - -var patchedExec = nativeExec; - -var UPDATES_LAST_INDEX_WRONG = (function () { - var re1 = /a/; - var re2 = /b*/g; - nativeExec.call(re1, 'a'); - nativeExec.call(re2, 'a'); - return re1.lastIndex !== 0 || re2.lastIndex !== 0; -})(); - -// nonparticipating capturing group, copied from es5-shim's String#split patch. -var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; - -var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED; - -if (PATCH) { - patchedExec = function exec(str) { - var re = this; - var lastIndex, reCopy, match, i; - - if (NPCG_INCLUDED) { - reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re)); - } - if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; - - match = nativeExec.call(re, str); - - if (UPDATES_LAST_INDEX_WRONG && match) { - re.lastIndex = re.global ? match.index + match[0].length : lastIndex; - } - if (NPCG_INCLUDED && match && match.length > 1) { - // Fix browsers whose `exec` methods don't consistently return `undefined` - // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ - nativeReplace.call(match[0], reCopy, function () { - for (i = 1; i < arguments.length - 2; i++) { - if (arguments[i] === undefined) match[i] = undefined; - } - }); - } - - return match; - }; -} - -module.exports = patchedExec; - -},{"./regexp-flags":232}],232:[function(require,module,exports){ -'use strict'; -var anObject = require('../internals/an-object'); - -// `RegExp.prototype.flags` getter implementation -// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags -module.exports = function () { - var that = anObject(this); - var result = ''; - if (that.global) result += 'g'; - if (that.ignoreCase) result += 'i'; - if (that.multiline) result += 'm'; - if (that.dotAll) result += 's'; - if (that.unicode) result += 'u'; - if (that.sticky) result += 'y'; - return result; -}; - -},{"../internals/an-object":124}],233:[function(require,module,exports){ -// `RequireObjectCoercible` abstract operation -// https://tc39.github.io/ecma262/#sec-requireobjectcoercible -module.exports = function (it) { - if (it == undefined) throw TypeError("Can't call method on " + it); - return it; -}; - -},{}],234:[function(require,module,exports){ -// `SameValue` abstract operation -// https://tc39.github.io/ecma262/#sec-samevalue -module.exports = Object.is || function is(x, y) { - // eslint-disable-next-line no-self-compare - return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; -}; - -},{}],235:[function(require,module,exports){ -var global = require('../internals/global'); -var hide = require('../internals/hide'); - -module.exports = function (key, value) { - try { - hide(global, key, value); - } catch (error) { - global[key] = value; - } return value; -}; - -},{"../internals/global":173,"../internals/hide":176}],236:[function(require,module,exports){ -'use strict'; -var getBuiltIn = require('../internals/get-built-in'); -var definePropertyModule = require('../internals/object-define-property'); -var wellKnownSymbol = require('../internals/well-known-symbol'); -var DESCRIPTORS = require('../internals/descriptors'); - -var SPECIES = wellKnownSymbol('species'); - -module.exports = function (CONSTRUCTOR_NAME) { - var Constructor = getBuiltIn(CONSTRUCTOR_NAME); - var defineProperty = definePropertyModule.f; - - if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) { - defineProperty(Constructor, SPECIES, { - configurable: true, - get: function () { return this; } - }); - } -}; - -},{"../internals/descriptors":156,"../internals/get-built-in":170,"../internals/object-define-property":209,"../internals/well-known-symbol":262}],237:[function(require,module,exports){ -var defineProperty = require('../internals/object-define-property').f; -var has = require('../internals/has'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var TO_STRING_TAG = wellKnownSymbol('toStringTag'); - -module.exports = function (it, TAG, STATIC) { - if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { - defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG }); - } -}; - -},{"../internals/has":174,"../internals/object-define-property":209,"../internals/well-known-symbol":262}],238:[function(require,module,exports){ -var shared = require('../internals/shared'); -var uid = require('../internals/uid'); - -var keys = shared('keys'); - -module.exports = function (key) { - return keys[key] || (keys[key] = uid(key)); -}; - -},{"../internals/shared":239,"../internals/uid":259}],239:[function(require,module,exports){ -var global = require('../internals/global'); -var setGlobal = require('../internals/set-global'); -var IS_PURE = require('../internals/is-pure'); - -var SHARED = '__core-js_shared__'; -var store = global[SHARED] || setGlobal(SHARED, {}); - -(module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); -})('versions', []).push({ - version: '3.2.1', - mode: IS_PURE ? 'pure' : 'global', - copyright: '© 2019 Denis Pushkarev (zloirock.ru)' -}); - -},{"../internals/global":173,"../internals/is-pure":189,"../internals/set-global":235}],240:[function(require,module,exports){ -'use strict'; -var fails = require('../internals/fails'); - -module.exports = function (METHOD_NAME, argument) { - var method = [][METHOD_NAME]; - return !method || !fails(function () { - // eslint-disable-next-line no-useless-call,no-throw-literal - method.call(null, argument || function () { throw 1; }, 1); - }); -}; - -},{"../internals/fails":161}],241:[function(require,module,exports){ -var anObject = require('../internals/an-object'); -var aFunction = require('../internals/a-function'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var SPECIES = wellKnownSymbol('species'); - -// `SpeciesConstructor` abstract operation -// https://tc39.github.io/ecma262/#sec-speciesconstructor -module.exports = function (O, defaultConstructor) { - var C = anObject(O).constructor; - var S; - return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S); -}; - -},{"../internals/a-function":119,"../internals/an-object":124,"../internals/well-known-symbol":262}],242:[function(require,module,exports){ -var toInteger = require('../internals/to-integer'); -var requireObjectCoercible = require('../internals/require-object-coercible'); - -// `String.prototype.{ codePointAt, at }` methods implementation -var createMethod = function (CONVERT_TO_STRING) { - return function ($this, pos) { - var S = String(requireObjectCoercible($this)); - var position = toInteger(pos); - var size = S.length; - var first, second; - if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; - first = S.charCodeAt(position); - return first < 0xD800 || first > 0xDBFF || position + 1 === size - || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF - ? CONVERT_TO_STRING ? S.charAt(position) : first - : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; - }; -}; - -module.exports = { - // `String.prototype.codePointAt` method - // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat - codeAt: createMethod(false), - // `String.prototype.at` method - // https://github.com/mathiasbynens/String.prototype.at - charAt: createMethod(true) -}; - -},{"../internals/require-object-coercible":233,"../internals/to-integer":251}],243:[function(require,module,exports){ -// https://github.com/tc39/proposal-string-pad-start-end -var toLength = require('../internals/to-length'); -var repeat = require('../internals/string-repeat'); -var requireObjectCoercible = require('../internals/require-object-coercible'); - -var ceil = Math.ceil; - -// `String.prototype.{ padStart, padEnd }` methods implementation -var createMethod = function (IS_END) { - return function ($this, maxLength, fillString) { - var S = String(requireObjectCoercible($this)); - var stringLength = S.length; - var fillStr = fillString === undefined ? ' ' : String(fillString); - var intMaxLength = toLength(maxLength); - var fillLen, stringFiller; - if (intMaxLength <= stringLength || fillStr == '') return S; - fillLen = intMaxLength - stringLength; - stringFiller = repeat.call(fillStr, ceil(fillLen / fillStr.length)); - if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen); - return IS_END ? S + stringFiller : stringFiller + S; - }; -}; - -module.exports = { - // `String.prototype.padStart` method - // https://tc39.github.io/ecma262/#sec-string.prototype.padstart - start: createMethod(false), - // `String.prototype.padEnd` method - // https://tc39.github.io/ecma262/#sec-string.prototype.padend - end: createMethod(true) -}; - -},{"../internals/require-object-coercible":233,"../internals/string-repeat":244,"../internals/to-length":252}],244:[function(require,module,exports){ -'use strict'; -var toInteger = require('../internals/to-integer'); -var requireObjectCoercible = require('../internals/require-object-coercible'); - -// `String.prototype.repeat` method implementation -// https://tc39.github.io/ecma262/#sec-string.prototype.repeat -module.exports = ''.repeat || function repeat(count) { - var str = String(requireObjectCoercible(this)); - var result = ''; - var n = toInteger(count); - if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions'); - for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str; - return result; -}; - -},{"../internals/require-object-coercible":233,"../internals/to-integer":251}],245:[function(require,module,exports){ -var requireObjectCoercible = require('../internals/require-object-coercible'); -var whitespaces = require('../internals/whitespaces'); - -var whitespace = '[' + whitespaces + ']'; -var ltrim = RegExp('^' + whitespace + whitespace + '*'); -var rtrim = RegExp(whitespace + whitespace + '*$'); - -// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation -var createMethod = function (TYPE) { - return function ($this) { - var string = String(requireObjectCoercible($this)); - if (TYPE & 1) string = string.replace(ltrim, ''); - if (TYPE & 2) string = string.replace(rtrim, ''); - return string; - }; -}; - -module.exports = { - // `String.prototype.{ trimLeft, trimStart }` methods - // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart - start: createMethod(1), - // `String.prototype.{ trimRight, trimEnd }` methods - // https://tc39.github.io/ecma262/#sec-string.prototype.trimend - end: createMethod(2), - // `String.prototype.trim` method - // https://tc39.github.io/ecma262/#sec-string.prototype.trim - trim: createMethod(3) -}; - -},{"../internals/require-object-coercible":233,"../internals/whitespaces":263}],246:[function(require,module,exports){ -var global = require('../internals/global'); -var fails = require('../internals/fails'); -var classof = require('../internals/classof-raw'); -var bind = require('../internals/bind-context'); -var html = require('../internals/html'); -var createElement = require('../internals/document-create-element'); - -var location = global.location; -var set = global.setImmediate; -var clear = global.clearImmediate; -var process = global.process; -var MessageChannel = global.MessageChannel; -var Dispatch = global.Dispatch; -var counter = 0; -var queue = {}; -var ONREADYSTATECHANGE = 'onreadystatechange'; -var defer, channel, port; - -var run = function (id) { - // eslint-disable-next-line no-prototype-builtins - if (queue.hasOwnProperty(id)) { - var fn = queue[id]; - delete queue[id]; - fn(); - } -}; - -var runner = function (id) { - return function () { - run(id); - }; -}; - -var listener = function (event) { - run(event.data); -}; - -var post = function (id) { - // old engines have not location.origin - global.postMessage(id + '', location.protocol + '//' + location.host); -}; - -// Node.js 0.9+ & IE10+ has setImmediate, otherwise: -if (!set || !clear) { - set = function setImmediate(fn) { - var args = []; - var i = 1; - while (arguments.length > i) args.push(arguments[i++]); - queue[++counter] = function () { - // eslint-disable-next-line no-new-func - (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args); - }; - defer(counter); - return counter; - }; - clear = function clearImmediate(id) { - delete queue[id]; - }; - // Node.js 0.8- - if (classof(process) == 'process') { - defer = function (id) { - process.nextTick(runner(id)); - }; - // Sphere (JS game engine) Dispatch API - } else if (Dispatch && Dispatch.now) { - defer = function (id) { - Dispatch.now(runner(id)); - }; - // Browsers with MessageChannel, includes WebWorkers - } else if (MessageChannel) { - channel = new MessageChannel(); - port = channel.port2; - channel.port1.onmessage = listener; - defer = bind(port.postMessage, port, 1); - // Browsers with postMessage, skip WebWorkers - // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' - } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts && !fails(post)) { - defer = post; - global.addEventListener('message', listener, false); - // IE8- - } else if (ONREADYSTATECHANGE in createElement('script')) { - defer = function (id) { - html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () { - html.removeChild(this); - run(id); - }; - }; - // Rest old browsers - } else { - defer = function (id) { - setTimeout(runner(id), 0); - }; - } -} - -module.exports = { - set: set, - clear: clear -}; - -},{"../internals/bind-context":137,"../internals/classof-raw":140,"../internals/document-create-element":157,"../internals/fails":161,"../internals/global":173,"../internals/html":178}],247:[function(require,module,exports){ -var classof = require('../internals/classof-raw'); - -// `thisNumberValue` abstract operation -// https://tc39.github.io/ecma262/#sec-thisnumbervalue -module.exports = function (value) { - if (typeof value != 'number' && classof(value) != 'Number') { - throw TypeError('Incorrect invocation'); - } - return +value; -}; - -},{"../internals/classof-raw":140}],248:[function(require,module,exports){ -var toInteger = require('../internals/to-integer'); - -var max = Math.max; -var min = Math.min; - -// Helper for a popular repeating case of the spec: -// Let integer be ? ToInteger(index). -// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length). -module.exports = function (index, length) { - var integer = toInteger(index); - return integer < 0 ? max(integer + length, 0) : min(integer, length); -}; - -},{"../internals/to-integer":251}],249:[function(require,module,exports){ -var toInteger = require('../internals/to-integer'); -var toLength = require('../internals/to-length'); - -// `ToIndex` abstract operation -// https://tc39.github.io/ecma262/#sec-toindex -module.exports = function (it) { - if (it === undefined) return 0; - var number = toInteger(it); - var length = toLength(number); - if (number !== length) throw RangeError('Wrong length or index'); - return length; -}; - -},{"../internals/to-integer":251,"../internals/to-length":252}],250:[function(require,module,exports){ -// toObject with fallback for non-array-like ES3 strings -var IndexedObject = require('../internals/indexed-object'); -var requireObjectCoercible = require('../internals/require-object-coercible'); - -module.exports = function (it) { - return IndexedObject(requireObjectCoercible(it)); -}; - -},{"../internals/indexed-object":180,"../internals/require-object-coercible":233}],251:[function(require,module,exports){ -var ceil = Math.ceil; -var floor = Math.floor; - -// `ToInteger` abstract operation -// https://tc39.github.io/ecma262/#sec-tointeger -module.exports = function (argument) { - return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); -}; - -},{}],252:[function(require,module,exports){ -var toInteger = require('../internals/to-integer'); - -var min = Math.min; - -// `ToLength` abstract operation -// https://tc39.github.io/ecma262/#sec-tolength -module.exports = function (argument) { - return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 -}; - -},{"../internals/to-integer":251}],253:[function(require,module,exports){ -var requireObjectCoercible = require('../internals/require-object-coercible'); - -// `ToObject` abstract operation -// https://tc39.github.io/ecma262/#sec-toobject -module.exports = function (argument) { - return Object(requireObjectCoercible(argument)); -}; - -},{"../internals/require-object-coercible":233}],254:[function(require,module,exports){ -var toInteger = require('../internals/to-integer'); - -module.exports = function (it, BYTES) { - var offset = toInteger(it); - if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset'); - return offset; -}; - -},{"../internals/to-integer":251}],255:[function(require,module,exports){ -var isObject = require('../internals/is-object'); - -// `ToPrimitive` abstract operation -// https://tc39.github.io/ecma262/#sec-toprimitive -// instead of the ES6 spec version, we didn't implement @@toPrimitive case -// and the second argument - flag - preferred type is a string -module.exports = function (input, PREFERRED_STRING) { - if (!isObject(input)) return input; - var fn, val; - if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; - if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; - if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; - throw TypeError("Can't convert object to primitive value"); -}; - -},{"../internals/is-object":188}],256:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var global = require('../internals/global'); -var DESCRIPTORS = require('../internals/descriptors'); -var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers'); -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var ArrayBufferModule = require('../internals/array-buffer'); -var anInstance = require('../internals/an-instance'); -var createPropertyDescriptor = require('../internals/create-property-descriptor'); -var hide = require('../internals/hide'); -var toLength = require('../internals/to-length'); -var toIndex = require('../internals/to-index'); -var toOffset = require('../internals/to-offset'); -var toPrimitive = require('../internals/to-primitive'); -var has = require('../internals/has'); -var classof = require('../internals/classof'); -var isObject = require('../internals/is-object'); -var create = require('../internals/object-create'); -var setPrototypeOf = require('../internals/object-set-prototype-of'); -var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; -var typedArrayFrom = require('../internals/typed-array-from'); -var forEach = require('../internals/array-iteration').forEach; -var setSpecies = require('../internals/set-species'); -var definePropertyModule = require('../internals/object-define-property'); -var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); -var InternalStateModule = require('../internals/internal-state'); - -var getInternalState = InternalStateModule.get; -var setInternalState = InternalStateModule.set; -var nativeDefineProperty = definePropertyModule.f; -var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; -var round = Math.round; -var RangeError = global.RangeError; -var ArrayBuffer = ArrayBufferModule.ArrayBuffer; -var DataView = ArrayBufferModule.DataView; -var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; -var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG; -var TypedArray = ArrayBufferViewCore.TypedArray; -var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype; -var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; -var isTypedArray = ArrayBufferViewCore.isTypedArray; -var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; -var WRONG_LENGTH = 'Wrong length'; - -var fromList = function (C, list) { - var index = 0; - var length = list.length; - var result = new (aTypedArrayConstructor(C))(length); - while (length > index) result[index] = list[index++]; - return result; -}; - -var addGetter = function (it, key) { - nativeDefineProperty(it, key, { get: function () { - return getInternalState(this)[key]; - } }); -}; - -var isArrayBuffer = function (it) { - var klass; - return it instanceof ArrayBuffer || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer'; -}; - -var isTypedArrayIndex = function (target, key) { - return isTypedArray(target) - && typeof key != 'symbol' - && key in target - && String(+key) == String(key); -}; - -var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) { - return isTypedArrayIndex(target, key = toPrimitive(key, true)) - ? createPropertyDescriptor(2, target[key]) - : nativeGetOwnPropertyDescriptor(target, key); -}; - -var wrappedDefineProperty = function defineProperty(target, key, descriptor) { - if (isTypedArrayIndex(target, key = toPrimitive(key, true)) - && isObject(descriptor) - && has(descriptor, 'value') - && !has(descriptor, 'get') - && !has(descriptor, 'set') - // TODO: add validation descriptor w/o calling accessors - && !descriptor.configurable - && (!has(descriptor, 'writable') || descriptor.writable) - && (!has(descriptor, 'enumerable') || descriptor.enumerable) - ) { - target[key] = descriptor.value; - return target; - } return nativeDefineProperty(target, key, descriptor); -}; - -if (DESCRIPTORS) { - if (!NATIVE_ARRAY_BUFFER_VIEWS) { - getOwnPropertyDescriptorModule.f = wrappedGetOwnPropertyDescriptor; - definePropertyModule.f = wrappedDefineProperty; - addGetter(TypedArrayPrototype, 'buffer'); - addGetter(TypedArrayPrototype, 'byteOffset'); - addGetter(TypedArrayPrototype, 'byteLength'); - addGetter(TypedArrayPrototype, 'length'); - } - - $({ target: 'Object', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, { - getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor, - defineProperty: wrappedDefineProperty - }); - - // eslint-disable-next-line max-statements - module.exports = function (TYPE, BYTES, wrapper, CLAMPED) { - var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array'; - var GETTER = 'get' + TYPE; - var SETTER = 'set' + TYPE; - var NativeTypedArrayConstructor = global[CONSTRUCTOR_NAME]; - var TypedArrayConstructor = NativeTypedArrayConstructor; - var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype; - var exported = {}; - - var getter = function (that, index) { - var data = getInternalState(that); - return data.view[GETTER](index * BYTES + data.byteOffset, true); - }; - - var setter = function (that, index, value) { - var data = getInternalState(that); - if (CLAMPED) value = (value = round(value)) < 0 ? 0 : value > 0xFF ? 0xFF : value & 0xFF; - data.view[SETTER](index * BYTES + data.byteOffset, value, true); - }; - - var addElement = function (that, index) { - nativeDefineProperty(that, index, { - get: function () { - return getter(this, index); - }, - set: function (value) { - return setter(this, index, value); - }, - enumerable: true - }); - }; - - if (!NATIVE_ARRAY_BUFFER_VIEWS) { - TypedArrayConstructor = wrapper(function (that, data, offset, $length) { - anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME); - var index = 0; - var byteOffset = 0; - var buffer, byteLength, length; - if (!isObject(data)) { - length = toIndex(data); - byteLength = length * BYTES; - buffer = new ArrayBuffer(byteLength); - } else if (isArrayBuffer(data)) { - buffer = data; - byteOffset = toOffset(offset, BYTES); - var $len = data.byteLength; - if ($length === undefined) { - if ($len % BYTES) throw RangeError(WRONG_LENGTH); - byteLength = $len - byteOffset; - if (byteLength < 0) throw RangeError(WRONG_LENGTH); - } else { - byteLength = toLength($length) * BYTES; - if (byteLength + byteOffset > $len) throw RangeError(WRONG_LENGTH); - } - length = byteLength / BYTES; - } else if (isTypedArray(data)) { - return fromList(TypedArrayConstructor, data); - } else { - return typedArrayFrom.call(TypedArrayConstructor, data); - } - setInternalState(that, { - buffer: buffer, - byteOffset: byteOffset, - byteLength: byteLength, - length: length, - view: new DataView(buffer) - }); - while (index < length) addElement(that, index++); - }); - - if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray); - TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype); - } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) { - TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) { - anInstance(dummy, TypedArrayConstructor, CONSTRUCTOR_NAME); - if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data)); - if (isArrayBuffer(data)) return $length !== undefined - ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES), $length) - : typedArrayOffset !== undefined - ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES)) - : new NativeTypedArrayConstructor(data); - if (isTypedArray(data)) return fromList(TypedArrayConstructor, data); - return typedArrayFrom.call(TypedArrayConstructor, data); - }); - - if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray); - forEach(getOwnPropertyNames(NativeTypedArrayConstructor), function (key) { - if (!(key in TypedArrayConstructor)) hide(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]); - }); - TypedArrayConstructor.prototype = TypedArrayConstructorPrototype; - } - - if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) { - hide(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor); - } - - if (TYPED_ARRAY_TAG) hide(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME); - - exported[CONSTRUCTOR_NAME] = TypedArrayConstructor; - - $({ - global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS - }, exported); - - if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) { - hide(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES); - } - - if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) { - hide(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES); - } - - setSpecies(CONSTRUCTOR_NAME); - }; -} else module.exports = function () { /* empty */ }; - -},{"../internals/an-instance":123,"../internals/array-buffer":126,"../internals/array-buffer-view-core":125,"../internals/array-iteration":132,"../internals/classof":141,"../internals/create-property-descriptor":150,"../internals/descriptors":156,"../internals/export":160,"../internals/global":173,"../internals/has":174,"../internals/hide":176,"../internals/internal-state":183,"../internals/is-object":188,"../internals/object-create":207,"../internals/object-define-property":209,"../internals/object-get-own-property-descriptor":210,"../internals/object-get-own-property-names":212,"../internals/object-set-prototype-of":218,"../internals/set-species":236,"../internals/to-index":249,"../internals/to-length":252,"../internals/to-offset":254,"../internals/to-primitive":255,"../internals/typed-array-from":257,"../internals/typed-arrays-constructors-requires-wrappers":258}],257:[function(require,module,exports){ -var toObject = require('../internals/to-object'); -var toLength = require('../internals/to-length'); -var getIteratorMethod = require('../internals/get-iterator-method'); -var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); -var bind = require('../internals/bind-context'); -var aTypedArrayConstructor = require('../internals/array-buffer-view-core').aTypedArrayConstructor; - -module.exports = function from(source /* , mapfn, thisArg */) { - var O = toObject(source); - var argumentsLength = arguments.length; - var mapfn = argumentsLength > 1 ? arguments[1] : undefined; - var mapping = mapfn !== undefined; - var iteratorMethod = getIteratorMethod(O); - var i, length, result, step, iterator; - if (iteratorMethod != undefined && !isArrayIteratorMethod(iteratorMethod)) { - iterator = iteratorMethod.call(O); - O = []; - while (!(step = iterator.next()).done) { - O.push(step.value); - } - } - if (mapping && argumentsLength > 2) { - mapfn = bind(mapfn, arguments[2], 2); - } - length = toLength(O.length); - result = new (aTypedArrayConstructor(this))(length); - for (i = 0; length > i; i++) { - result[i] = mapping ? mapfn(O[i], i) : O[i]; - } - return result; -}; - -},{"../internals/array-buffer-view-core":125,"../internals/bind-context":137,"../internals/get-iterator-method":171,"../internals/is-array-iterator-method":184,"../internals/to-length":252,"../internals/to-object":253}],258:[function(require,module,exports){ -/* eslint-disable no-new */ -var global = require('../internals/global'); -var fails = require('../internals/fails'); -var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); -var NATIVE_ARRAY_BUFFER_VIEWS = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER_VIEWS; - -var ArrayBuffer = global.ArrayBuffer; -var Int8Array = global.Int8Array; - -module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () { - Int8Array(1); -}) || !fails(function () { - new Int8Array(-1); -}) || !checkCorrectnessOfIteration(function (iterable) { - new Int8Array(); - new Int8Array(null); - new Int8Array(1.5); - new Int8Array(iterable); -}, true) || fails(function () { - // Safari 11 bug - return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1; -}); - -},{"../internals/array-buffer-view-core":125,"../internals/check-correctness-of-iteration":139,"../internals/fails":161,"../internals/global":173}],259:[function(require,module,exports){ -var id = 0; -var postfix = Math.random(); - -module.exports = function (key) { - return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); -}; - -},{}],260:[function(require,module,exports){ -var getBuiltIn = require('../internals/get-built-in'); - -module.exports = getBuiltIn('navigator', 'userAgent') || ''; - -},{"../internals/get-built-in":170}],261:[function(require,module,exports){ -// https://github.com/zloirock/core-js/issues/280 -var userAgent = require('../internals/user-agent'); - -// eslint-disable-next-line unicorn/no-unsafe-regex -module.exports = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent); - -},{"../internals/user-agent":260}],262:[function(require,module,exports){ -var global = require('../internals/global'); -var shared = require('../internals/shared'); -var uid = require('../internals/uid'); -var NATIVE_SYMBOL = require('../internals/native-symbol'); - -var Symbol = global.Symbol; -var store = shared('wks'); - -module.exports = function (name) { - return store[name] || (store[name] = NATIVE_SYMBOL && Symbol[name] - || (NATIVE_SYMBOL ? Symbol : uid)('Symbol.' + name)); -}; - -},{"../internals/global":173,"../internals/native-symbol":200,"../internals/shared":239,"../internals/uid":259}],263:[function(require,module,exports){ -// a string of all valid unicode whitespaces -// eslint-disable-next-line max-len -module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; - -},{}],264:[function(require,module,exports){ -exports.f = require('../internals/well-known-symbol'); - -},{"../internals/well-known-symbol":262}],265:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var global = require('../internals/global'); -var arrayBufferModule = require('../internals/array-buffer'); -var setSpecies = require('../internals/set-species'); - -var ARRAY_BUFFER = 'ArrayBuffer'; -var ArrayBuffer = arrayBufferModule[ARRAY_BUFFER]; -var NativeArrayBuffer = global[ARRAY_BUFFER]; - -// `ArrayBuffer` constructor -// https://tc39.github.io/ecma262/#sec-arraybuffer-constructor -$({ global: true, forced: NativeArrayBuffer !== ArrayBuffer }, { - ArrayBuffer: ArrayBuffer -}); - -setSpecies(ARRAY_BUFFER); - -},{"../internals/array-buffer":126,"../internals/export":160,"../internals/global":173,"../internals/set-species":236}],266:[function(require,module,exports){ -var $ = require('../internals/export'); -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); - -var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; - -// `ArrayBuffer.isView` method -// https://tc39.github.io/ecma262/#sec-arraybuffer.isview -$({ target: 'ArrayBuffer', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, { - isView: ArrayBufferViewCore.isView -}); - -},{"../internals/array-buffer-view-core":125,"../internals/export":160}],267:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var ArrayBufferModule = require('../internals/array-buffer'); -var anObject = require('../internals/an-object'); -var toAbsoluteIndex = require('../internals/to-absolute-index'); -var toLength = require('../internals/to-length'); -var speciesConstructor = require('../internals/species-constructor'); - -var ArrayBuffer = ArrayBufferModule.ArrayBuffer; -var DataView = ArrayBufferModule.DataView; -var nativeArrayBufferSlice = ArrayBuffer.prototype.slice; - -var INCORRECT_SLICE = fails(function () { - return !new ArrayBuffer(2).slice(1, undefined).byteLength; -}); - -// `ArrayBuffer.prototype.slice` method -// https://tc39.github.io/ecma262/#sec-arraybuffer.prototype.slice -$({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, { - slice: function slice(start, end) { - if (nativeArrayBufferSlice !== undefined && end === undefined) { - return nativeArrayBufferSlice.call(anObject(this), start); // FF fix - } - var length = anObject(this).byteLength; - var first = toAbsoluteIndex(start, length); - var fin = toAbsoluteIndex(end === undefined ? length : end, length); - var result = new (speciesConstructor(this, ArrayBuffer))(toLength(fin - first)); - var viewSource = new DataView(this); - var viewTarget = new DataView(result); - var index = 0; - while (first < fin) { - viewTarget.setUint8(index++, viewSource.getUint8(first++)); - } return result; - } -}); - -},{"../internals/an-object":124,"../internals/array-buffer":126,"../internals/export":160,"../internals/fails":161,"../internals/species-constructor":241,"../internals/to-absolute-index":248,"../internals/to-length":252}],268:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var isArray = require('../internals/is-array'); -var isObject = require('../internals/is-object'); -var toObject = require('../internals/to-object'); -var toLength = require('../internals/to-length'); -var createProperty = require('../internals/create-property'); -var arraySpeciesCreate = require('../internals/array-species-create'); -var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); -var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; -var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; - -var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () { - var array = []; - array[IS_CONCAT_SPREADABLE] = false; - return array.concat()[0] !== array; -}); - -var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); - -var isConcatSpreadable = function (O) { - if (!isObject(O)) return false; - var spreadable = O[IS_CONCAT_SPREADABLE]; - return spreadable !== undefined ? !!spreadable : isArray(O); -}; - -var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; - -// `Array.prototype.concat` method -// https://tc39.github.io/ecma262/#sec-array.prototype.concat -// with adding support of @@isConcatSpreadable and @@species -$({ target: 'Array', proto: true, forced: FORCED }, { - concat: function concat(arg) { // eslint-disable-line no-unused-vars - var O = toObject(this); - var A = arraySpeciesCreate(O, 0); - var n = 0; - var i, k, length, len, E; - for (i = -1, length = arguments.length; i < length; i++) { - E = i === -1 ? O : arguments[i]; - if (isConcatSpreadable(E)) { - len = toLength(E.length); - if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); - for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); - } else { - if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); - createProperty(A, n++, E); - } - } - A.length = n; - return A; - } -}); - -},{"../internals/array-method-has-species-support":134,"../internals/array-species-create":136,"../internals/create-property":151,"../internals/export":160,"../internals/fails":161,"../internals/is-array":185,"../internals/is-object":188,"../internals/to-length":252,"../internals/to-object":253,"../internals/well-known-symbol":262}],269:[function(require,module,exports){ -var $ = require('../internals/export'); -var copyWithin = require('../internals/array-copy-within'); -var addToUnscopables = require('../internals/add-to-unscopables'); - -// `Array.prototype.copyWithin` method -// https://tc39.github.io/ecma262/#sec-array.prototype.copywithin -$({ target: 'Array', proto: true }, { - copyWithin: copyWithin -}); - -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables('copyWithin'); - -},{"../internals/add-to-unscopables":121,"../internals/array-copy-within":127,"../internals/export":160}],270:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $every = require('../internals/array-iteration').every; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); - -// `Array.prototype.every` method -// https://tc39.github.io/ecma262/#sec-array.prototype.every -$({ target: 'Array', proto: true, forced: sloppyArrayMethod('every') }, { - every: function every(callbackfn /* , thisArg */) { - return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -},{"../internals/array-iteration":132,"../internals/export":160,"../internals/sloppy-array-method":240}],271:[function(require,module,exports){ -var $ = require('../internals/export'); -var fill = require('../internals/array-fill'); -var addToUnscopables = require('../internals/add-to-unscopables'); - -// `Array.prototype.fill` method -// https://tc39.github.io/ecma262/#sec-array.prototype.fill -$({ target: 'Array', proto: true }, { - fill: fill -}); - -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables('fill'); - -},{"../internals/add-to-unscopables":121,"../internals/array-fill":128,"../internals/export":160}],272:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $filter = require('../internals/array-iteration').filter; -var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); - -// `Array.prototype.filter` method -// https://tc39.github.io/ecma262/#sec-array.prototype.filter -// with adding support of @@species -$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, { - filter: function filter(callbackfn /* , thisArg */) { - return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -},{"../internals/array-iteration":132,"../internals/array-method-has-species-support":134,"../internals/export":160}],273:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $findIndex = require('../internals/array-iteration').findIndex; -var addToUnscopables = require('../internals/add-to-unscopables'); - -var FIND_INDEX = 'findIndex'; -var SKIPS_HOLES = true; - -// Shouldn't skip holes -if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; }); - -// `Array.prototype.findIndex` method -// https://tc39.github.io/ecma262/#sec-array.prototype.findindex -$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { - findIndex: function findIndex(callbackfn /* , that = undefined */) { - return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables(FIND_INDEX); - -},{"../internals/add-to-unscopables":121,"../internals/array-iteration":132,"../internals/export":160}],274:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $find = require('../internals/array-iteration').find; -var addToUnscopables = require('../internals/add-to-unscopables'); - -var FIND = 'find'; -var SKIPS_HOLES = true; - -// Shouldn't skip holes -if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); - -// `Array.prototype.find` method -// https://tc39.github.io/ecma262/#sec-array.prototype.find -$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { - find: function find(callbackfn /* , that = undefined */) { - return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables(FIND); - -},{"../internals/add-to-unscopables":121,"../internals/array-iteration":132,"../internals/export":160}],275:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var flattenIntoArray = require('../internals/flatten-into-array'); -var toObject = require('../internals/to-object'); -var toLength = require('../internals/to-length'); -var aFunction = require('../internals/a-function'); -var arraySpeciesCreate = require('../internals/array-species-create'); - -// `Array.prototype.flatMap` method -// https://github.com/tc39/proposal-flatMap -$({ target: 'Array', proto: true }, { - flatMap: function flatMap(callbackfn /* , thisArg */) { - var O = toObject(this); - var sourceLen = toLength(O.length); - var A; - aFunction(callbackfn); - A = arraySpeciesCreate(O, 0); - A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - return A; - } -}); - -},{"../internals/a-function":119,"../internals/array-species-create":136,"../internals/export":160,"../internals/flatten-into-array":163,"../internals/to-length":252,"../internals/to-object":253}],276:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var flattenIntoArray = require('../internals/flatten-into-array'); -var toObject = require('../internals/to-object'); -var toLength = require('../internals/to-length'); -var toInteger = require('../internals/to-integer'); -var arraySpeciesCreate = require('../internals/array-species-create'); - -// `Array.prototype.flat` method -// https://github.com/tc39/proposal-flatMap -$({ target: 'Array', proto: true }, { - flat: function flat(/* depthArg = 1 */) { - var depthArg = arguments.length ? arguments[0] : undefined; - var O = toObject(this); - var sourceLen = toLength(O.length); - var A = arraySpeciesCreate(O, 0); - A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg)); - return A; - } -}); - -},{"../internals/array-species-create":136,"../internals/export":160,"../internals/flatten-into-array":163,"../internals/to-integer":251,"../internals/to-length":252,"../internals/to-object":253}],277:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var forEach = require('../internals/array-for-each'); - -// `Array.prototype.forEach` method -// https://tc39.github.io/ecma262/#sec-array.prototype.foreach -$({ target: 'Array', proto: true, forced: [].forEach != forEach }, { - forEach: forEach -}); - -},{"../internals/array-for-each":129,"../internals/export":160}],278:[function(require,module,exports){ -var $ = require('../internals/export'); -var from = require('../internals/array-from'); -var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); - -var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { - Array.from(iterable); -}); - -// `Array.from` method -// https://tc39.github.io/ecma262/#sec-array.from -$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { - from: from -}); - -},{"../internals/array-from":130,"../internals/check-correctness-of-iteration":139,"../internals/export":160}],279:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $includes = require('../internals/array-includes').includes; -var addToUnscopables = require('../internals/add-to-unscopables'); - -// `Array.prototype.includes` method -// https://tc39.github.io/ecma262/#sec-array.prototype.includes -$({ target: 'Array', proto: true }, { - includes: function includes(el /* , fromIndex = 0 */) { - return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables('includes'); - -},{"../internals/add-to-unscopables":121,"../internals/array-includes":131,"../internals/export":160}],280:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $indexOf = require('../internals/array-includes').indexOf; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); - -var nativeIndexOf = [].indexOf; - -var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; -var SLOPPY_METHOD = sloppyArrayMethod('indexOf'); - -// `Array.prototype.indexOf` method -// https://tc39.github.io/ecma262/#sec-array.prototype.indexof -$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, { - indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { - return NEGATIVE_ZERO - // convert -0 to +0 - ? nativeIndexOf.apply(this, arguments) || 0 - : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -},{"../internals/array-includes":131,"../internals/export":160,"../internals/sloppy-array-method":240}],281:[function(require,module,exports){ -'use strict'; -var toIndexedObject = require('../internals/to-indexed-object'); -var addToUnscopables = require('../internals/add-to-unscopables'); -var Iterators = require('../internals/iterators'); -var InternalStateModule = require('../internals/internal-state'); -var defineIterator = require('../internals/define-iterator'); - -var ARRAY_ITERATOR = 'Array Iterator'; -var setInternalState = InternalStateModule.set; -var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); - -// `Array.prototype.entries` method -// https://tc39.github.io/ecma262/#sec-array.prototype.entries -// `Array.prototype.keys` method -// https://tc39.github.io/ecma262/#sec-array.prototype.keys -// `Array.prototype.values` method -// https://tc39.github.io/ecma262/#sec-array.prototype.values -// `Array.prototype[@@iterator]` method -// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator -// `CreateArrayIterator` internal method -// https://tc39.github.io/ecma262/#sec-createarrayiterator -module.exports = defineIterator(Array, 'Array', function (iterated, kind) { - setInternalState(this, { - type: ARRAY_ITERATOR, - target: toIndexedObject(iterated), // target - index: 0, // next index - kind: kind // kind - }); -// `%ArrayIteratorPrototype%.next` method -// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next -}, function () { - var state = getInternalState(this); - var target = state.target; - var kind = state.kind; - var index = state.index++; - if (!target || index >= target.length) { - state.target = undefined; - return { value: undefined, done: true }; - } - if (kind == 'keys') return { value: index, done: false }; - if (kind == 'values') return { value: target[index], done: false }; - return { value: [index, target[index]], done: false }; -}, 'values'); - -// argumentsList[@@iterator] is %ArrayProto_values% -// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject -// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject -Iterators.Arguments = Iterators.Array; - -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables('keys'); -addToUnscopables('values'); -addToUnscopables('entries'); - -},{"../internals/add-to-unscopables":121,"../internals/define-iterator":154,"../internals/internal-state":183,"../internals/iterators":193,"../internals/to-indexed-object":250}],282:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var IndexedObject = require('../internals/indexed-object'); -var toIndexedObject = require('../internals/to-indexed-object'); -var sloppyArrayMethod = require('../internals/sloppy-array-method'); - -var nativeJoin = [].join; - -var ES3_STRINGS = IndexedObject != Object; -var SLOPPY_METHOD = sloppyArrayMethod('join', ','); - -// `Array.prototype.join` method -// https://tc39.github.io/ecma262/#sec-array.prototype.join -$({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, { - join: function join(separator) { - return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator); - } -}); - -},{"../internals/export":160,"../internals/indexed-object":180,"../internals/sloppy-array-method":240,"../internals/to-indexed-object":250}],283:[function(require,module,exports){ -var $ = require('../internals/export'); -var lastIndexOf = require('../internals/array-last-index-of'); - -// `Array.prototype.lastIndexOf` method -// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof -$({ target: 'Array', proto: true, forced: lastIndexOf !== [].lastIndexOf }, { - lastIndexOf: lastIndexOf -}); - -},{"../internals/array-last-index-of":133,"../internals/export":160}],284:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $map = require('../internals/array-iteration').map; -var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); - -// `Array.prototype.map` method -// https://tc39.github.io/ecma262/#sec-array.prototype.map -// with adding support of @@species -$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('map') }, { - map: function map(callbackfn /* , thisArg */) { - return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -},{"../internals/array-iteration":132,"../internals/array-method-has-species-support":134,"../internals/export":160}],285:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var createProperty = require('../internals/create-property'); - -var ISNT_GENERIC = fails(function () { - function F() { /* empty */ } - return !(Array.of.call(F) instanceof F); -}); - -// `Array.of` method -// https://tc39.github.io/ecma262/#sec-array.of -// WebKit Array.of isn't generic -$({ target: 'Array', stat: true, forced: ISNT_GENERIC }, { - of: function of(/* ...args */) { - var index = 0; - var argumentsLength = arguments.length; - var result = new (typeof this == 'function' ? this : Array)(argumentsLength); - while (argumentsLength > index) createProperty(result, index, arguments[index++]); - result.length = argumentsLength; - return result; - } -}); - -},{"../internals/create-property":151,"../internals/export":160,"../internals/fails":161}],286:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $reduceRight = require('../internals/array-reduce').right; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); - -// `Array.prototype.reduceRight` method -// https://tc39.github.io/ecma262/#sec-array.prototype.reduceright -$({ target: 'Array', proto: true, forced: sloppyArrayMethod('reduceRight') }, { - reduceRight: function reduceRight(callbackfn /* , initialValue */) { - return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -},{"../internals/array-reduce":135,"../internals/export":160,"../internals/sloppy-array-method":240}],287:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $reduce = require('../internals/array-reduce').left; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); - -// `Array.prototype.reduce` method -// https://tc39.github.io/ecma262/#sec-array.prototype.reduce -$({ target: 'Array', proto: true, forced: sloppyArrayMethod('reduce') }, { - reduce: function reduce(callbackfn /* , initialValue */) { - return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -},{"../internals/array-reduce":135,"../internals/export":160,"../internals/sloppy-array-method":240}],288:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var isArray = require('../internals/is-array'); - -var nativeReverse = [].reverse; -var test = [1, 2]; - -// `Array.prototype.reverse` method -// https://tc39.github.io/ecma262/#sec-array.prototype.reverse -// fix for Safari 12.0 bug -// https://bugs.webkit.org/show_bug.cgi?id=188794 -$({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, { - reverse: function reverse() { - if (isArray(this)) this.length = this.length; - return nativeReverse.call(this); - } -}); - -},{"../internals/export":160,"../internals/is-array":185}],289:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var isObject = require('../internals/is-object'); -var isArray = require('../internals/is-array'); -var toAbsoluteIndex = require('../internals/to-absolute-index'); -var toLength = require('../internals/to-length'); -var toIndexedObject = require('../internals/to-indexed-object'); -var createProperty = require('../internals/create-property'); -var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var SPECIES = wellKnownSymbol('species'); -var nativeSlice = [].slice; -var max = Math.max; - -// `Array.prototype.slice` method -// https://tc39.github.io/ecma262/#sec-array.prototype.slice -// fallback for not array-like ES3 strings and DOM objects -$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, { - slice: function slice(start, end) { - var O = toIndexedObject(this); - var length = toLength(O.length); - var k = toAbsoluteIndex(start, length); - var fin = toAbsoluteIndex(end === undefined ? length : end, length); - // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible - var Constructor, result, n; - if (isArray(O)) { - Constructor = O.constructor; - // cross-realm fallback - if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) { - Constructor = undefined; - } else if (isObject(Constructor)) { - Constructor = Constructor[SPECIES]; - if (Constructor === null) Constructor = undefined; - } - if (Constructor === Array || Constructor === undefined) { - return nativeSlice.call(O, k, fin); - } - } - result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0)); - for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]); - result.length = n; - return result; - } -}); - -},{"../internals/array-method-has-species-support":134,"../internals/create-property":151,"../internals/export":160,"../internals/is-array":185,"../internals/is-object":188,"../internals/to-absolute-index":248,"../internals/to-indexed-object":250,"../internals/to-length":252,"../internals/well-known-symbol":262}],290:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $some = require('../internals/array-iteration').some; -var sloppyArrayMethod = require('../internals/sloppy-array-method'); - -// `Array.prototype.some` method -// https://tc39.github.io/ecma262/#sec-array.prototype.some -$({ target: 'Array', proto: true, forced: sloppyArrayMethod('some') }, { - some: function some(callbackfn /* , thisArg */) { - return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -},{"../internals/array-iteration":132,"../internals/export":160,"../internals/sloppy-array-method":240}],291:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var aFunction = require('../internals/a-function'); -var toObject = require('../internals/to-object'); -var fails = require('../internals/fails'); -var sloppyArrayMethod = require('../internals/sloppy-array-method'); - -var nativeSort = [].sort; -var test = [1, 2, 3]; - -// IE8- -var FAILS_ON_UNDEFINED = fails(function () { - test.sort(undefined); -}); -// V8 bug -var FAILS_ON_NULL = fails(function () { - test.sort(null); -}); -// Old WebKit -var SLOPPY_METHOD = sloppyArrayMethod('sort'); - -var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD; - -// `Array.prototype.sort` method -// https://tc39.github.io/ecma262/#sec-array.prototype.sort -$({ target: 'Array', proto: true, forced: FORCED }, { - sort: function sort(comparefn) { - return comparefn === undefined - ? nativeSort.call(toObject(this)) - : nativeSort.call(toObject(this), aFunction(comparefn)); - } -}); - -},{"../internals/a-function":119,"../internals/export":160,"../internals/fails":161,"../internals/sloppy-array-method":240,"../internals/to-object":253}],292:[function(require,module,exports){ -var setSpecies = require('../internals/set-species'); - -// `Array[@@species]` getter -// https://tc39.github.io/ecma262/#sec-get-array-@@species -setSpecies('Array'); - -},{"../internals/set-species":236}],293:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var toAbsoluteIndex = require('../internals/to-absolute-index'); -var toInteger = require('../internals/to-integer'); -var toLength = require('../internals/to-length'); -var toObject = require('../internals/to-object'); -var arraySpeciesCreate = require('../internals/array-species-create'); -var createProperty = require('../internals/create-property'); -var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); - -var max = Math.max; -var min = Math.min; -var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; -var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; - -// `Array.prototype.splice` method -// https://tc39.github.io/ecma262/#sec-array.prototype.splice -// with adding support of @@species -$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('splice') }, { - splice: function splice(start, deleteCount /* , ...items */) { - var O = toObject(this); - var len = toLength(O.length); - var actualStart = toAbsoluteIndex(start, len); - var argumentsLength = arguments.length; - var insertCount, actualDeleteCount, A, k, from, to; - if (argumentsLength === 0) { - insertCount = actualDeleteCount = 0; - } else if (argumentsLength === 1) { - insertCount = 0; - actualDeleteCount = len - actualStart; - } else { - insertCount = argumentsLength - 2; - actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart); - } - if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) { - throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); - } - A = arraySpeciesCreate(O, actualDeleteCount); - for (k = 0; k < actualDeleteCount; k++) { - from = actualStart + k; - if (from in O) createProperty(A, k, O[from]); - } - A.length = actualDeleteCount; - if (insertCount < actualDeleteCount) { - for (k = actualStart; k < len - actualDeleteCount; k++) { - from = k + actualDeleteCount; - to = k + insertCount; - if (from in O) O[to] = O[from]; - else delete O[to]; - } - for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1]; - } else if (insertCount > actualDeleteCount) { - for (k = len - actualDeleteCount; k > actualStart; k--) { - from = k + actualDeleteCount - 1; - to = k + insertCount - 1; - if (from in O) O[to] = O[from]; - else delete O[to]; - } - } - for (k = 0; k < insertCount; k++) { - O[k + actualStart] = arguments[k + 2]; - } - O.length = len - actualDeleteCount + insertCount; - return A; - } -}); - -},{"../internals/array-method-has-species-support":134,"../internals/array-species-create":136,"../internals/create-property":151,"../internals/export":160,"../internals/to-absolute-index":248,"../internals/to-integer":251,"../internals/to-length":252,"../internals/to-object":253}],294:[function(require,module,exports){ -// this method was added to unscopables after implementation -// in popular engines, so it's moved to a separate module -var addToUnscopables = require('../internals/add-to-unscopables'); - -addToUnscopables('flatMap'); - -},{"../internals/add-to-unscopables":121}],295:[function(require,module,exports){ -// this method was added to unscopables after implementation -// in popular engines, so it's moved to a separate module -var addToUnscopables = require('../internals/add-to-unscopables'); - -addToUnscopables('flat'); - -},{"../internals/add-to-unscopables":121}],296:[function(require,module,exports){ -var $ = require('../internals/export'); -var ArrayBufferModule = require('../internals/array-buffer'); -var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER; - -// `DataView` constructor -// https://tc39.github.io/ecma262/#sec-dataview-constructor -$({ global: true, forced: !NATIVE_ARRAY_BUFFER }, { - DataView: ArrayBufferModule.DataView -}); - -},{"../internals/array-buffer":126,"../internals/array-buffer-view-core":125,"../internals/export":160}],297:[function(require,module,exports){ -var $ = require('../internals/export'); -var toISOString = require('../internals/date-to-iso-string'); - -// `Date.prototype.toISOString` method -// https://tc39.github.io/ecma262/#sec-date.prototype.toisostring -// PhantomJS / old WebKit has a broken implementations -$({ target: 'Date', proto: true, forced: Date.prototype.toISOString !== toISOString }, { - toISOString: toISOString -}); - -},{"../internals/date-to-iso-string":152,"../internals/export":160}],298:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var toObject = require('../internals/to-object'); -var toPrimitive = require('../internals/to-primitive'); - -var FORCED = fails(function () { - return new Date(NaN).toJSON() !== null - || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; -}); - -// `Date.prototype.toJSON` method -// https://tc39.github.io/ecma262/#sec-date.prototype.tojson -$({ target: 'Date', proto: true, forced: FORCED }, { - // eslint-disable-next-line no-unused-vars - toJSON: function toJSON(key) { - var O = toObject(this); - var pv = toPrimitive(O); - return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/to-object":253,"../internals/to-primitive":255}],299:[function(require,module,exports){ -var hide = require('../internals/hide'); -var dateToPrimitive = require('../internals/date-to-primitive'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); -var DatePrototype = Date.prototype; - -// `Date.prototype[@@toPrimitive]` method -// https://tc39.github.io/ecma262/#sec-date.prototype-@@toprimitive -if (!(TO_PRIMITIVE in DatePrototype)) hide(DatePrototype, TO_PRIMITIVE, dateToPrimitive); - -},{"../internals/date-to-primitive":153,"../internals/hide":176,"../internals/well-known-symbol":262}],300:[function(require,module,exports){ -var redefine = require('../internals/redefine'); - -var DatePrototype = Date.prototype; -var INVALID_DATE = 'Invalid Date'; -var TO_STRING = 'toString'; -var nativeDateToString = DatePrototype[TO_STRING]; -var getTime = DatePrototype.getTime; - -// `Date.prototype.toString` method -// https://tc39.github.io/ecma262/#sec-date.prototype.tostring -if (new Date(NaN) + '' != INVALID_DATE) { - redefine(DatePrototype, TO_STRING, function toString() { - var value = getTime.call(this); - // eslint-disable-next-line no-self-compare - return value === value ? nativeDateToString.call(this) : INVALID_DATE; - }); -} - -},{"../internals/redefine":229}],301:[function(require,module,exports){ -'use strict'; -var isObject = require('../internals/is-object'); -var definePropertyModule = require('../internals/object-define-property'); -var getPrototypeOf = require('../internals/object-get-prototype-of'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var HAS_INSTANCE = wellKnownSymbol('hasInstance'); -var FunctionPrototype = Function.prototype; - -// `Function.prototype[@@hasInstance]` method -// https://tc39.github.io/ecma262/#sec-function.prototype-@@hasinstance -if (!(HAS_INSTANCE in FunctionPrototype)) { - definePropertyModule.f(FunctionPrototype, HAS_INSTANCE, { value: function (O) { - if (typeof this != 'function' || !isObject(O)) return false; - if (!isObject(this.prototype)) return O instanceof this; - // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: - while (O = getPrototypeOf(O)) if (this.prototype === O) return true; - return false; - } }); -} - -},{"../internals/is-object":188,"../internals/object-define-property":209,"../internals/object-get-prototype-of":214,"../internals/well-known-symbol":262}],302:[function(require,module,exports){ -var DESCRIPTORS = require('../internals/descriptors'); -var defineProperty = require('../internals/object-define-property').f; - -var FunctionPrototype = Function.prototype; -var FunctionPrototypeToString = FunctionPrototype.toString; -var nameRE = /^\s*function ([^ (]*)/; -var NAME = 'name'; - -// Function instances `.name` property -// https://tc39.github.io/ecma262/#sec-function-instances-name -if (DESCRIPTORS && !(NAME in FunctionPrototype)) { - defineProperty(FunctionPrototype, NAME, { - configurable: true, - get: function () { - try { - return FunctionPrototypeToString.call(this).match(nameRE)[1]; - } catch (error) { - return ''; - } - } - }); -} - -},{"../internals/descriptors":156,"../internals/object-define-property":209}],303:[function(require,module,exports){ -var global = require('../internals/global'); -var setToStringTag = require('../internals/set-to-string-tag'); - -// JSON[@@toStringTag] property -// https://tc39.github.io/ecma262/#sec-json-@@tostringtag -setToStringTag(global.JSON, 'JSON', true); - -},{"../internals/global":173,"../internals/set-to-string-tag":237}],304:[function(require,module,exports){ -'use strict'; -var collection = require('../internals/collection'); -var collectionStrong = require('../internals/collection-strong'); - -// `Map` constructor -// https://tc39.github.io/ecma262/#sec-map-objects -module.exports = collection('Map', function (get) { - return function Map() { return get(this, arguments.length ? arguments[0] : undefined); }; -}, collectionStrong, true); - -},{"../internals/collection":144,"../internals/collection-strong":142}],305:[function(require,module,exports){ -var $ = require('../internals/export'); -var log1p = require('../internals/math-log1p'); - -var nativeAcosh = Math.acosh; -var log = Math.log; -var sqrt = Math.sqrt; -var LN2 = Math.LN2; - -var FORCED = !nativeAcosh - // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 - || Math.floor(nativeAcosh(Number.MAX_VALUE)) != 710 - // Tor Browser bug: Math.acosh(Infinity) -> NaN - || nativeAcosh(Infinity) != Infinity; - -// `Math.acosh` method -// https://tc39.github.io/ecma262/#sec-math.acosh -$({ target: 'Math', stat: true, forced: FORCED }, { - acosh: function acosh(x) { - return (x = +x) < 1 ? NaN : x > 94906265.62425156 - ? log(x) + LN2 - : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); - } -}); - -},{"../internals/export":160,"../internals/math-log1p":196}],306:[function(require,module,exports){ -var $ = require('../internals/export'); - -var nativeAsinh = Math.asinh; -var log = Math.log; -var sqrt = Math.sqrt; - -function asinh(x) { - return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1)); -} - -// `Math.asinh` method -// https://tc39.github.io/ecma262/#sec-math.asinh -// Tor Browser bug: Math.asinh(0) -> -0 -$({ target: 'Math', stat: true, forced: !(nativeAsinh && 1 / nativeAsinh(0) > 0) }, { - asinh: asinh -}); - -},{"../internals/export":160}],307:[function(require,module,exports){ -var $ = require('../internals/export'); - -var nativeAtanh = Math.atanh; -var log = Math.log; - -// `Math.atanh` method -// https://tc39.github.io/ecma262/#sec-math.atanh -// Tor Browser bug: Math.atanh(-0) -> 0 -$({ target: 'Math', stat: true, forced: !(nativeAtanh && 1 / nativeAtanh(-0) < 0) }, { - atanh: function atanh(x) { - return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2; - } -}); - -},{"../internals/export":160}],308:[function(require,module,exports){ -var $ = require('../internals/export'); -var sign = require('../internals/math-sign'); - -var abs = Math.abs; -var pow = Math.pow; - -// `Math.cbrt` method -// https://tc39.github.io/ecma262/#sec-math.cbrt -$({ target: 'Math', stat: true }, { - cbrt: function cbrt(x) { - return sign(x = +x) * pow(abs(x), 1 / 3); - } -}); - -},{"../internals/export":160,"../internals/math-sign":197}],309:[function(require,module,exports){ -var $ = require('../internals/export'); - -var floor = Math.floor; -var log = Math.log; -var LOG2E = Math.LOG2E; - -// `Math.clz32` method -// https://tc39.github.io/ecma262/#sec-math.clz32 -$({ target: 'Math', stat: true }, { - clz32: function clz32(x) { - return (x >>>= 0) ? 31 - floor(log(x + 0.5) * LOG2E) : 32; - } -}); - -},{"../internals/export":160}],310:[function(require,module,exports){ -var $ = require('../internals/export'); -var expm1 = require('../internals/math-expm1'); - -var nativeCosh = Math.cosh; -var abs = Math.abs; -var E = Math.E; - -// `Math.cosh` method -// https://tc39.github.io/ecma262/#sec-math.cosh -$({ target: 'Math', stat: true, forced: !nativeCosh || nativeCosh(710) === Infinity }, { - cosh: function cosh(x) { - var t = expm1(abs(x) - 1) + 1; - return (t + 1 / (t * E * E)) * (E / 2); - } -}); - -},{"../internals/export":160,"../internals/math-expm1":194}],311:[function(require,module,exports){ -var $ = require('../internals/export'); -var expm1 = require('../internals/math-expm1'); - -// `Math.expm1` method -// https://tc39.github.io/ecma262/#sec-math.expm1 -$({ target: 'Math', stat: true, forced: expm1 != Math.expm1 }, { expm1: expm1 }); - -},{"../internals/export":160,"../internals/math-expm1":194}],312:[function(require,module,exports){ -var $ = require('../internals/export'); -var fround = require('../internals/math-fround'); - -// `Math.fround` method -// https://tc39.github.io/ecma262/#sec-math.fround -$({ target: 'Math', stat: true }, { fround: fround }); - -},{"../internals/export":160,"../internals/math-fround":195}],313:[function(require,module,exports){ -var $ = require('../internals/export'); - -var $hypot = Math.hypot; -var abs = Math.abs; -var sqrt = Math.sqrt; - -// Chrome 77 bug -// https://bugs.chromium.org/p/v8/issues/detail?id=9546 -var BUGGY = !!$hypot && $hypot(Infinity, NaN) !== Infinity; - -// `Math.hypot` method -// https://tc39.github.io/ecma262/#sec-math.hypot -$({ target: 'Math', stat: true, forced: BUGGY }, { - hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars - var sum = 0; - var i = 0; - var aLen = arguments.length; - var larg = 0; - var arg, div; - while (i < aLen) { - arg = abs(arguments[i++]); - if (larg < arg) { - div = larg / arg; - sum = sum * div * div + 1; - larg = arg; - } else if (arg > 0) { - div = arg / larg; - sum += div * div; - } else sum += arg; - } - return larg === Infinity ? Infinity : larg * sqrt(sum); - } -}); - -},{"../internals/export":160}],314:[function(require,module,exports){ -var $ = require('../internals/export'); -var fails = require('../internals/fails'); - -var nativeImul = Math.imul; - -var FORCED = fails(function () { - return nativeImul(0xFFFFFFFF, 5) != -5 || nativeImul.length != 2; -}); - -// `Math.imul` method -// https://tc39.github.io/ecma262/#sec-math.imul -// some WebKit versions fails with big numbers, some has wrong arity -$({ target: 'Math', stat: true, forced: FORCED }, { - imul: function imul(x, y) { - var UINT16 = 0xFFFF; - var xn = +x; - var yn = +y; - var xl = UINT16 & xn; - var yl = UINT16 & yn; - return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); - } -}); - -},{"../internals/export":160,"../internals/fails":161}],315:[function(require,module,exports){ -var $ = require('../internals/export'); - -var log = Math.log; -var LOG10E = Math.LOG10E; - -// `Math.log10` method -// https://tc39.github.io/ecma262/#sec-math.log10 -$({ target: 'Math', stat: true }, { - log10: function log10(x) { - return log(x) * LOG10E; - } -}); - -},{"../internals/export":160}],316:[function(require,module,exports){ -var $ = require('../internals/export'); -var log1p = require('../internals/math-log1p'); - -// `Math.log1p` method -// https://tc39.github.io/ecma262/#sec-math.log1p -$({ target: 'Math', stat: true }, { log1p: log1p }); - -},{"../internals/export":160,"../internals/math-log1p":196}],317:[function(require,module,exports){ -var $ = require('../internals/export'); - -var log = Math.log; -var LN2 = Math.LN2; - -// `Math.log2` method -// https://tc39.github.io/ecma262/#sec-math.log2 -$({ target: 'Math', stat: true }, { - log2: function log2(x) { - return log(x) / LN2; - } -}); - -},{"../internals/export":160}],318:[function(require,module,exports){ -var $ = require('../internals/export'); -var sign = require('../internals/math-sign'); - -// `Math.sign` method -// https://tc39.github.io/ecma262/#sec-math.sign -$({ target: 'Math', stat: true }, { - sign: sign -}); - -},{"../internals/export":160,"../internals/math-sign":197}],319:[function(require,module,exports){ -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var expm1 = require('../internals/math-expm1'); - -var abs = Math.abs; -var exp = Math.exp; -var E = Math.E; - -var FORCED = fails(function () { - return Math.sinh(-2e-17) != -2e-17; -}); - -// `Math.sinh` method -// https://tc39.github.io/ecma262/#sec-math.sinh -// V8 near Chromium 38 has a problem with very small numbers -$({ target: 'Math', stat: true, forced: FORCED }, { - sinh: function sinh(x) { - return abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (E / 2); - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/math-expm1":194}],320:[function(require,module,exports){ -var $ = require('../internals/export'); -var expm1 = require('../internals/math-expm1'); - -var exp = Math.exp; - -// `Math.tanh` method -// https://tc39.github.io/ecma262/#sec-math.tanh -$({ target: 'Math', stat: true }, { - tanh: function tanh(x) { - var a = expm1(x = +x); - var b = expm1(-x); - return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); - } -}); - -},{"../internals/export":160,"../internals/math-expm1":194}],321:[function(require,module,exports){ -var setToStringTag = require('../internals/set-to-string-tag'); - -// Math[@@toStringTag] property -// https://tc39.github.io/ecma262/#sec-math-@@tostringtag -setToStringTag(Math, 'Math', true); - -},{"../internals/set-to-string-tag":237}],322:[function(require,module,exports){ -var $ = require('../internals/export'); - -var ceil = Math.ceil; -var floor = Math.floor; - -// `Math.trunc` method -// https://tc39.github.io/ecma262/#sec-math.trunc -$({ target: 'Math', stat: true }, { - trunc: function trunc(it) { - return (it > 0 ? floor : ceil)(it); - } -}); - -},{"../internals/export":160}],323:[function(require,module,exports){ -'use strict'; -var DESCRIPTORS = require('../internals/descriptors'); -var global = require('../internals/global'); -var isForced = require('../internals/is-forced'); -var redefine = require('../internals/redefine'); -var has = require('../internals/has'); -var classof = require('../internals/classof-raw'); -var inheritIfRequired = require('../internals/inherit-if-required'); -var toPrimitive = require('../internals/to-primitive'); -var fails = require('../internals/fails'); -var create = require('../internals/object-create'); -var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; -var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; -var defineProperty = require('../internals/object-define-property').f; -var trim = require('../internals/string-trim').trim; - -var NUMBER = 'Number'; -var NativeNumber = global[NUMBER]; -var NumberPrototype = NativeNumber.prototype; - -// Opera ~12 has broken Object#toString -var BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER; - -// `ToNumber` abstract operation -// https://tc39.github.io/ecma262/#sec-tonumber -var toNumber = function (argument) { - var it = toPrimitive(argument, false); - var first, third, radix, maxCode, digits, length, index, code; - if (typeof it == 'string' && it.length > 2) { - it = trim(it); - first = it.charCodeAt(0); - if (first === 43 || first === 45) { - third = it.charCodeAt(2); - if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix - } else if (first === 48) { - switch (it.charCodeAt(1)) { - case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i - case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i - default: return +it; - } - digits = it.slice(2); - length = digits.length; - for (index = 0; index < length; index++) { - code = digits.charCodeAt(index); - // parseInt parses a string to a first unavailable symbol - // but ToNumber should return NaN if a string contains unavailable symbols - if (code < 48 || code > maxCode) return NaN; - } return parseInt(digits, radix); - } - } return +it; -}; - -// `Number` constructor -// https://tc39.github.io/ecma262/#sec-number-constructor -if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { - var NumberWrapper = function Number(value) { - var it = arguments.length < 1 ? 0 : value; - var dummy = this; - return dummy instanceof NumberWrapper - // check on 1..constructor(foo) case - && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classof(dummy) != NUMBER) - ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it); - }; - for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : ( - // ES3: - 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + - // ES2015 (in case, if modules with ES2015 Number statics required before): - 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + - 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' - ).split(','), j = 0, key; keys.length > j; j++) { - if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) { - defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key)); - } - } - NumberWrapper.prototype = NumberPrototype; - NumberPrototype.constructor = NumberWrapper; - redefine(global, NUMBER, NumberWrapper); -} - -},{"../internals/classof-raw":140,"../internals/descriptors":156,"../internals/fails":161,"../internals/global":173,"../internals/has":174,"../internals/inherit-if-required":181,"../internals/is-forced":186,"../internals/object-create":207,"../internals/object-define-property":209,"../internals/object-get-own-property-descriptor":210,"../internals/object-get-own-property-names":212,"../internals/redefine":229,"../internals/string-trim":245,"../internals/to-primitive":255}],324:[function(require,module,exports){ -var $ = require('../internals/export'); - -// `Number.EPSILON` constant -// https://tc39.github.io/ecma262/#sec-number.epsilon -$({ target: 'Number', stat: true }, { - EPSILON: Math.pow(2, -52) -}); - -},{"../internals/export":160}],325:[function(require,module,exports){ -var $ = require('../internals/export'); -var numberIsFinite = require('../internals/number-is-finite'); - -// `Number.isFinite` method -// https://tc39.github.io/ecma262/#sec-number.isfinite -$({ target: 'Number', stat: true }, { isFinite: numberIsFinite }); - -},{"../internals/export":160,"../internals/number-is-finite":205}],326:[function(require,module,exports){ -var $ = require('../internals/export'); -var isInteger = require('../internals/is-integer'); - -// `Number.isInteger` method -// https://tc39.github.io/ecma262/#sec-number.isinteger -$({ target: 'Number', stat: true }, { - isInteger: isInteger -}); - -},{"../internals/export":160,"../internals/is-integer":187}],327:[function(require,module,exports){ -var $ = require('../internals/export'); - -// `Number.isNaN` method -// https://tc39.github.io/ecma262/#sec-number.isnan -$({ target: 'Number', stat: true }, { - isNaN: function isNaN(number) { - // eslint-disable-next-line no-self-compare - return number != number; - } -}); - -},{"../internals/export":160}],328:[function(require,module,exports){ -var $ = require('../internals/export'); -var isInteger = require('../internals/is-integer'); - -var abs = Math.abs; - -// `Number.isSafeInteger` method -// https://tc39.github.io/ecma262/#sec-number.issafeinteger -$({ target: 'Number', stat: true }, { - isSafeInteger: function isSafeInteger(number) { - return isInteger(number) && abs(number) <= 0x1FFFFFFFFFFFFF; - } -}); - -},{"../internals/export":160,"../internals/is-integer":187}],329:[function(require,module,exports){ -var $ = require('../internals/export'); - -// `Number.MAX_SAFE_INTEGER` constant -// https://tc39.github.io/ecma262/#sec-number.max_safe_integer -$({ target: 'Number', stat: true }, { - MAX_SAFE_INTEGER: 0x1FFFFFFFFFFFFF -}); - -},{"../internals/export":160}],330:[function(require,module,exports){ -var $ = require('../internals/export'); - -// `Number.MIN_SAFE_INTEGER` constant -// https://tc39.github.io/ecma262/#sec-number.min_safe_integer -$({ target: 'Number', stat: true }, { - MIN_SAFE_INTEGER: -0x1FFFFFFFFFFFFF -}); - -},{"../internals/export":160}],331:[function(require,module,exports){ -var $ = require('../internals/export'); -var parseFloat = require('../internals/parse-float'); - -// `Number.parseFloat` method -// https://tc39.github.io/ecma262/#sec-number.parseFloat -$({ target: 'Number', stat: true, forced: Number.parseFloat != parseFloat }, { - parseFloat: parseFloat -}); - -},{"../internals/export":160,"../internals/parse-float":222}],332:[function(require,module,exports){ -var $ = require('../internals/export'); -var parseInt = require('../internals/parse-int'); - -// `Number.parseInt` method -// https://tc39.github.io/ecma262/#sec-number.parseint -$({ target: 'Number', stat: true, forced: Number.parseInt != parseInt }, { - parseInt: parseInt -}); - -},{"../internals/export":160,"../internals/parse-int":223}],333:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var toInteger = require('../internals/to-integer'); -var thisNumberValue = require('../internals/this-number-value'); -var repeat = require('../internals/string-repeat'); -var fails = require('../internals/fails'); - -var nativeToFixed = 1.0.toFixed; -var floor = Math.floor; - -var pow = function (x, n, acc) { - return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); -}; - -var log = function (x) { - var n = 0; - var x2 = x; - while (x2 >= 4096) { - n += 12; - x2 /= 4096; - } - while (x2 >= 2) { - n += 1; - x2 /= 2; - } return n; -}; - -var FORCED = nativeToFixed && ( - 0.00008.toFixed(3) !== '0.000' || - 0.9.toFixed(0) !== '1' || - 1.255.toFixed(2) !== '1.25' || - 1000000000000000128.0.toFixed(0) !== '1000000000000000128' -) || !fails(function () { - // V8 ~ Android 4.3- - nativeToFixed.call({}); -}); - -// `Number.prototype.toFixed` method -// https://tc39.github.io/ecma262/#sec-number.prototype.tofixed -$({ target: 'Number', proto: true, forced: FORCED }, { - // eslint-disable-next-line max-statements - toFixed: function toFixed(fractionDigits) { - var number = thisNumberValue(this); - var fractDigits = toInteger(fractionDigits); - var data = [0, 0, 0, 0, 0, 0]; - var sign = ''; - var result = '0'; - var e, z, j, k; - - var multiply = function (n, c) { - var index = -1; - var c2 = c; - while (++index < 6) { - c2 += n * data[index]; - data[index] = c2 % 1e7; - c2 = floor(c2 / 1e7); - } - }; - - var divide = function (n) { - var index = 6; - var c = 0; - while (--index >= 0) { - c += data[index]; - data[index] = floor(c / n); - c = (c % n) * 1e7; - } - }; - - var dataToString = function () { - var index = 6; - var s = ''; - while (--index >= 0) { - if (s !== '' || index === 0 || data[index] !== 0) { - var t = String(data[index]); - s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t; - } - } return s; - }; - - if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits'); - // eslint-disable-next-line no-self-compare - if (number != number) return 'NaN'; - if (number <= -1e21 || number >= 1e21) return String(number); - if (number < 0) { - sign = '-'; - number = -number; - } - if (number > 1e-21) { - e = log(number * pow(2, 69, 1)) - 69; - z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1); - z *= 0x10000000000000; - e = 52 - e; - if (e > 0) { - multiply(0, z); - j = fractDigits; - while (j >= 7) { - multiply(1e7, 0); - j -= 7; - } - multiply(pow(10, j, 1), 0); - j = e - 1; - while (j >= 23) { - divide(1 << 23); - j -= 23; - } - divide(1 << j); - multiply(1, 1); - divide(2); - result = dataToString(); - } else { - multiply(0, z); - multiply(1 << -e, 0); - result = dataToString() + repeat.call('0', fractDigits); - } - } - if (fractDigits > 0) { - k = result.length; - result = sign + (k <= fractDigits - ? '0.' + repeat.call('0', fractDigits - k) + result - : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits)); - } else { - result = sign + result; - } return result; - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/string-repeat":244,"../internals/this-number-value":247,"../internals/to-integer":251}],334:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var thisNumberValue = require('../internals/this-number-value'); - -var nativeToPrecision = 1.0.toPrecision; - -var FORCED = fails(function () { - // IE7- - return nativeToPrecision.call(1, undefined) !== '1'; -}) || !fails(function () { - // V8 ~ Android 4.3- - nativeToPrecision.call({}); -}); - -// `Number.prototype.toPrecision` method -// https://tc39.github.io/ecma262/#sec-number.prototype.toprecision -$({ target: 'Number', proto: true, forced: FORCED }, { - toPrecision: function toPrecision(precision) { - return precision === undefined - ? nativeToPrecision.call(thisNumberValue(this)) - : nativeToPrecision.call(thisNumberValue(this), precision); - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/this-number-value":247}],335:[function(require,module,exports){ -var $ = require('../internals/export'); -var assign = require('../internals/object-assign'); - -// `Object.assign` method -// https://tc39.github.io/ecma262/#sec-object.assign -$({ target: 'Object', stat: true, forced: Object.assign !== assign }, { - assign: assign -}); - -},{"../internals/export":160,"../internals/object-assign":206}],336:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var DESCRIPTORS = require('../internals/descriptors'); -var FORCED = require('../internals/forced-object-prototype-accessors-methods'); -var toObject = require('../internals/to-object'); -var aFunction = require('../internals/a-function'); -var definePropertyModule = require('../internals/object-define-property'); - -// `Object.prototype.__defineGetter__` method -// https://tc39.github.io/ecma262/#sec-object.prototype.__defineGetter__ -if (DESCRIPTORS) { - $({ target: 'Object', proto: true, forced: FORCED }, { - __defineGetter__: function __defineGetter__(P, getter) { - definePropertyModule.f(toObject(this), P, { get: aFunction(getter), enumerable: true, configurable: true }); - } - }); -} - -},{"../internals/a-function":119,"../internals/descriptors":156,"../internals/export":160,"../internals/forced-object-prototype-accessors-methods":164,"../internals/object-define-property":209,"../internals/to-object":253}],337:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var DESCRIPTORS = require('../internals/descriptors'); -var FORCED = require('../internals/forced-object-prototype-accessors-methods'); -var toObject = require('../internals/to-object'); -var aFunction = require('../internals/a-function'); -var definePropertyModule = require('../internals/object-define-property'); - -// `Object.prototype.__defineSetter__` method -// https://tc39.github.io/ecma262/#sec-object.prototype.__defineSetter__ -if (DESCRIPTORS) { - $({ target: 'Object', proto: true, forced: FORCED }, { - __defineSetter__: function __defineSetter__(P, setter) { - definePropertyModule.f(toObject(this), P, { set: aFunction(setter), enumerable: true, configurable: true }); - } - }); -} - -},{"../internals/a-function":119,"../internals/descriptors":156,"../internals/export":160,"../internals/forced-object-prototype-accessors-methods":164,"../internals/object-define-property":209,"../internals/to-object":253}],338:[function(require,module,exports){ -var $ = require('../internals/export'); -var $entries = require('../internals/object-to-array').entries; - -// `Object.entries` method -// https://tc39.github.io/ecma262/#sec-object.entries -$({ target: 'Object', stat: true }, { - entries: function entries(O) { - return $entries(O); - } -}); - -},{"../internals/export":160,"../internals/object-to-array":219}],339:[function(require,module,exports){ -var $ = require('../internals/export'); -var FREEZING = require('../internals/freezing'); -var fails = require('../internals/fails'); -var isObject = require('../internals/is-object'); -var onFreeze = require('../internals/internal-metadata').onFreeze; - -var nativeFreeze = Object.freeze; -var FAILS_ON_PRIMITIVES = fails(function () { nativeFreeze(1); }); - -// `Object.freeze` method -// https://tc39.github.io/ecma262/#sec-object.freeze -$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, { - freeze: function freeze(it) { - return nativeFreeze && isObject(it) ? nativeFreeze(onFreeze(it)) : it; - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/freezing":167,"../internals/internal-metadata":182,"../internals/is-object":188}],340:[function(require,module,exports){ -var $ = require('../internals/export'); -var iterate = require('../internals/iterate'); -var createProperty = require('../internals/create-property'); - -// `Object.fromEntries` method -// https://github.com/tc39/proposal-object-from-entries -$({ target: 'Object', stat: true }, { - fromEntries: function fromEntries(iterable) { - var obj = {}; - iterate(iterable, function (k, v) { - createProperty(obj, k, v); - }, undefined, true); - return obj; - } -}); - -},{"../internals/create-property":151,"../internals/export":160,"../internals/iterate":191}],341:[function(require,module,exports){ -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var toIndexedObject = require('../internals/to-indexed-object'); -var nativeGetOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; -var DESCRIPTORS = require('../internals/descriptors'); - -var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); }); -var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES; - -// `Object.getOwnPropertyDescriptor` method -// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor -$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, { - getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { - return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key); - } -}); - -},{"../internals/descriptors":156,"../internals/export":160,"../internals/fails":161,"../internals/object-get-own-property-descriptor":210,"../internals/to-indexed-object":250}],342:[function(require,module,exports){ -var $ = require('../internals/export'); -var DESCRIPTORS = require('../internals/descriptors'); -var ownKeys = require('../internals/own-keys'); -var toIndexedObject = require('../internals/to-indexed-object'); -var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); -var createProperty = require('../internals/create-property'); - -// `Object.getOwnPropertyDescriptors` method -// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors -$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, { - getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { - var O = toIndexedObject(object); - var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; - var keys = ownKeys(O); - var result = {}; - var index = 0; - var key, descriptor; - while (keys.length > index) { - descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); - if (descriptor !== undefined) createProperty(result, key, descriptor); - } - return result; - } -}); - -},{"../internals/create-property":151,"../internals/descriptors":156,"../internals/export":160,"../internals/object-get-own-property-descriptor":210,"../internals/own-keys":221,"../internals/to-indexed-object":250}],343:[function(require,module,exports){ -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var nativeGetOwnPropertyNames = require('../internals/object-get-own-property-names-external').f; - -var FAILS_ON_PRIMITIVES = fails(function () { return !Object.getOwnPropertyNames(1); }); - -// `Object.getOwnPropertyNames` method -// https://tc39.github.io/ecma262/#sec-object.getownpropertynames -$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { - getOwnPropertyNames: nativeGetOwnPropertyNames -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/object-get-own-property-names-external":211}],344:[function(require,module,exports){ -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var toObject = require('../internals/to-object'); -var nativeGetPrototypeOf = require('../internals/object-get-prototype-of'); -var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter'); - -var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); }); - -// `Object.getPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-object.getprototypeof -$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, { - getPrototypeOf: function getPrototypeOf(it) { - return nativeGetPrototypeOf(toObject(it)); - } -}); - - -},{"../internals/correct-prototype-getter":147,"../internals/export":160,"../internals/fails":161,"../internals/object-get-prototype-of":214,"../internals/to-object":253}],345:[function(require,module,exports){ -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var isObject = require('../internals/is-object'); - -var nativeIsExtensible = Object.isExtensible; -var FAILS_ON_PRIMITIVES = fails(function () { nativeIsExtensible(1); }); - -// `Object.isExtensible` method -// https://tc39.github.io/ecma262/#sec-object.isextensible -$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { - isExtensible: function isExtensible(it) { - return isObject(it) ? nativeIsExtensible ? nativeIsExtensible(it) : true : false; - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/is-object":188}],346:[function(require,module,exports){ -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var isObject = require('../internals/is-object'); - -var nativeIsFrozen = Object.isFrozen; -var FAILS_ON_PRIMITIVES = fails(function () { nativeIsFrozen(1); }); - -// `Object.isFrozen` method -// https://tc39.github.io/ecma262/#sec-object.isfrozen -$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { - isFrozen: function isFrozen(it) { - return isObject(it) ? nativeIsFrozen ? nativeIsFrozen(it) : false : true; - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/is-object":188}],347:[function(require,module,exports){ -var $ = require('../internals/export'); -var fails = require('../internals/fails'); -var isObject = require('../internals/is-object'); - -var nativeIsSealed = Object.isSealed; -var FAILS_ON_PRIMITIVES = fails(function () { nativeIsSealed(1); }); - -// `Object.isSealed` method -// https://tc39.github.io/ecma262/#sec-object.issealed -$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { - isSealed: function isSealed(it) { - return isObject(it) ? nativeIsSealed ? nativeIsSealed(it) : false : true; - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/is-object":188}],348:[function(require,module,exports){ -var $ = require('../internals/export'); -var is = require('../internals/same-value'); - -// `Object.is` method -// https://tc39.github.io/ecma262/#sec-object.is -$({ target: 'Object', stat: true }, { - is: is -}); - -},{"../internals/export":160,"../internals/same-value":234}],349:[function(require,module,exports){ -var $ = require('../internals/export'); -var toObject = require('../internals/to-object'); -var nativeKeys = require('../internals/object-keys'); -var fails = require('../internals/fails'); - -var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); }); - -// `Object.keys` method -// https://tc39.github.io/ecma262/#sec-object.keys -$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { - keys: function keys(it) { - return nativeKeys(toObject(it)); - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/object-keys":216,"../internals/to-object":253}],350:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var DESCRIPTORS = require('../internals/descriptors'); -var FORCED = require('../internals/forced-object-prototype-accessors-methods'); -var toObject = require('../internals/to-object'); -var toPrimitive = require('../internals/to-primitive'); -var getPrototypeOf = require('../internals/object-get-prototype-of'); -var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; - -// `Object.prototype.__lookupGetter__` method -// https://tc39.github.io/ecma262/#sec-object.prototype.__lookupGetter__ -if (DESCRIPTORS) { - $({ target: 'Object', proto: true, forced: FORCED }, { - __lookupGetter__: function __lookupGetter__(P) { - var O = toObject(this); - var key = toPrimitive(P, true); - var desc; - do { - if (desc = getOwnPropertyDescriptor(O, key)) return desc.get; - } while (O = getPrototypeOf(O)); - } - }); -} - -},{"../internals/descriptors":156,"../internals/export":160,"../internals/forced-object-prototype-accessors-methods":164,"../internals/object-get-own-property-descriptor":210,"../internals/object-get-prototype-of":214,"../internals/to-object":253,"../internals/to-primitive":255}],351:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var DESCRIPTORS = require('../internals/descriptors'); -var FORCED = require('../internals/forced-object-prototype-accessors-methods'); -var toObject = require('../internals/to-object'); -var toPrimitive = require('../internals/to-primitive'); -var getPrototypeOf = require('../internals/object-get-prototype-of'); -var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; - -// `Object.prototype.__lookupSetter__` method -// https://tc39.github.io/ecma262/#sec-object.prototype.__lookupSetter__ -if (DESCRIPTORS) { - $({ target: 'Object', proto: true, forced: FORCED }, { - __lookupSetter__: function __lookupSetter__(P) { - var O = toObject(this); - var key = toPrimitive(P, true); - var desc; - do { - if (desc = getOwnPropertyDescriptor(O, key)) return desc.set; - } while (O = getPrototypeOf(O)); - } - }); -} - -},{"../internals/descriptors":156,"../internals/export":160,"../internals/forced-object-prototype-accessors-methods":164,"../internals/object-get-own-property-descriptor":210,"../internals/object-get-prototype-of":214,"../internals/to-object":253,"../internals/to-primitive":255}],352:[function(require,module,exports){ -var $ = require('../internals/export'); -var isObject = require('../internals/is-object'); -var onFreeze = require('../internals/internal-metadata').onFreeze; -var FREEZING = require('../internals/freezing'); -var fails = require('../internals/fails'); - -var nativePreventExtensions = Object.preventExtensions; -var FAILS_ON_PRIMITIVES = fails(function () { nativePreventExtensions(1); }); - -// `Object.preventExtensions` method -// https://tc39.github.io/ecma262/#sec-object.preventextensions -$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, { - preventExtensions: function preventExtensions(it) { - return nativePreventExtensions && isObject(it) ? nativePreventExtensions(onFreeze(it)) : it; - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/freezing":167,"../internals/internal-metadata":182,"../internals/is-object":188}],353:[function(require,module,exports){ -var $ = require('../internals/export'); -var isObject = require('../internals/is-object'); -var onFreeze = require('../internals/internal-metadata').onFreeze; -var FREEZING = require('../internals/freezing'); -var fails = require('../internals/fails'); - -var nativeSeal = Object.seal; -var FAILS_ON_PRIMITIVES = fails(function () { nativeSeal(1); }); - -// `Object.seal` method -// https://tc39.github.io/ecma262/#sec-object.seal -$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, { - seal: function seal(it) { - return nativeSeal && isObject(it) ? nativeSeal(onFreeze(it)) : it; - } -}); - -},{"../internals/export":160,"../internals/fails":161,"../internals/freezing":167,"../internals/internal-metadata":182,"../internals/is-object":188}],354:[function(require,module,exports){ -var $ = require('../internals/export'); -var setPrototypeOf = require('../internals/object-set-prototype-of'); - -// `Object.setPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-object.setprototypeof -$({ target: 'Object', stat: true }, { - setPrototypeOf: setPrototypeOf -}); - -},{"../internals/export":160,"../internals/object-set-prototype-of":218}],355:[function(require,module,exports){ -var redefine = require('../internals/redefine'); -var toString = require('../internals/object-to-string'); - -var ObjectPrototype = Object.prototype; - -// `Object.prototype.toString` method -// https://tc39.github.io/ecma262/#sec-object.prototype.tostring -if (toString !== ObjectPrototype.toString) { - redefine(ObjectPrototype, 'toString', toString, { unsafe: true }); -} - -},{"../internals/object-to-string":220,"../internals/redefine":229}],356:[function(require,module,exports){ -var $ = require('../internals/export'); -var $values = require('../internals/object-to-array').values; - -// `Object.values` method -// https://tc39.github.io/ecma262/#sec-object.values -$({ target: 'Object', stat: true }, { - values: function values(O) { - return $values(O); - } -}); - -},{"../internals/export":160,"../internals/object-to-array":219}],357:[function(require,module,exports){ -var $ = require('../internals/export'); -var parseFloatImplementation = require('../internals/parse-float'); - -// `parseFloat` method -// https://tc39.github.io/ecma262/#sec-parsefloat-string -$({ global: true, forced: parseFloat != parseFloatImplementation }, { - parseFloat: parseFloatImplementation -}); - -},{"../internals/export":160,"../internals/parse-float":222}],358:[function(require,module,exports){ -var $ = require('../internals/export'); -var parseIntImplementation = require('../internals/parse-int'); - -// `parseInt` method -// https://tc39.github.io/ecma262/#sec-parseint-string-radix -$({ global: true, forced: parseInt != parseIntImplementation }, { - parseInt: parseIntImplementation -}); - -},{"../internals/export":160,"../internals/parse-int":223}],359:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var IS_PURE = require('../internals/is-pure'); -var NativePromise = require('../internals/native-promise-constructor'); -var getBuiltIn = require('../internals/get-built-in'); -var speciesConstructor = require('../internals/species-constructor'); -var promiseResolve = require('../internals/promise-resolve'); -var redefine = require('../internals/redefine'); - -// `Promise.prototype.finally` method -// https://tc39.github.io/ecma262/#sec-promise.prototype.finally -$({ target: 'Promise', proto: true, real: true }, { - 'finally': function (onFinally) { - var C = speciesConstructor(this, getBuiltIn('Promise')); - var isFunction = typeof onFinally == 'function'; - return this.then( - isFunction ? function (x) { - return promiseResolve(C, onFinally()).then(function () { return x; }); - } : onFinally, - isFunction ? function (e) { - return promiseResolve(C, onFinally()).then(function () { throw e; }); - } : onFinally - ); - } -}); - -// patch native Promise.prototype for native async functions -if (!IS_PURE && typeof NativePromise == 'function' && !NativePromise.prototype['finally']) { - redefine(NativePromise.prototype, 'finally', getBuiltIn('Promise').prototype['finally']); -} - -},{"../internals/export":160,"../internals/get-built-in":170,"../internals/is-pure":189,"../internals/native-promise-constructor":199,"../internals/promise-resolve":226,"../internals/redefine":229,"../internals/species-constructor":241}],360:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var IS_PURE = require('../internals/is-pure'); -var global = require('../internals/global'); -var path = require('../internals/path'); -var NativePromise = require('../internals/native-promise-constructor'); -var redefine = require('../internals/redefine'); -var redefineAll = require('../internals/redefine-all'); -var setToStringTag = require('../internals/set-to-string-tag'); -var setSpecies = require('../internals/set-species'); -var isObject = require('../internals/is-object'); -var aFunction = require('../internals/a-function'); -var anInstance = require('../internals/an-instance'); -var classof = require('../internals/classof-raw'); -var iterate = require('../internals/iterate'); -var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); -var speciesConstructor = require('../internals/species-constructor'); -var task = require('../internals/task').set; -var microtask = require('../internals/microtask'); -var promiseResolve = require('../internals/promise-resolve'); -var hostReportErrors = require('../internals/host-report-errors'); -var newPromiseCapabilityModule = require('../internals/new-promise-capability'); -var perform = require('../internals/perform'); -var userAgent = require('../internals/user-agent'); -var InternalStateModule = require('../internals/internal-state'); -var isForced = require('../internals/is-forced'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var SPECIES = wellKnownSymbol('species'); -var PROMISE = 'Promise'; -var getInternalState = InternalStateModule.get; -var setInternalState = InternalStateModule.set; -var getInternalPromiseState = InternalStateModule.getterFor(PROMISE); -var PromiseConstructor = NativePromise; -var TypeError = global.TypeError; -var document = global.document; -var process = global.process; -var $fetch = global.fetch; -var versions = process && process.versions; -var v8 = versions && versions.v8 || ''; -var newPromiseCapability = newPromiseCapabilityModule.f; -var newGenericPromiseCapability = newPromiseCapability; -var IS_NODE = classof(process) == 'process'; -var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent); -var UNHANDLED_REJECTION = 'unhandledrejection'; -var REJECTION_HANDLED = 'rejectionhandled'; -var PENDING = 0; -var FULFILLED = 1; -var REJECTED = 2; -var HANDLED = 1; -var UNHANDLED = 2; -var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; - -var FORCED = isForced(PROMISE, function () { - // correct subclassing with @@species support - var promise = PromiseConstructor.resolve(1); - var empty = function () { /* empty */ }; - var FakePromise = (promise.constructor = {})[SPECIES] = function (exec) { - exec(empty, empty); - }; - // unhandled rejections tracking support, NodeJS Promise without it fails @@species test - return !((IS_NODE || typeof PromiseRejectionEvent == 'function') - && (!IS_PURE || promise['finally']) - && promise.then(empty) instanceof FakePromise - // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables - // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 - // we can't detect it synchronously, so just check versions - && v8.indexOf('6.6') !== 0 - && userAgent.indexOf('Chrome/66') === -1); -}); - -var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) { - PromiseConstructor.all(iterable)['catch'](function () { /* empty */ }); -}); - -// helpers -var isThenable = function (it) { - var then; - return isObject(it) && typeof (then = it.then) == 'function' ? then : false; -}; - -var notify = function (promise, state, isReject) { - if (state.notified) return; - state.notified = true; - var chain = state.reactions; - microtask(function () { - var value = state.value; - var ok = state.state == FULFILLED; - var index = 0; - // variable length - can't use forEach - while (chain.length > index) { - var reaction = chain[index++]; - var handler = ok ? reaction.ok : reaction.fail; - var resolve = reaction.resolve; - var reject = reaction.reject; - var domain = reaction.domain; - var result, then, exited; - try { - if (handler) { - if (!ok) { - if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state); - state.rejection = HANDLED; - } - if (handler === true) result = value; - else { - if (domain) domain.enter(); - result = handler(value); // can throw - if (domain) { - domain.exit(); - exited = true; - } - } - if (result === reaction.promise) { - reject(TypeError('Promise-chain cycle')); - } else if (then = isThenable(result)) { - then.call(result, resolve, reject); - } else resolve(result); - } else reject(value); - } catch (error) { - if (domain && !exited) domain.exit(); - reject(error); - } - } - state.reactions = []; - state.notified = false; - if (isReject && !state.rejection) onUnhandled(promise, state); - }); -}; - -var dispatchEvent = function (name, promise, reason) { - var event, handler; - if (DISPATCH_EVENT) { - event = document.createEvent('Event'); - event.promise = promise; - event.reason = reason; - event.initEvent(name, false, true); - global.dispatchEvent(event); - } else event = { promise: promise, reason: reason }; - if (handler = global['on' + name]) handler(event); - else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); -}; - -var onUnhandled = function (promise, state) { - task.call(global, function () { - var value = state.value; - var IS_UNHANDLED = isUnhandled(state); - var result; - if (IS_UNHANDLED) { - result = perform(function () { - if (IS_NODE) { - process.emit('unhandledRejection', value, promise); - } else dispatchEvent(UNHANDLED_REJECTION, promise, value); - }); - // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should - state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED; - if (result.error) throw result.value; - } - }); -}; - -var isUnhandled = function (state) { - return state.rejection !== HANDLED && !state.parent; -}; - -var onHandleUnhandled = function (promise, state) { - task.call(global, function () { - if (IS_NODE) { - process.emit('rejectionHandled', promise); - } else dispatchEvent(REJECTION_HANDLED, promise, state.value); - }); -}; - -var bind = function (fn, promise, state, unwrap) { - return function (value) { - fn(promise, state, value, unwrap); - }; -}; - -var internalReject = function (promise, state, value, unwrap) { - if (state.done) return; - state.done = true; - if (unwrap) state = unwrap; - state.value = value; - state.state = REJECTED; - notify(promise, state, true); -}; - -var internalResolve = function (promise, state, value, unwrap) { - if (state.done) return; - state.done = true; - if (unwrap) state = unwrap; - try { - if (promise === value) throw TypeError("Promise can't be resolved itself"); - var then = isThenable(value); - if (then) { - microtask(function () { - var wrapper = { done: false }; - try { - then.call(value, - bind(internalResolve, promise, wrapper, state), - bind(internalReject, promise, wrapper, state) - ); - } catch (error) { - internalReject(promise, wrapper, error, state); - } - }); - } else { - state.value = value; - state.state = FULFILLED; - notify(promise, state, false); - } - } catch (error) { - internalReject(promise, { done: false }, error, state); - } -}; - -// constructor polyfill -if (FORCED) { - // 25.4.3.1 Promise(executor) - PromiseConstructor = function Promise(executor) { - anInstance(this, PromiseConstructor, PROMISE); - aFunction(executor); - Internal.call(this); - var state = getInternalState(this); - try { - executor(bind(internalResolve, this, state), bind(internalReject, this, state)); - } catch (error) { - internalReject(this, state, error); - } - }; - // eslint-disable-next-line no-unused-vars - Internal = function Promise(executor) { - setInternalState(this, { - type: PROMISE, - done: false, - notified: false, - parent: false, - reactions: [], - rejection: false, - state: PENDING, - value: undefined - }); - }; - Internal.prototype = redefineAll(PromiseConstructor.prototype, { - // `Promise.prototype.then` method - // https://tc39.github.io/ecma262/#sec-promise.prototype.then - then: function then(onFulfilled, onRejected) { - var state = getInternalPromiseState(this); - var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); - reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; - reaction.fail = typeof onRejected == 'function' && onRejected; - reaction.domain = IS_NODE ? process.domain : undefined; - state.parent = true; - state.reactions.push(reaction); - if (state.state != PENDING) notify(this, state, false); - return reaction.promise; - }, - // `Promise.prototype.catch` method - // https://tc39.github.io/ecma262/#sec-promise.prototype.catch - 'catch': function (onRejected) { - return this.then(undefined, onRejected); - } - }); - OwnPromiseCapability = function () { - var promise = new Internal(); - var state = getInternalState(promise); - this.promise = promise; - this.resolve = bind(internalResolve, promise, state); - this.reject = bind(internalReject, promise, state); - }; - newPromiseCapabilityModule.f = newPromiseCapability = function (C) { - return C === PromiseConstructor || C === PromiseWrapper - ? new OwnPromiseCapability(C) - : newGenericPromiseCapability(C); - }; - - if (!IS_PURE && typeof NativePromise == 'function') { - nativeThen = NativePromise.prototype.then; - - // wrap native Promise#then for native async functions - redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) { - var that = this; - return new PromiseConstructor(function (resolve, reject) { - nativeThen.call(that, resolve, reject); - }).then(onFulfilled, onRejected); - }); - - // wrap fetch result - if (typeof $fetch == 'function') $({ global: true, enumerable: true, forced: true }, { - // eslint-disable-next-line no-unused-vars - fetch: function fetch(input) { - return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments)); - } - }); - } -} - -$({ global: true, wrap: true, forced: FORCED }, { - Promise: PromiseConstructor -}); - -setToStringTag(PromiseConstructor, PROMISE, false, true); -setSpecies(PROMISE); - -PromiseWrapper = path[PROMISE]; - -// statics -$({ target: PROMISE, stat: true, forced: FORCED }, { - // `Promise.reject` method - // https://tc39.github.io/ecma262/#sec-promise.reject - reject: function reject(r) { - var capability = newPromiseCapability(this); - capability.reject.call(undefined, r); - return capability.promise; - } -}); - -$({ target: PROMISE, stat: true, forced: IS_PURE || FORCED }, { - // `Promise.resolve` method - // https://tc39.github.io/ecma262/#sec-promise.resolve - resolve: function resolve(x) { - return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x); - } -}); - -$({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { - // `Promise.all` method - // https://tc39.github.io/ecma262/#sec-promise.all - all: function all(iterable) { - var C = this; - var capability = newPromiseCapability(C); - var resolve = capability.resolve; - var reject = capability.reject; - var result = perform(function () { - var $promiseResolve = aFunction(C.resolve); - var values = []; - var counter = 0; - var remaining = 1; - iterate(iterable, function (promise) { - var index = counter++; - var alreadyCalled = false; - values.push(undefined); - remaining++; - $promiseResolve.call(C, promise).then(function (value) { - if (alreadyCalled) return; - alreadyCalled = true; - values[index] = value; - --remaining || resolve(values); - }, reject); - }); - --remaining || resolve(values); - }); - if (result.error) reject(result.value); - return capability.promise; - }, - // `Promise.race` method - // https://tc39.github.io/ecma262/#sec-promise.race - race: function race(iterable) { - var C = this; - var capability = newPromiseCapability(C); - var reject = capability.reject; - var result = perform(function () { - var $promiseResolve = aFunction(C.resolve); - iterate(iterable, function (promise) { - $promiseResolve.call(C, promise).then(capability.resolve, reject); - }); - }); - if (result.error) reject(result.value); - return capability.promise; - } -}); - -},{"../internals/a-function":119,"../internals/an-instance":123,"../internals/check-correctness-of-iteration":139,"../internals/classof-raw":140,"../internals/export":160,"../internals/global":173,"../internals/host-report-errors":177,"../internals/internal-state":183,"../internals/is-forced":186,"../internals/is-object":188,"../internals/is-pure":189,"../internals/iterate":191,"../internals/microtask":198,"../internals/native-promise-constructor":199,"../internals/new-promise-capability":203,"../internals/path":224,"../internals/perform":225,"../internals/promise-resolve":226,"../internals/redefine":229,"../internals/redefine-all":228,"../internals/set-species":236,"../internals/set-to-string-tag":237,"../internals/species-constructor":241,"../internals/task":246,"../internals/user-agent":260,"../internals/well-known-symbol":262}],361:[function(require,module,exports){ -var $ = require('../internals/export'); -var getBuiltIn = require('../internals/get-built-in'); -var aFunction = require('../internals/a-function'); -var anObject = require('../internals/an-object'); -var fails = require('../internals/fails'); - -var nativeApply = getBuiltIn('Reflect', 'apply'); -var functionApply = Function.apply; - -// MS Edge argumentsList argument is optional -var OPTIONAL_ARGUMENTS_LIST = !fails(function () { - nativeApply(function () { /* empty */ }); -}); - -// `Reflect.apply` method -// https://tc39.github.io/ecma262/#sec-reflect.apply -$({ target: 'Reflect', stat: true, forced: OPTIONAL_ARGUMENTS_LIST }, { - apply: function apply(target, thisArgument, argumentsList) { - aFunction(target); - anObject(argumentsList); - return nativeApply - ? nativeApply(target, thisArgument, argumentsList) - : functionApply.call(target, thisArgument, argumentsList); - } -}); - -},{"../internals/a-function":119,"../internals/an-object":124,"../internals/export":160,"../internals/fails":161,"../internals/get-built-in":170}],362:[function(require,module,exports){ -var $ = require('../internals/export'); -var getBuiltIn = require('../internals/get-built-in'); -var aFunction = require('../internals/a-function'); -var anObject = require('../internals/an-object'); -var isObject = require('../internals/is-object'); -var create = require('../internals/object-create'); -var bind = require('../internals/function-bind'); -var fails = require('../internals/fails'); - -var nativeConstruct = getBuiltIn('Reflect', 'construct'); - -// `Reflect.construct` method -// https://tc39.github.io/ecma262/#sec-reflect.construct -// MS Edge supports only 2 arguments and argumentsList argument is optional -// FF Nightly sets third argument as `new.target`, but does not create `this` from it -var NEW_TARGET_BUG = fails(function () { - function F() { /* empty */ } - return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F); -}); -var ARGS_BUG = !fails(function () { - nativeConstruct(function () { /* empty */ }); -}); -var FORCED = NEW_TARGET_BUG || ARGS_BUG; - -$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, { - construct: function construct(Target, args /* , newTarget */) { - aFunction(Target); - anObject(args); - var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); - if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget); - if (Target == newTarget) { - // w/o altered newTarget, optimization for 0-4 arguments - switch (args.length) { - case 0: return new Target(); - case 1: return new Target(args[0]); - case 2: return new Target(args[0], args[1]); - case 3: return new Target(args[0], args[1], args[2]); - case 4: return new Target(args[0], args[1], args[2], args[3]); - } - // w/o altered newTarget, lot of arguments case - var $args = [null]; - $args.push.apply($args, args); - return new (bind.apply(Target, $args))(); - } - // with altered newTarget, not support built-in constructors - var proto = newTarget.prototype; - var instance = create(isObject(proto) ? proto : Object.prototype); - var result = Function.apply.call(Target, instance, args); - return isObject(result) ? result : instance; - } -}); - -},{"../internals/a-function":119,"../internals/an-object":124,"../internals/export":160,"../internals/fails":161,"../internals/function-bind":168,"../internals/get-built-in":170,"../internals/is-object":188,"../internals/object-create":207}],363:[function(require,module,exports){ -var $ = require('../internals/export'); -var DESCRIPTORS = require('../internals/descriptors'); -var anObject = require('../internals/an-object'); -var toPrimitive = require('../internals/to-primitive'); -var definePropertyModule = require('../internals/object-define-property'); -var fails = require('../internals/fails'); - -// MS Edge has broken Reflect.defineProperty - throwing instead of returning false -var ERROR_INSTEAD_OF_FALSE = fails(function () { - // eslint-disable-next-line no-undef - Reflect.defineProperty(definePropertyModule.f({}, 1, { value: 1 }), 1, { value: 2 }); -}); - -// `Reflect.defineProperty` method -// https://tc39.github.io/ecma262/#sec-reflect.defineproperty -$({ target: 'Reflect', stat: true, forced: ERROR_INSTEAD_OF_FALSE, sham: !DESCRIPTORS }, { - defineProperty: function defineProperty(target, propertyKey, attributes) { - anObject(target); - var key = toPrimitive(propertyKey, true); - anObject(attributes); - try { - definePropertyModule.f(target, key, attributes); - return true; - } catch (error) { - return false; - } - } -}); - -},{"../internals/an-object":124,"../internals/descriptors":156,"../internals/export":160,"../internals/fails":161,"../internals/object-define-property":209,"../internals/to-primitive":255}],364:[function(require,module,exports){ -var $ = require('../internals/export'); -var anObject = require('../internals/an-object'); -var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; - -// `Reflect.deleteProperty` method -// https://tc39.github.io/ecma262/#sec-reflect.deleteproperty -$({ target: 'Reflect', stat: true }, { - deleteProperty: function deleteProperty(target, propertyKey) { - var descriptor = getOwnPropertyDescriptor(anObject(target), propertyKey); - return descriptor && !descriptor.configurable ? false : delete target[propertyKey]; - } -}); - -},{"../internals/an-object":124,"../internals/export":160,"../internals/object-get-own-property-descriptor":210}],365:[function(require,module,exports){ -var $ = require('../internals/export'); -var DESCRIPTORS = require('../internals/descriptors'); -var anObject = require('../internals/an-object'); -var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); - -// `Reflect.getOwnPropertyDescriptor` method -// https://tc39.github.io/ecma262/#sec-reflect.getownpropertydescriptor -$({ target: 'Reflect', stat: true, sham: !DESCRIPTORS }, { - getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) { - return getOwnPropertyDescriptorModule.f(anObject(target), propertyKey); - } -}); - -},{"../internals/an-object":124,"../internals/descriptors":156,"../internals/export":160,"../internals/object-get-own-property-descriptor":210}],366:[function(require,module,exports){ -var $ = require('../internals/export'); -var anObject = require('../internals/an-object'); -var objectGetPrototypeOf = require('../internals/object-get-prototype-of'); -var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter'); - -// `Reflect.getPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-reflect.getprototypeof -$({ target: 'Reflect', stat: true, sham: !CORRECT_PROTOTYPE_GETTER }, { - getPrototypeOf: function getPrototypeOf(target) { - return objectGetPrototypeOf(anObject(target)); - } -}); - -},{"../internals/an-object":124,"../internals/correct-prototype-getter":147,"../internals/export":160,"../internals/object-get-prototype-of":214}],367:[function(require,module,exports){ -var $ = require('../internals/export'); -var isObject = require('../internals/is-object'); -var anObject = require('../internals/an-object'); -var has = require('../internals/has'); -var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); -var getPrototypeOf = require('../internals/object-get-prototype-of'); - -// `Reflect.get` method -// https://tc39.github.io/ecma262/#sec-reflect.get -function get(target, propertyKey /* , receiver */) { - var receiver = arguments.length < 3 ? target : arguments[2]; - var descriptor, prototype; - if (anObject(target) === receiver) return target[propertyKey]; - if (descriptor = getOwnPropertyDescriptorModule.f(target, propertyKey)) return has(descriptor, 'value') - ? descriptor.value - : descriptor.get === undefined - ? undefined - : descriptor.get.call(receiver); - if (isObject(prototype = getPrototypeOf(target))) return get(prototype, propertyKey, receiver); -} - -$({ target: 'Reflect', stat: true }, { - get: get -}); - -},{"../internals/an-object":124,"../internals/export":160,"../internals/has":174,"../internals/is-object":188,"../internals/object-get-own-property-descriptor":210,"../internals/object-get-prototype-of":214}],368:[function(require,module,exports){ -var $ = require('../internals/export'); - -// `Reflect.has` method -// https://tc39.github.io/ecma262/#sec-reflect.has -$({ target: 'Reflect', stat: true }, { - has: function has(target, propertyKey) { - return propertyKey in target; - } -}); - -},{"../internals/export":160}],369:[function(require,module,exports){ -var $ = require('../internals/export'); -var anObject = require('../internals/an-object'); - -var objectIsExtensible = Object.isExtensible; - -// `Reflect.isExtensible` method -// https://tc39.github.io/ecma262/#sec-reflect.isextensible -$({ target: 'Reflect', stat: true }, { - isExtensible: function isExtensible(target) { - anObject(target); - return objectIsExtensible ? objectIsExtensible(target) : true; - } -}); - -},{"../internals/an-object":124,"../internals/export":160}],370:[function(require,module,exports){ -var $ = require('../internals/export'); -var ownKeys = require('../internals/own-keys'); - -// `Reflect.ownKeys` method -// https://tc39.github.io/ecma262/#sec-reflect.ownkeys -$({ target: 'Reflect', stat: true }, { - ownKeys: ownKeys -}); - -},{"../internals/export":160,"../internals/own-keys":221}],371:[function(require,module,exports){ -var $ = require('../internals/export'); -var getBuiltIn = require('../internals/get-built-in'); -var anObject = require('../internals/an-object'); -var FREEZING = require('../internals/freezing'); - -// `Reflect.preventExtensions` method -// https://tc39.github.io/ecma262/#sec-reflect.preventextensions -$({ target: 'Reflect', stat: true, sham: !FREEZING }, { - preventExtensions: function preventExtensions(target) { - anObject(target); - try { - var objectPreventExtensions = getBuiltIn('Object', 'preventExtensions'); - if (objectPreventExtensions) objectPreventExtensions(target); - return true; - } catch (error) { - return false; - } - } -}); - -},{"../internals/an-object":124,"../internals/export":160,"../internals/freezing":167,"../internals/get-built-in":170}],372:[function(require,module,exports){ -var $ = require('../internals/export'); -var anObject = require('../internals/an-object'); -var aPossiblePrototype = require('../internals/a-possible-prototype'); -var objectSetPrototypeOf = require('../internals/object-set-prototype-of'); - -// `Reflect.setPrototypeOf` method -// https://tc39.github.io/ecma262/#sec-reflect.setprototypeof -if (objectSetPrototypeOf) $({ target: 'Reflect', stat: true }, { - setPrototypeOf: function setPrototypeOf(target, proto) { - anObject(target); - aPossiblePrototype(proto); - try { - objectSetPrototypeOf(target, proto); - return true; - } catch (error) { - return false; - } - } -}); - -},{"../internals/a-possible-prototype":120,"../internals/an-object":124,"../internals/export":160,"../internals/object-set-prototype-of":218}],373:[function(require,module,exports){ -var $ = require('../internals/export'); -var anObject = require('../internals/an-object'); -var isObject = require('../internals/is-object'); -var has = require('../internals/has'); -var definePropertyModule = require('../internals/object-define-property'); -var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); -var getPrototypeOf = require('../internals/object-get-prototype-of'); -var createPropertyDescriptor = require('../internals/create-property-descriptor'); - -// `Reflect.set` method -// https://tc39.github.io/ecma262/#sec-reflect.set -function set(target, propertyKey, V /* , receiver */) { - var receiver = arguments.length < 4 ? target : arguments[3]; - var ownDescriptor = getOwnPropertyDescriptorModule.f(anObject(target), propertyKey); - var existingDescriptor, prototype; - if (!ownDescriptor) { - if (isObject(prototype = getPrototypeOf(target))) { - return set(prototype, propertyKey, V, receiver); - } - ownDescriptor = createPropertyDescriptor(0); - } - if (has(ownDescriptor, 'value')) { - if (ownDescriptor.writable === false || !isObject(receiver)) return false; - if (existingDescriptor = getOwnPropertyDescriptorModule.f(receiver, propertyKey)) { - if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false; - existingDescriptor.value = V; - definePropertyModule.f(receiver, propertyKey, existingDescriptor); - } else definePropertyModule.f(receiver, propertyKey, createPropertyDescriptor(0, V)); - return true; - } - return ownDescriptor.set === undefined ? false : (ownDescriptor.set.call(receiver, V), true); -} - -$({ target: 'Reflect', stat: true }, { - set: set -}); - -},{"../internals/an-object":124,"../internals/create-property-descriptor":150,"../internals/export":160,"../internals/has":174,"../internals/is-object":188,"../internals/object-define-property":209,"../internals/object-get-own-property-descriptor":210,"../internals/object-get-prototype-of":214}],374:[function(require,module,exports){ -var DESCRIPTORS = require('../internals/descriptors'); -var global = require('../internals/global'); -var isForced = require('../internals/is-forced'); -var inheritIfRequired = require('../internals/inherit-if-required'); -var defineProperty = require('../internals/object-define-property').f; -var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; -var isRegExp = require('../internals/is-regexp'); -var getFlags = require('../internals/regexp-flags'); -var redefine = require('../internals/redefine'); -var fails = require('../internals/fails'); -var setSpecies = require('../internals/set-species'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var MATCH = wellKnownSymbol('match'); -var NativeRegExp = global.RegExp; -var RegExpPrototype = NativeRegExp.prototype; -var re1 = /a/g; -var re2 = /a/g; - -// "new" should create a new object, old webkit bug -var CORRECT_NEW = new NativeRegExp(re1) !== re1; - -var FORCED = DESCRIPTORS && isForced('RegExp', (!CORRECT_NEW || fails(function () { - re2[MATCH] = false; - // RegExp constructor can alter flags and IsRegExp works correct with @@match - return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; -}))); - -// `RegExp` constructor -// https://tc39.github.io/ecma262/#sec-regexp-constructor -if (FORCED) { - var RegExpWrapper = function RegExp(pattern, flags) { - var thisIsRegExp = this instanceof RegExpWrapper; - var patternIsRegExp = isRegExp(pattern); - var flagsAreUndefined = flags === undefined; - return !thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined ? pattern - : inheritIfRequired(CORRECT_NEW - ? new NativeRegExp(patternIsRegExp && !flagsAreUndefined ? pattern.source : pattern, flags) - : NativeRegExp((patternIsRegExp = pattern instanceof RegExpWrapper) - ? pattern.source - : pattern, patternIsRegExp && flagsAreUndefined ? getFlags.call(pattern) : flags) - , thisIsRegExp ? this : RegExpPrototype, RegExpWrapper); - }; - var proxy = function (key) { - key in RegExpWrapper || defineProperty(RegExpWrapper, key, { - configurable: true, - get: function () { return NativeRegExp[key]; }, - set: function (it) { NativeRegExp[key] = it; } - }); - }; - var keys = getOwnPropertyNames(NativeRegExp); - var index = 0; - while (keys.length > index) proxy(keys[index++]); - RegExpPrototype.constructor = RegExpWrapper; - RegExpWrapper.prototype = RegExpPrototype; - redefine(global, 'RegExp', RegExpWrapper); -} - -// https://tc39.github.io/ecma262/#sec-get-regexp-@@species -setSpecies('RegExp'); - -},{"../internals/descriptors":156,"../internals/fails":161,"../internals/global":173,"../internals/inherit-if-required":181,"../internals/is-forced":186,"../internals/is-regexp":190,"../internals/object-define-property":209,"../internals/object-get-own-property-names":212,"../internals/redefine":229,"../internals/regexp-flags":232,"../internals/set-species":236,"../internals/well-known-symbol":262}],375:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var exec = require('../internals/regexp-exec'); - -$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, { - exec: exec -}); - -},{"../internals/export":160,"../internals/regexp-exec":231}],376:[function(require,module,exports){ -var DESCRIPTORS = require('../internals/descriptors'); -var objectDefinePropertyModule = require('../internals/object-define-property'); -var regExpFlags = require('../internals/regexp-flags'); - -// `RegExp.prototype.flags` getter -// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags -if (DESCRIPTORS && /./g.flags != 'g') { - objectDefinePropertyModule.f(RegExp.prototype, 'flags', { - configurable: true, - get: regExpFlags - }); -} - -},{"../internals/descriptors":156,"../internals/object-define-property":209,"../internals/regexp-flags":232}],377:[function(require,module,exports){ -'use strict'; -var redefine = require('../internals/redefine'); -var anObject = require('../internals/an-object'); -var fails = require('../internals/fails'); -var flags = require('../internals/regexp-flags'); - -var TO_STRING = 'toString'; -var RegExpPrototype = RegExp.prototype; -var nativeToString = RegExpPrototype[TO_STRING]; - -var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); -// FF44- RegExp#toString has a wrong name -var INCORRECT_NAME = nativeToString.name != TO_STRING; - -// `RegExp.prototype.toString` method -// https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring -if (NOT_GENERIC || INCORRECT_NAME) { - redefine(RegExp.prototype, TO_STRING, function toString() { - var R = anObject(this); - var p = String(R.source); - var rf = R.flags; - var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf); - return '/' + p + '/' + f; - }, { unsafe: true }); -} - -},{"../internals/an-object":124,"../internals/fails":161,"../internals/redefine":229,"../internals/regexp-flags":232}],378:[function(require,module,exports){ -'use strict'; -var collection = require('../internals/collection'); -var collectionStrong = require('../internals/collection-strong'); - -// `Set` constructor -// https://tc39.github.io/ecma262/#sec-set-objects -module.exports = collection('Set', function (get) { - return function Set() { return get(this, arguments.length ? arguments[0] : undefined); }; -}, collectionStrong); - -},{"../internals/collection":144,"../internals/collection-strong":142}],379:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.anchor` method -// https://tc39.github.io/ecma262/#sec-string.prototype.anchor -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('anchor') }, { - anchor: function anchor(name) { - return createHTML(this, 'a', 'name', name); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],380:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.big` method -// https://tc39.github.io/ecma262/#sec-string.prototype.big -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('big') }, { - big: function big() { - return createHTML(this, 'big', '', ''); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],381:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.blink` method -// https://tc39.github.io/ecma262/#sec-string.prototype.blink -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('blink') }, { - blink: function blink() { - return createHTML(this, 'blink', '', ''); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],382:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.bold` method -// https://tc39.github.io/ecma262/#sec-string.prototype.bold -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('bold') }, { - bold: function bold() { - return createHTML(this, 'b', '', ''); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],383:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var codeAt = require('../internals/string-multibyte').codeAt; - -// `String.prototype.codePointAt` method -// https://tc39.github.io/ecma262/#sec-string.prototype.codepointat -$({ target: 'String', proto: true }, { - codePointAt: function codePointAt(pos) { - return codeAt(this, pos); - } -}); - -},{"../internals/export":160,"../internals/string-multibyte":242}],384:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var toLength = require('../internals/to-length'); -var notARegExp = require('../internals/not-a-regexp'); -var requireObjectCoercible = require('../internals/require-object-coercible'); -var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic'); - -var nativeEndsWith = ''.endsWith; -var min = Math.min; - -// `String.prototype.endsWith` method -// https://tc39.github.io/ecma262/#sec-string.prototype.endswith -$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('endsWith') }, { - endsWith: function endsWith(searchString /* , endPosition = @length */) { - var that = String(requireObjectCoercible(this)); - notARegExp(searchString); - var endPosition = arguments.length > 1 ? arguments[1] : undefined; - var len = toLength(that.length); - var end = endPosition === undefined ? len : min(toLength(endPosition), len); - var search = String(searchString); - return nativeEndsWith - ? nativeEndsWith.call(that, search, end) - : that.slice(end - search.length, end) === search; - } -}); - -},{"../internals/correct-is-regexp-logic":146,"../internals/export":160,"../internals/not-a-regexp":204,"../internals/require-object-coercible":233,"../internals/to-length":252}],385:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.fixed` method -// https://tc39.github.io/ecma262/#sec-string.prototype.fixed -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('fixed') }, { - fixed: function fixed() { - return createHTML(this, 'tt', '', ''); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],386:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.fontcolor` method -// https://tc39.github.io/ecma262/#sec-string.prototype.fontcolor -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('fontcolor') }, { - fontcolor: function fontcolor(color) { - return createHTML(this, 'font', 'color', color); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],387:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.fontsize` method -// https://tc39.github.io/ecma262/#sec-string.prototype.fontsize -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('fontsize') }, { - fontsize: function fontsize(size) { - return createHTML(this, 'font', 'size', size); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],388:[function(require,module,exports){ -var $ = require('../internals/export'); -var toAbsoluteIndex = require('../internals/to-absolute-index'); - -var fromCharCode = String.fromCharCode; -var nativeFromCodePoint = String.fromCodePoint; - -// length should be 1, old FF problem -var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1; - -// `String.fromCodePoint` method -// https://tc39.github.io/ecma262/#sec-string.fromcodepoint -$({ target: 'String', stat: true, forced: INCORRECT_LENGTH }, { - fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars - var elements = []; - var length = arguments.length; - var i = 0; - var code; - while (length > i) { - code = +arguments[i++]; - if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw RangeError(code + ' is not a valid code point'); - elements.push(code < 0x10000 - ? fromCharCode(code) - : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00) - ); - } return elements.join(''); - } -}); - -},{"../internals/export":160,"../internals/to-absolute-index":248}],389:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var notARegExp = require('../internals/not-a-regexp'); -var requireObjectCoercible = require('../internals/require-object-coercible'); -var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic'); - -// `String.prototype.includes` method -// https://tc39.github.io/ecma262/#sec-string.prototype.includes -$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, { - includes: function includes(searchString /* , position = 0 */) { - return !!~String(requireObjectCoercible(this)) - .indexOf(notARegExp(searchString), arguments.length > 1 ? arguments[1] : undefined); - } -}); - -},{"../internals/correct-is-regexp-logic":146,"../internals/export":160,"../internals/not-a-regexp":204,"../internals/require-object-coercible":233}],390:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.italics` method -// https://tc39.github.io/ecma262/#sec-string.prototype.italics -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('italics') }, { - italics: function italics() { - return createHTML(this, 'i', '', ''); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],391:[function(require,module,exports){ -'use strict'; -var charAt = require('../internals/string-multibyte').charAt; -var InternalStateModule = require('../internals/internal-state'); -var defineIterator = require('../internals/define-iterator'); - -var STRING_ITERATOR = 'String Iterator'; -var setInternalState = InternalStateModule.set; -var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); - -// `String.prototype[@@iterator]` method -// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator -defineIterator(String, 'String', function (iterated) { - setInternalState(this, { - type: STRING_ITERATOR, - string: String(iterated), - index: 0 - }); -// `%StringIteratorPrototype%.next` method -// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next -}, function next() { - var state = getInternalState(this); - var string = state.string; - var index = state.index; - var point; - if (index >= string.length) return { value: undefined, done: true }; - point = charAt(string, index); - state.index += point.length; - return { value: point, done: false }; -}); - -},{"../internals/define-iterator":154,"../internals/internal-state":183,"../internals/string-multibyte":242}],392:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.link` method -// https://tc39.github.io/ecma262/#sec-string.prototype.link -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('link') }, { - link: function link(url) { - return createHTML(this, 'a', 'href', url); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],393:[function(require,module,exports){ -'use strict'; -var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); -var anObject = require('../internals/an-object'); -var toLength = require('../internals/to-length'); -var requireObjectCoercible = require('../internals/require-object-coercible'); -var advanceStringIndex = require('../internals/advance-string-index'); -var regExpExec = require('../internals/regexp-exec-abstract'); - -// @@match logic -fixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) { - return [ - // `String.prototype.match` method - // https://tc39.github.io/ecma262/#sec-string.prototype.match - function match(regexp) { - var O = requireObjectCoercible(this); - var matcher = regexp == undefined ? undefined : regexp[MATCH]; - return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); - }, - // `RegExp.prototype[@@match]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match - function (regexp) { - var res = maybeCallNative(nativeMatch, regexp, this); - if (res.done) return res.value; - - var rx = anObject(regexp); - var S = String(this); - - if (!rx.global) return regExpExec(rx, S); - - var fullUnicode = rx.unicode; - rx.lastIndex = 0; - var A = []; - var n = 0; - var result; - while ((result = regExpExec(rx, S)) !== null) { - var matchStr = String(result[0]); - A[n] = matchStr; - if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); - n++; - } - return n === 0 ? null : A; - } - ]; -}); - -},{"../internals/advance-string-index":122,"../internals/an-object":124,"../internals/fix-regexp-well-known-symbol-logic":162,"../internals/regexp-exec-abstract":230,"../internals/require-object-coercible":233,"../internals/to-length":252}],394:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $padEnd = require('../internals/string-pad').end; -var WEBKIT_BUG = require('../internals/webkit-string-pad-bug'); - -// `String.prototype.padEnd` method -// https://tc39.github.io/ecma262/#sec-string.prototype.padend -$({ target: 'String', proto: true, forced: WEBKIT_BUG }, { - padEnd: function padEnd(maxLength /* , fillString = ' ' */) { - return $padEnd(this, maxLength, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -},{"../internals/export":160,"../internals/string-pad":243,"../internals/webkit-string-pad-bug":261}],395:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $padStart = require('../internals/string-pad').start; -var WEBKIT_BUG = require('../internals/webkit-string-pad-bug'); - -// `String.prototype.padStart` method -// https://tc39.github.io/ecma262/#sec-string.prototype.padstart -$({ target: 'String', proto: true, forced: WEBKIT_BUG }, { - padStart: function padStart(maxLength /* , fillString = ' ' */) { - return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -},{"../internals/export":160,"../internals/string-pad":243,"../internals/webkit-string-pad-bug":261}],396:[function(require,module,exports){ -var $ = require('../internals/export'); -var toIndexedObject = require('../internals/to-indexed-object'); -var toLength = require('../internals/to-length'); - -// `String.raw` method -// https://tc39.github.io/ecma262/#sec-string.raw -$({ target: 'String', stat: true }, { - raw: function raw(template) { - var rawTemplate = toIndexedObject(template.raw); - var literalSegments = toLength(rawTemplate.length); - var argumentsLength = arguments.length; - var elements = []; - var i = 0; - while (literalSegments > i) { - elements.push(String(rawTemplate[i++])); - if (i < argumentsLength) elements.push(String(arguments[i])); - } return elements.join(''); - } -}); - -},{"../internals/export":160,"../internals/to-indexed-object":250,"../internals/to-length":252}],397:[function(require,module,exports){ -var $ = require('../internals/export'); -var repeat = require('../internals/string-repeat'); - -// `String.prototype.repeat` method -// https://tc39.github.io/ecma262/#sec-string.prototype.repeat -$({ target: 'String', proto: true }, { - repeat: repeat -}); - -},{"../internals/export":160,"../internals/string-repeat":244}],398:[function(require,module,exports){ -'use strict'; -var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); -var anObject = require('../internals/an-object'); -var toObject = require('../internals/to-object'); -var toLength = require('../internals/to-length'); -var toInteger = require('../internals/to-integer'); -var requireObjectCoercible = require('../internals/require-object-coercible'); -var advanceStringIndex = require('../internals/advance-string-index'); -var regExpExec = require('../internals/regexp-exec-abstract'); - -var max = Math.max; -var min = Math.min; -var floor = Math.floor; -var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g; -var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g; - -var maybeToString = function (it) { - return it === undefined ? it : String(it); -}; - -// @@replace logic -fixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) { - return [ - // `String.prototype.replace` method - // https://tc39.github.io/ecma262/#sec-string.prototype.replace - function replace(searchValue, replaceValue) { - var O = requireObjectCoercible(this); - var replacer = searchValue == undefined ? undefined : searchValue[REPLACE]; - return replacer !== undefined - ? replacer.call(searchValue, O, replaceValue) - : nativeReplace.call(String(O), searchValue, replaceValue); - }, - // `RegExp.prototype[@@replace]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace - function (regexp, replaceValue) { - var res = maybeCallNative(nativeReplace, regexp, this, replaceValue); - if (res.done) return res.value; - - var rx = anObject(regexp); - var S = String(this); - - var functionalReplace = typeof replaceValue === 'function'; - if (!functionalReplace) replaceValue = String(replaceValue); - - var global = rx.global; - if (global) { - var fullUnicode = rx.unicode; - rx.lastIndex = 0; - } - var results = []; - while (true) { - var result = regExpExec(rx, S); - if (result === null) break; - - results.push(result); - if (!global) break; - - var matchStr = String(result[0]); - if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); - } - - var accumulatedResult = ''; - var nextSourcePosition = 0; - for (var i = 0; i < results.length; i++) { - result = results[i]; - - var matched = String(result[0]); - var position = max(min(toInteger(result.index), S.length), 0); - var captures = []; - // NOTE: This is equivalent to - // captures = result.slice(1).map(maybeToString) - // but for some reason `nativeSlice.call(result, 1, result.length)` (called in - // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and - // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. - for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); - var namedCaptures = result.groups; - if (functionalReplace) { - var replacerArgs = [matched].concat(captures, position, S); - if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); - var replacement = String(replaceValue.apply(undefined, replacerArgs)); - } else { - replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); - } - if (position >= nextSourcePosition) { - accumulatedResult += S.slice(nextSourcePosition, position) + replacement; - nextSourcePosition = position + matched.length; - } - } - return accumulatedResult + S.slice(nextSourcePosition); - } - ]; - - // https://tc39.github.io/ecma262/#sec-getsubstitution - function getSubstitution(matched, str, position, captures, namedCaptures, replacement) { - var tailPos = position + matched.length; - var m = captures.length; - var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; - if (namedCaptures !== undefined) { - namedCaptures = toObject(namedCaptures); - symbols = SUBSTITUTION_SYMBOLS; - } - return nativeReplace.call(replacement, symbols, function (match, ch) { - var capture; - switch (ch.charAt(0)) { - case '$': return '$'; - case '&': return matched; - case '`': return str.slice(0, position); - case "'": return str.slice(tailPos); - case '<': - capture = namedCaptures[ch.slice(1, -1)]; - break; - default: // \d\d? - var n = +ch; - if (n === 0) return match; - if (n > m) { - var f = floor(n / 10); - if (f === 0) return match; - if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); - return match; - } - capture = captures[n - 1]; - } - return capture === undefined ? '' : capture; - }); - } -}); - -},{"../internals/advance-string-index":122,"../internals/an-object":124,"../internals/fix-regexp-well-known-symbol-logic":162,"../internals/regexp-exec-abstract":230,"../internals/require-object-coercible":233,"../internals/to-integer":251,"../internals/to-length":252,"../internals/to-object":253}],399:[function(require,module,exports){ -'use strict'; -var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); -var anObject = require('../internals/an-object'); -var requireObjectCoercible = require('../internals/require-object-coercible'); -var sameValue = require('../internals/same-value'); -var regExpExec = require('../internals/regexp-exec-abstract'); - -// @@search logic -fixRegExpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) { - return [ - // `String.prototype.search` method - // https://tc39.github.io/ecma262/#sec-string.prototype.search - function search(regexp) { - var O = requireObjectCoercible(this); - var searcher = regexp == undefined ? undefined : regexp[SEARCH]; - return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); - }, - // `RegExp.prototype[@@search]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search - function (regexp) { - var res = maybeCallNative(nativeSearch, regexp, this); - if (res.done) return res.value; - - var rx = anObject(regexp); - var S = String(this); - - var previousLastIndex = rx.lastIndex; - if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0; - var result = regExpExec(rx, S); - if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex; - return result === null ? -1 : result.index; - } - ]; -}); - -},{"../internals/an-object":124,"../internals/fix-regexp-well-known-symbol-logic":162,"../internals/regexp-exec-abstract":230,"../internals/require-object-coercible":233,"../internals/same-value":234}],400:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.small` method -// https://tc39.github.io/ecma262/#sec-string.prototype.small -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('small') }, { - small: function small() { - return createHTML(this, 'small', '', ''); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],401:[function(require,module,exports){ -'use strict'; -var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); -var isRegExp = require('../internals/is-regexp'); -var anObject = require('../internals/an-object'); -var requireObjectCoercible = require('../internals/require-object-coercible'); -var speciesConstructor = require('../internals/species-constructor'); -var advanceStringIndex = require('../internals/advance-string-index'); -var toLength = require('../internals/to-length'); -var callRegExpExec = require('../internals/regexp-exec-abstract'); -var regexpExec = require('../internals/regexp-exec'); -var fails = require('../internals/fails'); - -var arrayPush = [].push; -var min = Math.min; -var MAX_UINT32 = 0xFFFFFFFF; - -// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError -var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); }); - -// @@split logic -fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) { - var internalSplit; - if ( - 'abbc'.split(/(b)*/)[1] == 'c' || - 'test'.split(/(?:)/, -1).length != 4 || - 'ab'.split(/(?:ab)*/).length != 2 || - '.'.split(/(.?)(.?)/).length != 4 || - '.'.split(/()()/).length > 1 || - ''.split(/.?/).length - ) { - // based on es5-shim implementation, need to rework it - internalSplit = function (separator, limit) { - var string = String(requireObjectCoercible(this)); - var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; - if (lim === 0) return []; - if (separator === undefined) return [string]; - // If `separator` is not a regex, use native split - if (!isRegExp(separator)) { - return nativeSplit.call(string, separator, lim); - } - var output = []; - var flags = (separator.ignoreCase ? 'i' : '') + - (separator.multiline ? 'm' : '') + - (separator.unicode ? 'u' : '') + - (separator.sticky ? 'y' : ''); - var lastLastIndex = 0; - // Make `global` and avoid `lastIndex` issues by working with a copy - var separatorCopy = new RegExp(separator.source, flags + 'g'); - var match, lastIndex, lastLength; - while (match = regexpExec.call(separatorCopy, string)) { - lastIndex = separatorCopy.lastIndex; - if (lastIndex > lastLastIndex) { - output.push(string.slice(lastLastIndex, match.index)); - if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1)); - lastLength = match[0].length; - lastLastIndex = lastIndex; - if (output.length >= lim) break; - } - if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop - } - if (lastLastIndex === string.length) { - if (lastLength || !separatorCopy.test('')) output.push(''); - } else output.push(string.slice(lastLastIndex)); - return output.length > lim ? output.slice(0, lim) : output; - }; - // Chakra, V8 - } else if ('0'.split(undefined, 0).length) { - internalSplit = function (separator, limit) { - return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit); - }; - } else internalSplit = nativeSplit; - - return [ - // `String.prototype.split` method - // https://tc39.github.io/ecma262/#sec-string.prototype.split - function split(separator, limit) { - var O = requireObjectCoercible(this); - var splitter = separator == undefined ? undefined : separator[SPLIT]; - return splitter !== undefined - ? splitter.call(separator, O, limit) - : internalSplit.call(String(O), separator, limit); - }, - // `RegExp.prototype[@@split]` method - // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split - // - // NOTE: This cannot be properly polyfilled in engines that don't support - // the 'y' flag. - function (regexp, limit) { - var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit); - if (res.done) return res.value; - - var rx = anObject(regexp); - var S = String(this); - var C = speciesConstructor(rx, RegExp); - - var unicodeMatching = rx.unicode; - var flags = (rx.ignoreCase ? 'i' : '') + - (rx.multiline ? 'm' : '') + - (rx.unicode ? 'u' : '') + - (SUPPORTS_Y ? 'y' : 'g'); - - // ^(? + rx + ) is needed, in combination with some S slicing, to - // simulate the 'y' flag. - var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); - var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; - if (lim === 0) return []; - if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : []; - var p = 0; - var q = 0; - var A = []; - while (q < S.length) { - splitter.lastIndex = SUPPORTS_Y ? q : 0; - var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q)); - var e; - if ( - z === null || - (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p - ) { - q = advanceStringIndex(S, q, unicodeMatching); - } else { - A.push(S.slice(p, q)); - if (A.length === lim) return A; - for (var i = 1; i <= z.length - 1; i++) { - A.push(z[i]); - if (A.length === lim) return A; - } - q = p = e; - } - } - A.push(S.slice(p)); - return A; - } - ]; -}, !SUPPORTS_Y); - -},{"../internals/advance-string-index":122,"../internals/an-object":124,"../internals/fails":161,"../internals/fix-regexp-well-known-symbol-logic":162,"../internals/is-regexp":190,"../internals/regexp-exec":231,"../internals/regexp-exec-abstract":230,"../internals/require-object-coercible":233,"../internals/species-constructor":241,"../internals/to-length":252}],402:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var toLength = require('../internals/to-length'); -var notARegExp = require('../internals/not-a-regexp'); -var requireObjectCoercible = require('../internals/require-object-coercible'); -var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic'); - -var nativeStartsWith = ''.startsWith; -var min = Math.min; - -// `String.prototype.startsWith` method -// https://tc39.github.io/ecma262/#sec-string.prototype.startswith -$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('startsWith') }, { - startsWith: function startsWith(searchString /* , position = 0 */) { - var that = String(requireObjectCoercible(this)); - notARegExp(searchString); - var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length)); - var search = String(searchString); - return nativeStartsWith - ? nativeStartsWith.call(that, search, index) - : that.slice(index, index + search.length) === search; - } -}); - -},{"../internals/correct-is-regexp-logic":146,"../internals/export":160,"../internals/not-a-regexp":204,"../internals/require-object-coercible":233,"../internals/to-length":252}],403:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.strike` method -// https://tc39.github.io/ecma262/#sec-string.prototype.strike -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('strike') }, { - strike: function strike() { - return createHTML(this, 'strike', '', ''); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],404:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.sub` method -// https://tc39.github.io/ecma262/#sec-string.prototype.sub -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('sub') }, { - sub: function sub() { - return createHTML(this, 'sub', '', ''); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],405:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var createHTML = require('../internals/create-html'); -var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - -// `String.prototype.sup` method -// https://tc39.github.io/ecma262/#sec-string.prototype.sup -$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('sup') }, { - sup: function sup() { - return createHTML(this, 'sup', '', ''); - } -}); - -},{"../internals/create-html":148,"../internals/export":160,"../internals/forced-string-html-method":165}],406:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $trimEnd = require('../internals/string-trim').end; -var forcedStringTrimMethod = require('../internals/forced-string-trim-method'); - -var FORCED = forcedStringTrimMethod('trimEnd'); - -var trimEnd = FORCED ? function trimEnd() { - return $trimEnd(this); -} : ''.trimEnd; - -// `String.prototype.{ trimEnd, trimRight }` methods -// https://github.com/tc39/ecmascript-string-left-right-trim -$({ target: 'String', proto: true, forced: FORCED }, { - trimEnd: trimEnd, - trimRight: trimEnd -}); - -},{"../internals/export":160,"../internals/forced-string-trim-method":166,"../internals/string-trim":245}],407:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $trimStart = require('../internals/string-trim').start; -var forcedStringTrimMethod = require('../internals/forced-string-trim-method'); - -var FORCED = forcedStringTrimMethod('trimStart'); - -var trimStart = FORCED ? function trimStart() { - return $trimStart(this); -} : ''.trimStart; - -// `String.prototype.{ trimStart, trimLeft }` methods -// https://github.com/tc39/ecmascript-string-left-right-trim -$({ target: 'String', proto: true, forced: FORCED }, { - trimStart: trimStart, - trimLeft: trimStart -}); - -},{"../internals/export":160,"../internals/forced-string-trim-method":166,"../internals/string-trim":245}],408:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var $trim = require('../internals/string-trim').trim; -var forcedStringTrimMethod = require('../internals/forced-string-trim-method'); - -// `String.prototype.trim` method -// https://tc39.github.io/ecma262/#sec-string.prototype.trim -$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { - trim: function trim() { - return $trim(this); - } -}); - -},{"../internals/export":160,"../internals/forced-string-trim-method":166,"../internals/string-trim":245}],409:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.asyncIterator` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.asynciterator -defineWellKnownSymbol('asyncIterator'); - -},{"../internals/define-well-known-symbol":155}],410:[function(require,module,exports){ -// `Symbol.prototype.description` getter -// https://tc39.github.io/ecma262/#sec-symbol.prototype.description -'use strict'; -var $ = require('../internals/export'); -var DESCRIPTORS = require('../internals/descriptors'); -var global = require('../internals/global'); -var has = require('../internals/has'); -var isObject = require('../internals/is-object'); -var defineProperty = require('../internals/object-define-property').f; -var copyConstructorProperties = require('../internals/copy-constructor-properties'); - -var NativeSymbol = global.Symbol; - -if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) || - // Safari 12 bug - NativeSymbol().description !== undefined -)) { - var EmptyStringDescriptionStore = {}; - // wrap Symbol constructor for correct work with undefined description - var SymbolWrapper = function Symbol() { - var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]); - var result = this instanceof SymbolWrapper - ? new NativeSymbol(description) - // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)' - : description === undefined ? NativeSymbol() : NativeSymbol(description); - if (description === '') EmptyStringDescriptionStore[result] = true; - return result; - }; - copyConstructorProperties(SymbolWrapper, NativeSymbol); - var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype; - symbolPrototype.constructor = SymbolWrapper; - - var symbolToString = symbolPrototype.toString; - var native = String(NativeSymbol('test')) == 'Symbol(test)'; - var regexp = /^Symbol\((.*)\)[^)]+$/; - defineProperty(symbolPrototype, 'description', { - configurable: true, - get: function description() { - var symbol = isObject(this) ? this.valueOf() : this; - var string = symbolToString.call(symbol); - if (has(EmptyStringDescriptionStore, symbol)) return ''; - var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1'); - return desc === '' ? undefined : desc; - } - }); - - $({ global: true, forced: true }, { - Symbol: SymbolWrapper - }); -} - -},{"../internals/copy-constructor-properties":145,"../internals/descriptors":156,"../internals/export":160,"../internals/global":173,"../internals/has":174,"../internals/is-object":188,"../internals/object-define-property":209}],411:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.hasInstance` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.hasinstance -defineWellKnownSymbol('hasInstance'); - -},{"../internals/define-well-known-symbol":155}],412:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.isConcatSpreadable` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable -defineWellKnownSymbol('isConcatSpreadable'); - -},{"../internals/define-well-known-symbol":155}],413:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.iterator` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.iterator -defineWellKnownSymbol('iterator'); - -},{"../internals/define-well-known-symbol":155}],414:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); -var global = require('../internals/global'); -var IS_PURE = require('../internals/is-pure'); -var DESCRIPTORS = require('../internals/descriptors'); -var NATIVE_SYMBOL = require('../internals/native-symbol'); -var fails = require('../internals/fails'); -var has = require('../internals/has'); -var isArray = require('../internals/is-array'); -var isObject = require('../internals/is-object'); -var anObject = require('../internals/an-object'); -var toObject = require('../internals/to-object'); -var toIndexedObject = require('../internals/to-indexed-object'); -var toPrimitive = require('../internals/to-primitive'); -var createPropertyDescriptor = require('../internals/create-property-descriptor'); -var nativeObjectCreate = require('../internals/object-create'); -var objectKeys = require('../internals/object-keys'); -var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names'); -var getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external'); -var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols'); -var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); -var definePropertyModule = require('../internals/object-define-property'); -var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); -var hide = require('../internals/hide'); -var redefine = require('../internals/redefine'); -var shared = require('../internals/shared'); -var sharedKey = require('../internals/shared-key'); -var hiddenKeys = require('../internals/hidden-keys'); -var uid = require('../internals/uid'); -var wellKnownSymbol = require('../internals/well-known-symbol'); -var wrappedWellKnownSymbolModule = require('../internals/wrapped-well-known-symbol'); -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); -var setToStringTag = require('../internals/set-to-string-tag'); -var InternalStateModule = require('../internals/internal-state'); -var $forEach = require('../internals/array-iteration').forEach; - -var HIDDEN = sharedKey('hidden'); -var SYMBOL = 'Symbol'; -var PROTOTYPE = 'prototype'; -var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); -var setInternalState = InternalStateModule.set; -var getInternalState = InternalStateModule.getterFor(SYMBOL); -var ObjectPrototype = Object[PROTOTYPE]; -var $Symbol = global.Symbol; -var JSON = global.JSON; -var nativeJSONStringify = JSON && JSON.stringify; -var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; -var nativeDefineProperty = definePropertyModule.f; -var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; -var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; -var AllSymbols = shared('symbols'); -var ObjectPrototypeSymbols = shared('op-symbols'); -var StringToSymbolRegistry = shared('string-to-symbol-registry'); -var SymbolToStringRegistry = shared('symbol-to-string-registry'); -var WellKnownSymbolsStore = shared('wks'); -var QObject = global.QObject; -// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 -var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; - -// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 -var setSymbolDescriptor = DESCRIPTORS && fails(function () { - return nativeObjectCreate(nativeDefineProperty({}, 'a', { - get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; } - })).a != 7; -}) ? function (O, P, Attributes) { - var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P); - if (ObjectPrototypeDescriptor) delete ObjectPrototype[P]; - nativeDefineProperty(O, P, Attributes); - if (ObjectPrototypeDescriptor && O !== ObjectPrototype) { - nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor); - } -} : nativeDefineProperty; - -var wrap = function (tag, description) { - var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]); - setInternalState(symbol, { - type: SYMBOL, - tag: tag, - description: description - }); - if (!DESCRIPTORS) symbol.description = description; - return symbol; -}; - -var isSymbol = NATIVE_SYMBOL && typeof $Symbol.iterator == 'symbol' ? function (it) { - return typeof it == 'symbol'; -} : function (it) { - return Object(it) instanceof $Symbol; -}; - -var $defineProperty = function defineProperty(O, P, Attributes) { - if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes); - anObject(O); - var key = toPrimitive(P, true); - anObject(Attributes); - if (has(AllSymbols, key)) { - if (!Attributes.enumerable) { - if (!has(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); - O[HIDDEN][key] = true; - } else { - if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; - Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) }); - } return setSymbolDescriptor(O, key, Attributes); - } return nativeDefineProperty(O, key, Attributes); -}; - -var $defineProperties = function defineProperties(O, Properties) { - anObject(O); - var properties = toIndexedObject(Properties); - var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); - $forEach(keys, function (key) { - if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]); - }); - return O; -}; - -var $create = function create(O, Properties) { - return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); -}; - -var $propertyIsEnumerable = function propertyIsEnumerable(V) { - var P = toPrimitive(V, true); - var enumerable = nativePropertyIsEnumerable.call(this, P); - if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false; - return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; -}; - -var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { - var it = toIndexedObject(O); - var key = toPrimitive(P, true); - if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return; - var descriptor = nativeGetOwnPropertyDescriptor(it, key); - if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) { - descriptor.enumerable = true; - } - return descriptor; -}; - -var $getOwnPropertyNames = function getOwnPropertyNames(O) { - var names = nativeGetOwnPropertyNames(toIndexedObject(O)); - var result = []; - $forEach(names, function (key) { - if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key); - }); - return result; -}; - -var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { - var IS_OBJECT_PROTOTYPE = O === ObjectPrototype; - var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); - var result = []; - $forEach(names, function (key) { - if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) { - result.push(AllSymbols[key]); - } - }); - return result; -}; - -// `Symbol` constructor -// https://tc39.github.io/ecma262/#sec-symbol-constructor -if (!NATIVE_SYMBOL) { - $Symbol = function Symbol() { - if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor'); - var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]); - var tag = uid(description); - var setter = function (value) { - if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value); - if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; - setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value)); - }; - if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter }); - return wrap(tag, description); - }; - - redefine($Symbol[PROTOTYPE], 'toString', function toString() { - return getInternalState(this).tag; - }); - - propertyIsEnumerableModule.f = $propertyIsEnumerable; - definePropertyModule.f = $defineProperty; - getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor; - getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; - getOwnPropertySymbolsModule.f = $getOwnPropertySymbols; - - if (DESCRIPTORS) { - // https://github.com/tc39/proposal-Symbol-description - nativeDefineProperty($Symbol[PROTOTYPE], 'description', { - configurable: true, - get: function description() { - return getInternalState(this).description; - } - }); - if (!IS_PURE) { - redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true }); - } - } - - wrappedWellKnownSymbolModule.f = function (name) { - return wrap(wellKnownSymbol(name), name); - }; -} - -$({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, { - Symbol: $Symbol -}); - -$forEach(objectKeys(WellKnownSymbolsStore), function (name) { - defineWellKnownSymbol(name); -}); - -$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, { - // `Symbol.for` method - // https://tc39.github.io/ecma262/#sec-symbol.for - 'for': function (key) { - var string = String(key); - if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; - var symbol = $Symbol(string); - StringToSymbolRegistry[string] = symbol; - SymbolToStringRegistry[symbol] = string; - return symbol; - }, - // `Symbol.keyFor` method - // https://tc39.github.io/ecma262/#sec-symbol.keyfor - keyFor: function keyFor(sym) { - if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol'); - if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; - }, - useSetter: function () { USE_SETTER = true; }, - useSimple: function () { USE_SETTER = false; } -}); - -$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, { - // `Object.create` method - // https://tc39.github.io/ecma262/#sec-object.create - create: $create, - // `Object.defineProperty` method - // https://tc39.github.io/ecma262/#sec-object.defineproperty - defineProperty: $defineProperty, - // `Object.defineProperties` method - // https://tc39.github.io/ecma262/#sec-object.defineproperties - defineProperties: $defineProperties, - // `Object.getOwnPropertyDescriptor` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors - getOwnPropertyDescriptor: $getOwnPropertyDescriptor -}); - -$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, { - // `Object.getOwnPropertyNames` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertynames - getOwnPropertyNames: $getOwnPropertyNames, - // `Object.getOwnPropertySymbols` method - // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols - getOwnPropertySymbols: $getOwnPropertySymbols -}); - -// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives -// https://bugs.chromium.org/p/v8/issues/detail?id=3443 -$({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, { - getOwnPropertySymbols: function getOwnPropertySymbols(it) { - return getOwnPropertySymbolsModule.f(toObject(it)); - } -}); - -// `JSON.stringify` method behavior with symbols -// https://tc39.github.io/ecma262/#sec-json.stringify -JSON && $({ target: 'JSON', stat: true, forced: !NATIVE_SYMBOL || fails(function () { - var symbol = $Symbol(); - // MS Edge converts symbol values to JSON as {} - return nativeJSONStringify([symbol]) != '[null]' - // WebKit converts symbol values to JSON as null - || nativeJSONStringify({ a: symbol }) != '{}' - // V8 throws on boxed symbols - || nativeJSONStringify(Object(symbol)) != '{}'; -}) }, { - stringify: function stringify(it) { - var args = [it]; - var index = 1; - var replacer, $replacer; - while (arguments.length > index) args.push(arguments[index++]); - $replacer = replacer = args[1]; - if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined - if (!isArray(replacer)) replacer = function (key, value) { - if (typeof $replacer == 'function') value = $replacer.call(this, key, value); - if (!isSymbol(value)) return value; - }; - args[1] = replacer; - return nativeJSONStringify.apply(JSON, args); - } -}); - -// `Symbol.prototype[@@toPrimitive]` method -// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive -if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) hide($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); -// `Symbol.prototype[@@toStringTag]` property -// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag -setToStringTag($Symbol, SYMBOL); - -hiddenKeys[HIDDEN] = true; - -},{"../internals/an-object":124,"../internals/array-iteration":132,"../internals/create-property-descriptor":150,"../internals/define-well-known-symbol":155,"../internals/descriptors":156,"../internals/export":160,"../internals/fails":161,"../internals/global":173,"../internals/has":174,"../internals/hidden-keys":175,"../internals/hide":176,"../internals/internal-state":183,"../internals/is-array":185,"../internals/is-object":188,"../internals/is-pure":189,"../internals/native-symbol":200,"../internals/object-create":207,"../internals/object-define-property":209,"../internals/object-get-own-property-descriptor":210,"../internals/object-get-own-property-names":212,"../internals/object-get-own-property-names-external":211,"../internals/object-get-own-property-symbols":213,"../internals/object-keys":216,"../internals/object-property-is-enumerable":217,"../internals/redefine":229,"../internals/set-to-string-tag":237,"../internals/shared":239,"../internals/shared-key":238,"../internals/to-indexed-object":250,"../internals/to-object":253,"../internals/to-primitive":255,"../internals/uid":259,"../internals/well-known-symbol":262,"../internals/wrapped-well-known-symbol":264}],415:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.match` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.match -defineWellKnownSymbol('match'); - -},{"../internals/define-well-known-symbol":155}],416:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.replace` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.replace -defineWellKnownSymbol('replace'); - -},{"../internals/define-well-known-symbol":155}],417:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.search` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.search -defineWellKnownSymbol('search'); - -},{"../internals/define-well-known-symbol":155}],418:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.species` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.species -defineWellKnownSymbol('species'); - -},{"../internals/define-well-known-symbol":155}],419:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.split` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.split -defineWellKnownSymbol('split'); - -},{"../internals/define-well-known-symbol":155}],420:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.toPrimitive` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.toprimitive -defineWellKnownSymbol('toPrimitive'); - -},{"../internals/define-well-known-symbol":155}],421:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.toStringTag` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.tostringtag -defineWellKnownSymbol('toStringTag'); - -},{"../internals/define-well-known-symbol":155}],422:[function(require,module,exports){ -var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); - -// `Symbol.unscopables` well-known symbol -// https://tc39.github.io/ecma262/#sec-symbol.unscopables -defineWellKnownSymbol('unscopables'); - -},{"../internals/define-well-known-symbol":155}],423:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $copyWithin = require('../internals/array-copy-within'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.copyWithin` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.copywithin -ArrayBufferViewCore.exportProto('copyWithin', function copyWithin(target, start /* , end */) { - return $copyWithin.call(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-copy-within":127}],424:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $every = require('../internals/array-iteration').every; - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.every` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.every -ArrayBufferViewCore.exportProto('every', function every(callbackfn /* , thisArg */) { - return $every(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-iteration":132}],425:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $fill = require('../internals/array-fill'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.fill` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.fill -// eslint-disable-next-line no-unused-vars -ArrayBufferViewCore.exportProto('fill', function fill(value /* , start, end */) { - return $fill.apply(aTypedArray(this), arguments); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-fill":128}],426:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $filter = require('../internals/array-iteration').filter; -var speciesConstructor = require('../internals/species-constructor'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; -var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; - -// `%TypedArray%.prototype.filter` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.filter -ArrayBufferViewCore.exportProto('filter', function filter(callbackfn /* , thisArg */) { - var list = $filter(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); - var C = speciesConstructor(this, this.constructor); - var index = 0; - var length = list.length; - var result = new (aTypedArrayConstructor(C))(length); - while (length > index) result[index] = list[index++]; - return result; -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-iteration":132,"../internals/species-constructor":241}],427:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $findIndex = require('../internals/array-iteration').findIndex; - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.findIndex` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.findindex -ArrayBufferViewCore.exportProto('findIndex', function findIndex(predicate /* , thisArg */) { - return $findIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-iteration":132}],428:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $find = require('../internals/array-iteration').find; - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.find` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.find -ArrayBufferViewCore.exportProto('find', function find(predicate /* , thisArg */) { - return $find(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-iteration":132}],429:[function(require,module,exports){ -var typedArrayConstructor = require('../internals/typed-array-constructor'); - -// `Float32Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects -typedArrayConstructor('Float32', 4, function (init) { - return function Float32Array(data, byteOffset, length) { - return init(this, data, byteOffset, length); - }; -}); - -},{"../internals/typed-array-constructor":256}],430:[function(require,module,exports){ -var typedArrayConstructor = require('../internals/typed-array-constructor'); - -// `Float64Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects -typedArrayConstructor('Float64', 8, function (init) { - return function Float64Array(data, byteOffset, length) { - return init(this, data, byteOffset, length); - }; -}); - -},{"../internals/typed-array-constructor":256}],431:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $forEach = require('../internals/array-iteration').forEach; - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.forEach` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.foreach -ArrayBufferViewCore.exportProto('forEach', function forEach(callbackfn /* , thisArg */) { - $forEach(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-iteration":132}],432:[function(require,module,exports){ -'use strict'; -var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers'); -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var typedArrayFrom = require('../internals/typed-array-from'); - -// `%TypedArray%.from` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.from -ArrayBufferViewCore.exportStatic('from', typedArrayFrom, TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS); - -},{"../internals/array-buffer-view-core":125,"../internals/typed-array-from":257,"../internals/typed-arrays-constructors-requires-wrappers":258}],433:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $includes = require('../internals/array-includes').includes; - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.includes` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.includes -ArrayBufferViewCore.exportProto('includes', function includes(searchElement /* , fromIndex */) { - return $includes(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-includes":131}],434:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $indexOf = require('../internals/array-includes').indexOf; - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.indexOf` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.indexof -ArrayBufferViewCore.exportProto('indexOf', function indexOf(searchElement /* , fromIndex */) { - return $indexOf(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-includes":131}],435:[function(require,module,exports){ -var typedArrayConstructor = require('../internals/typed-array-constructor'); - -// `Int16Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects -typedArrayConstructor('Int16', 2, function (init) { - return function Int16Array(data, byteOffset, length) { - return init(this, data, byteOffset, length); - }; -}); - -},{"../internals/typed-array-constructor":256}],436:[function(require,module,exports){ -var typedArrayConstructor = require('../internals/typed-array-constructor'); - -// `Int32Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects -typedArrayConstructor('Int32', 4, function (init) { - return function Int32Array(data, byteOffset, length) { - return init(this, data, byteOffset, length); - }; -}); - -},{"../internals/typed-array-constructor":256}],437:[function(require,module,exports){ -var typedArrayConstructor = require('../internals/typed-array-constructor'); - -// `Int8Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects -typedArrayConstructor('Int8', 1, function (init) { - return function Int8Array(data, byteOffset, length) { - return init(this, data, byteOffset, length); - }; -}); - -},{"../internals/typed-array-constructor":256}],438:[function(require,module,exports){ -'use strict'; -var global = require('../internals/global'); -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var ArrayIterators = require('../modules/es.array.iterator'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var ITERATOR = wellKnownSymbol('iterator'); -var Uint8Array = global.Uint8Array; -var arrayValues = ArrayIterators.values; -var arrayKeys = ArrayIterators.keys; -var arrayEntries = ArrayIterators.entries; -var aTypedArray = ArrayBufferViewCore.aTypedArray; -var exportProto = ArrayBufferViewCore.exportProto; -var nativeTypedArrayIterator = Uint8Array && Uint8Array.prototype[ITERATOR]; - -var CORRECT_ITER_NAME = !!nativeTypedArrayIterator - && (nativeTypedArrayIterator.name == 'values' || nativeTypedArrayIterator.name == undefined); - -var typedArrayValues = function values() { - return arrayValues.call(aTypedArray(this)); -}; - -// `%TypedArray%.prototype.entries` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.entries -exportProto('entries', function entries() { - return arrayEntries.call(aTypedArray(this)); -}); -// `%TypedArray%.prototype.keys` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.keys -exportProto('keys', function keys() { - return arrayKeys.call(aTypedArray(this)); -}); -// `%TypedArray%.prototype.values` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.values -exportProto('values', typedArrayValues, !CORRECT_ITER_NAME); -// `%TypedArray%.prototype[@@iterator]` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype-@@iterator -exportProto(ITERATOR, typedArrayValues, !CORRECT_ITER_NAME); - -},{"../internals/array-buffer-view-core":125,"../internals/global":173,"../internals/well-known-symbol":262,"../modules/es.array.iterator":281}],439:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; -var $join = [].join; - -// `%TypedArray%.prototype.join` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join -// eslint-disable-next-line no-unused-vars -ArrayBufferViewCore.exportProto('join', function join(separator) { - return $join.apply(aTypedArray(this), arguments); -}); - -},{"../internals/array-buffer-view-core":125}],440:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $lastIndexOf = require('../internals/array-last-index-of'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.lastIndexOf` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.lastindexof -// eslint-disable-next-line no-unused-vars -ArrayBufferViewCore.exportProto('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) { - return $lastIndexOf.apply(aTypedArray(this), arguments); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-last-index-of":133}],441:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $map = require('../internals/array-iteration').map; -var speciesConstructor = require('../internals/species-constructor'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; -var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; - -// `%TypedArray%.prototype.map` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.map -ArrayBufferViewCore.exportProto('map', function map(mapfn /* , thisArg */) { - return $map(aTypedArray(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) { - return new (aTypedArrayConstructor(speciesConstructor(O, O.constructor)))(length); - }); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-iteration":132,"../internals/species-constructor":241}],442:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers'); - -var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; - -// `%TypedArray%.of` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.of -ArrayBufferViewCore.exportStatic('of', function of(/* ...items */) { - var index = 0; - var length = arguments.length; - var result = new (aTypedArrayConstructor(this))(length); - while (length > index) result[index] = arguments[index++]; - return result; -}, TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS); - -},{"../internals/array-buffer-view-core":125,"../internals/typed-arrays-constructors-requires-wrappers":258}],443:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $reduceRight = require('../internals/array-reduce').right; - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.reduceRicht` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduceright -ArrayBufferViewCore.exportProto('reduceRight', function reduceRight(callbackfn /* , initialValue */) { - return $reduceRight(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-reduce":135}],444:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $reduce = require('../internals/array-reduce').left; - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.reduce` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduce -ArrayBufferViewCore.exportProto('reduce', function reduce(callbackfn /* , initialValue */) { - return $reduce(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-reduce":135}],445:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; -var floor = Math.floor; - -// `%TypedArray%.prototype.reverse` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reverse -ArrayBufferViewCore.exportProto('reverse', function reverse() { - var that = this; - var length = aTypedArray(that).length; - var middle = floor(length / 2); - var index = 0; - var value; - while (index < middle) { - value = that[index]; - that[index++] = that[--length]; - that[length] = value; - } return that; -}); - -},{"../internals/array-buffer-view-core":125}],446:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var toLength = require('../internals/to-length'); -var toOffset = require('../internals/to-offset'); -var toObject = require('../internals/to-object'); -var fails = require('../internals/fails'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -var FORCED = fails(function () { - // eslint-disable-next-line no-undef - new Int8Array(1).set({}); -}); - -// `%TypedArray%.prototype.set` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.set -ArrayBufferViewCore.exportProto('set', function set(arrayLike /* , offset */) { - aTypedArray(this); - var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1); - var length = this.length; - var src = toObject(arrayLike); - var len = toLength(src.length); - var index = 0; - if (len + offset > length) throw RangeError('Wrong length'); - while (index < len) this[offset + index] = src[index++]; -}, FORCED); - -},{"../internals/array-buffer-view-core":125,"../internals/fails":161,"../internals/to-length":252,"../internals/to-object":253,"../internals/to-offset":254}],447:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var speciesConstructor = require('../internals/species-constructor'); -var fails = require('../internals/fails'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; -var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; -var $slice = [].slice; - -var FORCED = fails(function () { - // eslint-disable-next-line no-undef - new Int8Array(1).slice(); -}); - -// `%TypedArray%.prototype.slice` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.slice -ArrayBufferViewCore.exportProto('slice', function slice(start, end) { - var list = $slice.call(aTypedArray(this), start, end); - var C = speciesConstructor(this, this.constructor); - var index = 0; - var length = list.length; - var result = new (aTypedArrayConstructor(C))(length); - while (length > index) result[index] = list[index++]; - return result; -}, FORCED); - -},{"../internals/array-buffer-view-core":125,"../internals/fails":161,"../internals/species-constructor":241}],448:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var $some = require('../internals/array-iteration').some; - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.some` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.some -ArrayBufferViewCore.exportProto('some', function some(callbackfn /* , thisArg */) { - return $some(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/array-iteration":132}],449:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; -var $sort = [].sort; - -// `%TypedArray%.prototype.sort` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.sort -ArrayBufferViewCore.exportProto('sort', function sort(comparefn) { - return $sort.call(aTypedArray(this), comparefn); -}); - -},{"../internals/array-buffer-view-core":125}],450:[function(require,module,exports){ -'use strict'; -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var toLength = require('../internals/to-length'); -var toAbsoluteIndex = require('../internals/to-absolute-index'); -var speciesConstructor = require('../internals/species-constructor'); - -var aTypedArray = ArrayBufferViewCore.aTypedArray; - -// `%TypedArray%.prototype.subarray` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.subarray -ArrayBufferViewCore.exportProto('subarray', function subarray(begin, end) { - var O = aTypedArray(this); - var length = O.length; - var beginIndex = toAbsoluteIndex(begin, length); - return new (speciesConstructor(O, O.constructor))( - O.buffer, - O.byteOffset + beginIndex * O.BYTES_PER_ELEMENT, - toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - beginIndex) - ); -}); - -},{"../internals/array-buffer-view-core":125,"../internals/species-constructor":241,"../internals/to-absolute-index":248,"../internals/to-length":252}],451:[function(require,module,exports){ -'use strict'; -var global = require('../internals/global'); -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var fails = require('../internals/fails'); - -var Int8Array = global.Int8Array; -var aTypedArray = ArrayBufferViewCore.aTypedArray; -var $toLocaleString = [].toLocaleString; -var $slice = [].slice; - -// iOS Safari 6.x fails here -var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () { - $toLocaleString.call(new Int8Array(1)); -}); - -var FORCED = fails(function () { - return [1, 2].toLocaleString() != new Int8Array([1, 2]).toLocaleString(); -}) || !fails(function () { - Int8Array.prototype.toLocaleString.call([1, 2]); -}); - -// `%TypedArray%.prototype.toLocaleString` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tolocalestring -ArrayBufferViewCore.exportProto('toLocaleString', function toLocaleString() { - return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice.call(aTypedArray(this)) : aTypedArray(this), arguments); -}, FORCED); - -},{"../internals/array-buffer-view-core":125,"../internals/fails":161,"../internals/global":173}],452:[function(require,module,exports){ -'use strict'; -var global = require('../internals/global'); -var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -var fails = require('../internals/fails'); - -var Uint8Array = global.Uint8Array; -var Uint8ArrayPrototype = Uint8Array && Uint8Array.prototype; -var arrayToString = [].toString; -var arrayJoin = [].join; - -if (fails(function () { arrayToString.call({}); })) { - arrayToString = function toString() { - return arrayJoin.call(this); - }; -} - -// `%TypedArray%.prototype.toString` method -// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tostring -ArrayBufferViewCore.exportProto('toString', arrayToString, (Uint8ArrayPrototype || {}).toString != arrayToString); - -},{"../internals/array-buffer-view-core":125,"../internals/fails":161,"../internals/global":173}],453:[function(require,module,exports){ -var typedArrayConstructor = require('../internals/typed-array-constructor'); - -// `Uint16Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects -typedArrayConstructor('Uint16', 2, function (init) { - return function Uint16Array(data, byteOffset, length) { - return init(this, data, byteOffset, length); - }; -}); - -},{"../internals/typed-array-constructor":256}],454:[function(require,module,exports){ -var typedArrayConstructor = require('../internals/typed-array-constructor'); - -// `Uint32Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects -typedArrayConstructor('Uint32', 4, function (init) { - return function Uint32Array(data, byteOffset, length) { - return init(this, data, byteOffset, length); - }; -}); - -},{"../internals/typed-array-constructor":256}],455:[function(require,module,exports){ -var typedArrayConstructor = require('../internals/typed-array-constructor'); - -// `Uint8Array` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects -typedArrayConstructor('Uint8', 1, function (init) { - return function Uint8Array(data, byteOffset, length) { - return init(this, data, byteOffset, length); - }; -}); - -},{"../internals/typed-array-constructor":256}],456:[function(require,module,exports){ -var typedArrayConstructor = require('../internals/typed-array-constructor'); - -// `Uint8ClampedArray` constructor -// https://tc39.github.io/ecma262/#sec-typedarray-objects -typedArrayConstructor('Uint8', 1, function (init) { - return function Uint8ClampedArray(data, byteOffset, length) { - return init(this, data, byteOffset, length); - }; -}, true); - -},{"../internals/typed-array-constructor":256}],457:[function(require,module,exports){ -'use strict'; -var global = require('../internals/global'); -var redefineAll = require('../internals/redefine-all'); -var InternalMetadataModule = require('../internals/internal-metadata'); -var collection = require('../internals/collection'); -var collectionWeak = require('../internals/collection-weak'); -var isObject = require('../internals/is-object'); -var enforceIternalState = require('../internals/internal-state').enforce; -var NATIVE_WEAK_MAP = require('../internals/native-weak-map'); - -var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; -var isExtensible = Object.isExtensible; -var InternalWeakMap; - -var wrapper = function (get) { - return function WeakMap() { - return get(this, arguments.length ? arguments[0] : undefined); - }; -}; - -// `WeakMap` constructor -// https://tc39.github.io/ecma262/#sec-weakmap-constructor -var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak, true, true); - -// IE11 WeakMap frozen keys fix -// We can't use feature detection because it crash some old IE builds -// https://github.com/zloirock/core-js/issues/485 -if (NATIVE_WEAK_MAP && IS_IE11) { - InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true); - InternalMetadataModule.REQUIRED = true; - var WeakMapPrototype = $WeakMap.prototype; - var nativeDelete = WeakMapPrototype['delete']; - var nativeHas = WeakMapPrototype.has; - var nativeGet = WeakMapPrototype.get; - var nativeSet = WeakMapPrototype.set; - redefineAll(WeakMapPrototype, { - 'delete': function (key) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); - if (!state.frozen) state.frozen = new InternalWeakMap(); - return nativeDelete.call(this, key) || state.frozen['delete'](key); - } return nativeDelete.call(this, key); - }, - has: function has(key) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); - if (!state.frozen) state.frozen = new InternalWeakMap(); - return nativeHas.call(this, key) || state.frozen.has(key); - } return nativeHas.call(this, key); - }, - get: function get(key) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); - if (!state.frozen) state.frozen = new InternalWeakMap(); - return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key); - } return nativeGet.call(this, key); - }, - set: function set(key, value) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); - if (!state.frozen) state.frozen = new InternalWeakMap(); - nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value); - } else nativeSet.call(this, key, value); - return this; - } - }); -} - -},{"../internals/collection":144,"../internals/collection-weak":143,"../internals/global":173,"../internals/internal-metadata":182,"../internals/internal-state":183,"../internals/is-object":188,"../internals/native-weak-map":202,"../internals/redefine-all":228}],458:[function(require,module,exports){ -'use strict'; -var collection = require('../internals/collection'); -var collectionWeak = require('../internals/collection-weak'); - -// `WeakSet` constructor -// https://tc39.github.io/ecma262/#sec-weakset-constructor -collection('WeakSet', function (get) { - return function WeakSet() { return get(this, arguments.length ? arguments[0] : undefined); }; -}, collectionWeak, false, true); - -},{"../internals/collection":144,"../internals/collection-weak":143}],459:[function(require,module,exports){ -var global = require('../internals/global'); -var DOMIterables = require('../internals/dom-iterables'); -var forEach = require('../internals/array-for-each'); -var hide = require('../internals/hide'); - -for (var COLLECTION_NAME in DOMIterables) { - var Collection = global[COLLECTION_NAME]; - var CollectionPrototype = Collection && Collection.prototype; - // some Chrome versions have non-configurable methods on DOMTokenList - if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try { - hide(CollectionPrototype, 'forEach', forEach); - } catch (error) { - CollectionPrototype.forEach = forEach; - } -} - -},{"../internals/array-for-each":129,"../internals/dom-iterables":158,"../internals/global":173,"../internals/hide":176}],460:[function(require,module,exports){ -var global = require('../internals/global'); -var DOMIterables = require('../internals/dom-iterables'); -var ArrayIteratorMethods = require('../modules/es.array.iterator'); -var hide = require('../internals/hide'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var ITERATOR = wellKnownSymbol('iterator'); -var TO_STRING_TAG = wellKnownSymbol('toStringTag'); -var ArrayValues = ArrayIteratorMethods.values; - -for (var COLLECTION_NAME in DOMIterables) { - var Collection = global[COLLECTION_NAME]; - var CollectionPrototype = Collection && Collection.prototype; - if (CollectionPrototype) { - // some Chrome versions have non-configurable methods on DOMTokenList - if (CollectionPrototype[ITERATOR] !== ArrayValues) try { - hide(CollectionPrototype, ITERATOR, ArrayValues); - } catch (error) { - CollectionPrototype[ITERATOR] = ArrayValues; - } - if (!CollectionPrototype[TO_STRING_TAG]) hide(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME); - if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) { - // some Chrome versions have non-configurable methods on DOMTokenList - if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try { - hide(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]); - } catch (error) { - CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME]; - } - } - } -} - -},{"../internals/dom-iterables":158,"../internals/global":173,"../internals/hide":176,"../internals/well-known-symbol":262,"../modules/es.array.iterator":281}],461:[function(require,module,exports){ -var global = require('../internals/global'); -var task = require('../internals/task'); - -var FORCED = !global.setImmediate || !global.clearImmediate; - -// http://w3c.github.io/setImmediate/ -require('../internals/export')({ global: true, bind: true, enumerable: true, forced: FORCED }, { - // `setImmediate` method - // http://w3c.github.io/setImmediate/#si-setImmediate - setImmediate: task.set, - // `clearImmediate` method - // http://w3c.github.io/setImmediate/#si-clearImmediate - clearImmediate: task.clear -}); - -},{"../internals/export":160,"../internals/global":173,"../internals/task":246}],462:[function(require,module,exports){ -var $ = require('../internals/export'); -var global = require('../internals/global'); -var microtask = require('../internals/microtask'); -var classof = require('../internals/classof-raw'); - -var process = global.process; -var isNode = classof(process) == 'process'; - -// `queueMicrotask` method -// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask -$({ global: true, enumerable: true, noTargetGet: true }, { - queueMicrotask: function queueMicrotask(fn) { - var domain = isNode && process.domain; - microtask(domain ? domain.bind(fn) : fn); - } -}); - -},{"../internals/classof-raw":140,"../internals/export":160,"../internals/global":173,"../internals/microtask":198}],463:[function(require,module,exports){ -'use strict'; -// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` -require('../modules/es.array.iterator'); -var $ = require('../internals/export'); -var USE_NATIVE_URL = require('../internals/native-url'); -var redefine = require('../internals/redefine'); -var redefineAll = require('../internals/redefine-all'); -var setToStringTag = require('../internals/set-to-string-tag'); -var createIteratorConstructor = require('../internals/create-iterator-constructor'); -var InternalStateModule = require('../internals/internal-state'); -var anInstance = require('../internals/an-instance'); -var hasOwn = require('../internals/has'); -var bind = require('../internals/bind-context'); -var anObject = require('../internals/an-object'); -var isObject = require('../internals/is-object'); -var getIterator = require('../internals/get-iterator'); -var getIteratorMethod = require('../internals/get-iterator-method'); -var wellKnownSymbol = require('../internals/well-known-symbol'); - -var ITERATOR = wellKnownSymbol('iterator'); -var URL_SEARCH_PARAMS = 'URLSearchParams'; -var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator'; -var setInternalState = InternalStateModule.set; -var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS); -var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR); - -var plus = /\+/g; -var sequences = Array(4); - -var percentSequence = function (bytes) { - return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi')); -}; - -var percentDecode = function (sequence) { - try { - return decodeURIComponent(sequence); - } catch (error) { - return sequence; - } -}; - -var deserialize = function (it) { - var result = it.replace(plus, ' '); - var bytes = 4; - try { - return decodeURIComponent(result); - } catch (error) { - while (bytes) { - result = result.replace(percentSequence(bytes--), percentDecode); - } - return result; - } -}; - -var find = /[!'()~]|%20/g; - -var replace = { - '!': '%21', - "'": '%27', - '(': '%28', - ')': '%29', - '~': '%7E', - '%20': '+' -}; - -var replacer = function (match) { - return replace[match]; -}; - -var serialize = function (it) { - return encodeURIComponent(it).replace(find, replacer); -}; - -var parseSearchParams = function (result, query) { - if (query) { - var attributes = query.split('&'); - var index = 0; - var attribute, entry; - while (index < attributes.length) { - attribute = attributes[index++]; - if (attribute.length) { - entry = attribute.split('='); - result.push({ - key: deserialize(entry.shift()), - value: deserialize(entry.join('=')) - }); - } - } - } -}; - -var updateSearchParams = function (query) { - this.entries.length = 0; - parseSearchParams(this.entries, query); -}; - -var validateArgumentsLength = function (passed, required) { - if (passed < required) throw TypeError('Not enough arguments'); -}; - -var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) { - setInternalState(this, { - type: URL_SEARCH_PARAMS_ITERATOR, - iterator: getIterator(getInternalParamsState(params).entries), - kind: kind - }); -}, 'Iterator', function next() { - var state = getInternalIteratorState(this); - var kind = state.kind; - var step = state.iterator.next(); - var entry = step.value; - if (!step.done) { - step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value]; - } return step; -}); - -// `URLSearchParams` constructor -// https://url.spec.whatwg.org/#interface-urlsearchparams -var URLSearchParamsConstructor = function URLSearchParams(/* init */) { - anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS); - var init = arguments.length > 0 ? arguments[0] : undefined; - var that = this; - var entries = []; - var iteratorMethod, iterator, step, entryIterator, first, second, key; - - setInternalState(that, { - type: URL_SEARCH_PARAMS, - entries: entries, - updateURL: function () { /* empty */ }, - updateSearchParams: updateSearchParams - }); - - if (init !== undefined) { - if (isObject(init)) { - iteratorMethod = getIteratorMethod(init); - if (typeof iteratorMethod === 'function') { - iterator = iteratorMethod.call(init); - while (!(step = iterator.next()).done) { - entryIterator = getIterator(anObject(step.value)); - if ( - (first = entryIterator.next()).done || - (second = entryIterator.next()).done || - !entryIterator.next().done - ) throw TypeError('Expected sequence with length 2'); - entries.push({ key: first.value + '', value: second.value + '' }); - } - } else for (key in init) if (hasOwn(init, key)) entries.push({ key: key, value: init[key] + '' }); - } else { - parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + ''); - } - } -}; - -var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; - -redefineAll(URLSearchParamsPrototype, { - // `URLSearchParams.prototype.appent` method - // https://url.spec.whatwg.org/#dom-urlsearchparams-append - append: function append(name, value) { - validateArgumentsLength(arguments.length, 2); - var state = getInternalParamsState(this); - state.entries.push({ key: name + '', value: value + '' }); - state.updateURL(); - }, - // `URLSearchParams.prototype.delete` method - // https://url.spec.whatwg.org/#dom-urlsearchparams-delete - 'delete': function (name) { - validateArgumentsLength(arguments.length, 1); - var state = getInternalParamsState(this); - var entries = state.entries; - var key = name + ''; - var index = 0; - while (index < entries.length) { - if (entries[index].key === key) entries.splice(index, 1); - else index++; - } - state.updateURL(); - }, - // `URLSearchParams.prototype.get` method - // https://url.spec.whatwg.org/#dom-urlsearchparams-get - get: function get(name) { - validateArgumentsLength(arguments.length, 1); - var entries = getInternalParamsState(this).entries; - var key = name + ''; - var index = 0; - for (; index < entries.length; index++) { - if (entries[index].key === key) return entries[index].value; - } - return null; - }, - // `URLSearchParams.prototype.getAll` method - // https://url.spec.whatwg.org/#dom-urlsearchparams-getall - getAll: function getAll(name) { - validateArgumentsLength(arguments.length, 1); - var entries = getInternalParamsState(this).entries; - var key = name + ''; - var result = []; - var index = 0; - for (; index < entries.length; index++) { - if (entries[index].key === key) result.push(entries[index].value); - } - return result; - }, - // `URLSearchParams.prototype.has` method - // https://url.spec.whatwg.org/#dom-urlsearchparams-has - has: function has(name) { - validateArgumentsLength(arguments.length, 1); - var entries = getInternalParamsState(this).entries; - var key = name + ''; - var index = 0; - while (index < entries.length) { - if (entries[index++].key === key) return true; - } - return false; - }, - // `URLSearchParams.prototype.set` method - // https://url.spec.whatwg.org/#dom-urlsearchparams-set - set: function set(name, value) { - validateArgumentsLength(arguments.length, 1); - var state = getInternalParamsState(this); - var entries = state.entries; - var found = false; - var key = name + ''; - var val = value + ''; - var index = 0; - var entry; - for (; index < entries.length; index++) { - entry = entries[index]; - if (entry.key === key) { - if (found) entries.splice(index--, 1); - else { - found = true; - entry.value = val; - } - } - } - if (!found) entries.push({ key: key, value: val }); - state.updateURL(); - }, - // `URLSearchParams.prototype.sort` method - // https://url.spec.whatwg.org/#dom-urlsearchparams-sort - sort: function sort() { - var state = getInternalParamsState(this); - var entries = state.entries; - // Array#sort is not stable in some engines - var slice = entries.slice(); - var entry, entriesIndex, sliceIndex; - entries.length = 0; - for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) { - entry = slice[sliceIndex]; - for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) { - if (entries[entriesIndex].key > entry.key) { - entries.splice(entriesIndex, 0, entry); - break; - } - } - if (entriesIndex === sliceIndex) entries.push(entry); - } - state.updateURL(); - }, - // `URLSearchParams.prototype.forEach` method - forEach: function forEach(callback /* , thisArg */) { - var entries = getInternalParamsState(this).entries; - var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3); - var index = 0; - var entry; - while (index < entries.length) { - entry = entries[index++]; - boundFunction(entry.value, entry.key, this); - } - }, - // `URLSearchParams.prototype.keys` method - keys: function keys() { - return new URLSearchParamsIterator(this, 'keys'); - }, - // `URLSearchParams.prototype.values` method - values: function values() { - return new URLSearchParamsIterator(this, 'values'); - }, - // `URLSearchParams.prototype.entries` method - entries: function entries() { - return new URLSearchParamsIterator(this, 'entries'); - } -}, { enumerable: true }); - -// `URLSearchParams.prototype[@@iterator]` method -redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries); - -// `URLSearchParams.prototype.toString` method -// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior -redefine(URLSearchParamsPrototype, 'toString', function toString() { - var entries = getInternalParamsState(this).entries; - var result = []; - var index = 0; - var entry; - while (index < entries.length) { - entry = entries[index++]; - result.push(serialize(entry.key) + '=' + serialize(entry.value)); - } return result.join('&'); -}, { enumerable: true }); - -setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS); - -$({ global: true, forced: !USE_NATIVE_URL }, { - URLSearchParams: URLSearchParamsConstructor -}); - -module.exports = { - URLSearchParams: URLSearchParamsConstructor, - getState: getInternalParamsState -}; - -},{"../internals/an-instance":123,"../internals/an-object":124,"../internals/bind-context":137,"../internals/create-iterator-constructor":149,"../internals/export":160,"../internals/get-iterator":172,"../internals/get-iterator-method":171,"../internals/has":174,"../internals/internal-state":183,"../internals/is-object":188,"../internals/native-url":201,"../internals/redefine":229,"../internals/redefine-all":228,"../internals/set-to-string-tag":237,"../internals/well-known-symbol":262,"../modules/es.array.iterator":281}],464:[function(require,module,exports){ -'use strict'; -// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` -require('../modules/es.string.iterator'); -var $ = require('../internals/export'); -var DESCRIPTORS = require('../internals/descriptors'); -var USE_NATIVE_URL = require('../internals/native-url'); -var global = require('../internals/global'); -var defineProperties = require('../internals/object-define-properties'); -var redefine = require('../internals/redefine'); -var anInstance = require('../internals/an-instance'); -var has = require('../internals/has'); -var assign = require('../internals/object-assign'); -var arrayFrom = require('../internals/array-from'); -var codeAt = require('../internals/string-multibyte').codeAt; -var toASCII = require('../internals/punycode-to-ascii'); -var setToStringTag = require('../internals/set-to-string-tag'); -var URLSearchParamsModule = require('../modules/web.url-search-params'); -var InternalStateModule = require('../internals/internal-state'); - -var NativeURL = global.URL; -var URLSearchParams = URLSearchParamsModule.URLSearchParams; -var getInternalSearchParamsState = URLSearchParamsModule.getState; -var setInternalState = InternalStateModule.set; -var getInternalURLState = InternalStateModule.getterFor('URL'); -var floor = Math.floor; -var pow = Math.pow; - -var INVALID_AUTHORITY = 'Invalid authority'; -var INVALID_SCHEME = 'Invalid scheme'; -var INVALID_HOST = 'Invalid host'; -var INVALID_PORT = 'Invalid port'; - -var ALPHA = /[A-Za-z]/; -var ALPHANUMERIC = /[\d+\-.A-Za-z]/; -var DIGIT = /\d/; -var HEX_START = /^(0x|0X)/; -var OCT = /^[0-7]+$/; -var DEC = /^\d+$/; -var HEX = /^[\dA-Fa-f]+$/; -// eslint-disable-next-line no-control-regex -var FORBIDDEN_HOST_CODE_POINT = /[\u0000\u0009\u000A\u000D #%/:?@[\\]]/; -// eslint-disable-next-line no-control-regex -var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\u0009\u000A\u000D #/:?@[\\]]/; -// eslint-disable-next-line no-control-regex -var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g; -// eslint-disable-next-line no-control-regex -var TAB_AND_NEW_LINE = /[\u0009\u000A\u000D]/g; -var EOF; - -var parseHost = function (url, input) { - var result, codePoints, index; - if (input.charAt(0) == '[') { - if (input.charAt(input.length - 1) != ']') return INVALID_HOST; - result = parseIPv6(input.slice(1, -1)); - if (!result) return INVALID_HOST; - url.host = result; - // opaque host - } else if (!isSpecial(url)) { - if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST; - result = ''; - codePoints = arrayFrom(input); - for (index = 0; index < codePoints.length; index++) { - result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); - } - url.host = result; - } else { - input = toASCII(input); - if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST; - result = parseIPv4(input); - if (result === null) return INVALID_HOST; - url.host = result; - } -}; - -var parseIPv4 = function (input) { - var parts = input.split('.'); - var partsLength, numbers, index, part, radix, number, ipv4; - if (parts.length && parts[parts.length - 1] == '') { - parts.pop(); - } - partsLength = parts.length; - if (partsLength > 4) return input; - numbers = []; - for (index = 0; index < partsLength; index++) { - part = parts[index]; - if (part == '') return input; - radix = 10; - if (part.length > 1 && part.charAt(0) == '0') { - radix = HEX_START.test(part) ? 16 : 8; - part = part.slice(radix == 8 ? 1 : 2); - } - if (part === '') { - number = 0; - } else { - if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input; - number = parseInt(part, radix); - } - numbers.push(number); - } - for (index = 0; index < partsLength; index++) { - number = numbers[index]; - if (index == partsLength - 1) { - if (number >= pow(256, 5 - partsLength)) return null; - } else if (number > 255) return null; - } - ipv4 = numbers.pop(); - for (index = 0; index < numbers.length; index++) { - ipv4 += numbers[index] * pow(256, 3 - index); - } - return ipv4; -}; - -// eslint-disable-next-line max-statements -var parseIPv6 = function (input) { - var address = [0, 0, 0, 0, 0, 0, 0, 0]; - var pieceIndex = 0; - var compress = null; - var pointer = 0; - var value, length, numbersSeen, ipv4Piece, number, swaps, swap; - - var char = function () { - return input.charAt(pointer); - }; - - if (char() == ':') { - if (input.charAt(1) != ':') return; - pointer += 2; - pieceIndex++; - compress = pieceIndex; - } - while (char()) { - if (pieceIndex == 8) return; - if (char() == ':') { - if (compress !== null) return; - pointer++; - pieceIndex++; - compress = pieceIndex; - continue; - } - value = length = 0; - while (length < 4 && HEX.test(char())) { - value = value * 16 + parseInt(char(), 16); - pointer++; - length++; - } - if (char() == '.') { - if (length == 0) return; - pointer -= length; - if (pieceIndex > 6) return; - numbersSeen = 0; - while (char()) { - ipv4Piece = null; - if (numbersSeen > 0) { - if (char() == '.' && numbersSeen < 4) pointer++; - else return; - } - if (!DIGIT.test(char())) return; - while (DIGIT.test(char())) { - number = parseInt(char(), 10); - if (ipv4Piece === null) ipv4Piece = number; - else if (ipv4Piece == 0) return; - else ipv4Piece = ipv4Piece * 10 + number; - if (ipv4Piece > 255) return; - pointer++; - } - address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece; - numbersSeen++; - if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++; - } - if (numbersSeen != 4) return; - break; - } else if (char() == ':') { - pointer++; - if (!char()) return; - } else if (char()) return; - address[pieceIndex++] = value; - } - if (compress !== null) { - swaps = pieceIndex - compress; - pieceIndex = 7; - while (pieceIndex != 0 && swaps > 0) { - swap = address[pieceIndex]; - address[pieceIndex--] = address[compress + swaps - 1]; - address[compress + --swaps] = swap; - } - } else if (pieceIndex != 8) return; - return address; -}; - -var findLongestZeroSequence = function (ipv6) { - var maxIndex = null; - var maxLength = 1; - var currStart = null; - var currLength = 0; - var index = 0; - for (; index < 8; index++) { - if (ipv6[index] !== 0) { - if (currLength > maxLength) { - maxIndex = currStart; - maxLength = currLength; - } - currStart = null; - currLength = 0; - } else { - if (currStart === null) currStart = index; - ++currLength; - } - } - if (currLength > maxLength) { - maxIndex = currStart; - maxLength = currLength; - } - return maxIndex; -}; - -var serializeHost = function (host) { - var result, index, compress, ignore0; - // ipv4 - if (typeof host == 'number') { - result = []; - for (index = 0; index < 4; index++) { - result.unshift(host % 256); - host = floor(host / 256); - } return result.join('.'); - // ipv6 - } else if (typeof host == 'object') { - result = ''; - compress = findLongestZeroSequence(host); - for (index = 0; index < 8; index++) { - if (ignore0 && host[index] === 0) continue; - if (ignore0) ignore0 = false; - if (compress === index) { - result += index ? ':' : '::'; - ignore0 = true; - } else { - result += host[index].toString(16); - if (index < 7) result += ':'; - } - } - return '[' + result + ']'; - } return host; -}; - -var C0ControlPercentEncodeSet = {}; -var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, { - ' ': 1, '"': 1, '<': 1, '>': 1, '`': 1 -}); -var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, { - '#': 1, '?': 1, '{': 1, '}': 1 -}); -var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, { - '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\': 1, ']': 1, '^': 1, '|': 1 -}); - -var percentEncode = function (char, set) { - var code = codeAt(char, 0); - return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char); -}; - -var specialSchemes = { - ftp: 21, - file: null, - gopher: 70, - http: 80, - https: 443, - ws: 80, - wss: 443 -}; - -var isSpecial = function (url) { - return has(specialSchemes, url.scheme); -}; - -var includesCredentials = function (url) { - return url.username != '' || url.password != ''; -}; - -var cannotHaveUsernamePasswordPort = function (url) { - return !url.host || url.cannotBeABaseURL || url.scheme == 'file'; -}; - -var isWindowsDriveLetter = function (string, normalized) { - var second; - return string.length == 2 && ALPHA.test(string.charAt(0)) - && ((second = string.charAt(1)) == ':' || (!normalized && second == '|')); -}; - -var startsWithWindowsDriveLetter = function (string) { - var third; - return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && ( - string.length == 2 || - ((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#') - ); -}; - -var shortenURLsPath = function (url) { - var path = url.path; - var pathSize = path.length; - if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { - path.pop(); - } -}; - -var isSingleDot = function (segment) { - return segment === '.' || segment.toLowerCase() === '%2e'; -}; - -var isDoubleDot = function (segment) { - segment = segment.toLowerCase(); - return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e'; -}; - -// States: -var SCHEME_START = {}; -var SCHEME = {}; -var NO_SCHEME = {}; -var SPECIAL_RELATIVE_OR_AUTHORITY = {}; -var PATH_OR_AUTHORITY = {}; -var RELATIVE = {}; -var RELATIVE_SLASH = {}; -var SPECIAL_AUTHORITY_SLASHES = {}; -var SPECIAL_AUTHORITY_IGNORE_SLASHES = {}; -var AUTHORITY = {}; -var HOST = {}; -var HOSTNAME = {}; -var PORT = {}; -var FILE = {}; -var FILE_SLASH = {}; -var FILE_HOST = {}; -var PATH_START = {}; -var PATH = {}; -var CANNOT_BE_A_BASE_URL_PATH = {}; -var QUERY = {}; -var FRAGMENT = {}; - -// eslint-disable-next-line max-statements -var parseURL = function (url, input, stateOverride, base) { - var state = stateOverride || SCHEME_START; - var pointer = 0; - var buffer = ''; - var seenAt = false; - var seenBracket = false; - var seenPasswordToken = false; - var codePoints, char, bufferCodePoints, failure; - - if (!stateOverride) { - url.scheme = ''; - url.username = ''; - url.password = ''; - url.host = null; - url.port = null; - url.path = []; - url.query = null; - url.fragment = null; - url.cannotBeABaseURL = false; - input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); - } - - input = input.replace(TAB_AND_NEW_LINE, ''); - - codePoints = arrayFrom(input); - - while (pointer <= codePoints.length) { - char = codePoints[pointer]; - switch (state) { - case SCHEME_START: - if (char && ALPHA.test(char)) { - buffer += char.toLowerCase(); - state = SCHEME; - } else if (!stateOverride) { - state = NO_SCHEME; - continue; - } else return INVALID_SCHEME; - break; - - case SCHEME: - if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) { - buffer += char.toLowerCase(); - } else if (char == ':') { - if (stateOverride && ( - (isSpecial(url) != has(specialSchemes, buffer)) || - (buffer == 'file' && (includesCredentials(url) || url.port !== null)) || - (url.scheme == 'file' && !url.host) - )) return; - url.scheme = buffer; - if (stateOverride) { - if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null; - return; - } - buffer = ''; - if (url.scheme == 'file') { - state = FILE; - } else if (isSpecial(url) && base && base.scheme == url.scheme) { - state = SPECIAL_RELATIVE_OR_AUTHORITY; - } else if (isSpecial(url)) { - state = SPECIAL_AUTHORITY_SLASHES; - } else if (codePoints[pointer + 1] == '/') { - state = PATH_OR_AUTHORITY; - pointer++; - } else { - url.cannotBeABaseURL = true; - url.path.push(''); - state = CANNOT_BE_A_BASE_URL_PATH; - } - } else if (!stateOverride) { - buffer = ''; - state = NO_SCHEME; - pointer = 0; - continue; - } else return INVALID_SCHEME; - break; - - case NO_SCHEME: - if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME; - if (base.cannotBeABaseURL && char == '#') { - url.scheme = base.scheme; - url.path = base.path.slice(); - url.query = base.query; - url.fragment = ''; - url.cannotBeABaseURL = true; - state = FRAGMENT; - break; - } - state = base.scheme == 'file' ? FILE : RELATIVE; - continue; - - case SPECIAL_RELATIVE_OR_AUTHORITY: - if (char == '/' && codePoints[pointer + 1] == '/') { - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - pointer++; - } else { - state = RELATIVE; - continue; - } break; - - case PATH_OR_AUTHORITY: - if (char == '/') { - state = AUTHORITY; - break; - } else { - state = PATH; - continue; - } - - case RELATIVE: - url.scheme = base.scheme; - if (char == EOF) { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = base.path.slice(); - url.query = base.query; - } else if (char == '/' || (char == '\\' && isSpecial(url))) { - state = RELATIVE_SLASH; - } else if (char == '?') { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = base.path.slice(); - url.query = ''; - state = QUERY; - } else if (char == '#') { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = base.path.slice(); - url.query = base.query; - url.fragment = ''; - state = FRAGMENT; - } else { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = base.path.slice(); - url.path.pop(); - state = PATH; - continue; - } break; - - case RELATIVE_SLASH: - if (isSpecial(url) && (char == '/' || char == '\\')) { - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - } else if (char == '/') { - state = AUTHORITY; - } else { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - state = PATH; - continue; - } break; - - case SPECIAL_AUTHORITY_SLASHES: - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - if (char != '/' || buffer.charAt(pointer + 1) != '/') continue; - pointer++; - break; - - case SPECIAL_AUTHORITY_IGNORE_SLASHES: - if (char != '/' && char != '\\') { - state = AUTHORITY; - continue; - } break; - - case AUTHORITY: - if (char == '@') { - if (seenAt) buffer = '%40' + buffer; - seenAt = true; - bufferCodePoints = arrayFrom(buffer); - for (var i = 0; i < bufferCodePoints.length; i++) { - var codePoint = bufferCodePoints[i]; - if (codePoint == ':' && !seenPasswordToken) { - seenPasswordToken = true; - continue; - } - var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); - if (seenPasswordToken) url.password += encodedCodePoints; - else url.username += encodedCodePoints; - } - buffer = ''; - } else if ( - char == EOF || char == '/' || char == '?' || char == '#' || - (char == '\\' && isSpecial(url)) - ) { - if (seenAt && buffer == '') return INVALID_AUTHORITY; - pointer -= arrayFrom(buffer).length + 1; - buffer = ''; - state = HOST; - } else buffer += char; - break; - - case HOST: - case HOSTNAME: - if (stateOverride && url.scheme == 'file') { - state = FILE_HOST; - continue; - } else if (char == ':' && !seenBracket) { - if (buffer == '') return INVALID_HOST; - failure = parseHost(url, buffer); - if (failure) return failure; - buffer = ''; - state = PORT; - if (stateOverride == HOSTNAME) return; - } else if ( - char == EOF || char == '/' || char == '?' || char == '#' || - (char == '\\' && isSpecial(url)) - ) { - if (isSpecial(url) && buffer == '') return INVALID_HOST; - if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return; - failure = parseHost(url, buffer); - if (failure) return failure; - buffer = ''; - state = PATH_START; - if (stateOverride) return; - continue; - } else { - if (char == '[') seenBracket = true; - else if (char == ']') seenBracket = false; - buffer += char; - } break; - - case PORT: - if (DIGIT.test(char)) { - buffer += char; - } else if ( - char == EOF || char == '/' || char == '?' || char == '#' || - (char == '\\' && isSpecial(url)) || - stateOverride - ) { - if (buffer != '') { - var port = parseInt(buffer, 10); - if (port > 0xFFFF) return INVALID_PORT; - url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port; - buffer = ''; - } - if (stateOverride) return; - state = PATH_START; - continue; - } else return INVALID_PORT; - break; - - case FILE: - url.scheme = 'file'; - if (char == '/' || char == '\\') state = FILE_SLASH; - else if (base && base.scheme == 'file') { - if (char == EOF) { - url.host = base.host; - url.path = base.path.slice(); - url.query = base.query; - } else if (char == '?') { - url.host = base.host; - url.path = base.path.slice(); - url.query = ''; - state = QUERY; - } else if (char == '#') { - url.host = base.host; - url.path = base.path.slice(); - url.query = base.query; - url.fragment = ''; - state = FRAGMENT; - } else { - if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { - url.host = base.host; - url.path = base.path.slice(); - shortenURLsPath(url); - } - state = PATH; - continue; - } - } else { - state = PATH; - continue; - } break; - - case FILE_SLASH: - if (char == '/' || char == '\\') { - state = FILE_HOST; - break; - } - if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { - if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]); - else url.host = base.host; - } - state = PATH; - continue; - - case FILE_HOST: - if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') { - if (!stateOverride && isWindowsDriveLetter(buffer)) { - state = PATH; - } else if (buffer == '') { - url.host = ''; - if (stateOverride) return; - state = PATH_START; - } else { - failure = parseHost(url, buffer); - if (failure) return failure; - if (url.host == 'localhost') url.host = ''; - if (stateOverride) return; - buffer = ''; - state = PATH_START; - } continue; - } else buffer += char; - break; - - case PATH_START: - if (isSpecial(url)) { - state = PATH; - if (char != '/' && char != '\\') continue; - } else if (!stateOverride && char == '?') { - url.query = ''; - state = QUERY; - } else if (!stateOverride && char == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (char != EOF) { - state = PATH; - if (char != '/') continue; - } break; - - case PATH: - if ( - char == EOF || char == '/' || - (char == '\\' && isSpecial(url)) || - (!stateOverride && (char == '?' || char == '#')) - ) { - if (isDoubleDot(buffer)) { - shortenURLsPath(url); - if (char != '/' && !(char == '\\' && isSpecial(url))) { - url.path.push(''); - } - } else if (isSingleDot(buffer)) { - if (char != '/' && !(char == '\\' && isSpecial(url))) { - url.path.push(''); - } - } else { - if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { - if (url.host) url.host = ''; - buffer = buffer.charAt(0) + ':'; // normalize windows drive letter - } - url.path.push(buffer); - } - buffer = ''; - if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) { - while (url.path.length > 1 && url.path[0] === '') { - url.path.shift(); - } - } - if (char == '?') { - url.query = ''; - state = QUERY; - } else if (char == '#') { - url.fragment = ''; - state = FRAGMENT; - } - } else { - buffer += percentEncode(char, pathPercentEncodeSet); - } break; - - case CANNOT_BE_A_BASE_URL_PATH: - if (char == '?') { - url.query = ''; - state = QUERY; - } else if (char == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (char != EOF) { - url.path[0] += percentEncode(char, C0ControlPercentEncodeSet); - } break; - - case QUERY: - if (!stateOverride && char == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (char != EOF) { - if (char == "'" && isSpecial(url)) url.query += '%27'; - else if (char == '#') url.query += '%23'; - else url.query += percentEncode(char, C0ControlPercentEncodeSet); - } break; - - case FRAGMENT: - if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet); - break; - } - - pointer++; - } -}; - -// `URL` constructor -// https://url.spec.whatwg.org/#url-class -var URLConstructor = function URL(url /* , base */) { - var that = anInstance(this, URLConstructor, 'URL'); - var base = arguments.length > 1 ? arguments[1] : undefined; - var urlString = String(url); - var state = setInternalState(that, { type: 'URL' }); - var baseState, failure; - if (base !== undefined) { - if (base instanceof URLConstructor) baseState = getInternalURLState(base); - else { - failure = parseURL(baseState = {}, String(base)); - if (failure) throw TypeError(failure); - } - } - failure = parseURL(state, urlString, null, baseState); - if (failure) throw TypeError(failure); - var searchParams = state.searchParams = new URLSearchParams(); - var searchParamsState = getInternalSearchParamsState(searchParams); - searchParamsState.updateSearchParams(state.query); - searchParamsState.updateURL = function () { - state.query = String(searchParams) || null; - }; - if (!DESCRIPTORS) { - that.href = serializeURL.call(that); - that.origin = getOrigin.call(that); - that.protocol = getProtocol.call(that); - that.username = getUsername.call(that); - that.password = getPassword.call(that); - that.host = getHost.call(that); - that.hostname = getHostname.call(that); - that.port = getPort.call(that); - that.pathname = getPathname.call(that); - that.search = getSearch.call(that); - that.searchParams = getSearchParams.call(that); - that.hash = getHash.call(that); - } -}; - -var URLPrototype = URLConstructor.prototype; - -var serializeURL = function () { - var url = getInternalURLState(this); - var scheme = url.scheme; - var username = url.username; - var password = url.password; - var host = url.host; - var port = url.port; - var path = url.path; - var query = url.query; - var fragment = url.fragment; - var output = scheme + ':'; - if (host !== null) { - output += '//'; - if (includesCredentials(url)) { - output += username + (password ? ':' + password : '') + '@'; - } - output += serializeHost(host); - if (port !== null) output += ':' + port; - } else if (scheme == 'file') output += '//'; - output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; - if (query !== null) output += '?' + query; - if (fragment !== null) output += '#' + fragment; - return output; -}; - -var getOrigin = function () { - var url = getInternalURLState(this); - var scheme = url.scheme; - var port = url.port; - if (scheme == 'blob') try { - return new URL(scheme.path[0]).origin; - } catch (error) { - return 'null'; - } - if (scheme == 'file' || !isSpecial(url)) return 'null'; - return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : ''); -}; - -var getProtocol = function () { - return getInternalURLState(this).scheme + ':'; -}; - -var getUsername = function () { - return getInternalURLState(this).username; -}; - -var getPassword = function () { - return getInternalURLState(this).password; -}; - -var getHost = function () { - var url = getInternalURLState(this); - var host = url.host; - var port = url.port; - return host === null ? '' - : port === null ? serializeHost(host) - : serializeHost(host) + ':' + port; -}; - -var getHostname = function () { - var host = getInternalURLState(this).host; - return host === null ? '' : serializeHost(host); -}; - -var getPort = function () { - var port = getInternalURLState(this).port; - return port === null ? '' : String(port); -}; - -var getPathname = function () { - var url = getInternalURLState(this); - var path = url.path; - return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; -}; - -var getSearch = function () { - var query = getInternalURLState(this).query; - return query ? '?' + query : ''; -}; - -var getSearchParams = function () { - return getInternalURLState(this).searchParams; -}; - -var getHash = function () { - var fragment = getInternalURLState(this).fragment; - return fragment ? '#' + fragment : ''; -}; - -var accessorDescriptor = function (getter, setter) { - return { get: getter, set: setter, configurable: true, enumerable: true }; -}; - -if (DESCRIPTORS) { - defineProperties(URLPrototype, { - // `URL.prototype.href` accessors pair - // https://url.spec.whatwg.org/#dom-url-href - href: accessorDescriptor(serializeURL, function (href) { - var url = getInternalURLState(this); - var urlString = String(href); - var failure = parseURL(url, urlString); - if (failure) throw TypeError(failure); - getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); - }), - // `URL.prototype.origin` getter - // https://url.spec.whatwg.org/#dom-url-origin - origin: accessorDescriptor(getOrigin), - // `URL.prototype.protocol` accessors pair - // https://url.spec.whatwg.org/#dom-url-protocol - protocol: accessorDescriptor(getProtocol, function (protocol) { - var url = getInternalURLState(this); - parseURL(url, String(protocol) + ':', SCHEME_START); - }), - // `URL.prototype.username` accessors pair - // https://url.spec.whatwg.org/#dom-url-username - username: accessorDescriptor(getUsername, function (username) { - var url = getInternalURLState(this); - var codePoints = arrayFrom(String(username)); - if (cannotHaveUsernamePasswordPort(url)) return; - url.username = ''; - for (var i = 0; i < codePoints.length; i++) { - url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); - } - }), - // `URL.prototype.password` accessors pair - // https://url.spec.whatwg.org/#dom-url-password - password: accessorDescriptor(getPassword, function (password) { - var url = getInternalURLState(this); - var codePoints = arrayFrom(String(password)); - if (cannotHaveUsernamePasswordPort(url)) return; - url.password = ''; - for (var i = 0; i < codePoints.length; i++) { - url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); - } - }), - // `URL.prototype.host` accessors pair - // https://url.spec.whatwg.org/#dom-url-host - host: accessorDescriptor(getHost, function (host) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) return; - parseURL(url, String(host), HOST); - }), - // `URL.prototype.hostname` accessors pair - // https://url.spec.whatwg.org/#dom-url-hostname - hostname: accessorDescriptor(getHostname, function (hostname) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) return; - parseURL(url, String(hostname), HOSTNAME); - }), - // `URL.prototype.port` accessors pair - // https://url.spec.whatwg.org/#dom-url-port - port: accessorDescriptor(getPort, function (port) { - var url = getInternalURLState(this); - if (cannotHaveUsernamePasswordPort(url)) return; - port = String(port); - if (port == '') url.port = null; - else parseURL(url, port, PORT); - }), - // `URL.prototype.pathname` accessors pair - // https://url.spec.whatwg.org/#dom-url-pathname - pathname: accessorDescriptor(getPathname, function (pathname) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) return; - url.path = []; - parseURL(url, pathname + '', PATH_START); - }), - // `URL.prototype.search` accessors pair - // https://url.spec.whatwg.org/#dom-url-search - search: accessorDescriptor(getSearch, function (search) { - var url = getInternalURLState(this); - search = String(search); - if (search == '') { - url.query = null; - } else { - if ('?' == search.charAt(0)) search = search.slice(1); - url.query = ''; - parseURL(url, search, QUERY); - } - getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); - }), - // `URL.prototype.searchParams` getter - // https://url.spec.whatwg.org/#dom-url-searchparams - searchParams: accessorDescriptor(getSearchParams), - // `URL.prototype.hash` accessors pair - // https://url.spec.whatwg.org/#dom-url-hash - hash: accessorDescriptor(getHash, function (hash) { - var url = getInternalURLState(this); - hash = String(hash); - if (hash == '') { - url.fragment = null; - return; - } - if ('#' == hash.charAt(0)) hash = hash.slice(1); - url.fragment = ''; - parseURL(url, hash, FRAGMENT); - }) - }); -} - -// `URL.prototype.toJSON` method -// https://url.spec.whatwg.org/#dom-url-tojson -redefine(URLPrototype, 'toJSON', function toJSON() { - return serializeURL.call(this); -}, { enumerable: true }); - -// `URL.prototype.toString` method -// https://url.spec.whatwg.org/#URL-stringification-behavior -redefine(URLPrototype, 'toString', function toString() { - return serializeURL.call(this); -}, { enumerable: true }); - -if (NativeURL) { - var nativeCreateObjectURL = NativeURL.createObjectURL; - var nativeRevokeObjectURL = NativeURL.revokeObjectURL; - // `URL.createObjectURL` method - // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL - // eslint-disable-next-line no-unused-vars - if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) { - return nativeCreateObjectURL.apply(NativeURL, arguments); - }); - // `URL.revokeObjectURL` method - // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL - // eslint-disable-next-line no-unused-vars - if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) { - return nativeRevokeObjectURL.apply(NativeURL, arguments); - }); -} - -setToStringTag(URLConstructor, 'URL'); - -$({ global: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, { - URL: URLConstructor -}); - -},{"../internals/an-instance":123,"../internals/array-from":130,"../internals/descriptors":156,"../internals/export":160,"../internals/global":173,"../internals/has":174,"../internals/internal-state":183,"../internals/native-url":201,"../internals/object-assign":206,"../internals/object-define-properties":208,"../internals/punycode-to-ascii":227,"../internals/redefine":229,"../internals/set-to-string-tag":237,"../internals/string-multibyte":242,"../modules/es.string.iterator":391,"../modules/web.url-search-params":463}],465:[function(require,module,exports){ -'use strict'; -var $ = require('../internals/export'); - -// `URL.prototype.toJSON` method -// https://url.spec.whatwg.org/#dom-url-tojson -$({ target: 'URL', proto: true, enumerable: true }, { - toJSON: function toJSON() { - return URL.prototype.toString.call(this); - } -}); - -},{"../internals/export":160}],466:[function(require,module,exports){ -(function (Buffer){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. - -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) - -},{"../../is-buffer/index.js":549}],467:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var Errors_1 = require("./Errors"); -var Argument = /** @class */ (function () { - function Argument(group, parameterType) { - this.group = group; - this.parameterType = parameterType; - this.group = group; - this.parameterType = parameterType; - } - Argument.build = function (treeRegexp, text, parameterTypes) { - var group = treeRegexp.match(text); - if (!group) { - return null; - } - var argGroups = group.children; - if (argGroups.length !== parameterTypes.length) { - throw new Errors_1.CucumberExpressionError("Expression " + treeRegexp.regexp + " has " + argGroups.length + " capture groups (" + argGroups.map(function (g) { return g.value; }) + "), but there were " + parameterTypes.length + " parameter types (" + parameterTypes.map(function (p) { return p.name; }) + ")"); - } - return parameterTypes.map(function (parameterType, i) { return new Argument(argGroups[i], parameterType); }); - }; - /** - * Get the value returned by the parameter type's transformer function. - * - * @param thisObj the object in which the transformer function is applied. - */ - Argument.prototype.getValue = function (thisObj) { - var groupValues = this.group ? this.group.values : null; - return this.parameterType.transform(thisObj, groupValues); - }; - Argument.prototype.getParameterType = function () { - return this.parameterType; - }; - return Argument; -}()); -exports.default = Argument; -module.exports = Argument; - -},{"./Errors":471}],468:[function(require,module,exports){ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var GeneratedExpression_1 = __importDefault(require("./GeneratedExpression")); -// 256 generated expressions ought to be enough for anybody -var MAX_EXPRESSIONS = 256; -var CombinatorialGeneratedExpressionFactory = /** @class */ (function () { - function CombinatorialGeneratedExpressionFactory(expressionTemplate, parameterTypeCombinations) { - this.expressionTemplate = expressionTemplate; - this.parameterTypeCombinations = parameterTypeCombinations; - this.expressionTemplate = expressionTemplate; - } - CombinatorialGeneratedExpressionFactory.prototype.generateExpressions = function () { - var generatedExpressions = []; - this.generatePermutations(generatedExpressions, 0, []); - return generatedExpressions; - }; - CombinatorialGeneratedExpressionFactory.prototype.generatePermutations = function (generatedExpressions, depth, currentParameterTypes) { - if (generatedExpressions.length >= MAX_EXPRESSIONS) { - return; - } - if (depth === this.parameterTypeCombinations.length) { - generatedExpressions.push(new GeneratedExpression_1.default(this.expressionTemplate, currentParameterTypes)); - return; - } - // tslint:disable-next-line:prefer-for-of - for (var i = 0; i < this.parameterTypeCombinations[depth].length; ++i) { - // Avoid recursion if no elements can be added. - if (generatedExpressions.length >= MAX_EXPRESSIONS) { - return; - } - var newCurrentParameterTypes = currentParameterTypes.slice(); // clone - newCurrentParameterTypes.push(this.parameterTypeCombinations[depth][i]); - this.generatePermutations(generatedExpressions, depth + 1, newCurrentParameterTypes); - } - }; - return CombinatorialGeneratedExpressionFactory; -}()); -exports.default = CombinatorialGeneratedExpressionFactory; - -},{"./GeneratedExpression":472}],469:[function(require,module,exports){ -"use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var ParameterType_1 = __importDefault(require("./ParameterType")); -var TreeRegexp_1 = __importDefault(require("./TreeRegexp")); -var Argument_1 = __importDefault(require("./Argument")); -var Errors_1 = require("./Errors"); -// RegExps with the g flag are stateful in JavaScript. In order to be able -// to reuse them we have to wrap them in a function. -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test -// Does not include (){} characters because they have special meaning -var ESCAPE_REGEXP = function () { return /([\\^[$.|?*+])/g; }; -var PARAMETER_REGEXP = function () { return /(\\\\)?{([^}]*)}/g; }; -var OPTIONAL_REGEXP = function () { return /(\\\\)?\(([^)]+)\)/g; }; -var ALTERNATIVE_NON_WHITESPACE_TEXT_REGEXP = function () { - return /([^\s^/]+)((\/[^\s^/]+)+)/g; -}; -var DOUBLE_ESCAPE = '\\\\'; -var PARAMETER_TYPES_CANNOT_BE_ALTERNATIVE = 'Parameter types cannot be alternative: '; -var PARAMETER_TYPES_CANNOT_BE_OPTIONAL = 'Parameter types cannot be optional: '; -var CucumberExpression = /** @class */ (function () { - /** - * @param expression - * @param parameterTypeRegistry - */ - function CucumberExpression(expression, parameterTypeRegistry) { - this.expression = expression; - this.parameterTypeRegistry = parameterTypeRegistry; - this.parameterTypes = []; - var expr = this.processEscapes(expression); - expr = this.processOptional(expr); - expr = this.processAlternation(expr); - expr = this.processParameters(expr, parameterTypeRegistry); - expr = "^" + expr + "$"; - this.treeRegexp = new TreeRegexp_1.default(expr); - } - CucumberExpression.prototype.processEscapes = function (expression) { - return expression.replace(ESCAPE_REGEXP(), '\\$1'); - }; - CucumberExpression.prototype.processOptional = function (expression) { - var _this = this; - return expression.replace(OPTIONAL_REGEXP(), function (match, p1, p2) { - if (p1 === DOUBLE_ESCAPE) { - return "\\(" + p2 + "\\)"; - } - _this.checkNoParameterType(p2, PARAMETER_TYPES_CANNOT_BE_OPTIONAL); - return "(?:" + p2 + ")?"; - }); - }; - CucumberExpression.prototype.processAlternation = function (expression) { - var _this = this; - return expression.replace(ALTERNATIVE_NON_WHITESPACE_TEXT_REGEXP(), function (match) { - var e_1, _a; - // replace \/ with / - // replace / with | - var replacement = match.replace(/\//g, '|').replace(/\\\|/g, '/'); - if (replacement.indexOf('|') !== -1) { - try { - for (var _b = __values(replacement.split(/\|/)), _c = _b.next(); !_c.done; _c = _b.next()) { - var part = _c.value; - _this.checkNoParameterType(part, PARAMETER_TYPES_CANNOT_BE_ALTERNATIVE); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - return "(?:" + replacement + ")"; - } - else { - return replacement; - } - }); - }; - CucumberExpression.prototype.processParameters = function (expression, parameterTypeRegistry) { - var _this = this; - return expression.replace(PARAMETER_REGEXP(), function (match, p1, p2) { - if (p1 === DOUBLE_ESCAPE) { - return "\\{" + p2 + "\\}"; - } - var typeName = p2; - ParameterType_1.default.checkParameterTypeName(typeName); - var parameterType = parameterTypeRegistry.lookupByTypeName(typeName); - if (!parameterType) { - throw new Errors_1.UndefinedParameterTypeError(typeName); - } - _this.parameterTypes.push(parameterType); - return buildCaptureRegexp(parameterType.regexpStrings); - }); - }; - CucumberExpression.prototype.match = function (text) { - return Argument_1.default.build(this.treeRegexp, text, this.parameterTypes); - }; - Object.defineProperty(CucumberExpression.prototype, "regexp", { - get: function () { - return this.treeRegexp.regexp; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CucumberExpression.prototype, "source", { - get: function () { - return this.expression; - }, - enumerable: true, - configurable: true - }); - CucumberExpression.prototype.checkNoParameterType = function (s, message) { - if (s.match(PARAMETER_REGEXP())) { - throw new Errors_1.CucumberExpressionError(message + this.source); - } - }; - return CucumberExpression; -}()); -exports.default = CucumberExpression; -function buildCaptureRegexp(regexps) { - if (regexps.length === 1) { - return "(" + regexps[0] + ")"; - } - var captureGroups = regexps.map(function (group) { - return "(?:" + group + ")"; - }); - return "(" + captureGroups.join('|') + ")"; -} - -},{"./Argument":467,"./Errors":471,"./ParameterType":475,"./TreeRegexp":479}],470:[function(require,module,exports){ -"use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var ParameterTypeMatcher_1 = __importDefault(require("./ParameterTypeMatcher")); -var ParameterType_1 = __importDefault(require("./ParameterType")); -var util_1 = __importDefault(require("util")); -var CombinatorialGeneratedExpressionFactory_1 = __importDefault(require("./CombinatorialGeneratedExpressionFactory")); -var CucumberExpressionGenerator = /** @class */ (function () { - function CucumberExpressionGenerator(parameterTypeRegistry) { - this.parameterTypeRegistry = parameterTypeRegistry; - } - CucumberExpressionGenerator.prototype.generateExpressions = function (text) { - var parameterTypeCombinations = []; - var parameterTypeMatchers = this.createParameterTypeMatchers(text); - var expressionTemplate = ''; - var pos = 0; - var _loop_1 = function () { - var e_1, _a, e_2, _b; - var matchingParameterTypeMatchers = []; - try { - for (var parameterTypeMatchers_1 = (e_1 = void 0, __values(parameterTypeMatchers)), parameterTypeMatchers_1_1 = parameterTypeMatchers_1.next(); !parameterTypeMatchers_1_1.done; parameterTypeMatchers_1_1 = parameterTypeMatchers_1.next()) { - var parameterTypeMatcher = parameterTypeMatchers_1_1.value; - var advancedParameterTypeMatcher = parameterTypeMatcher.advanceTo(pos); - if (advancedParameterTypeMatcher.find) { - matchingParameterTypeMatchers.push(advancedParameterTypeMatcher); - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (parameterTypeMatchers_1_1 && !parameterTypeMatchers_1_1.done && (_a = parameterTypeMatchers_1.return)) _a.call(parameterTypeMatchers_1); - } - finally { if (e_1) throw e_1.error; } - } - if (matchingParameterTypeMatchers.length > 0) { - matchingParameterTypeMatchers = matchingParameterTypeMatchers.sort(ParameterTypeMatcher_1.default.compare); - // Find all the best parameter type matchers, they are all candidates. - var bestParameterTypeMatcher_1 = matchingParameterTypeMatchers[0]; - var bestParameterTypeMatchers = matchingParameterTypeMatchers.filter(function (m) { return ParameterTypeMatcher_1.default.compare(m, bestParameterTypeMatcher_1) === 0; }); - // Build a list of parameter types without duplicates. The reason there - // might be duplicates is that some parameter types have more than one regexp, - // which means multiple ParameterTypeMatcher objects will have a reference to the - // same ParameterType. - // We're sorting the list so preferential parameter types are listed first. - // Users are most likely to want these, so they should be listed at the top. - var parameterTypes = []; - try { - for (var bestParameterTypeMatchers_1 = (e_2 = void 0, __values(bestParameterTypeMatchers)), bestParameterTypeMatchers_1_1 = bestParameterTypeMatchers_1.next(); !bestParameterTypeMatchers_1_1.done; bestParameterTypeMatchers_1_1 = bestParameterTypeMatchers_1.next()) { - var parameterTypeMatcher = bestParameterTypeMatchers_1_1.value; - if (parameterTypes.indexOf(parameterTypeMatcher.parameterType) === -1) { - parameterTypes.push(parameterTypeMatcher.parameterType); - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (bestParameterTypeMatchers_1_1 && !bestParameterTypeMatchers_1_1.done && (_b = bestParameterTypeMatchers_1.return)) _b.call(bestParameterTypeMatchers_1); - } - finally { if (e_2) throw e_2.error; } - } - parameterTypes = parameterTypes.sort(ParameterType_1.default.compare); - parameterTypeCombinations.push(parameterTypes); - expressionTemplate += escape(text.slice(pos, bestParameterTypeMatcher_1.start)); - expressionTemplate += '{%s}'; - pos = - bestParameterTypeMatcher_1.start + bestParameterTypeMatcher_1.group.length; - } - else { - return "break"; - } - if (pos >= text.length) { - return "break"; - } - }; - // eslint-disable-next-line no-constant-condition - while (true) { - var state_1 = _loop_1(); - if (state_1 === "break") - break; - } - expressionTemplate += escape(text.slice(pos)); - return new CombinatorialGeneratedExpressionFactory_1.default(expressionTemplate, parameterTypeCombinations).generateExpressions(); - }; - /** - * @deprecated - */ - CucumberExpressionGenerator.prototype.generateExpression = function (text) { - var _this = this; - return util_1.default.deprecate(function () { return _this.generateExpressions(text)[0]; }, 'CucumberExpressionGenerator.generateExpression: Use CucumberExpressionGenerator.generateExpressions instead')(); - }; - CucumberExpressionGenerator.prototype.createParameterTypeMatchers = function (text) { - var e_3, _a; - var parameterMatchers = []; - try { - for (var _b = __values(this.parameterTypeRegistry.parameterTypes), _c = _b.next(); !_c.done; _c = _b.next()) { - var parameterType = _c.value; - if (parameterType.useForSnippets) { - parameterMatchers = parameterMatchers.concat(CucumberExpressionGenerator.createParameterTypeMatchers2(parameterType, text)); - } - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_3) throw e_3.error; } - } - return parameterMatchers; - }; - CucumberExpressionGenerator.createParameterTypeMatchers2 = function (parameterType, text) { - var e_4, _a; - // TODO: [].map - var result = []; - try { - for (var _b = __values(parameterType.regexpStrings), _c = _b.next(); !_c.done; _c = _b.next()) { - var regexp = _c.value; - result.push(new ParameterTypeMatcher_1.default(parameterType, regexp, text)); - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_4) throw e_4.error; } - } - return result; - }; - return CucumberExpressionGenerator; -}()); -exports.default = CucumberExpressionGenerator; -function escape(s) { - return s - .replace(/%/g, '%%') // for util.format - .replace(/\(/g, '\\(') - .replace(/{/g, '\\{') - .replace(/\//g, '\\/'); -} -module.exports = CucumberExpressionGenerator; - -},{"./CombinatorialGeneratedExpressionFactory":468,"./ParameterType":475,"./ParameterTypeMatcher":476,"util":634}],471:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var CucumberExpressionError = /** @class */ (function (_super) { - __extends(CucumberExpressionError, _super); - function CucumberExpressionError() { - return _super !== null && _super.apply(this, arguments) || this; - } - return CucumberExpressionError; -}(Error)); -exports.CucumberExpressionError = CucumberExpressionError; -var AmbiguousParameterTypeError = /** @class */ (function (_super) { - __extends(AmbiguousParameterTypeError, _super); - function AmbiguousParameterTypeError() { - return _super !== null && _super.apply(this, arguments) || this; - } - AmbiguousParameterTypeError.forConstructor = function (keyName, keyValue, parameterTypes, generatedExpressions) { - return new this("parameter type with " + keyName + "=" + keyValue + " is used by several parameter types: " + parameterTypes + ", " + generatedExpressions); - }; - AmbiguousParameterTypeError.forRegExp = function (parameterTypeRegexp, expressionRegexp, parameterTypes, generatedExpressions) { - return new this("Your Regular Expression " + expressionRegexp + "\nmatches multiple parameter types with regexp " + parameterTypeRegexp + ":\n " + this._parameterTypeNames(parameterTypes) + "\n\nI couldn't decide which one to use. You have two options:\n\n1) Use a Cucumber Expression instead of a Regular Expression. Try one of these:\n " + this._expressions(generatedExpressions) + "\n\n2) Make one of the parameter types preferential and continue to use a Regular Expression.\n"); - }; - AmbiguousParameterTypeError._parameterTypeNames = function (parameterTypes) { - return parameterTypes.map(function (p) { return "{" + p.name + "}"; }).join('\n '); - }; - AmbiguousParameterTypeError._expressions = function (generatedExpressions) { - return generatedExpressions.map(function (e) { return e.source; }).join('\n '); - }; - return AmbiguousParameterTypeError; -}(CucumberExpressionError)); -exports.AmbiguousParameterTypeError = AmbiguousParameterTypeError; -var UndefinedParameterTypeError = /** @class */ (function (_super) { - __extends(UndefinedParameterTypeError, _super); - function UndefinedParameterTypeError(typeName) { - return _super.call(this, "Undefined parameter type {" + typeName + "}") || this; - } - return UndefinedParameterTypeError; -}(CucumberExpressionError)); -exports.UndefinedParameterTypeError = UndefinedParameterTypeError; - -},{}],472:[function(require,module,exports){ -"use strict"; -var __read = (this && this.__read) || function (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; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var util_1 = __importDefault(require("util")); -var GeneratedExpression = /** @class */ (function () { - function GeneratedExpression(expressionTemplate, parameterTypes) { - this.expressionTemplate = expressionTemplate; - this.parameterTypes = parameterTypes; - } - Object.defineProperty(GeneratedExpression.prototype, "source", { - get: function () { - return util_1.default.format.apply(util_1.default, __spread([this.expressionTemplate], this.parameterTypes.map(function (t) { return t.name; }))); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(GeneratedExpression.prototype, "parameterNames", { - /** - * Returns an array of parameter names to use in generated function/method signatures - * - * @returns {Array.} - */ - get: function () { - var usageByTypeName = {}; - return this.parameterTypes.map(function (t) { - return getParameterName(t.name, usageByTypeName); - }); - }, - enumerable: true, - configurable: true - }); - return GeneratedExpression; -}()); -exports.default = GeneratedExpression; -function getParameterName(typeName, usageByTypeName) { - var count = usageByTypeName[typeName]; - count = count ? count + 1 : 1; - usageByTypeName[typeName] = count; - return count === 1 ? typeName : "" + typeName + count; -} - -},{"util":634}],473:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var Group = /** @class */ (function () { - function Group(value, start, end, children) { - this.value = value; - this.start = start; - this.end = end; - this.children = children; - } - Object.defineProperty(Group.prototype, "values", { - get: function () { - return (this.children.length === 0 ? [this] : this.children) - .filter(function (g) { return typeof g.start !== 'undefined'; }) - .map(function (g) { return g.value; }); - }, - enumerable: true, - configurable: true - }); - return Group; -}()); -exports.default = Group; - -},{}],474:[function(require,module,exports){ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var Group_1 = __importDefault(require("./Group")); -var GroupBuilder = /** @class */ (function () { - function GroupBuilder() { - this.capturing = true; - this.groupBuilders = []; - } - GroupBuilder.prototype.add = function (groupBuilder) { - this.groupBuilders.push(groupBuilder); - }; - GroupBuilder.prototype.build = function (match, nextGroupIndex) { - var groupIndex = nextGroupIndex(); - var children = this.groupBuilders.map(function (gb) { - return gb.build(match, nextGroupIndex); - }); - return new Group_1.default(match[groupIndex] || null, match.index[groupIndex], match.index[groupIndex] + (match[groupIndex] || '').length, children); - }; - GroupBuilder.prototype.setNonCapturing = function () { - this.capturing = false; - }; - Object.defineProperty(GroupBuilder.prototype, "children", { - get: function () { - return this.groupBuilders; - }, - enumerable: true, - configurable: true - }); - GroupBuilder.prototype.moveChildrenTo = function (groupBuilder) { - this.groupBuilders.forEach(function (child) { return groupBuilder.add(child); }); - }; - return GroupBuilder; -}()); -exports.default = GroupBuilder; - -},{"./Group":473}],475:[function(require,module,exports){ -"use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var Errors_1 = require("./Errors"); -var ILLEGAL_PARAMETER_NAME_PATTERN = /([[\]()$.|?*+])/; -var UNESCAPE_PATTERN = function () { return /(\\([[$.|?*+\]]))/g; }; -var ParameterType = /** @class */ (function () { - /** - * @param name {String} the name of the type - * @param regexps {Array.,RegExp,Array.,String} that matches the type - * @param type {Function} the prototype (constructor) of the type. May be null. - * @param transform {Function} function transforming string to another type. May be null. - * @param useForSnippets {boolean} true if this should be used for snippets. Defaults to true. - * @param preferForRegexpMatch {boolean} true if this is a preferential type. Defaults to false. - */ - function ParameterType(name, regexps, type, transform, useForSnippets, preferForRegexpMatch) { - this.name = name; - this.type = type; - this.useForSnippets = useForSnippets; - this.preferForRegexpMatch = preferForRegexpMatch; - if (transform === undefined) { - transform = function (s) { return s; }; - } - if (useForSnippets === undefined) { - this.useForSnippets = true; - } - if (preferForRegexpMatch === undefined) { - this.preferForRegexpMatch = false; - } - if (name) { - ParameterType.checkParameterTypeName(name); - } - this.regexpStrings = stringArray(regexps); - this.transformFn = transform; - } - ParameterType.compare = function (pt1, pt2) { - if (pt1.preferForRegexpMatch && !pt2.preferForRegexpMatch) { - return -1; - } - if (pt2.preferForRegexpMatch && !pt1.preferForRegexpMatch) { - return 1; - } - return pt1.name.localeCompare(pt2.name); - }; - ParameterType.checkParameterTypeName = function (typeName) { - var unescapedTypeName = typeName.replace(UNESCAPE_PATTERN(), '$2'); - var match = unescapedTypeName.match(ILLEGAL_PARAMETER_NAME_PATTERN); - if (match) { - throw new Errors_1.CucumberExpressionError("Illegal character '" + match[1] + "' in parameter name {" + unescapedTypeName + "}"); - } - }; - ParameterType.prototype.transform = function (thisObj, groupValues) { - return this.transformFn.apply(thisObj, groupValues); - }; - return ParameterType; -}()); -exports.default = ParameterType; -function stringArray(regexps) { - var array = Array.isArray(regexps) ? regexps : [regexps]; - return array.map(function (r) { - return r instanceof RegExp ? regexpSource(r) : r; - }); -} -function regexpSource(regexp) { - var e_1, _a; - var flags = regexpFlags(regexp); - try { - for (var _b = __values(['g', 'i', 'm', 'y']), _c = _b.next(); !_c.done; _c = _b.next()) { - var flag = _c.value; - if (flags.indexOf(flag) !== -1) { - throw new Errors_1.CucumberExpressionError("ParameterType Regexps can't use flag '" + flag + "'"); - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - return regexp.source; -} -// Backport RegExp.flags for Node 4.x -// https://github.com/nodejs/node/issues/8390 -function regexpFlags(regexp) { - var flags = regexp.flags; - if (flags === undefined) { - flags = ''; - if (regexp.ignoreCase) { - flags += 'i'; - } - if (regexp.global) { - flags += 'g'; - } - if (regexp.multiline) { - flags += 'm'; - } - } - return flags; -} - -},{"./Errors":471}],476:[function(require,module,exports){ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -// @ts-ignore -var xregexp_1 = __importDefault(require("xregexp")); -// Needed for Node8 support, should be able to remove once Node 8 reaches end of life -// (eta 2019-12-31) https://nodejs.org/en/about/releases/ -var whitespacePunctuationPattern = xregexp_1.default('\\s|\\p{P}', 'u'); -var ParameterTypeMatcher = /** @class */ (function () { - function ParameterTypeMatcher(parameterType, regexpString, text, matchPosition) { - if (matchPosition === void 0) { matchPosition = 0; } - this.parameterType = parameterType; - this.regexpString = regexpString; - this.text = text; - this.matchPosition = matchPosition; - var captureGroupRegexp = new RegExp("(" + regexpString + ")"); - this.match = captureGroupRegexp.exec(text.slice(this.matchPosition)); - } - ParameterTypeMatcher.prototype.advanceTo = function (newMatchPosition) { - for (var advancedPos = newMatchPosition; advancedPos < this.text.length; advancedPos++) { - var matcher = new ParameterTypeMatcher(this.parameterType, this.regexpString, this.text, advancedPos); - if (matcher.find) { - return matcher; - } - } - return new ParameterTypeMatcher(this.parameterType, this.regexpString, this.text, this.text.length); - }; - Object.defineProperty(ParameterTypeMatcher.prototype, "find", { - get: function () { - return this.match && this.group !== '' && this.full_word; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ParameterTypeMatcher.prototype, "start", { - get: function () { - return this.matchPosition + this.match.index; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ParameterTypeMatcher.prototype, "full_word", { - get: function () { - return this.match_start_word && this.match_end_word; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ParameterTypeMatcher.prototype, "match_start_word", { - get: function () { - return this.start == 0 || this.text[this.start - 1].match(whitespacePunctuationPattern); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ParameterTypeMatcher.prototype, "match_end_word", { - get: function () { - var next_character_index = this.start + this.group.length; - return next_character_index === this.text.length || this.text[next_character_index].match(whitespacePunctuationPattern); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ParameterTypeMatcher.prototype, "group", { - get: function () { - return this.match[0]; - }, - enumerable: true, - configurable: true - }); - ParameterTypeMatcher.compare = function (a, b) { - var posComparison = a.start - b.start; - if (posComparison !== 0) { - return posComparison; - } - var lengthComparison = b.group.length - a.group.length; - if (lengthComparison !== 0) { - return lengthComparison; - } - return 0; - }; - return ParameterTypeMatcher; -}()); -exports.default = ParameterTypeMatcher; -module.exports = ParameterTypeMatcher; - -},{"xregexp":644}],477:[function(require,module,exports){ -"use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var ParameterType_1 = __importDefault(require("./ParameterType")); -var CucumberExpressionGenerator_1 = __importDefault(require("./CucumberExpressionGenerator")); -var Errors_1 = require("./Errors"); -var ParameterTypeRegistry = /** @class */ (function () { - function ParameterTypeRegistry() { - this.parameterTypeByName = new Map(); - this.parameterTypesByRegexp = new Map(); - this.defineParameterType(new ParameterType_1.default('int', ParameterTypeRegistry.INTEGER_REGEXPS, Number, function (s) { return (s === undefined ? null : Number(s)); }, true, true)); - this.defineParameterType(new ParameterType_1.default('float', ParameterTypeRegistry.FLOAT_REGEXP, Number, function (s) { return (s === undefined ? null : parseFloat(s)); }, true, false)); - this.defineParameterType(new ParameterType_1.default('word', ParameterTypeRegistry.WORD_REGEXP, String, function (s) { return s; }, false, false)); - this.defineParameterType(new ParameterType_1.default('string', ParameterTypeRegistry.STRING_REGEXP, String, function (s) { return (s || '').replace(/\\"/g, '"').replace(/\\'/g, "'"); }, true, false)); - this.defineParameterType(new ParameterType_1.default('', ParameterTypeRegistry.ANONYMOUS_REGEXP, String, function (s) { return s; }, false, true)); - } - Object.defineProperty(ParameterTypeRegistry.prototype, "parameterTypes", { - get: function () { - return this.parameterTypeByName.values(); - }, - enumerable: true, - configurable: true - }); - ParameterTypeRegistry.prototype.lookupByTypeName = function (typeName) { - return this.parameterTypeByName.get(typeName); - }; - ParameterTypeRegistry.prototype.lookupByRegexp = function (parameterTypeRegexp, expressionRegexp, text) { - var parameterTypes = this.parameterTypesByRegexp.get(parameterTypeRegexp); - if (!parameterTypes) { - return null; - } - if (parameterTypes.length > 1 && !parameterTypes[0].preferForRegexpMatch) { - // We don't do this check on insertion because we only want to restrict - // ambiguiuty when we look up by Regexp. Users of CucumberExpression should - // not be restricted. - var generatedExpressions = new CucumberExpressionGenerator_1.default(this).generateExpressions(text); - throw Errors_1.AmbiguousParameterTypeError.forRegExp(parameterTypeRegexp, expressionRegexp, parameterTypes, generatedExpressions); - } - return parameterTypes[0]; - }; - ParameterTypeRegistry.prototype.defineParameterType = function (parameterType) { - var e_1, _a; - if (parameterType.name !== undefined) { - if (this.parameterTypeByName.has(parameterType.name)) { - if (parameterType.name.length === 0) { - throw new Error("The anonymous parameter type has already been defined"); - } - else { - throw new Error("There is already a parameter type with name " + parameterType.name); - } - } - this.parameterTypeByName.set(parameterType.name, parameterType); - } - try { - for (var _b = __values(parameterType.regexpStrings), _c = _b.next(); !_c.done; _c = _b.next()) { - var parameterTypeRegexp = _c.value; - if (!this.parameterTypesByRegexp.has(parameterTypeRegexp)) { - this.parameterTypesByRegexp.set(parameterTypeRegexp, []); - } - var parameterTypes = this.parameterTypesByRegexp.get(parameterTypeRegexp); - var existingParameterType = parameterTypes[0]; - if (parameterTypes.length > 0 && - existingParameterType.preferForRegexpMatch && - parameterType.preferForRegexpMatch) { - throw new Errors_1.CucumberExpressionError('There can only be one preferential parameter type per regexp. ' + - ("The regexp /" + parameterTypeRegexp + "/ is used for two preferential parameter types, {" + existingParameterType.name + "} and {" + parameterType.name + "}")); - } - if (parameterTypes.indexOf(parameterType) === -1) { - parameterTypes.push(parameterType); - this.parameterTypesByRegexp.set(parameterTypeRegexp, parameterTypes.sort(ParameterType_1.default.compare)); - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - }; - ParameterTypeRegistry.INTEGER_REGEXPS = [/-?\d+/, /\d+/]; - ParameterTypeRegistry.FLOAT_REGEXP = /(?=.*\d.*)[-+]?\d*(?:\.(?=\d.*))?\d*(?:\d+[E][+\-]?\d+)?/; - ParameterTypeRegistry.WORD_REGEXP = /[^\s]+/; - ParameterTypeRegistry.STRING_REGEXP = /"([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'/; - ParameterTypeRegistry.ANONYMOUS_REGEXP = /.*/; - return ParameterTypeRegistry; -}()); -exports.default = ParameterTypeRegistry; -module.exports = ParameterTypeRegistry; - -},{"./CucumberExpressionGenerator":470,"./Errors":471,"./ParameterType":475}],478:[function(require,module,exports){ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var Argument_1 = __importDefault(require("./Argument")); -var TreeRegexp_1 = __importDefault(require("./TreeRegexp")); -var ParameterType_1 = __importDefault(require("./ParameterType")); -var RegularExpression = /** @class */ (function () { - function RegularExpression(regexp, parameterTypeRegistry) { - this.regexp = regexp; - this.parameterTypeRegistry = parameterTypeRegistry; - this.treeRegexp = new TreeRegexp_1.default(regexp); - } - RegularExpression.prototype.match = function (text) { - var _this = this; - var parameterTypes = this.treeRegexp.groupBuilder.children.map(function (groupBuilder) { - var parameterTypeRegexp = groupBuilder.source; - return (_this.parameterTypeRegistry.lookupByRegexp(parameterTypeRegexp, _this.regexp, text) || - new ParameterType_1.default(null, parameterTypeRegexp, String, function (s) { return (s === undefined ? null : s); }, false, false)); - }); - return Argument_1.default.build(this.treeRegexp, text, parameterTypes); - }; - Object.defineProperty(RegularExpression.prototype, "source", { - get: function () { - return this.regexp.source; - }, - enumerable: true, - configurable: true - }); - return RegularExpression; -}()); -exports.default = RegularExpression; - -},{"./Argument":467,"./ParameterType":475,"./TreeRegexp":479}],479:[function(require,module,exports){ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var GroupBuilder_1 = __importDefault(require("./GroupBuilder")); -// @ts-ignore -var becke_ch__regex__s0_0_v1__base__pl__lib_1 = __importDefault(require("becke-ch--regex--s0-0-v1--base--pl--lib")); -var TreeRegexp = /** @class */ (function () { - function TreeRegexp(regexp) { - var _this = this; - this.regexp = 'string' === typeof regexp ? new RegExp(regexp) : regexp; - this.regex = new becke_ch__regex__s0_0_v1__base__pl__lib_1.default(this.regexp.source, this.regexp.flags); - var stack = [new GroupBuilder_1.default()]; - var groupStartStack = []; - var last = null; - var escaping = false; - var nonCapturingMaybe = false; - var charClass = false; - this.regexp.source.split('').forEach(function (c, n) { - if (c === '[' && !escaping) { - charClass = true; - } - else if (c === ']' && !escaping) { - charClass = false; - } - else if (c === '(' && !escaping && !charClass) { - stack.push(new GroupBuilder_1.default()); - groupStartStack.push(n + 1); - nonCapturingMaybe = false; - } - else if (c === ')' && !escaping && !charClass) { - var gb = stack.pop(); - var groupStart = groupStartStack.pop(); - if (gb.capturing) { - gb.source = _this.regexp.source.substring(groupStart, n); - stack[stack.length - 1].add(gb); - } - else { - gb.moveChildrenTo(stack[stack.length - 1]); - } - nonCapturingMaybe = false; - } - else if (c === '?' && last === '(') { - nonCapturingMaybe = true; - } - else if ((c === ':' || c === '!' || c === '=' || c === '<') && - last === '?' && - nonCapturingMaybe) { - stack[stack.length - 1].setNonCapturing(); - nonCapturingMaybe = false; - } - escaping = c === '\\' && !escaping; - last = c; - }); - this.groupBuilder = stack.pop(); - } - TreeRegexp.prototype.match = function (s) { - var match = this.regex.exec(s); - if (!match) { - return null; - } - var groupIndex = 0; - var nextGroupIndex = function () { return groupIndex++; }; - return this.groupBuilder.build(match, nextGroupIndex); - }; - return TreeRegexp; -}()); -exports.default = TreeRegexp; - -},{"./GroupBuilder":474,"becke-ch--regex--s0-0-v1--base--pl--lib":94}],480:[function(require,module,exports){ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -var CucumberExpression_1 = __importDefault(require("./CucumberExpression")); -var RegularExpression_1 = __importDefault(require("./RegularExpression")); -var CucumberExpressionGenerator_1 = __importDefault(require("./CucumberExpressionGenerator")); -var ParameterTypeRegistry_1 = __importDefault(require("./ParameterTypeRegistry")); -var ParameterType_1 = __importDefault(require("./ParameterType")); -module.exports = { - CucumberExpression: CucumberExpression_1.default, - RegularExpression: RegularExpression_1.default, - CucumberExpressionGenerator: CucumberExpressionGenerator_1.default, - ParameterTypeRegistry: ParameterTypeRegistry_1.default, - ParameterType: ParameterType_1.default, -}; - -},{"./CucumberExpression":469,"./CucumberExpressionGenerator":470,"./ParameterType":475,"./ParameterTypeRegistry":477,"./RegularExpression":478}],481:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var OPERAND = 'operand'; -var OPERATOR = 'operator'; -var PREC = { - '(': -2, - ')': -1, - or: 0, - and: 1, - not: 2, -}; -var ASSOC = { - or: 'left', - and: 'left', - not: 'right', -}; -/** - * Parses infix boolean expression (using Dijkstra's Shunting Yard algorithm) - * and builds a tree of expressions. The root node of the expression is returned. - * - * This expression can be evaluated by passing in an array of literals that resolve to true - */ -function parse(infix) { - var tokens = tokenize(infix); - if (tokens.length === 0) { - return new True(); - } - var expressions = []; - var operators = []; - var expectedTokenType = OPERAND; - tokens.forEach(function (token) { - if (isUnary(token)) { - check(expectedTokenType, OPERAND); - operators.push(token); - expectedTokenType = OPERAND; - } - else if (isBinary(token)) { - check(expectedTokenType, OPERATOR); - while (operators.length > 0 && - isOp(peek(operators)) && - ((ASSOC[token] === 'left' && PREC[token] <= PREC[peek(operators)]) || - (ASSOC[token] === 'right' && PREC[token] < PREC[peek(operators)]))) { - pushExpr(pop(operators), expressions); - } - operators.push(token); - expectedTokenType = OPERAND; - } - else if ('(' === token) { - check(expectedTokenType, OPERAND); - operators.push(token); - expectedTokenType = OPERAND; - } - else if (')' === token) { - check(expectedTokenType, OPERATOR); - while (operators.length > 0 && peek(operators) !== '(') { - pushExpr(pop(operators), expressions); - } - if (operators.length === 0) { - throw Error('Syntax error. Unmatched )'); - } - if (peek(operators) === '(') { - pop(operators); - } - expectedTokenType = OPERATOR; - } - else { - check(expectedTokenType, OPERAND); - pushExpr(token, expressions); - expectedTokenType = OPERATOR; - } - }); - while (operators.length > 0) { - if (peek(operators) === '(') { - throw Error('Syntax error. Unmatched ('); - } - pushExpr(pop(operators), expressions); - } - return pop(expressions); -} -exports.default = parse; -function tokenize(expr) { - var tokens = []; - var isEscaped = false; - var token; - for (var i = 0; i < expr.length; i++) { - var c = expr.charAt(i); - if ('\\' === c) { - isEscaped = true; - } - else { - if (/\s/.test(c)) { - // skip - if (token) { - // end of token - tokens.push(token.join('')); - token = undefined; - } - } - else { - if ((c === '(' || c === ')') && !isEscaped) { - if (token) { - // end of token - tokens.push(token.join('')); - token = undefined; - } - tokens.push(c); - continue; - } - token = token ? token : []; // start of token - token.push(c); - } - isEscaped = false; - } - } - if (token) { - tokens.push(token.join('')); - } - return tokens; -} -function isUnary(token) { - return 'not' === token; -} -function isBinary(token) { - return 'or' === token || 'and' === token; -} -function isOp(token) { - return ASSOC[token] !== undefined; -} -function check(expectedTokenType, tokenType) { - if (expectedTokenType !== tokenType) { - throw new Error('Syntax error. Expected ' + expectedTokenType); - } -} -function peek(stack) { - return stack[stack.length - 1]; -} -function pop(stack) { - if (stack.length === 0) { - throw new Error('empty stack'); - } - return stack.pop(); -} -function pushExpr(token, stack) { - if (token === 'and') { - var rightAndExpr = pop(stack); - stack.push(new And(pop(stack), rightAndExpr)); - } - else if (token === 'or') { - var rightOrExpr = pop(stack); - stack.push(new Or(pop(stack), rightOrExpr)); - } - else if (token === 'not') { - stack.push(new Not(pop(stack))); - } - else { - stack.push(new Literal(token)); - } -} -var Literal = /** @class */ (function () { - function Literal(value) { - this.value = value; - } - Literal.prototype.evaluate = function (variables) { - return variables.indexOf(this.value) !== -1; - }; - Literal.prototype.toString = function () { - return this.value.replace(/\(/g, '\\(').replace(/\)/g, '\\)'); - }; - return Literal; -}()); -var Or = /** @class */ (function () { - function Or(leftExpr, rightExpr) { - this.leftExpr = leftExpr; - this.rightExpr = rightExpr; - } - Or.prototype.evaluate = function (variables) { - return (this.leftExpr.evaluate(variables) || this.rightExpr.evaluate(variables)); - }; - Or.prototype.toString = function () { - return ('( ' + - this.leftExpr.toString() + - ' or ' + - this.rightExpr.toString() + - ' )'); - }; - return Or; -}()); -var And = /** @class */ (function () { - function And(leftExpr, rightExpr) { - this.leftExpr = leftExpr; - this.rightExpr = rightExpr; - } - And.prototype.evaluate = function (variables) { - return (this.leftExpr.evaluate(variables) && this.rightExpr.evaluate(variables)); - }; - And.prototype.toString = function () { - return ('( ' + - this.leftExpr.toString() + - ' and ' + - this.rightExpr.toString() + - ' )'); - }; - return And; -}()); -var Not = /** @class */ (function () { - function Not(expr) { - this.expr = expr; - } - Not.prototype.evaluate = function (variables) { - return !this.expr.evaluate(variables); - }; - Not.prototype.toString = function () { - return 'not ( ' + this.expr.toString() + ' )'; - }; - return Not; -}()); -var True = /** @class */ (function () { - function True() { - } - True.prototype.evaluate = function (variables) { - return true; - }; - True.prototype.toString = function () { - return 'true'; - }; - return True; -}()); - -},{}],482:[function(require,module,exports){ -"use strict"; - -var isValue = require("type/value/is") - , isPlainFunction = require("type/plain-function/is") - , assign = require("es5-ext/object/assign") - , normalizeOpts = require("es5-ext/object/normalize-options") - , contains = require("es5-ext/string/#/contains"); - -var d = (module.exports = function (dscr, value/*, options*/) { - var c, e, w, options, desc; - if (arguments.length < 2 || typeof dscr !== "string") { - options = value; - value = dscr; - dscr = null; - } else { - options = arguments[2]; - } - if (isValue(dscr)) { - c = contains.call(dscr, "c"); - e = contains.call(dscr, "e"); - w = contains.call(dscr, "w"); - } else { - c = w = true; - e = false; - } - - desc = { value: value, configurable: c, enumerable: e, writable: w }; - return !options ? desc : assign(normalizeOpts(options), desc); -}); - -d.gs = function (dscr, get, set/*, options*/) { - var c, e, options, desc; - if (typeof dscr !== "string") { - options = set; - set = get; - get = dscr; - dscr = null; - } else { - options = arguments[3]; - } - if (!isValue(get)) { - get = undefined; - } else if (!isPlainFunction(get)) { - options = get; - get = set = undefined; - } else if (!isValue(set)) { - set = undefined; - } else if (!isPlainFunction(set)) { - options = set; - set = undefined; - } - if (isValue(dscr)) { - c = contains.call(dscr, "c"); - e = contains.call(dscr, "e"); - } else { - c = true; - e = false; - } - - desc = { get: get, set: set, configurable: c, enumerable: e }; - return !options ? desc : assign(normalizeOpts(options), desc); -}; - -},{"es5-ext/object/assign":499,"es5-ext/object/normalize-options":507,"es5-ext/string/#/contains":509,"type/plain-function/is":626,"type/value/is":628}],483:[function(require,module,exports){ -"use strict"; - -var d = require("d") - , pad = require("es5-ext/number/#/pad") - , date = require("es5-ext/date/valid-date") - , daysInMonth = require("es5-ext/date/#/days-in-month") - , copy = require("es5-ext/date/#/copy") - , dfloor = require("es5-ext/date/#/floor-day") - , mfloor = require("es5-ext/date/#/floor-month") - , yfloor = require("es5-ext/date/#/floor-year") - , toInteger = require("es5-ext/number/to-integer") - , toPosInt = require("es5-ext/number/to-pos-integer") - , isValue = require("es5-ext/object/is-value"); - -var abs = Math.abs, format, toPrimitive, getYear, Duration, getCalcData; - -format = require("es5-ext/string/format-method")({ - y: function () { return String(abs(this.year)); }, - m: function () { return pad.call(abs(this.month), 2); }, - d: function () { return pad.call(abs(this.day), 2); }, - H: function () { return pad.call(abs(this.hour), 2); }, - M: function () { return pad.call(abs(this.minute), 2); }, - S: function () { return pad.call(abs(this.second), 2); }, - L: function () { return pad.call(abs(this.millisecond), 3); }, - - ms: function () { return String(abs(this.months)); }, - ds: function () { return String(abs(this.days)); }, - Hs: function () { return String(abs(this.hours)); }, - Ms: function () { return String(abs(this.minutes)); }, - Ss: function () { return String(abs(this.seconds)); }, - Ls: function () { return String(abs(this.milliseconds)); }, - - sign: function () { return this.to < this.from ? "-" : ""; } -}); - -getCalcData = function (duration) { - return duration.to < duration.from - ? { to: duration.from, from: duration.to, sign: -1 } - : { to: duration.to, from: duration.from, sign: 1 }; -}; - -Duration = module.exports = function (from, to) { - // Make it both constructor and factory - if (!(this instanceof Duration)) return new Duration(from, to); - - this.from = date(from); - this.to = isValue(to) ? date(to) : new Date(); -}; - -Duration.prototype = Object.create(Object.prototype, { - valueOf: d((toPrimitive = function () { return this.to - this.from; })), - millisecond: d.gs(function () { return this.milliseconds % 1000; }), - second: d.gs(function () { return this.seconds % 60; }), - minute: d.gs(function () { return this.minutes % 60; }), - hour: d.gs(function () { return this.hours % 24; }), - day: d.gs(function () { - var data = getCalcData(this); - var toDays = data.to.getDate(), fromDays = data.from.getDate(); - var isToLater = - data.to - dfloor.call(copy.call(data.to)) >= - data.from - dfloor.call(copy.call(data.from)); - var result; - if (toDays > fromDays) { - result = toDays - fromDays; - if (!isToLater) --result; - return data.sign * result; - } - if (toDays === fromDays && isToLater) { - return 0; - } - result = isToLater ? toDays : toDays - 1; - result += daysInMonth.call(data.from) - data.from.getDate(); - return data.sign * result; - }), - month: d.gs(function () { - var data = getCalcData(this); - return ( - data.sign * - (((12 - data.from.getMonth() + data.to.getMonth()) % 12) - - (data.from - mfloor.call(copy.call(data.from)) > - data.to - mfloor.call(copy.call(data.to)))) - ); - }), - year: d.gs( - (getYear = function () { - var data = getCalcData(this); - return ( - data.sign * - (data.to.getFullYear() - - data.from.getFullYear() - - (data.from - yfloor.call(copy.call(data.from)) > - data.to - yfloor.call(copy.call(data.to)))) - ); - }) - ), - - milliseconds: d.gs(toPrimitive, null), - seconds: d.gs(function () { return toInteger(this.valueOf() / 1000); }), - minutes: d.gs(function () { return toInteger(this.valueOf() / (1000 * 60)); }), - hours: d.gs(function () { return toInteger(this.valueOf() / (1000 * 60 * 60)); }), - days: d.gs(function () { return toInteger(this.valueOf() / (1000 * 60 * 60 * 24)); }), - months: d.gs(function () { - var data = getCalcData(this); - return ( - data.sign * - ((data.to.getFullYear() - data.from.getFullYear()) * 12 + - data.to.getMonth() - - data.from.getMonth() - - (data.from - mfloor.call(copy.call(data.from)) > - data.to - mfloor.call(copy.call(data.to)))) - ); - }), - years: d.gs(getYear), - - _resolveSign: d(function (isNonZero) { - if (!isNonZero) return ""; - return this.to < this.from ? "-" : ""; - }), - _toStringDefaultDate: d(function (threshold, s, isNonZero) { - if (!this.days && threshold < 0) return this._resolveSign(isNonZero) + s; - if (threshold-- <= 0) s = abs((isNonZero = this.day)) + "d" + (s ? " " : "") + s; - if (!this.months && threshold < 0) return this._resolveSign(isNonZero) + s; - if (threshold-- <= 0) s = abs((isNonZero = this.month)) + "m" + (s ? " " : "") + s; - if (this.years || threshold >= 0) { - s = abs((isNonZero = this.year)) + "y" + (s ? " " : "") + s; - } - return this._resolveSign(isNonZero) + s; - }), - _toStringDefault: d(function (threshold) { - var s = "", isNonZero; - if (threshold-- <= 0) s += "." + pad.call(abs((isNonZero = this.millisecond)), 3); - if (!this.seconds && threshold < 0) return this._resolveSign(isNonZero) + s; - if (threshold-- <= 0) { - isNonZero = this.second; - s = (this.minutes ? pad.call(abs(isNonZero), 2) : abs(isNonZero)) + s; - } - if (!this.minutes && threshold < 0) return this._resolveSign(isNonZero) + s; - if (threshold-- <= 0) { - isNonZero = this.minute; - s = - (this.hours || s ? pad.call(abs(isNonZero), 2) : abs(isNonZero)) + - (s ? ":" : "") + - s; - } - if (!this.hours && threshold < 0) return this._resolveSign(isNonZero) + s; - if (threshold-- <= 0) s = pad.call(abs((isNonZero = this.hour)), 2) + (s ? ":" : "") + s; - return this._toStringDefaultDate(threshold, s, isNonZero); - }), - _toString1: d(function (threshold) { - var tokens = [], isNonZero; - if (threshold-- <= 0) tokens.unshift(abs((isNonZero = this.millisecond)) + "ms"); - if (!this.seconds && threshold < 0) return this._resolveSign(isNonZero) + tokens.join(" "); - if (threshold-- <= 0) tokens.unshift(abs((isNonZero = this.second)) + "s"); - if (!this.minutes && threshold < 0) return this._resolveSign(isNonZero) + tokens.join(" "); - if (threshold-- <= 0) tokens.unshift(abs((isNonZero = this.minute)) + "m"); - if (!this.hours && threshold < 0) return this._resolveSign(isNonZero) + tokens.join(" "); - if (threshold-- <= 0) tokens.unshift(abs((isNonZero = this.hour)) + "h"); - if (!this.days && threshold < 0) return this._resolveSign(isNonZero) + tokens.join(" "); - if (threshold-- <= 0) tokens.unshift(abs((isNonZero = this.day)) + "d"); - if (!this.months && threshold < 0) return this._resolveSign(isNonZero) + tokens.join(" "); - if (threshold-- <= 0) tokens.unshift(abs((isNonZero = this.month)) + "m"); - if (!this.years && threshold < 0) return this._resolveSign(isNonZero) + tokens.join(" "); - tokens.unshift(abs((isNonZero = this.year)) + "y"); - return this._resolveSign(isNonZero) + tokens.join(" "); - }), - toString: d(function (pattern/*, threshold*/) { - var threshold; - if (!isValue(pattern)) pattern = 0; - if (isNaN(pattern)) return format.call(this, pattern); - pattern = Number(pattern); - threshold = toPosInt(arguments[1]); - if (pattern === 1) return this._toString1(threshold); - return this._toStringDefault(threshold); - }) -}); - -},{"d":482,"es5-ext/date/#/copy":485,"es5-ext/date/#/days-in-month":486,"es5-ext/date/#/floor-day":487,"es5-ext/date/#/floor-month":488,"es5-ext/date/#/floor-year":489,"es5-ext/date/valid-date":491,"es5-ext/number/#/pad":496,"es5-ext/number/to-integer":497,"es5-ext/number/to-pos-integer":498,"es5-ext/object/is-value":503,"es5-ext/string/format-method":516}],484:[function(require,module,exports){ -(function(root, factory) { - 'use strict'; - // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers. - - /* istanbul ignore next */ - if (typeof define === 'function' && define.amd) { - define('error-stack-parser', ['stackframe'], factory); - } else if (typeof exports === 'object') { - module.exports = factory(require('stackframe')); - } else { - root.ErrorStackParser = factory(root.StackFrame); - } -}(this, function ErrorStackParser(StackFrame) { - 'use strict'; - - var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+\:\d+/; - var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+\:\d+|\(native\))/m; - var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/; - - return { - /** - * Given an Error object, extract the most information from it. - * - * @param {Error} error object - * @return {Array} of StackFrames - */ - parse: function ErrorStackParser$$parse(error) { - if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') { - return this.parseOpera(error); - } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) { - return this.parseV8OrIE(error); - } else if (error.stack) { - return this.parseFFOrSafari(error); - } else { - throw new Error('Cannot parse given Error object'); - } - }, - - // Separate line and column numbers from a string of the form: (URI:Line:Column) - extractLocation: function ErrorStackParser$$extractLocation(urlLike) { - // Fail-fast but return locations like "(native)" - if (urlLike.indexOf(':') === -1) { - return [urlLike]; - } - - var regExp = /(.+?)(?:\:(\d+))?(?:\:(\d+))?$/; - var parts = regExp.exec(urlLike.replace(/[\(\)]/g, '')); - return [parts[1], parts[2] || undefined, parts[3] || undefined]; - }, - - parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) { - var filtered = error.stack.split('\n').filter(function(line) { - return !!line.match(CHROME_IE_STACK_REGEXP); - }, this); - - return filtered.map(function(line) { - if (line.indexOf('(eval ') > -1) { - // Throw away eval information until we implement stacktrace.js/stackframe#8 - line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, ''); - } - var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '('); - - // capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in - // case it has spaces in it, as the string is split on \s+ later on - var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/); - - // remove the parenthesized location from the line, if it was matched - sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine; - - var tokens = sanitizedLine.split(/\s+/).slice(1); - // if a location was matched, pass it to extractLocation() otherwise pop the last token - var locationParts = this.extractLocation(location ? location[1] : tokens.pop()); - var functionName = tokens.join(' ') || undefined; - var fileName = ['eval', ''].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0]; - - return new StackFrame({ - functionName: functionName, - fileName: fileName, - lineNumber: locationParts[1], - columnNumber: locationParts[2], - source: line - }); - }, this); - }, - - parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) { - var filtered = error.stack.split('\n').filter(function(line) { - return !line.match(SAFARI_NATIVE_CODE_REGEXP); - }, this); - - return filtered.map(function(line) { - // Throw away eval information until we implement stacktrace.js/stackframe#8 - if (line.indexOf(' > eval') > -1) { - line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g, ':$1'); - } - - if (line.indexOf('@') === -1 && line.indexOf(':') === -1) { - // Safari eval frames only have function names and nothing else - return new StackFrame({ - functionName: line - }); - } else { - var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/; - var matches = line.match(functionNameRegex); - var functionName = matches && matches[1] ? matches[1] : undefined; - var locationParts = this.extractLocation(line.replace(functionNameRegex, '')); - - return new StackFrame({ - functionName: functionName, - fileName: locationParts[0], - lineNumber: locationParts[1], - columnNumber: locationParts[2], - source: line - }); - } - }, this); - }, - - parseOpera: function ErrorStackParser$$parseOpera(e) { - if (!e.stacktrace || (e.message.indexOf('\n') > -1 && - e.message.split('\n').length > e.stacktrace.split('\n').length)) { - return this.parseOpera9(e); - } else if (!e.stack) { - return this.parseOpera10(e); - } else { - return this.parseOpera11(e); - } - }, - - parseOpera9: function ErrorStackParser$$parseOpera9(e) { - var lineRE = /Line (\d+).*script (?:in )?(\S+)/i; - var lines = e.message.split('\n'); - var result = []; - - for (var i = 2, len = lines.length; i < len; i += 2) { - var match = lineRE.exec(lines[i]); - if (match) { - result.push(new StackFrame({ - fileName: match[2], - lineNumber: match[1], - source: lines[i] - })); - } - } - - return result; - }, - - parseOpera10: function ErrorStackParser$$parseOpera10(e) { - var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i; - var lines = e.stacktrace.split('\n'); - var result = []; - - for (var i = 0, len = lines.length; i < len; i += 2) { - var match = lineRE.exec(lines[i]); - if (match) { - result.push( - new StackFrame({ - functionName: match[3] || undefined, - fileName: match[2], - lineNumber: match[1], - source: lines[i] - }) - ); - } - } - - return result; - }, - - // Opera 10.65+ Error.stack very similar to FF/Safari - parseOpera11: function ErrorStackParser$$parseOpera11(error) { - var filtered = error.stack.split('\n').filter(function(line) { - return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/); - }, this); - - return filtered.map(function(line) { - var tokens = line.split('@'); - var locationParts = this.extractLocation(tokens.pop()); - var functionCall = (tokens.shift() || ''); - var functionName = functionCall - .replace(//, '$2') - .replace(/\([^\)]*\)/g, '') || undefined; - var argsRaw; - if (functionCall.match(/\(([^\)]*)\)/)) { - argsRaw = functionCall.replace(/^[^\(]+\(([^\)]*)\)$/, '$1'); - } - var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ? - undefined : argsRaw.split(','); - - return new StackFrame({ - functionName: functionName, - args: args, - fileName: locationParts[0], - lineNumber: locationParts[1], - columnNumber: locationParts[2], - source: line - }); - }, this); - } - }; -})); - -},{"stackframe":605}],485:[function(require,module,exports){ -"use strict"; - -var getTime = Date.prototype.getTime; - -module.exports = function () { return new Date(getTime.call(this)); }; - -},{}],486:[function(require,module,exports){ -"use strict"; - -var getMonth = Date.prototype.getMonth; - -module.exports = function () { - switch (getMonth.call(this)) { - case 1: - return this.getFullYear() % 4 ? 28 : 29; - case 3: - case 5: - case 8: - case 10: - return 30; - default: - return 31; - } -}; - -},{}],487:[function(require,module,exports){ -"use strict"; - -var setHours = Date.prototype.setHours; - -module.exports = function () { - setHours.call(this, 0, 0, 0, 0); - return this; -}; - -},{}],488:[function(require,module,exports){ -"use strict"; - -var floorDay = require("./floor-day"); - -module.exports = function () { - floorDay.call(this).setDate(1); - return this; -}; - -},{"./floor-day":487}],489:[function(require,module,exports){ -"use strict"; - -var floorMonth = require("./floor-month"); - -module.exports = function () { - floorMonth.call(this).setMonth(0); - return this; -}; - -},{"./floor-month":488}],490:[function(require,module,exports){ -"use strict"; - -var objToString = Object.prototype.toString, id = objToString.call(new Date()); - -module.exports = function (value) { - return ( - (value && !isNaN(value) && (value instanceof Date || objToString.call(value) === id)) || - false - ); -}; - -},{}],491:[function(require,module,exports){ -"use strict"; - -var isDate = require("./is-date"); - -module.exports = function (value) { - if (!isDate(value)) throw new TypeError(value + " is not valid Date object"); - return value; -}; - -},{"./is-date":490}],492:[function(require,module,exports){ -"use strict"; - -// eslint-disable-next-line no-empty-function -module.exports = function () {}; - -},{}],493:[function(require,module,exports){ -"use strict"; - -module.exports = require("./is-implemented")() ? Math.sign : require("./shim"); - -},{"./is-implemented":494,"./shim":495}],494:[function(require,module,exports){ -"use strict"; - -module.exports = function () { - var sign = Math.sign; - if (typeof sign !== "function") return false; - return sign(10) === 1 && sign(-20) === -1; -}; - -},{}],495:[function(require,module,exports){ -"use strict"; - -module.exports = function (value) { - value = Number(value); - if (isNaN(value) || value === 0) return value; - return value > 0 ? 1 : -1; -}; - -},{}],496:[function(require,module,exports){ -"use strict"; - -var pad = require("../../string/#/pad") - , toPosInt = require("../to-pos-integer") - , toFixed = Number.prototype.toFixed; - -module.exports = function (length/*, precision*/) { - var precision; - length = toPosInt(length); - precision = toPosInt(arguments[1]); - - return pad.call( - precision ? toFixed.call(this, precision) : this, "0", - length + (precision ? 1 + precision : 0) - ); -}; - -},{"../../string/#/pad":512,"../to-pos-integer":498}],497:[function(require,module,exports){ -"use strict"; - -var sign = require("../math/sign") - , abs = Math.abs - , floor = Math.floor; - -module.exports = function (value) { - if (isNaN(value)) return 0; - value = Number(value); - if (value === 0 || !isFinite(value)) return value; - return sign(value) * floor(abs(value)); -}; - -},{"../math/sign":493}],498:[function(require,module,exports){ -"use strict"; - -var toInteger = require("./to-integer") - , max = Math.max; - -module.exports = function (value) { return max(0, toInteger(value)); }; - -},{"./to-integer":497}],499:[function(require,module,exports){ -"use strict"; - -module.exports = require("./is-implemented")() ? Object.assign : require("./shim"); - -},{"./is-implemented":500,"./shim":501}],500:[function(require,module,exports){ -"use strict"; - -module.exports = function () { - var assign = Object.assign, obj; - if (typeof assign !== "function") return false; - obj = { foo: "raz" }; - assign(obj, { bar: "dwa" }, { trzy: "trzy" }); - return obj.foo + obj.bar + obj.trzy === "razdwatrzy"; -}; - -},{}],501:[function(require,module,exports){ -"use strict"; - -var keys = require("../keys") - , value = require("../valid-value") - , max = Math.max; - -module.exports = function (dest, src/*, …srcn*/) { - var error, i, length = max(arguments.length, 2), assign; - dest = Object(value(dest)); - assign = function (key) { - try { - dest[key] = src[key]; - } catch (e) { - if (!error) error = e; - } - }; - for (i = 1; i < length; ++i) { - src = arguments[i]; - keys(src).forEach(assign); - } - if (error !== undefined) throw error; - return dest; -}; - -},{"../keys":504,"../valid-value":508}],502:[function(require,module,exports){ -// Deprecated - -"use strict"; - -module.exports = function (obj) { return typeof obj === "function"; }; - -},{}],503:[function(require,module,exports){ -"use strict"; - -var _undefined = require("../function/noop")(); // Support ES3 engines - -module.exports = function (val) { return val !== _undefined && val !== null; }; - -},{"../function/noop":492}],504:[function(require,module,exports){ -"use strict"; - -module.exports = require("./is-implemented")() ? Object.keys : require("./shim"); - -},{"./is-implemented":505,"./shim":506}],505:[function(require,module,exports){ -"use strict"; - -module.exports = function () { - try { - Object.keys("primitive"); - return true; - } catch (e) { - return false; - } -}; - -},{}],506:[function(require,module,exports){ -"use strict"; - -var isValue = require("../is-value"); - -var keys = Object.keys; - -module.exports = function (object) { return keys(isValue(object) ? Object(object) : object); }; - -},{"../is-value":503}],507:[function(require,module,exports){ -"use strict"; - -var isValue = require("./is-value"); - -var forEach = Array.prototype.forEach, create = Object.create; - -var process = function (src, obj) { - var key; - for (key in src) obj[key] = src[key]; -}; - -// eslint-disable-next-line no-unused-vars -module.exports = function (opts1/*, …options*/) { - var result = create(null); - forEach.call(arguments, function (options) { - if (!isValue(options)) return; - process(Object(options), result); - }); - return result; -}; - -},{"./is-value":503}],508:[function(require,module,exports){ -"use strict"; - -var isValue = require("./is-value"); - -module.exports = function (value) { - if (!isValue(value)) throw new TypeError("Cannot use null or undefined"); - return value; -}; - -},{"./is-value":503}],509:[function(require,module,exports){ -"use strict"; - -module.exports = require("./is-implemented")() ? String.prototype.contains : require("./shim"); - -},{"./is-implemented":510,"./shim":511}],510:[function(require,module,exports){ -"use strict"; - -var str = "razdwatrzy"; - -module.exports = function () { - if (typeof str.contains !== "function") return false; - return str.contains("dwa") === true && str.contains("foo") === false; -}; - -},{}],511:[function(require,module,exports){ -"use strict"; - -var indexOf = String.prototype.indexOf; - -module.exports = function (searchString/*, position*/) { - return indexOf.call(this, searchString, arguments[1]) > -1; -}; - -},{}],512:[function(require,module,exports){ -"use strict"; - -var toInteger = require("../../number/to-integer") - , value = require("../../object/valid-value") - , repeat = require("./repeat") - , abs = Math.abs - , max = Math.max; - -module.exports = function (fill/*, length*/) { - var self = String(value(this)), sLength = self.length, length = arguments[1]; - - length = isNaN(length) ? 1 : toInteger(length); - fill = repeat.call(String(fill), abs(length)); - if (length >= 0) return fill.slice(0, max(0, length - sLength)) + self; - return self + (sLength + length >= 0 ? "" : fill.slice(length + sLength)); -}; - -},{"../../number/to-integer":497,"../../object/valid-value":508,"./repeat":513}],513:[function(require,module,exports){ -"use strict"; - -module.exports = require("./is-implemented")() ? String.prototype.repeat : require("./shim"); - -},{"./is-implemented":514,"./shim":515}],514:[function(require,module,exports){ -"use strict"; - -var str = "foo"; - -module.exports = function () { - if (typeof str.repeat !== "function") return false; - return str.repeat(2) === "foofoo"; -}; - -},{}],515:[function(require,module,exports){ -// Thanks -// @rauchma http://www.2ality.com/2014/01/efficient-string-repeat.html -// @mathiasbynens https://github.com/mathiasbynens/String.prototype.repeat/blob/4a4b567def/repeat.js - -"use strict"; - -var value = require("../../../object/valid-value") - , toInteger = require("../../../number/to-integer"); - -module.exports = function (count) { - var str = String(value(this)), result; - count = toInteger(count); - if (count < 0) throw new RangeError("Count must be >= 0"); - if (!isFinite(count)) throw new RangeError("Count must be < ∞"); - - result = ""; - while (count) { - if (count % 2) result += str; - if (count > 1) str += str; - // eslint-disable-next-line no-bitwise - count >>= 1; - } - return result; -}; - -},{"../../../number/to-integer":497,"../../../object/valid-value":508}],516:[function(require,module,exports){ -"use strict"; - -var isCallable = require("../object/is-callable") - , value = require("../object/valid-value") - , call = Function.prototype.call; - -module.exports = function (fmap) { - fmap = Object(value(fmap)); - return function (pattern) { - var context = this; - value(context); - pattern = String(pattern); - return pattern.replace(/%([a-zA-Z]+)|\\([\u0000-\uffff])/g, function ( - match, - token, - escapeChar - ) { - var t, result; - if (escapeChar) return escapeChar; - t = token; - while (t && !(result = fmap[t])) t = t.slice(0, -1); - if (!result) return match; - if (isCallable(result)) result = call.call(result, context); - return result + token.slice(t.length); - }); - }; -}; - -},{"../object/is-callable":502,"../object/valid-value":508}],517:[function(require,module,exports){ -'use strict'; - -const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g; - -module.exports = string => { - if (typeof string !== 'string') { - throw new TypeError('Expected a string'); - } - - return string.replace(matchOperatorsRegex, '\\$&'); -}; - -},{}],518:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var objectCreate = Object.create || objectCreatePolyfill -var objectKeys = Object.keys || objectKeysPolyfill -var bind = Function.prototype.bind || functionBindPolyfill - -function EventEmitter() { - if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { - this._events = objectCreate(null); - this._eventsCount = 0; - } - - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -var defaultMaxListeners = 10; - -var hasDefineProperty; -try { - var o = {}; - if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); - hasDefineProperty = o.x === 0; -} catch (err) { hasDefineProperty = false } -if (hasDefineProperty) { - Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - // check whether the input is a positive number (whose value is zero or - // greater and not a NaN). - if (typeof arg !== 'number' || arg < 0 || arg !== arg) - throw new TypeError('"defaultMaxListeners" must be a positive number'); - defaultMaxListeners = arg; - } - }); -} else { - EventEmitter.defaultMaxListeners = defaultMaxListeners; -} - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || isNaN(n)) - throw new TypeError('"n" argument must be a positive number'); - this._maxListeners = n; - return this; -}; - -function $getMaxListeners(that) { - if (that._maxListeners === undefined) - return EventEmitter.defaultMaxListeners; - return that._maxListeners; -} - -EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return $getMaxListeners(this); -}; - -// These standalone emit* functions are used to optimize calling of event -// handlers for fast cases because emit() itself often has a variable number of -// arguments and can be deoptimized because of that. These functions always have -// the same number of arguments and thus do not get deoptimized, so the code -// inside them can execute faster. -function emitNone(handler, isFn, self) { - if (isFn) - handler.call(self); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self); - } -} -function emitOne(handler, isFn, self, arg1) { - if (isFn) - handler.call(self, arg1); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1); - } -} -function emitTwo(handler, isFn, self, arg1, arg2) { - if (isFn) - handler.call(self, arg1, arg2); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2); - } -} -function emitThree(handler, isFn, self, arg1, arg2, arg3) { - if (isFn) - handler.call(self, arg1, arg2, arg3); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2, arg3); - } -} - -function emitMany(handler, isFn, self, args) { - if (isFn) - handler.apply(self, args); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].apply(self, args); - } -} - -EventEmitter.prototype.emit = function emit(type) { - var er, handler, len, args, i, events; - var doError = (type === 'error'); - - events = this._events; - if (events) - doError = (doError && events.error == null); - else if (!doError) - return false; - - // If there is no 'error' event listener then throw. - if (doError) { - if (arguments.length > 1) - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; - } - return false; - } - - handler = events[type]; - - if (!handler) - return false; - - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); - } - - return true; -}; - -function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = target._events; - if (!events) { - events = target._events = objectCreate(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (events.newListener) { - target.emit('newListener', type, - listener.listener ? listener.listener : listener); - - // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - events = target._events; - } - existing = events[type]; - } - - if (!existing) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === 'function') { - // Adding the second element, need to change to array. - existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { - // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } - } - - // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } - } - } - - return target; -} - -EventEmitter.prototype.addListener = function addListener(type, listener) { - return _addListener(this, type, listener, false); -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.prependListener = - function prependListener(type, listener) { - return _addListener(this, type, listener, true); - }; - -function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - switch (arguments.length) { - case 0: - return this.listener.call(this.target); - case 1: - return this.listener.call(this.target, arguments[0]); - case 2: - return this.listener.call(this.target, arguments[0], arguments[1]); - case 3: - return this.listener.call(this.target, arguments[0], arguments[1], - arguments[2]); - default: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } - } -} - -function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; -} - -EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.on(type, _onceWrap(this, type, listener)); - return this; -}; - -EventEmitter.prototype.prependOnceListener = - function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; - -// Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener = - function removeListener(type, listener) { - var list, events, position, i, originalListener; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = this._events; - if (!events) - return this; - - list = events[type]; - if (!list) - return this; - - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else { - delete events[type]; - if (events.removeListener) - this.emit('removeListener', type, list.listener || listener); - } - } else if (typeof list !== 'function') { - position = -1; - - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } - - if (position < 0) - return this; - - if (position === 0) - list.shift(); - else - spliceOne(list, position); - - if (list.length === 1) - events[type] = list[0]; - - if (events.removeListener) - this.emit('removeListener', type, originalListener || listener); - } - - return this; - }; - -EventEmitter.prototype.removeAllListeners = - function removeAllListeners(type) { - var listeners, events, i; - - events = this._events; - if (!events) - return this; - - // not listening for removeListener, no need to emit - if (!events.removeListener) { - if (arguments.length === 0) { - this._events = objectCreate(null); - this._eventsCount = 0; - } else if (events[type]) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else - delete events[type]; - } - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - var keys = objectKeys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = objectCreate(null); - this._eventsCount = 0; - return this; - } - - listeners = events[type]; - - if (typeof listeners === 'function') { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } - - return this; - }; - -function _listeners(target, type, unwrap) { - var events = target._events; - - if (!events) - return []; - - var evlistener = events[type]; - if (!evlistener) - return []; - - if (typeof evlistener === 'function') - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); -} - -EventEmitter.prototype.listeners = function listeners(type) { - return _listeners(this, type, true); -}; - -EventEmitter.prototype.rawListeners = function rawListeners(type) { - return _listeners(this, type, false); -}; - -EventEmitter.listenerCount = function(emitter, type) { - if (typeof emitter.listenerCount === 'function') { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); - } -}; - -EventEmitter.prototype.listenerCount = listenerCount; -function listenerCount(type) { - var events = this._events; - - if (events) { - var evlistener = events[type]; - - if (typeof evlistener === 'function') { - return 1; - } else if (evlistener) { - return evlistener.length; - } - } - - return 0; -} - -EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; -}; - -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - -function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; -} - -function unwrapListeners(arr) { - var ret = new Array(arr.length); - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - return ret; -} - -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; -} - -},{}],519:[function(require,module,exports){ -(function (process){ -/* - * extsprintf.js: extended POSIX-style sprintf - */ - -var mod_assert = require('assert'); -var mod_util = require('util'); - -/* - * Public interface - */ -exports.sprintf = jsSprintf; -exports.printf = jsPrintf; -exports.fprintf = jsFprintf; - -/* - * Stripped down version of s[n]printf(3c). We make a best effort to throw an - * exception when given a format string we don't understand, rather than - * ignoring it, so that we won't break existing programs if/when we go implement - * the rest of this. - * - * This implementation currently supports specifying - * - field alignment ('-' flag), - * - zero-pad ('0' flag) - * - always show numeric sign ('+' flag), - * - field width - * - conversions for strings, decimal integers, and floats (numbers). - * - argument size specifiers. These are all accepted but ignored, since - * Javascript has no notion of the physical size of an argument. - * - * Everything else is currently unsupported, most notably precision, unsigned - * numbers, non-decimal numbers, and characters. - */ -function jsSprintf(ofmt) -{ - var regex = [ - '([^%]*)', /* normal text */ - '%', /* start of format */ - '([\'\\-+ #0]*?)', /* flags (optional) */ - '([1-9]\\d*)?', /* width (optional) */ - '(\\.([1-9]\\d*))?', /* precision (optional) */ - '[lhjztL]*?', /* length mods (ignored) */ - '([diouxXfFeEgGaAcCsSp%jr])' /* conversion */ - ].join(''); - - var re = new RegExp(regex); - - /* variadic arguments used to fill in conversion specifiers */ - var args = Array.prototype.slice.call(arguments, 1); - /* remaining format string */ - var fmt = ofmt; - - /* components of the current conversion specifier */ - var flags, width, precision, conversion; - var left, pad, sign, arg, match; - - /* return value */ - var ret = ''; - - /* current variadic argument (1-based) */ - var argn = 1; - /* 0-based position in the format string that we've read */ - var posn = 0; - /* 1-based position in the format string of the current conversion */ - var convposn; - /* current conversion specifier */ - var curconv; - - mod_assert.equal('string', typeof (fmt), - 'first argument must be a format string'); - - while ((match = re.exec(fmt)) !== null) { - ret += match[1]; - fmt = fmt.substring(match[0].length); - - /* - * Update flags related to the current conversion specifier's - * position so that we can report clear error messages. - */ - curconv = match[0].substring(match[1].length); - convposn = posn + match[1].length + 1; - posn += match[0].length; - - flags = match[2] || ''; - width = match[3] || 0; - precision = match[4] || ''; - conversion = match[6]; - left = false; - sign = false; - pad = ' '; - - if (conversion == '%') { - ret += '%'; - continue; - } - - if (args.length === 0) { - throw (jsError(ofmt, convposn, curconv, - 'has no matching argument ' + - '(too few arguments passed)')); - } - - arg = args.shift(); - argn++; - - if (flags.match(/[\' #]/)) { - throw (jsError(ofmt, convposn, curconv, - 'uses unsupported flags')); - } - - if (precision.length > 0) { - throw (jsError(ofmt, convposn, curconv, - 'uses non-zero precision (not supported)')); - } - - if (flags.match(/-/)) - left = true; - - if (flags.match(/0/)) - pad = '0'; - - if (flags.match(/\+/)) - sign = true; - - switch (conversion) { - case 's': - if (arg === undefined || arg === null) { - throw (jsError(ofmt, convposn, curconv, - 'attempted to print undefined or null ' + - 'as a string (argument ' + argn + ' to ' + - 'sprintf)')); - } - ret += doPad(pad, width, left, arg.toString()); - break; - - case 'd': - arg = Math.floor(arg); - /*jsl:fallthru*/ - case 'f': - sign = sign && arg > 0 ? '+' : ''; - ret += sign + doPad(pad, width, left, - arg.toString()); - break; - - case 'x': - ret += doPad(pad, width, left, arg.toString(16)); - break; - - case 'j': /* non-standard */ - if (width === 0) - width = 10; - ret += mod_util.inspect(arg, false, width); - break; - - case 'r': /* non-standard */ - ret += dumpException(arg); - break; - - default: - throw (jsError(ofmt, convposn, curconv, - 'is not supported')); - } - } - - ret += fmt; - return (ret); -} - -function jsError(fmtstr, convposn, curconv, reason) { - mod_assert.equal(typeof (fmtstr), 'string'); - mod_assert.equal(typeof (curconv), 'string'); - mod_assert.equal(typeof (convposn), 'number'); - mod_assert.equal(typeof (reason), 'string'); - return (new Error('format string "' + fmtstr + - '": conversion specifier "' + curconv + '" at character ' + - convposn + ' ' + reason)); -} - -function jsPrintf() { - var args = Array.prototype.slice.call(arguments); - args.unshift(process.stdout); - jsFprintf.apply(null, args); -} - -function jsFprintf(stream) { - var args = Array.prototype.slice.call(arguments, 1); - return (stream.write(jsSprintf.apply(this, args))); -} - -function doPad(chr, width, left, str) -{ - var ret = str; - - while (ret.length < width) { - if (left) - ret += chr; - else - ret = chr + ret; - } - - return (ret); -} - -/* - * This function dumps long stack traces for exceptions having a cause() method. - * See node-verror for an example. - */ -function dumpException(ex) -{ - var ret; - - if (!(ex instanceof Error)) - throw (new Error(jsSprintf('invalid type for %%r: %j', ex))); - - /* Note that V8 prepends "ex.stack" with ex.toString(). */ - ret = 'EXCEPTION: ' + ex.constructor.name + ': ' + ex.stack; - - if (ex.cause && typeof (ex.cause) === 'function') { - var cex = ex.cause(); - if (cex) { - ret += '\nCaused by: ' + dumpException(cex); - } - } - - return (ret); -} - -}).call(this,require('_process')) - -},{"_process":571,"assert":79,"util":634}],520:[function(require,module,exports){ -(function (process){ -'use strict'; -const escapeStringRegexp = require('escape-string-regexp'); - -const {platform} = process; - -const main = { - tick: '✔', - cross: '✖', - star: '★', - square: '▇', - squareSmall: '◻', - squareSmallFilled: '◼', - play: '▶', - circle: '◯', - circleFilled: '◉', - circleDotted: '◌', - circleDouble: '◎', - circleCircle: 'ⓞ', - circleCross: 'ⓧ', - circlePipe: 'Ⓘ', - circleQuestionMark: '?⃝', - bullet: '●', - dot: '․', - line: '─', - ellipsis: '…', - pointer: '❯', - pointerSmall: '›', - info: 'ℹ', - warning: '⚠', - hamburger: '☰', - smiley: '㋡', - mustache: '෴', - heart: '♥', - arrowUp: '↑', - arrowDown: '↓', - arrowLeft: '←', - arrowRight: '→', - radioOn: '◉', - radioOff: '◯', - checkboxOn: '☒', - checkboxOff: '☐', - checkboxCircleOn: 'ⓧ', - checkboxCircleOff: 'Ⓘ', - questionMarkPrefix: '?⃝', - oneHalf: '½', - oneThird: '⅓', - oneQuarter: '¼', - oneFifth: '⅕', - oneSixth: '⅙', - oneSeventh: '⅐', - oneEighth: '⅛', - oneNinth: '⅑', - oneTenth: '⅒', - twoThirds: '⅔', - twoFifths: '⅖', - threeQuarters: '¾', - threeFifths: '⅗', - threeEighths: '⅜', - fourFifths: '⅘', - fiveSixths: '⅚', - fiveEighths: '⅝', - sevenEighths: '⅞' -}; - -const windows = { - tick: '√', - cross: '×', - star: '*', - square: '█', - squareSmall: '[ ]', - squareSmallFilled: '[█]', - play: '►', - circle: '( )', - circleFilled: '(*)', - circleDotted: '( )', - circleDouble: '( )', - circleCircle: '(○)', - circleCross: '(×)', - circlePipe: '(│)', - circleQuestionMark: '(?)', - bullet: '*', - dot: '.', - line: '─', - ellipsis: '...', - pointer: '>', - pointerSmall: '»', - info: 'i', - warning: '‼', - hamburger: '≡', - smiley: '☺', - mustache: '┌─┐', - heart: main.heart, - arrowUp: main.arrowUp, - arrowDown: main.arrowDown, - arrowLeft: main.arrowLeft, - arrowRight: main.arrowRight, - radioOn: '(*)', - radioOff: '( )', - checkboxOn: '[×]', - checkboxOff: '[ ]', - checkboxCircleOn: '(×)', - checkboxCircleOff: '( )', - questionMarkPrefix: '?', - oneHalf: '1/2', - oneThird: '1/3', - oneQuarter: '1/4', - oneFifth: '1/5', - oneSixth: '1/6', - oneSeventh: '1/7', - oneEighth: '1/8', - oneNinth: '1/9', - oneTenth: '1/10', - twoThirds: '2/3', - twoFifths: '2/5', - threeQuarters: '3/4', - threeFifths: '3/5', - threeEighths: '3/8', - fourFifths: '4/5', - fiveSixths: '5/6', - fiveEighths: '5/8', - sevenEighths: '7/8' -}; - -if (platform === 'linux') { - // The main one doesn't look that good on Ubuntu - main.questionMarkPrefix = '?'; -} - -const figures = platform === 'win32' ? windows : main; - -const fn = string => { - if (figures === main) { - return string; - } - - for (const [key, value] of Object.entries(main)) { - if (value === figures[key]) { - continue; - } - - string = string.replace(new RegExp(escapeStringRegexp(value), 'g'), figures[key]); - } - - return string; -}; - -module.exports = Object.assign(fn, figures); - -}).call(this,require('_process')) - -},{"_process":571,"escape-string-regexp":521}],521:[function(require,module,exports){ -'use strict'; - -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; - -module.exports = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - - return str.replace(matchOperatorsRe, '\\$&'); -}; - -},{}],522:[function(require,module,exports){ -(function (process){ -module.exports = realpath -realpath.realpath = realpath -realpath.sync = realpathSync -realpath.realpathSync = realpathSync -realpath.monkeypatch = monkeypatch -realpath.unmonkeypatch = unmonkeypatch - -var fs = require('fs') -var origRealpath = fs.realpath -var origRealpathSync = fs.realpathSync - -var version = process.version -var ok = /^v[0-5]\./.test(version) -var old = require('./old.js') - -function newError (er) { - return er && er.syscall === 'realpath' && ( - er.code === 'ELOOP' || - er.code === 'ENOMEM' || - er.code === 'ENAMETOOLONG' - ) -} - -function realpath (p, cache, cb) { - if (ok) { - return origRealpath(p, cache, cb) - } - - if (typeof cache === 'function') { - cb = cache - cache = null - } - origRealpath(p, cache, function (er, result) { - if (newError(er)) { - old.realpath(p, cache, cb) - } else { - cb(er, result) - } - }) -} - -function realpathSync (p, cache) { - if (ok) { - return origRealpathSync(p, cache) - } - - try { - return origRealpathSync(p, cache) - } catch (er) { - if (newError(er)) { - return old.realpathSync(p, cache) - } else { - throw er - } - } -} - -function monkeypatch () { - fs.realpath = realpath - fs.realpathSync = realpathSync -} - -function unmonkeypatch () { - fs.realpath = origRealpath - fs.realpathSync = origRealpathSync -} - -}).call(this,require('_process')) - -},{"./old.js":523,"_process":571,"fs":98}],523:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var pathModule = require('path'); -var isWindows = process.platform === 'win32'; -var fs = require('fs'); - -// JavaScript implementation of realpath, ported from node pre-v6 - -var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); - -function rethrow() { - // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and - // is fairly slow to generate. - var callback; - if (DEBUG) { - var backtrace = new Error; - callback = debugCallback; - } else - callback = missingCallback; - - return callback; - - function debugCallback(err) { - if (err) { - backtrace.message = err.message; - err = backtrace; - missingCallback(err); - } - } - - function missingCallback(err) { - if (err) { - if (process.throwDeprecation) - throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs - else if (!process.noDeprecation) { - var msg = 'fs: missing callback ' + (err.stack || err.message); - if (process.traceDeprecation) - console.trace(msg); - else - console.error(msg); - } - } - } -} - -function maybeCallback(cb) { - return typeof cb === 'function' ? cb : rethrow(); -} - -var normalize = pathModule.normalize; - -// Regexp that finds the next partion of a (partial) path -// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] -if (isWindows) { - var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; -} else { - var nextPartRe = /(.*?)(?:[\/]+|$)/g; -} - -// Regex to find the device root, including trailing slash. E.g. 'c:\\'. -if (isWindows) { - var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; -} else { - var splitRootRe = /^[\/]*/; -} - -exports.realpathSync = function realpathSync(p, cache) { - // make p is absolute - p = pathModule.resolve(p); - - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return cache[p]; - } - - var original = p, - seenLinks = {}, - knownHard = {}; - - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; - - start(); - - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; - - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstatSync(base); - knownHard[base] = true; - } - } - - // walk down the path, swapping out linked pathparts for their real - // values - // NB: p.length changes. - while (pos < p.length) { - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; - - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - continue; - } - - var resolvedLink; - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // some known symbolic link. no need to stat again. - resolvedLink = cache[base]; - } else { - var stat = fs.lstatSync(base); - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - continue; - } - - // read the link if it wasn't read before - // dev/ino always return 0 on windows, so skip the check. - var linkTarget = null; - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - linkTarget = seenLinks[id]; - } - } - if (linkTarget === null) { - fs.statSync(base); - linkTarget = fs.readlinkSync(base); - } - resolvedLink = pathModule.resolve(previous, linkTarget); - // track this, if given a cache. - if (cache) cache[base] = resolvedLink; - if (!isWindows) seenLinks[id] = linkTarget; - } - - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } - - if (cache) cache[original] = p; - - return p; -}; - - -exports.realpath = function realpath(p, cache, cb) { - if (typeof cb !== 'function') { - cb = maybeCallback(cache); - cache = null; - } - - // make p is absolute - p = pathModule.resolve(p); - - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return process.nextTick(cb.bind(null, null, cache[p])); - } - - var original = p, - seenLinks = {}, - knownHard = {}; - - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; - - start(); - - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; - - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstat(base, function(err) { - if (err) return cb(err); - knownHard[base] = true; - LOOP(); - }); - } else { - process.nextTick(LOOP); - } - } - - // walk down the path, swapping out linked pathparts for their real - // values - function LOOP() { - // stop if scanned past end of path - if (pos >= p.length) { - if (cache) cache[original] = p; - return cb(null, p); - } - - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; - - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - return process.nextTick(LOOP); - } - - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // known symbolic link. no need to stat again. - return gotResolvedLink(cache[base]); - } - - return fs.lstat(base, gotStat); - } - - function gotStat(err, stat) { - if (err) return cb(err); - - // if not a symlink, skip to the next path part - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - return process.nextTick(LOOP); - } - - // stat & read the link if not read before - // call gotTarget as soon as the link target is known - // dev/ino always return 0 on windows, so skip the check. - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - return gotTarget(null, seenLinks[id], base); - } - } - fs.stat(base, function(err) { - if (err) return cb(err); - - fs.readlink(base, function(err, target) { - if (!isWindows) seenLinks[id] = target; - gotTarget(err, target); - }); - }); - } - - function gotTarget(err, target, base) { - if (err) return cb(err); - - var resolvedLink = pathModule.resolve(previous, target); - if (cache) cache[base] = resolvedLink; - gotResolvedLink(resolvedLink); - } - - function gotResolvedLink(resolvedLink) { - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } -}; - -}).call(this,require('_process')) - -},{"_process":571,"fs":98,"path":567}],524:[function(require,module,exports){ -(function (factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module - define([], factory) - } - if (typeof module !== 'undefined' && module.exports) { - // Node.js/RequireJS - module.exports = factory(); - } - if (typeof window === 'object'){ - // Browser globals - window.Gherkin = factory(); - } -}(function () { - return { - Parser: require('./lib/gherkin/parser'), - TokenScanner: require('./lib/gherkin/token_scanner'), - TokenMatcher: require('./lib/gherkin/token_matcher'), - AstBuilder: require('./lib/gherkin/ast_builder'), - Compiler: require('./lib/gherkin/pickles/compiler'), - DIALECTS: require('./lib/gherkin/dialects'), - generateEvents: require('./lib/gherkin/generate_events') - }; -})); - -},{"./lib/gherkin/ast_builder":525,"./lib/gherkin/dialects":528,"./lib/gherkin/generate_events":530,"./lib/gherkin/parser":533,"./lib/gherkin/pickles/compiler":534,"./lib/gherkin/token_matcher":536,"./lib/gherkin/token_scanner":537}],525:[function(require,module,exports){ -var AstNode = require('./ast_node'); -var Errors = require('./errors'); - -module.exports = function AstBuilder () { - - var stack = [new AstNode('None')]; - var comments = []; - - this.reset = function () { - stack = [new AstNode('None')]; - comments = []; - }; - - this.startRule = function (ruleType) { - stack.push(new AstNode(ruleType)); - }; - - this.endRule = function (ruleType) { - var node = stack.pop(); - var transformedNode = transformNode(node); - currentNode().add(node.ruleType, transformedNode); - }; - - this.build = function (token) { - if(token.matchedType === 'Comment') { - comments.push({ - type: 'Comment', - location: getLocation(token), - text: token.matchedText - }); - } else { - currentNode().add(token.matchedType, token); - } - }; - - this.getResult = function () { - return currentNode().getSingle('GherkinDocument'); - }; - - function currentNode () { - return stack[stack.length - 1]; - } - - function getLocation (token, column) { - return !column ? token.location : {line: token.location.line, column: column}; - } - - function getTags (node) { - var tags = []; - var tagsNode = node.getSingle('Tags'); - if (!tagsNode) return tags; - tagsNode.getTokens('TagLine').forEach(function (token) { - token.matchedItems.forEach(function (tagItem) { - tags.push({ - type: 'Tag', - location: getLocation(token, tagItem.column), - name: tagItem.text - }); - }); - - }); - return tags; - } - - function getCells(tableRowToken) { - return tableRowToken.matchedItems.map(function (cellItem) { - return { - type: 'TableCell', - location: getLocation(tableRowToken, cellItem.column), - value: cellItem.text - } - }); - } - - function getDescription (node) { - return node.getSingle('Description'); - } - - function getSteps (node) { - return node.getItems('Step'); - } - - function getTableRows(node) { - var rows = node.getTokens('TableRow').map(function (token) { - return { - type: 'TableRow', - location: getLocation(token), - cells: getCells(token) - }; - }); - ensureCellCount(rows); - return rows; - } - - function ensureCellCount(rows) { - if(rows.length == 0) return; - var cellCount = rows[0].cells.length; - - rows.forEach(function (row) { - if (row.cells.length != cellCount) { - throw Errors.AstBuilderException.create("inconsistent cell count within the table", row.location); - } - }); - } - - function transformNode(node) { - switch(node.ruleType) { - case 'Step': - var stepLine = node.getToken('StepLine'); - var stepArgument = node.getSingle('DataTable') || node.getSingle('DocString') || undefined; - - return { - type: node.ruleType, - location: getLocation(stepLine), - keyword: stepLine.matchedKeyword, - text: stepLine.matchedText, - argument: stepArgument - } - case 'DocString': - var separatorToken = node.getTokens('DocStringSeparator')[0]; - var contentType = separatorToken.matchedText.length > 0 ? separatorToken.matchedText : undefined; - var lineTokens = node.getTokens('Other'); - var content = lineTokens.map(function (t) {return t.matchedText}).join("\n"); - - var result = { - type: node.ruleType, - location: getLocation(separatorToken), - content: content - }; - // conditionally add this like this (needed to make tests pass on node 0.10 as well as 4.0) - if(contentType) { - result.contentType = contentType; - } - return result; - case 'DataTable': - var rows = getTableRows(node); - return { - type: node.ruleType, - location: rows[0].location, - rows: rows, - } - case 'Background': - var backgroundLine = node.getToken('BackgroundLine'); - var description = getDescription(node); - var steps = getSteps(node); - - return { - type: node.ruleType, - location: getLocation(backgroundLine), - keyword: backgroundLine.matchedKeyword, - name: backgroundLine.matchedText, - description: description, - steps: steps - }; - case 'Scenario_Definition': - var tags = getTags(node); - var scenarioNode = node.getSingle('Scenario'); - if(scenarioNode) { - var scenarioLine = scenarioNode.getToken('ScenarioLine'); - var description = getDescription(scenarioNode); - var steps = getSteps(scenarioNode); - - return { - type: scenarioNode.ruleType, - tags: tags, - location: getLocation(scenarioLine), - keyword: scenarioLine.matchedKeyword, - name: scenarioLine.matchedText, - description: description, - steps: steps - }; - } else { - var scenarioOutlineNode = node.getSingle('ScenarioOutline'); - if(!scenarioOutlineNode) throw new Error('Internal grammar error'); - - var scenarioOutlineLine = scenarioOutlineNode.getToken('ScenarioOutlineLine'); - var description = getDescription(scenarioOutlineNode); - var steps = getSteps(scenarioOutlineNode); - var examples = scenarioOutlineNode.getItems('Examples_Definition'); - - return { - type: scenarioOutlineNode.ruleType, - tags: tags, - location: getLocation(scenarioOutlineLine), - keyword: scenarioOutlineLine.matchedKeyword, - name: scenarioOutlineLine.matchedText, - description: description, - steps: steps, - examples: examples - }; - } - case 'Examples_Definition': - var tags = getTags(node); - var examplesNode = node.getSingle('Examples'); - var examplesLine = examplesNode.getToken('ExamplesLine'); - var description = getDescription(examplesNode); - var exampleTable = examplesNode.getSingle('Examples_Table') - - return { - type: examplesNode.ruleType, - tags: tags, - location: getLocation(examplesLine), - keyword: examplesLine.matchedKeyword, - name: examplesLine.matchedText, - description: description, - tableHeader: exampleTable != undefined ? exampleTable.tableHeader : undefined, - tableBody: exampleTable != undefined ? exampleTable.tableBody : undefined - }; - case 'Examples_Table': - var rows = getTableRows(node) - - return { - tableHeader: rows != undefined ? rows[0] : undefined, - tableBody: rows != undefined ? rows.slice(1) : undefined - }; - case 'Description': - var lineTokens = node.getTokens('Other'); - // Trim trailing empty lines - var end = lineTokens.length; - while (end > 0 && lineTokens[end-1].line.trimmedLineText === '') { - end--; - } - lineTokens = lineTokens.slice(0, end); - - var description = lineTokens.map(function (token) { return token.matchedText}).join("\n"); - return description; - - case 'Feature': - var header = node.getSingle('Feature_Header'); - if(!header) return null; - var tags = getTags(header); - var featureLine = header.getToken('FeatureLine'); - if(!featureLine) return null; - var children = [] - var background = node.getSingle('Background'); - if(background) children.push(background); - children = children.concat(node.getItems('Scenario_Definition')); - var description = getDescription(header); - var language = featureLine.matchedGherkinDialect; - - return { - type: node.ruleType, - tags: tags, - location: getLocation(featureLine), - language: language, - keyword: featureLine.matchedKeyword, - name: featureLine.matchedText, - description: description, - children: children, - }; - case 'GherkinDocument': - var feature = node.getSingle('Feature'); - - return { - type: node.ruleType, - feature: feature, - comments: comments - }; - default: - return node; - } - } - -}; - -},{"./ast_node":526,"./errors":529}],526:[function(require,module,exports){ -function AstNode (ruleType) { - this.ruleType = ruleType; - this._subItems = {}; -} - -AstNode.prototype.add = function (ruleType, obj) { - var items = this._subItems[ruleType]; - if(items === undefined) this._subItems[ruleType] = items = []; - items.push(obj); -} - -AstNode.prototype.getSingle = function (ruleType) { - return (this._subItems[ruleType] || [])[0]; -} - -AstNode.prototype.getItems = function (ruleType) { - return this._subItems[ruleType] || []; -} - -AstNode.prototype.getToken = function (tokenType) { - return this.getSingle(tokenType); -} - -AstNode.prototype.getTokens = function (tokenType) { - return this._subItems[tokenType] || []; -} - -module.exports = AstNode; - -},{}],527:[function(require,module,exports){ -// https://mathiasbynens.be/notes/javascript-unicode -var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; - -module.exports = function countSymbols(string) { - return string.replace(regexAstralSymbols, '_').length; -} - -},{}],528:[function(require,module,exports){ -module.exports = require('./gherkin-languages.json'); - -},{"./gherkin-languages.json":531}],529:[function(require,module,exports){ -var Errors = {}; - -[ - 'ParserException', - 'CompositeParserException', - 'UnexpectedTokenException', - 'UnexpectedEOFException', - 'AstBuilderException', - 'NoSuchLanguageException' -].forEach(function (name) { - - function ErrorProto (message) { - this.message = message || ('Unspecified ' + name); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, arguments.callee); - } - } - - ErrorProto.prototype = Object.create(Error.prototype); - ErrorProto.prototype.name = name; - ErrorProto.prototype.constructor = ErrorProto; - Errors[name] = ErrorProto; -}); - -Errors.CompositeParserException.create = function(errors) { - var message = "Parser errors:\n" + errors.map(function (e) { return e.message; }).join("\n"); - var err = new Errors.CompositeParserException(message); - err.errors = errors; - return err; -}; - -Errors.UnexpectedTokenException.create = function(token, expectedTokenTypes, stateComment) { - var message = "expected: " + expectedTokenTypes.join(', ') + ", got '" + token.getTokenValue().trim() + "'"; - var location = !token.location.column - ? {line: token.location.line, column: token.line.indent + 1 } - : token.location; - return createError(Errors.UnexpectedEOFException, message, location); -}; - -Errors.UnexpectedEOFException.create = function(token, expectedTokenTypes, stateComment) { - var message = "unexpected end of file, expected: " + expectedTokenTypes.join(', '); - return createError(Errors.UnexpectedTokenException, message, token.location); -}; - -Errors.AstBuilderException.create = function(message, location) { - return createError(Errors.AstBuilderException, message, location); -}; - -Errors.NoSuchLanguageException.create = function(language, location) { - var message = "Language not supported: " + language; - return createError(Errors.NoSuchLanguageException, message, location); -}; - -function createError(Ctor, message, location) { - var fullMessage = "(" + location.line + ":" + location.column + "): " + message; - var error = new Ctor(fullMessage); - error.location = location; - return error; -} - -module.exports = Errors; - -},{}],530:[function(require,module,exports){ -var Parser = require('./parser') -var Compiler = require('./pickles/compiler') - -var compiler = new Compiler() -var parser = new Parser() -parser.stopAtFirstError = false - -function generateEvents(data, uri, types, language) { - types = Object.assign({ - 'source': true, - 'gherkin-document': true, - 'pickle': true - }, types || {}) - - result = [] - - try { - if (types['source']) { - result.push({ - type: 'source', - uri: uri, - data: data, - media: { - encoding: 'utf-8', - type: 'text/x.cucumber.gherkin+plain' - } - }) - } - - if (!types['gherkin-document'] && !types['pickle']) - return result - - var gherkinDocument = parser.parse(data, language) - - if (types['gherkin-document']) { - result.push({ - type: 'gherkin-document', - uri: uri, - document: gherkinDocument - }) - } - - if (types['pickle']) { - var pickles = compiler.compile(gherkinDocument) - for (var p in pickles) { - result.push({ - type: 'pickle', - uri: uri, - pickle: pickles[p] - }) - } - } - } catch (err) { - var errors = err.errors || [err] - for (var e in errors) { - result.push({ - type: "attachment", - source: { - uri: uri, - start: { - line: errors[e].location.line, - column: errors[e].location.column - } - }, - data: errors[e].message, - media: { - encoding: "utf-8", - type: "text/x.cucumber.stacktrace+plain" - } - }) - } - } - return result -} - -module.exports = generateEvents - -},{"./parser":533,"./pickles/compiler":534}],531:[function(require,module,exports){ -module.exports={ - "af": { - "and": [ - "* ", - "En " - ], - "background": [ - "Agtergrond" - ], - "but": [ - "* ", - "Maar " - ], - "examples": [ - "Voorbeelde" - ], - "feature": [ - "Funksie", - "Besigheid Behoefte", - "Vermoë" - ], - "given": [ - "* ", - "Gegewe " - ], - "name": "Afrikaans", - "native": "Afrikaans", - "scenario": [ - "Situasie" - ], - "scenarioOutline": [ - "Situasie Uiteensetting" - ], - "then": [ - "* ", - "Dan " - ], - "when": [ - "* ", - "Wanneer " - ] - }, - "am": { - "and": [ - "* ", - "Եվ " - ], - "background": [ - "Կոնտեքստ" - ], - "but": [ - "* ", - "Բայց " - ], - "examples": [ - "Օրինակներ" - ], - "feature": [ - "Ֆունկցիոնալություն", - "Հատկություն" - ], - "given": [ - "* ", - "Դիցուք " - ], - "name": "Armenian", - "native": "հայերեն", - "scenario": [ - "Սցենար" - ], - "scenarioOutline": [ - "Սցենարի կառուցվացքը" - ], - "then": [ - "* ", - "Ապա " - ], - "when": [ - "* ", - "Եթե ", - "Երբ " - ] - }, - "ar": { - "and": [ - "* ", - "و " - ], - "background": [ - "الخلفية" - ], - "but": [ - "* ", - "لكن " - ], - "examples": [ - "امثلة" - ], - "feature": [ - "خاصية" - ], - "given": [ - "* ", - "بفرض " - ], - "name": "Arabic", - "native": "العربية", - "scenario": [ - "سيناريو" - ], - "scenarioOutline": [ - "سيناريو مخطط" - ], - "then": [ - "* ", - "اذاً ", - "ثم " - ], - "when": [ - "* ", - "متى ", - "عندما " - ] - }, - "ast": { - "and": [ - "* ", - "Y ", - "Ya " - ], - "background": [ - "Antecedentes" - ], - "but": [ - "* ", - "Peru " - ], - "examples": [ - "Exemplos" - ], - "feature": [ - "Carauterística" - ], - "given": [ - "* ", - "Dáu ", - "Dada ", - "Daos ", - "Daes " - ], - "name": "Asturian", - "native": "asturianu", - "scenario": [ - "Casu" - ], - "scenarioOutline": [ - "Esbozu del casu" - ], - "then": [ - "* ", - "Entós " - ], - "when": [ - "* ", - "Cuando " - ] - }, - "az": { - "and": [ - "* ", - "Və ", - "Həm " - ], - "background": [ - "Keçmiş", - "Kontekst" - ], - "but": [ - "* ", - "Amma ", - "Ancaq " - ], - "examples": [ - "Nümunələr" - ], - "feature": [ - "Özəllik" - ], - "given": [ - "* ", - "Tutaq ki ", - "Verilir " - ], - "name": "Azerbaijani", - "native": "Azərbaycanca", - "scenario": [ - "Ssenari" - ], - "scenarioOutline": [ - "Ssenarinin strukturu" - ], - "then": [ - "* ", - "O halda " - ], - "when": [ - "* ", - "Əgər ", - "Nə vaxt ki " - ] - }, - "bg": { - "and": [ - "* ", - "И " - ], - "background": [ - "Предистория" - ], - "but": [ - "* ", - "Но " - ], - "examples": [ - "Примери" - ], - "feature": [ - "Функционалност" - ], - "given": [ - "* ", - "Дадено " - ], - "name": "Bulgarian", - "native": "български", - "scenario": [ - "Сценарий" - ], - "scenarioOutline": [ - "Рамка на сценарий" - ], - "then": [ - "* ", - "То " - ], - "when": [ - "* ", - "Когато " - ] - }, - "bm": { - "and": [ - "* ", - "Dan " - ], - "background": [ - "Latar Belakang" - ], - "but": [ - "* ", - "Tetapi ", - "Tapi " - ], - "examples": [ - "Contoh" - ], - "feature": [ - "Fungsi" - ], - "given": [ - "* ", - "Diberi ", - "Bagi " - ], - "name": "Malay", - "native": "Bahasa Melayu", - "scenario": [ - "Senario", - "Situasi", - "Keadaan" - ], - "scenarioOutline": [ - "Kerangka Senario", - "Kerangka Situasi", - "Kerangka Keadaan", - "Garis Panduan Senario" - ], - "then": [ - "* ", - "Maka ", - "Kemudian " - ], - "when": [ - "* ", - "Apabila " - ] - }, - "bs": { - "and": [ - "* ", - "I ", - "A " - ], - "background": [ - "Pozadina" - ], - "but": [ - "* ", - "Ali " - ], - "examples": [ - "Primjeri" - ], - "feature": [ - "Karakteristika" - ], - "given": [ - "* ", - "Dato " - ], - "name": "Bosnian", - "native": "Bosanski", - "scenario": [ - "Scenariju", - "Scenario" - ], - "scenarioOutline": [ - "Scenariju-obris", - "Scenario-outline" - ], - "then": [ - "* ", - "Zatim " - ], - "when": [ - "* ", - "Kada " - ] - }, - "ca": { - "and": [ - "* ", - "I " - ], - "background": [ - "Rerefons", - "Antecedents" - ], - "but": [ - "* ", - "Però " - ], - "examples": [ - "Exemples" - ], - "feature": [ - "Característica", - "Funcionalitat" - ], - "given": [ - "* ", - "Donat ", - "Donada ", - "Atès ", - "Atesa " - ], - "name": "Catalan", - "native": "català", - "scenario": [ - "Escenari" - ], - "scenarioOutline": [ - "Esquema de l'escenari" - ], - "then": [ - "* ", - "Aleshores ", - "Cal " - ], - "when": [ - "* ", - "Quan " - ] - }, - "cs": { - "and": [ - "* ", - "A také ", - "A " - ], - "background": [ - "Pozadí", - "Kontext" - ], - "but": [ - "* ", - "Ale " - ], - "examples": [ - "Příklady" - ], - "feature": [ - "Požadavek" - ], - "given": [ - "* ", - "Pokud ", - "Za předpokladu " - ], - "name": "Czech", - "native": "Česky", - "scenario": [ - "Scénář" - ], - "scenarioOutline": [ - "Náčrt Scénáře", - "Osnova scénáře" - ], - "then": [ - "* ", - "Pak " - ], - "when": [ - "* ", - "Když " - ] - }, - "cy-GB": { - "and": [ - "* ", - "A " - ], - "background": [ - "Cefndir" - ], - "but": [ - "* ", - "Ond " - ], - "examples": [ - "Enghreifftiau" - ], - "feature": [ - "Arwedd" - ], - "given": [ - "* ", - "Anrhegedig a " - ], - "name": "Welsh", - "native": "Cymraeg", - "scenario": [ - "Scenario" - ], - "scenarioOutline": [ - "Scenario Amlinellol" - ], - "then": [ - "* ", - "Yna " - ], - "when": [ - "* ", - "Pryd " - ] - }, - "da": { - "and": [ - "* ", - "Og " - ], - "background": [ - "Baggrund" - ], - "but": [ - "* ", - "Men " - ], - "examples": [ - "Eksempler" - ], - "feature": [ - "Egenskab" - ], - "given": [ - "* ", - "Givet " - ], - "name": "Danish", - "native": "dansk", - "scenario": [ - "Scenarie" - ], - "scenarioOutline": [ - "Abstrakt Scenario" - ], - "then": [ - "* ", - "Så " - ], - "when": [ - "* ", - "Når " - ] - }, - "de": { - "and": [ - "* ", - "Und " - ], - "background": [ - "Grundlage" - ], - "but": [ - "* ", - "Aber " - ], - "examples": [ - "Beispiele" - ], - "feature": [ - "Funktionalität" - ], - "given": [ - "* ", - "Angenommen ", - "Gegeben sei ", - "Gegeben seien " - ], - "name": "German", - "native": "Deutsch", - "scenario": [ - "Szenario" - ], - "scenarioOutline": [ - "Szenariogrundriss" - ], - "then": [ - "* ", - "Dann " - ], - "when": [ - "* ", - "Wenn " - ] - }, - "el": { - "and": [ - "* ", - "Και " - ], - "background": [ - "Υπόβαθρο" - ], - "but": [ - "* ", - "Αλλά " - ], - "examples": [ - "Παραδείγματα", - "Σενάρια" - ], - "feature": [ - "Δυνατότητα", - "Λειτουργία" - ], - "given": [ - "* ", - "Δεδομένου " - ], - "name": "Greek", - "native": "Ελληνικά", - "scenario": [ - "Σενάριο" - ], - "scenarioOutline": [ - "Περιγραφή Σεναρίου", - "Περίγραμμα Σεναρίου" - ], - "then": [ - "* ", - "Τότε " - ], - "when": [ - "* ", - "Όταν " - ] - }, - "em": { - "and": [ - "* ", - "😂" - ], - "background": [ - "💤" - ], - "but": [ - "* ", - "😔" - ], - "examples": [ - "📓" - ], - "feature": [ - "📚" - ], - "given": [ - "* ", - "😐" - ], - "name": "Emoji", - "native": "😀", - "scenario": [ - "📕" - ], - "scenarioOutline": [ - "📖" - ], - "then": [ - "* ", - "🙏" - ], - "when": [ - "* ", - "🎬" - ] - }, - "en": { - "and": [ - "* ", - "And " - ], - "background": [ - "Background" - ], - "but": [ - "* ", - "But " - ], - "examples": [ - "Examples", - "Scenarios" - ], - "feature": [ - "Feature", - "Business Need", - "Ability" - ], - "given": [ - "* ", - "Given " - ], - "name": "English", - "native": "English", - "scenario": [ - "Scenario" - ], - "scenarioOutline": [ - "Scenario Outline", - "Scenario Template" - ], - "then": [ - "* ", - "Then " - ], - "when": [ - "* ", - "When " - ] - }, - "en-Scouse": { - "and": [ - "* ", - "An " - ], - "background": [ - "Dis is what went down" - ], - "but": [ - "* ", - "Buh " - ], - "examples": [ - "Examples" - ], - "feature": [ - "Feature" - ], - "given": [ - "* ", - "Givun ", - "Youse know when youse got " - ], - "name": "Scouse", - "native": "Scouse", - "scenario": [ - "The thing of it is" - ], - "scenarioOutline": [ - "Wharrimean is" - ], - "then": [ - "* ", - "Dun ", - "Den youse gotta " - ], - "when": [ - "* ", - "Wun ", - "Youse know like when " - ] - }, - "en-au": { - "and": [ - "* ", - "Too right " - ], - "background": [ - "First off" - ], - "but": [ - "* ", - "Yeah nah " - ], - "examples": [ - "You'll wanna" - ], - "feature": [ - "Pretty much" - ], - "given": [ - "* ", - "Y'know " - ], - "name": "Australian", - "native": "Australian", - "scenario": [ - "Awww, look mate" - ], - "scenarioOutline": [ - "Reckon it's like" - ], - "then": [ - "* ", - "But at the end of the day I reckon " - ], - "when": [ - "* ", - "It's just unbelievable " - ] - }, - "en-lol": { - "and": [ - "* ", - "AN " - ], - "background": [ - "B4" - ], - "but": [ - "* ", - "BUT " - ], - "examples": [ - "EXAMPLZ" - ], - "feature": [ - "OH HAI" - ], - "given": [ - "* ", - "I CAN HAZ " - ], - "name": "LOLCAT", - "native": "LOLCAT", - "scenario": [ - "MISHUN" - ], - "scenarioOutline": [ - "MISHUN SRSLY" - ], - "then": [ - "* ", - "DEN " - ], - "when": [ - "* ", - "WEN " - ] - }, - "en-old": { - "and": [ - "* ", - "Ond ", - "7 " - ], - "background": [ - "Aer", - "Ær" - ], - "but": [ - "* ", - "Ac " - ], - "examples": [ - "Se the", - "Se þe", - "Se ðe" - ], - "feature": [ - "Hwaet", - "Hwæt" - ], - "given": [ - "* ", - "Thurh ", - "Þurh ", - "Ðurh " - ], - "name": "Old English", - "native": "Englisc", - "scenario": [ - "Swa" - ], - "scenarioOutline": [ - "Swa hwaer swa", - "Swa hwær swa" - ], - "then": [ - "* ", - "Tha ", - "Þa ", - "Ða ", - "Tha the ", - "Þa þe ", - "Ða ðe " - ], - "when": [ - "* ", - "Tha ", - "Þa ", - "Ða " - ] - }, - "en-pirate": { - "and": [ - "* ", - "Aye " - ], - "background": [ - "Yo-ho-ho" - ], - "but": [ - "* ", - "Avast! " - ], - "examples": [ - "Dead men tell no tales" - ], - "feature": [ - "Ahoy matey!" - ], - "given": [ - "* ", - "Gangway! " - ], - "name": "Pirate", - "native": "Pirate", - "scenario": [ - "Heave to" - ], - "scenarioOutline": [ - "Shiver me timbers" - ], - "then": [ - "* ", - "Let go and haul " - ], - "when": [ - "* ", - "Blimey! " - ] - }, - "eo": { - "and": [ - "* ", - "Kaj " - ], - "background": [ - "Fono" - ], - "but": [ - "* ", - "Sed " - ], - "examples": [ - "Ekzemploj" - ], - "feature": [ - "Trajto" - ], - "given": [ - "* ", - "Donitaĵo ", - "Komence " - ], - "name": "Esperanto", - "native": "Esperanto", - "scenario": [ - "Scenaro", - "Kazo" - ], - "scenarioOutline": [ - "Konturo de la scenaro", - "Skizo", - "Kazo-skizo" - ], - "then": [ - "* ", - "Do " - ], - "when": [ - "* ", - "Se " - ] - }, - "es": { - "and": [ - "* ", - "Y ", - "E " - ], - "background": [ - "Antecedentes" - ], - "but": [ - "* ", - "Pero " - ], - "examples": [ - "Ejemplos" - ], - "feature": [ - "Característica" - ], - "given": [ - "* ", - "Dado ", - "Dada ", - "Dados ", - "Dadas " - ], - "name": "Spanish", - "native": "español", - "scenario": [ - "Escenario" - ], - "scenarioOutline": [ - "Esquema del escenario" - ], - "then": [ - "* ", - "Entonces " - ], - "when": [ - "* ", - "Cuando " - ] - }, - "et": { - "and": [ - "* ", - "Ja " - ], - "background": [ - "Taust" - ], - "but": [ - "* ", - "Kuid " - ], - "examples": [ - "Juhtumid" - ], - "feature": [ - "Omadus" - ], - "given": [ - "* ", - "Eeldades " - ], - "name": "Estonian", - "native": "eesti keel", - "scenario": [ - "Stsenaarium" - ], - "scenarioOutline": [ - "Raamstsenaarium" - ], - "then": [ - "* ", - "Siis " - ], - "when": [ - "* ", - "Kui " - ] - }, - "fa": { - "and": [ - "* ", - "و " - ], - "background": [ - "زمینه" - ], - "but": [ - "* ", - "اما " - ], - "examples": [ - "نمونه ها" - ], - "feature": [ - "وِیژگی" - ], - "given": [ - "* ", - "با فرض " - ], - "name": "Persian", - "native": "فارسی", - "scenario": [ - "سناریو" - ], - "scenarioOutline": [ - "الگوی سناریو" - ], - "then": [ - "* ", - "آنگاه " - ], - "when": [ - "* ", - "هنگامی " - ] - }, - "fi": { - "and": [ - "* ", - "Ja " - ], - "background": [ - "Tausta" - ], - "but": [ - "* ", - "Mutta " - ], - "examples": [ - "Tapaukset" - ], - "feature": [ - "Ominaisuus" - ], - "given": [ - "* ", - "Oletetaan " - ], - "name": "Finnish", - "native": "suomi", - "scenario": [ - "Tapaus" - ], - "scenarioOutline": [ - "Tapausaihio" - ], - "then": [ - "* ", - "Niin " - ], - "when": [ - "* ", - "Kun " - ] - }, - "fr": { - "and": [ - "* ", - "Et que ", - "Et qu'", - "Et " - ], - "background": [ - "Contexte" - ], - "but": [ - "* ", - "Mais que ", - "Mais qu'", - "Mais " - ], - "examples": [ - "Exemples" - ], - "feature": [ - "Fonctionnalité" - ], - "given": [ - "* ", - "Soit ", - "Etant donné que ", - "Etant donné qu'", - "Etant donné ", - "Etant donnée ", - "Etant donnés ", - "Etant données ", - "Étant donné que ", - "Étant donné qu'", - "Étant donné ", - "Étant donnée ", - "Étant donnés ", - "Étant données " - ], - "name": "French", - "native": "français", - "scenario": [ - "Scénario" - ], - "scenarioOutline": [ - "Plan du scénario", - "Plan du Scénario" - ], - "then": [ - "* ", - "Alors " - ], - "when": [ - "* ", - "Quand ", - "Lorsque ", - "Lorsqu'" - ] - }, - "ga": { - "and": [ - "* ", - "Agus" - ], - "background": [ - "Cúlra" - ], - "but": [ - "* ", - "Ach" - ], - "examples": [ - "Samplaí" - ], - "feature": [ - "Gné" - ], - "given": [ - "* ", - "Cuir i gcás go", - "Cuir i gcás nach", - "Cuir i gcás gur", - "Cuir i gcás nár" - ], - "name": "Irish", - "native": "Gaeilge", - "scenario": [ - "Cás" - ], - "scenarioOutline": [ - "Cás Achomair" - ], - "then": [ - "* ", - "Ansin" - ], - "when": [ - "* ", - "Nuair a", - "Nuair nach", - "Nuair ba", - "Nuair nár" - ] - }, - "gj": { - "and": [ - "* ", - "અને " - ], - "background": [ - "બેકગ્રાઉન્ડ" - ], - "but": [ - "* ", - "પણ " - ], - "examples": [ - "ઉદાહરણો" - ], - "feature": [ - "લક્ષણ", - "વ્યાપાર જરૂર", - "ક્ષમતા" - ], - "given": [ - "* ", - "આપેલ છે " - ], - "name": "Gujarati", - "native": "ગુજરાતી", - "scenario": [ - "સ્થિતિ" - ], - "scenarioOutline": [ - "પરિદ્દશ્ય રૂપરેખા", - "પરિદ્દશ્ય ઢાંચો" - ], - "then": [ - "* ", - "પછી " - ], - "when": [ - "* ", - "ક્યારે " - ] - }, - "gl": { - "and": [ - "* ", - "E " - ], - "background": [ - "Contexto" - ], - "but": [ - "* ", - "Mais ", - "Pero " - ], - "examples": [ - "Exemplos" - ], - "feature": [ - "Característica" - ], - "given": [ - "* ", - "Dado ", - "Dada ", - "Dados ", - "Dadas " - ], - "name": "Galician", - "native": "galego", - "scenario": [ - "Escenario" - ], - "scenarioOutline": [ - "Esbozo do escenario" - ], - "then": [ - "* ", - "Entón ", - "Logo " - ], - "when": [ - "* ", - "Cando " - ] - }, - "he": { - "and": [ - "* ", - "וגם " - ], - "background": [ - "רקע" - ], - "but": [ - "* ", - "אבל " - ], - "examples": [ - "דוגמאות" - ], - "feature": [ - "תכונה" - ], - "given": [ - "* ", - "בהינתן " - ], - "name": "Hebrew", - "native": "עברית", - "scenario": [ - "תרחיש" - ], - "scenarioOutline": [ - "תבנית תרחיש" - ], - "then": [ - "* ", - "אז ", - "אזי " - ], - "when": [ - "* ", - "כאשר " - ] - }, - "hi": { - "and": [ - "* ", - "और ", - "तथा " - ], - "background": [ - "पृष्ठभूमि" - ], - "but": [ - "* ", - "पर ", - "परन्तु ", - "किन्तु " - ], - "examples": [ - "उदाहरण" - ], - "feature": [ - "रूप लेख" - ], - "given": [ - "* ", - "अगर ", - "यदि ", - "चूंकि " - ], - "name": "Hindi", - "native": "हिंदी", - "scenario": [ - "परिदृश्य" - ], - "scenarioOutline": [ - "परिदृश्य रूपरेखा" - ], - "then": [ - "* ", - "तब ", - "तदा " - ], - "when": [ - "* ", - "जब ", - "कदा " - ] - }, - "hr": { - "and": [ - "* ", - "I " - ], - "background": [ - "Pozadina" - ], - "but": [ - "* ", - "Ali " - ], - "examples": [ - "Primjeri", - "Scenariji" - ], - "feature": [ - "Osobina", - "Mogućnost", - "Mogucnost" - ], - "given": [ - "* ", - "Zadan ", - "Zadani ", - "Zadano " - ], - "name": "Croatian", - "native": "hrvatski", - "scenario": [ - "Scenarij" - ], - "scenarioOutline": [ - "Skica", - "Koncept" - ], - "then": [ - "* ", - "Onda " - ], - "when": [ - "* ", - "Kada ", - "Kad " - ] - }, - "ht": { - "and": [ - "* ", - "Ak ", - "Epi ", - "E " - ], - "background": [ - "Kontèks", - "Istorik" - ], - "but": [ - "* ", - "Men " - ], - "examples": [ - "Egzanp" - ], - "feature": [ - "Karakteristik", - "Mak", - "Fonksyonalite" - ], - "given": [ - "* ", - "Sipoze ", - "Sipoze ke ", - "Sipoze Ke " - ], - "name": "Creole", - "native": "kreyòl", - "scenario": [ - "Senaryo" - ], - "scenarioOutline": [ - "Plan senaryo", - "Plan Senaryo", - "Senaryo deskripsyon", - "Senaryo Deskripsyon", - "Dyagram senaryo", - "Dyagram Senaryo" - ], - "then": [ - "* ", - "Lè sa a ", - "Le sa a " - ], - "when": [ - "* ", - "Lè ", - "Le " - ] - }, - "hu": { - "and": [ - "* ", - "És " - ], - "background": [ - "Háttér" - ], - "but": [ - "* ", - "De " - ], - "examples": [ - "Példák" - ], - "feature": [ - "Jellemző" - ], - "given": [ - "* ", - "Amennyiben ", - "Adott " - ], - "name": "Hungarian", - "native": "magyar", - "scenario": [ - "Forgatókönyv" - ], - "scenarioOutline": [ - "Forgatókönyv vázlat" - ], - "then": [ - "* ", - "Akkor " - ], - "when": [ - "* ", - "Majd ", - "Ha ", - "Amikor " - ] - }, - "id": { - "and": [ - "* ", - "Dan " - ], - "background": [ - "Dasar" - ], - "but": [ - "* ", - "Tapi " - ], - "examples": [ - "Contoh" - ], - "feature": [ - "Fitur" - ], - "given": [ - "* ", - "Dengan " - ], - "name": "Indonesian", - "native": "Bahasa Indonesia", - "scenario": [ - "Skenario" - ], - "scenarioOutline": [ - "Skenario konsep" - ], - "then": [ - "* ", - "Maka " - ], - "when": [ - "* ", - "Ketika " - ] - }, - "is": { - "and": [ - "* ", - "Og " - ], - "background": [ - "Bakgrunnur" - ], - "but": [ - "* ", - "En " - ], - "examples": [ - "Dæmi", - "Atburðarásir" - ], - "feature": [ - "Eiginleiki" - ], - "given": [ - "* ", - "Ef " - ], - "name": "Icelandic", - "native": "Íslenska", - "scenario": [ - "Atburðarás" - ], - "scenarioOutline": [ - "Lýsing Atburðarásar", - "Lýsing Dæma" - ], - "then": [ - "* ", - "Þá " - ], - "when": [ - "* ", - "Þegar " - ] - }, - "it": { - "and": [ - "* ", - "E " - ], - "background": [ - "Contesto" - ], - "but": [ - "* ", - "Ma " - ], - "examples": [ - "Esempi" - ], - "feature": [ - "Funzionalità" - ], - "given": [ - "* ", - "Dato ", - "Data ", - "Dati ", - "Date " - ], - "name": "Italian", - "native": "italiano", - "scenario": [ - "Scenario" - ], - "scenarioOutline": [ - "Schema dello scenario" - ], - "then": [ - "* ", - "Allora " - ], - "when": [ - "* ", - "Quando " - ] - }, - "ja": { - "and": [ - "* ", - "かつ" - ], - "background": [ - "背景" - ], - "but": [ - "* ", - "しかし", - "但し", - "ただし" - ], - "examples": [ - "例", - "サンプル" - ], - "feature": [ - "フィーチャ", - "機能" - ], - "given": [ - "* ", - "前提" - ], - "name": "Japanese", - "native": "日本語", - "scenario": [ - "シナリオ" - ], - "scenarioOutline": [ - "シナリオアウトライン", - "シナリオテンプレート", - "テンプレ", - "シナリオテンプレ" - ], - "then": [ - "* ", - "ならば" - ], - "when": [ - "* ", - "もし" - ] - }, - "jv": { - "and": [ - "* ", - "Lan " - ], - "background": [ - "Dasar" - ], - "but": [ - "* ", - "Tapi ", - "Nanging ", - "Ananging " - ], - "examples": [ - "Conto", - "Contone" - ], - "feature": [ - "Fitur" - ], - "given": [ - "* ", - "Nalika ", - "Nalikaning " - ], - "name": "Javanese", - "native": "Basa Jawa", - "scenario": [ - "Skenario" - ], - "scenarioOutline": [ - "Konsep skenario" - ], - "then": [ - "* ", - "Njuk ", - "Banjur " - ], - "when": [ - "* ", - "Manawa ", - "Menawa " - ] - }, - "ka": { - "and": [ - "* ", - "და" - ], - "background": [ - "კონტექსტი" - ], - "but": [ - "* ", - "მაგ­რამ" - ], - "examples": [ - "მაგალითები" - ], - "feature": [ - "თვისება" - ], - "given": [ - "* ", - "მოცემული" - ], - "name": "Georgian", - "native": "ქართველი", - "scenario": [ - "სცენარის" - ], - "scenarioOutline": [ - "სცენარის ნიმუში" - ], - "then": [ - "* ", - "მაშინ" - ], - "when": [ - "* ", - "როდესაც" - ] - }, - "kn": { - "and": [ - "* ", - "ಮತ್ತು " - ], - "background": [ - "ಹಿನ್ನೆಲೆ" - ], - "but": [ - "* ", - "ಆದರೆ " - ], - "examples": [ - "ಉದಾಹರಣೆಗಳು" - ], - "feature": [ - "ಹೆಚ್ಚಳ" - ], - "given": [ - "* ", - "ನೀಡಿದ " - ], - "name": "Kannada", - "native": "ಕನ್ನಡ", - "scenario": [ - "ಕಥಾಸಾರಾಂಶ" - ], - "scenarioOutline": [ - "ವಿವರಣೆ" - ], - "then": [ - "* ", - "ನಂತರ " - ], - "when": [ - "* ", - "ಸ್ಥಿತಿಯನ್ನು " - ] - }, - "ko": { - "and": [ - "* ", - "그리고" - ], - "background": [ - "배경" - ], - "but": [ - "* ", - "하지만", - "단" - ], - "examples": [ - "예" - ], - "feature": [ - "기능" - ], - "given": [ - "* ", - "조건", - "먼저" - ], - "name": "Korean", - "native": "한국어", - "scenario": [ - "시나리오" - ], - "scenarioOutline": [ - "시나리오 개요" - ], - "then": [ - "* ", - "그러면" - ], - "when": [ - "* ", - "만일", - "만약" - ] - }, - "lt": { - "and": [ - "* ", - "Ir " - ], - "background": [ - "Kontekstas" - ], - "but": [ - "* ", - "Bet " - ], - "examples": [ - "Pavyzdžiai", - "Scenarijai", - "Variantai" - ], - "feature": [ - "Savybė" - ], - "given": [ - "* ", - "Duota " - ], - "name": "Lithuanian", - "native": "lietuvių kalba", - "scenario": [ - "Scenarijus" - ], - "scenarioOutline": [ - "Scenarijaus šablonas" - ], - "then": [ - "* ", - "Tada " - ], - "when": [ - "* ", - "Kai " - ] - }, - "lu": { - "and": [ - "* ", - "an ", - "a " - ], - "background": [ - "Hannergrond" - ], - "but": [ - "* ", - "awer ", - "mä " - ], - "examples": [ - "Beispiller" - ], - "feature": [ - "Funktionalitéit" - ], - "given": [ - "* ", - "ugeholl " - ], - "name": "Luxemburgish", - "native": "Lëtzebuergesch", - "scenario": [ - "Szenario" - ], - "scenarioOutline": [ - "Plang vum Szenario" - ], - "then": [ - "* ", - "dann " - ], - "when": [ - "* ", - "wann " - ] - }, - "lv": { - "and": [ - "* ", - "Un " - ], - "background": [ - "Konteksts", - "Situācija" - ], - "but": [ - "* ", - "Bet " - ], - "examples": [ - "Piemēri", - "Paraugs" - ], - "feature": [ - "Funkcionalitāte", - "Fīča" - ], - "given": [ - "* ", - "Kad " - ], - "name": "Latvian", - "native": "latviešu", - "scenario": [ - "Scenārijs" - ], - "scenarioOutline": [ - "Scenārijs pēc parauga" - ], - "then": [ - "* ", - "Tad " - ], - "when": [ - "* ", - "Ja " - ] - }, - "mk-Cyrl": { - "and": [ - "* ", - "И " - ], - "background": [ - "Контекст", - "Содржина" - ], - "but": [ - "* ", - "Но " - ], - "examples": [ - "Примери", - "Сценарија" - ], - "feature": [ - "Функционалност", - "Бизнис потреба", - "Можност" - ], - "given": [ - "* ", - "Дадено ", - "Дадена " - ], - "name": "Macedonian", - "native": "Македонски", - "scenario": [ - "Сценарио", - "На пример" - ], - "scenarioOutline": [ - "Преглед на сценарија", - "Скица", - "Концепт" - ], - "then": [ - "* ", - "Тогаш " - ], - "when": [ - "* ", - "Кога " - ] - }, - "mk-Latn": { - "and": [ - "* ", - "I " - ], - "background": [ - "Kontekst", - "Sodrzhina" - ], - "but": [ - "* ", - "No " - ], - "examples": [ - "Primeri", - "Scenaria" - ], - "feature": [ - "Funkcionalnost", - "Biznis potreba", - "Mozhnost" - ], - "given": [ - "* ", - "Dadeno ", - "Dadena " - ], - "name": "Macedonian (Latin)", - "native": "Makedonski (Latinica)", - "scenario": [ - "Scenario", - "Na primer" - ], - "scenarioOutline": [ - "Pregled na scenarija", - "Skica", - "Koncept" - ], - "then": [ - "* ", - "Togash " - ], - "when": [ - "* ", - "Koga " - ] - }, - "mn": { - "and": [ - "* ", - "Мөн ", - "Тэгээд " - ], - "background": [ - "Агуулга" - ], - "but": [ - "* ", - "Гэхдээ ", - "Харин " - ], - "examples": [ - "Тухайлбал" - ], - "feature": [ - "Функц", - "Функционал" - ], - "given": [ - "* ", - "Өгөгдсөн нь ", - "Анх " - ], - "name": "Mongolian", - "native": "монгол", - "scenario": [ - "Сценар" - ], - "scenarioOutline": [ - "Сценарын төлөвлөгөө" - ], - "then": [ - "* ", - "Тэгэхэд ", - "Үүний дараа " - ], - "when": [ - "* ", - "Хэрэв " - ] - }, - "nl": { - "and": [ - "* ", - "En " - ], - "background": [ - "Achtergrond" - ], - "but": [ - "* ", - "Maar " - ], - "examples": [ - "Voorbeelden" - ], - "feature": [ - "Functionaliteit" - ], - "given": [ - "* ", - "Gegeven ", - "Stel " - ], - "name": "Dutch", - "native": "Nederlands", - "scenario": [ - "Scenario" - ], - "scenarioOutline": [ - "Abstract Scenario" - ], - "then": [ - "* ", - "Dan " - ], - "when": [ - "* ", - "Als ", - "Wanneer " - ] - }, - "no": { - "and": [ - "* ", - "Og " - ], - "background": [ - "Bakgrunn" - ], - "but": [ - "* ", - "Men " - ], - "examples": [ - "Eksempler" - ], - "feature": [ - "Egenskap" - ], - "given": [ - "* ", - "Gitt " - ], - "name": "Norwegian", - "native": "norsk", - "scenario": [ - "Scenario" - ], - "scenarioOutline": [ - "Scenariomal", - "Abstrakt Scenario" - ], - "then": [ - "* ", - "Så " - ], - "when": [ - "* ", - "Når " - ] - }, - "pa": { - "and": [ - "* ", - "ਅਤੇ " - ], - "background": [ - "ਪਿਛੋਕੜ" - ], - "but": [ - "* ", - "ਪਰ " - ], - "examples": [ - "ਉਦਾਹਰਨਾਂ" - ], - "feature": [ - "ਖਾਸੀਅਤ", - "ਮੁਹਾਂਦਰਾ", - "ਨਕਸ਼ ਨੁਹਾਰ" - ], - "given": [ - "* ", - "ਜੇਕਰ ", - "ਜਿਵੇਂ ਕਿ " - ], - "name": "Panjabi", - "native": "ਪੰਜਾਬੀ", - "scenario": [ - "ਪਟਕਥਾ" - ], - "scenarioOutline": [ - "ਪਟਕਥਾ ਢਾਂਚਾ", - "ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ" - ], - "then": [ - "* ", - "ਤਦ " - ], - "when": [ - "* ", - "ਜਦੋਂ " - ] - }, - "pl": { - "and": [ - "* ", - "Oraz ", - "I " - ], - "background": [ - "Założenia" - ], - "but": [ - "* ", - "Ale " - ], - "examples": [ - "Przykłady" - ], - "feature": [ - "Właściwość", - "Funkcja", - "Aspekt", - "Potrzeba biznesowa" - ], - "given": [ - "* ", - "Zakładając ", - "Mając ", - "Zakładając, że " - ], - "name": "Polish", - "native": "polski", - "scenario": [ - "Scenariusz" - ], - "scenarioOutline": [ - "Szablon scenariusza" - ], - "then": [ - "* ", - "Wtedy " - ], - "when": [ - "* ", - "Jeżeli ", - "Jeśli ", - "Gdy ", - "Kiedy " - ] - }, - "pt": { - "and": [ - "* ", - "E " - ], - "background": [ - "Contexto", - "Cenário de Fundo", - "Cenario de Fundo", - "Fundo" - ], - "but": [ - "* ", - "Mas " - ], - "examples": [ - "Exemplos", - "Cenários", - "Cenarios" - ], - "feature": [ - "Funcionalidade", - "Característica", - "Caracteristica" - ], - "given": [ - "* ", - "Dado ", - "Dada ", - "Dados ", - "Dadas " - ], - "name": "Portuguese", - "native": "português", - "scenario": [ - "Cenário", - "Cenario" - ], - "scenarioOutline": [ - "Esquema do Cenário", - "Esquema do Cenario", - "Delineação do Cenário", - "Delineacao do Cenario" - ], - "then": [ - "* ", - "Então ", - "Entao " - ], - "when": [ - "* ", - "Quando " - ] - }, - "ro": { - "and": [ - "* ", - "Si ", - "Și ", - "Şi " - ], - "background": [ - "Context" - ], - "but": [ - "* ", - "Dar " - ], - "examples": [ - "Exemple" - ], - "feature": [ - "Functionalitate", - "Funcționalitate", - "Funcţionalitate" - ], - "given": [ - "* ", - "Date fiind ", - "Dat fiind ", - "Dată fiind", - "Dati fiind ", - "Dați fiind ", - "Daţi fiind " - ], - "name": "Romanian", - "native": "română", - "scenario": [ - "Scenariu" - ], - "scenarioOutline": [ - "Structura scenariu", - "Structură scenariu" - ], - "then": [ - "* ", - "Atunci " - ], - "when": [ - "* ", - "Cand ", - "Când " - ] - }, - "ru": { - "and": [ - "* ", - "И ", - "К тому же ", - "Также " - ], - "background": [ - "Предыстория", - "Контекст" - ], - "but": [ - "* ", - "Но ", - "А " - ], - "examples": [ - "Примеры" - ], - "feature": [ - "Функция", - "Функциональность", - "Функционал", - "Свойство" - ], - "given": [ - "* ", - "Допустим ", - "Дано ", - "Пусть ", - "Если " - ], - "name": "Russian", - "native": "русский", - "scenario": [ - "Сценарий" - ], - "scenarioOutline": [ - "Структура сценария" - ], - "then": [ - "* ", - "То ", - "Затем ", - "Тогда " - ], - "when": [ - "* ", - "Когда " - ] - }, - "sk": { - "and": [ - "* ", - "A ", - "A tiež ", - "A taktiež ", - "A zároveň " - ], - "background": [ - "Pozadie" - ], - "but": [ - "* ", - "Ale " - ], - "examples": [ - "Príklady" - ], - "feature": [ - "Požiadavka", - "Funkcia", - "Vlastnosť" - ], - "given": [ - "* ", - "Pokiaľ ", - "Za predpokladu " - ], - "name": "Slovak", - "native": "Slovensky", - "scenario": [ - "Scenár" - ], - "scenarioOutline": [ - "Náčrt Scenáru", - "Náčrt Scenára", - "Osnova Scenára" - ], - "then": [ - "* ", - "Tak ", - "Potom " - ], - "when": [ - "* ", - "Keď ", - "Ak " - ] - }, - "sl": { - "and": [ - "In ", - "Ter " - ], - "background": [ - "Kontekst", - "Osnova", - "Ozadje" - ], - "but": [ - "Toda ", - "Ampak ", - "Vendar " - ], - "examples": [ - "Primeri", - "Scenariji" - ], - "feature": [ - "Funkcionalnost", - "Funkcija", - "Možnosti", - "Moznosti", - "Lastnost", - "Značilnost" - ], - "given": [ - "Dano ", - "Podano ", - "Zaradi ", - "Privzeto " - ], - "name": "Slovenian", - "native": "Slovenski", - "scenario": [ - "Scenarij", - "Primer" - ], - "scenarioOutline": [ - "Struktura scenarija", - "Skica", - "Koncept", - "Oris scenarija", - "Osnutek" - ], - "then": [ - "Nato ", - "Potem ", - "Takrat " - ], - "when": [ - "Ko ", - "Ce ", - "Če ", - "Kadar " - ] - }, - "sr-Cyrl": { - "and": [ - "* ", - "И " - ], - "background": [ - "Контекст", - "Основа", - "Позадина" - ], - "but": [ - "* ", - "Али " - ], - "examples": [ - "Примери", - "Сценарији" - ], - "feature": [ - "Функционалност", - "Могућност", - "Особина" - ], - "given": [ - "* ", - "За дато ", - "За дате ", - "За дати " - ], - "name": "Serbian", - "native": "Српски", - "scenario": [ - "Сценарио", - "Пример" - ], - "scenarioOutline": [ - "Структура сценарија", - "Скица", - "Концепт" - ], - "then": [ - "* ", - "Онда " - ], - "when": [ - "* ", - "Када ", - "Кад " - ] - }, - "sr-Latn": { - "and": [ - "* ", - "I " - ], - "background": [ - "Kontekst", - "Osnova", - "Pozadina" - ], - "but": [ - "* ", - "Ali " - ], - "examples": [ - "Primeri", - "Scenariji" - ], - "feature": [ - "Funkcionalnost", - "Mogućnost", - "Mogucnost", - "Osobina" - ], - "given": [ - "* ", - "Za dato ", - "Za date ", - "Za dati " - ], - "name": "Serbian (Latin)", - "native": "Srpski (Latinica)", - "scenario": [ - "Scenario", - "Primer" - ], - "scenarioOutline": [ - "Struktura scenarija", - "Skica", - "Koncept" - ], - "then": [ - "* ", - "Onda " - ], - "when": [ - "* ", - "Kada ", - "Kad " - ] - }, - "sv": { - "and": [ - "* ", - "Och " - ], - "background": [ - "Bakgrund" - ], - "but": [ - "* ", - "Men " - ], - "examples": [ - "Exempel" - ], - "feature": [ - "Egenskap" - ], - "given": [ - "* ", - "Givet " - ], - "name": "Swedish", - "native": "Svenska", - "scenario": [ - "Scenario" - ], - "scenarioOutline": [ - "Abstrakt Scenario", - "Scenariomall" - ], - "then": [ - "* ", - "Så " - ], - "when": [ - "* ", - "När " - ] - }, - "ta": { - "and": [ - "* ", - "மேலும் ", - "மற்றும் " - ], - "background": [ - "பின்னணி" - ], - "but": [ - "* ", - "ஆனால் " - ], - "examples": [ - "எடுத்துக்காட்டுகள்", - "காட்சிகள்", - " நிலைமைகளில்" - ], - "feature": [ - "அம்சம்", - "வணிக தேவை", - "திறன்" - ], - "given": [ - "* ", - "கொடுக்கப்பட்ட " - ], - "name": "Tamil", - "native": "தமிழ்", - "scenario": [ - "காட்சி" - ], - "scenarioOutline": [ - "காட்சி சுருக்கம்", - "காட்சி வார்ப்புரு" - ], - "then": [ - "* ", - "அப்பொழுது " - ], - "when": [ - "* ", - "எப்போது " - ] - }, - "th": { - "and": [ - "* ", - "และ " - ], - "background": [ - "แนวคิด" - ], - "but": [ - "* ", - "แต่ " - ], - "examples": [ - "ชุดของตัวอย่าง", - "ชุดของเหตุการณ์" - ], - "feature": [ - "โครงหลัก", - "ความต้องการทางธุรกิจ", - "ความสามารถ" - ], - "given": [ - "* ", - "กำหนดให้ " - ], - "name": "Thai", - "native": "ไทย", - "scenario": [ - "เหตุการณ์" - ], - "scenarioOutline": [ - "สรุปเหตุการณ์", - "โครงสร้างของเหตุการณ์" - ], - "then": [ - "* ", - "ดังนั้น " - ], - "when": [ - "* ", - "เมื่อ " - ] - }, - "tl": { - "and": [ - "* ", - "మరియు " - ], - "background": [ - "నేపథ్యం" - ], - "but": [ - "* ", - "కాని " - ], - "examples": [ - "ఉదాహరణలు" - ], - "feature": [ - "గుణము" - ], - "given": [ - "* ", - "చెప్పబడినది " - ], - "name": "Telugu", - "native": "తెలుగు", - "scenario": [ - "సన్నివేశం" - ], - "scenarioOutline": [ - "కథనం" - ], - "then": [ - "* ", - "అప్పుడు " - ], - "when": [ - "* ", - "ఈ పరిస్థితిలో " - ] - }, - "tlh": { - "and": [ - "* ", - "'ej ", - "latlh " - ], - "background": [ - "mo'" - ], - "but": [ - "* ", - "'ach ", - "'a " - ], - "examples": [ - "ghantoH", - "lutmey" - ], - "feature": [ - "Qap", - "Qu'meH 'ut", - "perbogh", - "poQbogh malja'", - "laH" - ], - "given": [ - "* ", - "ghu' noblu' ", - "DaH ghu' bejlu' " - ], - "name": "Klingon", - "native": "tlhIngan", - "scenario": [ - "lut" - ], - "scenarioOutline": [ - "lut chovnatlh" - ], - "then": [ - "* ", - "vaj " - ], - "when": [ - "* ", - "qaSDI' " - ] - }, - "tr": { - "and": [ - "* ", - "Ve " - ], - "background": [ - "Geçmiş" - ], - "but": [ - "* ", - "Fakat ", - "Ama " - ], - "examples": [ - "Örnekler" - ], - "feature": [ - "Özellik" - ], - "given": [ - "* ", - "Diyelim ki " - ], - "name": "Turkish", - "native": "Türkçe", - "scenario": [ - "Senaryo" - ], - "scenarioOutline": [ - "Senaryo taslağı" - ], - "then": [ - "* ", - "O zaman " - ], - "when": [ - "* ", - "Eğer ki " - ] - }, - "tt": { - "and": [ - "* ", - "Һәм ", - "Вә " - ], - "background": [ - "Кереш" - ], - "but": [ - "* ", - "Ләкин ", - "Әмма " - ], - "examples": [ - "Үрнәкләр", - "Мисаллар" - ], - "feature": [ - "Мөмкинлек", - "Үзенчәлеклелек" - ], - "given": [ - "* ", - "Әйтик " - ], - "name": "Tatar", - "native": "Татарча", - "scenario": [ - "Сценарий" - ], - "scenarioOutline": [ - "Сценарийның төзелеше" - ], - "then": [ - "* ", - "Нәтиҗәдә " - ], - "when": [ - "* ", - "Әгәр " - ] - }, - "uk": { - "and": [ - "* ", - "І ", - "А також ", - "Та " - ], - "background": [ - "Передумова" - ], - "but": [ - "* ", - "Але " - ], - "examples": [ - "Приклади" - ], - "feature": [ - "Функціонал" - ], - "given": [ - "* ", - "Припустимо ", - "Припустимо, що ", - "Нехай ", - "Дано " - ], - "name": "Ukrainian", - "native": "Українська", - "scenario": [ - "Сценарій" - ], - "scenarioOutline": [ - "Структура сценарію" - ], - "then": [ - "* ", - "То ", - "Тоді " - ], - "when": [ - "* ", - "Якщо ", - "Коли " - ] - }, - "ur": { - "and": [ - "* ", - "اور " - ], - "background": [ - "پس منظر" - ], - "but": [ - "* ", - "لیکن " - ], - "examples": [ - "مثالیں" - ], - "feature": [ - "صلاحیت", - "کاروبار کی ضرورت", - "خصوصیت" - ], - "given": [ - "* ", - "اگر ", - "بالفرض ", - "فرض کیا " - ], - "name": "Urdu", - "native": "اردو", - "scenario": [ - "منظرنامہ" - ], - "scenarioOutline": [ - "منظر نامے کا خاکہ" - ], - "then": [ - "* ", - "پھر ", - "تب " - ], - "when": [ - "* ", - "جب " - ] - }, - "uz": { - "and": [ - "* ", - "Ва " - ], - "background": [ - "Тарих" - ], - "but": [ - "* ", - "Лекин ", - "Бирок ", - "Аммо " - ], - "examples": [ - "Мисоллар" - ], - "feature": [ - "Функционал" - ], - "given": [ - "* ", - "Агар " - ], - "name": "Uzbek", - "native": "Узбекча", - "scenario": [ - "Сценарий" - ], - "scenarioOutline": [ - "Сценарий структураси" - ], - "then": [ - "* ", - "Унда " - ], - "when": [ - "* ", - "Агар " - ] - }, - "vi": { - "and": [ - "* ", - "Và " - ], - "background": [ - "Bối cảnh" - ], - "but": [ - "* ", - "Nhưng " - ], - "examples": [ - "Dữ liệu" - ], - "feature": [ - "Tính năng" - ], - "given": [ - "* ", - "Biết ", - "Cho " - ], - "name": "Vietnamese", - "native": "Tiếng Việt", - "scenario": [ - "Tình huống", - "Kịch bản" - ], - "scenarioOutline": [ - "Khung tình huống", - "Khung kịch bản" - ], - "then": [ - "* ", - "Thì " - ], - "when": [ - "* ", - "Khi " - ] - }, - "zh-CN": { - "and": [ - "* ", - "而且", - "并且", - "同时" - ], - "background": [ - "背景" - ], - "but": [ - "* ", - "但是" - ], - "examples": [ - "例子" - ], - "feature": [ - "功能" - ], - "given": [ - "* ", - "假如", - "假设", - "假定" - ], - "name": "Chinese simplified", - "native": "简体中文", - "scenario": [ - "场景", - "剧本" - ], - "scenarioOutline": [ - "场景大纲", - "剧本大纲" - ], - "then": [ - "* ", - "那么" - ], - "when": [ - "* ", - "当" - ] - }, - "zh-TW": { - "and": [ - "* ", - "而且", - "並且", - "同時" - ], - "background": [ - "背景" - ], - "but": [ - "* ", - "但是" - ], - "examples": [ - "例子" - ], - "feature": [ - "功能" - ], - "given": [ - "* ", - "假如", - "假設", - "假定" - ], - "name": "Chinese traditional", - "native": "繁體中文", - "scenario": [ - "場景", - "劇本" - ], - "scenarioOutline": [ - "場景大綱", - "劇本大綱" - ], - "then": [ - "* ", - "那麼" - ], - "when": [ - "* ", - "當" - ] - } -} - -},{}],532:[function(require,module,exports){ -var countSymbols = require('./count_symbols') - -function GherkinLine(lineText, lineNumber) { - this.lineText = lineText; - this.lineNumber = lineNumber; - this.trimmedLineText = lineText.replace(/^\s+/g, ''); // ltrim - this.isEmpty = this.trimmedLineText.length == 0; - this.indent = countSymbols(lineText) - countSymbols(this.trimmedLineText); -}; - -GherkinLine.prototype.startsWith = function startsWith(prefix) { - return this.trimmedLineText.indexOf(prefix) == 0; -}; - -GherkinLine.prototype.startsWithTitleKeyword = function startsWithTitleKeyword(keyword) { - return this.startsWith(keyword+':'); // The C# impl is more complicated. Find out why. -}; - -GherkinLine.prototype.getLineText = function getLineText(indentToRemove) { - if (indentToRemove < 0 || indentToRemove > this.indent) { - return this.trimmedLineText; - } else { - return this.lineText.substring(indentToRemove); - } -}; - -GherkinLine.prototype.getRestTrimmed = function getRestTrimmed(length) { - return this.trimmedLineText.substring(length).trim(); -}; - -GherkinLine.prototype.getTableCells = function getTableCells() { - var cells = []; - var col = 0; - var startCol = col + 1; - var cell = ''; - var firstCell = true; - while (col < this.trimmedLineText.length) { - var chr = this.trimmedLineText[col]; - col++; - - if (chr == '|') { - if (firstCell) { - // First cell (content before the first |) is skipped - firstCell = false; - } else { - var cellIndent = cell.length - cell.replace(/^\s+/g, '').length; - var span = {column: this.indent + startCol + cellIndent, text: cell.trim()}; - cells.push(span); - } - cell = ''; - startCol = col + 1; - } else if (chr == '\\') { - chr = this.trimmedLineText[col]; - col += 1; - if (chr == 'n') { - cell += '\n'; - } else { - if (chr != '|' && chr != '\\') { - cell += '\\'; - } - cell += chr; - } - } else { - cell += chr; - } - } - - return cells; -}; - -GherkinLine.prototype.getTags = function getTags() { - var column = this.indent + 1; - var items = this.trimmedLineText.trim().split('@'); - items.shift(); - return items.map(function (item) { - var length = item.length; - var span = {column: column, text: '@' + item.trim()}; - column += length + 1; - return span; - }); -}; - -module.exports = GherkinLine; - -},{"./count_symbols":527}],533:[function(require,module,exports){ -// This file is generated. Do not edit! Edit gherkin-javascript.razor instead. -var Errors = require('./errors'); -var AstBuilder = require('./ast_builder'); -var TokenScanner = require('./token_scanner'); -var TokenMatcher = require('./token_matcher'); - -var RULE_TYPES = [ - 'None', - '_EOF', // #EOF - '_Empty', // #Empty - '_Comment', // #Comment - '_TagLine', // #TagLine - '_FeatureLine', // #FeatureLine - '_BackgroundLine', // #BackgroundLine - '_ScenarioLine', // #ScenarioLine - '_ScenarioOutlineLine', // #ScenarioOutlineLine - '_ExamplesLine', // #ExamplesLine - '_StepLine', // #StepLine - '_DocStringSeparator', // #DocStringSeparator - '_TableRow', // #TableRow - '_Language', // #Language - '_Other', // #Other - 'GherkinDocument', // GherkinDocument! := Feature? - 'Feature', // Feature! := Feature_Header Background? Scenario_Definition* - 'Feature_Header', // Feature_Header! := #Language? Tags? #FeatureLine Description_Helper - 'Background', // Background! := #BackgroundLine Description_Helper Step* - 'Scenario_Definition', // Scenario_Definition! := Tags? (Scenario | ScenarioOutline) - 'Scenario', // Scenario! := #ScenarioLine Description_Helper Step* - 'ScenarioOutline', // ScenarioOutline! := #ScenarioOutlineLine Description_Helper Step* Examples_Definition* - 'Examples_Definition', // Examples_Definition! [#Empty|#Comment|#TagLine->#ExamplesLine] := Tags? Examples - 'Examples', // Examples! := #ExamplesLine Description_Helper Examples_Table? - 'Examples_Table', // Examples_Table! := #TableRow #TableRow* - 'Step', // Step! := #StepLine Step_Arg? - 'Step_Arg', // Step_Arg := (DataTable | DocString) - 'DataTable', // DataTable! := #TableRow+ - 'DocString', // DocString! := #DocStringSeparator #Other* #DocStringSeparator - 'Tags', // Tags! := #TagLine+ - 'Description_Helper', // Description_Helper := #Empty* Description? #Comment* - 'Description', // Description! := #Other+ -]; - -module.exports = function Parser(builder) { - builder = builder || new AstBuilder(); - var self = this; - var context; - - this.parse = function(tokenScanner, tokenMatcher) { - if(typeof tokenScanner == 'string') { - tokenScanner = new TokenScanner(tokenScanner); - } - if(typeof tokenMatcher == 'string') { - tokenMatcher = new TokenMatcher(tokenMatcher); - } - tokenMatcher = tokenMatcher || new TokenMatcher(); - builder.reset(); - tokenMatcher.reset(); - context = { - tokenScanner: tokenScanner, - tokenMatcher: tokenMatcher, - tokenQueue: [], - errors: [] - }; - startRule(context, "GherkinDocument"); - var state = 0; - var token = null; - while(true) { - token = readToken(context); - state = matchToken(state, token, context); - if(token.isEof) break; - } - - endRule(context, "GherkinDocument"); - - if(context.errors.length > 0) { - throw Errors.CompositeParserException.create(context.errors); - } - - return getResult(); - }; - - function addError(context, error) { - context.errors.push(error); - if (context.errors.length > 10) - throw Errors.CompositeParserException.create(context.errors); - } - - function startRule(context, ruleType) { - handleAstError(context, function () { - builder.startRule(ruleType); - }); - } - - function endRule(context, ruleType) { - handleAstError(context, function () { - builder.endRule(ruleType); - }); - } - - function build(context, token) { - handleAstError(context, function () { - builder.build(token); - }); - } - - function getResult() { - return builder.getResult(); - } - - function handleAstError(context, action) { - handleExternalError(context, true, action) - } - - function handleExternalError(context, defaultValue, action) { - if(self.stopAtFirstError) return action(); - try { - return action(); - } catch (e) { - if(e instanceof Errors.CompositeParserException) { - e.errors.forEach(function (error) { - addError(context, error); - }); - } else if( - e instanceof Errors.ParserException || - e instanceof Errors.AstBuilderException || - e instanceof Errors.UnexpectedTokenException || - e instanceof Errors.NoSuchLanguageException - ) { - addError(context, e); - } else { - throw e; - } - } - return defaultValue; - } - - function readToken(context) { - return context.tokenQueue.length > 0 ? - context.tokenQueue.shift() : - context.tokenScanner.read(); - } - - function matchToken(state, token, context) { - switch(state) { - case 0: - return matchTokenAt_0(token, context); - case 1: - return matchTokenAt_1(token, context); - case 2: - return matchTokenAt_2(token, context); - case 3: - return matchTokenAt_3(token, context); - case 4: - return matchTokenAt_4(token, context); - case 5: - return matchTokenAt_5(token, context); - case 6: - return matchTokenAt_6(token, context); - case 7: - return matchTokenAt_7(token, context); - case 8: - return matchTokenAt_8(token, context); - case 9: - return matchTokenAt_9(token, context); - case 10: - return matchTokenAt_10(token, context); - case 11: - return matchTokenAt_11(token, context); - case 12: - return matchTokenAt_12(token, context); - case 13: - return matchTokenAt_13(token, context); - case 14: - return matchTokenAt_14(token, context); - case 15: - return matchTokenAt_15(token, context); - case 16: - return matchTokenAt_16(token, context); - case 17: - return matchTokenAt_17(token, context); - case 18: - return matchTokenAt_18(token, context); - case 19: - return matchTokenAt_19(token, context); - case 20: - return matchTokenAt_20(token, context); - case 21: - return matchTokenAt_21(token, context); - case 22: - return matchTokenAt_22(token, context); - case 23: - return matchTokenAt_23(token, context); - case 24: - return matchTokenAt_24(token, context); - case 25: - return matchTokenAt_25(token, context); - case 26: - return matchTokenAt_26(token, context); - case 28: - return matchTokenAt_28(token, context); - case 29: - return matchTokenAt_29(token, context); - case 30: - return matchTokenAt_30(token, context); - case 31: - return matchTokenAt_31(token, context); - case 32: - return matchTokenAt_32(token, context); - case 33: - return matchTokenAt_33(token, context); - default: - throw new Error("Unknown state: " + state); - } - } - - - // Start - function matchTokenAt_0(token, context) { - if(match_EOF(context, token)) { - build(context, token); - return 27; - } - if(match_Language(context, token)) { - startRule(context, 'Feature'); - startRule(context, 'Feature_Header'); - build(context, token); - return 1; - } - if(match_TagLine(context, token)) { - startRule(context, 'Feature'); - startRule(context, 'Feature_Header'); - startRule(context, 'Tags'); - build(context, token); - return 2; - } - if(match_FeatureLine(context, token)) { - startRule(context, 'Feature'); - startRule(context, 'Feature_Header'); - build(context, token); - return 3; - } - if(match_Comment(context, token)) { - build(context, token); - return 0; - } - if(match_Empty(context, token)) { - build(context, token); - return 0; - } - - var stateComment = "State: 0 - Start"; - token.detach(); - var expectedTokens = ["#EOF", "#Language", "#TagLine", "#FeatureLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 0; - } - - - // GherkinDocument:0>Feature:0>Feature_Header:0>#Language:0 - function matchTokenAt_1(token, context) { - if(match_TagLine(context, token)) { - startRule(context, 'Tags'); - build(context, token); - return 2; - } - if(match_FeatureLine(context, token)) { - build(context, token); - return 3; - } - if(match_Comment(context, token)) { - build(context, token); - return 1; - } - if(match_Empty(context, token)) { - build(context, token); - return 1; - } - - var stateComment = "State: 1 - GherkinDocument:0>Feature:0>Feature_Header:0>#Language:0"; - token.detach(); - var expectedTokens = ["#TagLine", "#FeatureLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 1; - } - - - // GherkinDocument:0>Feature:0>Feature_Header:1>Tags:0>#TagLine:0 - function matchTokenAt_2(token, context) { - if(match_TagLine(context, token)) { - build(context, token); - return 2; - } - if(match_FeatureLine(context, token)) { - endRule(context, 'Tags'); - build(context, token); - return 3; - } - if(match_Comment(context, token)) { - build(context, token); - return 2; - } - if(match_Empty(context, token)) { - build(context, token); - return 2; - } - - var stateComment = "State: 2 - GherkinDocument:0>Feature:0>Feature_Header:1>Tags:0>#TagLine:0"; - token.detach(); - var expectedTokens = ["#TagLine", "#FeatureLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 2; - } - - - // GherkinDocument:0>Feature:0>Feature_Header:2>#FeatureLine:0 - function matchTokenAt_3(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Feature_Header'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Empty(context, token)) { - build(context, token); - return 3; - } - if(match_Comment(context, token)) { - build(context, token); - return 5; - } - if(match_BackgroundLine(context, token)) { - endRule(context, 'Feature_Header'); - startRule(context, 'Background'); - build(context, token); - return 6; - } - if(match_TagLine(context, token)) { - endRule(context, 'Feature_Header'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Feature_Header'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Feature_Header'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Other(context, token)) { - startRule(context, 'Description'); - build(context, token); - return 4; - } - - var stateComment = "State: 3 - GherkinDocument:0>Feature:0>Feature_Header:2>#FeatureLine:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Empty", "#Comment", "#BackgroundLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 3; - } - - - // GherkinDocument:0>Feature:0>Feature_Header:3>Description_Helper:1>Description:0>#Other:0 - function matchTokenAt_4(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Feature_Header'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Comment(context, token)) { - endRule(context, 'Description'); - build(context, token); - return 5; - } - if(match_BackgroundLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Feature_Header'); - startRule(context, 'Background'); - build(context, token); - return 6; - } - if(match_TagLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Feature_Header'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Feature_Header'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Feature_Header'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Other(context, token)) { - build(context, token); - return 4; - } - - var stateComment = "State: 4 - GherkinDocument:0>Feature:0>Feature_Header:3>Description_Helper:1>Description:0>#Other:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Comment", "#BackgroundLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 4; - } - - - // GherkinDocument:0>Feature:0>Feature_Header:3>Description_Helper:2>#Comment:0 - function matchTokenAt_5(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Feature_Header'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Comment(context, token)) { - build(context, token); - return 5; - } - if(match_BackgroundLine(context, token)) { - endRule(context, 'Feature_Header'); - startRule(context, 'Background'); - build(context, token); - return 6; - } - if(match_TagLine(context, token)) { - endRule(context, 'Feature_Header'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Feature_Header'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Feature_Header'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Empty(context, token)) { - build(context, token); - return 5; - } - - var stateComment = "State: 5 - GherkinDocument:0>Feature:0>Feature_Header:3>Description_Helper:2>#Comment:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Comment", "#BackgroundLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 5; - } - - - // GherkinDocument:0>Feature:1>Background:0>#BackgroundLine:0 - function matchTokenAt_6(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Background'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Empty(context, token)) { - build(context, token); - return 6; - } - if(match_Comment(context, token)) { - build(context, token); - return 8; - } - if(match_StepLine(context, token)) { - startRule(context, 'Step'); - build(context, token); - return 9; - } - if(match_TagLine(context, token)) { - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Other(context, token)) { - startRule(context, 'Description'); - build(context, token); - return 7; - } - - var stateComment = "State: 6 - GherkinDocument:0>Feature:1>Background:0>#BackgroundLine:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 6; - } - - - // GherkinDocument:0>Feature:1>Background:1>Description_Helper:1>Description:0>#Other:0 - function matchTokenAt_7(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Background'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Comment(context, token)) { - endRule(context, 'Description'); - build(context, token); - return 8; - } - if(match_StepLine(context, token)) { - endRule(context, 'Description'); - startRule(context, 'Step'); - build(context, token); - return 9; - } - if(match_TagLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Other(context, token)) { - build(context, token); - return 7; - } - - var stateComment = "State: 7 - GherkinDocument:0>Feature:1>Background:1>Description_Helper:1>Description:0>#Other:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 7; - } - - - // GherkinDocument:0>Feature:1>Background:1>Description_Helper:2>#Comment:0 - function matchTokenAt_8(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Background'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Comment(context, token)) { - build(context, token); - return 8; - } - if(match_StepLine(context, token)) { - startRule(context, 'Step'); - build(context, token); - return 9; - } - if(match_TagLine(context, token)) { - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Empty(context, token)) { - build(context, token); - return 8; - } - - var stateComment = "State: 8 - GherkinDocument:0>Feature:1>Background:1>Description_Helper:2>#Comment:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 8; - } - - - // GherkinDocument:0>Feature:1>Background:2>Step:0>#StepLine:0 - function matchTokenAt_9(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Step'); - endRule(context, 'Background'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_TableRow(context, token)) { - startRule(context, 'DataTable'); - build(context, token); - return 10; - } - if(match_DocStringSeparator(context, token)) { - startRule(context, 'DocString'); - build(context, token); - return 32; - } - if(match_StepLine(context, token)) { - endRule(context, 'Step'); - startRule(context, 'Step'); - build(context, token); - return 9; - } - if(match_TagLine(context, token)) { - endRule(context, 'Step'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Step'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Step'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 9; - } - if(match_Empty(context, token)) { - build(context, token); - return 9; - } - - var stateComment = "State: 9 - GherkinDocument:0>Feature:1>Background:2>Step:0>#StepLine:0"; - token.detach(); - var expectedTokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 9; - } - - - // GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0 - function matchTokenAt_10(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'Background'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_TableRow(context, token)) { - build(context, token); - return 10; - } - if(match_StepLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - startRule(context, 'Step'); - build(context, token); - return 9; - } - if(match_TagLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 10; - } - if(match_Empty(context, token)) { - build(context, token); - return 10; - } - - var stateComment = "State: 10 - GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0"; - token.detach(); - var expectedTokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 10; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:0>Tags:0>#TagLine:0 - function matchTokenAt_11(token, context) { - if(match_TagLine(context, token)) { - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Tags'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Tags'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 11; - } - if(match_Empty(context, token)) { - build(context, token); - return 11; - } - - var stateComment = "State: 11 - GherkinDocument:0>Feature:2>Scenario_Definition:0>Tags:0>#TagLine:0"; - token.detach(); - var expectedTokens = ["#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 11; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:0>#ScenarioLine:0 - function matchTokenAt_12(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Empty(context, token)) { - build(context, token); - return 12; - } - if(match_Comment(context, token)) { - build(context, token); - return 14; - } - if(match_StepLine(context, token)) { - startRule(context, 'Step'); - build(context, token); - return 15; - } - if(match_TagLine(context, token)) { - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Other(context, token)) { - startRule(context, 'Description'); - build(context, token); - return 13; - } - - var stateComment = "State: 12 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:0>#ScenarioLine:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 12; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Description_Helper:1>Description:0>#Other:0 - function matchTokenAt_13(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Comment(context, token)) { - endRule(context, 'Description'); - build(context, token); - return 14; - } - if(match_StepLine(context, token)) { - endRule(context, 'Description'); - startRule(context, 'Step'); - build(context, token); - return 15; - } - if(match_TagLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Other(context, token)) { - build(context, token); - return 13; - } - - var stateComment = "State: 13 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Description_Helper:1>Description:0>#Other:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 13; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Description_Helper:2>#Comment:0 - function matchTokenAt_14(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Comment(context, token)) { - build(context, token); - return 14; - } - if(match_StepLine(context, token)) { - startRule(context, 'Step'); - build(context, token); - return 15; - } - if(match_TagLine(context, token)) { - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Empty(context, token)) { - build(context, token); - return 14; - } - - var stateComment = "State: 14 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Description_Helper:2>#Comment:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 14; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:0>#StepLine:0 - function matchTokenAt_15(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_TableRow(context, token)) { - startRule(context, 'DataTable'); - build(context, token); - return 16; - } - if(match_DocStringSeparator(context, token)) { - startRule(context, 'DocString'); - build(context, token); - return 30; - } - if(match_StepLine(context, token)) { - endRule(context, 'Step'); - startRule(context, 'Step'); - build(context, token); - return 15; - } - if(match_TagLine(context, token)) { - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 15; - } - if(match_Empty(context, token)) { - build(context, token); - return 15; - } - - var stateComment = "State: 15 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:0>#StepLine:0"; - token.detach(); - var expectedTokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 15; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0 - function matchTokenAt_16(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_TableRow(context, token)) { - build(context, token); - return 16; - } - if(match_StepLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - startRule(context, 'Step'); - build(context, token); - return 15; - } - if(match_TagLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 16; - } - if(match_Empty(context, token)) { - build(context, token); - return 16; - } - - var stateComment = "State: 16 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0"; - token.detach(); - var expectedTokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 16; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:0>#ScenarioOutlineLine:0 - function matchTokenAt_17(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Empty(context, token)) { - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 19; - } - if(match_StepLine(context, token)) { - startRule(context, 'Step'); - build(context, token); - return 20; - } - if(match_TagLine(context, token)) { - if(lookahead_0(context, token)) { - startRule(context, 'Examples_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 22; - } - } - if(match_TagLine(context, token)) { - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ExamplesLine(context, token)) { - startRule(context, 'Examples_Definition'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Other(context, token)) { - startRule(context, 'Description'); - build(context, token); - return 18; - } - - var stateComment = "State: 17 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:0>#ScenarioOutlineLine:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 17; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>Description_Helper:1>Description:0>#Other:0 - function matchTokenAt_18(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Description'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Comment(context, token)) { - endRule(context, 'Description'); - build(context, token); - return 19; - } - if(match_StepLine(context, token)) { - endRule(context, 'Description'); - startRule(context, 'Step'); - build(context, token); - return 20; - } - if(match_TagLine(context, token)) { - if(lookahead_0(context, token)) { - endRule(context, 'Description'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 22; - } - } - if(match_TagLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ExamplesLine(context, token)) { - endRule(context, 'Description'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Other(context, token)) { - build(context, token); - return 18; - } - - var stateComment = "State: 18 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>Description_Helper:1>Description:0>#Other:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 18; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>Description_Helper:2>#Comment:0 - function matchTokenAt_19(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Comment(context, token)) { - build(context, token); - return 19; - } - if(match_StepLine(context, token)) { - startRule(context, 'Step'); - build(context, token); - return 20; - } - if(match_TagLine(context, token)) { - if(lookahead_0(context, token)) { - startRule(context, 'Examples_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 22; - } - } - if(match_TagLine(context, token)) { - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ExamplesLine(context, token)) { - startRule(context, 'Examples_Definition'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Empty(context, token)) { - build(context, token); - return 19; - } - - var stateComment = "State: 19 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>Description_Helper:2>#Comment:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 19; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:0>#StepLine:0 - function matchTokenAt_20(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_TableRow(context, token)) { - startRule(context, 'DataTable'); - build(context, token); - return 21; - } - if(match_DocStringSeparator(context, token)) { - startRule(context, 'DocString'); - build(context, token); - return 28; - } - if(match_StepLine(context, token)) { - endRule(context, 'Step'); - startRule(context, 'Step'); - build(context, token); - return 20; - } - if(match_TagLine(context, token)) { - if(lookahead_0(context, token)) { - endRule(context, 'Step'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 22; - } - } - if(match_TagLine(context, token)) { - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ExamplesLine(context, token)) { - endRule(context, 'Step'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 20; - } - if(match_Empty(context, token)) { - build(context, token); - return 20; - } - - var stateComment = "State: 20 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:0>#StepLine:0"; - token.detach(); - var expectedTokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 20; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0 - function matchTokenAt_21(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_TableRow(context, token)) { - build(context, token); - return 21; - } - if(match_StepLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - startRule(context, 'Step'); - build(context, token); - return 20; - } - if(match_TagLine(context, token)) { - if(lookahead_0(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 22; - } - } - if(match_TagLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ExamplesLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'DataTable'); - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 21; - } - if(match_Empty(context, token)) { - build(context, token); - return 21; - } - - var stateComment = "State: 21 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0"; - token.detach(); - var expectedTokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 21; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:0>Tags:0>#TagLine:0 - function matchTokenAt_22(token, context) { - if(match_TagLine(context, token)) { - build(context, token); - return 22; - } - if(match_ExamplesLine(context, token)) { - endRule(context, 'Tags'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_Comment(context, token)) { - build(context, token); - return 22; - } - if(match_Empty(context, token)) { - build(context, token); - return 22; - } - - var stateComment = "State: 22 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:0>Tags:0>#TagLine:0"; - token.detach(); - var expectedTokens = ["#TagLine", "#ExamplesLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 22; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:0>#ExamplesLine:0 - function matchTokenAt_23(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Empty(context, token)) { - build(context, token); - return 23; - } - if(match_Comment(context, token)) { - build(context, token); - return 25; - } - if(match_TableRow(context, token)) { - startRule(context, 'Examples_Table'); - build(context, token); - return 26; - } - if(match_TagLine(context, token)) { - if(lookahead_0(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 22; - } - } - if(match_TagLine(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ExamplesLine(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Other(context, token)) { - startRule(context, 'Description'); - build(context, token); - return 24; - } - - var stateComment = "State: 23 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:0>#ExamplesLine:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Empty", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 23; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Description_Helper:1>Description:0>#Other:0 - function matchTokenAt_24(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Comment(context, token)) { - endRule(context, 'Description'); - build(context, token); - return 25; - } - if(match_TableRow(context, token)) { - endRule(context, 'Description'); - startRule(context, 'Examples_Table'); - build(context, token); - return 26; - } - if(match_TagLine(context, token)) { - if(lookahead_0(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 22; - } - } - if(match_TagLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ExamplesLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Description'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Other(context, token)) { - build(context, token); - return 24; - } - - var stateComment = "State: 24 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Description_Helper:1>Description:0>#Other:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 24; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Description_Helper:2>#Comment:0 - function matchTokenAt_25(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_Comment(context, token)) { - build(context, token); - return 25; - } - if(match_TableRow(context, token)) { - startRule(context, 'Examples_Table'); - build(context, token); - return 26; - } - if(match_TagLine(context, token)) { - if(lookahead_0(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 22; - } - } - if(match_TagLine(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ExamplesLine(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Empty(context, token)) { - build(context, token); - return 25; - } - - var stateComment = "State: 25 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Description_Helper:2>#Comment:0"; - token.detach(); - var expectedTokens = ["#EOF", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 25; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:2>Examples_Table:0>#TableRow:0 - function matchTokenAt_26(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'Examples_Table'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_TableRow(context, token)) { - build(context, token); - return 26; - } - if(match_TagLine(context, token)) { - if(lookahead_0(context, token)) { - endRule(context, 'Examples_Table'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 22; - } - } - if(match_TagLine(context, token)) { - endRule(context, 'Examples_Table'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ExamplesLine(context, token)) { - endRule(context, 'Examples_Table'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'Examples_Table'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'Examples_Table'); - endRule(context, 'Examples'); - endRule(context, 'Examples_Definition'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 26; - } - if(match_Empty(context, token)) { - build(context, token); - return 26; - } - - var stateComment = "State: 26 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:2>Examples_Table:0>#TableRow:0"; - token.detach(); - var expectedTokens = ["#EOF", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 26; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0 - function matchTokenAt_28(token, context) { - if(match_DocStringSeparator(context, token)) { - build(context, token); - return 29; - } - if(match_Other(context, token)) { - build(context, token); - return 28; - } - - var stateComment = "State: 28 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0"; - token.detach(); - var expectedTokens = ["#DocStringSeparator", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 28; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0 - function matchTokenAt_29(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_StepLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - startRule(context, 'Step'); - build(context, token); - return 20; - } - if(match_TagLine(context, token)) { - if(lookahead_0(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 22; - } - } - if(match_TagLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ExamplesLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - startRule(context, 'Examples_Definition'); - startRule(context, 'Examples'); - build(context, token); - return 23; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'ScenarioOutline'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 29; - } - if(match_Empty(context, token)) { - build(context, token); - return 29; - } - - var stateComment = "State: 29 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0"; - token.detach(); - var expectedTokens = ["#EOF", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 29; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0 - function matchTokenAt_30(token, context) { - if(match_DocStringSeparator(context, token)) { - build(context, token); - return 31; - } - if(match_Other(context, token)) { - build(context, token); - return 30; - } - - var stateComment = "State: 30 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0"; - token.detach(); - var expectedTokens = ["#DocStringSeparator", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 30; - } - - - // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0 - function matchTokenAt_31(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_StepLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - startRule(context, 'Step'); - build(context, token); - return 15; - } - if(match_TagLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'Scenario'); - endRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 31; - } - if(match_Empty(context, token)) { - build(context, token); - return 31; - } - - var stateComment = "State: 31 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0"; - token.detach(); - var expectedTokens = ["#EOF", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 31; - } - - - // GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0 - function matchTokenAt_32(token, context) { - if(match_DocStringSeparator(context, token)) { - build(context, token); - return 33; - } - if(match_Other(context, token)) { - build(context, token); - return 32; - } - - var stateComment = "State: 32 - GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0"; - token.detach(); - var expectedTokens = ["#DocStringSeparator", "#Other"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 32; - } - - - // GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0 - function matchTokenAt_33(token, context) { - if(match_EOF(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'Background'); - endRule(context, 'Feature'); - build(context, token); - return 27; - } - if(match_StepLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - startRule(context, 'Step'); - build(context, token); - return 9; - } - if(match_TagLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Tags'); - build(context, token); - return 11; - } - if(match_ScenarioLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'Scenario'); - build(context, token); - return 12; - } - if(match_ScenarioOutlineLine(context, token)) { - endRule(context, 'DocString'); - endRule(context, 'Step'); - endRule(context, 'Background'); - startRule(context, 'Scenario_Definition'); - startRule(context, 'ScenarioOutline'); - build(context, token); - return 17; - } - if(match_Comment(context, token)) { - build(context, token); - return 33; - } - if(match_Empty(context, token)) { - build(context, token); - return 33; - } - - var stateComment = "State: 33 - GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0"; - token.detach(); - var expectedTokens = ["#EOF", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]; - var error = token.isEof ? - Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) : - Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment); - if (self.stopAtFirstError) throw error; - addError(context, error); - return 33; - } - - - - function match_EOF(context, token) { - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_EOF(token); - }); - } - - - function match_Empty(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_Empty(token); - }); - } - - - function match_Comment(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_Comment(token); - }); - } - - - function match_TagLine(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_TagLine(token); - }); - } - - - function match_FeatureLine(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_FeatureLine(token); - }); - } - - - function match_BackgroundLine(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_BackgroundLine(token); - }); - } - - - function match_ScenarioLine(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_ScenarioLine(token); - }); - } - - - function match_ScenarioOutlineLine(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_ScenarioOutlineLine(token); - }); - } - - - function match_ExamplesLine(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_ExamplesLine(token); - }); - } - - - function match_StepLine(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_StepLine(token); - }); - } - - - function match_DocStringSeparator(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_DocStringSeparator(token); - }); - } - - - function match_TableRow(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_TableRow(token); - }); - } - - - function match_Language(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_Language(token); - }); - } - - - function match_Other(context, token) { - if(token.isEof) return false; - return handleExternalError(context, false, function () { - return context.tokenMatcher.match_Other(token); - }); - } - - - - function lookahead_0(context, currentToken) { - currentToken.detach(); - var token; - var queue = []; - var match = false; - do { - token = readToken(context); - token.detach(); - queue.push(token); - - if (false || match_ExamplesLine(context, token)) { - match = true; - break; - } - } while(false || match_Empty(context, token) || match_Comment(context, token) || match_TagLine(context, token)); - - context.tokenQueue = context.tokenQueue.concat(queue); - - return match; - } - - -} - -},{"./ast_builder":525,"./errors":529,"./token_matcher":536,"./token_scanner":537}],534:[function(require,module,exports){ -var countSymbols = require('../count_symbols'); - -function Compiler() { - this.compile = function (gherkin_document) { - var pickles = []; - - if (gherkin_document.feature == null) return pickles; - - var feature = gherkin_document.feature; - var language = feature.language; - var featureTags = feature.tags; - var backgroundSteps = []; - - feature.children.forEach(function (scenarioDefinition) { - if(scenarioDefinition.type === 'Background') { - backgroundSteps = pickleSteps(scenarioDefinition); - } else if(scenarioDefinition.type === 'Scenario') { - compileScenario(featureTags, backgroundSteps, scenarioDefinition, language, pickles); - } else { - compileScenarioOutline(featureTags, backgroundSteps, scenarioDefinition, language, pickles); - } - }); - return pickles; - }; - - function compileScenario(featureTags, backgroundSteps, scenario, language, pickles) { - var steps = scenario.steps.length == 0 ? [] : [].concat(backgroundSteps); - - var tags = [].concat(featureTags).concat(scenario.tags); - - scenario.steps.forEach(function (step) { - steps.push(pickleStep(step)); - }); - - var pickle = { - tags: pickleTags(tags), - name: scenario.name, - language: language, - locations: [pickleLocation(scenario.location)], - steps: steps - }; - pickles.push(pickle); - } - - function compileScenarioOutline(featureTags, backgroundSteps, scenarioOutline, language, pickles) { - scenarioOutline.examples.filter(function(e) { return e.tableHeader != undefined; }).forEach(function (examples) { - var variableCells = examples.tableHeader.cells; - examples.tableBody.forEach(function (values) { - var valueCells = values.cells; - var steps = scenarioOutline.steps.length == 0 ? [] : [].concat(backgroundSteps); - var tags = [].concat(featureTags).concat(scenarioOutline.tags).concat(examples.tags); - - scenarioOutline.steps.forEach(function (scenarioOutlineStep) { - var stepText = interpolate(scenarioOutlineStep.text, variableCells, valueCells); - var args = createPickleArguments(scenarioOutlineStep.argument, variableCells, valueCells); - var pickleStep = { - text: stepText, - arguments: args, - locations: [ - pickleLocation(values.location), - pickleStepLocation(scenarioOutlineStep) - ] - }; - steps.push(pickleStep); - }); - - var pickle = { - name: interpolate(scenarioOutline.name, variableCells, valueCells), - language: language, - steps: steps, - tags: pickleTags(tags), - locations: [ - pickleLocation(values.location), - pickleLocation(scenarioOutline.location) - ] - }; - pickles.push(pickle); - - }); - }); - } - - function createPickleArguments(argument, variableCells, valueCells) { - var result = []; - if (!argument) return result; - if (argument.type === 'DataTable') { - var table = { - rows: argument.rows.map(function (row) { - return { - cells: row.cells.map(function (cell) { - return { - location: pickleLocation(cell.location), - value: interpolate(cell.value, variableCells, valueCells) - }; - }) - }; - }) - }; - result.push(table); - } else if (argument.type === 'DocString') { - var docString = { - location: pickleLocation(argument.location), - content: interpolate(argument.content, variableCells, valueCells) - }; - result.push(docString); - } else { - throw Error('Internal error'); - } - return result; - } - - function interpolate(name, variableCells, valueCells) { - variableCells.forEach(function (variableCell, n) { - var valueCell = valueCells[n]; - var search = new RegExp('<' + variableCell.value + '>', 'g'); - name = name.replace(search, valueCell.value); - }); - return name; - } - - function pickleSteps(scenarioDefinition) { - return scenarioDefinition.steps.map(function (step) { - return pickleStep(step); - }); - } - - function pickleStep(step) { - return { - text: step.text, - arguments: createPickleArguments(step.argument, [], []), - locations: [pickleStepLocation(step)] - } - } - - function pickleStepLocation(step) { - return { - line: step.location.line, - column: step.location.column + (step.keyword ? countSymbols(step.keyword) : 0) - }; - } - - function pickleLocation(location) { - return { - line: location.line, - column: location.column - } - } - - function pickleTags(tags) { - return tags.map(function (tag) { - return pickleTag(tag); - }); - } - - function pickleTag(tag) { - return { - name: tag.name, - location: pickleLocation(tag.location) - }; - } -} - -module.exports = Compiler; - -},{"../count_symbols":527}],535:[function(require,module,exports){ -function Token(line, location) { - this.line = line; - this.location = location; - this.isEof = line == null; -}; - -Token.prototype.getTokenValue = function () { - return this.isEof ? "EOF" : this.line.getLineText(-1); -}; - -Token.prototype.detach = function () { - // TODO: Detach line, but is this really needed? -}; - -module.exports = Token; - -},{}],536:[function(require,module,exports){ -var DIALECTS = require('./dialects'); -var Errors = require('./errors'); -var LANGUAGE_PATTERN = /^\s*#\s*language\s*:\s*([a-zA-Z\-_]+)\s*$/; - -module.exports = function TokenMatcher(defaultDialectName) { - defaultDialectName = defaultDialectName || 'en'; - - var dialect; - var dialectName; - var activeDocStringSeparator; - var indentToRemove; - - function changeDialect(newDialectName, location) { - var newDialect = DIALECTS[newDialectName]; - if(!newDialect) { - throw Errors.NoSuchLanguageException.create(newDialectName, location); - } - - dialectName = newDialectName; - dialect = newDialect; - } - - this.reset = function () { - if(dialectName != defaultDialectName) changeDialect(defaultDialectName); - activeDocStringSeparator = null; - indentToRemove = 0; - }; - - this.reset(); - - this.match_TagLine = function match_TagLine(token) { - if(token.line.startsWith('@')) { - setTokenMatched(token, 'TagLine', null, null, null, token.line.getTags()); - return true; - } - return false; - }; - - this.match_FeatureLine = function match_FeatureLine(token) { - return matchTitleLine(token, 'FeatureLine', dialect.feature); - }; - - this.match_ScenarioLine = function match_ScenarioLine(token) { - return matchTitleLine(token, 'ScenarioLine', dialect.scenario); - }; - - this.match_ScenarioOutlineLine = function match_ScenarioOutlineLine(token) { - return matchTitleLine(token, 'ScenarioOutlineLine', dialect.scenarioOutline); - }; - - this.match_BackgroundLine = function match_BackgroundLine(token) { - return matchTitleLine(token, 'BackgroundLine', dialect.background); - }; - - this.match_ExamplesLine = function match_ExamplesLine(token) { - return matchTitleLine(token, 'ExamplesLine', dialect.examples); - }; - - this.match_TableRow = function match_TableRow(token) { - if (token.line.startsWith('|')) { - // TODO: indent - setTokenMatched(token, 'TableRow', null, null, null, token.line.getTableCells()); - return true; - } - return false; - }; - - this.match_Empty = function match_Empty(token) { - if (token.line.isEmpty) { - setTokenMatched(token, 'Empty', null, null, 0); - return true; - } - return false; - }; - - this.match_Comment = function match_Comment(token) { - if(token.line.startsWith('#')) { - var text = token.line.getLineText(0); //take the entire line, including leading space - setTokenMatched(token, 'Comment', text, null, 0); - return true; - } - return false; - }; - - this.match_Language = function match_Language(token) { - var match; - if(match = token.line.trimmedLineText.match(LANGUAGE_PATTERN)) { - var newDialectName = match[1]; - setTokenMatched(token, 'Language', newDialectName); - - changeDialect(newDialectName, token.location); - return true; - } - return false; - }; - - this.match_DocStringSeparator = function match_DocStringSeparator(token) { - return activeDocStringSeparator == null - ? - // open - _match_DocStringSeparator(token, '"""', true) || - _match_DocStringSeparator(token, '```', true) - : - // close - _match_DocStringSeparator(token, activeDocStringSeparator, false); - }; - - function _match_DocStringSeparator(token, separator, isOpen) { - if (token.line.startsWith(separator)) { - var contentType = null; - if (isOpen) { - contentType = token.line.getRestTrimmed(separator.length); - activeDocStringSeparator = separator; - indentToRemove = token.line.indent; - } else { - activeDocStringSeparator = null; - indentToRemove = 0; - } - - // TODO: Use the separator as keyword. That's needed for pretty printing. - setTokenMatched(token, 'DocStringSeparator', contentType); - return true; - } - return false; - } - - this.match_EOF = function match_EOF(token) { - if(token.isEof) { - setTokenMatched(token, 'EOF'); - return true; - } - return false; - }; - - this.match_StepLine = function match_StepLine(token) { - var keywords = [] - .concat(dialect.given) - .concat(dialect.when) - .concat(dialect.then) - .concat(dialect.and) - .concat(dialect.but); - var length = keywords.length; - for(var i = 0, keyword; i < length; i++) { - var keyword = keywords[i]; - - if (token.line.startsWith(keyword)) { - var title = token.line.getRestTrimmed(keyword.length); - setTokenMatched(token, 'StepLine', title, keyword); - return true; - } - } - return false; - }; - - this.match_Other = function match_Other(token) { - var text = token.line.getLineText(indentToRemove); //take the entire line, except removing DocString indents - setTokenMatched(token, 'Other', unescapeDocString(text), null, 0); - return true; - }; - - function matchTitleLine(token, tokenType, keywords) { - var length = keywords.length; - for(var i = 0, keyword; i < length; i++) { - var keyword = keywords[i]; - - if (token.line.startsWithTitleKeyword(keyword)) { - var title = token.line.getRestTrimmed(keyword.length + ':'.length); - setTokenMatched(token, tokenType, title, keyword); - return true; - } - } - return false; - } - - function setTokenMatched(token, matchedType, text, keyword, indent, items) { - token.matchedType = matchedType; - token.matchedText = text; - token.matchedKeyword = keyword; - token.matchedIndent = (typeof indent === 'number') ? indent : (token.line == null ? 0 : token.line.indent); - token.matchedItems = items || []; - - token.location.column = token.matchedIndent + 1; - token.matchedGherkinDialect = dialectName; - } - - function unescapeDocString(text) { - return activeDocStringSeparator != null ? text.replace("\\\"\\\"\\\"", "\"\"\"") : text; - } -}; - -},{"./dialects":528,"./errors":529}],537:[function(require,module,exports){ -var Token = require('./token'); -var GherkinLine = require('./gherkin_line'); - -/** - * The scanner reads a gherkin doc (typically read from a .feature file) and creates a token for each line. - * The tokens are passed to the parser, which outputs an AST (Abstract Syntax Tree). - * - * If the scanner sees a `#` language header, it will reconfigure itself dynamically to look for - * Gherkin keywords for the associated language. The keywords are defined in gherkin-languages.json. - */ -module.exports = function TokenScanner(source) { - var lines = source.split(/\r?\n/); - if(lines.length > 0 && lines[lines.length-1].trim() == '') { - lines.pop(); - } - var lineNumber = 0; - - this.read = function () { - var line = lines[lineNumber++]; - var location = {line: lineNumber, column: 0}; - return line == null ? new Token(null, location) : new Token(new GherkinLine(line, lineNumber), location); - } -}; - -},{"./gherkin_line":532,"./token":535}],538:[function(require,module,exports){ -(function (process){ -exports.alphasort = alphasort -exports.alphasorti = alphasorti -exports.setopts = setopts -exports.ownProp = ownProp -exports.makeAbs = makeAbs -exports.finish = finish -exports.mark = mark -exports.isIgnored = isIgnored -exports.childrenIgnored = childrenIgnored - -function ownProp (obj, field) { - return Object.prototype.hasOwnProperty.call(obj, field) -} - -var path = require("path") -var minimatch = require("minimatch") -var isAbsolute = require("path-is-absolute") -var Minimatch = minimatch.Minimatch - -function alphasorti (a, b) { - return a.toLowerCase().localeCompare(b.toLowerCase()) -} - -function alphasort (a, b) { - return a.localeCompare(b) -} - -function setupIgnores (self, options) { - self.ignore = options.ignore || [] - - if (!Array.isArray(self.ignore)) - self.ignore = [self.ignore] - - if (self.ignore.length) { - self.ignore = self.ignore.map(ignoreMap) - } -} - -// ignore patterns are always in dot:true mode. -function ignoreMap (pattern) { - var gmatcher = null - if (pattern.slice(-3) === '/**') { - var gpattern = pattern.replace(/(\/\*\*)+$/, '') - gmatcher = new Minimatch(gpattern, { dot: true }) - } - - return { - matcher: new Minimatch(pattern, { dot: true }), - gmatcher: gmatcher - } -} - -function setopts (self, pattern, options) { - if (!options) - options = {} - - // base-matching: just use globstar for that. - if (options.matchBase && -1 === pattern.indexOf("/")) { - if (options.noglobstar) { - throw new Error("base matching requires globstar") - } - pattern = "**/" + pattern - } - - self.silent = !!options.silent - self.pattern = pattern - self.strict = options.strict !== false - self.realpath = !!options.realpath - self.realpathCache = options.realpathCache || Object.create(null) - self.follow = !!options.follow - self.dot = !!options.dot - self.mark = !!options.mark - self.nodir = !!options.nodir - if (self.nodir) - self.mark = true - self.sync = !!options.sync - self.nounique = !!options.nounique - self.nonull = !!options.nonull - self.nosort = !!options.nosort - self.nocase = !!options.nocase - self.stat = !!options.stat - self.noprocess = !!options.noprocess - self.absolute = !!options.absolute - - self.maxLength = options.maxLength || Infinity - self.cache = options.cache || Object.create(null) - self.statCache = options.statCache || Object.create(null) - self.symlinks = options.symlinks || Object.create(null) - - setupIgnores(self, options) - - self.changedCwd = false - var cwd = process.cwd() - if (!ownProp(options, "cwd")) - self.cwd = cwd - else { - self.cwd = path.resolve(options.cwd) - self.changedCwd = self.cwd !== cwd - } - - self.root = options.root || path.resolve(self.cwd, "/") - self.root = path.resolve(self.root) - if (process.platform === "win32") - self.root = self.root.replace(/\\/g, "/") - - // TODO: is an absolute `cwd` supposed to be resolved against `root`? - // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') - self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) - if (process.platform === "win32") - self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") - self.nomount = !!options.nomount - - // disable comments and negation in Minimatch. - // Note that they are not supported in Glob itself anyway. - options.nonegate = true - options.nocomment = true - - self.minimatch = new Minimatch(pattern, options) - self.options = self.minimatch.options -} - -function finish (self) { - var nou = self.nounique - var all = nou ? [] : Object.create(null) - - for (var i = 0, l = self.matches.length; i < l; i ++) { - var matches = self.matches[i] - if (!matches || Object.keys(matches).length === 0) { - if (self.nonull) { - // do like the shell, and spit out the literal glob - var literal = self.minimatch.globSet[i] - if (nou) - all.push(literal) - else - all[literal] = true - } - } else { - // had matches - var m = Object.keys(matches) - if (nou) - all.push.apply(all, m) - else - m.forEach(function (m) { - all[m] = true - }) - } - } - - if (!nou) - all = Object.keys(all) - - if (!self.nosort) - all = all.sort(self.nocase ? alphasorti : alphasort) - - // at *some* point we statted all of these - if (self.mark) { - for (var i = 0; i < all.length; i++) { - all[i] = self._mark(all[i]) - } - if (self.nodir) { - all = all.filter(function (e) { - var notDir = !(/\/$/.test(e)) - var c = self.cache[e] || self.cache[makeAbs(self, e)] - if (notDir && c) - notDir = c !== 'DIR' && !Array.isArray(c) - return notDir - }) - } - } - - if (self.ignore.length) - all = all.filter(function(m) { - return !isIgnored(self, m) - }) - - self.found = all -} - -function mark (self, p) { - var abs = makeAbs(self, p) - var c = self.cache[abs] - var m = p - if (c) { - var isDir = c === 'DIR' || Array.isArray(c) - var slash = p.slice(-1) === '/' - - if (isDir && !slash) - m += '/' - else if (!isDir && slash) - m = m.slice(0, -1) - - if (m !== p) { - var mabs = makeAbs(self, m) - self.statCache[mabs] = self.statCache[abs] - self.cache[mabs] = self.cache[abs] - } - } - - return m -} - -// lotta situps... -function makeAbs (self, f) { - var abs = f - if (f.charAt(0) === '/') { - abs = path.join(self.root, f) - } else if (isAbsolute(f) || f === '') { - abs = f - } else if (self.changedCwd) { - abs = path.resolve(self.cwd, f) - } else { - abs = path.resolve(f) - } - - if (process.platform === 'win32') - abs = abs.replace(/\\/g, '/') - - return abs -} - - -// Return true, if pattern ends with globstar '**', for the accompanying parent directory. -// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents -function isIgnored (self, path) { - if (!self.ignore.length) - return false - - return self.ignore.some(function(item) { - return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) - }) -} - -function childrenIgnored (self, path) { - if (!self.ignore.length) - return false - - return self.ignore.some(function(item) { - return !!(item.gmatcher && item.gmatcher.match(path)) - }) -} - -}).call(this,require('_process')) - -},{"_process":571,"minimatch":557,"path":567,"path-is-absolute":568}],539:[function(require,module,exports){ -(function (process){ -// Approach: -// -// 1. Get the minimatch set -// 2. For each pattern in the set, PROCESS(pattern, false) -// 3. Store matches per-set, then uniq them -// -// PROCESS(pattern, inGlobStar) -// Get the first [n] items from pattern that are all strings -// Join these together. This is PREFIX. -// If there is no more remaining, then stat(PREFIX) and -// add to matches if it succeeds. END. -// -// If inGlobStar and PREFIX is symlink and points to dir -// set ENTRIES = [] -// else readdir(PREFIX) as ENTRIES -// If fail, END -// -// with ENTRIES -// If pattern[n] is GLOBSTAR -// // handle the case where the globstar match is empty -// // by pruning it out, and testing the resulting pattern -// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) -// // handle other cases. -// for ENTRY in ENTRIES (not dotfiles) -// // attach globstar + tail onto the entry -// // Mark that this entry is a globstar match -// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) -// -// else // not globstar -// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) -// Test ENTRY against pattern[n] -// If fails, continue -// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) -// -// Caveat: -// Cache all stats and readdirs results to minimize syscall. Since all -// we ever care about is existence and directory-ness, we can just keep -// `true` for files, and [children,...] for directories, or `false` for -// things that don't exist. - -module.exports = glob - -var fs = require('fs') -var rp = require('fs.realpath') -var minimatch = require('minimatch') -var Minimatch = minimatch.Minimatch -var inherits = require('inherits') -var EE = require('events').EventEmitter -var path = require('path') -var assert = require('assert') -var isAbsolute = require('path-is-absolute') -var globSync = require('./sync.js') -var common = require('./common.js') -var alphasort = common.alphasort -var alphasorti = common.alphasorti -var setopts = common.setopts -var ownProp = common.ownProp -var inflight = require('inflight') -var util = require('util') -var childrenIgnored = common.childrenIgnored -var isIgnored = common.isIgnored - -var once = require('once') - -function glob (pattern, options, cb) { - if (typeof options === 'function') cb = options, options = {} - if (!options) options = {} - - if (options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return globSync(pattern, options) - } - - return new Glob(pattern, options, cb) -} - -glob.sync = globSync -var GlobSync = glob.GlobSync = globSync.GlobSync - -// old api surface -glob.glob = glob - -function extend (origin, add) { - if (add === null || typeof add !== 'object') { - return origin - } - - var keys = Object.keys(add) - var i = keys.length - while (i--) { - origin[keys[i]] = add[keys[i]] - } - return origin -} - -glob.hasMagic = function (pattern, options_) { - var options = extend({}, options_) - options.noprocess = true - - var g = new Glob(pattern, options) - var set = g.minimatch.set - - if (!pattern) - return false - - if (set.length > 1) - return true - - for (var j = 0; j < set[0].length; j++) { - if (typeof set[0][j] !== 'string') - return true - } - - return false -} - -glob.Glob = Glob -inherits(Glob, EE) -function Glob (pattern, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - - if (options && options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return new GlobSync(pattern, options) - } - - if (!(this instanceof Glob)) - return new Glob(pattern, options, cb) - - setopts(this, pattern, options) - this._didRealPath = false - - // process each pattern in the minimatch set - var n = this.minimatch.set.length - - // The matches are stored as {: true,...} so that - // duplicates are automagically pruned. - // Later, we do an Object.keys() on these. - // Keep them as a list so we can fill in when nonull is set. - this.matches = new Array(n) - - if (typeof cb === 'function') { - cb = once(cb) - this.on('error', cb) - this.on('end', function (matches) { - cb(null, matches) - }) - } - - var self = this - this._processing = 0 - - this._emitQueue = [] - this._processQueue = [] - this.paused = false - - if (this.noprocess) - return this - - if (n === 0) - return done() - - var sync = true - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false, done) - } - sync = false - - function done () { - --self._processing - if (self._processing <= 0) { - if (sync) { - process.nextTick(function () { - self._finish() - }) - } else { - self._finish() - } - } - } -} - -Glob.prototype._finish = function () { - assert(this instanceof Glob) - if (this.aborted) - return - - if (this.realpath && !this._didRealpath) - return this._realpath() - - common.finish(this) - this.emit('end', this.found) -} - -Glob.prototype._realpath = function () { - if (this._didRealpath) - return - - this._didRealpath = true - - var n = this.matches.length - if (n === 0) - return this._finish() - - var self = this - for (var i = 0; i < this.matches.length; i++) - this._realpathSet(i, next) - - function next () { - if (--n === 0) - self._finish() - } -} - -Glob.prototype._realpathSet = function (index, cb) { - var matchset = this.matches[index] - if (!matchset) - return cb() - - var found = Object.keys(matchset) - var self = this - var n = found.length - - if (n === 0) - return cb() - - var set = this.matches[index] = Object.create(null) - found.forEach(function (p, i) { - // If there's a problem with the stat, then it means that - // one or more of the links in the realpath couldn't be - // resolved. just return the abs value in that case. - p = self._makeAbs(p) - rp.realpath(p, self.realpathCache, function (er, real) { - if (!er) - set[real] = true - else if (er.syscall === 'stat') - set[p] = true - else - self.emit('error', er) // srsly wtf right here - - if (--n === 0) { - self.matches[index] = set - cb() - } - }) - }) -} - -Glob.prototype._mark = function (p) { - return common.mark(this, p) -} - -Glob.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} - -Glob.prototype.abort = function () { - this.aborted = true - this.emit('abort') -} - -Glob.prototype.pause = function () { - if (!this.paused) { - this.paused = true - this.emit('pause') - } -} - -Glob.prototype.resume = function () { - if (this.paused) { - this.emit('resume') - this.paused = false - if (this._emitQueue.length) { - var eq = this._emitQueue.slice(0) - this._emitQueue.length = 0 - for (var i = 0; i < eq.length; i ++) { - var e = eq[i] - this._emitMatch(e[0], e[1]) - } - } - if (this._processQueue.length) { - var pq = this._processQueue.slice(0) - this._processQueue.length = 0 - for (var i = 0; i < pq.length; i ++) { - var p = pq[i] - this._processing-- - this._process(p[0], p[1], p[2], p[3]) - } - } - } -} - -Glob.prototype._process = function (pattern, index, inGlobStar, cb) { - assert(this instanceof Glob) - assert(typeof cb === 'function') - - if (this.aborted) - return - - this._processing++ - if (this.paused) { - this._processQueue.push([pattern, index, inGlobStar, cb]) - return - } - - //console.error('PROCESS %d', this._processing, pattern) - - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. - - // see if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index, cb) - return - - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break - - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break - } - - var remain = pattern.slice(n) - - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix - - var abs = this._makeAbs(read) - - //if ignored, skip _processing - if (childrenIgnored(this, read)) - return cb() - - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) -} - -Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} - -Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - - // if the abs isn't a dir, then nothing can match! - if (!entries) - return cb() - - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' - - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) - } - } - - //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) - - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return cb() - - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. - - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this._emitMatch(index, e) - } - // This was the last one, and no stats were needed - return cb() - } - - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - this._process([e].concat(remain), index, inGlobStar, cb) - } - cb() -} - -Glob.prototype._emitMatch = function (index, e) { - if (this.aborted) - return - - if (isIgnored(this, e)) - return - - if (this.paused) { - this._emitQueue.push([index, e]) - return - } - - var abs = isAbsolute(e) ? e : this._makeAbs(e) - - if (this.mark) - e = this._mark(e) - - if (this.absolute) - e = abs - - if (this.matches[index][e]) - return - - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return - } - - this.matches[index][e] = true - - var st = this.statCache[abs] - if (st) - this.emit('stat', e, st) - - this.emit('match', e) -} - -Glob.prototype._readdirInGlobStar = function (abs, cb) { - if (this.aborted) - return - - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false, cb) - - var lstatkey = 'lstat\0' + abs - var self = this - var lstatcb = inflight(lstatkey, lstatcb_) - - if (lstatcb) - fs.lstat(abs, lstatcb) - - function lstatcb_ (er, lstat) { - if (er && er.code === 'ENOENT') - return cb() - - var isSym = lstat && lstat.isSymbolicLink() - self.symlinks[abs] = isSym - - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) { - self.cache[abs] = 'FILE' - cb() - } else - self._readdir(abs, false, cb) - } -} - -Glob.prototype._readdir = function (abs, inGlobStar, cb) { - if (this.aborted) - return - - cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) - if (!cb) - return - - //console.error('RD %j %j', +inGlobStar, abs) - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs, cb) - - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return cb() - - if (Array.isArray(c)) - return cb(null, c) - } - - var self = this - fs.readdir(abs, readdirCb(this, abs, cb)) -} - -function readdirCb (self, abs, cb) { - return function (er, entries) { - if (er) - self._readdirError(abs, er, cb) - else - self._readdirEntries(abs, entries, cb) - } -} - -Glob.prototype._readdirEntries = function (abs, entries, cb) { - if (this.aborted) - return - - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } - } - - this.cache[abs] = entries - return cb(null, entries) -} - -Glob.prototype._readdirError = function (f, er, cb) { - if (this.aborted) - return - - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - this.emit('error', error) - this.abort() - } - break - - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break - - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) { - this.emit('error', er) - // If the error is handled, then we abort - // if not, we threw out of here - this.abort() - } - if (!this.silent) - console.error('glob error', er) - break - } - - return cb() -} - -Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} - - -Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - //console.error('pgs2', prefix, remain[0], entries) - - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return cb() - - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) - - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false, cb) - - var isSym = this.symlinks[abs] - var len = entries.length - - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return cb() - - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue - - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true, cb) - - var below = gspref.concat(entries[i], remain) - this._process(below, index, true, cb) - } - - cb() -} - -Glob.prototype._processSimple = function (prefix, index, cb) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var self = this - this._stat(prefix, function (er, exists) { - self._processSimple2(prefix, index, er, exists, cb) - }) -} -Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { - - //console.error('ps2', prefix, exists) - - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - // If it doesn't exist, then just mark the lack of results - if (!exists) - return cb() - - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' - } - } - - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') - - // Mark this as a match - this._emitMatch(index, prefix) - cb() -} - -// Returns either 'DIR', 'FILE', or false -Glob.prototype._stat = function (f, cb) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' - - if (f.length > this.maxLength) - return cb() - - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] - - if (Array.isArray(c)) - c = 'DIR' - - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return cb(null, c) - - if (needDir && c === 'FILE') - return cb() - - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. - } - - var exists - var stat = this.statCache[abs] - if (stat !== undefined) { - if (stat === false) - return cb(null, stat) - else { - var type = stat.isDirectory() ? 'DIR' : 'FILE' - if (needDir && type === 'FILE') - return cb() - else - return cb(null, type, stat) - } - } - - var self = this - var statcb = inflight('stat\0' + abs, lstatcb_) - if (statcb) - fs.lstat(abs, statcb) - - function lstatcb_ (er, lstat) { - if (lstat && lstat.isSymbolicLink()) { - // If it's a symlink, then treat it as the target, unless - // the target does not exist, then treat it as a file. - return fs.stat(abs, function (er, stat) { - if (er) - self._stat2(f, abs, null, lstat, cb) - else - self._stat2(f, abs, er, stat, cb) - }) - } else { - self._stat2(f, abs, er, lstat, cb) - } - } -} - -Glob.prototype._stat2 = function (f, abs, er, stat, cb) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return cb() - } - - var needDir = f.slice(-1) === '/' - this.statCache[abs] = stat - - if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) - return cb(null, false, stat) - - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - this.cache[abs] = this.cache[abs] || c - - if (needDir && c === 'FILE') - return cb() - - return cb(null, c, stat) -} - -}).call(this,require('_process')) - -},{"./common.js":538,"./sync.js":540,"_process":571,"assert":79,"events":518,"fs":98,"fs.realpath":522,"inflight":547,"inherits":548,"minimatch":557,"once":564,"path":567,"path-is-absolute":568,"util":634}],540:[function(require,module,exports){ -(function (process){ -module.exports = globSync -globSync.GlobSync = GlobSync - -var fs = require('fs') -var rp = require('fs.realpath') -var minimatch = require('minimatch') -var Minimatch = minimatch.Minimatch -var Glob = require('./glob.js').Glob -var util = require('util') -var path = require('path') -var assert = require('assert') -var isAbsolute = require('path-is-absolute') -var common = require('./common.js') -var alphasort = common.alphasort -var alphasorti = common.alphasorti -var setopts = common.setopts -var ownProp = common.ownProp -var childrenIgnored = common.childrenIgnored -var isIgnored = common.isIgnored - -function globSync (pattern, options) { - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') - - return new GlobSync(pattern, options).found -} - -function GlobSync (pattern, options) { - if (!pattern) - throw new Error('must provide pattern') - - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') - - if (!(this instanceof GlobSync)) - return new GlobSync(pattern, options) - - setopts(this, pattern, options) - - if (this.noprocess) - return this - - var n = this.minimatch.set.length - this.matches = new Array(n) - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false) - } - this._finish() -} - -GlobSync.prototype._finish = function () { - assert(this instanceof GlobSync) - if (this.realpath) { - var self = this - this.matches.forEach(function (matchset, index) { - var set = self.matches[index] = Object.create(null) - for (var p in matchset) { - try { - p = self._makeAbs(p) - var real = rp.realpathSync(p, self.realpathCache) - set[real] = true - } catch (er) { - if (er.syscall === 'stat') - set[self._makeAbs(p)] = true - else - throw er - } - } - }) - } - common.finish(this) -} - - -GlobSync.prototype._process = function (pattern, index, inGlobStar) { - assert(this instanceof GlobSync) - - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. - - // See if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index) - return - - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break - - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break - } - - var remain = pattern.slice(n) - - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix - - var abs = this._makeAbs(read) - - //if ignored, skip processing - if (childrenIgnored(this, read)) - return - - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar) -} - - -GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { - var entries = this._readdir(abs, inGlobStar) - - // if the abs isn't a dir, then nothing can match! - if (!entries) - return - - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' - - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) - } - } - - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return - - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. - - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix.slice(-1) !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this._emitMatch(index, e) - } - // This was the last one, and no stats were needed - return - } - - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) - newPattern = [prefix, e] - else - newPattern = [e] - this._process(newPattern.concat(remain), index, inGlobStar) - } -} - - -GlobSync.prototype._emitMatch = function (index, e) { - if (isIgnored(this, e)) - return - - var abs = this._makeAbs(e) - - if (this.mark) - e = this._mark(e) - - if (this.absolute) { - e = abs - } - - if (this.matches[index][e]) - return - - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return - } - - this.matches[index][e] = true - - if (this.stat) - this._stat(e) -} - - -GlobSync.prototype._readdirInGlobStar = function (abs) { - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false) - - var entries - var lstat - var stat - try { - lstat = fs.lstatSync(abs) - } catch (er) { - if (er.code === 'ENOENT') { - // lstat failed, doesn't exist - return null - } - } - - var isSym = lstat && lstat.isSymbolicLink() - this.symlinks[abs] = isSym - - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) - this.cache[abs] = 'FILE' - else - entries = this._readdir(abs, false) - - return entries -} - -GlobSync.prototype._readdir = function (abs, inGlobStar) { - var entries - - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs) - - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return null - - if (Array.isArray(c)) - return c - } - - try { - return this._readdirEntries(abs, fs.readdirSync(abs)) - } catch (er) { - this._readdirError(abs, er) - return null - } -} - -GlobSync.prototype._readdirEntries = function (abs, entries) { - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } - } - - this.cache[abs] = entries - - // mark and cache dir-ness - return entries -} - -GlobSync.prototype._readdirError = function (f, er) { - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - throw error - } - break - - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break - - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) - throw er - if (!this.silent) - console.error('glob error', er) - break - } -} - -GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { - - var entries = this._readdir(abs, inGlobStar) - - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return - - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) - - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false) - - var len = entries.length - var isSym = this.symlinks[abs] - - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return - - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue - - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true) - - var below = gspref.concat(entries[i], remain) - this._process(below, index, true) - } -} - -GlobSync.prototype._processSimple = function (prefix, index) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var exists = this._stat(prefix) - - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - // If it doesn't exist, then just mark the lack of results - if (!exists) - return - - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' - } - } - - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') - - // Mark this as a match - this._emitMatch(index, prefix) -} - -// Returns either 'DIR', 'FILE', or false -GlobSync.prototype._stat = function (f) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' - - if (f.length > this.maxLength) - return false - - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] - - if (Array.isArray(c)) - c = 'DIR' - - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return c - - if (needDir && c === 'FILE') - return false - - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. - } - - var exists - var stat = this.statCache[abs] - if (!stat) { - var lstat - try { - lstat = fs.lstatSync(abs) - } catch (er) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return false - } - } - - if (lstat && lstat.isSymbolicLink()) { - try { - stat = fs.statSync(abs) - } catch (er) { - stat = lstat - } - } else { - stat = lstat - } - } - - this.statCache[abs] = stat - - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - - this.cache[abs] = this.cache[abs] || c - - if (needDir && c === 'FILE') - return false - - return c -} - -GlobSync.prototype._mark = function (p) { - return common.mark(this, p) -} - -GlobSync.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} - -}).call(this,require('_process')) - -},{"./common.js":538,"./glob.js":539,"_process":571,"assert":79,"fs":98,"fs.realpath":522,"minimatch":557,"path":567,"path-is-absolute":568,"util":634}],541:[function(require,module,exports){ -'use strict' - -module.exports = clone - -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj - - if (obj instanceof Object) - var copy = { __proto__: obj.__proto__ } - else - var copy = Object.create(null) - - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) - - return copy -} - -},{}],542:[function(require,module,exports){ -(function (process,global){ -var fs = require('fs') -var polyfills = require('./polyfills.js') -var legacy = require('./legacy-streams.js') -var clone = require('./clone.js') - -var util = require('util') - -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol - -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' -} - -function noop () {} - -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } - -// Once time initialization -if (!global[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = [] - Object.defineProperty(global, gracefulQueue, { - get: function() { - return queue - } - }) - - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - retry() - } - - if (typeof cb === 'function') - cb.apply(this, arguments) - }) - } - - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) - - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - retry() - } - - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) - - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(global[gracefulQueue]) - require('assert').equal(global[gracefulQueue].length, 0) - }) - } -} - -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} - -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch - - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readFile(path, options, cb) - - function go$readFile (path, options, cb) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } - - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$writeFile(path, data, options, cb) - - function go$writeFile (path, data, options, cb) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } - - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$appendFile(path, data, options, cb) - - function go$appendFile (path, data, options, cb) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } - - var fs$readdir = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - var args = [path] - if (typeof options !== 'function') { - args.push(options) - } else { - cb = options - } - args.push(go$readdir$cb) - - return go$readdir(args) - - function go$readdir$cb (err, files) { - if (files && files.sort) - files.sort() - - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [args]]) - - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - } - } - - function go$readdir (args) { - return fs$readdir.apply(fs, args) - } - - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } - - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } - - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } - - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) - - // legacy names - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) - - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } - - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() - - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } - - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } - - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } - - function createReadStream (path, options) { - return new fs.ReadStream(path, options) - } - - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) - } - - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null - - return go$open(path, flags, mode, cb) - - function go$open (path, flags, mode, cb) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } - - return fs -} - -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - global[gracefulQueue].push(elem) -} - -function retry () { - var elem = global[gracefulQueue].shift() - if (elem) { - debug('RETRY', elem[0].name, elem[1]) - elem[0].apply(null, elem[1]) - } -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"./clone.js":541,"./legacy-streams.js":543,"./polyfills.js":544,"_process":571,"assert":79,"fs":98,"util":634}],543:[function(require,module,exports){ -(function (process){ -var Stream = require('stream').Stream - -module.exports = legacy - -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } - - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); - - Stream.call(this); - - var self = this; - - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; - - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.encoding) this.setEncoding(this.encoding); - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } - - if (this.start > this.end) { - throw new Error('start must be <= end'); - } - - this.pos = this.start; - } - - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } - - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } - - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } - - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - - Stream.call(this); - - this.path = path; - this.fd = null; - this.writable = true; - - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } - - this.pos = this.start; - } - - this.busy = false; - this._queue = []; - - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } -} - -}).call(this,require('_process')) - -},{"_process":571,"stream":615}],544:[function(require,module,exports){ -(function (process){ -var constants = require('constants') - -var origCwd = process.cwd -var cwd = null - -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} - -var chdir = process.chdir -process.chdir = function(d) { - cwd = null - chdir.call(process, d) -} - -module.exports = patch - -function patch (fs) { - // (re-)implement some things that are known busted or missing. - - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } - - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } - - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. - - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) - - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) - - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) - - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) - - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) - - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) - - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } - - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. - - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } - - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - - // This ensures `util.promisify` works as it does for native `fs.read`. - read.__proto__ = fs$read - return read - })(fs.read) - - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) - - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } - - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) - - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - } - - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } - - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } - - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } - - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - return stats; - } - } - - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true - - if (er.code === "ENOSYS") - return true - - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } - - return false - } -} - -}).call(this,require('_process')) - -},{"_process":571,"constants":118}],545:[function(require,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - -},{}],546:[function(require,module,exports){ -'use strict'; - -module.exports = (string, count = 1, options) => { - options = { - indent: ' ', - includeEmptyLines: false, - ...options - }; - - if (typeof string !== 'string') { - throw new TypeError( - `Expected \`input\` to be a \`string\`, got \`${typeof string}\`` - ); - } - - if (typeof count !== 'number') { - throw new TypeError( - `Expected \`count\` to be a \`number\`, got \`${typeof count}\`` - ); - } - - if (typeof options.indent !== 'string') { - throw new TypeError( - `Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\`` - ); - } - - if (count === 0) { - return string; - } - - const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm; - - return string.replace(regex, options.indent.repeat(count)); -}; - -},{}],547:[function(require,module,exports){ -(function (process){ -var wrappy = require('wrappy') -var reqs = Object.create(null) -var once = require('once') - -module.exports = wrappy(inflight) - -function inflight (key, cb) { - if (reqs[key]) { - reqs[key].push(cb) - return null - } else { - reqs[key] = [cb] - return makeres(key) - } -} - -function makeres (key) { - return once(function RES () { - var cbs = reqs[key] - var len = cbs.length - var args = slice(arguments) - - // XXX It's somewhat ambiguous whether a new callback added in this - // pass should be queued for later execution if something in the - // list of callbacks throws, or if it should just be discarded. - // However, it's such an edge case that it hardly matters, and either - // choice is likely as surprising as the other. - // As it happens, we do go ahead and schedule it for later execution. - try { - for (var i = 0; i < len; i++) { - cbs[i].apply(null, args) - } - } finally { - if (cbs.length > len) { - // added more in the interim. - // de-zalgo, just in case, but don't call again. - cbs.splice(0, len) - process.nextTick(function () { - RES.apply(null, args) - }) - } else { - delete reqs[key] - } - } - }) -} - -function slice (args) { - var length = args.length - var array = [] - - for (var i = 0; i < length; i++) array[i] = args[i] - return array -} - -}).call(this,require('_process')) - -},{"_process":571,"once":564,"wrappy":636}],548:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) - } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} - -},{}],549:[function(require,module,exports){ -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) -} - -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} - -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) -} - -},{}],550:[function(require,module,exports){ -'use strict'; -/* eslint-disable yoda */ -module.exports = x => { - if (Number.isNaN(x)) { - return false; - } - - // code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - x >= 0x1100 && ( - x <= 0x115f || // Hangul Jamo - x === 0x2329 || // LEFT-POINTING ANGLE BRACKET - x === 0x232a || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= x && x <= 0x4dbf) || - // CJK Unified Ideographs .. Yi Radicals - (0x4e00 <= x && x <= 0xa4c6) || - // Hangul Jamo Extended-A - (0xa960 <= x && x <= 0xa97c) || - // Hangul Syllables - (0xac00 <= x && x <= 0xd7a3) || - // CJK Compatibility Ideographs - (0xf900 <= x && x <= 0xfaff) || - // Vertical Forms - (0xfe10 <= x && x <= 0xfe19) || - // CJK Compatibility Forms .. Small Form Variants - (0xfe30 <= x && x <= 0xfe6b) || - // Halfwidth and Fullwidth Forms - (0xff01 <= x && x <= 0xff60) || - (0xffe0 <= x && x <= 0xffe6) || - // Kana Supplement - (0x1b000 <= x && x <= 0x1b001) || - // Enclosed Ideographic Supplement - (0x1f200 <= x && x <= 0x1f251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= x && x <= 0x3fffd) - ) - ) { - return true; - } - - return false; -}; - -},{}],551:[function(require,module,exports){ -/** - * Export generator function checks. - */ -module.exports = isGenerator -module.exports.fn = isGeneratorFunction - -/** - * Check whether an object is a generator. - * - * @param {Object} obj - * @return {Boolean} - */ -function isGenerator (obj) { - return obj && - typeof obj.next === 'function' && - typeof obj.throw === 'function' -} - -/** - * Check whether a function is generator. - * - * @param {Function} fn - * @return {Boolean} - */ -function isGeneratorFunction (fn) { - return typeof fn === 'function' && - fn.constructor && - fn.constructor.name === 'GeneratorFunction' -} - -},{}],552:[function(require,module,exports){ -'use strict'; - -const isStream = stream => - stream !== null && - typeof stream === 'object' && - typeof stream.pipe === 'function'; - -isStream.writable = stream => - isStream(stream) && - stream.writable !== false && - typeof stream._write === 'function' && - typeof stream._writableState === 'object'; - -isStream.readable = stream => - isStream(stream) && - stream.readable !== false && - typeof stream._read === 'function' && - typeof stream._readableState === 'object'; - -isStream.duplex = stream => - isStream.writable(stream) && - isStream.readable(stream); - -isStream.transform = stream => - isStream.duplex(stream) && - typeof stream._transform === 'function' && - typeof stream._transformState === 'object'; - -module.exports = isStream; - -},{}],553:[function(require,module,exports){ -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - -},{}],554:[function(require,module,exports){ -/* - * Copyright 2013 AJ O'Neal - * Copyright 2015 Tiancheng "Timothy" Gu - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict' - -/** - * @file - * - * Implementation of the Fisher-Yates shuffle algorithm in JavaScript, with - * the possibility of using a seed to ensure reproducibility. - * - * @module knuth-shuffle-seeded - */ - -var randGen = require('seed-random') - -/** - * Shuffle an array using the Fisher-Yates shuffle algorithm, aka Knuth - * shuffle. - * - * Note that this function overwrites the initial array. As a result if you - * would like to keep the original array intact, you have to copy the initial - * array to a new array. - * - * Implementation derived from http://stackoverflow.com/questions/2450954/. - * - * @param {Array} array An array that is to be shuffled. - * @param [seed=Math.random()] Seed for the shuffling operation. If - * unspecified then a random value is used. - * @return {Array} The resulting array. - */ -module.exports = function shuffle(array, seed) { - var currentIndex - , temporaryValue - , randomIndex - , rand - if (seed == null) rand = randGen() - else rand = randGen(seed) - - if (array.constructor !== Array) throw new Error('Input is not an array') - currentIndex = array.length - - // While there remain elements to shuffle... - while (0 !== currentIndex) { - // Pick a remaining element... - randomIndex = Math.floor(rand() * (currentIndex --)) - - // And swap it with the current element. - temporaryValue = array[currentIndex] - array[currentIndex] = array[randomIndex] - array[randomIndex] = temporaryValue - } - - return array -} - -},{"seed-random":599}],555:[function(require,module,exports){ -(function (global){ -/** - * @license - * Lodash - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre-ES5 environments. */ - var undefined; - - /** Used as the semantic version number. */ - var VERSION = '4.17.15'; - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** Error message constants. */ - var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', - FUNC_ERROR_TEXT = 'Expected a function'; - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** Used as the maximum memoize cache size. */ - var MAX_MEMOIZE_SIZE = 500; - - /** Used as the internal argument placeholder. */ - var PLACEHOLDER = '__lodash_placeholder__'; - - /** Used to compose bitmasks for cloning. */ - var CLONE_DEEP_FLAG = 1, - CLONE_FLAT_FLAG = 2, - CLONE_SYMBOLS_FLAG = 4; - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; - - /** Used to compose bitmasks for function metadata. */ - var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_CURRY_BOUND_FLAG = 4, - WRAP_CURRY_FLAG = 8, - WRAP_CURRY_RIGHT_FLAG = 16, - WRAP_PARTIAL_FLAG = 32, - WRAP_PARTIAL_RIGHT_FLAG = 64, - WRAP_ARY_FLAG = 128, - WRAP_REARG_FLAG = 256, - WRAP_FLIP_FLAG = 512; - - /** Used as default options for `_.truncate`. */ - var DEFAULT_TRUNC_LENGTH = 30, - DEFAULT_TRUNC_OMISSION = '...'; - - /** Used to detect hot functions by number of calls within a span of milliseconds. */ - var HOT_COUNT = 800, - HOT_SPAN = 16; - - /** Used to indicate the type of lazy iteratees. */ - var LAZY_FILTER_FLAG = 1, - LAZY_MAP_FLAG = 2, - LAZY_WHILE_FLAG = 3; - - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0, - MAX_SAFE_INTEGER = 9007199254740991, - MAX_INTEGER = 1.7976931348623157e+308, - NAN = 0 / 0; - - /** Used as references for the maximum length and index of an array. */ - var MAX_ARRAY_LENGTH = 4294967295, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, - HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - - /** Used to associate wrap methods with their bit flags. */ - var wrapFlags = [ - ['ary', WRAP_ARY_FLAG], - ['bind', WRAP_BIND_FLAG], - ['bindKey', WRAP_BIND_KEY_FLAG], - ['curry', WRAP_CURRY_FLAG], - ['curryRight', WRAP_CURRY_RIGHT_FLAG], - ['flip', WRAP_FLIP_FLAG], - ['partial', WRAP_PARTIAL_FLAG], - ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], - ['rearg', WRAP_REARG_FLAG] - ]; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - asyncTag = '[object AsyncFunction]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - domExcTag = '[object DOMException]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - nullTag = '[object Null]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - proxyTag = '[object Proxy]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - undefinedTag = '[object Undefined]', - weakMapTag = '[object WeakMap]', - weakSetTag = '[object WeakSet]'; - - var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to match empty string literals in compiled template source. */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** Used to match HTML entities and HTML characters. */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, - reUnescapedHtml = /[&<>"']/g, - reHasEscapedHtml = RegExp(reEscapedHtml.source), - reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - - /** Used to match template delimiters. */ - var reEscape = /<%-([\s\S]+?)%>/g, - reEvaluate = /<%([\s\S]+?)%>/g, - reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match property names within property paths. */ - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, - reHasRegExpChar = RegExp(reRegExpChar.source); - - /** Used to match leading and trailing whitespace. */ - var reTrim = /^\s+|\s+$/g, - reTrimStart = /^\s+/, - reTrimEnd = /\s+$/; - - /** Used to match wrap detail comments. */ - var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, - reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, - reSplitDetails = /,? & /; - - /** Used to match words composed of alphanumeric characters. */ - var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; - - /** Used to match backslashes in property paths. */ - var reEscapeChar = /\\(\\)?/g; - - /** - * Used to match - * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match `RegExp` flags from their coerced string values. */ - var reFlags = /\w*$/; - - /** 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 host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used to detect octal string values. */ - var reIsOctal = /^0o[0-7]+$/i; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** Used to match Latin Unicode letters (excluding mathematical operators). */ - var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - - /** Used to ensure capturing order of template delimiters. */ - var reNoMatch = /($^)/; - - /** Used to match unescaped characters in compiled string literals. */ - var reUnescapedString = /['\n\r\u2028\u2029\\]/g; - - /** Used to compose unicode character classes. */ - var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, - rsDingbatRange = '\\u2700-\\u27bf', - rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', - rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', - rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', - rsPunctuationRange = '\\u2000-\\u206f', - rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', - rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', - rsVarRange = '\\ufe0e\\ufe0f', - rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; - - /** Used to compose unicode capture groups. */ - var rsApos = "['\u2019]", - rsAstral = '[' + rsAstralRange + ']', - rsBreak = '[' + rsBreakRange + ']', - rsCombo = '[' + rsComboRange + ']', - rsDigits = '\\d+', - rsDingbat = '[' + rsDingbatRange + ']', - rsLower = '[' + rsLowerRange + ']', - rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', - rsFitz = '\\ud83c[\\udffb-\\udfff]', - rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsUpper = '[' + rsUpperRange + ']', - rsZWJ = '\\u200d'; - - /** Used to compose unicode regexes. */ - var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', - rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', - rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', - rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', - reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', - rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, - rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; - - /** Used to match apostrophes. */ - var reApos = RegExp(rsApos, 'g'); - - /** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ - var reComboMark = RegExp(rsCombo, 'g'); - - /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ - var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - - /** Used to match complex or compound words. */ - var reUnicodeWord = RegExp([ - rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', - rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', - rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, - rsUpper + '+' + rsOptContrUpper, - rsOrdUpper, - rsOrdLower, - rsDigits, - rsEmoji - ].join('|'), 'g'); - - /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ - var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); - - /** Used to detect strings that need a more robust regexp to match words. */ - var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; - - /** Used to assign default `context` object properties. */ - var contextProps = [ - 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', - 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', - 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', - 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', - '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' - ]; - - /** Used to make template sourceURLs easier to identify. */ - var templateCounter = -1; - - /** 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] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; - - /** Used to identify `toStringTag` values supported by `_.clone`. */ - var cloneableTags = {}; - cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; - cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; - - /** Used to map Latin Unicode letters to basic Latin letters. */ - var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 's' - }; - - /** Used to map characters to HTML entities. */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Used to map HTML entities to characters. */ - var htmlUnescapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - ''': "'" - }; - - /** Used to escape characters for inclusion in compiled string literals. */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /** Built-in method references without a dependency on `root`. */ - var freeParseFloat = parseFloat, - freeParseInt = parseInt; - - /** 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')(); - - /** 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; - - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports && freeGlobal.process; - - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function() { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule && freeModule.require && freeModule.require('util').types; - - if (types) { - return types; - } - - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - }()); - - /* Node.js helper references. */ - var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, - nodeIsDate = nodeUtil && nodeUtil.isDate, - nodeIsMap = nodeUtil && nodeUtil.isMap, - nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, - nodeIsSet = nodeUtil && nodeUtil.isSet, - nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - - /*--------------------------------------------------------------------------*/ - - /** - * 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); - } - - /** - * A specialized version of `baseAggregator` for arrays. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function arrayAggregator(array, setter, iteratee, accumulator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - var value = array[index]; - setter(accumulator, value, iteratee(value), array); - } - return accumulator; - } - - /** - * A specialized version of `_.forEach` 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 `array`. - */ - function arrayEach(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.forEachRight` 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 `array`. - */ - function arrayEachRight(array, iteratee) { - var length = array == null ? 0 : array.length; - - while (length--) { - if (iteratee(array[length], length, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.every` 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 all elements pass the predicate check, - * else `false`. - */ - function arrayEvery(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (!predicate(array[index], index, array)) { - return false; - } - } - return true; - } - - /** - * 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; - } - - /** - * A specialized version of `_.includes` for arrays without support for - * specifying an index to search from. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludes(array, value) { - var length = array == null ? 0 : array.length; - return !!length && baseIndexOf(array, value, 0) > -1; - } - - /** - * This function is like `arrayIncludes` except that it accepts a comparator. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @param {Function} comparator The comparator invoked per element. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludesWith(array, value, comparator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (comparator(value, array[index])) { - return true; - } - } - return false; - } - - /** - * 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; - } - - /** - * 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; - } - - /** - * 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; - } - - /** - * A specialized version of `_.reduceRight` 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 last element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduceRight(array, iteratee, accumulator, initAccum) { - var length = array == null ? 0 : array.length; - if (initAccum && length) { - accumulator = array[--length]; - } - while (length--) { - accumulator = iteratee(accumulator, array[length], length, array); - } - return accumulator; - } - - /** - * 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; - } - - /** - * Gets the size of an ASCII `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - var asciiSize = baseProperty('length'); - - /** - * Converts an ASCII `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function asciiToArray(string) { - return string.split(''); - } - - /** - * Splits an ASCII `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function asciiWords(string) { - return string.match(reAsciiWord) || []; - } - - /** - * The base implementation of methods like `_.findKey` and `_.findLastKey`, - * without support for iteratee shorthands, which iterates over `collection` - * using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the found element or its key, else `undefined`. - */ - function baseFindKey(collection, predicate, eachFunc) { - var result; - eachFunc(collection, function(value, key, collection) { - if (predicate(value, key, collection)) { - result = key; - return false; - } - }); - return result; - } - - /** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); - - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.indexOf` without `fromIndex` bounds checks. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOf(array, value, fromIndex) { - return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); - } - - /** - * This function is like `baseIndexOf` except that it accepts a comparator. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @param {Function} comparator The comparator invoked per element. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOfWith(array, value, fromIndex, comparator) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (comparator(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.isNaN` without support for number objects. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - */ - function baseIsNaN(value) { - return value !== value; - } - - /** - * The base implementation of `_.mean` and `_.meanBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the mean. - */ - function baseMean(array, iteratee) { - var length = array == null ? 0 : array.length; - return length ? (baseSum(array, iteratee) / length) : NAN; - } - - /** - * 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]; - }; - } - - /** - * The base implementation of `_.propertyOf` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; - }; - } - - /** - * 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; - } - - /** - * The base implementation of `_.sortBy` which uses `comparer` to define the - * sort order of `array` and replaces criteria objects with their corresponding - * values. - * - * @private - * @param {Array} array The array to sort. - * @param {Function} comparer The function to define sort order. - * @returns {Array} Returns `array`. - */ - function baseSortBy(array, comparer) { - var length = array.length; - - array.sort(comparer); - while (length--) { - array[length] = array[length].value; - } - return array; - } - - /** - * The base implementation of `_.sum` and `_.sumBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the sum. - */ - function baseSum(array, iteratee) { - var result, - index = -1, - length = array.length; - - while (++index < length) { - var current = iteratee(array[index]); - if (current !== undefined) { - result = result === undefined ? current : (result + current); - } - } - return result; - } - - /** - * 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; - } - - /** - * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array - * of key-value pairs for `object` corresponding to the property names of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the key-value pairs. - */ - function baseToPairs(object, props) { - return arrayMap(props, function(key) { - return [key, object[key]]; - }); - } - - /** - * 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); - }; - } - - /** - * The base implementation of `_.values` and `_.valuesIn` which creates an - * array of `object` property values corresponding to the property names - * of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the array of property values. - */ - function baseValues(object, props) { - return arrayMap(props, function(key) { - return object[key]; - }); - } - - /** - * 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 by `_.trim` and `_.trimStart` to get the index of the first string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the first unmatched string symbol. - */ - function charsStartIndex(strSymbols, chrSymbols) { - var index = -1, - length = strSymbols.length; - - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the last unmatched string symbol. - */ - function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; - - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Gets the number of `placeholder` occurrences in `array`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} placeholder The placeholder to search for. - * @returns {number} Returns the placeholder count. - */ - function countHolders(array, placeholder) { - var length = array.length, - result = 0; - - while (length--) { - if (array[length] === placeholder) { - ++result; - } - } - return result; - } - - /** - * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A - * letters to basic Latin letters. - * - * @private - * @param {string} letter The matched letter to deburr. - * @returns {string} Returns the deburred letter. - */ - var deburrLetter = basePropertyOf(deburredLetters); - - /** - * Used by `_.escape` to convert characters to HTML entities. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - var escapeHtmlChar = basePropertyOf(htmlEscapes); - - /** - * Used by `_.template` to escape characters for inclusion in compiled string literals. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeStringChar(chr) { - return '\\' + stringEscapes[chr]; - } - - /** - * 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]; - } - - /** - * Checks if `string` contains Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a symbol is found, else `false`. - */ - function hasUnicode(string) { - return reHasUnicode.test(string); - } - - /** - * Checks if `string` contains a word composed of Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a word is found, else `false`. - */ - function hasUnicodeWord(string) { - return reHasUnicodeWord.test(string); - } - - /** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ - function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; - } - - /** - * 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; - } - - /** - * 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)); - }; - } - - /** - * Replaces all `placeholder` elements in `array` with an internal placeholder - * and returns an array of their indexes. - * - * @private - * @param {Array} array The array to modify. - * @param {*} placeholder The placeholder to replace. - * @returns {Array} Returns the new array of placeholder indexes. - */ - function replaceHolders(array, placeholder) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value === placeholder || value === PLACEHOLDER) { - array[index] = PLACEHOLDER; - result[resIndex++] = index; - } - } - 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; - } - - /** - * Converts `set` to its value-value pairs. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the value-value pairs. - */ - function setToPairs(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = [value, value]; - }); - return result; - } - - /** - * A specialized version of `_.indexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function strictIndexOf(array, value, fromIndex) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * A specialized version of `_.lastIndexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function strictLastIndexOf(array, value, fromIndex) { - var index = fromIndex + 1; - while (index--) { - if (array[index] === value) { - return index; - } - } - return index; - } - - /** - * Gets the number of symbols in `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the string size. - */ - function stringSize(string) { - return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); - } - - /** - * Converts `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function stringToArray(string) { - return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); - } - - /** - * Used by `_.unescape` to convert HTML entities to characters. - * - * @private - * @param {string} chr The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ - var unescapeHtmlChar = basePropertyOf(htmlUnescapes); - - /** - * Gets the size of a Unicode `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - function unicodeSize(string) { - var result = reUnicode.lastIndex = 0; - while (reUnicode.test(string)) { - ++result; - } - return result; - } - - /** - * Converts a Unicode `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function unicodeToArray(string) { - return string.match(reUnicode) || []; - } - - /** - * Splits a Unicode `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function unicodeWords(string) { - return string.match(reUnicodeWord) || []; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Create a new pristine `lodash` function using the `context` object. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Util - * @param {Object} [context=root] The context object. - * @returns {Function} Returns a new `lodash` function. - * @example - * - * _.mixin({ 'foo': _.constant('foo') }); - * - * var lodash = _.runInContext(); - * lodash.mixin({ 'bar': lodash.constant('bar') }); - * - * _.isFunction(_.foo); - * // => true - * _.isFunction(_.bar); - * // => false - * - * lodash.isFunction(lodash.foo); - * // => false - * lodash.isFunction(lodash.bar); - * // => true - * - * // Create a suped-up `defer` in Node.js. - * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; - */ - var runInContext = (function runInContext(context) { - context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); - - /** Built-in constructor references. */ - var Array = context.Array, - Date = context.Date, - Error = context.Error, - Function = context.Function, - Math = context.Math, - Object = context.Object, - RegExp = context.RegExp, - String = context.String, - TypeError = context.TypeError; - - /** Used for built-in method references. */ - var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; - - /** Used to detect overreaching core-js shims. */ - var coreJsData = context['__core-js_shared__']; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** Used to generate unique IDs. */ - var idCounter = 0; - - /** 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) : ''; - }()); - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto.toString; - - /** Used to infer the `Object` constructor. */ - var objectCtorString = funcToString.call(Object); - - /** Used to restore the original `_` reference in `_.noConflict`. */ - var oldDash = root._; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' - ); - - /** Built-in value references. */ - var Buffer = moduleExports ? context.Buffer : undefined, - Symbol = context.Symbol, - Uint8Array = context.Uint8Array, - allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, - getPrototype = overArg(Object.getPrototypeOf, Object), - objectCreate = Object.create, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice, - spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, - symIterator = Symbol ? Symbol.iterator : undefined, - symToStringTag = Symbol ? Symbol.toStringTag : undefined; - - var defineProperty = (function() { - try { - var func = getNative(Object, 'defineProperty'); - func({}, '', {}); - return func; - } catch (e) {} - }()); - - /** Mocked built-ins. */ - var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, - ctxNow = Date && Date.now !== root.Date.now && Date.now, - ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeCeil = Math.ceil, - nativeFloor = Math.floor, - nativeGetSymbols = Object.getOwnPropertySymbols, - nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, - nativeIsFinite = context.isFinite, - nativeJoin = arrayProto.join, - nativeKeys = overArg(Object.keys, Object), - nativeMax = Math.max, - nativeMin = Math.min, - nativeNow = Date.now, - nativeParseInt = context.parseInt, - nativeRandom = Math.random, - nativeReverse = arrayProto.reverse; - - /* Built-in method references that are verified to be native. */ - var DataView = getNative(context, 'DataView'), - Map = getNative(context, 'Map'), - Promise = getNative(context, 'Promise'), - Set = getNative(context, 'Set'), - WeakMap = getNative(context, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - - /** Used to store function metadata. */ - var metaMap = WeakMap && new WeakMap; - - /** Used to lookup unminified function names. */ - var realNames = {}; - - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps `value` to enable implicit method - * chain sequences. Methods that operate on and return arrays, collections, - * and functions can be chained together. Methods that retrieve a single value - * or may return a primitive value will automatically end the chain sequence - * and return the unwrapped value. Otherwise, the value must be unwrapped - * with `_#value`. - * - * Explicit chain sequences, which must be unwrapped with `_#value`, may be - * enabled using `_.chain`. - * - * The execution of chained methods is lazy, that is, it's deferred until - * `_#value` is implicitly or explicitly called. - * - * Lazy evaluation allows several methods to support shortcut fusion. - * Shortcut fusion is an optimization to merge iteratee calls; this avoids - * the creation of intermediate arrays and can greatly reduce the number of - * iteratee executions. Sections of a chain sequence qualify for shortcut - * fusion if the section is applied to an array and iteratees accept only - * one argument. The heuristic for whether a section qualifies for shortcut - * fusion is subject to change. - * - * Chaining is supported in custom builds as long as the `_#value` method is - * directly or indirectly included in the build. - * - * In addition to lodash methods, wrappers have `Array` and `String` methods. - * - * The wrapper `Array` methods are: - * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` - * - * The wrapper `String` methods are: - * `replace` and `split` - * - * The wrapper methods that support shortcut fusion are: - * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, - * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` - * - * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, - * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, - * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, - * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, - * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, - * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, - * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, - * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, - * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, - * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, - * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, - * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, - * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, - * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, - * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, - * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, - * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, - * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, - * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, - * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, - * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, - * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, - * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, - * `zipObject`, `zipObjectDeep`, and `zipWith` - * - * The wrapper methods that are **not** chainable by default are: - * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, - * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, - * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, - * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, - * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, - * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, - * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, - * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, - * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, - * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, - * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, - * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, - * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, - * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, - * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, - * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, - * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, - * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, - * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, - * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, - * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, - * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, - * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, - * `upperFirst`, `value`, and `words` - * - * @name _ - * @constructor - * @category Seq - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2, 3]); - * - * // Returns an unwrapped value. - * wrapped.reduce(_.add); - * // => 6 - * - * // Returns a wrapped value. - * var squares = wrapped.map(square); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { - if (value instanceof LodashWrapper) { - return value; - } - if (hasOwnProperty.call(value, '__wrapped__')) { - return wrapperClone(value); - } - } - return new LodashWrapper(value); - } - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} proto The object to inherit from. - * @returns {Object} Returns the new object. - */ - var baseCreate = (function() { - function object() {} - return function(proto) { - if (!isObject(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result = new object; - object.prototype = undefined; - return result; - }; - }()); - - /** - * The function whose prototype chain sequence wrappers inherit from. - * - * @private - */ - function baseLodash() { - // No operation performed. - } - - /** - * The base constructor for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable explicit method chain sequences. - */ - function LodashWrapper(value, chainAll) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__chain__ = !!chainAll; - this.__index__ = 0; - this.__values__ = undefined; - } - - /** - * By default, the template delimiters used by lodash are like those in - * embedded Ruby (ERB) as well as ES2015 template strings. Change the - * following template settings to use alternative delimiters. - * - * @static - * @memberOf _ - * @type {Object} - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'escape': reEscape, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'evaluate': reEvaluate, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type {string} - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type {Object} - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type {Function} - */ - '_': lodash - } - }; - - // Ensure wrappers are instances of `baseLodash`. - lodash.prototype = baseLodash.prototype; - lodash.prototype.constructor = lodash; - - LodashWrapper.prototype = baseCreate(baseLodash.prototype); - LodashWrapper.prototype.constructor = LodashWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. - * - * @private - * @constructor - * @param {*} value The value to wrap. - */ - function LazyWrapper(value) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__dir__ = 1; - this.__filtered__ = false; - this.__iteratees__ = []; - this.__takeCount__ = MAX_ARRAY_LENGTH; - this.__views__ = []; - } - - /** - * Creates a clone of the lazy wrapper object. - * - * @private - * @name clone - * @memberOf LazyWrapper - * @returns {Object} Returns the cloned `LazyWrapper` object. - */ - function lazyClone() { - var result = new LazyWrapper(this.__wrapped__); - result.__actions__ = copyArray(this.__actions__); - result.__dir__ = this.__dir__; - result.__filtered__ = this.__filtered__; - result.__iteratees__ = copyArray(this.__iteratees__); - result.__takeCount__ = this.__takeCount__; - result.__views__ = copyArray(this.__views__); - return result; - } - - /** - * Reverses the direction of lazy iteration. - * - * @private - * @name reverse - * @memberOf LazyWrapper - * @returns {Object} Returns the new reversed `LazyWrapper` object. - */ - function lazyReverse() { - if (this.__filtered__) { - var result = new LazyWrapper(this); - result.__dir__ = -1; - result.__filtered__ = true; - } else { - result = this.clone(); - result.__dir__ *= -1; - } - return result; - } - - /** - * Extracts the unwrapped value from its lazy wrapper. - * - * @private - * @name value - * @memberOf LazyWrapper - * @returns {*} Returns the unwrapped value. - */ - function lazyValue() { - var array = this.__wrapped__.value(), - dir = this.__dir__, - isArr = isArray(array), - isRight = dir < 0, - arrLength = isArr ? array.length : 0, - view = getView(0, arrLength, this.__views__), - start = view.start, - end = view.end, - length = end - start, - index = isRight ? end : (start - 1), - iteratees = this.__iteratees__, - iterLength = iteratees.length, - resIndex = 0, - takeCount = nativeMin(length, this.__takeCount__); - - if (!isArr || (!isRight && arrLength == length && takeCount == length)) { - return baseWrapperValue(array, this.__actions__); - } - var result = []; - - outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } - } - result[resIndex++] = value; - } - return result; - } - - // Ensure `LazyWrapper` is an instance of `baseLodash`. - LazyWrapper.prototype = baseCreate(baseLodash.prototype); - LazyWrapper.prototype.constructor = LazyWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * 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]); - } - } - - /** - * 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; - } - - /** - * 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.call(data, key) ? data[key] : undefined; - } - - /** - * 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.call(data, key); - } - - /** - * 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 : value; - return this; - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /*------------------------------------------------------------------------*/ - - /** - * 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]); - } - } - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - /** - * 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; - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - /*------------------------------------------------------------------------*/ - - /** - * 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]); - } - } - - /** - * 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 - }; - } - - /** - * 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; - } - - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - - /*------------------------------------------------------------------------*/ - - /** - * - * 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]); - } - } - - /** - * 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); - 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); - } - - // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - - /*------------------------------------------------------------------------*/ - - /** - * 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; - } - - /** - * 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); - } - - /** - * 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; - } - - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - /*------------------------------------------------------------------------*/ - - /** - * 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.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; - } - - /** - * A specialized version of `_.sample` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @returns {*} Returns the random element. - */ - function arraySample(array) { - var length = array.length; - return length ? array[baseRandom(0, length - 1)] : undefined; - } - - /** - * A specialized version of `_.sampleSize` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function arraySampleSize(array, n) { - return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); - } - - /** - * A specialized version of `_.shuffle` for arrays. - * - * @private - * @param {Array} array The array to shuffle. - * @returns {Array} Returns the new shuffled array. - */ - function arrayShuffle(array) { - return shuffleSelf(copyArray(array)); - } - - /** - * This function is like `assignValue` except that it doesn't assign - * `undefined` values. - * - * @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 assignMergeValue(object, key, value) { - if ((value !== undefined && !eq(object[key], value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * 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.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * 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; - } - - /** - * Aggregates elements of `collection` on `accumulator` with keys transformed - * by `iteratee` and values set by `setter`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function baseAggregator(collection, setter, iteratee, accumulator) { - baseEach(collection, function(value, key, collection) { - setter(accumulator, value, iteratee(value), collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); - } - - /** - * The base implementation of `_.assignIn` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssignIn(object, source) { - return object && copyObject(source, keysIn(source), object); - } - - /** - * 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) { - defineProperty(object, key, { - 'configurable': true, - 'enumerable': true, - 'value': value, - 'writable': true - }); - } else { - object[key] = value; - } - } - - /** - * The base implementation of `_.at` without support for individual paths. - * - * @private - * @param {Object} object The object to iterate over. - * @param {string[]} paths The property paths to pick. - * @returns {Array} Returns the picked elements. - */ - function baseAt(object, paths) { - var index = -1, - length = paths.length, - result = Array(length), - skip = object == null; - - while (++index < length) { - result[index] = skip ? undefined : get(object, paths[index]); - } - return result; - } - - /** - * 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; - } - - /** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} bitmask The bitmask flags. - * 1 - Deep clone - * 2 - Flatten inherited properties - * 4 - Clone symbols - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, bitmask, customizer, key, object, stack) { - var result, - isDeep = bitmask & CLONE_DEEP_FLAG, - isFlat = bitmask & CLONE_FLAT_FLAG, - isFull = bitmask & CLONE_SYMBOLS_FLAG; - - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag(value), - isFunc = tag == funcTag || tag == genTag; - - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - result = (isFlat || isFunc) ? {} : initCloneObject(value); - if (!isDeep) { - return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag(value, tag, isDeep); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - if (isSet(value)) { - value.forEach(function(subValue) { - result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); - }); - } else if (isMap(value)) { - value.forEach(function(subValue, key) { - result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - } - - var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); - - var props = isArr ? undefined : keysFunc(value); - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; - } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - return result; - } - - /** - * The base implementation of `_.conforms` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new spec function. - */ - function baseConforms(source) { - var props = keys(source); - return function(object) { - return baseConformsTo(object, source, props); - }; - } - - /** - * The base implementation of `_.conformsTo` which accepts `props` to check. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - */ - function baseConformsTo(object, source, props) { - var length = props.length; - if (object == null) { - return !length; - } - object = Object(object); - while (length--) { - var key = props[length], - predicate = source[key], - value = object[key]; - - if ((value === undefined && !(key in object)) || !predicate(value)) { - return false; - } - } - return true; - } - - /** - * The base implementation of `_.delay` and `_.defer` which accepts `args` - * to provide to `func`. - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {Array} args The arguments to provide to `func`. - * @returns {number|Object} Returns the timer id or timeout object. - */ - function baseDelay(func, wait, args) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * The base implementation of methods like `_.difference` without support - * for excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ - function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; - } - - /** - * 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); - - /** - * The base implementation of `_.forEachRight` 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 baseEachRight = createBaseEach(baseForOwnRight, true); - - /** - * The base implementation of `_.every` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false` - */ - function baseEvery(collection, predicate) { - var result = true; - baseEach(collection, function(value, index, collection) { - result = !!predicate(value, index, collection); - return result; - }); - return result; - } - - /** - * The base implementation of methods like `_.max` and `_.min` which accepts a - * `comparator` to determine the extremum value. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The iteratee invoked per iteration. - * @param {Function} comparator The comparator used to compare values. - * @returns {*} Returns the extremum value. - */ - function baseExtremum(array, iteratee, comparator) { - var index = -1, - length = array.length; - - while (++index < length) { - var value = array[index], - current = iteratee(value); - - if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { - var computed = current, - result = value; - } - } - return result; - } - - /** - * The base implementation of `_.fill` without an iteratee call guard. - * - * @private - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - */ - function baseFill(array, value, start, end) { - var length = array.length; - - start = toInteger(start); - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = (end === undefined || end > length) ? length : toInteger(end); - if (end < 0) { - end += length; - } - end = start > end ? 0 : toLength(end); - while (start < end) { - array[start++] = value; - } - return array; - } - - /** - * The base implementation of `_.filter` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function baseFilter(collection, predicate) { - var result = []; - baseEach(collection, function(value, index, collection) { - if (predicate(value, index, collection)) { - result.push(value); - } - }); - return result; - } - - /** - * 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; - } - - /** - * 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(); - - /** - * This function is like `baseFor` except that it iterates over properties - * in the opposite order. - * - * @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 baseForRight = createBaseFor(true); - - /** - * 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); - } - - /** - * The base implementation of `_.forOwnRight` 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 baseForOwnRight(object, iteratee) { - return object && baseForRight(object, iteratee, keys); - } - - /** - * The base implementation of `_.functions` which creates an array of - * `object` function property names filtered from `props`. - * - * @private - * @param {Object} object The object to inspect. - * @param {Array} props The property names to filter. - * @returns {Array} Returns the function names. - */ - function baseFunctions(object, props) { - return arrayFilter(props, function(key) { - return isFunction(object[key]); - }); - } - - /** - * 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; - } - - /** - * 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)); - } - - /** - * 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); - } - - /** - * The base implementation of `_.gt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - */ - function baseGt(value, other) { - return value > other; - } - - /** - * The base implementation of `_.has` 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 baseHas(object, key) { - return object != null && hasOwnProperty.call(object, key); - } - - /** - * 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); - } - - /** - * The base implementation of `_.inRange` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to check. - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - */ - function baseInRange(number, start, end) { - return number >= nativeMin(start, end) && number < nativeMax(start, end); - } - - /** - * The base implementation of methods like `_.intersection`, without support - * for iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. - */ - function baseIntersection(arrays, iteratee, comparator) { - var includes = comparator ? arrayIncludesWith : arrayIncludes, - length = arrays[0].length, - othLength = arrays.length, - othIndex = othLength, - caches = Array(othLength), - maxLength = Infinity, - result = []; - - while (othIndex--) { - var array = arrays[othIndex]; - if (othIndex && iteratee) { - array = arrayMap(array, baseUnary(iteratee)); - } - maxLength = nativeMin(array.length, maxLength); - caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; - } - array = arrays[0]; - - var index = -1, - seen = caches[0]; - - outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) - )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) - ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.invert` and `_.invertBy` which inverts - * `object` with values transformed by `iteratee` and set by `setter`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform values. - * @param {Object} accumulator The initial inverted object. - * @returns {Function} Returns `accumulator`. - */ - function baseInverter(object, setter, iteratee, accumulator) { - baseForOwn(object, function(value, key, object) { - setter(accumulator, iteratee(value), key, object); - }); - return accumulator; - } - - /** - * The base implementation of `_.invoke` without support for individual - * method arguments. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {Array} args The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - */ - function baseInvoke(object, path, args) { - path = castPath(path, object); - object = parent(object, path); - var func = object == null ? object : object[toKey(last(path))]; - return func == null ? undefined : apply(func, object, args); - } - - /** - * 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; - } - - /** - * The base implementation of `_.isArrayBuffer` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - */ - function baseIsArrayBuffer(value) { - return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; - } - - /** - * The base implementation of `_.isDate` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - */ - function baseIsDate(value) { - return isObjectLike(value) && baseGetTag(value) == dateTag; - } - - /** - * 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); - } - - /** - * 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 : getTag(object), - othTag = othIsArr ? arrayTag : getTag(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - 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)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.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 `_.isMap` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - */ - function baseIsMap(value) { - return isObjectLike(value) && getTag(value) == mapTag; - } - - /** - * 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; - } - - /** - * 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(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - - /** - * The base implementation of `_.isRegExp` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - */ - function baseIsRegExp(value) { - return isObjectLike(value) && baseGetTag(value) == regexpTag; - } - - /** - * The base implementation of `_.isSet` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - */ - function baseIsSet(value) { - return isObjectLike(value) && getTag(value) == setTag; - } - - /** - * 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 `_.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 `_.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.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - - /** - * 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(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), - result = []; - - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; - } - - /** - * The base implementation of `_.lt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - */ - function baseLt(value, other) { - return value < other; - } - - /** - * 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; - } - - /** - * 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); - }; - } - - /** - * 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 | COMPARE_UNORDERED_FLAG); - }; - } - - /** - * The base implementation of `_.merge` without support for multiple sources. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {number} srcIndex The index of `source`. - * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ - function baseMerge(object, source, srcIndex, customizer, stack) { - if (object === source) { - return; - } - baseFor(source, function(srcValue, key) { - stack || (stack = new Stack); - if (isObject(srcValue)) { - baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); - } - else { - var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; - - if (newValue === undefined) { - newValue = srcValue; - } - assignMergeValue(object, key, newValue); - } - }, keysIn); - } - - /** - * A specialized version of `baseMerge` for arrays and objects which performs - * deep merges and tracks traversed objects enabling objects with circular - * references to be merged. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {string} key The key of the value to merge. - * @param {number} srcIndex The index of `source`. - * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ - function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { - var objValue = safeGet(object, key), - srcValue = safeGet(source, key), - stacked = stack.get(srcValue); - - if (stacked) { - assignMergeValue(object, key, stacked); - return; - } - var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; - - var isCommon = newValue === undefined; - - if (isCommon) { - var isArr = isArray(srcValue), - isBuff = !isArr && isBuffer(srcValue), - isTyped = !isArr && !isBuff && isTypedArray(srcValue); - - newValue = srcValue; - if (isArr || isBuff || isTyped) { - if (isArray(objValue)) { - newValue = objValue; - } - else if (isArrayLikeObject(objValue)) { - newValue = copyArray(objValue); - } - else if (isBuff) { - isCommon = false; - newValue = cloneBuffer(srcValue, true); - } - else if (isTyped) { - isCommon = false; - newValue = cloneTypedArray(srcValue, true); - } - else { - newValue = []; - } - } - else if (isPlainObject(srcValue) || isArguments(srcValue)) { - newValue = objValue; - if (isArguments(objValue)) { - newValue = toPlainObject(objValue); - } - else if (!isObject(objValue) || isFunction(objValue)) { - newValue = initCloneObject(srcValue); - } - } - else { - isCommon = false; - } - } - if (isCommon) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, newValue); - mergeFunc(newValue, srcValue, srcIndex, customizer, stack); - stack['delete'](srcValue); - } - assignMergeValue(object, key, newValue); - } - - /** - * The base implementation of `_.nth` which doesn't coerce arguments. - * - * @private - * @param {Array} array The array to query. - * @param {number} n The index of the element to return. - * @returns {*} Returns the nth element of `array`. - */ - function baseNth(array, n) { - var length = array.length; - if (!length) { - return; - } - n += n < 0 ? length : 0; - return isIndex(n, length) ? array[n] : undefined; - } - - /** - * The base implementation of `_.orderBy` without param guards. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. - * @param {string[]} orders The sort orders of `iteratees`. - * @returns {Array} Returns the new sorted array. - */ - function baseOrderBy(collection, iteratees, orders) { - var index = -1; - iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee())); - - var result = baseMap(collection, function(value, key, collection) { - var criteria = arrayMap(iteratees, function(iteratee) { - return iteratee(value); - }); - return { 'criteria': criteria, 'index': ++index, 'value': value }; - }); - - return baseSortBy(result, function(object, other) { - return compareMultiple(object, other, orders); - }); - } - - /** - * The base implementation of `_.pick` without support for individual - * property identifiers. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @returns {Object} Returns the new object. - */ - function basePick(object, paths) { - return basePickBy(object, paths, function(value, path) { - return hasIn(object, path); - }); - } - - /** - * The base implementation of `_.pickBy` without support for iteratee shorthands. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @param {Function} predicate The function invoked per property. - * @returns {Object} Returns the new object. - */ - function basePickBy(object, paths, predicate) { - var index = -1, - length = paths.length, - result = {}; - - while (++index < length) { - var path = paths[index], - value = baseGet(object, path); - - if (predicate(value, path)) { - baseSet(result, castPath(path, object), value); - } - } - return result; - } - - /** - * 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); - }; - } - - /** - * The base implementation of `_.pullAllBy` without support for iteratee - * shorthands. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - */ - function basePullAll(array, values, iteratee, comparator) { - var indexOf = comparator ? baseIndexOfWith : baseIndexOf, - index = -1, - length = values.length, - seen = array; - - if (array === values) { - values = copyArray(values); - } - if (iteratee) { - seen = arrayMap(array, baseUnary(iteratee)); - } - while (++index < length) { - var fromIndex = 0, - value = values[index], - computed = iteratee ? iteratee(value) : value; - - while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { - if (seen !== array) { - splice.call(seen, fromIndex, 1); - } - splice.call(array, fromIndex, 1); - } - } - return array; - } - - /** - * The base implementation of `_.pullAt` without support for individual - * indexes or capturing the removed elements. - * - * @private - * @param {Array} array The array to modify. - * @param {number[]} indexes The indexes of elements to remove. - * @returns {Array} Returns `array`. - */ - function basePullAt(array, indexes) { - var length = array ? indexes.length : 0, - lastIndex = length - 1; - - while (length--) { - var index = indexes[length]; - if (length == lastIndex || index !== previous) { - var previous = index; - if (isIndex(index)) { - splice.call(array, index, 1); - } else { - baseUnset(array, index); - } - } - } - return array; - } - - /** - * The base implementation of `_.random` without support for returning - * floating-point numbers. - * - * @private - * @param {number} lower The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the random number. - */ - function baseRandom(lower, upper) { - return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); - } - - /** - * The base implementation of `_.range` and `_.rangeRight` which doesn't - * coerce arguments. - * - * @private - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @param {number} step The value to increment or decrement by. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the range of numbers. - */ - function baseRange(start, end, step, fromRight) { - var index = -1, - length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), - result = Array(length); - - while (length--) { - result[fromRight ? length : ++index] = start; - start += step; - } - return result; - } - - /** - * The base implementation of `_.repeat` which doesn't coerce arguments. - * - * @private - * @param {string} string The string to repeat. - * @param {number} n The number of times to repeat the string. - * @returns {string} Returns the repeated string. - */ - function baseRepeat(string, n) { - var result = ''; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { - return result; - } - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. - do { - if (n % 2) { - result += string; - } - n = nativeFloor(n / 2); - if (n) { - string += string; - } - } while (n); - - return result; - } - - /** - * 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 + ''); - } - - /** - * The base implementation of `_.sample`. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - */ - function baseSample(collection) { - return arraySample(values(collection)); - } - - /** - * The base implementation of `_.sampleSize` without param guards. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function baseSampleSize(collection, n) { - var array = values(collection); - return shuffleSelf(array, baseClamp(n, 0, array.length)); - } - - /** - * The base implementation of `_.set`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseSet(object, path, value, customizer) { - if (!isObject(object)) { - return object; - } - path = castPath(path, object); - - var index = -1, - length = path.length, - lastIndex = length - 1, - nested = object; - - while (nested != null && ++index < length) { - var key = toKey(path[index]), - newValue = value; - - if (index != lastIndex) { - var objValue = nested[key]; - newValue = customizer ? customizer(objValue, key, nested) : undefined; - if (newValue === undefined) { - newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); - } - } - assignValue(nested, key, newValue); - nested = nested[key]; - } - return object; - } - - /** - * The base implementation of `setData` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var baseSetData = !metaMap ? identity : function(func, data) { - metaMap.set(func, data); - return func; - }; - - /** - * 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 ? identity : function(func, string) { - return defineProperty(func, 'toString', { - 'configurable': true, - 'enumerable': false, - 'value': constant(string), - 'writable': true - }); - }; - - /** - * The base implementation of `_.shuffle`. - * - * @private - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - */ - function baseShuffle(collection) { - return shuffleSelf(values(collection)); - } - - /** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = end > length ? length : end; - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; - } - - /** - * The base implementation of `_.some` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection 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 baseSome(collection, predicate) { - var result; - - baseEach(collection, function(value, index, collection) { - result = predicate(value, index, collection); - return !result; - }); - return !!result; - } - - /** - * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which - * performs a binary search of `array` to determine the index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseSortedIndex(array, value, retHighest) { - var low = 0, - high = array == null ? low : array.length; - - if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { - while (low < high) { - var mid = (low + high) >>> 1, - computed = array[mid]; - - if (computed !== null && !isSymbol(computed) && - (retHighest ? (computed <= value) : (computed < value))) { - low = mid + 1; - } else { - high = mid; - } - } - return high; - } - return baseSortedIndexBy(array, value, identity, retHighest); - } - - /** - * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` - * which invokes `iteratee` for `value` and each element of `array` to compute - * their sort ranking. The iteratee is invoked with one argument; (value). - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} iteratee The iteratee invoked per element. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseSortedIndexBy(array, value, iteratee, retHighest) { - value = iteratee(value); - - var low = 0, - high = array == null ? 0 : array.length, - valIsNaN = value !== value, - valIsNull = value === null, - valIsSymbol = isSymbol(value), - valIsUndefined = value === undefined; - - while (low < high) { - var mid = nativeFloor((low + high) / 2), - computed = iteratee(array[mid]), - othIsDefined = computed !== undefined, - othIsNull = computed === null, - othIsReflexive = computed === computed, - othIsSymbol = isSymbol(computed); - - if (valIsNaN) { - var setLow = retHighest || othIsReflexive; - } else if (valIsUndefined) { - setLow = othIsReflexive && (retHighest || othIsDefined); - } else if (valIsNull) { - setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); - } else if (valIsSymbol) { - setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); - } else if (othIsNull || othIsSymbol) { - setLow = false; - } else { - setLow = retHighest ? (computed <= value) : (computed < value); - } - if (setLow) { - low = mid + 1; - } else { - high = mid; - } - } - return nativeMin(high, MAX_ARRAY_INDEX); - } - - /** - * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseSortedUniq(array, iteratee) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (!index || !eq(computed, seen)) { - var seen = computed; - result[resIndex++] = value === 0 ? 0 : value; - } - } - return result; - } - - /** - * The base implementation of `_.toNumber` which doesn't ensure correct - * conversions of binary, hexadecimal, or octal string values. - * - * @private - * @param {*} value The value to process. - * @returns {number} Returns the number. - */ - function baseToNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - return +value; - } - - /** - * 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; - } - - /** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.unset`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The property path to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - */ - function baseUnset(object, path) { - path = castPath(path, object); - object = parent(object, path); - return object == null || delete object[toKey(last(path))]; - } - - /** - * The base implementation of `_.update`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to update. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseUpdate(object, path, updater, customizer) { - return baseSet(object, path, updater(baseGet(object, path)), customizer); - } - - /** - * The base implementation of methods like `_.dropWhile` and `_.takeWhile` - * without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to query. - * @param {Function} predicate The function invoked per iteration. - * @param {boolean} [isDrop] Specify dropping elements instead of taking them. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the slice of `array`. - */ - function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, - index = fromRight ? length : -1; - - while ((fromRight ? index-- : ++index < length) && - predicate(array[index], index, array)) {} - - return isDrop - ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) - : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); - } - - /** - * The base implementation of `wrapperValue` which returns the result of - * performing a sequence of actions on the unwrapped `value`, where each - * successive action is supplied the return value of the previous. - * - * @private - * @param {*} value The unwrapped value. - * @param {Array} actions Actions to perform to resolve the unwrapped value. - * @returns {*} Returns the resolved value. - */ - function baseWrapperValue(value, actions) { - var result = value; - if (result instanceof LazyWrapper) { - result = result.value(); - } - return arrayReduce(actions, function(result, action) { - return action.func.apply(action.thisArg, arrayPush([result], action.args)); - }, result); - } - - /** - * The base implementation of methods like `_.xor`, without support for - * iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - */ - function baseXor(arrays, iteratee, comparator) { - var length = arrays.length; - if (length < 2) { - return length ? baseUniq(arrays[0]) : []; - } - var index = -1, - result = Array(length); - - while (++index < length) { - var array = arrays[index], - othIndex = -1; - - while (++othIndex < length) { - if (othIndex != index) { - result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); - } - } - } - return baseUniq(baseFlatten(result, 1), iteratee, comparator); - } - - /** - * This base implementation of `_.zipObject` which assigns values using `assignFunc`. - * - * @private - * @param {Array} props The property identifiers. - * @param {Array} values The property values. - * @param {Function} assignFunc The function to assign values. - * @returns {Object} Returns the new object. - */ - function baseZipObject(props, values, assignFunc) { - var index = -1, - length = props.length, - valsLength = values.length, - result = {}; - - while (++index < length) { - var value = index < valsLength ? values[index] : undefined; - assignFunc(result, props[index], value); - } - return result; - } - - /** - * Casts `value` to an empty array if it's not an array like object. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array|Object} Returns the cast array-like object. - */ - function castArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; - } - - /** - * Casts `value` to `identity` if it's not a function. - * - * @private - * @param {*} value The value to inspect. - * @returns {Function} Returns cast function. - */ - function castFunction(value) { - return typeof value == 'function' ? value : identity; - } - - /** - * 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)); - } - - /** - * A `baseRest` alias which can be replaced with `identity` by module - * replacement plugins. - * - * @private - * @type {Function} - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - var castRest = baseRest; - - /** - * Casts `array` to a slice if it's needed. - * - * @private - * @param {Array} array The array to inspect. - * @param {number} start The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the cast slice. - */ - function castSlice(array, start, end) { - var length = array.length; - end = end === undefined ? length : end; - return (!start && end >= length) ? array : baseSlice(array, start, end); - } - - /** - * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). - * - * @private - * @param {number|Object} id The timer id or timeout object of the timer to clear. - */ - var clearTimeout = ctxClearTimeout || function(id) { - return root.clearTimeout(id); - }; - - /** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ - function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var length = buffer.length, - result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - - buffer.copy(result); - return result; - } - - /** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ - function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; - } - - /** - * Creates a clone of `dataView`. - * - * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. - */ - function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); - } - - /** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ - function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; - } - - /** - * Creates a clone of the `symbol` object. - * - * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. - */ - function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; - } - - /** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ - function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); - } - - /** - * Compares values to sort them in ascending order. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {number} Returns the sort order indicator for `value`. - */ - function compareAscending(value, other) { - if (value !== other) { - var valIsDefined = value !== undefined, - valIsNull = value === null, - valIsReflexive = value === value, - valIsSymbol = isSymbol(value); - - var othIsDefined = other !== undefined, - othIsNull = other === null, - othIsReflexive = other === other, - othIsSymbol = isSymbol(other); - - if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || - (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || - (valIsNull && othIsDefined && othIsReflexive) || - (!valIsDefined && othIsReflexive) || - !valIsReflexive) { - return 1; - } - if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || - (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || - (othIsNull && valIsDefined && valIsReflexive) || - (!othIsDefined && valIsReflexive) || - !othIsReflexive) { - return -1; - } - } - return 0; - } - - /** - * Used by `_.orderBy` to compare multiple properties of a value to another - * and stable sort them. - * - * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, - * specify an order of "desc" for descending or "asc" for ascending sort order - * of corresponding values. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {boolean[]|string[]} orders The order to sort by for each property. - * @returns {number} Returns the sort order indicator for `object`. - */ - function compareMultiple(object, other, orders) { - var index = -1, - objCriteria = object.criteria, - othCriteria = other.criteria, - length = objCriteria.length, - ordersLength = orders.length; - - while (++index < length) { - var result = compareAscending(objCriteria[index], othCriteria[index]); - if (result) { - if (index >= ordersLength) { - return result; - } - var order = orders[index]; - return result * (order == 'desc' ? -1 : 1); - } - } - // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to provide the same value for - // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 - // for more details. - // - // This also ensures a stable sort in V8 and other engines. - // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. - return object.index - other.index; - } - - /** - * Creates an array that is the composition of partially applied arguments, - * placeholders, and provided arguments into a single array of arguments. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to prepend to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgs(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersLength = holders.length, - leftIndex = -1, - leftLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(leftLength + rangeLength), - isUncurried = !isCurried; - - while (++leftIndex < leftLength) { - result[leftIndex] = partials[leftIndex]; - } - while (++argsIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[holders[argsIndex]] = args[argsIndex]; - } - } - while (rangeLength--) { - result[leftIndex++] = args[argsIndex++]; - } - return result; - } - - /** - * This function is like `composeArgs` except that the arguments composition - * is tailored for `_.partialRight`. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to append to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgsRight(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersIndex = -1, - holdersLength = holders.length, - rightIndex = -1, - rightLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(rangeLength + rightLength), - isUncurried = !isCurried; - - while (++argsIndex < rangeLength) { - result[argsIndex] = args[argsIndex]; - } - var offset = argsIndex; - while (++rightIndex < rightLength) { - result[offset + rightIndex] = partials[rightIndex]; - } - while (++holdersIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[offset + holders[holdersIndex]] = args[argsIndex++]; - } - } - 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; - } - - /** - * 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; - } - - /** - * Copies own symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); - } - - /** - * Copies own and inherited symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbolsIn(source, object) { - return copyObject(source, getSymbolsIn(source), object); - } - - /** - * Creates a function like `_.groupBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} [initializer] The accumulator object initializer. - * @returns {Function} Returns the new aggregator function. - */ - function createAggregator(setter, initializer) { - return function(collection, iteratee) { - var func = isArray(collection) ? arrayAggregator : baseAggregator, - accumulator = initializer ? initializer() : {}; - - return func(collection, setter, getIteratee(iteratee, 2), accumulator); - }; - } - - /** - * 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; - }); - } - - /** - * 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; - }; - } - - /** - * 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; - }; - } - - /** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg`. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createBind(func, bitmask, thisArg) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return fn.apply(isBind ? thisArg : this, arguments); - } - return wrapper; - } - - /** - * Creates a function like `_.lowerFirst`. - * - * @private - * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new case function. - */ - function createCaseFirst(methodName) { - return function(string) { - string = toString(string); - - var strSymbols = hasUnicode(string) - ? stringToArray(string) - : undefined; - - var chr = strSymbols - ? strSymbols[0] - : string.charAt(0); - - var trailing = strSymbols - ? castSlice(strSymbols, 1).join('') - : string.slice(1); - - return chr[methodName]() + trailing; - }; - } - - /** - * Creates a function like `_.camelCase`. - * - * @private - * @param {Function} callback The function to combine each word. - * @returns {Function} Returns the new compounder function. - */ - function createCompounder(callback) { - return function(string) { - return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); - }; - } - - /** - * Creates a function that produces an instance of `Ctor` regardless of - * whether it was invoked as part of a `new` expression or by `call` or `apply`. - * - * @private - * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new wrapped function. - */ - function createCtor(Ctor) { - return function() { - // Use a `switch` statement to work with class constructors. See - // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist - // for more details. - var args = arguments; - switch (args.length) { - case 0: return new Ctor; - case 1: return new Ctor(args[0]); - case 2: return new Ctor(args[0], args[1]); - case 3: return new Ctor(args[0], args[1], args[2]); - case 4: return new Ctor(args[0], args[1], args[2], args[3]); - case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); - case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); - case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); - } - var thisBinding = baseCreate(Ctor.prototype), - result = Ctor.apply(thisBinding, args); - - // Mimic the constructor's `return` behavior. - // See https://es5.github.io/#x13.2.2 for more details. - return isObject(result) ? result : thisBinding; - }; - } - - /** - * Creates a function that wraps `func` to enable currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {number} arity The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createCurry(func, bitmask, arity) { - var Ctor = createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length, - placeholder = getHolder(wrapper); - - while (index--) { - args[index] = arguments[index]; - } - var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); - - length -= holders.length; - if (length < arity) { - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); - } - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return apply(fn, this, args); - } - return wrapper; - } - - /** - * Creates a `_.find` or `_.findLast` function. - * - * @private - * @param {Function} findIndexFunc The function to find the collection index. - * @returns {Function} Returns the new find function. - */ - function createFind(findIndexFunc) { - return function(collection, predicate, fromIndex) { - var iterable = Object(collection); - if (!isArrayLike(collection)) { - var iteratee = getIteratee(predicate, 3); - collection = keys(collection); - predicate = function(key) { return iteratee(iterable[key], key, iterable); }; - } - var index = findIndexFunc(collection, predicate, fromIndex); - return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; - }; - } - - /** - * Creates a `_.flow` or `_.flowRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new flow function. - */ - function createFlow(fromRight) { - return flatRest(function(funcs) { - var length = funcs.length, - index = length, - prereq = LodashWrapper.prototype.thru; - - if (fromRight) { - funcs.reverse(); - } - while (index--) { - var func = funcs[index]; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (prereq && !wrapper && getFuncName(func) == 'wrapper') { - var wrapper = new LodashWrapper([], true); - } - } - index = wrapper ? index : length; - while (++index < length) { - func = funcs[index]; - - var funcName = getFuncName(func), - data = funcName == 'wrapper' ? getData(func) : undefined; - - if (data && isLaziable(data[0]) && - data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && - !data[4].length && data[9] == 1 - ) { - wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); - } else { - wrapper = (func.length == 1 && isLaziable(func)) - ? wrapper[funcName]() - : wrapper.thru(func); - } - } - return function() { - var args = arguments, - value = args[0]; - - if (wrapper && args.length == 1 && isArray(value)) { - return wrapper.plant(value).value(); - } - var index = 0, - result = length ? funcs[index].apply(this, args) : value; - - while (++index < length) { - result = funcs[index].call(this, result); - } - return result; - }; - }); - } - - /** - * Creates a function that wraps `func` to invoke it with optional `this` - * binding of `thisArg`, partial application, and currying. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [partialsRight] The arguments to append to those provided - * to the new function. - * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { - var isAry = bitmask & WRAP_ARY_FLAG, - isBind = bitmask & WRAP_BIND_FLAG, - isBindKey = bitmask & WRAP_BIND_KEY_FLAG, - isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), - isFlip = bitmask & WRAP_FLIP_FLAG, - Ctor = isBindKey ? undefined : createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length; - - while (index--) { - args[index] = arguments[index]; - } - if (isCurried) { - var placeholder = getHolder(wrapper), - holdersCount = countHolders(args, placeholder); - } - if (partials) { - args = composeArgs(args, partials, holders, isCurried); - } - if (partialsRight) { - args = composeArgsRight(args, partialsRight, holdersRight, isCurried); - } - length -= holdersCount; - if (isCurried && length < arity) { - var newHolders = replaceHolders(args, placeholder); - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length - ); - } - var thisBinding = isBind ? thisArg : this, - fn = isBindKey ? thisBinding[func] : func; - - length = args.length; - if (argPos) { - args = reorder(args, argPos); - } else if (isFlip && length > 1) { - args.reverse(); - } - if (isAry && ary < length) { - args.length = ary; - } - if (this && this !== root && this instanceof wrapper) { - fn = Ctor || createCtor(fn); - } - return fn.apply(thisBinding, args); - } - return wrapper; - } - - /** - * Creates a function like `_.invertBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} toIteratee The function to resolve iteratees. - * @returns {Function} Returns the new inverter function. - */ - function createInverter(setter, toIteratee) { - return function(object, iteratee) { - return baseInverter(object, setter, toIteratee(iteratee), {}); - }; - } - - /** - * Creates a function that performs a mathematical operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @param {number} [defaultValue] The value used for `undefined` arguments. - * @returns {Function} Returns the new mathematical operation function. - */ - function createMathOperation(operator, defaultValue) { - return function(value, other) { - var result; - if (value === undefined && other === undefined) { - return defaultValue; - } - if (value !== undefined) { - result = value; - } - if (other !== undefined) { - if (result === undefined) { - return other; - } - if (typeof value == 'string' || typeof other == 'string') { - value = baseToString(value); - other = baseToString(other); - } else { - value = baseToNumber(value); - other = baseToNumber(other); - } - result = operator(value, other); - } - return result; - }; - } - - /** - * Creates a function like `_.over`. - * - * @private - * @param {Function} arrayFunc The function to iterate over iteratees. - * @returns {Function} Returns the new over function. - */ - function createOver(arrayFunc) { - return flatRest(function(iteratees) { - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - return baseRest(function(args) { - var thisArg = this; - return arrayFunc(iteratees, function(iteratee) { - return apply(iteratee, thisArg, args); - }); - }); - }); - } - - /** - * Creates the padding for `string` based on `length`. The `chars` string - * is truncated if the number of characters exceeds `length`. - * - * @private - * @param {number} length The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padding for `string`. - */ - function createPadding(length, chars) { - chars = chars === undefined ? ' ' : baseToString(chars); - - var charsLength = chars.length; - if (charsLength < 2) { - return charsLength ? baseRepeat(chars, length) : chars; - } - var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); - return hasUnicode(chars) - ? castSlice(stringToArray(result), 0, length).join('') - : result.slice(0, length); - } - - /** - * Creates a function that wraps `func` to invoke it with the `this` binding - * of `thisArg` and `partials` prepended to the arguments it receives. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to - * the new function. - * @returns {Function} Returns the new wrapped function. - */ - function createPartial(func, bitmask, thisArg, partials) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var argsIndex = -1, - argsLength = arguments.length, - leftIndex = -1, - leftLength = partials.length, - args = Array(leftLength + argsLength), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - - while (++leftIndex < leftLength) { - args[leftIndex] = partials[leftIndex]; - } - while (argsLength--) { - args[leftIndex++] = arguments[++argsIndex]; - } - return apply(fn, isBind ? thisArg : this, args); - } - return wrapper; - } - - /** - * Creates a `_.range` or `_.rangeRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new range function. - */ - function createRange(fromRight) { - return function(start, end, step) { - if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { - end = step = undefined; - } - // Ensure the sign of `-0` is preserved. - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); - return baseRange(start, end, step, fromRight); - }; - } - - /** - * Creates a function that performs a relational operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @returns {Function} Returns the new relational operation function. - */ - function createRelationalOperation(operator) { - return function(value, other) { - if (!(typeof value == 'string' && typeof other == 'string')) { - value = toNumber(value); - other = toNumber(other); - } - return operator(value, other); - }; - } - - /** - * Creates a function that wraps `func` to continue currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {Function} wrapFunc The function to create the `func` wrapper. - * @param {*} placeholder The placeholder value. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { - var isCurry = bitmask & WRAP_CURRY_FLAG, - newHolders = isCurry ? holders : undefined, - newHoldersRight = isCurry ? undefined : holders, - newPartials = isCurry ? partials : undefined, - newPartialsRight = isCurry ? undefined : partials; - - bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); - bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); - - if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { - bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); - } - var newData = [ - func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, - newHoldersRight, argPos, ary, arity - ]; - - var result = wrapFunc.apply(undefined, newData); - if (isLaziable(func)) { - setData(result, newData); - } - result.placeholder = placeholder; - return setWrapToString(result, func, bitmask); - } - - /** - * Creates a function like `_.round`. - * - * @private - * @param {string} methodName The name of the `Math` method to use when rounding. - * @returns {Function} Returns the new round function. - */ - function createRound(methodName) { - var func = Math[methodName]; - return function(number, precision) { - number = toNumber(number); - precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); - if (precision && nativeIsFinite(number)) { - // Shift with exponential notation to avoid floating-point issues. - // See [MDN](https://mdn.io/round#Examples) for more details. - var pair = (toString(number) + 'e').split('e'), - value = func(pair[0] + 'e' + (+pair[1] + precision)); - - pair = (toString(value) + 'e').split('e'); - return +(pair[0] + 'e' + (+pair[1] - precision)); - } - return func(number); - }; - } - - /** - * Creates a set object of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ - var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { - return new Set(values); - }; - - /** - * Creates a `_.toPairs` or `_.toPairsIn` function. - * - * @private - * @param {Function} keysFunc The function to get the keys of a given object. - * @returns {Function} Returns the new pairs function. - */ - function createToPairs(keysFunc) { - return function(object) { - var tag = getTag(object); - if (tag == mapTag) { - return mapToArray(object); - } - if (tag == setTag) { - return setToPairs(object); - } - return baseToPairs(object, keysFunc(object)); - }; - } - - /** - * Creates a function that either curries or invokes `func` with optional - * `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` or `_.curryRight` of a bound function - * 8 - `_.curry` - * 16 - `_.curryRight` - * 32 - `_.partial` - * 64 - `_.partialRight` - * 128 - `_.rearg` - * 256 - `_.ary` - * 512 - `_.flip` - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to be partially applied. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { - var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; - if (!isBindKey && typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - var length = partials ? partials.length : 0; - if (!length) { - bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); - partials = holders = undefined; - } - ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); - arity = arity === undefined ? arity : toInteger(arity); - length -= holders ? holders.length : 0; - - if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { - var partialsRight = partials, - holdersRight = holders; - - partials = holders = undefined; - } - var data = isBindKey ? undefined : getData(func); - - var newData = [ - func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, - argPos, ary, arity - ]; - - if (data) { - mergeData(newData, data); - } - func = newData[0]; - bitmask = newData[1]; - thisArg = newData[2]; - partials = newData[3]; - holders = newData[4]; - arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); - - if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { - bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); - } - if (!bitmask || bitmask == WRAP_BIND_FLAG) { - var result = createBind(func, bitmask, thisArg); - } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { - result = createCurry(func, bitmask, arity); - } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { - result = createPartial(func, bitmask, thisArg, partials); - } else { - result = createHybrid.apply(undefined, newData); - } - var setter = data ? baseSetData : setData; - return setWrapToString(setter(result, newData), func, bitmask); - } - - /** - * Used by `_.defaults` to customize its `_.assignIn` use to assign properties - * of source objects to the destination object for all destination properties - * that resolve to `undefined`. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to assign. - * @param {Object} object The parent object of `objValue`. - * @returns {*} Returns the value to assign. - */ - function customDefaultsAssignIn(objValue, srcValue, key, object) { - if (objValue === undefined || - (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { - return srcValue; - } - return objValue; - } - - /** - * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source - * objects into destination objects that are passed thru. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to merge. - * @param {Object} object The parent object of `objValue`. - * @param {Object} source The parent object of `srcValue`. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - * @returns {*} Returns the value to assign. - */ - function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { - if (isObject(objValue) && isObject(srcValue)) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); - stack['delete'](srcValue); - } - return objValue; - } - - /** - * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain - * objects. - * - * @private - * @param {*} value The value to inspect. - * @param {string} key The key of the property to inspect. - * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. - */ - function customOmitClone(value) { - return isPlainObject(value) ? undefined : value; - } - - /** - * 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, - 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) ? 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; - } - - /** - * 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: - if ((object.byteLength != other.byteLength) || - (object.byteOffset != other.byteOffset)) { - return false; - } - object = object.buffer; - other = other.buffer; - - case arrayBufferTag: - if ((object.byteLength != other.byteLength) || - !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; - - case boolTag: - case dateTag: - case numberTag: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag: - return object.name == other.name && object.message == other.message; - - case regexpTag: - case stringTag: - // 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: - var convert = mapToArray; - - case setTag: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG; - 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; - - // 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: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; - } - - /** - * 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, - 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.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; - } - - /** - * A specialized version of `baseRest` which flattens the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - function flatRest(func) { - return setToString(overRest(func, undefined, flatten), func + ''); - } - - /** - * 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); - } - - /** - * Creates an array of own and inherited 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 getAllKeysIn(object) { - return baseGetAllKeys(object, keysIn, getSymbolsIn); - } - - /** - * Gets metadata for `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {*} Returns the metadata for `func`. - */ - var getData = !metaMap ? noop : function(func) { - return metaMap.get(func); - }; - - /** - * Gets the name of `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {string} Returns the function name. - */ - function getFuncName(func) { - var result = (func.name + ''), - array = realNames[result], - length = hasOwnProperty.call(realNames, result) ? array.length : 0; - - while (length--) { - var data = array[length], - otherFunc = data.func; - if (otherFunc == null || otherFunc == func) { - return data.name; - } - } - return result; - } - - /** - * Gets the argument placeholder value for `func`. - * - * @private - * @param {Function} func The function to inspect. - * @returns {*} Returns the placeholder value. - */ - function getHolder(func) { - var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; - return object.placeholder; - } - - /** - * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, - * this function returns the custom method, otherwise it returns `baseIteratee`. - * If arguments are provided, the chosen function is invoked with them and - * its result is returned. - * - * @private - * @param {*} [value] The value to convert to an iteratee. - * @param {number} [arity] The arity of the created iteratee. - * @returns {Function} Returns the chosen function or its result. - */ - function getIteratee() { - var result = lodash.iteratee || iteratee; - result = result === iteratee ? baseIteratee : result; - return arguments.length ? result(arguments[0], arguments[1]) : result; - } - - /** - * 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; - } - - /** - * 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; - } - - /** - * 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; - } - - /** - * 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), - tag = value[symToStringTag]; - - try { - value[symToStringTag] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; - } - - /** - * 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.call(object, symbol); - }); - }; - - /** - * Creates an array of the own and inherited enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { - var result = []; - while (object) { - arrayPush(result, getSymbols(object)); - object = getPrototype(object); - } - return result; - }; - - /** - * 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) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = baseGetTag(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; - } - - /** - * Gets the view, applying any `transforms` to the `start` and `end` positions. - * - * @private - * @param {number} start The start of the view. - * @param {number} end The end of the view. - * @param {Array} transforms The transformations to apply to the view. - * @returns {Object} Returns an object containing the `start` and `end` - * positions of the view. - */ - function getView(start, end, transforms) { - var index = -1, - length = transforms.length; - - while (++index < length) { - var data = transforms[index], - size = data.size; - - switch (data.type) { - case 'drop': start += size; break; - case 'dropRight': end -= size; break; - case 'take': end = nativeMin(end, start + size); break; - case 'takeRight': start = nativeMax(start, end - size); break; - } - } - return { 'start': start, 'end': end }; - } - - /** - * Extracts wrapper details from the `source` body comment. - * - * @private - * @param {string} source The source to inspect. - * @returns {Array} Returns the wrapper details. - */ - function getWrapDetails(source) { - var match = source.match(reWrapDetails); - return match ? match[1].split(reSplitDetails) : []; - } - - /** - * 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)); - } - - /** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ - function initCloneArray(array) { - var length = array.length, - result = new array.constructor(length); - - // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; - } - - /** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; - } - - /** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); - - case boolTag: - case dateTag: - return new Ctor(+object); - - case dataViewTag: - return cloneDataView(object, isDeep); - - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - return cloneTypedArray(object, isDeep); - - case mapTag: - return new Ctor; - - case numberTag: - case stringTag: - return new Ctor(object); - - case regexpTag: - return cloneRegExp(object); - - case setTag: - return new Ctor; - - case symbolTag: - return cloneSymbol(object); - } - } - - /** - * Inserts wrapper `details` in a comment at the top of the `source` body. - * - * @private - * @param {string} source The source to modify. - * @returns {Array} details The details to insert. - * @returns {string} Returns the modified source. - */ - function insertWrapDetails(source, details) { - var length = details.length; - if (!length) { - return source; - } - var lastIndex = length - 1; - details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; - details = details.join(length > 2 ? ', ' : ' '); - return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); - } - - /** - * 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]); - } - - /** - * 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) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER : length; - - return !!length && - (type == 'number' || - (type != 'symbol' && 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(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; - } - - /** - * 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)); - } - - /** - * 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); - } - - /** - * Checks if `func` has a lazy counterpart. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` has a lazy counterpart, - * else `false`. - */ - function isLaziable(func) { - var funcName = getFuncName(func), - other = lodash[funcName]; - - if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { - return false; - } - if (func === other) { - return true; - } - var data = getData(other); - return !!data && func === data[0]; - } - - /** - * 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); - } - - /** - * Checks if `func` is capable of being masked. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `func` is maskable, else `false`. - */ - var isMaskable = coreJsData ? isFunction : stubFalse; - - /** - * 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; - - return value === proto; - } - - /** - * 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(value); - } - - /** - * 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))); - }; - } - - /** - * 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; - } - - /** - * Merges the function metadata of `source` into `data`. - * - * Merging metadata reduces the number of wrappers used to invoke a function. - * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` - * may be applied regardless of execution order. Methods like `_.ary` and - * `_.rearg` modify function arguments, making the order in which they are - * executed important, preventing the merging of metadata. However, we make - * an exception for a safe combined case where curried functions have `_.ary` - * and or `_.rearg` applied. - * - * @private - * @param {Array} data The destination metadata. - * @param {Array} source The source metadata. - * @returns {Array} Returns `data`. - */ - function mergeData(data, source) { - var bitmask = data[1], - srcBitmask = source[1], - newBitmask = bitmask | srcBitmask, - isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); - - var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); - - // Exit early if metadata can't be merged. - if (!(isCommon || isCombo)) { - return data; - } - // Use source `thisArg` if available. - if (srcBitmask & WRAP_BIND_FLAG) { - data[2] = source[2]; - // Set when currying a bound function. - newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; - } - // Compose partial arguments. - var value = source[3]; - if (value) { - var partials = data[3]; - data[3] = partials ? composeArgs(partials, value, source[4]) : value; - data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; - } - // Compose partial right arguments. - value = source[5]; - if (value) { - partials = data[5]; - data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; - data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; - } - // Use source `argPos` if available. - value = source[7]; - if (value) { - data[7] = value; - } - // Use source `ary` if it's smaller. - if (srcBitmask & WRAP_ARY_FLAG) { - data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); - } - // Use source `arity` if one is not provided. - if (data[9] == null) { - data[9] = source[9]; - } - // Use source `func` and merge bitmasks. - data[0] = source[0]; - data[1] = newBitmask; - - return data; - } - - /** - * 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; - } - - /** - * 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.call(value); - } - - /** - * 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); - }; - } - - /** - * Gets the parent value at `path` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} path The path to get the parent value of. - * @returns {*} Returns the parent value. - */ - function parent(object, path) { - return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); - } - - /** - * Reorder `array` according to the specified indexes where the element at - * the first index is assigned as the first element, the element at - * the second index is assigned as the second element, and so on. - * - * @private - * @param {Array} array The array to reorder. - * @param {Array} indexes The arranged array indexes. - * @returns {Array} Returns `array`. - */ - function reorder(array, indexes) { - var arrLength = array.length, - length = nativeMin(indexes.length, arrLength), - oldArray = copyArray(array); - - while (length--) { - var index = indexes[length]; - array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; - } - return array; - } - - /** - * Gets the value at `key`, unless `key` is "__proto__" or "constructor". - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function safeGet(object, key) { - if (key === 'constructor' && typeof object[key] === 'function') { - return; - } - - if (key == '__proto__') { - return; - } - - return object[key]; - } - - /** - * Sets metadata for `func`. - * - * **Note:** If this function becomes hot, i.e. is invoked a lot in a short - * period of time, it will trip its breaker and transition to an identity - * function to avoid garbage collection pauses in V8. See - * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) - * for more details. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var setData = shortOut(baseSetData); - - /** - * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @returns {number|Object} Returns the timer id or timeout object. - */ - var setTimeout = ctxSetTimeout || function(func, wait) { - return root.setTimeout(func, wait); - }; - - /** - * 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); - - /** - * Sets the `toString` method of `wrapper` to mimic the source of `reference` - * with wrapper details in a comment at the top of the source body. - * - * @private - * @param {Function} wrapper The function to modify. - * @param {Function} reference The reference function. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Function} Returns `wrapper`. - */ - function setWrapToString(wrapper, reference, bitmask) { - var source = (reference + ''); - return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); - } - - /** - * 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); - }; - } - - /** - * A specialized version of `_.shuffle` which mutates and sets the size of `array`. - * - * @private - * @param {Array} array The array to shuffle. - * @param {number} [size=array.length] The size of `array`. - * @returns {Array} Returns `array`. - */ - function shuffleSelf(array, size) { - var index = -1, - length = array.length, - lastIndex = length - 1; - - size = size === undefined ? length : size; - while (++index < size) { - var rand = baseRandom(index, lastIndex), - value = array[rand]; - - array[rand] = array[index]; - array[index] = value; - } - array.length = size; - return array; - } - - /** - * 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 (string.charCodeAt(0) === 46 /* . */) { - result.push(''); - } - string.replace(rePropName, function(match, number, quote, subString) { - result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; - }); - - /** - * 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) ? '-0' : result; - } - - /** - * 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.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; - } - - /** - * Updates wrapper `details` based on `bitmask` flags. - * - * @private - * @returns {Array} details The details to modify. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Array} Returns `details`. - */ - function updateWrapDetails(details, bitmask) { - arrayEach(wrapFlags, function(pair) { - var value = '_.' + pair[0]; - if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { - details.push(value); - } - }); - return details.sort(); - } - - /** - * Creates a clone of `wrapper`. - * - * @private - * @param {Object} wrapper The wrapper to clone. - * @returns {Object} Returns the cloned wrapper. - */ - function wrapperClone(wrapper) { - if (wrapper instanceof LazyWrapper) { - return wrapper.clone(); - } - var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); - result.__actions__ = copyArray(wrapper.__actions__); - result.__index__ = wrapper.__index__; - result.__values__ = wrapper.__values__; - return result; - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array of elements split into groups the length of `size`. - * If `array` can't be split evenly, the final chunk will be the remaining - * elements. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to process. - * @param {number} [size=1] The length of each chunk - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the new array of chunks. - * @example - * - * _.chunk(['a', 'b', 'c', 'd'], 2); - * // => [['a', 'b'], ['c', 'd']] - * - * _.chunk(['a', 'b', 'c', 'd'], 3); - * // => [['a', 'b', 'c'], ['d']] - */ - function chunk(array, size, guard) { - if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { - size = 1; - } else { - size = nativeMax(toInteger(size), 0); - } - var length = array == null ? 0 : array.length; - if (!length || size < 1) { - return []; - } - var index = 0, - resIndex = 0, - result = Array(nativeCeil(length / size)); - - while (index < length) { - result[resIndex++] = baseSlice(array, index, (index += size)); - } - return result; - } - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are falsey. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to compact. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * 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)); - } - - /** - * Creates an array of `array` values not included in the other given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * **Note:** Unlike `_.pullAll`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.without, _.xor - * @example - * - * _.difference([2, 1], [2, 3]); - * // => [1] - */ - var difference = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `iteratee` which - * is invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * **Note:** Unlike `_.pullAllBy`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2] - * - * // The `_.property` iteratee shorthand. - * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var differenceBy = baseRest(function(array, values) { - var iteratee = last(values); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. The order and - * references of result values are determined by the first array. The comparator - * is invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.pullAllWith`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * - * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); - * // => [{ 'x': 2, 'y': 1 }] - */ - var differenceWith = baseRest(function(array, values) { - var comparator = last(values); - if (isArrayLikeObject(comparator)) { - comparator = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) - : []; - }); - - /** - * Creates a slice of `array` with `n` elements dropped from the beginning. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.drop([1, 2, 3]); - * // => [2, 3] - * - * _.drop([1, 2, 3], 2); - * // => [3] - * - * _.drop([1, 2, 3], 5); - * // => [] - * - * _.drop([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function drop(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, n < 0 ? 0 : n, length); - } - - /** - * Creates a slice of `array` with `n` elements dropped from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.dropRight([1, 2, 3]); - * // => [1, 2] - * - * _.dropRight([1, 2, 3], 2); - * // => [1] - * - * _.dropRight([1, 2, 3], 5); - * // => [] - * - * _.dropRight([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function dropRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` excluding elements dropped from the end. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.dropRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney'] - * - * // The `_.matches` iteratee shorthand. - * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropRightWhile(users, ['active', false]); - * // => objects for ['barney'] - * - * // The `_.property` iteratee shorthand. - * _.dropRightWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ - function dropRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true, true) - : []; - } - - /** - * Creates a slice of `array` excluding elements dropped from the beginning. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.dropWhile(users, function(o) { return !o.active; }); - * // => objects for ['pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.dropWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropWhile(users, ['active', false]); - * // => objects for ['pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.dropWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ - function dropWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true) - : []; - } - - /** - * Fills elements of `array` with `value` from `start` up to, but not - * including, `end`. - * - * **Note:** This method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Array - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.fill(array, 'a'); - * console.log(array); - * // => ['a', 'a', 'a'] - * - * _.fill(Array(3), 2); - * // => [2, 2, 2] - * - * _.fill([4, 6, 8, 10], '*', 1, 3); - * // => [4, '*', '*', 10] - */ - function fill(array, value, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { - start = 0; - end = length; - } - return baseFill(array, value, start, end); - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.findIndex(users, function(o) { return o.user == 'barney'; }); - * // => 0 - * - * // The `_.matches` iteratee shorthand. - * _.findIndex(users, { 'user': 'fred', 'active': false }); - * // => 1 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findIndex(users, ['active', false]); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.findIndex(users, 'active'); - * // => 2 - */ - function findIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseFindIndex(array, getIteratee(predicate, 3), index); - } - - /** - * This method is like `_.findIndex` except that it iterates over elements - * of `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); - * // => 2 - * - * // The `_.matches` iteratee shorthand. - * _.findLastIndex(users, { 'user': 'barney', 'active': true }); - * // => 0 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastIndex(users, ['active', false]); - * // => 2 - * - * // The `_.property` iteratee shorthand. - * _.findLastIndex(users, 'active'); - * // => 0 - */ - function findLastIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length - 1; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); - } - return baseFindIndex(array, getIteratee(predicate, 3), index, true); - } - - /** - * Flattens `array` a single level deep. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flatten([1, [2, [3, [4]], 5]]); - * // => [1, 2, [3, [4]], 5] - */ - function flatten(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, 1) : []; - } - - /** - * Recursively flattens `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flattenDeep([1, [2, [3, [4]], 5]]); - * // => [1, 2, 3, 4, 5] - */ - function flattenDeep(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, INFINITY) : []; - } - - /** - * Recursively flatten `array` up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Array - * @param {Array} array The array to flatten. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * var array = [1, [2, [3, [4]], 5]]; - * - * _.flattenDepth(array, 1); - * // => [1, 2, [3, [4]], 5] - * - * _.flattenDepth(array, 2); - * // => [1, 2, 3, [4], 5] - */ - function flattenDepth(array, depth) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(array, depth); - } - - /** - * The inverse of `_.toPairs`; this method returns an object composed - * from key-value `pairs`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} pairs The key-value pairs. - * @returns {Object} Returns the new object. - * @example - * - * _.fromPairs([['a', 1], ['b', 2]]); - * // => { 'a': 1, 'b': 2 } - */ - function fromPairs(pairs) { - var index = -1, - length = pairs == null ? 0 : pairs.length, - result = {}; - - while (++index < length) { - var pair = pairs[index]; - result[pair[0]] = pair[1]; - } - return result; - } - - /** - * Gets the first element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias first - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the first element of `array`. - * @example - * - * _.head([1, 2, 3]); - * // => 1 - * - * _.head([]); - * // => undefined - */ - function head(array) { - return (array && array.length) ? array[0] : undefined; - } - - /** - * Gets the index at which the first occurrence of `value` is found in `array` - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the - * offset from the end of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.indexOf([1, 2, 1, 2], 2); - * // => 1 - * - * // Search from the `fromIndex`. - * _.indexOf([1, 2, 1, 2], 2, 2); - * // => 3 - */ - function indexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseIndexOf(array, value, index); - } - - /** - * Gets all but the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - */ - function initial(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 0, -1) : []; - } - - /** - * Creates an array of unique values that are included in all given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersection([2, 1], [2, 3]); - * // => [2] - */ - var intersection = baseRest(function(arrays) { - var mapped = arrayMap(arrays, castArrayLikeObject); - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `iteratee` - * which is invoked for each element of each `arrays` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [2.1] - * - * // The `_.property` iteratee shorthand. - * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }] - */ - var intersectionBy = baseRest(function(arrays) { - var iteratee = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - if (iteratee === last(mapped)) { - iteratee = undefined; - } else { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, getIteratee(iteratee, 2)) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. The order and references - * of result values are determined by the first array. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.intersectionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }] - */ - var intersectionWith = baseRest(function(arrays) { - var comparator = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - comparator = typeof comparator == 'function' ? comparator : undefined; - if (comparator) { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, undefined, comparator) - : []; - }); - - /** - * Converts all elements in `array` into a string separated by `separator`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to convert. - * @param {string} [separator=','] The element separator. - * @returns {string} Returns the joined string. - * @example - * - * _.join(['a', 'b', 'c'], '~'); - * // => 'a~b~c' - */ - function join(array, separator) { - return array == null ? '' : nativeJoin.call(array, separator); - } - - /** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ - function last(array) { - var length = array == null ? 0 : array.length; - return length ? array[length - 1] : undefined; - } - - /** - * This method is like `_.indexOf` except that it iterates over elements of - * `array` from right to left. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.lastIndexOf([1, 2, 1, 2], 2); - * // => 3 - * - * // Search from the `fromIndex`. - * _.lastIndexOf([1, 2, 1, 2], 2, 2); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); - } - return value === value - ? strictLastIndexOf(array, value, index) - : baseFindIndex(array, baseIsNaN, index, true); - } - - /** - * Gets the element at index `n` of `array`. If `n` is negative, the nth - * element from the end is returned. - * - * @static - * @memberOf _ - * @since 4.11.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=0] The index of the element to return. - * @returns {*} Returns the nth element of `array`. - * @example - * - * var array = ['a', 'b', 'c', 'd']; - * - * _.nth(array, 1); - * // => 'b' - * - * _.nth(array, -2); - * // => 'c'; - */ - function nth(array, n) { - return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; - } - - /** - * Removes all given values from `array` using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` - * to remove elements from an array by predicate. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...*} [values] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pull(array, 'a', 'c'); - * console.log(array); - * // => ['b', 'b'] - */ - var pull = baseRest(pullAll); - - /** - * This method is like `_.pull` except that it accepts an array of values to remove. - * - * **Note:** Unlike `_.difference`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pullAll(array, ['a', 'c']); - * console.log(array); - * // => ['b', 'b'] - */ - function pullAll(array, values) { - return (array && array.length && values && values.length) - ? basePullAll(array, values) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `iteratee` which is - * invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The iteratee is invoked with one argument: (value). - * - * **Note:** Unlike `_.differenceBy`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; - * - * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); - * console.log(array); - * // => [{ 'x': 2 }] - */ - function pullAllBy(array, values, iteratee) { - return (array && array.length && values && values.length) - ? basePullAll(array, values, getIteratee(iteratee, 2)) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `comparator` which - * is invoked to compare elements of `array` to `values`. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.differenceWith`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; - * - * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); - * console.log(array); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] - */ - function pullAllWith(array, values, comparator) { - return (array && array.length && values && values.length) - ? basePullAll(array, values, undefined, comparator) - : array; - } - - /** - * Removes elements from `array` corresponding to `indexes` and returns an - * array of removed elements. - * - * **Note:** Unlike `_.at`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...(number|number[])} [indexes] The indexes of elements to remove. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = ['a', 'b', 'c', 'd']; - * var pulled = _.pullAt(array, [1, 3]); - * - * console.log(array); - * // => ['a', 'c'] - * - * console.log(pulled); - * // => ['b', 'd'] - */ - var pullAt = flatRest(function(array, indexes) { - var length = array == null ? 0 : array.length, - result = baseAt(array, indexes); - - basePullAt(array, arrayMap(indexes, function(index) { - return isIndex(index, length) ? +index : index; - }).sort(compareAscending)); - - return result; - }); - - /** - * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is invoked - * with three arguments: (value, index, array). - * - * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` - * to pull elements from an array by value. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4]; - * var evens = _.remove(array, function(n) { - * return n % 2 == 0; - * }); - * - * console.log(array); - * // => [1, 3] - * - * console.log(evens); - * // => [2, 4] - */ - function remove(array, predicate) { - var result = []; - if (!(array && array.length)) { - return result; - } - var index = -1, - indexes = [], - length = array.length; - - predicate = getIteratee(predicate, 3); - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result.push(value); - indexes.push(index); - } - } - basePullAt(array, indexes); - return result; - } - - /** - * Reverses `array` so that the first element becomes the last, the second - * element becomes the second to last, and so on. - * - * **Note:** This method mutates `array` and is based on - * [`Array#reverse`](https://mdn.io/Array/reverse). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.reverse(array); - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function reverse(array) { - return array == null ? array : nativeReverse.call(array); - } - - /** - * Creates a slice of `array` from `start` up to, but not including, `end`. - * - * **Note:** This method is used instead of - * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are - * returned. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function slice(array, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { - start = 0; - end = length; - } - else { - start = start == null ? 0 : toInteger(start); - end = end === undefined ? length : toInteger(end); - } - return baseSlice(array, start, end); - } - - /** - * Uses a binary search to determine the lowest index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedIndex([30, 50], 40); - * // => 1 - */ - function sortedIndex(array, value) { - return baseSortedIndex(array, value); - } - - /** - * This method is like `_.sortedIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); - * // => 0 - */ - function sortedIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); - } - - /** - * This method is like `_.indexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedIndexOf([4, 5, 5, 5, 6], 5); - * // => 1 - */ - function sortedIndexOf(array, value) { - var length = array == null ? 0 : array.length; - if (length) { - var index = baseSortedIndex(array, value); - if (index < length && eq(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.sortedIndex` except that it returns the highest - * index at which `value` should be inserted into `array` in order to - * maintain its sort order. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedLastIndex([4, 5, 5, 5, 6], 5); - * // => 4 - */ - function sortedLastIndex(array, value) { - return baseSortedIndex(array, value, true); - } - - /** - * This method is like `_.sortedLastIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 1 - * - * // The `_.property` iteratee shorthand. - * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); - * // => 1 - */ - function sortedLastIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); - } - - /** - * This method is like `_.lastIndexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); - * // => 3 - */ - function sortedLastIndexOf(array, value) { - var length = array == null ? 0 : array.length; - if (length) { - var index = baseSortedIndex(array, value, true) - 1; - if (eq(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.uniq` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniq([1, 1, 2]); - * // => [1, 2] - */ - function sortedUniq(array) { - return (array && array.length) - ? baseSortedUniq(array) - : []; - } - - /** - * This method is like `_.uniqBy` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); - * // => [1.1, 2.3] - */ - function sortedUniqBy(array, iteratee) { - return (array && array.length) - ? baseSortedUniq(array, getIteratee(iteratee, 2)) - : []; - } - - /** - * Gets all but the first element of `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.tail([1, 2, 3]); - * // => [2, 3] - */ - function tail(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 1, length) : []; - } - - /** - * Creates a slice of `array` with `n` elements taken from the beginning. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.take([1, 2, 3]); - * // => [1] - * - * _.take([1, 2, 3], 2); - * // => [1, 2] - * - * _.take([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.take([1, 2, 3], 0); - * // => [] - */ - function take(array, n, guard) { - if (!(array && array.length)) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` with `n` elements taken from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.takeRight([1, 2, 3]); - * // => [3] - * - * _.takeRight([1, 2, 3], 2); - * // => [2, 3] - * - * _.takeRight([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.takeRight([1, 2, 3], 0); - * // => [] - */ - function takeRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, n < 0 ? 0 : n, length); - } - - /** - * Creates a slice of `array` with elements taken from the end. Elements are - * taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.takeRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.takeRightWhile(users, ['active', false]); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.takeRightWhile(users, 'active'); - * // => [] - */ - function takeRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), false, true) - : []; - } - - /** - * Creates a slice of `array` with elements taken from the beginning. Elements - * are taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.takeWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matches` iteratee shorthand. - * _.takeWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.takeWhile(users, ['active', false]); - * // => objects for ['barney', 'fred'] - * - * // The `_.property` iteratee shorthand. - * _.takeWhile(users, 'active'); - * // => [] - */ - function takeWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3)) - : []; - } - - /** - * Creates an array of unique values, in order, from all given arrays using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.union([2], [1, 2]); - * // => [2, 1] - */ - var union = baseRest(function(arrays) { - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); - }); - - /** - * This method is like `_.union` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by - * which uniqueness is computed. Result values are chosen from the first - * array in which the value occurs. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.unionBy([2.1], [1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // The `_.property` iteratee shorthand. - * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - var unionBy = baseRest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); - }); - - /** - * This method is like `_.union` except that it accepts `comparator` which - * is invoked to compare elements of `arrays`. Result values are chosen from - * the first array in which the value occurs. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.unionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var unionWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == 'function' ? comparator : undefined; - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); - }); - - /** - * Creates a duplicate-free version of an array, using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each element - * is kept. The order of result values is determined by the order they occur - * in the array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniq([2, 1, 2]); - * // => [2, 1] - */ - function uniq(array) { - return (array && array.length) ? baseUniq(array) : []; - } - - /** - * This method is like `_.uniq` except that it accepts `iteratee` which is - * invoked for each element in `array` to generate the criterion by which - * uniqueness is computed. The order of result values is determined by the - * order they occur in the array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniqBy([2.1, 1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // The `_.property` iteratee shorthand. - * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniqBy(array, iteratee) { - return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; - } - - /** - * This method is like `_.uniq` except that it accepts `comparator` which - * is invoked to compare elements of `array`. The order of result values is - * determined by the order they occur in the array.The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.uniqWith(objects, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] - */ - function uniqWith(array, comparator) { - comparator = typeof comparator == 'function' ? comparator : undefined; - return (array && array.length) ? baseUniq(array, undefined, comparator) : []; - } - - /** - * This method is like `_.zip` except that it accepts an array of grouped - * elements and creates an array regrouping the elements to their pre-zip - * configuration. - * - * @static - * @memberOf _ - * @since 1.2.0 - * @category Array - * @param {Array} array The array of grouped elements to process. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); - * // => [['a', 1, true], ['b', 2, false]] - * - * _.unzip(zipped); - * // => [['a', 'b'], [1, 2], [true, false]] - */ - function unzip(array) { - if (!(array && array.length)) { - return []; - } - var length = 0; - array = arrayFilter(array, function(group) { - if (isArrayLikeObject(group)) { - length = nativeMax(group.length, length); - return true; - } - }); - return baseTimes(length, function(index) { - return arrayMap(array, baseProperty(index)); - }); - } - - /** - * This method is like `_.unzip` except that it accepts `iteratee` to specify - * how regrouped values should be combined. The iteratee is invoked with the - * elements of each group: (...group). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Array - * @param {Array} array The array of grouped elements to process. - * @param {Function} [iteratee=_.identity] The function to combine - * regrouped values. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip([1, 2], [10, 20], [100, 200]); - * // => [[1, 10, 100], [2, 20, 200]] - * - * _.unzipWith(zipped, _.add); - * // => [3, 30, 300] - */ - function unzipWith(array, iteratee) { - if (!(array && array.length)) { - return []; - } - var result = unzip(array); - if (iteratee == null) { - return result; - } - return arrayMap(result, function(group) { - return apply(iteratee, undefined, group); - }); - } - - /** - * Creates an array excluding all given values using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.pull`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...*} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.difference, _.xor - * @example - * - * _.without([2, 1, 2, 3], 1, 2); - * // => [3] - */ - var without = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; - }); - - /** - * Creates an array of unique values that is the - * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) - * of the given arrays. The order of result values is determined by the order - * they occur in the arrays. - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of filtered values. - * @see _.difference, _.without - * @example - * - * _.xor([2, 1], [2, 3]); - * // => [1, 3] - */ - var xor = baseRest(function(arrays) { - return baseXor(arrayFilter(arrays, isArrayLikeObject)); - }); - - /** - * This method is like `_.xor` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by - * which by which they're compared. The order of result values is determined - * by the order they occur in the arrays. The iteratee is invoked with one - * argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2, 3.4] - * - * // The `_.property` iteratee shorthand. - * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var xorBy = baseRest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); - }); - - /** - * This method is like `_.xor` except that it accepts `comparator` which is - * invoked to compare elements of `arrays`. The order of result values is - * determined by the order they occur in the arrays. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.xorWith(objects, others, _.isEqual); - * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var xorWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == 'function' ? comparator : undefined; - return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); - }); - - /** - * Creates an array of grouped elements, the first of which contains the - * first elements of the given arrays, the second of which contains the - * second elements of the given arrays, and so on. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zip(['a', 'b'], [1, 2], [true, false]); - * // => [['a', 1, true], ['b', 2, false]] - */ - var zip = baseRest(unzip); - - /** - * This method is like `_.fromPairs` except that it accepts two arrays, - * one of property identifiers and one of corresponding values. - * - * @static - * @memberOf _ - * @since 0.4.0 - * @category Array - * @param {Array} [props=[]] The property identifiers. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObject(['a', 'b'], [1, 2]); - * // => { 'a': 1, 'b': 2 } - */ - function zipObject(props, values) { - return baseZipObject(props || [], values || [], assignValue); - } - - /** - * This method is like `_.zipObject` except that it supports property paths. - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Array - * @param {Array} [props=[]] The property identifiers. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); - * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } - */ - function zipObjectDeep(props, values) { - return baseZipObject(props || [], values || [], baseSet); - } - - /** - * This method is like `_.zip` except that it accepts `iteratee` to specify - * how grouped values should be combined. The iteratee is invoked with the - * elements of each group: (...group). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @param {Function} [iteratee=_.identity] The function to combine - * grouped values. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { - * return a + b + c; - * }); - * // => [111, 222] - */ - var zipWith = baseRest(function(arrays) { - var length = arrays.length, - iteratee = length > 1 ? arrays[length - 1] : undefined; - - iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; - return unzipWith(arrays, iteratee); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` wrapper instance that wraps `value` with explicit method - * chain sequences enabled. The result of such sequences must be unwrapped - * with `_#value`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Seq - * @param {*} value The value to wrap. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'pebbles', 'age': 1 } - * ]; - * - * var youngest = _ - * .chain(users) - * .sortBy('age') - * .map(function(o) { - * return o.user + ' is ' + o.age; - * }) - * .head() - * .value(); - * // => 'pebbles is 1' - */ - function chain(value) { - var result = lodash(value); - result.__chain__ = true; - return result; - } - - /** - * This method invokes `interceptor` and returns `value`. The interceptor - * is invoked with one argument; (value). The purpose of this method is to - * "tap into" a method chain sequence in order to modify intermediate results. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns `value`. - * @example - * - * _([1, 2, 3]) - * .tap(function(array) { - * // Mutate input array. - * array.pop(); - * }) - * .reverse() - * .value(); - * // => [2, 1] - */ - function tap(value, interceptor) { - interceptor(value); - return value; - } - - /** - * This method is like `_.tap` except that it returns the result of `interceptor`. - * The purpose of this method is to "pass thru" values replacing intermediate - * results in a method chain sequence. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns the result of `interceptor`. - * @example - * - * _(' abc ') - * .chain() - * .trim() - * .thru(function(value) { - * return [value]; - * }) - * .value(); - * // => ['abc'] - */ - function thru(value, interceptor) { - return interceptor(value); - } - - /** - * This method is the wrapper version of `_.at`. - * - * @name at - * @memberOf _ - * @since 1.0.0 - * @category Seq - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _(object).at(['a[0].b.c', 'a[1]']).value(); - * // => [3, 4] - */ - var wrapperAt = flatRest(function(paths) { - var length = paths.length, - start = length ? paths[0] : 0, - value = this.__wrapped__, - interceptor = function(object) { return baseAt(object, paths); }; - - if (length > 1 || this.__actions__.length || - !(value instanceof LazyWrapper) || !isIndex(start)) { - return this.thru(interceptor); - } - value = value.slice(start, +start + (length ? 1 : 0)); - value.__actions__.push({ - 'func': thru, - 'args': [interceptor], - 'thisArg': undefined - }); - return new LodashWrapper(value, this.__chain__).thru(function(array) { - if (length && !array.length) { - array.push(undefined); - } - return array; - }); - }); - - /** - * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. - * - * @name chain - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 } - * ]; - * - * // A sequence without explicit chaining. - * _(users).head(); - * // => { 'user': 'barney', 'age': 36 } - * - * // A sequence with explicit chaining. - * _(users) - * .chain() - * .head() - * .pick('user') - * .value(); - * // => { 'user': 'barney' } - */ - function wrapperChain() { - return chain(this); - } - - /** - * Executes the chain sequence and returns the wrapped result. - * - * @name commit - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2]; - * var wrapped = _(array).push(3); - * - * console.log(array); - * // => [1, 2] - * - * wrapped = wrapped.commit(); - * console.log(array); - * // => [1, 2, 3] - * - * wrapped.last(); - * // => 3 - * - * console.log(array); - * // => [1, 2, 3] - */ - function wrapperCommit() { - return new LodashWrapper(this.value(), this.__chain__); - } - - /** - * Gets the next value on a wrapped object following the - * [iterator protocol](https://mdn.io/iteration_protocols#iterator). - * - * @name next - * @memberOf _ - * @since 4.0.0 - * @category Seq - * @returns {Object} Returns the next iterator value. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped.next(); - * // => { 'done': false, 'value': 1 } - * - * wrapped.next(); - * // => { 'done': false, 'value': 2 } - * - * wrapped.next(); - * // => { 'done': true, 'value': undefined } - */ - function wrapperNext() { - if (this.__values__ === undefined) { - this.__values__ = toArray(this.value()); - } - var done = this.__index__ >= this.__values__.length, - value = done ? undefined : this.__values__[this.__index__++]; - - return { 'done': done, 'value': value }; - } - - /** - * Enables the wrapper to be iterable. - * - * @name Symbol.iterator - * @memberOf _ - * @since 4.0.0 - * @category Seq - * @returns {Object} Returns the wrapper object. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped[Symbol.iterator]() === wrapped; - * // => true - * - * Array.from(wrapped); - * // => [1, 2] - */ - function wrapperToIterator() { - return this; - } - - /** - * Creates a clone of the chain sequence planting `value` as the wrapped value. - * - * @name plant - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @param {*} value The value to plant. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2]).map(square); - * var other = wrapped.plant([3, 4]); - * - * other.value(); - * // => [9, 16] - * - * wrapped.value(); - * // => [1, 4] - */ - function wrapperPlant(value) { - var result, - parent = this; - - while (parent instanceof baseLodash) { - var clone = wrapperClone(parent); - clone.__index__ = 0; - clone.__values__ = undefined; - if (result) { - previous.__wrapped__ = clone; - } else { - result = clone; - } - var previous = clone; - parent = parent.__wrapped__; - } - previous.__wrapped__ = value; - return result; - } - - /** - * This method is the wrapper version of `_.reverse`. - * - * **Note:** This method mutates the wrapped array. - * - * @name reverse - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2, 3]; - * - * _(array).reverse().value() - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function wrapperReverse() { - var value = this.__wrapped__; - if (value instanceof LazyWrapper) { - var wrapped = value; - if (this.__actions__.length) { - wrapped = new LazyWrapper(this); - } - wrapped = wrapped.reverse(); - wrapped.__actions__.push({ - 'func': thru, - 'args': [reverse], - 'thisArg': undefined - }); - return new LodashWrapper(wrapped, this.__chain__); - } - return this.thru(reverse); - } - - /** - * Executes the chain sequence to resolve the unwrapped value. - * - * @name value - * @memberOf _ - * @since 0.1.0 - * @alias toJSON, valueOf - * @category Seq - * @returns {*} Returns the resolved unwrapped value. - * @example - * - * _([1, 2, 3]).value(); - * // => [1, 2, 3] - */ - function wrapperValue() { - return baseWrapperValue(this.__wrapped__, this.__actions__); - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the number of times the key was returned by `iteratee`. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': 1, '6': 2 } - * - * // The `_.property` iteratee shorthand. - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - var countBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - ++result[key]; - } else { - baseAssignValue(result, key, 1); - } - }); - - /** - * Checks if `predicate` returns truthy for **all** elements of `collection`. - * Iteration is stopped once `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * **Note:** This method returns `true` for - * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because - * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of - * elements of empty collections. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes'], Boolean); - * // => false - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.every(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.every(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.every(users, 'active'); - * // => false - */ - function every(collection, predicate, guard) { - var func = isArray(collection) ? arrayEvery : baseEvery; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * **Note:** Unlike `_.remove`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.reject - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * _.filter(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.filter(users, { 'age': 36, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.filter(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.filter(users, 'active'); - * // => objects for ['barney'] - */ - function filter(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false }, - * { 'user': 'pebbles', 'age': 1, 'active': true } - * ]; - * - * _.find(users, function(o) { return o.age < 40; }); - * // => object for 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.find(users, { 'age': 1, 'active': true }); - * // => object for 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.find(users, ['active', false]); - * // => object for 'fred' - * - * // The `_.property` iteratee shorthand. - * _.find(users, 'active'); - * // => object for 'barney' - */ - var find = createFind(findIndex); - - /** - * This method is like `_.find` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=collection.length-1] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(n) { - * return n % 2 == 1; - * }); - * // => 3 - */ - var findLast = createFind(findLastIndex); - - /** - * 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); - } - - /** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results. - * - * @static - * @memberOf _ - * @since 4.7.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]]]; - * } - * - * _.flatMapDeep([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMapDeep(collection, iteratee) { - return baseFlatten(map(collection, iteratee), INFINITY); - } - - /** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDepth([1, 2], duplicate, 2); - * // => [[1, 1], [2, 2]] - */ - function flatMapDepth(collection, iteratee, depth) { - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(map(collection, iteratee), depth); - } - - /** - * Iterates over elements of `collection` and invokes `iteratee` for each element. - * The iteratee is invoked with three arguments: (value, index|key, collection). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * **Note:** As with other "Collections" methods, objects with a "length" - * property are iterated like arrays. To avoid this behavior use `_.forIn` - * or `_.forOwn` for object iteration. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias each - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEachRight - * @example - * - * _.forEach([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `1` then `2`. - * - * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forEach(collection, iteratee) { - var func = isArray(collection) ? arrayEach : baseEach; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.forEach` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @alias eachRight - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEach - * @example - * - * _.forEachRight([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `2` then `1`. - */ - function forEachRight(collection, iteratee) { - var func = isArray(collection) ? arrayEachRight : baseEachRight; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The order of grouped values - * is determined by the order they occur in `collection`. The corresponding - * value of each key is an array of elements responsible for generating the - * key. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': [4.2], '6': [6.1, 6.3] } - * - * // The `_.property` iteratee shorthand. - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - var groupBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - result[key].push(value); - } else { - baseAssignValue(result, key, [value]); - } - }); - - /** - * Checks if `value` is in `collection`. If `collection` is a string, it's - * checked for a substring of `value`, otherwise - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * is used for equality comparisons. If `fromIndex` is negative, it's used as - * the offset from the end of `collection`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {boolean} Returns `true` if `value` is found, else `false`. - * @example - * - * _.includes([1, 2, 3], 1); - * // => true - * - * _.includes([1, 2, 3], 1, 2); - * // => false - * - * _.includes({ 'a': 1, 'b': 2 }, 1); - * // => true - * - * _.includes('abcd', 'bc'); - * // => true - */ - function includes(collection, value, fromIndex, guard) { - collection = isArrayLike(collection) ? collection : values(collection); - fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; - - var length = collection.length; - if (fromIndex < 0) { - fromIndex = nativeMax(length + fromIndex, 0); - } - return isString(collection) - ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) - : (!!length && baseIndexOf(collection, value, fromIndex) > -1); - } - - /** - * Invokes the method at `path` of each element in `collection`, returning - * an array of the results of each invoked method. Any additional arguments - * are provided to each invoked method. If `path` is a function, it's invoked - * for, and `this` bound to, each element in `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array|Function|string} path The path of the method to invoke or - * the function invoked per iteration. - * @param {...*} [args] The arguments to invoke each method with. - * @returns {Array} Returns the array of results. - * @example - * - * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invokeMap([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - var invokeMap = baseRest(function(collection, path, args) { - var index = -1, - isFunc = typeof path == 'function', - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value) { - result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); - }); - return result; - }); - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the last element responsible for generating the key. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var array = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.keyBy(array, function(o) { - * return String.fromCharCode(o.code); - * }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - * - * _.keyBy(array, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - */ - var keyBy = createAggregator(function(result, value, key) { - baseAssignValue(result, key, value); - }); - - /** - * 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, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.sortBy` except that it allows specifying the sort - * orders of the iteratees to sort by. If `orders` is unspecified, all values - * are sorted in ascending order. Otherwise, specify an order of "desc" for - * descending or "asc" for ascending sort order of corresponding values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] - * The iteratees to sort by. - * @param {string[]} [orders] The sort orders of `iteratees`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 34 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 36 } - * ]; - * - * // Sort by `user` in ascending order and by `age` in descending order. - * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] - */ - function orderBy(collection, iteratees, orders, guard) { - if (collection == null) { - return []; - } - if (!isArray(iteratees)) { - iteratees = iteratees == null ? [] : [iteratees]; - } - orders = guard ? undefined : orders; - if (!isArray(orders)) { - orders = orders == null ? [] : [orders]; - } - return baseOrderBy(collection, iteratees, orders); - } - - /** - * Creates an array of elements split into two groups, the first of which - * contains elements `predicate` returns truthy for, the second of which - * contains elements `predicate` returns falsey for. The predicate is - * invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the array of grouped elements. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true }, - * { 'user': 'pebbles', 'age': 1, 'active': false } - * ]; - * - * _.partition(users, function(o) { return o.active; }); - * // => objects for [['fred'], ['barney', 'pebbles']] - * - * // The `_.matches` iteratee shorthand. - * _.partition(users, { 'age': 1, 'active': false }); - * // => objects for [['pebbles'], ['barney', 'fred']] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.partition(users, ['active', false]); - * // => objects for [['barney', 'pebbles'], ['fred']] - * - * // The `_.property` iteratee shorthand. - * _.partition(users, 'active'); - * // => objects for [['fred'], ['barney', 'pebbles']] - */ - var partition = createAggregator(function(result, value, key) { - result[key ? 0 : 1].push(value); - }, function() { return [[], []]; }); - - /** - * 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, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); - } - - /** - * This method is like `_.reduce` except that it iterates over elements of - * `collection` from right to left. - * - * @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 _.reduce - * @example - * - * var array = [[0, 1], [2, 3], [4, 5]]; - * - * _.reduceRight(array, function(flattened, other) { - * return flattened.concat(other); - * }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduceRight : baseReduce, - initAccum = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); - } - - /** - * The opposite of `_.filter`; this method returns the elements of `collection` - * that `predicate` does **not** return truthy for. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.filter - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true } - * ]; - * - * _.reject(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.reject(users, { 'age': 40, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.reject(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.reject(users, 'active'); - * // => objects for ['barney'] - */ - function reject(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, negate(getIteratee(predicate, 3))); - } - - /** - * Gets a random element from `collection`. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - * @example - * - * _.sample([1, 2, 3, 4]); - * // => 2 - */ - function sample(collection) { - var func = isArray(collection) ? arraySample : baseSample; - return func(collection); - } - - /** - * Gets `n` random elements at unique keys from `collection` up to the - * size of `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @param {number} [n=1] The number of elements to sample. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the random elements. - * @example - * - * _.sampleSize([1, 2, 3], 2); - * // => [3, 1] - * - * _.sampleSize([1, 2, 3], 4); - * // => [2, 3, 1] - */ - function sampleSize(collection, n, guard) { - if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { - n = 1; - } else { - n = toInteger(n); - } - var func = isArray(collection) ? arraySampleSize : baseSampleSize; - return func(collection, n); - } - - /** - * Creates an array of shuffled values, using a version of the - * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - * @example - * - * _.shuffle([1, 2, 3, 4]); - * // => [4, 1, 3, 2] - */ - function shuffle(collection) { - var func = isArray(collection) ? arrayShuffle : baseShuffle; - return func(collection); - } - - /** - * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable string keyed properties for objects. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns the collection size. - * @example - * - * _.size([1, 2, 3]); - * // => 3 - * - * _.size({ 'a': 1, 'b': 2 }); - * // => 2 - * - * _.size('pebbles'); - * // => 7 - */ - function size(collection) { - if (collection == null) { - return 0; - } - if (isArrayLike(collection)) { - return isString(collection) ? stringSize(collection) : collection.length; - } - var tag = getTag(collection); - if (tag == mapTag || tag == setTag) { - return collection.size; - } - return baseKeys(collection).length; - } - - /** - * Checks if `predicate` returns truthy for **any** element of `collection`. - * Iteration is stopped once `predicate` returns truthy. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.some(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.some(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.some(users, 'active'); - * // => true - */ - function some(collection, predicate, guard) { - var func = isArray(collection) ? arraySome : baseSome; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection thru each iteratee. This method - * performs a stable sort, that is, it preserves the original sort order of - * equal elements. The iteratees are invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {...(Function|Function[])} [iteratees=[_.identity]] - * The iteratees to sort by. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 34 } - * ]; - * - * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] - * - * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] - */ - var sortBy = baseRest(function(collection, iteratees) { - if (collection == null) { - return []; - } - var length = iteratees.length; - if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { - iteratees = []; - } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { - iteratees = [iteratees[0]]; - } - return baseOrderBy(collection, baseFlatten(iteratees, 1), []); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ - var now = ctxNow || function() { - return root.Date.now(); - }; - - /*------------------------------------------------------------------------*/ - - /** - * The opposite of `_.before`; this method creates a function that invokes - * `func` once it's called `n` or more times. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {number} n The number of calls before `func` is invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => Logs 'done saving!' after the two async saves have completed. - */ - function after(n, func) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that invokes `func`, with up to `n` arguments, - * ignoring any additional arguments. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @param {number} [n=func.length] The arity cap. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.ary(parseInt, 1)); - * // => [6, 8, 10] - */ - function ary(func, n, guard) { - n = guard ? undefined : n; - n = (func && n == null) ? func.length : n; - return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); - } - - /** - * Creates a function that invokes `func`, with the `this` binding and arguments - * of the created function, while it's called less than `n` times. Subsequent - * calls to the created function return the result of the last `func` invocation. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {number} n The number of calls at which `func` is no longer invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * jQuery(element).on('click', _.before(5, addContactToList)); - * // => Allows adding up to 4 contacts to the list. - */ - function before(n, func) { - var result; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n > 0) { - result = func.apply(this, arguments); - } - if (n <= 1) { - func = undefined; - } - return result; - }; - } - - /** - * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and `partials` prepended to the arguments it receives. - * - * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for partially applied arguments. - * - * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" - * property of bound functions. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * function greet(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * - * var object = { 'user': 'fred' }; - * - * var bound = _.bind(greet, object, 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * // Bound with placeholders. - * var bound = _.bind(greet, object, _, '!'); - * bound('hi'); - * // => 'hi fred!' - */ - var bind = baseRest(function(func, thisArg, partials) { - var bitmask = WRAP_BIND_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bind)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(func, bitmask, thisArg, partials, holders); - }); - - /** - * Creates a function that invokes the method at `object[key]` with `partials` - * prepended to the arguments it receives. - * - * This method differs from `_.bind` by allowing bound functions to reference - * methods that may be redefined or don't yet exist. See - * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) - * for more details. - * - * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Function - * @param {Object} object The object to invoke the method on. - * @param {string} key The key of the method. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'user': 'fred', - * 'greet': function(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * }; - * - * var bound = _.bindKey(object, 'greet', 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * object.greet = function(greeting, punctuation) { - * return greeting + 'ya ' + this.user + punctuation; - * }; - * - * bound('!'); - * // => 'hiya fred!' - * - * // Bound with placeholders. - * var bound = _.bindKey(object, 'greet', _, '!'); - * bound('hi'); - * // => 'hiya fred!' - */ - var bindKey = baseRest(function(object, key, partials) { - var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bindKey)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(key, bitmask, object, partials, holders); - }); - - /** - * Creates a function that accepts arguments of `func` and either invokes - * `func` returning its result, if at least `arity` number of arguments have - * been provided, or returns a function that accepts the remaining `func` - * arguments, and so on. The arity of `func` may be specified if `func.length` - * is not sufficient. - * - * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curry(abc); - * - * curried(1)(2)(3); - * // => [1, 2, 3] - * - * curried(1, 2)(3); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(1)(_, 3)(2); - * // => [1, 2, 3] - */ - function curry(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curry.placeholder; - return result; - } - - /** - * This method is like `_.curry` except that arguments are applied to `func` - * in the manner of `_.partialRight` instead of `_.partial`. - * - * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curryRight(abc); - * - * curried(3)(2)(1); - * // => [1, 2, 3] - * - * curried(2, 3)(1); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(3)(1, _)(2); - * // => [1, 2, 3] - */ - function curryRight(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curryRight.placeholder; - return result; - } - - /** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide `options` to indicate whether `func` should be invoked on the - * leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent - * calls to the debounced function return the result of the last `func` - * invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the debounced function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=false] - * Specify invoking on the leading edge of the timeout. - * @param {number} [options.maxWait] - * The maximum time `func` is allowed to be delayed before it's invoked. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // Avoid costly calculations while the window size is in flux. - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // Invoke `sendMail` when clicked, debouncing subsequent calls. - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // Cancel the trailing debounced invocation. - * jQuery(window).on('popstate', debounced.cancel); - */ - function debounce(func, wait, options) { - var lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime, - lastInvokeTime = 0, - leading = false, - maxing = false, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - wait = toNumber(wait) || 0; - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - function invokeFunc(time) { - var args = lastArgs, - thisArg = lastThis; - - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; - } - - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; - // Start the timer for the trailing edge. - timerId = setTimeout(timerExpired, wait); - // Invoke the leading edge. - return leading ? invokeFunc(time) : result; - } - - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime, - timeWaiting = wait - timeSinceLastCall; - - return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; - } - - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime; - - // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); - } - - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); - } - // Restart the timer. - timerId = setTimeout(timerExpired, remainingWait(time)); - } - - function trailingEdge(time) { - timerId = undefined; - - // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - if (trailing && lastArgs) { - return invokeFunc(time); - } - lastArgs = lastThis = undefined; - return result; - } - - function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); - } - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; - } - - function flush() { - return timerId === undefined ? result : trailingEdge(now()); - } - - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); - - lastArgs = arguments; - lastThis = this; - lastCallTime = time; - - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - if (maxing) { - // Handle invocations in a tight loop. - clearTimeout(timerId); - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); - } - } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } - return result; - } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; - } - - /** - * Defers invoking the `func` until the current call stack has cleared. Any - * additional arguments are provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to defer. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { - * console.log(text); - * }, 'deferred'); - * // => Logs 'deferred' after one millisecond. - */ - var defer = baseRest(function(func, args) { - return baseDelay(func, 1, args); - }); - - /** - * Invokes `func` after `wait` milliseconds. Any additional arguments are - * provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { - * console.log(text); - * }, 1000, 'later'); - * // => Logs 'later' after one second. - */ - var delay = baseRest(function(func, wait, args) { - return baseDelay(func, toNumber(wait) || 0, args); - }); - - /** - * Creates a function that invokes `func` with arguments reversed. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to flip arguments for. - * @returns {Function} Returns the new flipped function. - * @example - * - * var flipped = _.flip(function() { - * return _.toArray(arguments); - * }); - * - * flipped('a', 'b', 'c', 'd'); - * // => ['d', 'c', 'b', 'a'] - */ - function flip(func) { - return createWrap(func, WRAP_FLIP_FLAG); - } - - /** - * 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; - - /** - * Creates a function that negates the result of the predicate `func`. The - * `func` predicate is invoked with the `this` binding and arguments of the - * created function. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} predicate The predicate to negate. - * @returns {Function} Returns the new negated function. - * @example - * - * function isEven(n) { - * return n % 2 == 0; - * } - * - * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); - * // => [1, 3, 5] - */ - function negate(predicate) { - if (typeof predicate != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return function() { - var args = arguments; - switch (args.length) { - case 0: return !predicate.call(this); - case 1: return !predicate.call(this, args[0]); - case 2: return !predicate.call(this, args[0], args[1]); - case 3: return !predicate.call(this, args[0], args[1], args[2]); - } - return !predicate.apply(this, args); - }; - } - - /** - * Creates a function that is restricted to invoking `func` once. Repeat calls - * to the function return the value of the first invocation. The `func` is - * invoked with the `this` binding and arguments of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // => `createApplication` is invoked once - */ - function once(func) { - return before(2, func); - } - - /** - * Creates a function that invokes `func` with its arguments transformed. - * - * @static - * @since 4.0.0 - * @memberOf _ - * @category Function - * @param {Function} func The function to wrap. - * @param {...(Function|Function[])} [transforms=[_.identity]] - * The argument transforms. - * @returns {Function} Returns the new function. - * @example - * - * function doubled(n) { - * return n * 2; - * } - * - * function square(n) { - * return n * n; - * } - * - * var func = _.overArgs(function(x, y) { - * return [x, y]; - * }, [square, doubled]); - * - * func(9, 3); - * // => [81, 6] - * - * func(10, 5); - * // => [100, 10] - */ - var overArgs = castRest(function(func, transforms) { - transforms = (transforms.length == 1 && isArray(transforms[0])) - ? arrayMap(transforms[0], baseUnary(getIteratee())) - : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); - - var funcsLength = transforms.length; - return baseRest(function(args) { - var index = -1, - length = nativeMin(args.length, funcsLength); - - while (++index < length) { - args[index] = transforms[index].call(this, args[index]); - } - return apply(func, this, args); - }); - }); - - /** - * Creates a function that invokes `func` with `partials` prepended to the - * arguments it receives. This method is like `_.bind` except it does **not** - * alter the `this` binding. - * - * The `_.partial.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @since 0.2.0 - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * function greet(greeting, name) { - * return greeting + ' ' + name; - * } - * - * var sayHelloTo = _.partial(greet, 'hello'); - * sayHelloTo('fred'); - * // => 'hello fred' - * - * // Partially applied with placeholders. - * var greetFred = _.partial(greet, _, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - */ - var partial = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partial)); - return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); - }); - - /** - * This method is like `_.partial` except that partially applied arguments - * are appended to the arguments it receives. - * - * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * function greet(greeting, name) { - * return greeting + ' ' + name; - * } - * - * var greetFred = _.partialRight(greet, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - * - * // Partially applied with placeholders. - * var sayHelloTo = _.partialRight(greet, 'hello', _); - * sayHelloTo('fred'); - * // => 'hello fred' - */ - var partialRight = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partialRight)); - return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); - }); - - /** - * Creates a function that invokes `func` with arguments arranged according - * to the specified `indexes` where the argument value at the first index is - * provided as the first argument, the argument value at the second index is - * provided as the second argument, and so on. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to rearrange arguments for. - * @param {...(number|number[])} indexes The arranged argument indexes. - * @returns {Function} Returns the new function. - * @example - * - * var rearged = _.rearg(function(a, b, c) { - * return [a, b, c]; - * }, [2, 0, 1]); - * - * rearged('b', 'c', 'a') - * // => ['a', 'b', 'c'] - */ - var rearg = flatRest(function(func, indexes) { - return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); - }); - - /** - * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as - * an array. - * - * **Note:** This method is based on the - * [rest parameter](https://mdn.io/rest_parameters). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @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. - * @example - * - * var say = _.rest(function(what, names) { - * return what + ' ' + _.initial(names).join(', ') + - * (_.size(names) > 1 ? ', & ' : '') + _.last(names); - * }); - * - * say('hello', 'fred', 'barney', 'pebbles'); - * // => 'hello fred, barney, & pebbles' - */ - function rest(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = start === undefined ? start : toInteger(start); - return baseRest(func, start); - } - - /** - * Creates a function that invokes `func` with the `this` binding of the - * create function and an array of arguments much like - * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). - * - * **Note:** This method is based on the - * [spread operator](https://mdn.io/spread_operator). - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Function - * @param {Function} func The function to spread arguments over. - * @param {number} [start=0] The start position of the spread. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.spread(function(who, what) { - * return who + ' says ' + what; - * }); - * - * say(['fred', 'hello']); - * // => 'fred says hello' - * - * var numbers = Promise.all([ - * Promise.resolve(40), - * Promise.resolve(36) - * ]); - * - * numbers.then(_.spread(function(x, y) { - * return x + y; - * })); - * // => a Promise of 76 - */ - function spread(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = start == null ? 0 : nativeMax(toInteger(start), 0); - return baseRest(function(args) { - var array = args[start], - otherArgs = castSlice(args, 0, start); - - if (array) { - arrayPush(otherArgs, array); - } - return apply(func, this, otherArgs); - }); - } - - /** - * Creates a throttled function that only invokes `func` at most once per - * every `wait` milliseconds. The throttled function comes with a `cancel` - * method to cancel delayed `func` invocations and a `flush` method to - * immediately invoke them. Provide `options` to indicate whether `func` - * should be invoked on the leading and/or trailing edge of the `wait` - * timeout. The `func` is invoked with the last arguments provided to the - * throttled function. Subsequent calls to the throttled function return the - * result of the last `func` invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the throttled function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.throttle` and `_.debounce`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to throttle. - * @param {number} [wait=0] The number of milliseconds to throttle invocations to. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=true] - * Specify invoking on the leading edge of the timeout. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // Avoid excessively updating the position while scrolling. - * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); - * - * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. - * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); - * jQuery(element).on('click', throttled); - * - * // Cancel the trailing throttled invocation. - * jQuery(window).on('popstate', throttled.cancel); - */ - function throttle(func, wait, options) { - var leading = true, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (isObject(options)) { - leading = 'leading' in options ? !!options.leading : leading; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - return debounce(func, wait, { - 'leading': leading, - 'maxWait': wait, - 'trailing': trailing - }); - } - - /** - * Creates a function that accepts up to one argument, ignoring any - * additional arguments. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.unary(parseInt)); - * // => [6, 8, 10] - */ - function unary(func) { - return ary(func, 1); - } - - /** - * Creates a function that provides `value` to `wrapper` as its first - * argument. Any additional arguments provided to the function are appended - * to those provided to the `wrapper`. The wrapper is invoked with the `this` - * binding of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {*} value The value to wrap. - * @param {Function} [wrapper=identity] The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var p = _.wrap(_.escape, function(func, text) { - * return '

' + func(text) + '

'; - * }); - * - * p('fred, barney, & pebbles'); - * // => '

fred, barney, & pebbles

' - */ - function wrap(value, wrapper) { - return partial(castFunction(wrapper), value); - } - - /*------------------------------------------------------------------------*/ - - /** - * 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]; - } - - /** - * Creates a shallow clone of `value`. - * - * **Note:** This method is loosely based on the - * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) - * and supports cloning arrays, array buffers, booleans, date objects, maps, - * numbers, `Object` objects, regexes, sets, strings, symbols, and typed - * arrays. The own enumerable properties of `arguments` objects are cloned - * as plain objects. An empty object is returned for uncloneable values such - * as error objects, functions, DOM nodes, and WeakMaps. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to clone. - * @returns {*} Returns the cloned value. - * @see _.cloneDeep - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var shallow = _.clone(objects); - * console.log(shallow[0] === objects[0]); - * // => true - */ - function clone(value) { - return baseClone(value, CLONE_SYMBOLS_FLAG); - } - - /** - * This method is like `_.clone` except that it accepts `customizer` which - * is invoked to produce the cloned value. If `customizer` returns `undefined`, - * cloning is handled by the method instead. The `customizer` is invoked with - * up to four arguments; (value [, index|key, object, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the cloned value. - * @see _.cloneDeepWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(false); - * } - * } - * - * var el = _.cloneWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 0 - */ - function cloneWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); - } - - /** - * This method is like `_.clone` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @returns {*} Returns the deep cloned value. - * @see _.clone - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var deep = _.cloneDeep(objects); - * console.log(deep[0] === objects[0]); - * // => false - */ - function cloneDeep(value) { - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); - } - - /** - * This method is like `_.cloneWith` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the deep cloned value. - * @see _.cloneWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(true); - * } - * } - * - * var el = _.cloneDeepWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 20 - */ - function cloneDeepWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); - } - - /** - * Checks if `object` conforms to `source` by invoking the predicate - * properties of `source` with the corresponding property values of `object`. - * - * **Note:** This method is equivalent to `_.conforms` when `source` is - * partially applied. - * - * @static - * @memberOf _ - * @since 4.14.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); - * // => true - * - * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); - * // => false - */ - function conformsTo(object, source) { - return source == null || baseConformsTo(object, source, keys(source)); - } - - /** - * 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); - } - - /** - * Checks if `value` is greater than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - * @see _.lt - * @example - * - * _.gt(3, 1); - * // => true - * - * _.gt(3, 3); - * // => false - * - * _.gt(1, 3); - * // => false - */ - var gt = createRelationalOperation(baseGt); - - /** - * Checks if `value` is greater than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than or equal to - * `other`, else `false`. - * @see _.lte - * @example - * - * _.gte(3, 1); - * // => true - * - * _.gte(3, 3); - * // => true - * - * _.gte(1, 3); - * // => false - */ - var gte = createRelationalOperation(function(value, other) { - return value >= other; - }); - - /** - * 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.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); - }; - - /** - * 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; - - /** - * Checks if `value` is classified as an `ArrayBuffer` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - * @example - * - * _.isArrayBuffer(new ArrayBuffer(2)); - * // => true - * - * _.isArrayBuffer(new Array(2)); - * // => false - */ - var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; - - /** - * 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); - } - - /** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ - function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); - } - - /** - * 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); - } - - /** - * 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; - - /** - * Checks if `value` is classified as a `Date` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - * - * _.isDate('Mon April 23 2012'); - * // => false - */ - var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; - - /** - * Checks if `value` is likely a DOM element. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - * - * _.isElement(''); - * // => false - */ - function isElement(value) { - return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); - } - - /** - * Checks if `value` is an empty object, collection, map, or set. - * - * Objects are considered empty if they have no own enumerable string keyed - * properties. - * - * Array-like values such as `arguments` objects, arrays, buffers, strings, or - * jQuery-like collections are considered empty if they have a `length` of `0`. - * Similarly, maps and sets are considered empty if they have a `size` of `0`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is empty, else `false`. - * @example - * - * _.isEmpty(null); - * // => true - * - * _.isEmpty(true); - * // => true - * - * _.isEmpty(1); - * // => true - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({ 'a': 1 }); - * // => false - */ - function isEmpty(value) { - if (value == null) { - return true; - } - if (isArrayLike(value) && - (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { - return !value.length; - } - var tag = getTag(value); - if (tag == mapTag || tag == setTag) { - return !value.size; - } - if (isPrototype(value)) { - return !baseKeys(value).length; - } - for (var key in value) { - if (hasOwnProperty.call(value, key)) { - return false; - } - } - return true; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, array buffers, booleans, - * date objects, error objects, maps, numbers, `Object` objects, regexes, - * sets, strings, symbols, and typed arrays. `Object` objects are compared - * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are compared by strict equality, i.e. `===`. - * - * @static - * @memberOf _ - * @since 0.1.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 }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ - function isEqual(value, other) { - return baseIsEqual(value, other); - } - - /** - * This method is like `_.isEqual` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with up to - * six arguments: (objValue, othValue [, index|key, object, other, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, othValue) { - * if (isGreeting(objValue) && isGreeting(othValue)) { - * return true; - * } - * } - * - * var array = ['hello', 'goodbye']; - * var other = ['hi', 'goodbye']; - * - * _.isEqualWith(array, other, customizer); - * // => true - */ - function isEqualWith(value, other, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - var result = customizer ? customizer(value, other) : undefined; - return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; - } - - /** - * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, - * `SyntaxError`, `TypeError`, or `URIError` object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an error object, else `false`. - * @example - * - * _.isError(new Error); - * // => true - * - * _.isError(Error); - * // => false - */ - function isError(value) { - if (!isObjectLike(value)) { - return false; - } - var tag = baseGetTag(value); - return tag == errorTag || tag == domExcTag || - (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); - } - - /** - * Checks if `value` is a finite primitive number. - * - * **Note:** This method is based on - * [`Number.isFinite`](https://mdn.io/Number/isFinite). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. - * @example - * - * _.isFinite(3); - * // => true - * - * _.isFinite(Number.MIN_VALUE); - * // => true - * - * _.isFinite(Infinity); - * // => false - * - * _.isFinite('3'); - * // => false - */ - function isFinite(value) { - return typeof value == 'number' && nativeIsFinite(value); - } - - /** - * 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(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 an integer. - * - * **Note:** This method is based on - * [`Number.isInteger`](https://mdn.io/Number/isInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an integer, else `false`. - * @example - * - * _.isInteger(3); - * // => true - * - * _.isInteger(Number.MIN_VALUE); - * // => false - * - * _.isInteger(Infinity); - * // => false - * - * _.isInteger('3'); - * // => false - */ - function isInteger(value) { - return typeof value == 'number' && value == toInteger(value); - } - - /** - * 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 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(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - /** - * 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'; - } - - /** - * Checks if `value` is classified as a `Map` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - * @example - * - * _.isMap(new Map); - * // => true - * - * _.isMap(new WeakMap); - * // => false - */ - var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; - - /** - * Performs a partial deep comparison between `object` and `source` to - * determine if `object` contains equivalent property values. - * - * **Note:** This method is equivalent to `_.matches` when `source` is - * partially applied. - * - * Partial comparisons will match empty array and empty object `source` - * values against any array or object value, respectively. See `_.isEqual` - * for a list of supported value comparisons. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.isMatch(object, { 'b': 2 }); - * // => true - * - * _.isMatch(object, { 'b': 1 }); - * // => false - */ - function isMatch(object, source) { - return object === source || baseIsMatch(object, source, getMatchData(source)); - } - - /** - * This method is like `_.isMatch` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with five - * arguments: (objValue, srcValue, index|key, object, source). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, srcValue) { - * if (isGreeting(objValue) && isGreeting(srcValue)) { - * return true; - * } - * } - * - * var object = { 'greeting': 'hello' }; - * var source = { 'greeting': 'hi' }; - * - * _.isMatchWith(object, source, customizer); - * // => true - */ - function isMatchWith(object, source, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseIsMatch(object, source, getMatchData(source), customizer); - } - - /** - * Checks if `value` is `NaN`. - * - * **Note:** This method is based on - * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as - * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for - * `undefined` and other non-number values. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some - // ActiveX objects in IE. - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is a pristine native function. - * - * **Note:** This method can't reliably detect native functions in the presence - * of the core-js package because core-js circumvents this kind of detection. - * Despite multiple requests, the core-js maintainer has made it clear: any - * attempt to fix the detection will be obstructed. As a result, we're left - * with little choice but to throw an error. Unfortunately, this also affects - * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), - * which rely on core-js. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ - function isNative(value) { - if (isMaskable(value)) { - throw new Error(CORE_ERROR_TEXT); - } - return baseIsNative(value); - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(void 0); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is `null` or `undefined`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is nullish, else `false`. - * @example - * - * _.isNil(null); - * // => true - * - * _.isNil(void 0); - * // => true - * - * _.isNil(NaN); - * // => false - */ - function isNil(value) { - return value == null; - } - - /** - * Checks if `value` is classified as a `Number` primitive or object. - * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are - * classified as numbers, use the `_.isFinite` method. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a number, else `false`. - * @example - * - * _.isNumber(3); - * // => true - * - * _.isNumber(Number.MIN_VALUE); - * // => true - * - * _.isNumber(Infinity); - * // => true - * - * _.isNumber('3'); - * // => false - */ - function isNumber(value) { - return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); - } - - /** - * 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.call(proto, 'constructor') && proto.constructor; - return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; - } - - /** - * Checks if `value` is classified as a `RegExp` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - * @example - * - * _.isRegExp(/abc/); - * // => true - * - * _.isRegExp('/abc/'); - * // => false - */ - var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; - - /** - * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 - * double precision number which isn't the result of a rounded unsafe integer. - * - * **Note:** This method is based on - * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. - * @example - * - * _.isSafeInteger(3); - * // => true - * - * _.isSafeInteger(Number.MIN_VALUE); - * // => false - * - * _.isSafeInteger(Infinity); - * // => false - * - * _.isSafeInteger('3'); - * // => false - */ - function isSafeInteger(value) { - return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is classified as a `Set` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - * @example - * - * _.isSet(new Set); - * // => true - * - * _.isSet(new WeakSet); - * // => false - */ - var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; - - /** - * 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); - } - - /** - * 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); - } - - /** - * 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; - - /** - * 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; - } - - /** - * Checks if `value` is classified as a `WeakMap` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. - * @example - * - * _.isWeakMap(new WeakMap); - * // => true - * - * _.isWeakMap(new Map); - * // => false - */ - function isWeakMap(value) { - return isObjectLike(value) && getTag(value) == weakMapTag; - } - - /** - * Checks if `value` is classified as a `WeakSet` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. - * @example - * - * _.isWeakSet(new WeakSet); - * // => true - * - * _.isWeakSet(new Set); - * // => false - */ - function isWeakSet(value) { - return isObjectLike(value) && baseGetTag(value) == weakSetTag; - } - - /** - * Checks if `value` is less than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - * @see _.gt - * @example - * - * _.lt(1, 3); - * // => true - * - * _.lt(3, 3); - * // => false - * - * _.lt(3, 1); - * // => false - */ - var lt = createRelationalOperation(baseLt); - - /** - * Checks if `value` is less than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than or equal to - * `other`, else `false`. - * @see _.gte - * @example - * - * _.lte(1, 3); - * // => true - * - * _.lte(3, 3); - * // => true - * - * _.lte(3, 1); - * // => false - */ - var lte = createRelationalOperation(function(value, other) { - return value <= other; - }); - - /** - * Converts `value` to an array. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {Array} Returns the converted array. - * @example - * - * _.toArray({ 'a': 1, 'b': 2 }); - * // => [1, 2] - * - * _.toArray('abc'); - * // => ['a', 'b', 'c'] - * - * _.toArray(1); - * // => [] - * - * _.toArray(null); - * // => [] - */ - function toArray(value) { - if (!value) { - return []; - } - if (isArrayLike(value)) { - return isString(value) ? stringToArray(value) : copyArray(value); - } - if (symIterator && value[symIterator]) { - return iteratorToArray(value[symIterator]()); - } - var tag = getTag(value), - func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); - - return func(value); - } - - /** - * 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 || value === -INFINITY) { - 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 an integer suitable for use as the length of an - * array-like object. - * - * **Note:** This method is 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 convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toLength(3.2); - * // => 3 - * - * _.toLength(Number.MIN_VALUE); - * // => 0 - * - * _.toLength(Infinity); - * // => 4294967295 - * - * _.toLength('3.2'); - * // => 3 - */ - function toLength(value) { - return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; - } - - /** - * 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(value)) { - var other = typeof value.valueOf == 'function' ? value.valueOf() : value; - value = isObject(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); - } - - /** - * Converts `value` to a plain object flattening inherited enumerable string - * keyed properties of `value` to own properties of the plain object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {Object} Returns the converted plain object. - * @example - * - * function Foo() { - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.assign({ 'a': 1 }, new Foo); - * // => { 'a': 1, 'b': 2 } - * - * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); - * // => { 'a': 1, 'b': 2, 'c': 3 } - */ - function toPlainObject(value) { - return copyObject(value, keysIn(value)); - } - - /** - * Converts `value` to a safe integer. A safe integer can be compared and - * represented correctly. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toSafeInteger(3.2); - * // => 3 - * - * _.toSafeInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toSafeInteger(Infinity); - * // => 9007199254740991 - * - * _.toSafeInteger('3.2'); - * // => 3 - */ - function toSafeInteger(value) { - return value - ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) - : (value === 0 ? value : 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); - } - - /*------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable string keyed properties of source objects to the - * destination object. Source objects are applied from left to right. - * Subsequent sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object` and is loosely based on - * [`Object.assign`](https://mdn.io/Object/assign). - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assignIn - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assign({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'c': 3 } - */ - var assign = createAssigner(function(object, source) { - if (isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys(source), object); - return; - } - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - assignValue(object, key, source[key]); - } - } - }); - - /** - * 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); - }); - - /** - * This method is like `_.assign` 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 - * @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 _.assignInWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keys(source), object, customizer); - }); - - /** - * Creates an array of values corresponding to `paths` of `object`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Array} Returns the picked values. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _.at(object, ['a[0].b.c', 'a[1]']); - * // => [3, 4] - */ - var at = flatRest(baseAt); - - /** - * Creates an object that inherits from the `prototype` object. If a - * `properties` object is given, its own enumerable string keyed properties - * are assigned to the created object. - * - * @static - * @memberOf _ - * @since 2.3.0 - * @category Object - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { - * 'constructor': Circle - * }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ - function create(prototype, properties) { - var result = baseCreate(prototype); - return properties == null ? result : baseAssign(result, properties); - } - - /** - * Assigns own and inherited enumerable string keyed properties of source - * objects to the destination object for all destination properties that - * resolve to `undefined`. Source objects are applied from left to right. - * Once a property is set, additional values of the same property are ignored. - * - * **Note:** This method mutates `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaultsDeep - * @example - * - * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var defaults = baseRest(function(object, sources) { - object = Object(object); - - var index = -1; - var length = sources.length; - var guard = length > 2 ? sources[2] : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - length = 1; - } - - while (++index < length) { - var source = sources[index]; - var props = keysIn(source); - var propsIndex = -1; - var propsLength = props.length; - - while (++propsIndex < propsLength) { - var key = props[propsIndex]; - var value = object[key]; - - if (value === undefined || - (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { - object[key] = source[key]; - } - } - } - - return object; - }); - - /** - * This method is like `_.defaults` except that it recursively assigns - * default properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaults - * @example - * - * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); - * // => { 'a': { 'b': 2, 'c': 3 } } - */ - var defaultsDeep = baseRest(function(args) { - args.push(undefined, customDefaultsMerge); - return apply(mergeWith, undefined, args); - }); - - /** - * This method is like `_.find` except that it returns the key of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findKey(users, function(o) { return o.age < 40; }); - * // => 'barney' (iteration order is not guaranteed) - * - * // The `_.matches` iteratee shorthand. - * _.findKey(users, { 'age': 1, 'active': true }); - * // => 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findKey(users, 'active'); - * // => 'barney' - */ - function findKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); - } - - /** - * This method is like `_.findKey` except that it iterates over elements of - * a collection in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findLastKey(users, function(o) { return o.age < 40; }); - * // => returns 'pebbles' assuming `_.findKey` returns 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.findLastKey(users, { 'age': 36, 'active': true }); - * // => 'barney' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findLastKey(users, 'active'); - * // => 'pebbles' - */ - function findLastKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); - } - - /** - * Iterates over own and inherited enumerable string keyed properties of an - * object and invokes `iteratee` for each property. The iteratee is invoked - * with three arguments: (value, key, object). Iteratee functions may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forInRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forIn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). - */ - function forIn(object, iteratee) { - return object == null - ? object - : baseFor(object, getIteratee(iteratee, 3), keysIn); - } - - /** - * This method is like `_.forIn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forIn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forInRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. - */ - function forInRight(object, iteratee) { - return object == null - ? object - : baseForRight(object, getIteratee(iteratee, 3), keysIn); - } - - /** - * Iterates over own enumerable string keyed properties of an object and - * invokes `iteratee` for each property. The iteratee is invoked with three - * arguments: (value, key, object). Iteratee functions may exit iteration - * early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwnRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forOwn(object, iteratee) { - return object && baseForOwn(object, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.forOwn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwnRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. - */ - function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, getIteratee(iteratee, 3)); - } - - /** - * Creates an array of function property names from own enumerable properties - * of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functionsIn - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functions(new Foo); - * // => ['a', 'b'] - */ - function functions(object) { - return object == null ? [] : baseFunctions(object, keys(object)); - } - - /** - * Creates an array of function property names from own and inherited - * enumerable properties of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functions - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functionsIn(new Foo); - * // => ['a', 'b', 'c'] - */ - function functionsIn(object) { - return object == null ? [] : baseFunctions(object, keysIn(object)); - } - - /** - * 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; - } - - /** - * Checks if `path` is a direct property of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @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 = { 'a': { 'b': 2 } }; - * var other = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.has(object, 'a'); - * // => true - * - * _.has(object, 'a.b'); - * // => true - * - * _.has(object, ['a', 'b']); - * // => true - * - * _.has(other, 'a'); - * // => false - */ - function has(object, path) { - return object != null && hasPath(object, path, baseHas); - } - - /** - * 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); - } - - /** - * Creates an object composed of the inverted keys and values of `object`. - * If `object` contains duplicate values, subsequent values overwrite - * property assignments of previous values. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Object - * @param {Object} object The object to invert. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invert(object); - * // => { '1': 'c', '2': 'b' } - */ - var invert = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - result[value] = key; - }, constant(identity)); - - /** - * This method is like `_.invert` except that the inverted object is generated - * from the results of running each element of `object` thru `iteratee`. The - * corresponding inverted value of each inverted key is an array of keys - * responsible for generating the inverted value. The iteratee is invoked - * with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Object - * @param {Object} object The object to invert. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invertBy(object); - * // => { '1': ['a', 'c'], '2': ['b'] } - * - * _.invertBy(object, function(value) { - * return 'group' + value; - * }); - * // => { 'group1': ['a', 'c'], 'group2': ['b'] } - */ - var invertBy = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - if (hasOwnProperty.call(result, value)) { - result[value].push(key); - } else { - result[value] = [key]; - } - }, getIteratee); - - /** - * Invokes the method at `path` of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {...*} [args] The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - * @example - * - * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; - * - * _.invoke(object, 'a[0].b.c.slice', 1, 3); - * // => [2, 3] - */ - var invoke = baseRest(baseInvoke); - - /** - * 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); - } - - /** - * 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); - } - - /** - * The opposite of `_.mapValues`; this method creates an object with the - * same values as `object` and keys 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 3.8.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 _.mapValues - * @example - * - * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { - * return key + value; - * }); - * // => { 'a1': 1, 'b2': 2 } - */ - function mapKeys(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - baseAssignValue(result, iteratee(value, key, object), value); - }); - return result; - } - - /** - * 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 = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - baseAssignValue(result, key, iteratee(value, key, object)); - }); - return result; - } - - /** - * This method is like `_.assign` except that it recursively merges own and - * inherited enumerable string keyed properties of source objects into the - * destination object. Source properties that resolve to `undefined` are - * skipped if a destination value exists. Array and plain object properties - * are merged recursively. Other objects and value types are overridden by - * assignment. Source objects are applied from left to right. Subsequent - * sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * var object = { - * 'a': [{ 'b': 2 }, { 'd': 4 }] - * }; - * - * var other = { - * 'a': [{ 'c': 3 }, { 'e': 5 }] - * }; - * - * _.merge(object, other); - * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } - */ - var merge = createAssigner(function(object, source, srcIndex) { - baseMerge(object, source, srcIndex); - }); - - /** - * This method is like `_.merge` except that it accepts `customizer` which - * is invoked to produce the merged values of the destination and source - * properties. If `customizer` returns `undefined`, merging is handled by the - * method instead. The `customizer` is invoked with six arguments: - * (objValue, srcValue, key, object, source, stack). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @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`. - * @example - * - * function customizer(objValue, srcValue) { - * if (_.isArray(objValue)) { - * return objValue.concat(srcValue); - * } - * } - * - * var object = { 'a': [1], 'b': [2] }; - * var other = { 'a': [3], 'b': [4] }; - * - * _.mergeWith(object, other, customizer); - * // => { 'a': [1, 3], 'b': [2, 4] } - */ - var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { - baseMerge(object, source, srcIndex, customizer); - }); - - /** - * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable property paths of `object` that are not omitted. - * - * **Note:** This method is considerably slower than `_.pick`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to omit. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omit(object, ['a', 'c']); - * // => { 'b': '2' } - */ - var omit = flatRest(function(object, paths) { - var result = {}; - if (object == null) { - return result; - } - var isDeep = false; - paths = arrayMap(paths, function(path) { - path = castPath(path, object); - isDeep || (isDeep = path.length > 1); - return path; - }); - copyObject(object, getAllKeysIn(object), result); - if (isDeep) { - result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); - } - var length = paths.length; - while (length--) { - baseUnset(result, paths[length]); - } - return result; - }); - - /** - * The opposite of `_.pickBy`; this method creates an object composed of - * the own and inherited enumerable string keyed properties of `object` that - * `predicate` doesn't return truthy for. The predicate is invoked with two - * arguments: (value, key). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The source object. - * @param {Function} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omitBy(object, _.isNumber); - * // => { 'b': '2' } - */ - function omitBy(object, predicate) { - return pickBy(object, negate(getIteratee(predicate))); - } - - /** - * Creates an object composed of the picked `object` properties. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pick(object, ['a', 'c']); - * // => { 'a': 1, 'c': 3 } - */ - var pick = flatRest(function(object, paths) { - return object == null ? {} : basePick(object, paths); - }); - - /** - * Creates an object composed of the `object` properties `predicate` returns - * truthy for. The predicate is invoked with two arguments: (value, key). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The source object. - * @param {Function} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pickBy(object, _.isNumber); - * // => { 'a': 1, 'c': 3 } - */ - function pickBy(object, predicate) { - if (object == null) { - return {}; - } - var props = arrayMap(getAllKeysIn(object), function(prop) { - return [prop]; - }); - predicate = getIteratee(predicate); - return basePickBy(object, props, function(value, path) { - return predicate(value, path[0]); - }); - } - - /** - * This method is like `_.get` except that if the resolved value is a - * function it's invoked with the `this` binding of its parent object and - * its result is returned. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to resolve. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; - * - * _.result(object, 'a[0].b.c1'); - * // => 3 - * - * _.result(object, 'a[0].b.c2'); - * // => 4 - * - * _.result(object, 'a[0].b.c3', 'default'); - * // => 'default' - * - * _.result(object, 'a[0].b.c3', _.constant('default')); - * // => 'default' - */ - function result(object, path, defaultValue) { - path = castPath(path, object); - - var index = -1, - length = path.length; - - // Ensure the loop is entered when path is empty. - if (!length) { - length = 1; - object = undefined; - } - while (++index < length) { - var value = object == null ? undefined : object[toKey(path[index])]; - if (value === undefined) { - index = length; - value = defaultValue; - } - object = isFunction(value) ? value.call(object) : value; - } - return object; - } - - /** - * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, - * it's created. Arrays are created for missing index properties while objects - * are created for all other missing properties. Use `_.setWith` to customize - * `path` creation. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.set(object, 'a[0].b.c', 4); - * console.log(object.a[0].b.c); - * // => 4 - * - * _.set(object, ['x', '0', 'y', 'z'], 5); - * console.log(object.x[0].y.z); - * // => 5 - */ - function set(object, path, value) { - return object == null ? object : baseSet(object, path, value); - } - - /** - * This method is like `_.set` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * var object = {}; - * - * _.setWith(object, '[0][1]', 'a', Object); - * // => { '0': { '1': 'a' } } - */ - function setWith(object, path, value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseSet(object, path, value, customizer); - } - - /** - * Creates an array of own enumerable string keyed-value pairs for `object` - * which can be consumed by `_.fromPairs`. If `object` is a map or set, its - * entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entries - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairs(new Foo); - * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) - */ - var toPairs = createToPairs(keys); - - /** - * Creates an array of own and inherited enumerable string keyed-value pairs - * for `object` which can be consumed by `_.fromPairs`. If `object` is a map - * or set, its entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entriesIn - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairsIn(new Foo); - * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) - */ - var toPairsIn = createToPairs(keysIn); - - /** - * An alternative to `_.reduce`; this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own - * enumerable string keyed properties thru `iteratee`, with each invocation - * potentially mutating the `accumulator` object. If `accumulator` is not - * provided, a new object with the same `[[Prototype]]` will be used. The - * iteratee is invoked with four arguments: (accumulator, value, key, object). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @returns {*} Returns the accumulated value. - * @example - * - * _.transform([2, 3, 4], function(result, n) { - * result.push(n *= n); - * return n % 2 == 0; - * }, []); - * // => [4, 9] - * - * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } - */ - function transform(object, iteratee, accumulator) { - var isArr = isArray(object), - isArrLike = isArr || isBuffer(object) || isTypedArray(object); - - iteratee = getIteratee(iteratee, 4); - if (accumulator == null) { - var Ctor = object && object.constructor; - if (isArrLike) { - accumulator = isArr ? new Ctor : []; - } - else if (isObject(object)) { - accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; - } - else { - accumulator = {}; - } - } - (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { - return iteratee(accumulator, value, index, object); - }); - return accumulator; - } - - /** - * Removes the property at `path` of `object`. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 7 } }] }; - * _.unset(object, 'a[0].b.c'); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - * - * _.unset(object, ['a', '0', 'b', 'c']); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - */ - function unset(object, path) { - return object == null ? true : baseUnset(object, path); - } - - /** - * This method is like `_.set` except that accepts `updater` to produce the - * value to set. Use `_.updateWith` to customize `path` creation. The `updater` - * is invoked with one argument: (value). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {Function} updater The function to produce the updated value. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.update(object, 'a[0].b.c', function(n) { return n * n; }); - * console.log(object.a[0].b.c); - * // => 9 - * - * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); - * console.log(object.x[0].y.z); - * // => 0 - */ - function update(object, path, updater) { - return object == null ? object : baseUpdate(object, path, castFunction(updater)); - } - - /** - * This method is like `_.update` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * var object = {}; - * - * _.updateWith(object, '[0][1]', _.constant('a'), Object); - * // => { '0': { '1': 'a' } } - */ - function updateWith(object, path, updater, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); - } - - /** - * Creates an array of the own enumerable string keyed property values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.values(new Foo); - * // => [1, 2] (iteration order is not guaranteed) - * - * _.values('hi'); - * // => ['h', 'i'] - */ - function values(object) { - return object == null ? [] : baseValues(object, keys(object)); - } - - /** - * Creates an array of the own and inherited enumerable string keyed property - * values 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 values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.valuesIn(new Foo); - * // => [1, 2, 3] (iteration order is not guaranteed) - */ - function valuesIn(object) { - return object == null ? [] : baseValues(object, keysIn(object)); - } - - /*------------------------------------------------------------------------*/ - - /** - * Clamps `number` within the inclusive `lower` and `upper` bounds. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Number - * @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. - * @example - * - * _.clamp(-10, -5, 5); - * // => -5 - * - * _.clamp(10, -5, 5); - * // => 5 - */ - function clamp(number, lower, upper) { - if (upper === undefined) { - upper = lower; - lower = undefined; - } - if (upper !== undefined) { - upper = toNumber(upper); - upper = upper === upper ? upper : 0; - } - if (lower !== undefined) { - lower = toNumber(lower); - lower = lower === lower ? lower : 0; - } - return baseClamp(toNumber(number), lower, upper); - } - - /** - * Checks if `n` is between `start` and up to, but not including, `end`. If - * `end` is not specified, it's set to `start` with `start` then set to `0`. - * If `start` is greater than `end` the params are swapped to support - * negative ranges. - * - * @static - * @memberOf _ - * @since 3.3.0 - * @category Number - * @param {number} number The number to check. - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - * @see _.range, _.rangeRight - * @example - * - * _.inRange(3, 2, 4); - * // => true - * - * _.inRange(4, 8); - * // => true - * - * _.inRange(4, 2); - * // => false - * - * _.inRange(2, 2); - * // => false - * - * _.inRange(1.2, 2); - * // => true - * - * _.inRange(5.2, 4); - * // => false - * - * _.inRange(-3, -2, -6); - * // => true - */ - function inRange(number, start, end) { - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - number = toNumber(number); - return baseInRange(number, start, end); - } - - /** - * Produces a random number between the inclusive `lower` and `upper` bounds. - * If only one argument is provided a number between `0` and the given number - * is returned. If `floating` is `true`, or either `lower` or `upper` are - * floats, a floating-point number is returned instead of an integer. - * - * **Note:** JavaScript follows the IEEE-754 standard for resolving - * floating-point values which can produce unexpected results. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Number - * @param {number} [lower=0] The lower bound. - * @param {number} [upper=1] The upper bound. - * @param {boolean} [floating] Specify returning a floating-point number. - * @returns {number} Returns the random number. - * @example - * - * _.random(0, 5); - * // => an integer between 0 and 5 - * - * _.random(5); - * // => also an integer between 0 and 5 - * - * _.random(5, true); - * // => a floating-point number between 0 and 5 - * - * _.random(1.2, 5.2); - * // => a floating-point number between 1.2 and 5.2 - */ - function random(lower, upper, floating) { - if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { - upper = floating = undefined; - } - if (floating === undefined) { - if (typeof upper == 'boolean') { - floating = upper; - upper = undefined; - } - else if (typeof lower == 'boolean') { - floating = lower; - lower = undefined; - } - } - if (lower === undefined && upper === undefined) { - lower = 0; - upper = 1; - } - else { - lower = toFinite(lower); - if (upper === undefined) { - upper = lower; - lower = 0; - } else { - upper = toFinite(upper); - } - } - if (lower > upper) { - var temp = lower; - lower = upper; - upper = temp; - } - if (floating || lower % 1 || upper % 1) { - var rand = nativeRandom(); - return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); - } - return baseRandom(lower, upper); - } - - /*------------------------------------------------------------------------*/ - - /** - * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the camel cased string. - * @example - * - * _.camelCase('Foo Bar'); - * // => 'fooBar' - * - * _.camelCase('--foo-bar--'); - * // => 'fooBar' - * - * _.camelCase('__FOO_BAR__'); - * // => 'fooBar' - */ - var camelCase = createCompounder(function(result, word, index) { - word = word.toLowerCase(); - return result + (index ? capitalize(word) : word); - }); - - /** - * Converts the first character of `string` to upper case and the remaining - * to lower case. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to capitalize. - * @returns {string} Returns the capitalized string. - * @example - * - * _.capitalize('FRED'); - * // => 'Fred' - */ - function capitalize(string) { - return upperFirst(toString(string).toLowerCase()); - } - - /** - * Deburrs `string` by converting - * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) - * letters to basic Latin letters and removing - * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the deburred string. - * @example - * - * _.deburr('déjà vu'); - * // => 'deja vu' - */ - function deburr(string) { - string = toString(string); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); - } - - /** - * Checks if `string` ends 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=string.length] The position to search up to. - * @returns {boolean} Returns `true` if `string` ends with `target`, - * else `false`. - * @example - * - * _.endsWith('abc', 'c'); - * // => true - * - * _.endsWith('abc', 'b'); - * // => false - * - * _.endsWith('abc', 'b', 2); - * // => true - */ - function endsWith(string, target, position) { - string = toString(string); - target = baseToString(target); - - var length = string.length; - position = position === undefined - ? length - : baseClamp(toInteger(position), 0, length); - - var end = position; - position -= target.length; - return position >= 0 && string.slice(position, end) == target; - } - - /** - * Converts the characters "&", "<", ">", '"', and "'" in `string` to their - * corresponding HTML entities. - * - * **Note:** No other characters are escaped. To escape additional - * characters use a third-party library like [_he_](https://mths.be/he). - * - * Though the ">" character is escaped for symmetry, characters like - * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. See - * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) - * (under "semi-related fun fact") for more details. - * - * When working with HTML you should always - * [quote attribute values](http://wonko.com/post/html-escaping) to reduce - * XSS vectors. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('fred, barney, & pebbles'); - * // => 'fred, barney, & pebbles' - */ - function escape(string) { - string = toString(string); - return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; - } - - /** - * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", - * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escapeRegExp('[lodash](https://lodash.com/)'); - * // => '\[lodash\]\(https://lodash\.com/\)' - */ - function escapeRegExp(string) { - string = toString(string); - return (string && reHasRegExpChar.test(string)) - ? string.replace(reRegExpChar, '\\$&') - : string; - } - - /** - * Converts `string` to - * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the kebab cased string. - * @example - * - * _.kebabCase('Foo Bar'); - * // => 'foo-bar' - * - * _.kebabCase('fooBar'); - * // => 'foo-bar' - * - * _.kebabCase('__FOO_BAR__'); - * // => 'foo-bar' - */ - var kebabCase = createCompounder(function(result, word, index) { - return result + (index ? '-' : '') + word.toLowerCase(); - }); - - /** - * Converts `string`, as space separated words, to lower case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the lower cased string. - * @example - * - * _.lowerCase('--Foo-Bar--'); - * // => 'foo bar' - * - * _.lowerCase('fooBar'); - * // => 'foo bar' - * - * _.lowerCase('__FOO_BAR__'); - * // => 'foo bar' - */ - var lowerCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + word.toLowerCase(); - }); - - /** - * Converts the first character of `string` to lower case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.lowerFirst('Fred'); - * // => 'fred' - * - * _.lowerFirst('FRED'); - * // => 'fRED' - */ - var lowerFirst = createCaseFirst('toLowerCase'); - - /** - * Pads `string` on the left and right sides if it's shorter than `length`. - * Padding characters are truncated if they can't be evenly divided by `length`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.pad('abc', 8); - * // => ' abc ' - * - * _.pad('abc', 8, '_-'); - * // => '_-abc_-_' - * - * _.pad('abc', 3); - * // => 'abc' - */ - function pad(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - if (!length || strLength >= length) { - return string; - } - var mid = (length - strLength) / 2; - return ( - createPadding(nativeFloor(mid), chars) + - string + - createPadding(nativeCeil(mid), chars) - ); - } - - /** - * Pads `string` on the right side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padEnd('abc', 6); - * // => 'abc ' - * - * _.padEnd('abc', 6, '_-'); - * // => 'abc_-_' - * - * _.padEnd('abc', 3); - * // => 'abc' - */ - function padEnd(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - return (length && strLength < length) - ? (string + createPadding(length - strLength, chars)) - : string; - } - - /** - * Pads `string` on the left side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padStart('abc', 6); - * // => ' abc' - * - * _.padStart('abc', 6, '_-'); - * // => '_-_abc' - * - * _.padStart('abc', 3); - * // => 'abc' - */ - function padStart(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - return (length && strLength < length) - ? (createPadding(length - strLength, chars) + string) - : string; - } - - /** - * Converts `string` to an integer of the specified radix. If `radix` is - * `undefined` or `0`, a `radix` of `10` is used unless `value` is a - * hexadecimal, in which case a `radix` of `16` is used. - * - * **Note:** This method aligns with the - * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category String - * @param {string} string The string to convert. - * @param {number} [radix=10] The radix to interpret `value` by. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {number} Returns the converted integer. - * @example - * - * _.parseInt('08'); - * // => 8 - * - * _.map(['6', '08', '10'], _.parseInt); - * // => [6, 8, 10] - */ - function parseInt(string, radix, guard) { - if (guard || radix == null) { - radix = 0; - } else if (radix) { - radix = +radix; - } - return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); - } - - /** - * Repeats the given string `n` times. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to repeat. - * @param {number} [n=1] The number of times to repeat the string. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {string} Returns the repeated string. - * @example - * - * _.repeat('*', 3); - * // => '***' - * - * _.repeat('abc', 2); - * // => 'abcabc' - * - * _.repeat('abc', 0); - * // => '' - */ - function repeat(string, n, guard) { - if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { - n = 1; - } else { - n = toInteger(n); - } - return baseRepeat(toString(string), n); - } - - /** - * Replaces matches for `pattern` in `string` with `replacement`. - * - * **Note:** This method is based on - * [`String#replace`](https://mdn.io/String/replace). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to modify. - * @param {RegExp|string} pattern The pattern to replace. - * @param {Function|string} replacement The match replacement. - * @returns {string} Returns the modified string. - * @example - * - * _.replace('Hi Fred', 'Fred', 'Barney'); - * // => 'Hi Barney' - */ - function replace() { - var args = arguments, - string = toString(args[0]); - - return args.length < 3 ? string : string.replace(args[1], args[2]); - } - - /** - * Converts `string` to - * [snake case](https://en.wikipedia.org/wiki/Snake_case). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the snake cased string. - * @example - * - * _.snakeCase('Foo Bar'); - * // => 'foo_bar' - * - * _.snakeCase('fooBar'); - * // => 'foo_bar' - * - * _.snakeCase('--FOO-BAR--'); - * // => 'foo_bar' - */ - var snakeCase = createCompounder(function(result, word, index) { - return result + (index ? '_' : '') + word.toLowerCase(); - }); - - /** - * Splits `string` by `separator`. - * - * **Note:** This method is based on - * [`String#split`](https://mdn.io/String/split). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to split. - * @param {RegExp|string} separator The separator pattern to split by. - * @param {number} [limit] The length to truncate results to. - * @returns {Array} Returns the string segments. - * @example - * - * _.split('a-b-c', '-', 2); - * // => ['a', 'b'] - */ - function split(string, separator, limit) { - if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { - separator = limit = undefined; - } - limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; - if (!limit) { - return []; - } - string = toString(string); - if (string && ( - typeof separator == 'string' || - (separator != null && !isRegExp(separator)) - )) { - separator = baseToString(separator); - if (!separator && hasUnicode(string)) { - return castSlice(stringToArray(string), 0, limit); - } - } - return string.split(separator, limit); - } - - /** - * Converts `string` to - * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). - * - * @static - * @memberOf _ - * @since 3.1.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the start cased string. - * @example - * - * _.startCase('--foo-bar--'); - * // => 'Foo Bar' - * - * _.startCase('fooBar'); - * // => 'Foo Bar' - * - * _.startCase('__FOO_BAR__'); - * // => 'FOO BAR' - */ - var startCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + upperFirst(word); - }); - - /** - * 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; - } - - /** - * Creates a compiled template function that can interpolate data properties - * in "interpolate" delimiters, HTML-escape interpolated data properties in - * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data - * properties may be accessed as free variables in the template. If a setting - * object is given, it takes precedence over `_.templateSettings` values. - * - * **Note:** In the development build `_.template` utilizes - * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) - * for easier debugging. - * - * For more information on precompiling templates see - * [lodash's custom builds documentation](https://lodash.com/custom-builds). - * - * For more information on Chrome extension sandboxes see - * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The template string. - * @param {Object} [options={}] The options object. - * @param {RegExp} [options.escape=_.templateSettings.escape] - * The HTML "escape" delimiter. - * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] - * The "evaluate" delimiter. - * @param {Object} [options.imports=_.templateSettings.imports] - * An object to import into the template as free variables. - * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] - * The "interpolate" delimiter. - * @param {string} [options.sourceURL='lodash.templateSources[n]'] - * The sourceURL of the compiled template. - * @param {string} [options.variable='obj'] - * The data object variable name. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the compiled template function. - * @example - * - * // Use the "interpolate" delimiter to create a compiled template. - * var compiled = _.template('hello <%= user %>!'); - * compiled({ 'user': 'fred' }); - * // => 'hello fred!' - * - * // Use the HTML "escape" delimiter to escape data property values. - * var compiled = _.template('<%- value %>'); - * compiled({ 'value': ' - - - - - - - - - - - - -
- -
- - -
-
-
Feature: Simple maths - In order to do maths - As a developer - I want to increment variables - - Scenario: easy maths - Given a variable set to 1 - When I increment the variable by 1 - Then the variable should contain 2 - - Scenario Outline: much more complex stuff - Given a variable set to <var> - When I increment the variable by <increment> - Then the variable should contain <result> - - Examples: - | var | increment | result | - | 100 | 5 | 105 | - | 99 | 1234 | 1333 | - | 12 | 5 | 18 |
-
-
-
// Cucumber and chai have been loaded in the browser -var setWorldConstructor = Cucumber.setWorldConstructor; -var Given = Cucumber.Given; -var When = Cucumber.When; -var Then = Cucumber.Then; -var expect = chai.expect; - -///// World ///// -// -// Call 'setWorldConstructor' with to your custom world (optional) -// - -var CustomWorld = function() { - this.variable = 0; -}; - -CustomWorld.prototype.setTo = function(number) { - this.variable = parseInt(number); -}; - -CustomWorld.prototype.incrementBy = function(number) { - this.variable += parseInt(number); -}; - -setWorldConstructor(CustomWorld); - -///// Step definitions ///// -// -// use 'Given', 'When' and 'Then' to declare step definitions -// - -Given('a variable set to {int}', function(number) { - this.setTo(number); -}); - -When('I increment the variable by {int}', function(number) { - this.incrementBy(number); -}); - -Then('the variable should contain {int}', function(number) { - expect(this.variable).to.eql(number) -}); -
-
-
-

-        
-
-
- - - - diff --git a/example/index.ts b/example/index.ts deleted file mode 100644 index e8532643b..000000000 --- a/example/index.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { EventEmitter } from 'events' -import ansiHTML from 'ansi-html' -import { GherkinStreams } from '@cucumber/gherkin' -import { messages, IdGenerator } from '@cucumber/messages' - -declare var Cucumber: any -declare var $: any -declare var ace: any -declare var window: any - -const { uuid } = IdGenerator - -let featureEditor: any, stepDefinitionsEditor: any, $output: any - -async function runFeature(): Promise { - $output.empty() - $('a[href="#output-tab"]').tab('show') - - const eventBroadcaster = new EventEmitter() - const eventDataCollector = new Cucumber.formatterHelpers.EventDataCollector( - eventBroadcaster - ) - - const newId = uuid() - const gherkinMessageStream = GherkinStreams.fromSources( - [ - messages.Envelope.fromObject({ - source: { - data: featureEditor.getValue(), - uri: 'example.feature', - }, - }), - ], - { newId } - ) - const pickleIds = Cucumber.parseGherkinMessageStream({ - cwd: '', - eventBroadcaster, - eventDataCollector, - gherkinMessageStream, - pickleFilter: new Cucumber.PickleFilter({ cwd: '' }), - order: 'defined', - }) - - Cucumber.supportCodeLibraryBuilder.reset('', newId) - new Function(stepDefinitionsEditor.getValue())() // eslint-disable-line no-new-func, @typescript-eslint/no-implied-eval - const supportCodeLibrary = await Cucumber.supportCodeLibraryBuilder.finalize() - - const formatterOptions = { - cwd: '/', - eventBroadcaster, - eventDataCollector, - parsedArgvOptions: { - colorsEnabled: true, - }, - log(data: string) { - appendToOutput(ansiHTML(data)) - }, - supportCodeLibrary, - } - Cucumber.FormatterBuilder.build('progress', formatterOptions) - - const runtime = new Cucumber.Runtime({ - eventBroadcaster, - eventDataCollector, - newId, - options: {}, - pickleIds, - supportCodeLibrary, - }) - return runtime.start() -} - -function appendToOutput(data: string): void { - $output.append(data) - $output.scrollTop($output.prop('scrollHeight')) -} - -function displayError(error: Error): void { - const errorContainer = $('
') - errorContainer.addClass('error').text(error.stack) - appendToOutput(errorContainer) -} - -$(() => { - featureEditor = ace.edit('feature') - featureEditor.getSession().setMode('ace/mode/gherkin') - - stepDefinitionsEditor = ace.edit('step-definitions') - stepDefinitionsEditor.getSession().setMode('ace/mode/javascript') - - $output = $('#output') - - window.onerror = displayError - - $('#run-feature').click(() => { - runFeature() - .then((success) => { - const exitStatus = success ? '0' : '1' - const exitStatusContainer = $('
') - exitStatusContainer - .addClass('exit-status') - .text(`Exit Status: ${exitStatus}`) - appendToOutput(exitStatusContainer) - }) - .catch(displayError) - }) -}) diff --git a/example/types/ansi-html/index.d.ts b/example/types/ansi-html/index.d.ts deleted file mode 100644 index 4f6b921fd..000000000 --- a/example/types/ansi-html/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'ansi-html' { - export default function (input: string): string -} diff --git a/package.json b/package.json index a1936fe01..f7a79e312 100644 --- a/package.json +++ b/package.json @@ -223,12 +223,9 @@ "@types/verror": "1.10.4", "@typescript-eslint/eslint-plugin": "4.8.2", "@typescript-eslint/parser": "4.8.2", - "ansi-html": "0.0.7", - "browserify": "16.5.2", "chai": "4.2.0", "chai-exclude": "2.0.2", "coffeescript": "2.5.1", - "connect": "3.7.0", "core-js": "3.8.1", "coveralls": "3.1.0", "dependency-lint": "6.0.0", @@ -250,19 +247,15 @@ "prettier": "2.1.2", "regenerator-runtime": "0.13.7", "semver": "7.3.4", - "serve-static": "1.14.1", "sinon": "9.2.1", "sinon-chai": "3.5.0", "stream-buffers": "3.0.2", "stream-to-string": "1.2.0", "ts-node": "9.0.0", - "tsify": "5.0.2", "typescript": "4.0.5" }, "scripts": { - "build-browser-example": "browserify example/index.ts -o dist/browser-example.js -p [ tsify -p tsconfig.browser.json ]", "build-local": "tsc -p tsconfig.node.json", - "build-release": "browserify scripts/cucumber.ts -o dist/cucumber.js -p [ tsify -p tsconfig.browser.json ] --standalone Cucumber --debug", "cck-test": "mocha 'compatibility/**/*_spec.ts'", "feature-test": "node ./bin/cucumber-js", "html-formatter": "node ./bin/cucumber-js --profile htmlFormatter", @@ -275,7 +268,6 @@ "precck-test": "yarn run build-local", "prefeature-test": "yarn run build-local", "prepublishOnly": "rm -rf lib && npm run build-local", - "test-browser-example": "yarn build-release && yarn build-browser-example && git checkout -- dist/cucumber.js", "test-coverage": "yarn run lint && ./scripts/test-coverage.sh", "test": "yarn run lint && yarn run unit-test && yarn run cck-test && yarn run feature-test", "unit-test": "mocha 'src/**/*_spec.ts'", @@ -287,7 +279,6 @@ "license": "MIT", "files": [ "bin/", - "dist/", "lib/" ] } diff --git a/scripts/deploy.sh b/scripts/deploy.sh deleted file mode 100755 index 25e3eff1e..000000000 --- a/scripts/deploy.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Build example, remove source -yarn build-browser-example -rm example/index.js - -# Copy resources -rsync -a dist/ example/ - -# Publish to gh-pages -cd example -git init -git config user.name "Travis CI" -git config user.email "charles.rudolph@originate.com" -git add . -git commit -m "Deploy to GitHub Pages" -git push -f "https://${GITHUB_AUTH_TOKEN}@github.com/cucumber/cucumber-js.git" master:gh-pages diff --git a/scripts/server.js b/scripts/server.js deleted file mode 100644 index 7a8e36918..000000000 --- a/scripts/server.js +++ /dev/null @@ -1,14 +0,0 @@ -const path = require('path') -const http = require('http') -const connect = require('connect') -const serveStatic = require('serve-static') - -const port = process.env.PORT || 9797 -const app = connect() -app.use(serveStatic(path.join(__dirname, '..', 'example'))) -app.use(serveStatic(path.join(__dirname, '..', 'dist'))) - -http.createServer(app).listen(port) -/* eslint-disable no-console */ -console.log(`Accepting connections on port ${port}...`) -/* eslint-enable no-console */ diff --git a/tsconfig.browser.json b/tsconfig.browser.json deleted file mode 100644 index b49a87f48..000000000 --- a/tsconfig.browser.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "lib": ["es6", "dom"], - "target": "es5", - "downlevelIteration": true, - "typeRoots": [ - "./node_modules/@types", - "./src/types", - "./example/types" - ] - } -} diff --git a/yarn.lock b/yarn.lock index 1ceceb4b6..8735d0180 100644 --- a/yarn.lock +++ b/yarn.lock @@ -519,9 +519,9 @@ integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== "@types/connect@*": - version "3.4.33" - resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.33.tgz#31610c901eca573b8713c3330abc6e6b9f588546" - integrity sha512-2+FrkXY4zllzTNfJth7jOqEHC+enpLeGslEhpnTAkg21GkRrWV4SsAtqchtT4YS9/nODBU2/ZfsBY2X4J/dX7A== + version "3.4.34" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.34.tgz#170a40223a6d666006d93ca128af2beb1d9b1901" + integrity sha512-ePPA/JuI+X0vb+gSWlPKOY0NdNAie/rPUqX2GUPpbZwiKTkSPhjXWuee47E4MtE54QVzGCQMQkAL6JhV2E1+cQ== dependencies: "@types/node" "*" @@ -539,9 +539,9 @@ integrity sha512-7xUGaa0HqDmfawyFd8ANaoTHt5KF/BEdvKfqz4NxGEhbloIXGGtH065MOvC+YYQRZPAA/b5Vt/Xe5AmXoKTmhQ== "@types/express-serve-static-core@*": - version "4.17.12" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.12.tgz#9a487da757425e4f267e7d1c5720226af7f89591" - integrity sha512-EaEdY+Dty1jEU7U6J4CUWwxL+hyEGMkO5jan5gplfegUgCUsIUWqXxqw47uGjimeT4Qgkz/XUfwoau08+fgvKA== + version "4.17.15" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.15.tgz#7c3d37829a991da9a507c1efd44d97532e8909e3" + integrity sha512-pb71P0BrBAx7cQE+/7QnA1HTQUkdBKMlkPY7lHUMn0YvPJkL2UA+KW3BdWQ309IT+i9En/qm45ZxpjIcpgEhNQ== dependencies: "@types/node" "*" "@types/qs" "*" @@ -642,9 +642,9 @@ "@types/node" "*" "@types/qs@*": - version "6.9.4" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.4.tgz#a59e851c1ba16c0513ea123830dd639a0a15cb6a" - integrity sha512-+wYo+L6ZF6BMoEjtf8zB2esQsqdV6WsjRK/GP9WOgLPrq87PbNWgIxS76dS5uvl/QXtHGakZmwTznIfcPXcKlQ== + version "6.9.5" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.5.tgz#434711bdd49eb5ee69d90c1d67c354a9a8ecb18b" + integrity sha512-/JHkVHtx/REVG0VVToGRGH2+23hsYLHdyG+GrvoUGlGAd0ErauXDyvHtRI/7H7mzLm+tBCKA7pfcpkQ1lf58iQ== "@types/range-parser@*": version "1.2.3" @@ -664,12 +664,12 @@ integrity sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ== "@types/serve-static@*": - version "1.13.5" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.5.tgz#3d25d941a18415d3ab092def846e135a08bbcf53" - integrity sha512-6M64P58N+OXjU432WoLLBQxbA0LRGBCRm7aAGQJ+SMC1IMl0dgRVi9EFfoDcS2a7Xogygk/eGN94CfwU9UF7UQ== + version "1.13.8" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.8.tgz#851129d434433c7082148574ffec263d58309c46" + integrity sha512-MoJhSQreaVoL+/hurAZzIm8wafFR6ajiTM1m4A0kv6AGeVBl4r4pOV8bGFrjjq1sGxDTnCoF8i22o0/aE5XCyA== dependencies: - "@types/express-serve-static-core" "*" "@types/mime" "*" + "@types/node" "*" "@types/sinon-chai@3.2.5": version "3.2.5" @@ -793,14 +793,6 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== -JSONStream@^1.0.3: - version "1.3.5" - resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" - integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== - dependencies: - jsonparse "^1.2.0" - through ">=2.2.7 <3" - accepts@~1.3.7: version "1.3.7" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" @@ -814,7 +806,7 @@ acorn-jsx@^5.2.0: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== -acorn-node@^1.2.0, acorn-node@^1.3.0, acorn-node@^1.5.2, acorn-node@^1.6.1: +acorn-node@^1.6.1: version "1.8.2" resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.8.2.tgz#114c95d64539e53dede23de8b9d96df7c7ae2af8" integrity sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A== @@ -856,11 +848,6 @@ ansi-colors@4.1.1, ansi-colors@^4.1.1: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== -ansi-html@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" - integrity sha1-gTWEAhliqenm/QOflA0S9WynhZ4= - ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" @@ -898,7 +885,7 @@ ansi-to-html@^0.6.14: dependencies: entities "^1.1.2" -any-promise@^1.0.0, any-promise@^1.3.0: +any-promise@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= @@ -962,16 +949,6 @@ array.prototype.flat@^1.2.3: define-properties "^1.1.3" es-abstract "^1.17.0-next.1" -asn1.js@^5.2.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" - integrity sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA== - dependencies: - bn.js "^4.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - safer-buffer "^2.1.0" - asn1@~0.2.3: version "0.2.4" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" @@ -984,14 +961,6 @@ assert-plus@1.0.0, assert-plus@^1.0.0: resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= -assert@^1.4.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb" - integrity sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA== - dependencies: - object-assign "^4.1.1" - util "0.10.3" - assertion-error-formatter@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/assertion-error-formatter/-/assertion-error-formatter-3.0.0.tgz#be9c8825dee6a8a6c72183d915912d9b57d5d265" @@ -1036,11 +1005,6 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -base64-js@^1.0.2: - version "1.3.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" - integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== - bcrypt-pbkdf@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" @@ -1063,16 +1027,6 @@ bluebird@^3.4.3, bluebird@^3.7.2: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.4.0: - version "4.11.9" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" - integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw== - -bn.js@^5.1.1: - version "5.1.3" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b" - integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ== - body-parser@1.19.0: version "1.19.0" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" @@ -1104,188 +1058,26 @@ braces@^3.0.1, braces@~3.0.2: dependencies: fill-range "^7.0.1" -brorand@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= - -browser-pack@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-6.1.0.tgz#c34ba10d0b9ce162b5af227c7131c92c2ecd5774" - integrity sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA== - dependencies: - JSONStream "^1.0.3" - combine-source-map "~0.8.0" - defined "^1.0.0" - safe-buffer "^5.1.1" - through2 "^2.0.0" - umd "^3.0.0" - -browser-resolve@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-2.0.0.tgz#99b7304cb392f8d73dba741bb2d7da28c6d7842b" - integrity sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ== - dependencies: - resolve "^1.17.0" - browser-stdout@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -browserify-aes@^1.0.0, browserify-aes@^1.0.4: - version "1.2.0" - resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" - integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== - dependencies: - buffer-xor "^1.0.3" - cipher-base "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.3" - inherits "^2.0.1" - safe-buffer "^5.0.1" - -browserify-cipher@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" - integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== - dependencies: - browserify-aes "^1.0.4" - browserify-des "^1.0.0" - evp_bytestokey "^1.0.0" - -browserify-des@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" - integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== - dependencies: - cipher-base "^1.0.1" - des.js "^1.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -browserify-rsa@^4.0.0, browserify-rsa@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" - integrity sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= - dependencies: - bn.js "^4.1.0" - randombytes "^2.0.1" - -browserify-sign@^4.0.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.1.tgz#eaf4add46dd54be3bb3b36c0cf15abbeba7956c3" - integrity sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg== - dependencies: - bn.js "^5.1.1" - browserify-rsa "^4.0.1" - create-hash "^1.2.0" - create-hmac "^1.1.7" - elliptic "^6.5.3" - inherits "^2.0.4" - parse-asn1 "^5.1.5" - readable-stream "^3.6.0" - safe-buffer "^5.2.0" - -browserify-zlib@~0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f" - integrity sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA== - dependencies: - pako "~1.0.5" - -browserify@16.5.2: - version "16.5.2" - resolved "https://registry.yarnpkg.com/browserify/-/browserify-16.5.2.tgz#d926835e9280fa5fd57f5bc301f2ef24a972ddfe" - integrity sha512-TkOR1cQGdmXU9zW4YukWzWVSJwrxmNdADFbqbE3HFgQWe5wqZmOawqZ7J/8MPCwk/W8yY7Y0h+7mOtcZxLP23g== - dependencies: - JSONStream "^1.0.3" - assert "^1.4.0" - browser-pack "^6.0.1" - browser-resolve "^2.0.0" - browserify-zlib "~0.2.0" - buffer "~5.2.1" - cached-path-relative "^1.0.0" - concat-stream "^1.6.0" - console-browserify "^1.1.0" - constants-browserify "~1.0.0" - crypto-browserify "^3.0.0" - defined "^1.0.0" - deps-sort "^2.0.0" - domain-browser "^1.2.0" - duplexer2 "~0.1.2" - events "^2.0.0" - glob "^7.1.0" - has "^1.0.0" - htmlescape "^1.1.0" - https-browserify "^1.0.0" - inherits "~2.0.1" - insert-module-globals "^7.0.0" - labeled-stream-splicer "^2.0.0" - mkdirp-classic "^0.5.2" - module-deps "^6.2.3" - os-browserify "~0.3.0" - parents "^1.0.1" - path-browserify "~0.0.0" - process "~0.11.0" - punycode "^1.3.2" - querystring-es3 "~0.2.0" - read-only-stream "^2.0.0" - readable-stream "^2.0.2" - resolve "^1.1.4" - shasum "^1.0.0" - shell-quote "^1.6.1" - stream-browserify "^2.0.0" - stream-http "^3.0.0" - string_decoder "^1.1.1" - subarg "^1.0.0" - syntax-error "^1.1.1" - through2 "^2.0.0" - timers-browserify "^1.0.1" - tty-browserify "0.0.1" - url "~0.11.0" - util "~0.10.1" - vm-browserify "^1.0.0" - xtend "^4.0.0" - buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== -buffer-xor@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= - -buffer@~5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.2.1.tgz#dd57fa0f109ac59c602479044dca7b8b3d0b71d6" - integrity sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg== - dependencies: - base64-js "^1.0.2" - ieee754 "^1.1.4" - builtin-modules@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== -builtin-status-codes@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" - integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= - bytes@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== -cached-path-relative@^1.0.0, cached-path-relative@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.2.tgz#a13df4196d26776220cc3356eb147a52dba2c6db" - integrity sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg== - caching-transform@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-4.0.0.tgz#00d297a4206d71e2163c39eaffa8157ac0651f0f" @@ -1389,14 +1181,6 @@ chokidar@3.4.3: optionalDependencies: fsevents "~2.1.2" -cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" - integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" @@ -1480,16 +1264,6 @@ colors@^1.0.3, colors@^1.1.2, colors@^1.4.0: resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== -combine-source-map@^0.8.0, combine-source-map@~0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.8.0.tgz#a58d0df042c186fcf822a8e8015f5450d2d79a8b" - integrity sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos= - dependencies: - convert-source-map "~1.1.0" - inline-source-map "~0.6.0" - lodash.memoize "~3.0.3" - source-map "~0.5.3" - combined-stream@^1.0.6, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -1512,36 +1286,6 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -concat-stream@^1.6.0, concat-stream@^1.6.1, concat-stream@~1.6.0: - version "1.6.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" - integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -connect@3.7.0: - version "3.7.0" - resolved "https://registry.yarnpkg.com/connect/-/connect-3.7.0.tgz#5d49348910caa5e07a01800b030d0c35f20484f8" - integrity sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ== - dependencies: - debug "2.6.9" - finalhandler "1.1.2" - parseurl "~1.3.3" - utils-merge "1.0.1" - -console-browserify@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" - integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA== - -constants-browserify@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" - integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= - contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" @@ -1559,18 +1303,13 @@ content-type@~1.0.4: resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== -convert-source-map@^1.1.0, convert-source-map@^1.7.0: +convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== dependencies: safe-buffer "~5.1.1" -convert-source-map@~1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.1.3.tgz#4829c877e9fe49b3161f3bf3673888e204699860" - integrity sha1-SCnId+n+SbMWHzvzZziI4gRpmGA= - cookie-signature@1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" @@ -1591,7 +1330,7 @@ core-js@^2.6.5: resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== -core-util-is@1.0.2, core-util-is@~1.0.0: +core-util-is@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= @@ -1607,37 +1346,6 @@ coveralls@3.1.0: minimist "^1.2.5" request "^2.88.2" -create-ecdh@^4.0.0: - version "4.0.4" - resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" - integrity sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A== - dependencies: - bn.js "^4.1.0" - elliptic "^6.5.3" - -create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" - integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - md5.js "^1.3.4" - ripemd160 "^2.0.1" - sha.js "^2.4.0" - -create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" - integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== - dependencies: - cipher-base "^1.0.3" - create-hash "^1.1.0" - inherits "^2.0.1" - ripemd160 "^2.0.0" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - create-require@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" @@ -1652,23 +1360,6 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2: shebang-command "^2.0.0" which "^2.0.1" -crypto-browserify@^3.0.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" - integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== - dependencies: - browserify-cipher "^1.0.0" - browserify-sign "^4.0.0" - create-ecdh "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.0" - diffie-hellman "^5.0.0" - inherits "^2.0.1" - pbkdf2 "^3.0.3" - public-encrypt "^4.0.0" - randombytes "^2.0.0" - randomfill "^1.0.3" - d@1, d@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" @@ -1677,11 +1368,6 @@ d@1, d@^1.0.1: es5-ext "^0.10.50" type "^1.0.1" -dash-ast@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/dash-ast/-/dash-ast-1.0.0.tgz#12029ba5fb2f8aa6f0a861795b23c1b4b6c27d37" - integrity sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA== - dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -1782,24 +1468,6 @@ dependency-lint@6.0.0: semver "^6.0.0" sorted-object "^2.0.0" -deps-sort@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.1.tgz#9dfdc876d2bcec3386b6829ac52162cda9fa208d" - integrity sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw== - dependencies: - JSONStream "^1.0.3" - shasum-object "^1.0.0" - subarg "^1.0.0" - through2 "^2.0.0" - -des.js@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" - integrity sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA== - dependencies: - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - destroy@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" @@ -1812,7 +1480,7 @@ detective-es6@^2.0.0: dependencies: node-source-walk "^4.0.0" -detective@^5.1.0, detective@^5.2.0: +detective@^5.1.0: version "5.2.0" resolved "https://registry.yarnpkg.com/detective/-/detective-5.2.0.tgz#feb2a77e85b904ecdea459ad897cc90a99bd2a7b" integrity sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg== @@ -1826,15 +1494,6 @@ diff@4.0.2, diff@^4.0.1, diff@^4.0.2: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== -diffie-hellman@^5.0.0: - version "5.0.3" - resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" - integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== - dependencies: - bn.js "^4.1.0" - miller-rabin "^4.0.0" - randombytes "^2.0.0" - dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -1876,11 +1535,6 @@ dom-serializer@^1.0.1: domhandler "^3.0.0" entities "^2.0.0" -domain-browser@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" - integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== - domelementtype@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.0.1.tgz#1f8bdfe91f5a78063274e803b4bdcedf6e94f94d" @@ -1902,13 +1556,6 @@ domutils@^2.0.0: domelementtype "^2.0.1" domhandler "^3.0.0" -duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: - version "0.1.4" - resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" - integrity sha1-ixLauHjA1p4+eJEFFmKjL8a93ME= - dependencies: - readable-stream "^2.0.2" - duration@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/duration/-/duration-0.2.2.tgz#ddf149bc3bc6901150fe9017111d016b3357f529" @@ -1940,19 +1587,6 @@ elasticlunr@^0.9.5: resolved "https://registry.yarnpkg.com/elasticlunr/-/elasticlunr-0.9.5.tgz#65541bb309dddd0cf94f2d1c8861b2be651bb0d5" integrity sha1-ZVQbswnd3Qz5Ty0ciGGyvmUbsNU= -elliptic@^6.5.3: - version "6.5.3" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" - integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw== - dependencies: - bn.js "^4.4.0" - brorand "^1.0.1" - hash.js "^1.0.0" - hmac-drbg "^1.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.0" - emoji-regex@^7.0.1: version "7.0.3" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" @@ -2297,19 +1931,6 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= -events@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/events/-/events-2.1.0.tgz#2a9a1e18e6106e0e812aa9ebd4a819b3c29c0ba5" - integrity sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg== - -evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" - integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== - dependencies: - md5.js "^1.3.4" - safe-buffer "^5.1.1" - express@4.17.1: version "4.17.1" resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" @@ -2400,11 +2021,6 @@ fast-levenshtein@^2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -fast-safe-stringify@^2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" - integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA== - fastq@^1.6.0: version "1.9.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.9.0.tgz#e16a72f338eaca48e91b5c23593bcc2ef66b7947" @@ -2438,7 +2054,7 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -finalhandler@1.1.2, finalhandler@~1.1.2: +finalhandler@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== @@ -2590,11 +2206,6 @@ gensync@^1.0.0-beta.1: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" integrity sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg== -get-assigned-identifiers@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz#6dbf411de648cbaf8d9169ebb0d2d576191e2ff1" - integrity sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ== - get-caller-file@^2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" @@ -2629,7 +2240,7 @@ glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@~5.1.0: dependencies: is-glob "^4.0.1" -glob@7.1.6, glob@^7.0.0, glob@^7.1.0, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@7.1.6, glob@^7.0.0, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -2703,30 +2314,13 @@ has-symbols@^1.0.1: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== -has@^1.0.0, has@^1.0.3: +has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== dependencies: function-bind "^1.1.1" -hash-base@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" - integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== - dependencies: - inherits "^2.0.4" - readable-stream "^3.6.0" - safe-buffer "^5.2.0" - -hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - hasha@^5.0.0: version "5.2.0" resolved "https://registry.yarnpkg.com/hasha/-/hasha-5.2.0.tgz#33094d1f69c40a4a6ac7be53d5fe3ff95a269e0c" @@ -2740,15 +2334,6 @@ he@1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -hmac-drbg@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - hosted-git-info@^2.1.4: version "2.8.8" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" @@ -2759,11 +2344,6 @@ html-escaper@^2.0.0: resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -htmlescape@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/htmlescape/-/htmlescape-1.1.1.tgz#3a03edc2214bca3b66424a3e7959349509cb0351" - integrity sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E= - htmlparser2@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-4.1.0.tgz#9a4ef161f2e4625ebf7dfbe6c0a2f52d18a59e78" @@ -2805,11 +2385,6 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -https-browserify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" - integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= - iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -2817,11 +2392,6 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" -ieee754@^1.1.4: - version "1.1.13" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" - integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== - ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" @@ -2858,44 +2428,16 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: +inherits@2, inherits@2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -inherits@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" - integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= - inherits@2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -inline-source-map@~0.6.0: - version "0.6.2" - resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.6.2.tgz#f9393471c18a79d1724f863fa38b586370ade2a5" - integrity sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU= - dependencies: - source-map "~0.5.3" - -insert-module-globals@^7.0.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.2.0.tgz#ec87e5b42728479e327bd5c5c71611ddfb4752ba" - integrity sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw== - dependencies: - JSONStream "^1.0.3" - acorn-node "^1.5.2" - combine-source-map "^0.8.0" - concat-stream "^1.6.1" - is-buffer "^1.1.0" - path-is-absolute "^1.0.1" - process "~0.11.0" - through2 "^2.0.0" - undeclared-identifiers "^1.1.2" - xtend "^4.0.0" - ipaddr.js@1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" @@ -2918,11 +2460,6 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" -is-buffer@^1.1.0: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== - is-callable@^1.1.4, is-callable@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.1.tgz#4d1e21a4f437509d25ce55f8184350771421c96d" @@ -3004,11 +2541,6 @@ is-typedarray@^1.0.0, is-typedarray@~1.0.0: resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= -is-utf8@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" - integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= - is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -3019,7 +2551,7 @@ isarray@0.0.1: resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= -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" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= @@ -3133,13 +2665,6 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= -json-stable-stringify@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz#611c23e814db375527df851193db59dd2af27f45" - integrity sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U= - dependencies: - jsonify "~0.0.0" - json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -3175,16 +2700,6 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" - integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= - -jsonparse@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" - integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= - jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -3207,14 +2722,6 @@ knuth-shuffle-seeded@^1.0.6: dependencies: seed-random "~2.2.0" -labeled-stream-splicer@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz#42a41a16abcd46fd046306cf4f2c3576fffb1c21" - integrity sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw== - dependencies: - inherits "^2.0.1" - stream-splicer "^2.0.0" - lcov-parse@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-1.0.0.tgz#eb0d46b54111ebc561acb4c408ef9363bdc8f7e0" @@ -3278,11 +2785,6 @@ lodash.get@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= -lodash.memoize@~3.0.3: - version "3.0.4" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f" - integrity sha1-LcvSwofLwKVcxCMovQxzYVDVPj8= - lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.2.1: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" @@ -3348,15 +2850,6 @@ marked@^1.1.1: resolved "https://registry.yarnpkg.com/marked/-/marked-1.1.1.tgz#e5d61b69842210d5df57b05856e0c91572703e6a" integrity sha512-mJzT8D2yPxoPh7h0UXkB+dBj4FykPJ2OIfxAWeIHrvoHDkFxukV/29QxoFQoPM6RLEwhIFdJpmKBlqVM3s2ZIw== -md5.js@^1.3.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" - integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" @@ -3385,14 +2878,6 @@ micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" -miller-rabin@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" - integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== - dependencies: - bn.js "^4.0.0" - brorand "^1.0.1" - mime-db@1.44.0: version "1.44.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" @@ -3410,16 +2895,6 @@ mime@1.6.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== - -minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= - minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -3427,16 +2902,11 @@ minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5: +minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== -mkdirp-classic@^0.5.2: - version "0.5.3" - resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" - integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== - mkdirp@^0.5.1: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" @@ -3475,27 +2945,6 @@ mocha@8.2.1: yargs-parser "13.1.2" yargs-unparser "2.0.0" -module-deps@^6.2.3: - version "6.2.3" - resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-6.2.3.tgz#15490bc02af4b56cf62299c7c17cba32d71a96ee" - integrity sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA== - dependencies: - JSONStream "^1.0.3" - browser-resolve "^2.0.0" - cached-path-relative "^1.0.2" - concat-stream "~1.6.0" - defined "^1.0.0" - detective "^5.2.0" - duplexer2 "^0.1.2" - inherits "^2.0.1" - parents "^1.0.0" - readable-stream "^2.0.2" - resolve "^1.4.0" - stream-combiner2 "^1.1.1" - subarg "^1.0.0" - through2 "^2.0.0" - xtend "^4.0.0" - ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -3704,11 +3153,6 @@ optionator@^0.9.1: type-check "^0.4.0" word-wrap "^1.2.3" -os-browserify@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" - integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= - p-limit@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" @@ -3792,11 +3236,6 @@ pad-right@^0.2.2: dependencies: repeat-string "^1.5.2" -pako@~1.0.5: - version "1.0.11" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" - integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== - parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -3804,24 +3243,6 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" -parents@^1.0.0, parents@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/parents/-/parents-1.0.1.tgz#fedd4d2bf193a77745fe71e371d73c3307d9c751" - integrity sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E= - dependencies: - path-platform "~0.11.15" - -parse-asn1@^5.0.0, parse-asn1@^5.1.5: - version "5.1.6" - resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.6.tgz#385080a3ec13cb62a62d39409cb3e88844cdaed4" - integrity sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw== - dependencies: - asn1.js "^5.2.0" - browserify-aes "^1.0.0" - evp_bytestokey "^1.0.0" - pbkdf2 "^3.0.3" - safe-buffer "^5.1.1" - parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" @@ -3839,11 +3260,6 @@ parseurl@~1.3.3: resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== -path-browserify@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" - integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== - path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -3854,7 +3270,7 @@ path-exists@^4.0.0: resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== -path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: +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" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= @@ -3869,11 +3285,6 @@ path-parse@^1.0.6: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== -path-platform@~0.11.15: - version "0.11.15" - resolved "https://registry.yarnpkg.com/path-platform/-/path-platform-0.11.15.tgz#e864217f74c36850f0852b78dc7bf7d4a5721bf2" - integrity sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I= - path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" @@ -3903,17 +3314,6 @@ pathval@^1.1.0: resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0" integrity sha1-uULm1L3mUwBe9rcTYd74cn0GReA= -pbkdf2@^3.0.3: - version "3.1.1" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.1.tgz#cb8724b0fada984596856d1a6ebafd3584654b94" - integrity sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg== - dependencies: - create-hash "^1.1.2" - create-hmac "^1.1.4" - ripemd160 "^2.0.1" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -3969,11 +3369,6 @@ prettier@2.1.2: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5" integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg== -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - process-on-spawn@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/process-on-spawn/-/process-on-spawn-1.0.0.tgz#95b05a23073d30a17acfdc92a440efd2baefdc93" @@ -3981,11 +3376,6 @@ process-on-spawn@^1.0.0: dependencies: fromentries "^1.2.0" -process@~0.11.0: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= - progress@^2.0.0, progress@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" @@ -4037,28 +3427,6 @@ psl@^1.1.28: resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== -public-encrypt@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" - integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== - dependencies: - bn.js "^4.1.0" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - parse-asn1 "^5.0.0" - randombytes "^2.0.1" - safe-buffer "^5.1.2" - -punycode@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" - integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= - -punycode@^1.3.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= - punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" @@ -4074,31 +3442,13 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -querystring-es3@~0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" - integrity sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= - -querystring@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" - integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= - -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: +randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" -randomfill@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" - integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== - dependencies: - randombytes "^2.0.5" - safe-buffer "^5.1.0" - range-parser@~1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" @@ -4143,13 +3493,6 @@ react@^16.13.1: object-assign "^4.1.1" prop-types "^15.6.2" -read-only-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-2.0.0.tgz#2724fd6a8113d73764ac288d4386270c1dbf17f0" - integrity sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A= - dependencies: - readable-stream "^2.0.2" - read-pkg-up@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" @@ -4167,28 +3510,6 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" -readable-stream@^2.0.2, readable-stream@^2.2.2, readable-stream@~2.3.6: - version "2.3.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" - integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readable-stream@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - readdirp@~3.5.0: version "3.5.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" @@ -4271,7 +3592,7 @@ resolve-pkg@^2.0.0: dependencies: resolve-from "^5.0.0" -resolve@^1.1.4, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.13.1, resolve@^1.17.0, resolve@^1.3.2, resolve@^1.4.0: +resolve@^1.10.0, resolve@^1.10.1, resolve@^1.13.1, resolve@^1.17.0, resolve@^1.3.2: version "1.17.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== @@ -4297,25 +3618,17 @@ rimraf@^3.0.0: dependencies: glob "^7.1.3" -ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" - integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - run-parallel@^1.1.9: version "1.1.10" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.10.tgz#60a51b2ae836636c81377df16cb107351bcd13ef" integrity sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw== -safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@5.1.2, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -4416,29 +3729,6 @@ setprototypeof@1.1.1: resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== -sha.js@^2.4.0, sha.js@^2.4.8, sha.js@~2.4.4: - version "2.4.11" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -shasum-object@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shasum-object/-/shasum-object-1.0.0.tgz#0b7b74ff5b66ecf9035475522fa05090ac47e29e" - integrity sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg== - dependencies: - fast-safe-stringify "^2.0.7" - -shasum@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/shasum/-/shasum-1.0.2.tgz#e7012310d8f417f4deb5712150e5678b87ae565f" - integrity sha1-5wEjENj0F/TetXEhUOVni4euVl8= - dependencies: - json-stable-stringify "~0.0.0" - sha.js "~2.4.4" - shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -4451,21 +3741,11 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -shell-quote@^1.6.1: - version "1.7.2" - resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" - integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== - signal-exit@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== -simple-concat@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" - integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== - simple-swizzle@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" @@ -4523,7 +3803,7 @@ source-map@0.5.6: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" integrity sha1-dc449SvwczxafwwRjYEzSiu19BI= -source-map@^0.5.0, source-map@~0.5.3: +source-map@^0.5.0: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= @@ -4630,45 +3910,11 @@ stacktrace-js@^2.0.2: resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= -stream-browserify@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b" - integrity sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg== - dependencies: - inherits "~2.0.1" - readable-stream "^2.0.2" - stream-buffers@3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-3.0.2.tgz#5249005a8d5c2d00b3a32e6e0a6ea209dc4f3521" integrity sha512-DQi1h8VEBA/lURbSwFtEHnSTb9s2/pwLEaFuNhXwy1Dx3Sa0lOuYT2yNUr4/j2fs8oCAMANtrZ5OrPZtyVs3MQ== -stream-combiner2@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/stream-combiner2/-/stream-combiner2-1.1.1.tgz#fb4d8a1420ea362764e21ad4780397bebcb41cbe" - integrity sha1-+02KFCDqNidk4hrUeAOXvry0HL4= - dependencies: - duplexer2 "~0.1.0" - readable-stream "^2.0.2" - -stream-http@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-3.1.1.tgz#0370a8017cf8d050b9a8554afe608f043eaff564" - integrity sha512-S7OqaYu0EkFpgeGFb/NPOoPLxFko7TPqtEeFg5DXPB4v/KETHG0Ln6fRFrNezoelpaDKmycEmmZ81cC9DAwgYg== - dependencies: - builtin-status-codes "^3.0.0" - inherits "^2.0.4" - readable-stream "^3.6.0" - xtend "^4.0.2" - -stream-splicer@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/stream-splicer/-/stream-splicer-2.0.1.tgz#0b13b7ee2b5ac7e0609a7463d83899589a363fcd" - integrity sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg== - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.2" - stream-to-string@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/stream-to-string/-/stream-to-string-1.2.0.tgz#3ca506a097ecbf78b0e0aee0b6fa5c4565412a15" @@ -4723,20 +3969,6 @@ string.prototype.trimstart@^1.0.1: define-properties "^1.1.3" es-abstract "^1.17.5" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" @@ -4758,13 +3990,6 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" -strip-bom@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" - integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= - 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" @@ -4780,18 +4005,6 @@ strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1. resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -strip-json-comments@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= - -subarg@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" - integrity sha1-9izxdYHplrSPyWVpn1TAauJouNI= - dependencies: - minimist "^1.1.0" - supports-color@7.2.0, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" @@ -4813,13 +4026,6 @@ supports-color@^6.1.0: dependencies: has-flag "^3.0.0" -syntax-error@^1.1.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.4.0.tgz#2d9d4ff5c064acb711594a3e3b95054ad51d907c" - integrity sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w== - dependencies: - acorn-node "^1.2.0" - table@^5.2.3: version "5.4.6" resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" @@ -4858,26 +4064,6 @@ thenify-all@^1.0.0: dependencies: any-promise "^1.0.0" -through2@^2.0.0: - version "2.0.5" - resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" - integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== - dependencies: - readable-stream "~2.3.6" - xtend "~4.0.1" - -"through@>=2.2.7 <3": - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= - -timers-browserify@^1.0.1: - version "1.4.2" - resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-1.4.2.tgz#c9c58b575be8407375cb5e2462dacee74359f41d" - integrity sha1-ycWLV1voQHN1y14kYtrO50NZ9B0= - dependencies: - process "~0.11.0" - tmp@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" @@ -4931,28 +4117,6 @@ tsconfig-paths@^3.9.0: minimist "^1.2.0" strip-bom "^3.0.0" -tsconfig@^5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-5.0.3.tgz#5f4278e701800967a8fc383fd19648878f2a6e3a" - integrity sha1-X0J45wGACWeo/Dg/0ZZIh48qbjo= - dependencies: - any-promise "^1.3.0" - parse-json "^2.2.0" - strip-bom "^2.0.0" - strip-json-comments "^2.0.0" - -tsify@5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/tsify/-/tsify-5.0.2.tgz#ba3c9f8de239e89ba3aab6b83d65b569ef8b68c3" - integrity sha512-Pdo3ZO8CAgbQgNcFRBmfbgsPP+4TsD0itbSF5YgTnxKBXfg6WkQ79e4/bqBaq/7cEYa7vIOM1pHxnux8rJJnzg== - dependencies: - convert-source-map "^1.1.0" - fs.realpath "^1.0.0" - object-assign "^4.1.0" - semver "^6.1.0" - through2 "^2.0.0" - tsconfig "^5.0.3" - tslib@^1.10.0, tslib@^1.8.1: version "1.13.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" @@ -4965,11 +4129,6 @@ tsutils@^3.17.1: dependencies: tslib "^1.8.1" -tty-browserify@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811" - integrity sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw== - tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -5024,11 +4183,6 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= - typescript@4.0.5: version "4.0.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.5.tgz#ae9dddfd1069f1cb5beb3ef3b2170dd7c1332389" @@ -5039,22 +4193,6 @@ typescript@^4.0.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2" integrity sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ== -umd@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.3.tgz#aa9fe653c42b9097678489c01000acb69f0b26cf" - integrity sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow== - -undeclared-identifiers@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz#9254c1d37bdac0ac2b52de4b6722792d2a91e30f" - integrity sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw== - dependencies: - acorn-node "^1.3.0" - dash-ast "^1.0.0" - get-assigned-identifiers "^1.2.0" - simple-concat "^1.0.0" - xtend "^4.0.1" - universalify@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" @@ -5089,38 +4227,11 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" -url@~0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" - integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= - dependencies: - punycode "1.3.2" - querystring "0.2.0" - util-arity@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/util-arity/-/util-arity-1.1.0.tgz#59d01af1fdb3fede0ac4e632b0ab5f6ce97c9330" integrity sha1-WdAa8f2z/t4KxOYysKtfbOl8kzA= -util-deprecate@^1.0.1, util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= - -util@0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" - integrity sha1-evsa/lCAUkZInj23/g7TeTNqwPk= - dependencies: - inherits "2.0.1" - -util@~0.10.1: - version "0.10.4" - resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901" - integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A== - dependencies: - inherits "2.0.3" - utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" @@ -5163,11 +4274,6 @@ verror@1.10.0, verror@^1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -vm-browserify@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" - integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== - which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" @@ -5237,7 +4343,7 @@ write@1.0.3: dependencies: mkdirp "^0.5.1" -xtend@^4.0.0, xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.1: +xtend@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==