diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d8ce5fe8..1594c82d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) on how to contribute to Cucumber. -### [Unreleased](https://github.com/cucumber/cucumber-js/compare/v5.1.0...master) (In Git) +### [Unreleased](https://github.com/cucumber/cucumber-js/compare/v6.0.0...master) (In Git) + +### [6.0.0](https://github.com/cucumber/cucumber-js/compare/v5.1.0...v6.0.0) (2019-10-06) #### BREAKING CHANGES @@ -11,29 +13,30 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO #### Bug fixes * Prevent after hooks from updating skipped scenarios to passed +* Parallel: beforeAll / afterAll errors fail the suite * Fix CLI help link #### New features * Add ability to retry flaky tests * Use `--retry ` and limit what tests will be retried with `--retryTagFilter ` - * Event-protocol added an `attemptNumber` to test case started, test case finished, and all test step events and a `retried` boolean to the test case result to signify if the test case was retried + * Event-protocol added an `attemptNumber` to test case started, test case finished, and all test step events and a `retried` boolean to the test case result to signify if the test case was retried * usage-json formatter: add code and patternType * Add support for Node.js 12 -### [5.1.0](https://github.com/cucumber/cucumber-js/compare/v5.0.3...5.1.0) (2018-12-28) +### [5.1.0](https://github.com/cucumber/cucumber-js/compare/v5.0.3...v5.1.0) (2018-12-28) #### Internals * Upgrade to babel 7 -### [5.0.3](https://github.com/cucumber/cucumber-js/compare/v5.0.2...5.0.3) (2018-12-03) +### [5.0.3](https://github.com/cucumber/cucumber-js/compare/v5.0.2...v5.0.3) (2018-12-03) #### Speed Improvements * Only create Cucumber Expressions once -### [5.0.2](https://github.com/cucumber/cucumber-js/compare/v5.0.1...5.0.2) (2018-10-06) +### [5.0.2](https://github.com/cucumber/cucumber-js/compare/v5.0.1...v5.0.2) (2018-10-06) #### Bug Fixes diff --git a/dist/cucumber.js b/dist/cucumber.js index 4c94f893c..5ba871c64 100644 --- a/dist/cucumber.js +++ b/dist/cucumber.js @@ -1,4 +1,4 @@ -(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 e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;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 require=="function"&&require;for(var o=0;o= 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; +}; - switch ((0, _type2.default)(value)) { - case 'array': - return withStack(function () { - return value.map(function (item) { - return canonicalize(item, stack); - }); - }); - case 'function': - if (!(0, _has_property2.default)(value)) { - return '[Function]'; - } - /* falls through */ - case 'object': - return withStack(function () { - var 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":7,"./type":11}],7:[function(require,module,exports){ -"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = hasProperty;function hasProperty(obj) { - for (var prop in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop)) { - return true; - } +// 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; } - return false; -} -},{}],8:[function(require,module,exports){ -'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.default = + 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; +}; -inlineDiff;var _diff = require('diff');var _padRight = require('pad-right');var _padRight2 = _interopRequireDefault(_padRight);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function inlineDiff(actual, expected, colorFns) { - var msg = errorDiff(actual, expected, colorFns); - // linenos - var lines = msg.split('\n'); - if (lines.length > 4) {(function () { - var width = String(lines.length).length; - msg = lines.map(function (str, i) { - return (0, _padRight2.default)(i + 1, width, ' ') + '|' + ' ' + str; - }).join('\n');})(); +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]; +}; - // legend - msg = '\n ' + - colorFns.diffRemoved('actual') + - ' ' + - colorFns.diffAdded('expected') + - '\n\n' + - msg.replace(/^/gm, ' ') + - '\n'; - return msg; +/** + * 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; -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":14,"pad-right":259}],9:[function(require,module,exports){ -'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.default = - +// 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' +}; -jsonStringify;var _repeatString = require('repeat-string');var _repeatString2 = _interopRequireDefault(_repeatString);var _type = require('./type');var _type2 = _interopRequireDefault(_type);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function jsonStringify(object, depth) { - depth = depth || 1; - switch ((0, _type2.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 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 jsonStringifyBuffer(object, depth) {var _object$toJSON = - object.toJSON(),data = _object$toJSON.data; - return '[Buffer: ' + jsonStringify(data, depth) + ']'; +function stylizeNoColor(str, styleType) { + return str; } -function jsonStringifyDate(object) { - var str = void 0; - if (isNaN(object.getTime())) { - str = object.toString(); - } else { - str = object.toISOString(); - } - return '[Date: ' + str + ']'; +function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; } -function jsonStringifyProperties(object, depth) { - var space = 2 * depth; - var start = (0, _type2.default)(object) === 'array' ? '[' : '{'; - var end = (0, _type2.default)(object) === 'array' ? ']' : '}'; - var length = typeof object.length === 'number' ? object.length : Object.keys(object).length; - var addedProperties = 0; - var str = start; - - for (var prop in object) { - if (Object.prototype.hasOwnProperty.call(object, prop)) { - addedProperties += 1; - str += '\n' + (0, _repeatString2.default)(' ', space) + ( - (0, _type2.default)(object) === 'array' ? '' : '"' + prop + '": ') + - jsonStringify(object[prop], depth + 1) + ( - addedProperties === length ? '' : ','); +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; } - if (str.length !== 1) { - str += '\n' + (0, _repeatString2.default)(' ', space - 2); + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; } - return str + end; -} -},{"./type":11,"repeat-string":284}],10:[function(require,module,exports){ -'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.default = - + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } -stringify;var _canonicalize = require('./canonicalize');var _canonicalize2 = _interopRequireDefault(_canonicalize);var _json_stringify = require('./json_stringify');var _json_stringify2 = _interopRequireDefault(_json_stringify);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function stringify(value) { - return (0, _json_stringify2.default)((0, _canonicalize2.default)(value)).replace(/,(\n|$)/g, '$1'); -} -},{"./canonicalize":6,"./json_stringify":9}],11:[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'; + // 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); } - return Object.prototype.toString.call(value). - replace(/^\[.+\s(.+?)\]$/, '$1'). - toLowerCase(); -} -}).call(this,require("buffer").Buffer) -},{"buffer":22}],12:[function(require,module,exports){ -'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.default = -unifiedDiff;var _diff = require('diff');function unifiedDiff(actual, expected, colorFns) { - var indent = ' '; - function cleanUp(line) { - if (line.length === 0) { - return ''; - } - if (line[0] === '+') { - return indent + colorFns.diffAdded(line); + // 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 (line[0] === '-') { - return indent + colorFns.diffRemoved(line); + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } - if (line.match(/\@\@/)) { - return null; + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); } - if (line.match(/\\ No newline/)) { - return null; + if (isError(value)) { + return formatError(value); } - return indent + line; - } - function notBlank(line) { - return typeof line !== 'undefined' && line !== null; } - var msg = (0, _diff.createPatch)('string', actual, expected); - var 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":14}],13:[function(require,module,exports){ -'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports. - - - - - - - - + var base = '', array = false, braces = ['{', '}']; -format = format;var _inline_diff = require('./helpers/inline_diff');var _inline_diff2 = _interopRequireDefault(_inline_diff);var _stringify = require('./helpers/stringify');var _stringify2 = _interopRequireDefault(_stringify);var _type = require('./helpers/type');var _type2 = _interopRequireDefault(_type);var _unified_diff = require('./helpers/unified_diff');var _unified_diff2 = _interopRequireDefault(_unified_diff);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function identity(x) {return x;}function format(err, options) { - if (!options) { - options = {}; + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; } - if (!options.colorFns) { - options.colorFns = {}; + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; } - ['diffAdded', 'diffRemoved', 'errorMessage', 'errorStack'].forEach(function (key) { - if (!options.colorFns[key]) { - options.colorFns[key] = identity; - } - }); - var message = void 0; - 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); + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); } - var stack = err.stack || message; - var startOfMessageIndex = stack.indexOf(message); - if (startOfMessageIndex === -1) { - stack = '\n' + stack; - } else { - var endOfMessageIndex = startOfMessageIndex + message.length; - message = stack.slice(0, endOfMessageIndex); - stack = stack.slice(endOfMessageIndex); // remove message from stack + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); } - if (err.uncaught) { - message = 'Uncaught ' + message; + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); } - var actual = err.actual; - var expected = err.expected; + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } - if (err.showDiff !== false && (0, _type2.default)(actual) === (0, _type2.default)(expected) && expected !== undefined) { - if (!((0, _type2.default)(actual) === 'string' && (0, _type2.default)(expected) === 'string')) { - actual = (0, _stringify2.default)(actual); - expected = (0, _stringify2.default)(expected); + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); } + } - var match = message.match(/^([^:]+): expected/); - message = options.colorFns.errorMessage(match ? match[1] : message); + ctx.seen.push(value); - if (options.inlineDiff) { - message += (0, _inline_diff2.default)(actual, expected, options.colorFns); - } else { - message += (0, _unified_diff2.default)(actual, expected, options.colorFns); - } + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); } else { - message = options.colorFns.errorMessage(message); + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); } - if (stack) { - stack = options.colorFns.errorStack(stack); - } + ctx.seen.pop(); - return message + stack; + return reduceToSingleString(output, base, braces); } -},{"./helpers/inline_diff":8,"./helpers/stringify":10,"./helpers/type":11,"./helpers/unified_diff":12}],14:[function(require,module,exports){ -/*! - - diff v3.4.0 - -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: +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'); +} -* 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. +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} -* 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 webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["JsDiff"] = factory(); - else - root["JsDiff"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; +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; +} -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; +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'); + } + } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; + return name + ': ' + str; +} -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ // Flag the module as loaded -/******/ module.loaded = true; +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); -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; +// 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; -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; - /*istanbul ignore start*/'use strict'; +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; - exports.__esModule = true; - exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.merge = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined; +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; - /*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; - /*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/; +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; - var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/; +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; - var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/; +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; - var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/; +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; - var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/; +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; - var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/; +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; - var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/; +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; - var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/; +exports.isBuffer = require('./support/isBuffer'); - var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/; +function objectToString(o) { + return Object.prototype.toString.call(o); +} - var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/; - var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/; +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} - var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/; - var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/; +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; - /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +// 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(' '); +} - /* See LICENSE file for terms of use */ - /* - * Text diff implementation. - * - * This library supports the following APIS: - * JsDiff.diffChars: Character by character diff - * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace - * JsDiff.diffLines: Line based diff - * - * JsDiff.diffCss: Diff targeted at CSS content - * - * These methods are based on the implementation proposed in - * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). - * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 - */ - exports. /*istanbul ignore end*/Diff = _base2['default']; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays; - /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches; - /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge; - /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP; - /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML; - /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize; - - - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - - /*istanbul ignore start*/'use strict'; - - exports.__esModule = true; - exports['default'] = /*istanbul ignore end*/Diff; - function Diff() {} - - Diff.prototype = { - /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) { - /*istanbul ignore start*/var /*istanbul ignore end*/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 = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - 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; - } - } - } - }, - /*istanbul ignore start*/ /*istanbul ignore end*/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 }); - } - }, - /*istanbul ignore start*/ /*istanbul ignore end*/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; - }, - /*istanbul ignore start*/ /*istanbul ignore end*/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(); - } - }, - /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) { - var ret = []; - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - return ret; - }, - /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) { - return value; - }, - /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) { - return value.split(''); - }, - /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) { - return chars.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)); +}; - 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) }; - } +/** + * 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; +}; -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} - /*istanbul ignore start*/'use strict'; +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - exports.__esModule = true; - exports.characterDiff = undefined; - exports. /*istanbul ignore end*/diffChars = diffChars; +},{"./support/isBuffer":7,"_process":497,"inherits":6}],9:[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 };} - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; +function canonicalize(value, stack) { + stack = stack || []; - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + function withStack(fn) { + stack.push(value); + const result = fn(); + stack.pop(); + return result; + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + if (stack.indexOf(value) !== -1) { + return '[Circular]'; + } - /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - function diffChars(oldStr, newStr, options) { - return characterDiff.diff(oldStr, newStr, options); - } + 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":10,"./type":14}],10:[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; +} +},{}],11:[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); -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { + // 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'); + } - /*istanbul ignore start*/'use strict'; + // legend + msg = + '\n ' + + colorFns.diffRemoved('actual') + + ' ' + + colorFns.diffAdded('expected') + + '\n\n' + + msg.replace(/^/gm, ' ') + + '\n'; - exports.__esModule = true; - exports.wordDiff = undefined; - exports. /*istanbul ignore end*/diffWords = diffWords; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace; + return msg; +} - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; +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":17,"pad-right":492}],12:[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 };} - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); +function jsonStringify(object, depth) { + depth = depth || 1; - /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/; + 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 + }} - /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +} - /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode - // - // 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]+$/; +function jsonStringifyBuffer(object, depth) { + const { data } = object.toJSON(); + return '[Buffer: ' + jsonStringify(data, depth) + ']'; +} - var reWhitespace = /\S/; +function jsonStringifyDate(object) { + let str; + if (isNaN(object.getTime())) { + str = object.toString(); + } else { + str = object.toISOString(); + } + return '[Date: ' + str + ']'; +} - var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - 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 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 ? '' : ','); + } + } - function diffWords(oldStr, newStr, options) { - options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true }); - return wordDiff.diff(oldStr, newStr, options); - } + if (str.length !== 1) { + str += '\n' + (0, _repeatString.default)(' ', space - 2); + } - function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff.diff(oldStr, newStr, options); - } + return str + end; +} +},{"./type":14,"repeat-string":516}],13:[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":9,"./json_stringify":12}],14:[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":25}],15:[function(require,module,exports){ +"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = unifiedDiff;var _diff = require("diff"); -/***/ }), -/* 4 */ -/***/ (function(module, exports) { +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')); - /*istanbul ignore start*/'use strict'; +} +},{"diff":17}],16:[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 };} - exports.__esModule = true; - exports. /*istanbul ignore end*/generateOptions = generateOptions; - 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; - } +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); + } -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { + 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 + } - /*istanbul ignore start*/'use strict'; + if (err.uncaught) { + message = 'Uncaught ' + message; + } - exports.__esModule = true; - exports.lineDiff = undefined; - exports. /*istanbul ignore end*/diffLines = diffLines; - /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines; + let actual = err.actual; + let expected = err.expected; - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + 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); + } - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + const match = message.match(/^([^:]+): expected/); + message = options.colorFns.errorMessage(match ? match[1] : message); - /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/; + 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); + } - /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + if (stack) { + stack = options.colorFns.errorStack(stack); + } - /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - lineDiff.tokenize = function (value) { - var retLines = [], - linesAndNewlines = value.split(/(\n|\r\n)/); + return message + stack; +} +},{"./helpers/inline_diff":11,"./helpers/stringify":13,"./helpers/type":14,"./helpers/unified_diff":15}],17:[function(require,module,exports){ +/*! - // Ignore the final empty token that occurs if the string ends with a new line - if (!linesAndNewlines[linesAndNewlines.length - 1]) { - linesAndNewlines.pop(); - } + diff v4.0.1 - // Merge the content and line separators into single tokens - for (var i = 0; i < linesAndNewlines.length; i++) { - var line = linesAndNewlines[i]; +Software License Agreement (BSD License) - if (i % 2 && !this.options.newlineIsToken) { - retLines[retLines.length - 1] += line; - } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - retLines.push(line); - } - } +Copyright (c) 2009-2015, Kevin Decker - return retLines; - }; +All rights reserved. - function diffLines(oldStr, newStr, callback) { - return lineDiff.diff(oldStr, newStr, callback); - } - function diffTrimmedLines(oldStr, newStr, callback) { - var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true }); - return lineDiff.diff(oldStr, newStr, options); - } +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. -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { +* 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. - /*istanbul ignore start*/'use strict'; +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; + } - exports.__esModule = true; - exports.sentenceDiff = undefined; - exports. /*istanbul ignore end*/diffSentences = diffSentences; + var canAdd = addPath && addPath.newPos + 1 < newLen, + canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + 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 - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + 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 - /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - sentenceDiff.tokenize = function (value) { - return value.split(/(\S.+?[.!?])(?=\s+|$)/); - }; + basePath.newPos++; + self.pushComponent(basePath.components, true, undefined); + } - function diffSentences(oldStr, newStr, callback) { - return sentenceDiff.diff(oldStr, newStr, callback); - } + _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. -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - /*istanbul ignore start*/'use strict'; + if (callback) { + (function exec() { + setTimeout(function () { + // This should not happen, but we want to be safe. - exports.__esModule = true; - exports.cssDiff = undefined; - exports. /*istanbul ignore end*/diffCss = diffCss; + /* istanbul ignore next */ + if (editLength > maxEditLength) { + return callback(); + } - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + if (!execEditLength()) { + exec(); + } + }, 0); + })(); + } else { + while (editLength <= maxEditLength) { + var ret = execEditLength(); - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + 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 + }); + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + 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 = []; - /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - cssDiff.tokenize = function (value) { - return value.split(/([{}:;,]|\s+)/); - }; + for (var i = 0; i < array.length; i++) { + if (array[i]) { + ret.push(array[i]); + } + } - function diffCss(oldStr, newStr, callback) { - return cssDiff.diff(oldStr, newStr, callback); - } + 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 -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { + 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. - /*istanbul ignore start*/'use strict'; - exports.__esModule = true; - exports.jsonDiff = undefined; + var lastComponent = components[componentLen - 1]; - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { + components[componentLen - 2].value += lastComponent.value; + components.pop(); + } - exports. /*istanbul ignore end*/diffJson = diffJson; - /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize; + return components; + } - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + function clonePath(path) { + return { + newPos: path.newPos, + components: path.components.slice(0) + }; + } - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + var characterDiff = new Diff(); + function diffChars(oldStr, newStr, options) { + return characterDiff.diff(oldStr, newStr, options); + } - /*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/; + 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]; + } + } + } - /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + return defaults; + } - /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString; + // + // 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); + }; - var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - // 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; + 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. - jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize; - jsonDiff.castInput = function (value) { - /*istanbul ignore start*/var /*istanbul ignore end*/undefinedReplacement = this.options.undefinedReplacement; + 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; + }; - return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), function (k, v) { - if (typeof v === 'undefined') { - return undefinedReplacement; - } + 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); + } - return v; - }, ' '); - }; - jsonDiff.equals = function (left, right) { - return (/*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')) - ); - }; + var lineDiff = new Diff(); - function diffJson(oldObj, newObj, options) { - return jsonDiff.diff(oldObj, newObj, options); - } + 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 - // 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. - function canonicalize(obj, stack, replacementStack) { - stack = stack || []; - replacementStack = replacementStack || []; - - var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - - for (i = 0; i < stack.length; i += 1) { - if (stack[i] === obj) { - return replacementStack[i]; - } - } - - var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - - 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); - } - stack.pop(); - replacementStack.pop(); - return canonicalizedObj; - } - - if (obj && obj.toJSON) { - obj = obj.toJSON(); - } - - if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - replacementStack.push(canonicalizedObj); - var sortedKeys = [], - key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - 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); - } - stack.pop(); - replacementStack.pop(); - } else { - canonicalizedObj = obj; - } - return canonicalizedObj; - } + 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]; -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { + if (i % 2 && !this.options.newlineIsToken) { + retLines[retLines.length - 1] += line; + } else { + if (this.options.ignoreWhitespace) { + line = line.trim(); + } - /*istanbul ignore start*/'use strict'; + retLines.push(line); + } + } - exports.__esModule = true; - exports.arrayDiff = undefined; - exports. /*istanbul ignore end*/diffArrays = diffArrays; + return retLines; + }; - var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; + 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); + } - /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); + var sentenceDiff = new Diff(); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + sentenceDiff.tokenize = function (value) { + return value.split(/(\S.+?[.!?])(?=\s+|$)/); + }; - /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); - arrayDiff.tokenize = arrayDiff.join = function (value) { - return value.slice(); - }; - arrayDiff.removeEmpty = function (value) { - return value; - }; + function diffSentences(oldStr, newStr, callback) { + return sentenceDiff.diff(oldStr, newStr, callback); + } - function diffArrays(oldArr, newArr, callback) { - return arrayDiff.diff(oldArr, newArr, callback); - } + var cssDiff = new Diff(); + cssDiff.tokenize = function (value) { + return value.split(/([{}:;,]|\s+)/); + }; + function diffCss(oldStr, newStr, callback) { + return cssDiff.diff(oldStr, newStr, callback); + } -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - /*istanbul ignore start*/'use strict'; - - exports.__esModule = true; - exports. /*istanbul ignore end*/applyPatch = applyPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches; - - var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/; - - var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/; - - /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - /*istanbul ignore end*/function applyPatch(source, uniDiff) { - /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - if (typeof uniDiff === 'string') { - uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(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) /*istanbul ignore start*/{ - return (/*istanbul ignore end*/line === patchContent - ); - }, - errorCount = 0, - fuzzFactor = options.fuzzFactor || 0, - minLine = 0, - offset = 0, - removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/, - addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - - /** - * 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[0], - content = line.substr(1); - - 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 = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(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[0], - content = line.substr(1), - 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(''); - } + 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; + }; + } - // Wrapper that supports multiple file patches via callbacks. - function applyPatches(uniDiff, options) { - if (typeof uniDiff === 'string') { - uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(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(); - } + 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]; -/***/ }), -/* 11 */ -/***/ (function(module, exports) { - - /*istanbul ignore start*/'use strict'; - - exports.__esModule = true; - exports. /*istanbul ignore end*/parsePatch = parsePatch; - function parsePatch(uniDiff) { - /*istanbul ignore start*/var /*istanbul ignore end*/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 headerPattern = /^(---|\+\+\+)\s+([\S ]*)(?:\t(.*?)\s*)?$/; - var fileHeader = headerPattern.exec(diffstr[i]); - if (fileHeader) { - var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; - var fileName = fileHeader[2].replace(/\\\\/g, '\\'); - if (/^".*"$/.test(fileName)) { - fileName = fileName.substr(1, fileName.length - 2); - } - index[keyPrefix + 'FileName'] = fileName; - index[keyPrefix + 'Header'] = fileHeader[3]; - - 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][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; - } + 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"); + } -/***/ }), -/* 12 */ -/***/ (function(module, exports) { + 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: - /*istanbul ignore start*/"use strict"; + jsonDiff.useLongestToken = true; + jsonDiff.tokenize = lineDiff.tokenize; - exports.__esModule = true; + 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, ' '); + }; - exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) { - var wantForward = true, - backwardExhausted = false, - forwardExhausted = false, - localOffset = 1; + jsonDiff.equals = function (left, right) { + return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); + }; - return function iterator() { - if (wantForward && !forwardExhausted) { - if (backwardExhausted) { - localOffset++; - } else { - wantForward = false; - } + 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 - // 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; - } + function canonicalize(obj, stack, replacementStack, replacer, key) { + stack = stack || []; + replacementStack = replacementStack || []; - forwardExhausted = true; - } + if (replacer) { + obj = replacer(key, obj); + } - if (!backwardExhausted) { - if (!forwardExhausted) { - wantForward = true; - } + var i; - // Check if trying to fit before text beginning, and if not, check it fits - // before offset location - if (minLine <= start - localOffset) { - return -localOffset++; - } + for (i = 0; i < stack.length; i += 1) { + if (stack[i] === obj) { + return replacementStack[i]; + } + } - backwardExhausted = true; - return iterator(); - } + var canonicalizedObj; - // We tried to fit hunk before text beginning and beyond text length, then - // hunk can't fit on the text. Return undefined - }; - }; + 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; + } -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { + if (obj && obj.toJSON) { + obj = obj.toJSON(); + } - /*istanbul ignore start*/'use strict'; + if (_typeof(obj) === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + replacementStack.push(canonicalizedObj); - exports.__esModule = true; - exports. /*istanbul ignore end*/calcLineCount = calcLineCount; - /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge; + var sortedKeys = [], + _key; - var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/; + for (_key in obj) { + /* istanbul ignore else */ + if (obj.hasOwnProperty(_key)) { + sortedKeys.push(_key); + } + } - var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/; + sortedKeys.sort(); - var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/; + for (i = 0; i < sortedKeys.length; i += 1) { + _key = sortedKeys[i]; + canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); + } - /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + stack.pop(); + replacementStack.pop(); + } else { + canonicalizedObj = obj; + } - /*istanbul ignore end*/function calcLineCount(hunk) { - /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines), - oldLines = _calcOldNewLineCount.oldLines, - newLines = _calcOldNewLineCount.newLines; + return canonicalizedObj; + } - if (oldLines !== undefined) { - hunk.oldLines = oldLines; - } else { - delete hunk.oldLines; - } + var arrayDiff = new Diff(); - if (newLines !== undefined) { - hunk.newLines = newLines; - } else { - delete hunk.newLines; - } - } + arrayDiff.tokenize = function (value) { + return value.slice(); + }; - 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; - } + arrayDiff.join = arrayDiff.removeEmpty = function (value) { + return value; + }; - function loadPatch(param, base) { - if (typeof param === 'string') { - if (/^@@/m.test(param) || /^Index:/m.test(param)) { - return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0] - ); - } - - if (!base) { - throw new Error('Must provide a base reference or pass in a patch'); - } - return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param) - ); - } - - return param; - } + function diffArrays(oldArr, newArr, callback) { + return arrayDiff.diff(oldArr, newArr, callback); + } - function fileNameChanged(patch) { - return patch.newFileName && patch.newFileName !== patch.oldFileName; - } + 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 selectField(index, mine, theirs) { - if (mine === theirs) { - return mine; - } else { - index.conflict = true; - return { mine: mine, theirs: theirs }; - } - } + function parseIndex() { + var index = {}; + list.push(index); // Parse diff metadata - function hunkBefore(test, check) { - return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; - } + while (i < diffstr.length) { + var line = diffstr[i]; // File header found, end parsing diff metadata - function cloneHunk(hunk, offset) { - return { - oldStart: hunk.oldStart, oldLines: hunk.oldLines, - newStart: hunk.newStart + offset, newLines: hunk.newLines, - lines: hunk.lines - }; - } + if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { + break; + } // Diff index - 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] === ' ') { - /*istanbul ignore start*/var _hunk$lines; - - /*istanbul ignore end*/ // Mine inserted - /*istanbul ignore start*/(_hunk$lines = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(mine))); - } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { - /*istanbul ignore start*/var _hunk$lines2; - - /*istanbul ignore end*/ // Theirs inserted - /*istanbul ignore start*/(_hunk$lines2 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/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); + var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); - if (allRemoves(myChanges) && allRemoves(theirChanges)) { - // Special case for remove changes that are supersets of one another - if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { - /*istanbul ignore start*/var _hunk$lines3; + if (header) { + index.index = header[1]; + } - /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines3 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges)); - return; - } else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { - /*istanbul ignore start*/var _hunk$lines4; + 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 - /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines4 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines4 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges)); - return; - } - } else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) { - /*istanbul ignore start*/var _hunk$lines5; - /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines5 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines5 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges)); - return; - } + parseFileHeader(index); + parseFileHeader(index); // Parse hunks - conflict(hunk, myChanges, theirChanges); - } + index.hunks = []; - function removal(hunk, mine, their, swap) { - var myChanges = collectChange(mine), - theirChanges = collectContext(their, myChanges); - if (theirChanges.merged) { - /*istanbul ignore start*/var _hunk$lines6; + while (i < diffstr.length) { + var _line = diffstr[i]; - /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines6 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines6 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges.merged)); - } else { - conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); - } - } + 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 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 parseFileHeader(index) { + var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]); - 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 - }; - } + if (fileHeader) { + var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; + var data = fileHeader[2].split('\t', 2); + var fileName = data[0].replace(/\\\\/g, '\\'); - 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; - } + if (/^".*"$/.test(fileName)) { + fileName = fileName.substr(1, fileName.length - 2); + } - 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 }; - } + 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]; -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - - /*istanbul ignore start*/'use strict'; - - exports.__esModule = true; - exports. /*istanbul ignore end*/structuredPatch = structuredPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch; - /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch; - - var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/; - - /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - - /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - if (!options) { - options = {}; - } - if (typeof options.context === 'undefined') { - options.context = 4; - } - - var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(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; - - /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - /*istanbul ignore start*/var _curRange; - - /*istanbul ignore end*/ // 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 - /*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/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) { - /*istanbul ignore start*/var _curRange2; - - /*istanbul ignore end*/ // Overlapping - /*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines))); - } else { - /*istanbul ignore start*/var _curRange3; - - /*istanbul ignore end*/ // end the range and output - var contextSize = Math.min(lines.length, options.context); - /*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/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); - if (lines.length == 0 && !oldEOFNewline) { - // 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'); - } else if (!oldEOFNewline || !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++) { - /*istanbul ignore start*/_loop( /*istanbul ignore end*/i); - } - - return { - oldFileName: oldFileName, newFileName: newFileName, - oldHeader: oldHeader, newHeader: newHeader, - hunks: hunks - }; - } + if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { + hunk.lines.push(diffstr[i]); + hunk.linedelimiters.push(delimiters[i] || '\n'); - function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + if (operation === '+') { + addCount++; + } else if (operation === '-') { + removeCount++; + } else if (operation === ' ') { + addCount++; + removeCount++; + } + } else { + break; + } + } // Handle the empty block count case - 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); - } + if (!addCount && hunk.newLines === 1) { + hunk.newLines = 0; + } - return ret.join('\n') + '\n'; - } + if (!removeCount && hunk.oldLines === 1) { + hunk.oldLines = 0; + } // Perform optional sanity checking - function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { - return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); - } + 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(); + } -/***/ }), -/* 15 */ -/***/ (function(module, exports) { + return list; + } - /*istanbul ignore start*/"use strict"; + // 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) - exports.__esModule = true; - exports. /*istanbul ignore end*/arrayEqual = arrayEqual; - /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith; - function arrayEqual(a, b) { - if (a.length !== b.length) { - return false; - } - return arrayStartsWith(a, b); - } + if (start + localOffset <= maxLine) { + return localOffset; + } - function arrayStartsWith(array, start) { - if (start.length > array.length) { - return false; - } + forwardExhausted = true; + } - for (var i = 0; i < start.length; i++) { - if (start[i] !== array[i]) { - return false; - } - } + if (!backwardExhausted) { + if (!forwardExhausted) { + wantForward = true; + } // Check if trying to fit before text beginning, and if not, check it fits + // before offset location - return true; - } + 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 -/***/ }), -/* 16 */ -/***/ (function(module, exports) { - - /*istanbul ignore start*/"use strict"; - - exports.__esModule = true; - exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP; - // See: http://code.google.com/p/google-diff-match-patch/wiki/API - function convertChangesToDMP(changes) { - var ret = [], - change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/, - operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; - 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 applyPatch(source, uniDiff) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } -/***/ }), -/* 17 */ -/***/ (function(module, exports) { + if (Array.isArray(uniDiff)) { + if (uniDiff.length > 1) { + throw new Error('applyPatch only works with a single input.'); + } - /*istanbul ignore start*/'use strict'; + uniDiff = uniDiff[0]; + } // Apply the diff to the input - exports.__esModule = true; - exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML; - 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)); + 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 + */ - 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, '"'); + 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; - return n; - } + if (operation === ' ' || operation === '-') { + // Context sanity check + if (!compareLine(toPos + 1, lines[toPos], operation, content)) { + errorCount++; + if (errorCount > fuzzFactor) { + return false; + } + } + toPos++; + } + } -/***/ }) -/******/ ]) -}); -; -},{}],15:[function(require,module,exports){ + 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 }); + +})); + +},{}],18:[function(require,module,exports){ 'use strict'; module.exports = balanced; function balanced(a, b, str) { @@ -3026,7 +3432,7 @@ function range(a, b, str) { return result; } -},{}],16:[function(require,module,exports){ +},{}],19:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -3043,68 +3449,103 @@ for (var i = 0, len = code.length; i < len; ++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 placeHoldersCount (b64) { +function getLens (b64) { var len = b64.length + if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } - // the number of equal signs (place holders) - // if there are two placeholders, than the two characters before it - // represent one byte - // if there is only one, then the three characters before it represent 2 bytes - // this is just a cheap hack to not do indexOf twice - return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0 + // 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) { - // base64 is 4/3 + up to two characters of the original data - return (b64.length * 3 / 4) - placeHoldersCount(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 i, l, tmp, placeHolders, arr - var len = b64.length - placeHolders = placeHoldersCount(b64) + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] - arr = new Arr((len * 3 / 4) - placeHolders) + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 // if there are placeholders, only get up to the last complete 4 chars - l = placeHolders > 0 ? len - 4 : len + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen - var L = 0 + 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 + } - for (i = 0; i < l; 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[L++] = (tmp >> 16) & 0xFF - arr[L++] = (tmp >> 8) & 0xFF - arr[L++] = tmp & 0xFF + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF } - if (placeHolders === 2) { - tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[L++] = tmp & 0xFF - } else if (placeHolders === 1) { - tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[L++] = (tmp >> 8) & 0xFF - arr[L++] = 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] + 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) + (uint8[i + 1] << 8) + (uint8[i + 2]) + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) output.push(tripletToBase64(tmp)) } return output.join('') @@ -3114,35 +3555,38 @@ function fromByteArray (uint8) { var tmp var len = uint8.length var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var output = '' 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))) + 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] - output += lookup[tmp >> 2] - output += lookup[(tmp << 4) & 0x3F] - output += '==' + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + (uint8[len - 1]) - output += lookup[tmp >> 10] - output += lookup[(tmp >> 4) & 0x3F] - output += lookup[(tmp << 2) & 0x3F] - output += '=' + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) } - parts.push(output) - return parts.join('') } -},{}],17:[function(require,module,exports){ +},{}],20:[function(require,module,exports){ /* * Copyright (c) 2017. becke.ch - All Rights Reserved. * Use is subject to (MIT-style) License terms. @@ -3916,12 +4360,12 @@ function initialize() { } } initialize(); -},{}],18:[function(require,module,exports){ -(function (process,global){ +},{}],21:[function(require,module,exports){ +(function (process,global,setImmediate){ /* @preserve * The MIT License (MIT) * - * Copyright (c) 2013-2017 Petka Antonov + * 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 @@ -3943,7 +4387,7 @@ initialize(); * */ /** - * bluebird build version 3.5.1 + * 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) { - var fn = queue.shift(); - if (typeof fn !== "function") { - fn._settlePromises(); - continue; - } + _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 () { - this._drainQueue(this._normalQueue); + _drainQueue(this._normalQueue); this._reset(); this._haveDrainedQueues = true; - this._drainQueue(this._lateQueue); + _drainQueue(this._lateQueue); }; Async.prototype._queueTick = function () { @@ -4592,6 +5040,7 @@ 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; @@ -4710,6 +5159,7 @@ Promise.longStackTraces = function () { 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) { @@ -4717,12 +5167,14 @@ Promise.longStackTraces = function () { } 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(); } @@ -4738,10 +5190,14 @@ var fireDomEvent = (function() { var event = new CustomEvent("CustomEvent"); util.global.dispatchEvent(event); return function(name, event) { - var domEvent = new CustomEvent(name.toLowerCase(), { + 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") { @@ -4752,6 +5208,8 @@ var fireDomEvent = (function() { 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 { @@ -4900,6 +5358,7 @@ 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) { ; @@ -5005,6 +5464,10 @@ function longStackTracesAttachExtraTrace(error, ignoreSelf) { } } +function longStackTracesDereferenceTrace() { + this._trace = undefined; +} + function checkForgottenReturns(returnValue, promiseCreated, name, promise, parent) { if (returnValue === undefined && promiseCreated !== null && @@ -5262,8 +5725,8 @@ function parseLineInfo(line) { function setBounds(firstLineError, lastLineError) { if (!longStackTracesIsSupported()) return; - var firstStackLines = firstLineError.stack.split("\n"); - var lastStackLines = lastLineError.stack.split("\n"); + var firstStackLines = (firstLineError.stack || "").split("\n"); + var lastStackLines = (lastLineError.stack || "").split("\n"); var firstIndex = -1; var lastIndex = -1; var firstFileName; @@ -5506,7 +5969,7 @@ return { }; }; -},{"./errors":12,"./util":36}],10:[function(_dereq_,module,exports){ +},{"./errors":12,"./es5":13,"./util":36}],10:[function(_dereq_,module,exports){ "use strict"; module.exports = function(Promise) { function returner() { @@ -6787,6 +7250,11 @@ Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { } 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); @@ -7325,6 +7793,7 @@ Promise.prototype._fulfill = function (value) { } else { async.settlePromises(this); } + this._dereferenceTrace(); } }; @@ -7393,6 +7862,14 @@ Promise.prototype._settledValue = function() { } }; +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);} @@ -7419,12 +7896,10 @@ _dereq_("./synchronous_inspection")(Promise); _dereq_("./join")( Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); Promise.Promise = Promise; -Promise.version = "3.5.1"; -_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); +Promise.version = "3.5.5"; _dereq_('./call_get.js')(Promise); -_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); -_dereq_('./timers.js')(Promise, INTERNAL, debug); _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); @@ -7432,9 +7907,11 @@ _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_('./filter.js')(Promise, INTERNAL); -_dereq_('./each.js')(Promise, INTERNAL); +_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); @@ -8406,7 +8883,8 @@ if (util.isNode && typeof MutationObserver === "undefined") { } else if ((typeof MutationObserver !== "undefined") && !(typeof window !== "undefined" && window.navigator && - (window.navigator.standalone || window.cordova))) { + (window.navigator.standalone || window.cordova)) && + ("classList" in document.documentElement)) { schedule = (function() { var div = document.createElement("div"); var opts = {attributes: true}; @@ -9355,8 +9833,12 @@ function toFastProperties(obj) { /*jshint -W027,-W055,-W031*/ function FakeConstructor() {} FakeConstructor.prototype = obj; - var l = 8; - while (l--) new FakeConstructor(); + var receiver = new FakeConstructor(); + function ic() { + return typeof receiver.foo; + } + ic(); + ic(); return obj; eval(obj); } @@ -9530,7 +10012,12 @@ var ret = { domainBind: domainBind }; ret.isRecentNode = ret.isNode && (function() { - var version = process.versions.node.split(".").map(Number); + 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); })(); @@ -9541,8 +10028,9 @@ 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 : {}) -},{"_process":265}],19:[function(require,module,exports){ +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) + +},{"_process":497,"timers":548}],22:[function(require,module,exports){ var concatMap = require('concat-map'); var balanced = require('balanced-match'); @@ -9745,11 +10233,12 @@ function expand(str, isTop) { } -},{"balanced-match":15,"concat-map":39}],20:[function(require,module,exports){ +},{"balanced-match":18,"concat-map":43}],23:[function(require,module,exports){ -},{}],21:[function(require,module,exports){ -arguments[4][20][0].apply(exports,arguments) -},{"dup":20}],22:[function(require,module,exports){ +},{}],24:[function(require,module,exports){ +arguments[4][23][0].apply(exports,arguments) +},{"dup":23}],25:[function(require,module,exports){ +(function (Buffer){ /*! * The buffer module from node.js, for the browser. * @@ -9762,6 +10251,10 @@ arguments[4][20][0].apply(exports,arguments) 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 @@ -9798,20 +10291,38 @@ function typedArraySupport () { // Can typed array instances can be augmented? try { var arr = new Uint8Array(1) - arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} + 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('Invalid typed array length') + throw new RangeError('The value "' + length + '" is invalid for option "size"') } // Return an augmented `Uint8Array` instance var buf = new Uint8Array(length) - buf.__proto__ = Buffer.prototype + Object.setPrototypeOf(buf, Buffer.prototype) return buf } @@ -9829,8 +10340,8 @@ function Buffer (arg, encodingOrOffset, length) { // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { - throw new Error( - 'If encoding is specified then the first argument must be a string' + throw new TypeError( + 'The "string" argument must be of type string. Received type number' ) } return allocUnsafe(arg) @@ -9839,7 +10350,7 @@ function Buffer (arg, encodingOrOffset, length) { } // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species && +if (typeof Symbol !== 'undefined' && Symbol.species != null && Buffer[Symbol.species] === Buffer) { Object.defineProperty(Buffer, Symbol.species, { value: null, @@ -9852,19 +10363,51 @@ if (typeof Symbol !== 'undefined' && Symbol.species && Buffer.poolSize = 8192 // not used by this implementation function from (value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') + 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 (isArrayBuffer(value)) { + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { return fromArrayBuffer(value, encodingOrOffset, length) } - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) + 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) } - return fromObject(value) + 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) + ) } /** @@ -9881,14 +10424,14 @@ Buffer.from = function (value, encodingOrOffset, length) { // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: // https://github.com/feross/buffer/pull/148 -Buffer.prototype.__proto__ = Uint8Array.prototype -Buffer.__proto__ = Uint8Array +Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) +Object.setPrototypeOf(Buffer, Uint8Array) function assertSize (size) { if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') + throw new TypeError('"size" argument must be of type number') } else if (size < 0) { - throw new RangeError('"size" argument must not be negative') + throw new RangeError('The value "' + size + '" is invalid for option "size"') } } @@ -9940,7 +10483,7 @@ function fromString (string, encoding) { } if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') + throw new TypeError('Unknown encoding: ' + encoding) } var length = byteLength(string, encoding) | 0 @@ -9969,11 +10512,11 @@ function fromArrayLike (array) { function fromArrayBuffer (array, byteOffset, length) { if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('\'offset\' is out of bounds') + throw new RangeError('"offset" is outside of buffer bounds') } if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('\'length\' is out of bounds') + throw new RangeError('"length" is outside of buffer bounds') } var buf @@ -9986,7 +10529,8 @@ function fromArrayBuffer (array, byteOffset, length) { } // Return an augmented `Uint8Array` instance - buf.__proto__ = Buffer.prototype + Object.setPrototypeOf(buf, Buffer.prototype) + return buf } @@ -10003,20 +10547,16 @@ function fromObject (obj) { return buf } - if (obj) { - if (isArrayBufferView(obj) || 'length' in obj) { - 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) + if (obj.length !== undefined) { + if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { + return createBuffer(0) } + return fromArrayLike(obj) } - throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(obj.data) + } } function checked (length) { @@ -10037,12 +10577,17 @@ function SlowBuffer (length) { } Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true + 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('Arguments must be Buffers') + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) } if (a === b) return 0 @@ -10103,6 +10648,9 @@ Buffer.concat = function concat (list, 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') } @@ -10116,15 +10664,19 @@ function byteLength (string, encoding) { if (Buffer.isBuffer(string)) { return string.length } - if (isArrayBufferView(string) || isArrayBuffer(string)) { + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { return string.byteLength } if (typeof string !== 'string') { - 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 - if (len === 0) return 0 + var mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && len === 0) return 0 // Use a for loop to avoid recursion var loweredCase = false @@ -10136,7 +10688,6 @@ function byteLength (string, encoding) { return len case 'utf8': case 'utf-8': - case undefined: return utf8ToBytes(string).length case 'ucs2': case 'ucs-2': @@ -10148,7 +10699,9 @@ function byteLength (string, encoding) { case 'base64': return base64ToBytes(string).length default: - if (loweredCase) return utf8ToBytes(string).length // assume utf8 + if (loweredCase) { + return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 + } encoding = ('' + encoding).toLowerCase() loweredCase = true } @@ -10284,6 +10837,8 @@ Buffer.prototype.toString = function toString () { 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 @@ -10293,16 +10848,23 @@ Buffer.prototype.equals = function equals (b) { Buffer.prototype.inspect = function inspect () { var str = '' var max = exports.INSPECT_MAX_BYTES - if (this.length > 0) { - str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') - if (this.length > max) str += ' ... ' - } + 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('Argument must be a Buffer') + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) + ) } if (start === undefined) { @@ -10381,7 +10943,7 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } - byteOffset = +byteOffset // Coerce to Number. + 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) @@ -10418,7 +10980,7 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) + return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') @@ -10504,9 +11066,7 @@ function hexWrite (buf, string, offset, length) { } } - // must be an even number of digits var strLen = string.length - if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') if (length > strLen / 2) { length = strLen / 2 @@ -10635,8 +11195,8 @@ function utf8Slice (buf, start, end) { var codePoint = null var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 + : (firstByte > 0xBF) ? 2 + : 1 if (i + bytesPerSequence <= end) { var secondByte, thirdByte, fourthByte, tempCodePoint @@ -10786,7 +11346,8 @@ Buffer.prototype.slice = function slice (start, end) { var newBuf = this.subarray(start, end) // Return an augmented `Uint8Array` instance - newBuf.__proto__ = Buffer.prototype + Object.setPrototypeOf(newBuf, Buffer.prototype) + return newBuf } @@ -11199,6 +11760,7 @@ Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, 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 @@ -11213,7 +11775,7 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart 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? @@ -11223,22 +11785,19 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) { } var len = end - start - var i - if (this === target && start < targetStart && targetStart < end) { + 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 (i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else if (len < 1000) { - // ascending copy from start - for (i = 0; i < len; ++i) { + for (var i = len - 1; i >= 0; --i) { target[i + targetStart] = this[i + start] } } else { Uint8Array.prototype.set.call( target, - this.subarray(start, start + len), + this.subarray(start, end), targetStart ) } @@ -11261,20 +11820,24 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) { encoding = end end = this.length } - if (val.length === 1) { - var code = val.charCodeAt(0) - if (code < 256) { - val = code - } - } 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. @@ -11299,8 +11862,12 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) { } else { var bytes = Buffer.isBuffer(val) ? val - : new Buffer(val, encoding) + : 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] } @@ -11315,6 +11882,8 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) { 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 '' @@ -11448,26 +12017,24 @@ function blitBuffer (src, dst, offset, length) { return i } -// ArrayBuffers from another context (i.e. an iframe) do not pass the `instanceof` check -// but they should be treated as valid. See: https://github.com/feross/buffer/issues/166 -function isArrayBuffer (obj) { - return obj instanceof ArrayBuffer || - (obj != null && obj.constructor != null && obj.constructor.name === 'ArrayBuffer' && - typeof obj.byteLength === 'number') -} - -// Node 0.10 supports `ArrayBuffer` but lacks `ArrayBuffer.isView` -function isArrayBufferView (obj) { - return (typeof ArrayBuffer.isView === 'function') && ArrayBuffer.isView(obj) +// 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 } -},{"base64-js":16,"ieee754":235}],23:[function(require,module,exports){ +}).call(this,require("buffer").Buffer) + +},{"base64-js":19,"buffer":25,"ieee754":471}],26:[function(require,module,exports){ module.exports = require('./src/table'); -},{"./src/table":26}],24:[function(require,module,exports){ +},{"./src/table":29}],27:[function(require,module,exports){ const utils = require('./utils'); class Cell { @@ -11840,7 +12407,7 @@ module.exports = Cell; module.exports.ColSpanCell = ColSpanCell; module.exports.RowSpanCell = RowSpanCell; -},{"./utils":27,"colors/safe":37}],25:[function(require,module,exports){ +},{"./utils":30,"colors/safe":41}],28:[function(require,module,exports){ const objectAssign = require('object-assign'); const Cell = require('./cell'); const { ColSpanCell, RowSpanCell } = Cell; @@ -12074,7 +12641,7 @@ function makeComputeWidths(colSpan, desiredWidth, x, forcedMin) { }; } -},{"./cell":24,"object-assign":257}],26:[function(require,module,exports){ +},{"./cell":27,"object-assign":489}],29:[function(require,module,exports){ const utils = require('./utils'); const tableLayout = require('./layout-manager'); @@ -12153,7 +12720,7 @@ function doDraw(row, lineNum, result) { module.exports = Table; -},{"./layout-manager":25,"./utils":27}],27:[function(require,module,exports){ +},{"./layout-manager":28,"./utils":30}],30:[function(require,module,exports){ const objectAssign = require('object-assign'); const stringWidth = require('string-width'); @@ -12458,12 +13025,12 @@ module.exports = { colorizeLines: colorizeLines, }; -},{"object-assign":257,"string-width":313}],28:[function(require,module,exports){ +},{"object-assign":489,"string-width":543}],31:[function(require,module,exports){ /* The MIT License (MIT) -Original Library +Original Library - Copyright (c) Marak Squires Additional functionality @@ -12494,35 +13061,45 @@ 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'); +colors.supportsColor = require('./system/supports-colors').supportsColor; -if (typeof colors.enabled === "undefined") { - colors.enabled = colors.supportsColor; +if (typeof colors.enabled === 'undefined') { + colors.enabled = colors.supportsColor() !== false; } -colors.stripColors = colors.strip = function(str){ - return ("" + str).replace(/\x1B\[\d+m/g, ''); +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, ''); +}; -var stylize = colors.stylize = function stylize (str, style) { +// 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) { +var escapeStringRegexp = function(str) { if (typeof str !== 'string') { throw new TypeError('Expected a string'); } - return str.replace(matchOperatorsRe, '\\$&'); -} + return str.replace(matchOperatorsRe, '\\$&'); +}; function build(_styles) { var builder = function builder() { @@ -12535,15 +13112,16 @@ function build(_styles) { return builder; } -var styles = (function () { +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'); + Object.keys(ansiStyles).forEach(function(key) { + ansiStyles[key].closeRe = + new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); ret[key] = { - get: function () { + get: function() { return build(this._styles.concat(key)); - } + }, }; }); return ret; @@ -12552,78 +13130,81 @@ var styles = (function () { var proto = defineProps(function colors() {}, styles); function applyStyle() { - var args = arguments; - var argsLen = args.length; - var str = argsLen !== 0 && String(arguments[0]); - if (argsLen > 1) { - for (var a = 1; a < argsLen; a++) { - str += ' ' + args[a]; + 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; } -function applyTheme (theme) { +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'){ + (function(style) { + colors[style] = function(str) { + if (typeof theme[style] === 'object') { var out = str; - for (var i in theme[style]){ + for (var i in theme[style]) { out = colors[theme[style][i]](out); } return out; } return colors[theme[style]](str); }; - })(style) - } -} - -colors.setTheme = function (theme) { - if (typeof theme === 'string') { - try { - colors.themes[theme] = require(theme); - applyTheme(colors.themes[theme]); - return colors.themes[theme]; - } catch (err) { - console.log(err); - return err; - } - } else { - applyTheme(theme); + })(style); } }; function init() { var ret = {}; - Object.keys(styles).forEach(function (name) { + Object.keys(styles).forEach(function(name) { ret[name] = { - get: function () { + get: function() { return build([name]); - } + }, }; }); return ret; } -var sequencer = function sequencer (map, str) { - var exploded = str.split(""), i = 0; +var sequencer = function sequencer(map, str) { + var exploded = str.split(''); exploded = exploded.map(map); - return exploded.join(""); + return exploded.join(''); }; // custom formatter methods @@ -12632,73 +13213,75 @@ colors.zalgo = require('./custom/zalgo'); // maps colors.maps = {}; -colors.maps.america = require('./maps/america'); -colors.maps.zebra = require('./maps/zebra'); -colors.maps.rainbow = require('./maps/rainbow'); -colors.maps.random = require('./maps/random') +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) { + (function(map) { + colors[map] = function(str) { return sequencer(colors.maps[map], str); - } - })(map) + }; + })(map); } defineProps(colors, init()); -},{"./custom/trap":29,"./custom/zalgo":30,"./maps/america":31,"./maps/rainbow":32,"./maps/random":33,"./maps/zebra":34,"./styles":35,"./system/supports-colors":36}],29:[function(require,module,exports){ -module['exports'] = function runTheTrap (text, options) { - var result = ""; - text = text || "Run the trap, drop the bass"; + +},{"./custom/trap":32,"./custom/zalgo":33,"./maps/america":34,"./maps/rainbow":35,"./maps/random":36,"./maps/zebra":37,"./styles":38,"./system/supports-colors":40,"util":560}],32:[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){ + 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 chars = trap[c] || [' ']; var rand = Math.floor(Math.random() * chars.length); - if (typeof trap[c] !== "undefined") { + if (typeof trap[c] !== 'undefined') { result += trap[c][rand]; } else { result += c; } }); return result; +}; -} - -},{}],30:[function(require,module,exports){ +},{}],33:[function(require,module,exports){ // please no module['exports'] = function zalgo(text, options) { - text = text || " he is here "; + text = text || ' he is here '; var soul = { - "up" : [ + 'up': [ '̍', '̎', '̄', '̅', '̿', '̑', '̆', '̐', '͒', '͗', '͑', '̇', @@ -12711,9 +13294,9 @@ module['exports'] = function zalgo(text, options) { 'ͦ', 'ͧ', 'ͨ', 'ͩ', 'ͪ', 'ͫ', 'ͬ', 'ͭ', 'ͮ', 'ͯ', '̾', '͛', - '͆', '̚' + '͆', '̚', ], - "down" : [ + 'down': [ '̖', '̗', '̘', '̙', '̜', '̝', '̞', '̟', '̠', '̤', '̥', '̦', @@ -12723,70 +13306,75 @@ module['exports'] = function zalgo(text, options) { '̺', '̻', '̼', 'ͅ', '͇', '͈', '͉', '͍', '͎', '͓', '͔', '͕', - '͖', '͙', '͚', '̣' + '͖', '͙', '͚', '̣', ], - "mid" : [ + 'mid': [ '̕', '̛', '̀', '́', '͘', '̡', '̢', '̧', '̨', '̴', '̵', '̶', '͜', '͝', '͞', '͟', '͠', '͢', '̸', - '̷', '͡', ' ҉' - ] - }, - all = [].concat(soul.up, soul.down, soul.mid), - zalgo = {}; + '̷', '͡', ' ҉', + ], + }; + var all = [].concat(soul.up, soul.down, soul.mid); function randomNumber(range) { var r = Math.floor(Math.random() * range); return r; } - function is_char(character) { + function isChar(character) { var bool = false; - all.filter(function (i) { + all.filter(function(i) { bool = (i === character); }); return bool; } - + function heComes(text, options) { - var result = '', counts, l; + 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"; + 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 (is_char(l)) { + if (isChar(l)) { continue; } result = result + text[l]; - counts = {"up" : 0, "down" : 0, "mid" : 0}; + 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; + 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"]; + var arr = ['up', 'mid', 'down']; for (var d in arr) { var index = arr[d]; - for (var i = 0 ; i <= counts[index]; i++) { + for (var i = 0; i <= counts[index]; i++) { if (options[index]) { result = result + soul[index][randomNumber(soul[index].length)]; } @@ -12797,52 +13385,55 @@ module['exports'] = function zalgo(text, options) { } // don't summon him return heComes(text, options); -} +}; -},{}],31:[function(require,module,exports){ -var colors = require('../colors'); -module['exports'] = (function() { - return function (letter, i, exploded) { - if(letter === " ") return letter; - switch(i%3) { +},{}],34:[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) + case 1: return colors.white(letter); + case 2: return colors.blue(letter); } - } -})(); -},{"../colors":28}],32:[function(require,module,exports){ -var colors = require('../colors'); + }; +}; -module['exports'] = (function () { - var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; //RoY G BiV - return function (letter, i, exploded) { - if (letter === " ") { +},{}],35:[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); } }; -})(); - +}; -},{"../colors":28}],33:[function(require,module,exports){ -var colors = require('../colors'); -module['exports'] = (function () { - var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; +},{}],36:[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 - 1))]](letter); + return letter === ' ' ? letter : + colors[ + available[Math.round(Math.random() * (available.length - 2))] + ](letter); }; -})(); -},{"../colors":28}],34:[function(require,module,exports){ -var colors = require('../colors'); +}; -module['exports'] = function (letter, i, exploded) { - return i % 2 === 0 ? letter : colors.inverse(letter); +},{}],37:[function(require,module,exports){ +module['exports'] = function(colors) { + return function(letter, i, exploded) { + return i % 2 === 0 ? letter : colors.inverse(letter); + }; }; -},{"../colors":28}],35:[function(require,module,exports){ + +},{}],38:[function(require,module,exports){ /* The MIT License (MIT) @@ -12910,17 +13501,58 @@ var codes = { blueBG: [44, 49], magentaBG: [45, 49], cyanBG: [46, 49], - whiteBG: [47, 49] + whiteBG: [47, 49], }; -Object.keys(codes).forEach(function (key) { +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'; }); -},{}],36:[function(require,module,exports){ + +},{}],39:[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":497}],40:[function(require,module,exports){ (function (process){ /* The MIT License (MIT) @@ -12947,55 +13579,149 @@ THE SOFTWARE. */ -var argv = process.argv; +'use strict'; -module.exports = (function () { - if (argv.indexOf('--no-color') !== -1 || - argv.indexOf('--color=false') !== -1) { +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; } - if (argv.indexOf('--color') !== -1 || - argv.indexOf('--color=true') !== -1 || - argv.indexOf('--color=always') !== -1) { - return true; + return { + level: level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3, + }; +} + +function supportsColor(stream) { + if (forceColor === false) { + return 0; } - if (process.stdout && !process.stdout.isTTY) { - return false; + 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') { - return true; + // 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 ('COLORTERM' in process.env) { - return true; + 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 (process.env.TERM === 'dumb') { - return false; + if ('TEAMCITY_VERSION' in env) { + return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0 + ); } - if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) { - return true; + 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 + } } - return false; -})(); + 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')) -},{"_process":265}],37:[function(require,module,exports){ + +},{"./has-flag.js":39,"_process":497,"os":491}],41:[function(require,module,exports){ // -// Remark: Requiring this file will use the "safe" colors API which will not touch String.prototype +// Remark: Requiring this file will use the "safe" colors API, +// which will not touch String.prototype. // -// var colors = require('colors/safe); +// var colors = require('colors/safe'); // colors.red("foo") // // var colors = require('./lib/colors'); module['exports'] = colors; -},{"./lib/colors":28}],38:[function(require,module,exports){ -(function (process){ + +},{"./lib/colors":31}],42:[function(require,module,exports){ +(function (Buffer,process){ /** * Module dependencies. */ @@ -13007,6 +13733,12 @@ 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. */ @@ -13035,9 +13767,9 @@ exports.Option = Option; function Option(flags, description) { this.flags = flags; - this.required = ~flags.indexOf('<'); - this.optional = ~flags.indexOf('['); - this.bool = !~flags.indexOf('-no-'); + 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(); @@ -13052,9 +13784,19 @@ function Option(flags, description) { */ Option.prototype.name = function() { - return this.long - .replace('--', '') - .replace('no-', ''); + 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-/, '')); }; /** @@ -13066,7 +13808,7 @@ Option.prototype.name = function() { */ Option.prototype.is = function(arg) { - return arg == this.short || arg == this.long; + return this.short === arg || this.long === arg; }; /** @@ -13083,78 +13825,49 @@ function Command(name) { this._allowUnknownOption = false; this._args = []; this._name = name || ''; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ -Command.prototype.__proto__ = EventEmitter.prototype; + this._helpFlags = '-h, --help'; + this._helpDescription = 'output usage information'; + this._helpShortFlag = '-h'; + this._helpLongFlag = '--help'; +} /** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. + * Define a command. * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. + * 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 - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function() { - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); + * .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('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env) { - * console.log('deploying "%s"', env); - * }); + * .command('start ', 'start named service') + * .command('stop [service]', 'stop named serice, or all if no name supplied'); * - * program.parse(process.argv); - * - * @param {String} name - * @param {String} [desc] for git-style sub-commands - * @return {Command} the new command + * @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(name, desc, opts) { +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 = name.split(/ +/); + var args = nameAndArgs.split(/ +/); var cmd = new Command(args.shift()); if (desc) { @@ -13163,8 +13876,12 @@ Command.prototype.command = function(name, desc, opts) { 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; @@ -13179,7 +13896,7 @@ Command.prototype.command = function(name, desc, opts) { * @api public */ -Command.prototype.arguments = function (desc) { +Command.prototype.arguments = function(desc) { return this.parseExpectedArgs(desc.split(/ +/)); }; @@ -13275,7 +13992,7 @@ Command.prototype.action = function(fn) { if (parsed.args.length) args = parsed.args.concat(args); self._args.forEach(function(arg, i) { - if (arg.required && null == args[i]) { + if (arg.required && args[i] == null) { self.missingArgument(arg.name); } else if (arg.variadic) { if (i !== self._args.length - 1) { @@ -13318,14 +14035,17 @@ Command.prototype.action = function(fn) { * * Examples: * - * // simple boolean defaulting to false + * // simple boolean defaulting to undefined * program.option('-p, --pepper', 'add pepper'); * + * program.pepper + * // => undefined + * * --pepper * program.pepper - * // => Boolean + * // => true * - * // simple boolean defaulting to true + * // simple boolean defaulting to true (unless non-negated option is also defined) * program.option('-C, --no-cheese', 'remove cheese'); * * program.cheese @@ -13354,32 +14074,39 @@ Command.prototype.action = function(fn) { */ Command.prototype.option = function(flags, description, fn, defaultValue) { - var self = this - , option = new Option(flags, description) - , oname = option.name() - , name = camelcase(oname); + var self = this, + option = new Option(flags, description), + oname = option.name(), + name = option.attributeName(); // default as 3rd arg - if (typeof fn != 'function') { + 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 { + }; + } else { defaultValue = fn; fn = null; } } - // preassign default value only for --no-*, [optional], or - if (false == option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (false == option.bool) defaultValue = true; + // 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 (undefined !== defaultValue) self[name] = defaultValue; + if (defaultValue !== undefined) { + self[name] = defaultValue; + option.defaultValue = defaultValue; + } } // register the option @@ -13389,23 +14116,23 @@ Command.prototype.option = function(flags, description, fn, defaultValue) { // and conditionally invoke the callback this.on('option:' + oname, function(val) { // coercion - if (null !== val && fn) val = fn(val, undefined === self[name] - ? defaultValue - : self[name]); - - // unassigned or bool - if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { - // if no value, bool true, and we have a default, then use it! - if (null == val) { - self[name] = option.bool - ? defaultValue || true - : false; + 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 (null !== val) { + } else if (val !== null) { // reassign - self[name] = val; + self[name] = option.negate ? false : val; } }); @@ -13420,8 +14147,8 @@ Command.prototype.option = function(flags, description, fn, defaultValue) { * @api public */ Command.prototype.allowUnknownOption = function(arg) { - this._allowUnknownOption = arguments.length === 0 || arg; - return this; + this._allowUnknownOption = arguments.length === 0 || arg; + return this; }; /** @@ -13445,36 +14172,58 @@ Command.prototype.parse = function(argv) { // github-style sub-commands with no sub-command if (this.executables && argv.length < 3 && !this.defaultExecutable) { // this user needs help - argv.push('--help'); + argv.push(this._helpLongFlag); } // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); + 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; - var aliasCommand = null; - // check alias of sub commands + // Look for subcommand if (name) { - aliasCommand = this.commands.filter(function(command) { + 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; - })[0]; + }); + 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); - } else if (aliasCommand) { - // is alias of a subCommand - args[0] = aliasCommand._name; - return this.executeSubCommand(argv, args, parsed.unknown); - } else if (this.defaultExecutable) { - // use the default subcommand - args.unshift(this.defaultExecutable); - return this.executeSubCommand(argv, args, parsed.unknown); + if (this._execs[name] && typeof this._execs[name] !== 'function') { + return this.executeSubCommand(argv, args, parsed.unknown, subCommand ? subCommand._executableFile : undefined); } return result; @@ -13486,46 +14235,49 @@ Command.prototype.parse = function(argv) { * @param {Array} argv * @param {Array} args * @param {Array} unknown + * @param {String} specifySubcommand * @api private */ -Command.prototype.executeSubCommand = function(argv, args, unknown) { +Command.prototype.executeSubCommand = function(argv, args, unknown, executableFile) { args = args.concat(unknown); if (!args.length) this.help(); - if ('help' == args[0] && 1 == args.length) this.help(); - // --help - if ('help' == args[0]) { - args[0] = args[1]; - args[1] = '--help'; - } + var isExplicitJS = false; // Whether to use node to launch "executable" // executable - var f = argv[1]; - // name of the subcommand, link `pm-install` - var bin = basename(f, '.js') + '-' + args[0]; - + 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 - , link = fs.lstatSync(f).isSymbolicLink() ? fs.readlinkSync(f) : f; + var baseDir; - // when symbolink is relative path - if (link !== f && link.charAt(0) !== '/') { - link = path.join(dirname(f), link) - } - baseDir = dirname(link); + 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` extension - var isExplicitJS = false; + // 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; } @@ -13537,31 +14289,33 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) { if (isExplicitJS) { args.unshift(bin); // add executable arguments to spawn - args = (process.execArgv || []).concat(args); + args = incrementNodeInspectorPort(process.execArgv).concat(args); - proc = spawn('node', args, { stdio: 'inherit', customFds: [0, 1, 2] }); + 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); - proc = spawn(process.execPath, args, { stdio: 'inherit'}); + // 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)){ + 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('\n %s(1) does not exist, try --help\n', bin); - } else if (err.code == "EACCES") { - console.error('\n %s(1) not executable. try chmod or run with root\n', bin); + 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); }); @@ -13581,15 +14335,17 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) { */ Command.prototype.normalize = function(args) { - var ret = [] - , arg - , lastOpt - , index; + 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]); + lastOpt = this.optionFor(args[i - 1]); } if (arg === '--') { @@ -13598,10 +14354,17 @@ Command.prototype.normalize = function(args) { break; } else if (lastOpt && lastOpt.required) { ret.push(arg); - } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { - arg.slice(1).split('').forEach(function(c) { - ret.push('-' + c); - }); + } 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 { @@ -13642,6 +14405,10 @@ Command.prototype.parseArgs = function(args, unknown) { 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; @@ -13673,11 +14440,11 @@ Command.prototype.optionFor = function(arg) { */ Command.prototype.parseOptions = function(argv) { - var args = [] - , len = argv.length - , literal - , option - , arg; + var args = [], + len = argv.length, + literal, + option, + arg; var unknownOptions = []; @@ -13691,7 +14458,7 @@ Command.prototype.parseOptions = function(argv) { continue; } - if ('--' == arg) { + if (arg === '--') { literal = true; continue; } @@ -13704,18 +14471,18 @@ Command.prototype.parseOptions = function(argv) { // requires arg if (option.required) { arg = argv[++i]; - if (null == arg) return this.optionMissingArgument(option); + if (arg == null) return this.optionMissingArgument(option); this.emit('option:' + option.name(), arg); // optional arg } else if (option.optional) { - arg = argv[i+1]; - if (null == arg || ('-' == arg[0] && '-' != arg)) { + arg = argv[i + 1]; + if (arg == null || (arg[0] === '-' && arg !== '-')) { arg = null; } else { ++i; } this.emit('option:' + option.name(), arg); - // bool + // flag } else { this.emit('option:' + option.name()); } @@ -13723,13 +14490,13 @@ Command.prototype.parseOptions = function(argv) { } // looks like an option - if (arg.length > 1 && '-' == arg[0]) { + 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 (argv[i+1] && '-' != argv[i+1][0]) { + if ((i + 1) < argv.length && (argv[i + 1][0] !== '-' || argv[i + 1] === '-')) { unknownOptions.push(argv[++i]); } continue; @@ -13749,12 +14516,12 @@ Command.prototype.parseOptions = function(argv) { * @api public */ Command.prototype.opts = function() { - var result = {} - , len = this.options.length; + var result = {}, + len = this.options.length; - for (var i = 0 ; i < len; i++) { - var key = camelcase(this.options[i].name()); - result[key] = key === 'version' ? this._version : this[key]; + for (var i = 0; i < len; i++) { + var key = this.options[i].attributeName(); + result[key] = key === this._versionOptionName ? this._version : this[key]; } return result; }; @@ -13767,9 +14534,7 @@ Command.prototype.opts = function() { */ Command.prototype.missingArgument = function(name) { - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); + console.error("error: missing required argument '%s'", name); process.exit(1); }; @@ -13782,13 +14547,11 @@ Command.prototype.missingArgument = function(name) { */ Command.prototype.optionMissingArgument = function(option, flag) { - console.error(); if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); + console.error("error: option '%s' argument missing, got '%s'", option.flags, flag); } else { - console.error(" error: option `%s' argument missing", option.flags); + console.error("error: option '%s' argument missing", option.flags); } - console.error(); process.exit(1); }; @@ -13801,9 +14564,7 @@ Command.prototype.optionMissingArgument = function(option, flag) { Command.prototype.unknownOption = function(flag) { if (this._allowUnknownOption) return; - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); + console.error("error: unknown option '%s'", flag); process.exit(1); }; @@ -13815,9 +14576,7 @@ Command.prototype.unknownOption = function(flag) { */ Command.prototype.variadicArgNotLast = function(name) { - console.error(); - console.error(" error: variadic arguments must be last `%s'", name); - console.error(); + console.error("error: variadic arguments must be last '%s'", name); process.exit(1); }; @@ -13827,18 +14586,24 @@ Command.prototype.variadicArgNotLast = function(name) { * 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) { - if (0 == arguments.length) return this._version; +Command.prototype.version = function(str, flags, description) { + if (arguments.length === 0) return this._version; this._version = str; flags = flags || '-V, --version'; - this.option(flags, 'output the version number'); - this.on('option:version', function() { + 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); }); @@ -13849,13 +14614,15 @@ Command.prototype.version = function(str, flags) { * Set the description to `str`. * * @param {String} str + * @param {Object} argsDescription * @return {String|Command} * @api public */ -Command.prototype.description = function(str) { - if (0 === arguments.length) return this._description; +Command.prototype.description = function(str, argsDescription) { + if (arguments.length === 0) return this._description; this._description = str; + this._argsDescription = argsDescription; return this; }; @@ -13869,12 +14636,14 @@ Command.prototype.description = function(str) { Command.prototype.alias = function(alias) { var command = this; - if(this.commands.length !== 0) { - command = this.commands[this.commands.length - 1] + 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; }; @@ -13892,11 +14661,11 @@ Command.prototype.usage = function(str) { return humanReadableArgName(arg); }); - var usage = '[options]' - + (this.commands.length ? ' [command]' : '') - + (this._args.length ? ' ' + args.join(' ') : ''); + var usage = '[options]' + + (this.commands.length ? ' [command]' : '') + + (this._args.length ? ' ' + args.join(' ') : ''); - if (0 == arguments.length) return this._usage || usage; + if (arguments.length === 0) return this._usage || usage; this._usage = str; return this; @@ -13911,11 +14680,50 @@ Command.prototype.usage = function(str) { */ Command.prototype.name = function(str) { - if (0 === arguments.length) return this._name; + 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. * @@ -13924,11 +14732,53 @@ Command.prototype.name = function(str) { */ Command.prototype.largestOptionLength = function() { - return this.options.reduce(function(max, option) { + 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. * @@ -13937,12 +14787,13 @@ Command.prototype.largestOptionLength = function() { */ Command.prototype.optionHelp = function() { - var width = this.largestOptionLength(); + var width = this.padWidth(); // Append the help information return this.options.map(function(option) { - return pad(option.flags, width) + ' ' + option.description; - }).concat([pad('-h, --help', width) + ' ' + 'output usage information']) + 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'); }; @@ -13956,35 +14807,16 @@ Command.prototype.optionHelp = function() { Command.prototype.commandHelp = function() { if (!this.commands.length) return ''; - var commands = 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 - , cmd._description - ]; - }); - - var width = commands.reduce(function(max, command) { - return Math.max(max, command[0].length); - }, 0); + var commands = this.prepareCommands(); + var width = this.padWidth(); return [ - '' - , ' Commands:' - , '' - , commands.map(function(cmd) { + 'Commands:', + commands.map(function(cmd) { var desc = cmd[1] ? ' ' + cmd[1] : ''; - return pad(cmd[0], width) + desc; - }).join('\n').replace(/^/gm, ' ') - , '' + return (desc ? pad(cmd[0], width) : cmd[0]) + desc; + }).join('\n').replace(/^/gm, ' '), + '' ].join('\n'); }; @@ -13999,19 +14831,33 @@ Command.prototype.helpInformation = function() { var desc = []; if (this._description) { desc = [ - ' ' + this._description - , '' + 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(), '' - ,' Usage: ' + cmdName + ' ' + this.usage() - , '' ]; var cmds = []; @@ -14019,11 +14865,9 @@ Command.prototype.helpInformation = function() { if (commandHelp) cmds = [commandHelp]; var options = [ + 'Options:', + '' + this.optionHelp().replace(/^/gm, ' '), '' - , ' Options:' - , '' - , '' + this.optionHelp().replace(/^/gm, ' ') - , '' ]; return usage @@ -14034,7 +14878,10 @@ Command.prototype.helpInformation = function() { }; /** - * Output help information for this command + * Output help information for this command. + * + * When listener(s) are available for the helpLongFlag + * those callbacks are invoked. * * @api public */ @@ -14043,15 +14890,43 @@ 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(cb(this.helpInformation())); - this.emit('--help'); + 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 */ @@ -14098,8 +14973,9 @@ function pad(str, width) { function outputHelpIfNecessary(cmd, options) { options = options || []; + for (var i = 0; i < options.length; i++) { - if (options[i] == '--help' || options[i] == '-h') { + if (options[i] === cmd._helpLongFlag || options[i] === cmd._helpShortFlag) { cmd.outputHelp(); process.exit(0); } @@ -14107,7 +14983,7 @@ function outputHelpIfNecessary(cmd, options) { } /** - * Takes an argument an returns its human readable equivalent for help usage. + * Takes an argument and returns its human readable equivalent for help usage. * * @param {Object} arg * @return {String} @@ -14119,7 +14995,7 @@ function humanReadableArgName(arg) { return arg.required ? '<' + nameOutput + '>' - : '[' + nameOutput + ']' + : '[' + nameOutput + ']'; } // for versions before node v0.8 when there weren't `fs.existsSync` @@ -14133,9 +15009,56 @@ function exists(file) { } } +/** + * 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]; + } -}).call(this,require('_process')) -},{"_process":265,"child_process":21,"events":209,"fs":21,"path":260}],39:[function(require,module,exports){ + 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":475,"_process":497,"child_process":24,"events":444,"fs":24,"path":493,"util":560}],43:[function(require,module,exports){ module.exports = function (xs, fn) { var res = []; for (var i = 0; i < xs.length; i++) { @@ -14150,7 +15073,7 @@ var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; -},{}],40:[function(require,module,exports){ +},{}],44:[function(require,module,exports){ module.exports={ "O_RDONLY": 0, "O_WRONLY": 1, @@ -14361,44 +15284,641 @@ module.exports={ "UV_UDP_REUSEADDR": 4 } -},{}],41:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ module.exports = function (it) { - if (typeof it != 'function') throw TypeError(it + ' is not a function!'); - return it; + if (typeof it != 'function') { + throw TypeError(String(it) + ' is not a function'); + } return it; }; -},{}],42:[function(require,module,exports){ -// 22.1.3.31 Array.prototype[@@unscopables] -var UNSCOPABLES = require('./_wks')('unscopables'); -var ArrayProto = Array.prototype; -if (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {}); +},{}],46:[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":114}],47:[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) { - ArrayProto[UNSCOPABLES][key] = true; + ArrayPrototype[UNSCOPABLES][key] = true; +}; + +},{"../internals/hide":102,"../internals/object-create":133,"../internals/well-known-symbol":188}],48:[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); }; -},{"./_hide":67,"./_wks":123}],43:[function(require,module,exports){ -module.exports = function (it, Constructor, name, forbiddenField) { - if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { - throw TypeError(name + ': incorrect invocation!'); +},{"../internals/string-multibyte":168}],49:[function(require,module,exports){ +module.exports = function (it, Constructor, name) { + if (!(it instanceof Constructor)) { + throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); } return it; }; -},{}],44:[function(require,module,exports){ -var isObject = require('./_is-object'); +},{}],50:[function(require,module,exports){ +var isObject = require('../internals/is-object'); + module.exports = function (it) { - if (!isObject(it)) throw TypeError(it + ' is not an object!'); - return it; + if (!isObject(it)) { + throw TypeError(String(it) + ' is not an object'); + } return it; +}; + +},{"../internals/is-object":114}],51:[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":67,"../internals/descriptors":82,"../internals/global":99,"../internals/has":100,"../internals/hide":102,"../internals/is-object":114,"../internals/object-define-property":135,"../internals/object-get-prototype-of":140,"../internals/object-set-prototype-of":144,"../internals/redefine":155,"../internals/uid":185,"../internals/well-known-symbol":188}],52:[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]; }; -},{"./_is-object":75}],45:[function(require,module,exports){ -// false -> 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) { +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":49,"../internals/array-buffer-view-core":51,"../internals/array-fill":54,"../internals/descriptors":82,"../internals/fails":87,"../internals/global":99,"../internals/hide":102,"../internals/internal-state":109,"../internals/object-define-property":135,"../internals/object-get-own-property-names":138,"../internals/redefine-all":154,"../internals/set-to-string-tag":163,"../internals/to-index":175,"../internals/to-integer":177,"../internals/to-length":178}],53:[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":174,"../internals/to-length":178,"../internals/to-object":179}],54:[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":174,"../internals/to-length":178,"../internals/to-object":179}],55:[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":58,"../internals/sloppy-array-method":166}],56:[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":63,"../internals/call-with-safe-iteration-closing":64,"../internals/create-property":77,"../internals/get-iterator-method":97,"../internals/is-array-iterator-method":110,"../internals/to-length":178,"../internals/to-object":179}],57:[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 = toIObject($this); + var O = toIndexedObject($this); var length = toLength(O.length); var index = toAbsoluteIndex(fromIndex, length); var value; @@ -14409,137 +15929,206 @@ module.exports = function (IS_INCLUDES) { // 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; + } else for (;length > index; index++) { + if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; -},{"./_to-absolute-index":113,"./_to-iobject":115,"./_to-length":116}],46:[function(require,module,exports){ -// 0 -> Array#forEach -// 1 -> Array#map -// 2 -> Array#filter -// 3 -> Array#some -// 4 -> Array#every -// 5 -> Array#find -// 6 -> Array#findIndex -var ctx = require('./_ctx'); -var IObject = require('./_iobject'); -var toObject = require('./_to-object'); -var toLength = require('./_to-length'); -var asc = require('./_array-species-create'); -module.exports = function (TYPE, $create) { +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":174,"../internals/to-indexed-object":176,"../internals/to-length":178}],58:[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; - var create = $create || asc; - return function ($this, callbackfn, that) { + return function ($this, callbackfn, that, specificCreate) { var O = toObject($this); - var self = IObject(O); - var f = ctx(callbackfn, that, 3); + var self = IndexedObject(O); + var boundFunction = bind(callbackfn, that, 3); var length = toLength(self.length); var index = 0; - var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; - var val, res; + 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) { - val = self[index]; - res = f(val, index, O); + value = self[index]; + result = boundFunction(value, index, O); if (TYPE) { - if (IS_MAP) result[index] = res; // map - else if (res) switch (TYPE) { - case 3: return true; // some - case 5: return val; // find - case 6: return index; // findIndex - case 2: result.push(val); // filter - } else if (IS_EVERY) return false; // every + 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 : result; + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; }; }; -},{"./_array-species-create":48,"./_ctx":53,"./_iobject":72,"./_to-length":116,"./_to-object":117}],47:[function(require,module,exports){ -var isObject = require('./_is-object'); -var isArray = require('./_is-array'); -var SPECIES = require('./_wks')('species'); - -module.exports = function (original) { - var C; - if (isArray(original)) { - C = original.constructor; - // cross-realm fallback - if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; - if (isObject(C)) { - C = C[SPECIES]; - if (C === null) C = undefined; - } - } return C === undefined ? Array : C; -}; +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":62,"../internals/bind-context":63,"../internals/indexed-object":106,"../internals/to-length":178,"../internals/to-object":179}],59:[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'); -},{"./_is-array":74,"./_is-object":75,"./_wks":123}],48:[function(require,module,exports){ -// 9.4.2.3 ArraySpeciesCreate(originalArray, length) -var speciesConstructor = require('./_array-species-constructor'); +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; -module.exports = function (original, length) { - return new (speciesConstructor(original))(length); -}; +},{"../internals/sloppy-array-method":166,"../internals/to-indexed-object":176,"../internals/to-integer":177,"../internals/to-length":178}],60:[function(require,module,exports){ +var fails = require('../internals/fails'); +var wellKnownSymbol = require('../internals/well-known-symbol'); -},{"./_array-species-constructor":47}],49:[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'; +var SPECIES = wellKnownSymbol('species'); -// fallback for IE11 Script Access Denied error -var tryGet = function (it, key) { - try { - return it[key]; - } catch (e) { /* empty */ } +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; + }); }; -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; -}; +},{"../internals/fails":87,"../internals/well-known-symbol":188}],61:[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'); -},{"./_cof":50,"./_wks":123}],50:[function(require,module,exports){ -var toString = {}.toString; +// `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 = function (it) { - return toString.call(it).slice(8, -1); +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) }; -},{}],51:[function(require,module,exports){ -var core = module.exports = { version: '2.5.7' }; -if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef +},{"../internals/a-function":45,"../internals/indexed-object":106,"../internals/to-length":178,"../internals/to-object":179}],62:[function(require,module,exports){ +var isObject = require('../internals/is-object'); +var isArray = require('../internals/is-array'); +var wellKnownSymbol = require('../internals/well-known-symbol'); -},{}],52:[function(require,module,exports){ -'use strict'; -var $defineProperty = require('./_object-dp'); -var createDesc = require('./_property-desc'); +var SPECIES = wellKnownSymbol('species'); -module.exports = function (object, index, value) { - if (index in object) $defineProperty.f(object, index, createDesc(0, value)); - else object[index] = value; +// `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); }; -},{"./_object-dp":88,"./_property-desc":101}],53:[function(require,module,exports){ +},{"../internals/is-array":111,"../internals/is-object":114,"../internals/well-known-symbol":188}],63:[function(require,module,exports){ +var aFunction = require('../internals/a-function'); + // 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 0: return function () { + return fn.call(that); + }; case 1: return function (a) { return fn.call(that, a); }; @@ -14555,530 +16144,1636 @@ module.exports = function (fn, that, length) { }; }; -},{"./_a-function":41}],54:[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; -}; - -},{}],55:[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; -}); +},{"../internals/a-function":45}],64:[function(require,module,exports){ +var anObject = require('../internals/an-object'); -},{"./_fails":61}],56:[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) : {}; +// 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; + } }; -},{"./_global":65,"./_is-object":75}],57:[function(require,module,exports){ -// IE 8- don't enum bug keys -module.exports = ( - 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' -).split(','); - -},{}],58:[function(require,module,exports){ -// all enumerable object keys, includes symbols -var getKeys = require('./_object-keys'); -var gOPS = require('./_object-gops'); -var pIE = require('./_object-pie'); -module.exports = function (it) { - var result = getKeys(it); - var getSymbols = gOPS.f; - if (getSymbols) { - var symbols = getSymbols(it); - var isEnum = pIE.f; - var i = 0; - var key; - while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); - } return result; -}; +},{"../internals/an-object":50}],65:[function(require,module,exports){ +var wellKnownSymbol = require('../internals/well-known-symbol'); -},{"./_object-gops":93,"./_object-keys":96,"./_object-pie":97}],59:[function(require,module,exports){ -var global = require('./_global'); -var core = require('./_core'); -var hide = require('./_hide'); -var redefine = require('./_redefine'); -var ctx = require('./_ctx'); -var PROTOTYPE = 'prototype'; +var ITERATOR = wellKnownSymbol('iterator'); +var SAFE_CLOSING = false; -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 target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; - var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); - var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); - var key, own, out, exp; - if (IS_GLOBAL) source = name; - for (key in source) { - // contains in native - own = !IS_FORCED && target && target[key] !== undefined; - // export native or passed - out = (own ? target : source)[key]; - // bind timers to global for call from export context - exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - // extend global - if (target) redefine(target, key, out, type & $export.U); - // export - if (exports[key] != out) hide(exports, key, exp); - if (IS_PROTO && expProto[key] != out) expProto[key] = out; - } -}; -global.core = core; -// 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":51,"./_ctx":53,"./_global":65,"./_hide":67,"./_redefine":103}],60:[function(require,module,exports){ -var MATCH = require('./_wks')('match'); -module.exports = function (KEY) { - var re = /./; - try { - '/./'[KEY](re); - } catch (e) { - try { - re[MATCH] = false; - return !'/./'[KEY](re); - } catch (f) { /* empty */ } - } return true; -}; +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 */ } -},{"./_wks":123}],61:[function(require,module,exports){ -module.exports = function (exec) { +module.exports = function (exec, SKIP_CLOSING) { + if (!SKIP_CLOSING && !SAFE_CLOSING) return false; + var ITERATION_SUPPORT = false; try { - return !!exec(); - } catch (e) { - return true; - } + var object = {}; + object[ITERATOR] = function () { + return { + next: function () { + return { done: ITERATION_SUPPORT = true }; + } + }; + }; + exec(object); + } catch (error) { /* empty */ } + return ITERATION_SUPPORT; }; -},{}],62:[function(require,module,exports){ -'use strict'; -var hide = require('./_hide'); -var redefine = require('./_redefine'); -var fails = require('./_fails'); -var defined = require('./_defined'); -var wks = require('./_wks'); - -module.exports = function (KEY, length, exec) { - var SYMBOL = wks(KEY); - var fns = exec(defined, SYMBOL, ''[KEY]); - var strfn = fns[0]; - var rxfn = fns[1]; - if (fails(function () { - var O = {}; - O[SYMBOL] = function () { return 7; }; - return ''[KEY](O) != 7; - })) { - redefine(String.prototype, KEY, strfn); - hide(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 rxfn.call(string, this, arg); } - // 21.2.5.6 RegExp.prototype[@@match](string) - // 21.2.5.9 RegExp.prototype[@@search](string) - : function (string) { return rxfn.call(string, this); } - ); - } -}; +},{"../internals/well-known-symbol":188}],66:[function(require,module,exports){ +var toString = {}.toString; -},{"./_defined":54,"./_fails":61,"./_hide":67,"./_redefine":103,"./_wks":123}],63:[function(require,module,exports){ -'use strict'; -// 21.2.5.3 get RegExp.prototype.flags -var anObject = require('./_an-object'); -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.unicode) result += 'u'; - if (that.sticky) result += 'y'; - return result; +module.exports = function (it) { + return toString.call(it).slice(8, -1); }; -},{"./_an-object":44}],64:[function(require,module,exports){ -var ctx = require('./_ctx'); -var call = require('./_iter-call'); -var isArrayIter = require('./_is-array-iter'); -var anObject = require('./_an-object'); -var toLength = require('./_to-length'); -var getIterFn = require('./core.get-iterator-method'); -var BREAK = {}; -var RETURN = {}; -var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { - var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); - var f = ctx(fn, that, entries ? 2 : 1); - var index = 0; - var length, step, iterator, result; - if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); - // fast case for arrays with default iterator - if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { - result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); - if (result === BREAK || result === RETURN) return result; - } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { - result = call(iterator, f, step.value, entries); - if (result === BREAK || result === RETURN) return result; - } -}; -exports.BREAK = BREAK; -exports.RETURN = RETURN; +},{}],67:[function(require,module,exports){ +var classofRaw = require('../internals/classof-raw'); +var wellKnownSymbol = require('../internals/well-known-symbol'); -},{"./_an-object":44,"./_ctx":53,"./_is-array-iter":73,"./_iter-call":77,"./_to-length":116,"./core.get-iterator-method":124}],65:[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 +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +// ES3 wrong here +var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; -},{}],66:[function(require,module,exports){ -var hasOwnProperty = {}.hasOwnProperty; -module.exports = function (it, key) { - return hasOwnProperty.call(it, key); +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (error) { /* empty */ } }; -},{}],67:[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; +// 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; }; -},{"./_descriptors":55,"./_object-dp":88,"./_property-desc":101}],68:[function(require,module,exports){ -var document = require('./_global').document; -module.exports = document && document.documentElement; +},{"../internals/classof-raw":66,"../internals/well-known-symbol":188}],68:[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; -},{"./_global":65}],69:[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; -}); +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); + }); -},{"./_descriptors":55,"./_dom-create":56,"./_fails":61}],70:[function(require,module,exports){ -var isObject = require('./_is-object'); -var setPrototypeOf = require('./_set-proto').set; -module.exports = function (that, target, C) { - var S = target.constructor; - var P; - if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { - setPrototypeOf(that, P); - } return that; -}; + var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); -},{"./_is-object":75,"./_set-proto":104}],71:[function(require,module,exports){ -// fast apply, http://jsperf.lnkit.com/fast-apply/5 -module.exports = function (fn, args, that) { - var un = that === undefined; - switch (args.length) { - case 0: return un ? fn() - : fn.call(that); - case 1: return un ? fn(args[0]) - : fn.call(that, args[0]); - case 2: return un ? fn(args[0], args[1]) - : fn.call(that, args[0], args[1]); - case 3: return un ? fn(args[0], args[1], args[2]) - : fn.call(that, args[0], args[1], args[2]); - case 4: return un ? fn(args[0], args[1], args[2], args[3]) - : fn.call(that, args[0], args[1], args[2], args[3]); - } return fn.apply(that, args); -}; - -},{}],72:[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); -}; + 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; + }; -},{"./_cof":50}],73:[function(require,module,exports){ -// check on default Array iterator -var Iterators = require('./_iterators'); -var ITERATOR = require('./_wks')('iterator'); -var ArrayProto = Array.prototype; + 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; + } + }; -module.exports = function (it) { - return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); -}; + 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); + } + }); -},{"./_iterators":82,"./_wks":123}],74:[function(require,module,exports){ -// 7.2.2 IsArray(argument) -var cof = require('./_cof'); -module.exports = Array.isArray || function isArray(arg) { - return cof(arg) == 'Array'; + 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":49,"../internals/bind-context":63,"../internals/define-iterator":80,"../internals/descriptors":82,"../internals/internal-metadata":108,"../internals/internal-state":109,"../internals/iterate":117,"../internals/object-create":133,"../internals/object-define-property":135,"../internals/redefine-all":154,"../internals/set-species":162}],69:[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()); }; -},{"./_cof":50}],75:[function(require,module,exports){ -module.exports = function (it) { - return typeof it === 'object' ? it !== null : typeof it === 'function'; +var UncaughtFrozenStore = function () { + this.entries = []; }; -},{}],76:[function(require,module,exports){ -// 7.2.8 IsRegExp(argument) -var isObject = require('./_is-object'); -var cof = require('./_cof'); -var MATCH = require('./_wks')('match'); -module.exports = function (it) { - var isRegExp; - return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); +var findUncaughtFrozen = function (store, key) { + return find(store.entries, function (it) { + return it[0] === key; + }); }; -},{"./_cof":50,"./_is-object":75,"./_wks":123}],77:[function(require,module,exports){ -// call something on iterator step with safe closing on error -var anObject = require('./_an-object'); -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 (e) { - var ret = iterator['return']; - if (ret !== undefined) anObject(ret.call(iterator)); - throw e; +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; } }; -},{"./_an-object":44}],78:[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 = {}; +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); + }); -// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() -require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; }); + var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); -module.exports = function (Constructor, NAME, next) { - Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); - setToStringTag(Constructor, NAME + ' Iterator'); -}; + 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; + }; -},{"./_hide":67,"./_object-create":87,"./_property-desc":101,"./_set-to-string-tag":106,"./_wks":123}],79:[function(require,module,exports){ + 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":49,"../internals/an-object":50,"../internals/array-iteration":58,"../internals/has":100,"../internals/internal-metadata":108,"../internals/internal-state":109,"../internals/is-object":114,"../internals/iterate":117,"../internals/redefine-all":154}],70:[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":49,"../internals/check-correctness-of-iteration":65,"../internals/export":86,"../internals/fails":87,"../internals/global":99,"../internals/inherit-if-required":107,"../internals/internal-metadata":108,"../internals/is-forced":112,"../internals/is-object":114,"../internals/iterate":117,"../internals/redefine":155,"../internals/set-to-string-tag":163}],71:[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":100,"../internals/object-define-property":135,"../internals/object-get-own-property-descriptor":136,"../internals/own-keys":147}],72:[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":188}],73:[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":87}],74:[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":159}],75:[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":76,"../internals/iterators":119,"../internals/iterators-core":118,"../internals/object-create":133,"../internals/set-to-string-tag":163}],76:[function(require,module,exports){ +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + +},{}],77:[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":76,"../internals/object-define-property":135,"../internals/to-primitive":181}],78:[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":87,"../internals/string-pad":169}],79:[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":50,"../internals/to-primitive":181}],80:[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 $ = 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 (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); }; +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 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) { + + 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(IteratorPrototype, TAG, true); - // fix for some old engines - if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); + setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); + if (IS_PURE) Iterators[TO_STRING_TAG] = 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); }; + if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { + INCORRECT_VALUES_NAME = true; + defaultIterator = function values() { return nativeIterator.call(this); }; } - // Define iterator - if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { - hide(proto, ITERATOR, $default); + + // define iterator + if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { + hide(IterablePrototype, ITERATOR, defaultIterator); } - // Plug for library - Iterators[NAME] = $default; - Iterators[TAG] = returnThis; + Iterators[NAME] = defaultIterator; + + // export additional methods if (DEFAULT) { methods = { - values: DEF_VALUES ? $default : getMethod(VALUES), - keys: IS_SET ? $default : getMethod(KEYS), - entries: $entries + values: getIterationMethod(VALUES), + keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), + entries: getIterationMethod(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); + 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; }; -},{"./_export":59,"./_hide":67,"./_iter-create":78,"./_iterators":82,"./_library":83,"./_object-gpo":94,"./_redefine":103,"./_set-to-string-tag":106,"./_wks":123}],80:[function(require,module,exports){ -var ITERATOR = require('./_wks')('iterator'); -var SAFE_CLOSING = false; +},{"../internals/create-iterator-constructor":75,"../internals/export":86,"../internals/hide":102,"../internals/is-pure":115,"../internals/iterators":119,"../internals/iterators-core":118,"../internals/object-get-prototype-of":140,"../internals/object-set-prototype-of":144,"../internals/redefine":155,"../internals/set-to-string-tag":163,"../internals/well-known-symbol":188}],81:[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; -try { - var riter = [7][ITERATOR](); - riter['return'] = function () { SAFE_CLOSING = true; }; - // eslint-disable-next-line no-throw-literal - Array.from(riter, function () { throw 2; }); -} catch (e) { /* empty */ } +module.exports = function (NAME) { + var Symbol = path.Symbol || (path.Symbol = {}); + if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, { + value: wrappedWellKnownSymbolModule.f(NAME) + }); +}; + +},{"../internals/has":100,"../internals/object-define-property":135,"../internals/path":150,"../internals/wrapped-well-known-symbol":190}],82:[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; +}); -module.exports = function (exec, skipClosing) { - if (!skipClosing && !SAFE_CLOSING) return false; - var safe = false; +},{"../internals/fails":87}],83:[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":99,"../internals/is-object":114}],84:[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 +}; + +},{}],85:[function(require,module,exports){ +// IE8- don't enum bug keys +module.exports = [ + 'constructor', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'toLocaleString', + 'toString', + 'valueOf' +]; + +},{}],86:[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":71,"../internals/global":99,"../internals/hide":102,"../internals/is-forced":112,"../internals/object-get-own-property-descriptor":136,"../internals/redefine":155,"../internals/set-global":161}],87:[function(require,module,exports){ +module.exports = function (exec) { try { - var arr = [7]; - var iter = arr[ITERATOR](); - iter.next = function () { return { done: safe = true }; }; - arr[ITERATOR] = function () { return iter; }; - exec(arr); - } catch (e) { /* empty */ } - return safe; + return !!exec(); + } catch (error) { + return true; + } +}; + +},{}],88:[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":87,"../internals/hide":102,"../internals/redefine":155,"../internals/regexp-exec":157,"../internals/well-known-symbol":188}],89:[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":63,"../internals/is-array":111,"../internals/to-length":178}],90:[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":87,"../internals/global":99,"../internals/is-pure":115}],91:[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":87}],92:[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":87,"../internals/whitespaces":189}],93:[function(require,module,exports){ +var fails = require('../internals/fails'); + +module.exports = !fails(function () { + return Object.isExtensible(Object.preventExtensions({})); +}); + +},{"../internals/fails":87}],94:[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":45,"../internals/is-object":114}],95:[function(require,module,exports){ +var shared = require('../internals/shared'); + +module.exports = shared('native-function-to-string', Function.toString); + +},{"../internals/shared":165}],96:[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":99,"../internals/path":150}],97:[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":67,"../internals/iterators":119,"../internals/well-known-symbol":188}],98:[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":50,"../internals/get-iterator-method":97}],99:[function(require,module,exports){ +(function (global){ +var O = 'object'; +var check = function (it) { + return it && it.Math == Math && it; }; -},{"./_wks":123}],81:[function(require,module,exports){ -module.exports = function (done, value) { - return { value: value, done: !!done }; +// 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 : {}) + +},{}],100:[function(require,module,exports){ +var hasOwnProperty = {}.hasOwnProperty; + +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); }; -},{}],82:[function(require,module,exports){ +},{}],101:[function(require,module,exports){ module.exports = {}; -},{}],83:[function(require,module,exports){ -module.exports = false; +},{}],102:[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":76,"../internals/descriptors":82,"../internals/object-define-property":135}],103:[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); + } +}; -},{}],84:[function(require,module,exports){ -var META = require('./_uid')('meta'); -var isObject = require('./_is-object'); -var has = require('./_has'); -var setDesc = require('./_object-dp').f; +},{"../internals/global":99}],104:[function(require,module,exports){ +var getBuiltIn = require('../internals/get-built-in'); + +module.exports = getBuiltIn('document', 'documentElement'); + +},{"../internals/get-built-in":96}],105:[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":82,"../internals/document-create-element":83,"../internals/fails":87}],106:[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":66,"../internals/fails":87}],107:[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":114,"../internals/object-set-prototype-of":144}],108:[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 FREEZE = !require('./_fails')(function () { - return isExtensible(Object.preventExtensions({})); -}); -var setMeta = function (it) { - setDesc(it, META, { value: { - i: 'O' + ++id, // object ID - w: {} // weak collections IDs + +var setMetadata = function (it) { + defineProperty(it, METADATA, { value: { + objectID: 'O' + ++id, // object ID + weakData: {} // weak collections IDs } }); }; + var fastKey = function (it, create) { - // return primitive with prefix + // return a primitive with prefix if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!has(it, META)) { + 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 - setMeta(it); + setMetadata(it); // return object ID - } return it[META].i; + } return it[METADATA].objectID; }; -var getWeak = function (it, create) { - if (!has(it, META)) { + +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 - setMeta(it); - // return hash weak collections IDs - } return it[META].w; + 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 (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); + if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it); return it; }; + var meta = module.exports = { - KEY: META, - NEED: false, + REQUIRED: false, fastKey: fastKey, - getWeak: getWeak, + getWeakData: getWeakData, onFreeze: onFreeze }; -},{"./_fails":61,"./_has":66,"./_is-object":75,"./_object-dp":88,"./_uid":119}],85:[function(require,module,exports){ -var global = require('./_global'); -var macrotask = require('./_task').set; -var Observer = global.MutationObserver || global.WebKitMutationObserver; +hiddenKeys[METADATA] = true; + +},{"../internals/freezing":93,"../internals/has":100,"../internals/hidden-keys":101,"../internals/is-object":114,"../internals/object-define-property":135,"../internals/uid":185}],109:[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":99,"../internals/has":100,"../internals/hidden-keys":101,"../internals/hide":102,"../internals/is-object":114,"../internals/native-weak-map":128,"../internals/shared-key":164}],110:[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":119,"../internals/well-known-symbol":188}],111:[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":66}],112:[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":87}],113:[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":114}],114:[function(require,module,exports){ +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + +},{}],115:[function(require,module,exports){ +module.exports = false; + +},{}],116:[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":66,"../internals/is-object":114,"../internals/well-known-symbol":188}],117:[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":50,"../internals/bind-context":63,"../internals/call-with-safe-iteration-closing":64,"../internals/get-iterator-method":97,"../internals/is-array-iterator-method":110,"../internals/to-length":178}],118:[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":100,"../internals/hide":102,"../internals/is-pure":115,"../internals/object-get-prototype-of":140,"../internals/well-known-symbol":188}],119:[function(require,module,exports){ +arguments[4][101][0].apply(exports,arguments) +},{"dup":101}],120:[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; + +},{}],121:[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":123}],122:[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); +}; + +},{}],123:[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; +}; + +},{}],124:[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 isNode = require('./_cof')(process) == 'process'; +var IS_NODE = classof(process) == 'process'; +// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` +var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask'); +var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; -module.exports = function () { - var head, last, notify; +var flush, head, last, notify, toggle, node, promise, then; - var flush = function () { +// modern engines have queueMicrotask method +if (!queueMicrotask) { + flush = function () { var parent, fn; - if (isNode && (parent = process.domain)) parent.exit(); + if (IS_NODE && (parent = process.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; try { fn(); - } catch (e) { + } catch (error) { if (head) notify(); else last = undefined; - throw e; + throw error; } } last = undefined; if (parent) parent.enter(); }; // Node.js - if (isNode) { + if (IS_NODE) { notify = function () { process.nextTick(flush); }; - // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339 - } else if (Observer && !(global.navigator && global.navigator.standalone)) { - var toggle = true; - var node = document.createTextNode(''); - new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new + // 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 - var promise = Promise.resolve(undefined); + promise = Promise.resolve(undefined); + then = promise.then; notify = function () { - promise.then(flush); + then.call(promise, flush); }; // for other environments - macrotask based on: // - setImmediate @@ -15092,23 +17787,70 @@ module.exports = function () { macrotask.call(global, flush); }; } +} - return function (fn) { - var task = { fn: fn, next: undefined }; - if (last) last.next = task; - if (!head) { - head = task; - notify(); - } last = task; - }; +module.exports = queueMicrotask || function (fn) { + var task = { fn: fn, next: undefined }; + if (last) last.next = task; + if (!head) { + head = task; + notify(); + } last = task; }; -},{"./_cof":50,"./_global":65,"./_task":112}],86:[function(require,module,exports){ +},{"../internals/classof-raw":66,"../internals/global":99,"../internals/object-get-own-property-descriptor":136,"../internals/task":172,"../internals/user-agent":186}],125:[function(require,module,exports){ +var global = require('../internals/global'); + +module.exports = global.Promise; + +},{"../internals/global":99}],126:[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":87}],127:[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":87,"../internals/is-pure":115,"../internals/well-known-symbol":188}],128:[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":95,"../internals/global":99}],129:[function(require,module,exports){ 'use strict'; -// 25.4.1.5 NewPromiseCapability(C) -var aFunction = require('./_a-function'); +var aFunction = require('../internals/a-function'); -function PromiseCapability(C) { +var PromiseCapability = function (C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); @@ -15117,43 +17859,113 @@ function PromiseCapability(C) { }); this.resolve = aFunction(resolve); this.reject = aFunction(reject); -} +}; +// 25.4.1.5 NewPromiseCapability(C) module.exports.f = function (C) { return new PromiseCapability(C); }; -},{"./_a-function":41}],87:[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 */ }; +},{"../internals/a-function":45}],130:[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":116}],131:[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":99}],132:[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":82,"../internals/fails":87,"../internals/indexed-object":106,"../internals/object-get-own-property-symbols":139,"../internals/object-keys":142,"../internals/object-property-is-enumerable":143,"../internals/to-object":179}],133:[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 = require('./_dom-create')('iframe'); - var i = enumBugKeys.length; + 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'; - require('./_html').appendChild(iframe); - iframe.src = 'javascript:'; // eslint-disable-line no-script-url - // createDict = iframe.contentWindow.Object; - // html.removeChild(iframe); + 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.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt); iframeDocument.close(); createDict = iframeDocument.F; - while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + 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) { @@ -15163,64 +17975,77 @@ module.exports = Object.create || function create(O, Properties) { // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = createDict(); - return Properties === undefined ? result : dPs(result, Properties); + return Properties === undefined ? result : defineProperties(result, Properties); }; -},{"./_an-object":44,"./_dom-create":56,"./_enum-bug-keys":57,"./_html":68,"./_object-dps":89,"./_shared-key":107}],88:[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; +hiddenKeys[IE_PROTO] = true; -exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) { +},{"../internals/an-object":50,"../internals/document-create-element":83,"../internals/enum-bug-keys":85,"../internals/hidden-keys":101,"../internals/html":104,"../internals/object-define-properties":134,"../internals/shared-key":164}],134:[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); - 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; + 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; }; -},{"./_an-object":44,"./_descriptors":55,"./_ie8-dom-define":69,"./_to-primitive":118}],89:[function(require,module,exports){ -var dP = require('./_object-dp'); -var anObject = require('./_an-object'); -var getKeys = require('./_object-keys'); +},{"../internals/an-object":50,"../internals/descriptors":82,"../internals/object-define-property":135,"../internals/object-keys":142}],135:[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'); -module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) { +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); - var keys = getKeys(Properties); - var length = keys.length; - var i = 0; - var P; - while (length > i) dP.f(O, P = keys[i++], Properties[P]); + 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; }; -},{"./_an-object":44,"./_descriptors":55,"./_object-dp":88,"./_object-keys":96}],90:[function(require,module,exports){ -var pIE = require('./_object-pie'); -var createDesc = require('./_property-desc'); -var toIObject = require('./_to-iobject'); -var toPrimitive = require('./_to-primitive'); -var has = require('./_has'); -var IE8_DOM_DEFINE = require('./_ie8-dom-define'); -var gOPD = Object.getOwnPropertyDescriptor; +},{"../internals/an-object":50,"../internals/descriptors":82,"../internals/ie8-dom-define":105,"../internals/to-primitive":181}],136:[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; -exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) { - O = toIObject(O); +// `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 gOPD(O, P); - } catch (e) { /* empty */ } - if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); + return nativeGetOwnPropertyDescriptor(O, P); + } catch (error) { /* empty */ } + if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); }; -},{"./_descriptors":55,"./_has":66,"./_ie8-dom-define":69,"./_object-pie":97,"./_property-desc":101,"./_to-iobject":115,"./_to-primitive":118}],91:[function(require,module,exports){ -// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window -var toIObject = require('./_to-iobject'); -var gOPN = require('./_object-gopn').f; +},{"../internals/create-property-descriptor":76,"../internals/descriptors":82,"../internals/has":100,"../internals/ie8-dom-define":105,"../internals/object-property-is-enumerable":143,"../internals/to-indexed-object":176,"../internals/to-primitive":181}],137:[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 @@ -15228,99 +18053,234 @@ var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNa var getWindowNames = function (it) { try { - return gOPN(it); - } catch (e) { + 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) : gOPN(toIObject(it)); + return windowNames && toString.call(it) == '[object Window]' + ? getWindowNames(it) + : nativeGetOwnPropertyNames(toIndexedObject(it)); }; -},{"./_object-gopn":92,"./_to-iobject":115}],92:[function(require,module,exports){ -// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) -var $keys = require('./_object-keys-internal'); -var hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype'); +},{"../internals/object-get-own-property-names":138,"../internals/to-indexed-object":176}],138:[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 $keys(O, hiddenKeys); + return internalObjectKeys(O, hiddenKeys); }; -},{"./_enum-bug-keys":57,"./_object-keys-internal":95}],93:[function(require,module,exports){ +},{"../internals/enum-bug-keys":85,"../internals/object-keys-internal":141}],139:[function(require,module,exports){ exports.f = Object.getOwnPropertySymbols; -},{}],94:[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; +},{}],140:[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; -module.exports = Object.getPrototypeOf || function (O) { +// `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 ? ObjectProto : null; + } return O instanceof Object ? ObjectPrototype : null; }; -},{"./_has":66,"./_shared-key":107,"./_to-object":117}],95:[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'); +},{"../internals/correct-prototype-getter":73,"../internals/has":100,"../internals/shared-key":164,"../internals/to-object":179}],141:[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 = toIObject(object); + var O = toIndexedObject(object); var i = 0; var result = []; var key; - for (key in O) if (key != IE_PROTO) has(O, key) && result.push(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++])) { - ~arrayIndexOf(result, key) || result.push(key); + ~indexOf(result, key) || result.push(key); } return result; }; -},{"./_array-includes":45,"./_has":66,"./_shared-key":107,"./_to-iobject":115}],96:[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'); +},{"../internals/array-includes":57,"../internals/has":100,"../internals/hidden-keys":101,"../internals/to-indexed-object":176}],142:[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 $keys(O, enumBugKeys); + return internalObjectKeys(O, enumBugKeys); }; -},{"./_enum-bug-keys":57,"./_object-keys-internal":95}],97:[function(require,module,exports){ -exports.f = {}.propertyIsEnumerable; +},{"../internals/enum-bug-keys":85,"../internals/object-keys-internal":141}],143:[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; + +},{}],144:[function(require,module,exports){ +var anObject = require('../internals/an-object'); +var aPossiblePrototype = require('../internals/a-possible-prototype'); -},{}],98:[function(require,module,exports){ -// most Object methods by ES6 should accept primitives -var $export = require('./_export'); -var core = require('./_core'); -var fails = require('./_fails'); -module.exports = function (KEY, exec) { - var fn = (core.Object || {})[KEY] || Object[KEY]; - var exp = {}; - exp[KEY] = exec(fn); - $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); +// `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":46,"../internals/an-object":50}],145:[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) }; -},{"./_core":51,"./_export":59,"./_fails":61}],99:[function(require,module,exports){ +},{"../internals/descriptors":82,"../internals/object-keys":142,"../internals/object-property-is-enumerable":143,"../internals/to-indexed-object":176}],146:[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":67,"../internals/well-known-symbol":188}],147:[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":50,"../internals/get-built-in":96,"../internals/object-get-own-property-names":138,"../internals/object-get-own-property-symbols":139}],148:[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":99,"../internals/string-trim":171,"../internals/whitespaces":189}],149:[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":99,"../internals/string-trim":171,"../internals/whitespaces":189}],150:[function(require,module,exports){ +module.exports = require('../internals/global'); + +},{"../internals/global":99}],151:[function(require,module,exports){ module.exports = function (exec) { try { - return { e: false, v: exec() }; - } catch (e) { - return { e: true, v: e }; + return { error: false, value: exec() }; + } catch (error) { + return { error: true, value: error }; } }; -},{}],100:[function(require,module,exports){ -var anObject = require('./_an-object'); -var isObject = require('./_is-object'); -var newPromiseCapability = require('./_new-promise-capability'); +},{}],152:[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); @@ -15331,185 +18291,566 @@ module.exports = function (C, x) { return promiseCapability.promise; }; -},{"./_an-object":44,"./_is-object":75,"./_new-promise-capability":86}],101:[function(require,module,exports){ -module.exports = function (bitmap, value) { - return { - enumerable: !(bitmap & 1), - configurable: !(bitmap & 2), - writable: !(bitmap & 4), - value: value - }; +},{"../internals/an-object":50,"../internals/is-object":114,"../internals/new-promise-capability":129}],153:[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; }; -},{}],102:[function(require,module,exports){ -var redefine = require('./_redefine'); -module.exports = function (target, src, safe) { - for (var key in src) redefine(target, key, src[key], safe); - return target; +/** + * 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); }; -},{"./_redefine":103}],103:[function(require,module,exports){ -var global = require('./_global'); -var hide = require('./_hide'); -var has = require('./_has'); -var SRC = require('./_uid')('src'); -var TO_STRING = 'toString'; -var $toString = Function[TO_STRING]; -var TPL = ('' + $toString).split(TO_STRING); +/** + * 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; -require('./_core').inspectSource = function (it) { - return $toString.call(it); + 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('.'); +}; + +},{}],154:[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; }; -(module.exports = function (O, key, val, safe) { - var isFunction = typeof val == 'function'; - if (isFunction) has(val, 'name') || hide(val, 'name', key); - if (O[key] === val) return; - if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); +},{"../internals/redefine":155}],155:[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) { - O[key] = val; - } else if (!safe) { + if (simple) O[key] = value; + else setGlobal(key, value); + return; + } else if (!unsafe) { delete O[key]; - hide(O, key, val); - } else if (O[key]) { - O[key] = val; - } else { - hide(O, key, val); + } 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, TO_STRING, function toString() { - return typeof this == 'function' && this[SRC] || $toString.call(this); +})(Function.prototype, 'toString', function toString() { + return typeof this == 'function' && getInternalState(this).source || nativeFunctionToString.call(this); }); -},{"./_core":51,"./_global":65,"./_has":66,"./_hide":67,"./_uid":119}],104:[function(require,module,exports){ -// Works with __proto__ only. Old v8 can't work with null proto objects. -/* eslint-disable no-proto */ -var isObject = require('./_is-object'); -var anObject = require('./_an-object'); -var check = function (O, proto) { - anObject(O); - if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); -}; -module.exports = { - set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line - function (test, buggy, set) { - try { - set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2); - set(test, []); - buggy = !(test instanceof Array); - } catch (e) { buggy = true; } - return function setPrototypeOf(O, proto) { - check(O, proto); - if (buggy) O.__proto__ = proto; - else set(O, proto); - return O; - }; - }({}, false) : undefined), - check: check +},{"../internals/function-to-string":95,"../internals/global":99,"../internals/has":100,"../internals/hide":102,"../internals/internal-state":109,"../internals/set-global":161,"../internals/shared":165}],156:[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); }; -},{"./_an-object":44,"./_ctx":53,"./_is-object":75,"./_object-gopd":90}],105:[function(require,module,exports){ + +},{"./classof-raw":66,"./regexp-exec":157}],157:[function(require,module,exports){ 'use strict'; -var global = require('./_global'); -var dP = require('./_object-dp'); -var DESCRIPTORS = require('./_descriptors'); -var SPECIES = require('./_wks')('species'); - -module.exports = function (KEY) { - var C = global[KEY]; - if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { - configurable: true, - get: function () { return this; } - }); -}; +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; +})(); -},{"./_descriptors":55,"./_global":65,"./_object-dp":88,"./_wks":123}],106:[function(require,module,exports){ -var def = require('./_object-dp').f; -var has = require('./_has'); -var TAG = require('./_wks')('toStringTag'); +// nonparticipating capturing group, copied from es5-shim's String#split patch. +var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; -module.exports = function (it, tag, stat) { - if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); -}; +var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED; -},{"./_has":66,"./_object-dp":88,"./_wks":123}],107:[function(require,module,exports){ -var shared = require('./_shared')('keys'); -var uid = require('./_uid'); -module.exports = function (key) { - return shared[key] || (shared[key] = uid(key)); -}; +if (PATCH) { + patchedExec = function exec(str) { + var re = this; + var lastIndex, reCopy, match, i; -},{"./_shared":108,"./_uid":119}],108:[function(require,module,exports){ -var core = require('./_core'); -var global = require('./_global'); -var SHARED = '__core-js_shared__'; -var store = global[SHARED] || (global[SHARED] = {}); + if (NPCG_INCLUDED) { + reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re)); + } + if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; -(module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); -})('versions', []).push({ - version: core.version, - mode: require('./_library') ? 'pure' : 'global', - copyright: '© 2018 Denis Pushkarev (zloirock.ru)' -}); + match = nativeExec.call(re, str); -},{"./_core":51,"./_global":65,"./_library":83}],109:[function(require,module,exports){ -// 7.3.20 SpeciesConstructor(O, defaultConstructor) -var anObject = require('./_an-object'); -var aFunction = require('./_a-function'); -var SPECIES = require('./_wks')('species'); -module.exports = function (O, D) { - var C = anObject(O).constructor; - var S; - return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); -}; - -},{"./_a-function":41,"./_an-object":44,"./_wks":123}],110:[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; + 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; }; -}; +} -},{"./_defined":54,"./_to-integer":114}],111:[function(require,module,exports){ -// helper for String#{startsWith, endsWith, includes} -var isRegExp = require('./_is-regexp'); -var defined = require('./_defined'); +module.exports = patchedExec; -module.exports = function (that, searchString, NAME) { - if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); - return String(defined(that)); -}; +},{"./regexp-flags":158}],158:[function(require,module,exports){ +'use strict'; +var anObject = require('../internals/an-object'); -},{"./_defined":54,"./_is-regexp":76}],112:[function(require,module,exports){ -var ctx = require('./_ctx'); -var invoke = require('./_invoke'); -var html = require('./_html'); -var cel = require('./_dom-create'); -var global = require('./_global'); -var process = global.process; -var setTask = global.setImmediate; -var clearTask = global.clearImmediate; -var MessageChannel = global.MessageChannel; -var Dispatch = global.Dispatch; +// `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":50}],159:[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; +}; + +},{}],160:[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; +}; + +},{}],161:[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":99,"../internals/hide":102}],162:[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":82,"../internals/get-built-in":96,"../internals/object-define-property":135,"../internals/well-known-symbol":188}],163:[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":100,"../internals/object-define-property":135,"../internals/well-known-symbol":188}],164:[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":165,"../internals/uid":185}],165:[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":99,"../internals/is-pure":115,"../internals/set-global":161}],166:[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":87}],167:[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":45,"../internals/an-object":50,"../internals/well-known-symbol":188}],168:[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":159,"../internals/to-integer":177}],169:[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":159,"../internals/string-repeat":170,"../internals/to-length":178}],170:[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":159,"../internals/to-integer":177}],171:[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":159,"../internals/whitespaces":189}],172:[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 () { - var id = +this; + +var run = function (id) { // eslint-disable-next-line no-prototype-builtins if (queue.hasOwnProperty(id)) { var fn = queue[id]; @@ -15517,3082 +18858,7742 @@ var run = function () { fn(); } }; + +var runner = function (id) { + return function () { + run(id); + }; +}; + var listener = function (event) { - run.call(event.data); + 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 (!setTask || !clearTask) { - setTask = function setImmediate(fn) { +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 - invoke(typeof fn == 'function' ? fn : Function(fn), args); + (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args); }; defer(counter); return counter; }; - clearTask = function clearImmediate(id) { + clear = function clearImmediate(id) { delete queue[id]; }; // Node.js 0.8- - if (require('./_cof')(process) == 'process') { + if (classof(process) == 'process') { defer = function (id) { - process.nextTick(ctx(run, id, 1)); + process.nextTick(runner(id)); }; // Sphere (JS game engine) Dispatch API } else if (Dispatch && Dispatch.now) { defer = function (id) { - Dispatch.now(ctx(run, id, 1)); + Dispatch.now(runner(id)); }; // Browsers with MessageChannel, includes WebWorkers } else if (MessageChannel) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = listener; - defer = ctx(port.postMessage, port, 1); + 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) { - defer = function (id) { - global.postMessage(id + '', '*'); - }; + } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts && !fails(post)) { + defer = post; global.addEventListener('message', listener, false); // IE8- - } else if (ONREADYSTATECHANGE in cel('script')) { + } else if (ONREADYSTATECHANGE in createElement('script')) { defer = function (id) { - html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { + html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () { html.removeChild(this); - run.call(id); + run(id); }; }; // Rest old browsers } else { defer = function (id) { - setTimeout(ctx(run, id, 1), 0); + setTimeout(runner(id), 0); }; } } + module.exports = { - set: setTask, - clear: clearTask + set: set, + clear: clear +}; + +},{"../internals/bind-context":63,"../internals/classof-raw":66,"../internals/document-create-element":83,"../internals/fails":87,"../internals/global":99,"../internals/html":104}],173:[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; }; -},{"./_cof":50,"./_ctx":53,"./_dom-create":56,"./_global":65,"./_html":68,"./_invoke":71}],113:[function(require,module,exports){ -var toInteger = require('./_to-integer'); +},{"../internals/classof-raw":66}],174:[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) { - index = toInteger(index); - return index < 0 ? max(index + length, 0) : min(index, length); + var integer = toInteger(index); + return integer < 0 ? max(integer + length, 0) : min(integer, length); }; -},{"./_to-integer":114}],114:[function(require,module,exports){ -// 7.1.4 ToInteger -var ceil = Math.ceil; -var floor = Math.floor; +},{"../internals/to-integer":177}],175:[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) { - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(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; }; -},{}],115:[function(require,module,exports){ -// to indexed object, toObject with fallback for non-array-like ES3 strings -var IObject = require('./_iobject'); -var defined = require('./_defined'); +},{"../internals/to-integer":177,"../internals/to-length":178}],176:[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 IObject(defined(it)); + return IndexedObject(requireObjectCoercible(it)); }; -},{"./_defined":54,"./_iobject":72}],116:[function(require,module,exports){ -// 7.1.15 ToLength -var toInteger = require('./_to-integer'); +},{"../internals/indexed-object":106,"../internals/require-object-coercible":159}],177:[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); +}; + +},{}],178:[function(require,module,exports){ +var toInteger = require('../internals/to-integer'); + var min = Math.min; -module.exports = function (it) { - return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 + +// `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 }; -},{"./_to-integer":114}],117:[function(require,module,exports){ -// 7.1.13 ToObject(argument) -var defined = require('./_defined'); -module.exports = function (it) { - return Object(defined(it)); +},{"../internals/to-integer":177}],179:[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":159}],180:[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; }; -},{"./_defined":54}],118:[function(require,module,exports){ -// 7.1.1 ToPrimitive(input [, PreferredType]) -var isObject = require('./_is-object'); +},{"../internals/to-integer":177}],181:[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 (it, S) { - if (!isObject(it)) return it; +module.exports = function (input, PREFERRED_STRING) { + if (!isObject(input)) return input; 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; + 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"); }; -},{"./_is-object":75}],119:[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)); +},{"../internals/is-object":114}],182:[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; }; -},{}],120:[function(require,module,exports){ -var global = require('./_global'); -var navigator = global.navigator; - -module.exports = navigator && navigator.userAgent || ''; - -},{"./_global":65}],121:[function(require,module,exports){ -var global = require('./_global'); -var core = require('./_core'); -var LIBRARY = require('./_library'); -var wksExt = require('./_wks-ext'); -var defineProperty = require('./_object-dp').f; -module.exports = function (name) { - var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); - if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); +var addGetter = function (it, key) { + nativeDefineProperty(it, key, { get: function () { + return getInternalState(this)[key]; + } }); }; -},{"./_core":51,"./_global":65,"./_library":83,"./_object-dp":88,"./_wks-ext":122}],122:[function(require,module,exports){ -exports.f = require('./_wks'); - -},{"./_wks":123}],123:[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 isArrayBuffer = function (it) { + var klass; + return it instanceof ArrayBuffer || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer'; +}; -var $exports = module.exports = function (name) { - return store[name] || (store[name] = - USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); +var isTypedArrayIndex = function (target, key) { + return isTypedArray(target) + && typeof key != 'symbol' + && key in target + && String(+key) == String(key); }; -$exports.store = store; +var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) { + return isTypedArrayIndex(target, key = toPrimitive(key, true)) + ? createPropertyDescriptor(2, target[key]) + : nativeGetOwnPropertyDescriptor(target, key); +}; -},{"./_global":65,"./_shared":108,"./_uid":119}],124:[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)]; +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); }; -},{"./_classof":49,"./_core":51,"./_iterators":82,"./_wks":123}],125:[function(require,module,exports){ -'use strict'; -// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) -var $export = require('./_export'); -var $find = require('./_array-methods')(6); -var KEY = 'findIndex'; -var forced = true; -// Shouldn't skip holes -if (KEY in []) Array(1)[KEY](function () { forced = false; }); -$export($export.P + $export.F * forced, 'Array', { - findIndex: function findIndex(callbackfn /* , that = undefined */) { - return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); +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'); } -}); -require('./_add-to-unscopables')(KEY); -},{"./_add-to-unscopables":42,"./_array-methods":46,"./_export":59}],126:[function(require,module,exports){ -'use strict'; -// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) -var $export = require('./_export'); -var $find = require('./_array-methods')(5); -var KEY = 'find'; -var forced = true; -// Shouldn't skip holes -if (KEY in []) Array(1)[KEY](function () { forced = false; }); -$export($export.P + $export.F * forced, 'Array', { - find: function find(callbackfn /* , that = undefined */) { - return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); -require('./_add-to-unscopables')(KEY); + $({ target: 'Object', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, { + getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor, + defineProperty: wrappedDefineProperty + }); -},{"./_add-to-unscopables":42,"./_array-methods":46,"./_export":59}],127:[function(require,module,exports){ -'use strict'; -var ctx = require('./_ctx'); -var $export = require('./_export'); -var toObject = require('./_to-object'); -var call = require('./_iter-call'); -var isArrayIter = require('./_is-array-iter'); -var toLength = require('./_to-length'); -var createProperty = require('./_create-property'); -var getIterFn = require('./core.get-iterator-method'); - -$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', { - // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) - from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { - var O = toObject(arrayLike); - var C = typeof this == 'function' ? this : Array; - var aLen = arguments.length; - var mapfn = aLen > 1 ? arguments[1] : undefined; - var mapping = mapfn !== undefined; - var index = 0; - var iterFn = getIterFn(O); - var length, result, step, iterator; - if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); - // if object isn't iterable or it's array with default iterator - use simple case - if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { - for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { - createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); - } - } else { - length = toLength(O.length); - for (result = new C(length); length > index; index++) { - createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); - } + // 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; } - result.length = index; - return result; - } -}); -},{"./_create-property":52,"./_ctx":53,"./_export":59,"./_is-array-iter":73,"./_iter-call":77,"./_iter-detect":80,"./_to-length":116,"./_to-object":117,"./core.get-iterator-method":124}],128:[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'); + if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) { + hide(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor); + } -// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) -Iterators.Arguments = Iterators.Array; + if (TYPED_ARRAY_TAG) hide(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME); -addToUnscopables('keys'); -addToUnscopables('values'); -addToUnscopables('entries'); + exported[CONSTRUCTOR_NAME] = TypedArrayConstructor; -},{"./_add-to-unscopables":42,"./_iter-define":79,"./_iter-step":81,"./_iterators":82,"./_to-iobject":115}],129:[function(require,module,exports){ -var dP = require('./_object-dp').f; -var FProto = Function.prototype; -var nameRE = /^\s*function ([^ (]*)/; -var NAME = 'name'; + $({ + global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS + }, exported); -// 19.2.4.2 name -NAME in FProto || require('./_descriptors') && dP(FProto, NAME, { - configurable: true, - get: function () { - try { - return ('' + this).match(nameRE)[1]; - } catch (e) { - return ''; + if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) { + hide(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES); } - } -}); -},{"./_descriptors":55,"./_object-dp":88}],130:[function(require,module,exports){ -// 19.1.2.14 Object.keys(O) -var toObject = require('./_to-object'); -var $keys = require('./_object-keys'); + if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) { + hide(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES); + } -require('./_object-sap')('keys', function () { - return function keys(it) { - return $keys(toObject(it)); + setSpecies(CONSTRUCTOR_NAME); }; +} else module.exports = function () { /* empty */ }; + +},{"../internals/an-instance":49,"../internals/array-buffer":52,"../internals/array-buffer-view-core":51,"../internals/array-iteration":58,"../internals/classof":67,"../internals/create-property-descriptor":76,"../internals/descriptors":82,"../internals/export":86,"../internals/global":99,"../internals/has":100,"../internals/hide":102,"../internals/internal-state":109,"../internals/is-object":114,"../internals/object-create":133,"../internals/object-define-property":135,"../internals/object-get-own-property-descriptor":136,"../internals/object-get-own-property-names":138,"../internals/object-set-prototype-of":144,"../internals/set-species":162,"../internals/to-index":175,"../internals/to-length":178,"../internals/to-offset":180,"../internals/to-primitive":181,"../internals/typed-array-from":183,"../internals/typed-arrays-constructors-requires-wrappers":184}],183:[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":51,"../internals/bind-context":63,"../internals/get-iterator-method":97,"../internals/is-array-iterator-method":110,"../internals/to-length":178,"../internals/to-object":179}],184:[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; }); -},{"./_object-keys":96,"./_object-sap":98,"./_to-object":117}],131:[function(require,module,exports){ -// 19.1.3.19 Object.setPrototypeOf(O, proto) -var $export = require('./_export'); -$export($export.S, 'Object', { setPrototypeOf: require('./_set-proto').set }); +},{"../internals/array-buffer-view-core":51,"../internals/check-correctness-of-iteration":65,"../internals/fails":87,"../internals/global":99}],185:[function(require,module,exports){ +var id = 0; +var postfix = Math.random(); -},{"./_export":59,"./_set-proto":104}],132:[function(require,module,exports){ -'use strict'; -var LIBRARY = require('./_library'); -var global = require('./_global'); -var ctx = require('./_ctx'); -var classof = require('./_classof'); -var $export = require('./_export'); -var isObject = require('./_is-object'); -var aFunction = require('./_a-function'); -var anInstance = require('./_an-instance'); -var forOf = require('./_for-of'); -var speciesConstructor = require('./_species-constructor'); -var task = require('./_task').set; -var microtask = require('./_microtask')(); -var newPromiseCapabilityModule = require('./_new-promise-capability'); -var perform = require('./_perform'); -var userAgent = require('./_user-agent'); -var promiseResolve = require('./_promise-resolve'); -var PROMISE = 'Promise'; -var TypeError = global.TypeError; -var process = global.process; -var versions = process && process.versions; -var v8 = versions && versions.v8 || ''; -var $Promise = global[PROMISE]; -var isNode = classof(process) == 'process'; -var empty = function () { /* empty */ }; -var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; -var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f; +module.exports = function (key) { + return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); +}; -var USE_NATIVE = !!function () { - try { - // correct subclassing with @@species support - var promise = $Promise.resolve(1); - var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) { - exec(empty, empty); - }; - // unhandled rejections tracking support, NodeJS Promise without it fails @@species test - return (isNode || typeof PromiseRejectionEvent == 'function') - && 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; - } catch (e) { /* empty */ } -}(); +},{}],186:[function(require,module,exports){ +var getBuiltIn = require('../internals/get-built-in'); -// helpers -var isThenable = function (it) { - var then; - return isObject(it) && typeof (then = it.then) == 'function' ? then : false; -}; -var notify = function (promise, isReject) { - if (promise._n) return; - promise._n = true; - var chain = promise._c; - microtask(function () { - var value = promise._v; - var ok = promise._s == 1; - var i = 0; - var run = function (reaction) { - 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 (promise._h == 2) onHandleUnhandled(promise); - promise._h = 1; - } - if (handler === true) result = value; - else { - if (domain) domain.enter(); - result = handler(value); // may 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 (e) { - if (domain && !exited) domain.exit(); - reject(e); - } - }; - while (chain.length > i) run(chain[i++]); // variable length - can't use forEach - promise._c = []; - promise._n = false; - if (isReject && !promise._h) onUnhandled(promise); - }); -}; -var onUnhandled = function (promise) { - task.call(global, function () { - var value = promise._v; - var unhandled = isUnhandled(promise); - var result, handler, console; - if (unhandled) { - result = perform(function () { - if (isNode) { - process.emit('unhandledRejection', value, promise); - } else if (handler = global.onunhandledrejection) { - handler({ promise: promise, reason: value }); - } else if ((console = global.console) && console.error) { - console.error('Unhandled promise rejection', value); - } - }); - // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should - promise._h = isNode || isUnhandled(promise) ? 2 : 1; - } promise._a = undefined; - if (unhandled && result.e) throw result.v; - }); -}; -var isUnhandled = function (promise) { - return promise._h !== 1 && (promise._a || promise._c).length === 0; -}; -var onHandleUnhandled = function (promise) { - task.call(global, function () { - var handler; - if (isNode) { - process.emit('rejectionHandled', promise); - } else if (handler = global.onrejectionhandled) { - handler({ promise: promise, reason: promise._v }); - } - }); -}; -var $reject = function (value) { - var promise = this; - if (promise._d) return; - promise._d = true; - promise = promise._w || promise; // unwrap - promise._v = value; - promise._s = 2; - if (!promise._a) promise._a = promise._c.slice(); - notify(promise, true); -}; -var $resolve = function (value) { - var promise = this; - var then; - if (promise._d) return; - promise._d = true; - promise = promise._w || promise; // unwrap - try { - if (promise === value) throw TypeError("Promise can't be resolved itself"); - if (then = isThenable(value)) { - microtask(function () { - var wrapper = { _w: promise, _d: false }; // wrap - try { - then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); - } catch (e) { - $reject.call(wrapper, e); - } - }); - } else { - promise._v = value; - promise._s = 1; - notify(promise, false); - } - } catch (e) { - $reject.call({ _w: promise, _d: false }, e); // wrap - } +module.exports = getBuiltIn('navigator', 'userAgent') || ''; + +},{"../internals/get-built-in":96}],187:[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":186}],188:[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)); }; -// constructor polyfill -if (!USE_NATIVE) { - // 25.4.3.1 Promise(executor) - $Promise = function Promise(executor) { - anInstance(this, $Promise, PROMISE, '_h'); - aFunction(executor); - Internal.call(this); - try { - executor(ctx($resolve, this, 1), ctx($reject, this, 1)); - } catch (err) { - $reject.call(this, err); - } - }; - // eslint-disable-next-line no-unused-vars - Internal = function Promise(executor) { - this._c = []; // <- awaiting reactions - this._a = undefined; // <- checked in isUnhandled reactions - this._s = 0; // <- state - this._d = false; // <- done - this._v = undefined; // <- value - this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled - this._n = false; // <- notify - }; - Internal.prototype = require('./_redefine-all')($Promise.prototype, { - // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) - then: function then(onFulfilled, onRejected) { - var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); - reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; - reaction.fail = typeof onRejected == 'function' && onRejected; - reaction.domain = isNode ? process.domain : undefined; - this._c.push(reaction); - if (this._a) this._a.push(reaction); - if (this._s) notify(this, false); - return reaction.promise; - }, - // 25.4.5.1 Promise.prototype.catch(onRejected) - 'catch': function (onRejected) { - return this.then(undefined, onRejected); - } - }); - OwnPromiseCapability = function () { - var promise = new Internal(); - this.promise = promise; - this.resolve = ctx($resolve, promise, 1); - this.reject = ctx($reject, promise, 1); - }; - newPromiseCapabilityModule.f = newPromiseCapability = function (C) { - return C === $Promise || C === Wrapper - ? new OwnPromiseCapability(C) - : newGenericPromiseCapability(C); - }; -} +},{"../internals/global":99,"../internals/native-symbol":126,"../internals/shared":165,"../internals/uid":185}],189:[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'; -$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); -require('./_set-to-string-tag')($Promise, PROMISE); -require('./_set-species')(PROMISE); -Wrapper = require('./_core')[PROMISE]; +},{}],190:[function(require,module,exports){ +exports.f = require('../internals/well-known-symbol'); -// statics -$export($export.S + $export.F * !USE_NATIVE, PROMISE, { - // 25.4.4.5 Promise.reject(r) - reject: function reject(r) { - var capability = newPromiseCapability(this); - var $$reject = capability.reject; - $$reject(r); - return capability.promise; - } -}); -$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { - // 25.4.4.6 Promise.resolve(x) - resolve: function resolve(x) { - return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); - } -}); -$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) { - $Promise.all(iter)['catch'](empty); -})), PROMISE, { - // 25.4.4.1 Promise.all(iterable) - all: function all(iterable) { - var C = this; - var capability = newPromiseCapability(C); - var resolve = capability.resolve; - var reject = capability.reject; - var result = perform(function () { - var values = []; - var index = 0; - var remaining = 1; - forOf(iterable, false, function (promise) { - var $index = index++; - var alreadyCalled = false; - values.push(undefined); - remaining++; - C.resolve(promise).then(function (value) { - if (alreadyCalled) return; - alreadyCalled = true; - values[$index] = value; - --remaining || resolve(values); - }, reject); - }); - --remaining || resolve(values); - }); - if (result.e) reject(result.v); - return capability.promise; - }, - // 25.4.4.4 Promise.race(iterable) - race: function race(iterable) { - var C = this; - var capability = newPromiseCapability(C); - var reject = capability.reject; - var result = perform(function () { - forOf(iterable, false, function (promise) { - C.resolve(promise).then(capability.resolve, reject); - }); - }); - if (result.e) reject(result.v); - return capability.promise; - } +},{"../internals/well-known-symbol":188}],191:[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 }); -},{"./_a-function":41,"./_an-instance":43,"./_classof":49,"./_core":51,"./_ctx":53,"./_export":59,"./_for-of":64,"./_global":65,"./_is-object":75,"./_iter-detect":80,"./_library":83,"./_microtask":85,"./_new-promise-capability":86,"./_perform":99,"./_promise-resolve":100,"./_redefine-all":102,"./_set-species":105,"./_set-to-string-tag":106,"./_species-constructor":109,"./_task":112,"./_user-agent":120,"./_wks":123}],133:[function(require,module,exports){ -var global = require('./_global'); -var inheritIfRequired = require('./_inherit-if-required'); -var dP = require('./_object-dp').f; -var gOPN = require('./_object-gopn').f; -var isRegExp = require('./_is-regexp'); -var $flags = require('./_flags'); -var $RegExp = global.RegExp; -var Base = $RegExp; -var proto = $RegExp.prototype; -var re1 = /a/g; -var re2 = /a/g; -// "new" creates a new object, old webkit buggy here -var CORRECT_NEW = new $RegExp(re1) !== re1; +setSpecies(ARRAY_BUFFER); -if (require('./_descriptors') && (!CORRECT_NEW || require('./_fails')(function () { - re2[require('./_wks')('match')] = false; - // RegExp constructor can alter flags and IsRegExp works correct with @@match - return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; -}))) { - $RegExp = function RegExp(p, f) { - var tiRE = this instanceof $RegExp; - var piRE = isRegExp(p); - var fiU = f === undefined; - return !tiRE && piRE && p.constructor === $RegExp && fiU ? p - : inheritIfRequired(CORRECT_NEW - ? new Base(piRE && !fiU ? p.source : p, f) - : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f) - , tiRE ? this : proto, $RegExp); - }; - var proxy = function (key) { - key in $RegExp || dP($RegExp, key, { - configurable: true, - get: function () { return Base[key]; }, - set: function (it) { Base[key] = it; } - }); - }; - for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]); - proto.constructor = $RegExp; - $RegExp.prototype = proto; - require('./_redefine')(global, 'RegExp', $RegExp); -} +},{"../internals/array-buffer":52,"../internals/export":86,"../internals/global":99,"../internals/set-species":162}],192:[function(require,module,exports){ +var $ = require('../internals/export'); +var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); -require('./_set-species')('RegExp'); +var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; -},{"./_descriptors":55,"./_fails":61,"./_flags":63,"./_global":65,"./_inherit-if-required":70,"./_is-regexp":76,"./_object-dp":88,"./_object-gopn":92,"./_redefine":103,"./_set-species":105,"./_wks":123}],134:[function(require,module,exports){ -// 21.2.5.3 get RegExp.prototype.flags() -if (require('./_descriptors') && /./g.flags != 'g') require('./_object-dp').f(RegExp.prototype, 'flags', { - configurable: true, - get: require('./_flags') +// `ArrayBuffer.isView` method +// https://tc39.github.io/ecma262/#sec-arraybuffer.isview +$({ target: 'ArrayBuffer', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, { + isView: ArrayBufferViewCore.isView }); -},{"./_descriptors":55,"./_flags":63,"./_object-dp":88}],135:[function(require,module,exports){ -// @@match logic -require('./_fix-re-wks')('match', 1, function (defined, MATCH, $match) { - // 21.1.3.11 String.prototype.match(regexp) - return [function match(regexp) { - 'use strict'; - var O = defined(this); - var fn = regexp == undefined ? undefined : regexp[MATCH]; - return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); - }, $match]; +},{"../internals/array-buffer-view-core":51,"../internals/export":86}],193:[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; }); -},{"./_fix-re-wks":62}],136:[function(require,module,exports){ -// @@replace logic -require('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace) { - // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) - return [function replace(searchValue, replaceValue) { - 'use strict'; - var O = defined(this); - var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; - return fn !== undefined - ? fn.call(searchValue, O, replaceValue) - : $replace.call(String(O), searchValue, replaceValue); - }, $replace]; +// `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; + } }); -},{"./_fix-re-wks":62}],137:[function(require,module,exports){ -// @@split logic -require('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split) { - 'use strict'; - var isRegExp = require('./_is-regexp'); - var _split = $split; - var $push = [].push; - var $SPLIT = 'split'; - var LENGTH = 'length'; - var LAST_INDEX = 'lastIndex'; - if ( - 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || - 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || - 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || - '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || - '.'[$SPLIT](/()()/)[LENGTH] > 1 || - ''[$SPLIT](/.?/)[LENGTH] - ) { - var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group - // based on es5-shim implementation, need to rework it - $split = function (separator, limit) { - var string = String(this); - if (separator === undefined && limit === 0) return []; - // If `separator` is not a regex, use native split - if (!isRegExp(separator)) return _split.call(string, separator, limit); - var output = []; - var flags = (separator.ignoreCase ? 'i' : '') + - (separator.multiline ? 'm' : '') + - (separator.unicode ? 'u' : '') + - (separator.sticky ? 'y' : ''); - var lastLastIndex = 0; - var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; - // Make `global` and avoid `lastIndex` issues by working with a copy - var separatorCopy = new RegExp(separator.source, flags + 'g'); - var separator2, match, lastIndex, lastLength, i; - // Doesn't need flags gy, but they don't hurt - if (!NPCG) separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); - while (match = separatorCopy.exec(string)) { - // `separatorCopy.lastIndex` is not reliable cross-browser - lastIndex = match.index + match[0][LENGTH]; - if (lastIndex > lastLastIndex) { - output.push(string.slice(lastLastIndex, match.index)); - // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG - // eslint-disable-next-line no-loop-func - if (!NPCG && match[LENGTH] > 1) match[0].replace(separator2, function () { - for (i = 1; i < arguments[LENGTH] - 2; i++) if (arguments[i] === undefined) match[i] = undefined; - }); - if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); - lastLength = match[0][LENGTH]; - lastLastIndex = lastIndex; - if (output[LENGTH] >= splitLimit) break; - } - if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop +},{"../internals/an-object":50,"../internals/array-buffer":52,"../internals/export":86,"../internals/fails":87,"../internals/species-constructor":167,"../internals/to-absolute-index":174,"../internals/to-length":178}],194:[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); } - if (lastLastIndex === string[LENGTH]) { - if (lastLength || !separatorCopy.test('')) output.push(''); - } else output.push(string.slice(lastLastIndex)); - return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; - }; - // Chakra, V8 - } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { - $split = function (separator, limit) { - return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); - }; + } + A.length = n; + return A; } - // 21.1.3.17 String.prototype.split(separator, limit) - return [function split(separator, limit) { - var O = defined(this); - var fn = separator == undefined ? undefined : separator[SPLIT]; - return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); - }, $split]; }); -},{"./_fix-re-wks":62,"./_is-regexp":76}],138:[function(require,module,exports){ -'use strict'; -require('./es6.regexp.flags'); -var anObject = require('./_an-object'); -var $flags = require('./_flags'); -var DESCRIPTORS = require('./_descriptors'); -var TO_STRING = 'toString'; -var $toString = /./[TO_STRING]; +},{"../internals/array-method-has-species-support":60,"../internals/array-species-create":62,"../internals/create-property":77,"../internals/export":86,"../internals/fails":87,"../internals/is-array":111,"../internals/is-object":114,"../internals/to-length":178,"../internals/to-object":179,"../internals/well-known-symbol":188}],195:[function(require,module,exports){ +var $ = require('../internals/export'); +var copyWithin = require('../internals/array-copy-within'); +var addToUnscopables = require('../internals/add-to-unscopables'); -var define = function (fn) { - require('./_redefine')(RegExp.prototype, TO_STRING, fn, true); -}; +// `Array.prototype.copyWithin` method +// https://tc39.github.io/ecma262/#sec-array.prototype.copywithin +$({ target: 'Array', proto: true }, { + copyWithin: copyWithin +}); -// 21.2.5.14 RegExp.prototype.toString() -if (require('./_fails')(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { - define(function toString() { - var R = anObject(this); - return '/'.concat(R.source, '/', - 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined); - }); -// FF44- RegExp#toString has a wrong name -} else if ($toString.name != TO_STRING) { - define(function toString() { - return $toString.call(this); - }); -} +// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables('copyWithin'); -},{"./_an-object":44,"./_descriptors":55,"./_fails":61,"./_flags":63,"./_redefine":103,"./es6.regexp.flags":134}],139:[function(require,module,exports){ -// 21.1.3.7 String.prototype.includes(searchString, position = 0) +},{"../internals/add-to-unscopables":47,"../internals/array-copy-within":53,"../internals/export":86}],196:[function(require,module,exports){ 'use strict'; -var $export = require('./_export'); -var context = require('./_string-context'); -var INCLUDES = 'includes'; +var $ = require('../internals/export'); +var $every = require('../internals/array-iteration').every; +var sloppyArrayMethod = require('../internals/sloppy-array-method'); -$export($export.P + $export.F * require('./_fails-is-regexp')(INCLUDES), 'String', { - includes: function includes(searchString /* , position = 0 */) { - return !!~context(this, searchString, INCLUDES) - .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); +// `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); } }); -},{"./_export":59,"./_fails-is-regexp":60,"./_string-context":111}],140:[function(require,module,exports){ -'use strict'; -var $at = require('./_string-at')(true); +},{"../internals/array-iteration":58,"../internals/export":86,"../internals/sloppy-array-method":166}],197:[function(require,module,exports){ +var $ = require('../internals/export'); +var fill = require('../internals/array-fill'); +var addToUnscopables = require('../internals/add-to-unscopables'); -// 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 }; +// `Array.prototype.fill` method +// https://tc39.github.io/ecma262/#sec-array.prototype.fill +$({ target: 'Array', proto: true }, { + fill: fill }); -},{"./_iter-define":79,"./_string-at":110}],141:[function(require,module,exports){ -// 21.1.3.18 String.prototype.startsWith(searchString [, position ]) +// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables('fill'); + +},{"../internals/add-to-unscopables":47,"../internals/array-fill":54,"../internals/export":86}],198:[function(require,module,exports){ 'use strict'; -var $export = require('./_export'); -var toLength = require('./_to-length'); -var context = require('./_string-context'); -var STARTS_WITH = 'startsWith'; -var $startsWith = ''[STARTS_WITH]; +var $ = require('../internals/export'); +var $filter = require('../internals/array-iteration').filter; +var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); -$export($export.P + $export.F * require('./_fails-is-regexp')(STARTS_WITH), 'String', { - startsWith: function startsWith(searchString /* , position = 0 */) { - var that = context(this, searchString, STARTS_WITH); - var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)); - var search = String(searchString); - return $startsWith - ? $startsWith.call(that, search, index) - : that.slice(index, index + search.length) === search; +// `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); } }); -},{"./_export":59,"./_fails-is-regexp":60,"./_string-context":111,"./_to-length":116}],142:[function(require,module,exports){ +},{"../internals/array-iteration":58,"../internals/array-method-has-species-support":60,"../internals/export":86}],199:[function(require,module,exports){ 'use strict'; -// ECMAScript 6 symbols shim -var global = require('./_global'); -var has = require('./_has'); -var DESCRIPTORS = require('./_descriptors'); -var $export = require('./_export'); -var redefine = require('./_redefine'); -var META = require('./_meta').KEY; -var $fails = require('./_fails'); -var shared = require('./_shared'); -var setToStringTag = require('./_set-to-string-tag'); -var uid = require('./_uid'); -var wks = require('./_wks'); -var wksExt = require('./_wks-ext'); -var wksDefine = require('./_wks-define'); -var enumKeys = require('./_enum-keys'); -var isArray = require('./_is-array'); -var anObject = require('./_an-object'); -var isObject = require('./_is-object'); -var toIObject = require('./_to-iobject'); -var toPrimitive = require('./_to-primitive'); -var createDesc = require('./_property-desc'); -var _create = require('./_object-create'); -var gOPNExt = require('./_object-gopn-ext'); -var $GOPD = require('./_object-gopd'); -var $DP = require('./_object-dp'); -var $keys = require('./_object-keys'); -var gOPD = $GOPD.f; -var dP = $DP.f; -var gOPN = gOPNExt.f; -var $Symbol = global.Symbol; -var $JSON = global.JSON; -var _stringify = $JSON && $JSON.stringify; -var PROTOTYPE = 'prototype'; -var HIDDEN = wks('_hidden'); -var TO_PRIMITIVE = wks('toPrimitive'); -var isEnum = {}.propertyIsEnumerable; -var SymbolRegistry = shared('symbol-registry'); -var AllSymbols = shared('symbols'); -var OPSymbols = shared('op-symbols'); -var ObjectProto = Object[PROTOTYPE]; -var USE_NATIVE = typeof $Symbol == 'function'; -var QObject = global.QObject; -// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 -var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; +var $ = require('../internals/export'); +var $findIndex = require('../internals/array-iteration').findIndex; +var addToUnscopables = require('../internals/add-to-unscopables'); -// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 -var setSymbolDesc = DESCRIPTORS && $fails(function () { - return _create(dP({}, 'a', { - get: function () { return dP(this, 'a', { value: 7 }).a; } - })).a != 7; -}) ? function (it, key, D) { - var protoDesc = gOPD(ObjectProto, key); - if (protoDesc) delete ObjectProto[key]; - dP(it, key, D); - if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); -} : dP; +var FIND_INDEX = 'findIndex'; +var SKIPS_HOLES = true; -var wrap = function (tag) { - var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); - sym._k = tag; - return sym; -}; +// Shouldn't skip holes +if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; }); -var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { - return typeof it == 'symbol'; -} : function (it) { - return it instanceof $Symbol; -}; +// `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); + } +}); -var $defineProperty = function defineProperty(it, key, D) { - if (it === ObjectProto) $defineProperty(OPSymbols, key, D); - anObject(it); - key = toPrimitive(key, true); - anObject(D); - if (has(AllSymbols, key)) { - if (!D.enumerable) { - if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); - it[HIDDEN][key] = true; - } else { - if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; - D = _create(D, { enumerable: createDesc(0, false) }); - } return setSymbolDesc(it, key, D); - } return dP(it, key, D); -}; -var $defineProperties = function defineProperties(it, P) { - anObject(it); - var keys = enumKeys(P = toIObject(P)); - var i = 0; - var l = keys.length; - var key; - while (l > i) $defineProperty(it, key = keys[i++], P[key]); - return it; -}; -var $create = function create(it, P) { - return P === undefined ? _create(it) : $defineProperties(_create(it), P); -}; -var $propertyIsEnumerable = function propertyIsEnumerable(key) { - var E = isEnum.call(this, key = toPrimitive(key, true)); - if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; - return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; -}; -var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { - it = toIObject(it); - key = toPrimitive(key, true); - if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; - var D = gOPD(it, key); - if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; - return D; -}; -var $getOwnPropertyNames = function getOwnPropertyNames(it) { - var names = gOPN(toIObject(it)); - var result = []; - var i = 0; - var key; - while (names.length > i) { - if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); - } return result; -}; -var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { - var IS_OP = it === ObjectProto; - var names = gOPN(IS_OP ? OPSymbols : toIObject(it)); - var result = []; - var i = 0; - var key; - while (names.length > i) { - if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]); - } return result; -}; +// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables(FIND_INDEX); -// 19.4.1.1 Symbol([description]) -if (!USE_NATIVE) { - $Symbol = function Symbol() { - if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); - var tag = uid(arguments.length > 0 ? arguments[0] : undefined); - var $set = function (value) { - if (this === ObjectProto) $set.call(OPSymbols, value); - if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; - setSymbolDesc(this, tag, createDesc(1, value)); - }; - if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); - return wrap(tag); - }; - redefine($Symbol[PROTOTYPE], 'toString', function toString() { - return this._k; - }); +},{"../internals/add-to-unscopables":47,"../internals/array-iteration":58,"../internals/export":86}],200:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var $find = require('../internals/array-iteration').find; +var addToUnscopables = require('../internals/add-to-unscopables'); - $GOPD.f = $getOwnPropertyDescriptor; - $DP.f = $defineProperty; - require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames; - require('./_object-pie').f = $propertyIsEnumerable; - require('./_object-gops').f = $getOwnPropertySymbols; +var FIND = 'find'; +var SKIPS_HOLES = true; - if (DESCRIPTORS && !require('./_library')) { - redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, 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); } +}); - wksExt.f = function (name) { - return wrap(wks(name)); - }; -} +// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables(FIND); -$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); +},{"../internals/add-to-unscopables":47,"../internals/array-iteration":58,"../internals/export":86}],201:[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; + } +}); -for (var es6Symbols = ( - // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 - 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' -).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]); +},{"../internals/a-function":45,"../internals/array-species-create":62,"../internals/export":86,"../internals/flatten-into-array":89,"../internals/to-length":178,"../internals/to-object":179}],202:[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; + } +}); -for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]); +},{"../internals/array-species-create":62,"../internals/export":86,"../internals/flatten-into-array":89,"../internals/to-integer":177,"../internals/to-length":178,"../internals/to-object":179}],203:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var forEach = require('../internals/array-for-each'); -$export($export.S + $export.F * !USE_NATIVE, 'Symbol', { - // 19.4.2.1 Symbol.for(key) - 'for': function (key) { - return has(SymbolRegistry, key += '') - ? SymbolRegistry[key] - : SymbolRegistry[key] = $Symbol(key); - }, - // 19.4.2.5 Symbol.keyFor(sym) - keyFor: function keyFor(sym) { - if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); - for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; - }, - useSetter: function () { setter = true; }, - useSimple: function () { setter = false; } +// `Array.prototype.forEach` method +// https://tc39.github.io/ecma262/#sec-array.prototype.foreach +$({ target: 'Array', proto: true, forced: [].forEach != forEach }, { + forEach: forEach }); -$export($export.S + $export.F * !USE_NATIVE, 'Object', { - // 19.1.2.2 Object.create(O [, Properties]) - create: $create, - // 19.1.2.4 Object.defineProperty(O, P, Attributes) - defineProperty: $defineProperty, - // 19.1.2.3 Object.defineProperties(O, Properties) - defineProperties: $defineProperties, - // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) - getOwnPropertyDescriptor: $getOwnPropertyDescriptor, - // 19.1.2.7 Object.getOwnPropertyNames(O) - getOwnPropertyNames: $getOwnPropertyNames, - // 19.1.2.8 Object.getOwnPropertySymbols(O) - getOwnPropertySymbols: $getOwnPropertySymbols -}); +},{"../internals/array-for-each":55,"../internals/export":86}],204:[function(require,module,exports){ +var $ = require('../internals/export'); +var from = require('../internals/array-from'); +var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); -// 24.3.2 JSON.stringify(value [, replacer [, space]]) -$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { - var S = $Symbol(); - // MS Edge converts symbol values to JSON as {} - // WebKit converts symbol values to JSON as null - // V8 throws on boxed symbols - return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; -})), 'JSON', { - stringify: function stringify(it) { - var args = [it]; - var i = 1; - var replacer, $replacer; - while (arguments.length > i) args.push(arguments[i++]); - $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 _stringify.apply($JSON, args); - } +var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { + Array.from(iterable); }); -// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) -$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); -// 19.4.3.5 Symbol.prototype[@@toStringTag] -setToStringTag($Symbol, 'Symbol'); -// 20.2.1.9 Math[@@toStringTag] -setToStringTag(Math, 'Math', true); -// 24.3.3 JSON[@@toStringTag] -setToStringTag(global.JSON, 'JSON', true); +// `Array.from` method +// https://tc39.github.io/ecma262/#sec-array.from +$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { + from: from +}); -},{"./_an-object":44,"./_descriptors":55,"./_enum-keys":58,"./_export":59,"./_fails":61,"./_global":65,"./_has":66,"./_hide":67,"./_is-array":74,"./_is-object":75,"./_library":83,"./_meta":84,"./_object-create":87,"./_object-dp":88,"./_object-gopd":90,"./_object-gopn":92,"./_object-gopn-ext":91,"./_object-gops":93,"./_object-keys":96,"./_object-pie":97,"./_property-desc":101,"./_redefine":103,"./_set-to-string-tag":106,"./_shared":108,"./_to-iobject":115,"./_to-primitive":118,"./_uid":119,"./_wks":123,"./_wks-define":121,"./_wks-ext":122}],143:[function(require,module,exports){ +},{"../internals/array-from":56,"../internals/check-correctness-of-iteration":65,"../internals/export":86}],205:[function(require,module,exports){ 'use strict'; -// https://github.com/tc39/Array.prototype.includes -var $export = require('./_export'); -var $includes = require('./_array-includes')(true); +var $ = require('../internals/export'); +var $includes = require('../internals/array-includes').includes; +var addToUnscopables = require('../internals/add-to-unscopables'); -$export($export.P, 'Array', { +// `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); } }); -require('./_add-to-unscopables')('includes'); - -},{"./_add-to-unscopables":42,"./_array-includes":45,"./_export":59}],144:[function(require,module,exports){ -require('./_wks-define')('asyncIterator'); - -},{"./_wks-define":121}],145:[function(require,module,exports){ -var $iterators = require('./es6.array.iterator'); -var getKeys = require('./_object-keys'); -var redefine = require('./_redefine'); -var global = require('./_global'); -var hide = require('./_hide'); -var Iterators = require('./_iterators'); -var wks = require('./_wks'); -var ITERATOR = wks('iterator'); -var TO_STRING_TAG = wks('toStringTag'); -var ArrayValues = Iterators.Array; - -var DOMIterables = { - CSSRuleList: true, // TODO: Not spec compliant, should be false. - CSSStyleDeclaration: false, - CSSValueList: false, - ClientRectList: false, - DOMRectList: false, - DOMStringList: false, - DOMTokenList: true, - DataTransferItemList: false, - FileList: false, - HTMLAllCollection: false, - HTMLCollection: false, - HTMLFormElement: false, - HTMLSelectElement: false, - MediaList: true, // TODO: Not spec compliant, should be false. - MimeTypeArray: false, - NamedNodeMap: false, - NodeList: true, - PaintRequestList: false, - Plugin: false, - PluginArray: false, - SVGLengthList: false, - SVGNumberList: false, - SVGPathSegList: false, - SVGPointList: false, - SVGStringList: false, - SVGTransformList: false, - SourceBufferList: false, - StyleSheetList: true, // TODO: Not spec compliant, should be false. - TextTrackCueList: false, - TextTrackList: false, - TouchList: false -}; - -for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) { - var NAME = collections[i]; - var explicit = DOMIterables[NAME]; - var Collection = global[NAME]; - var proto = Collection && Collection.prototype; - var key; - if (proto) { - if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); - if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); - Iterators[NAME] = ArrayValues; - if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true); +// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables('includes'); + +},{"../internals/add-to-unscopables":47,"../internals/array-includes":57,"../internals/export":86}],206:[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); } -} +}); -},{"./_global":65,"./_hide":67,"./_iterators":82,"./_object-keys":96,"./_redefine":103,"./_wks":123,"./es6.array.iterator":128}],146:[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); +},{"../internals/array-includes":57,"../internals/export":86,"../internals/sloppy-array-method":166}],207:[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 }; } - 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; + 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'); -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; +// argumentsList[@@iterator] is %ArrayProto_values% +// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject +// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject +Iterators.Arguments = Iterators.Array; -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; +// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; +},{"../internals/add-to-unscopables":47,"../internals/define-iterator":80,"../internals/internal-state":109,"../internals/iterators":119,"../internals/to-indexed-object":176}],208:[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'); -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; +var nativeJoin = [].join; -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; +var ES3_STRINGS = IndexedObject != Object; +var SLOPPY_METHOD = sloppyArrayMethod('join', ','); -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; +// `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); + } +}); -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; +},{"../internals/export":86,"../internals/indexed-object":106,"../internals/sloppy-array-method":166,"../internals/to-indexed-object":176}],209:[function(require,module,exports){ +var $ = require('../internals/export'); +var lastIndexOf = require('../internals/array-last-index-of'); -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; +// `Array.prototype.lastIndexOf` method +// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof +$({ target: 'Array', proto: true, forced: lastIndexOf !== [].lastIndexOf }, { + lastIndexOf: lastIndexOf +}); -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; +},{"../internals/array-last-index-of":59,"../internals/export":86}],210:[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'); -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; +// `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); + } +}); -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; +},{"../internals/array-iteration":58,"../internals/array-method-has-species-support":60,"../internals/export":86}],211:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var fails = require('../internals/fails'); +var createProperty = require('../internals/create-property'); -exports.isBuffer = Buffer.isBuffer; +var ISNT_GENERIC = fails(function () { + function F() { /* empty */ } + return !(Array.of.call(F) instanceof F); +}); -function objectToString(o) { - return Object.prototype.toString.call(o); -} +// `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; + } +}); -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":239}],147:[function(require,module,exports){ +},{"../internals/create-property":77,"../internals/export":86,"../internals/fails":87}],212:[function(require,module,exports){ 'use strict'; +var $ = require('../internals/export'); +var $reduceRight = require('../internals/array-reduce').right; +var sloppyArrayMethod = require('../internals/sloppy-array-method'); -const cp = require('child_process'); -const parse = require('./lib/parse'); -const enoent = require('./lib/enoent'); - -function spawn(command, args, options) { - // Parse the arguments - const parsed = parse(command, args, options); +// `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); + } +}); - // Spawn the child process - const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); +},{"../internals/array-reduce":61,"../internals/export":86,"../internals/sloppy-array-method":166}],213:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var $reduce = require('../internals/array-reduce').left; +var sloppyArrayMethod = require('../internals/sloppy-array-method'); - // Hook into child process "exit" event to emit an error if the command - // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - enoent.hookChildProcess(spawned, parsed); +// `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); + } +}); - return spawned; -} +},{"../internals/array-reduce":61,"../internals/export":86,"../internals/sloppy-array-method":166}],214:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var isArray = require('../internals/is-array'); -function spawnSync(command, args, options) { - // Parse the arguments - const parsed = parse(command, args, options); +var nativeReverse = [].reverse; +var test = [1, 2]; - // Spawn the child process - const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); +// `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); + } +}); - // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); +},{"../internals/export":86,"../internals/is-array":111}],215:[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; -} - -module.exports = spawn; -module.exports.spawn = spawn; -module.exports.sync = spawnSync; - -module.exports._parse = parse; -module.exports._enoent = enoent; + } +}); -},{"./lib/enoent":148,"./lib/parse":149,"child_process":21}],148:[function(require,module,exports){ -(function (process){ +},{"../internals/array-method-has-species-support":60,"../internals/create-property":77,"../internals/export":86,"../internals/is-array":111,"../internals/is-object":114,"../internals/to-absolute-index":174,"../internals/to-indexed-object":176,"../internals/to-length":178,"../internals/well-known-symbol":188}],216:[function(require,module,exports){ 'use strict'; +var $ = require('../internals/export'); +var $some = require('../internals/array-iteration').some; +var sloppyArrayMethod = require('../internals/sloppy-array-method'); -const isWin = process.platform === 'win32'; +// `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); + } +}); -function notFoundError(original, syscall) { - return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { - code: 'ENOENT', - errno: 'ENOENT', - syscall: `${syscall} ${original.command}`, - path: original.command, - spawnargs: original.args, - }); -} +},{"../internals/array-iteration":58,"../internals/export":86,"../internals/sloppy-array-method":166}],217:[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'); -function hookChildProcess(cp, parsed) { - if (!isWin) { - return; - } +var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD; - const originalEmit = cp.emit; +// `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)); + } +}); - cp.emit = function (name, arg1) { - // If emitting "exit" event and exit code is 1, we need to check if - // the command exists and emit an "error" instead - // See https://github.com/IndigoUnited/node-cross-spawn/issues/16 - if (name === 'exit') { - const err = verifyENOENT(arg1, parsed, 'spawn'); +},{"../internals/a-function":45,"../internals/export":86,"../internals/fails":87,"../internals/sloppy-array-method":166,"../internals/to-object":179}],218:[function(require,module,exports){ +var setSpecies = require('../internals/set-species'); - if (err) { - return originalEmit.call(cp, 'error', err); - } - } +// `Array[@@species]` getter +// https://tc39.github.io/ecma262/#sec-get-array-@@species +setSpecies('Array'); - return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params - }; -} +},{"../internals/set-species":162}],219:[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'); -function verifyENOENT(status, parsed) { - if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, 'spawn'); +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); } - - return null; -} - -function verifyENOENTSync(status, parsed) { - if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, 'spawnSync'); + 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; + } +}); - return null; -} +},{"../internals/array-method-has-species-support":60,"../internals/array-species-create":62,"../internals/create-property":77,"../internals/export":86,"../internals/to-absolute-index":174,"../internals/to-integer":177,"../internals/to-length":178,"../internals/to-object":179}],220:[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'); -module.exports = { - hookChildProcess, - verifyENOENT, - verifyENOENTSync, - notFoundError, -}; +addToUnscopables('flatMap'); -}).call(this,require('_process')) -},{"_process":265}],149:[function(require,module,exports){ -(function (process){ -'use strict'; +},{"../internals/add-to-unscopables":47}],221:[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'); -const path = require('path'); -const niceTry = require('nice-try'); -const resolveCommand = require('./util/resolveCommand'); -const escape = require('./util/escape'); -const readShebang = require('./util/readShebang'); -const semver = require('semver'); +addToUnscopables('flat'); -const isWin = process.platform === 'win32'; -const isExecutableRegExp = /\.(?:com|exe)$/i; -const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; +},{"../internals/add-to-unscopables":47}],222:[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; -// `options.shell` is supported in Node ^4.8.0, ^5.7.0 and >= 6.0.0 -const supportsShellOption = niceTry(() => semver.satisfies(process.version, '^4.8.0 || ^5.7.0 || >= 6.0.0', true)) || false; +// `DataView` constructor +// https://tc39.github.io/ecma262/#sec-dataview-constructor +$({ global: true, forced: !NATIVE_ARRAY_BUFFER }, { + DataView: ArrayBufferModule.DataView +}); -function detectShebang(parsed) { - parsed.file = resolveCommand(parsed); +},{"../internals/array-buffer":52,"../internals/array-buffer-view-core":51,"../internals/export":86}],223:[function(require,module,exports){ +var $ = require('../internals/export'); +var toISOString = require('../internals/date-to-iso-string'); - const shebang = parsed.file && readShebang(parsed.file); +// `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 +}); - if (shebang) { - parsed.args.unshift(parsed.file); - parsed.command = shebang; +},{"../internals/date-to-iso-string":78,"../internals/export":86}],224:[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; +}); - return resolveCommand(parsed); - } +// `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(); + } +}); - return parsed.file; -} +},{"../internals/export":86,"../internals/fails":87,"../internals/to-object":179,"../internals/to-primitive":181}],225:[function(require,module,exports){ +var hide = require('../internals/hide'); +var dateToPrimitive = require('../internals/date-to-primitive'); +var wellKnownSymbol = require('../internals/well-known-symbol'); -function parseNonShell(parsed) { - if (!isWin) { - return parsed; - } +var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); +var DatePrototype = Date.prototype; - // Detect & add support for shebangs - const commandFile = detectShebang(parsed); +// `Date.prototype[@@toPrimitive]` method +// https://tc39.github.io/ecma262/#sec-date.prototype-@@toprimitive +if (!(TO_PRIMITIVE in DatePrototype)) hide(DatePrototype, TO_PRIMITIVE, dateToPrimitive); - // We don't need a shell if the command filename is an executable - const needsShell = !isExecutableRegExp.test(commandFile); +},{"../internals/date-to-primitive":79,"../internals/hide":102,"../internals/well-known-symbol":188}],226:[function(require,module,exports){ +var redefine = require('../internals/redefine'); - // If a shell is required, use cmd.exe and take care of escaping everything correctly - // Note that `forceShell` is an hidden option used only in tests - if (parsed.options.forceShell || needsShell) { - // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/` - // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument - // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called, - // we need to double escape them - const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); +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; + }); +} - // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar) - // This is necessary otherwise it will always fail with ENOENT in those cases - parsed.command = path.normalize(parsed.command); +},{"../internals/redefine":155}],227:[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; + } }); +} - // Escape command & arguments - parsed.command = escape.command(parsed.command); - parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars)); +},{"../internals/is-object":114,"../internals/object-define-property":135,"../internals/object-get-prototype-of":140,"../internals/well-known-symbol":188}],228:[function(require,module,exports){ +var DESCRIPTORS = require('../internals/descriptors'); +var defineProperty = require('../internals/object-define-property').f; - const shellCommand = [parsed.command].concat(parsed.args).join(' '); +var FunctionPrototype = Function.prototype; +var FunctionPrototypeToString = FunctionPrototype.toString; +var nameRE = /^\s*function ([^ (]*)/; +var NAME = 'name'; - parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; - parsed.command = process.env.comspec || 'cmd.exe'; - parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped +// 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 ''; + } } - - return parsed; + }); } -function parseShell(parsed) { - // If node supports the shell option, there's no need to mimic its behavior - if (supportsShellOption) { - return parsed; - } +},{"../internals/descriptors":82,"../internals/object-define-property":135}],229:[function(require,module,exports){ +var global = require('../internals/global'); +var setToStringTag = require('../internals/set-to-string-tag'); - // Mimic node shell option - // See https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335 - const shellCommand = [parsed.command].concat(parsed.args).join(' '); +// JSON[@@toStringTag] property +// https://tc39.github.io/ecma262/#sec-json-@@tostringtag +setToStringTag(global.JSON, 'JSON', true); - if (isWin) { - parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe'; - parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; - parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped - } else { - if (typeof parsed.options.shell === 'string') { - parsed.command = parsed.options.shell; - } else if (process.platform === 'android') { - parsed.command = '/system/bin/sh'; - } else { - parsed.command = '/bin/sh'; - } +},{"../internals/global":99,"../internals/set-to-string-tag":163}],230:[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":70,"../internals/collection-strong":68}],231:[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)); + } +}); - parsed.args = ['-c', shellCommand]; - } +},{"../internals/export":86,"../internals/math-log1p":122}],232:[function(require,module,exports){ +var $ = require('../internals/export'); - return parsed; +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)); } -function parse(command, args, options) { - // Normalize arguments, similar to nodejs - if (args && !Array.isArray(args)) { - options = args; - args = null; - } +// `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 +}); - args = args ? args.slice(0) : []; // Clone array to avoid changing the original - options = Object.assign({}, options); // Clone object to avoid changing the original +},{"../internals/export":86}],233:[function(require,module,exports){ +var $ = require('../internals/export'); - // Build our parsed object - const parsed = { - command, - args, - options, - file: undefined, - original: { - command, - args, - }, - }; +var nativeAtanh = Math.atanh; +var log = Math.log; - // Delegate further parsing to shell or non-shell - return options.shell ? parseShell(parsed) : parseNonShell(parsed); -} +// `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; + } +}); -module.exports = parse; +},{"../internals/export":86}],234:[function(require,module,exports){ +var $ = require('../internals/export'); +var sign = require('../internals/math-sign'); -}).call(this,require('_process')) -},{"./util/escape":150,"./util/readShebang":151,"./util/resolveCommand":152,"_process":265,"nice-try":252,"path":260,"semver":293}],150:[function(require,module,exports){ -'use strict'; +var abs = Math.abs; +var pow = Math.pow; -// See http://www.robvanderwoude.com/escapechars.php -const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; +// `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); + } +}); -function escapeCommand(arg) { - // Escape meta chars - arg = arg.replace(metaCharsRegExp, '^$1'); +},{"../internals/export":86,"../internals/math-sign":123}],235:[function(require,module,exports){ +var $ = require('../internals/export'); - return arg; -} +var floor = Math.floor; +var log = Math.log; +var LOG2E = Math.LOG2E; -function escapeArgument(arg, doubleEscapeMetaChars) { - // Convert to string - arg = `${arg}`; +// `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; + } +}); - // Algorithm below is based on https://qntm.org/cmd +},{"../internals/export":86}],236:[function(require,module,exports){ +var $ = require('../internals/export'); +var expm1 = require('../internals/math-expm1'); - // Sequence of backslashes followed by a double quote: - // double up all the backslashes and escape the double quote - arg = arg.replace(/(\\*)"/g, '$1$1\\"'); +var nativeCosh = Math.cosh; +var abs = Math.abs; +var E = Math.E; - // Sequence of backslashes followed by the end of the string - // (which will become a double quote later): - // double up all the backslashes - arg = arg.replace(/(\\*)$/, '$1$1'); +// `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); + } +}); - // All other backslashes occur literally +},{"../internals/export":86,"../internals/math-expm1":120}],237:[function(require,module,exports){ +var $ = require('../internals/export'); +var expm1 = require('../internals/math-expm1'); - // Quote the whole thing: - arg = `"${arg}"`; +// `Math.expm1` method +// https://tc39.github.io/ecma262/#sec-math.expm1 +$({ target: 'Math', stat: true, forced: expm1 != Math.expm1 }, { expm1: expm1 }); - // Escape meta chars - arg = arg.replace(metaCharsRegExp, '^$1'); +},{"../internals/export":86,"../internals/math-expm1":120}],238:[function(require,module,exports){ +var $ = require('../internals/export'); +var fround = require('../internals/math-fround'); - // Double escape meta chars if necessary - if (doubleEscapeMetaChars) { - arg = arg.replace(metaCharsRegExp, '^$1'); - } +// `Math.fround` method +// https://tc39.github.io/ecma262/#sec-math.fround +$({ target: 'Math', stat: true }, { fround: fround }); - return arg; -} +},{"../internals/export":86,"../internals/math-fround":121}],239:[function(require,module,exports){ +var $ = require('../internals/export'); -module.exports.command = escapeCommand; -module.exports.argument = escapeArgument; +var $hypot = Math.hypot; +var abs = Math.abs; +var sqrt = Math.sqrt; -},{}],151:[function(require,module,exports){ -(function (Buffer){ -'use strict'; +// Chrome 77 bug +// https://bugs.chromium.org/p/v8/issues/detail?id=9546 +var BUGGY = !!$hypot && $hypot(Infinity, NaN) !== Infinity; -const fs = require('fs'); -const shebangCommand = require('shebang-command'); +// `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); + } +}); -function readShebang(command) { - // Read the first 150 bytes from the file - const size = 150; - let buffer; +},{"../internals/export":86}],240:[function(require,module,exports){ +var $ = require('../internals/export'); +var fails = require('../internals/fails'); - if (Buffer.alloc) { - // Node.js v4.5+ / v5.10+ - buffer = Buffer.alloc(size); - } else { - // Old Node.js API - buffer = new Buffer(size); - buffer.fill(0); // zero-fill - } +var nativeImul = Math.imul; - let fd; +var FORCED = fails(function () { + return nativeImul(0xFFFFFFFF, 5) != -5 || nativeImul.length != 2; +}); - try { - fd = fs.openSync(command, 'r'); - fs.readSync(fd, buffer, 0, size, 0); - fs.closeSync(fd); - } catch (e) { /* Empty */ } +// `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); + } +}); - // Attempt to extract shebang (null is returned if not a shebang) - return shebangCommand(buffer.toString()); -} +},{"../internals/export":86,"../internals/fails":87}],241:[function(require,module,exports){ +var $ = require('../internals/export'); -module.exports = readShebang; +var log = Math.log; +var LOG10E = Math.LOG10E; -}).call(this,require("buffer").Buffer) -},{"buffer":22,"fs":21,"shebang-command":294}],152:[function(require,module,exports){ -(function (process){ -'use strict'; +// `Math.log10` method +// https://tc39.github.io/ecma262/#sec-math.log10 +$({ target: 'Math', stat: true }, { + log10: function log10(x) { + return log(x) * LOG10E; + } +}); -const path = require('path'); -const which = require('which'); -const pathKey = require('path-key')(); +},{"../internals/export":86}],242:[function(require,module,exports){ +var $ = require('../internals/export'); +var log1p = require('../internals/math-log1p'); -function resolveCommandAttempt(parsed, withoutPathExt) { - const cwd = process.cwd(); - const hasCustomCwd = parsed.options.cwd != null; +// `Math.log1p` method +// https://tc39.github.io/ecma262/#sec-math.log1p +$({ target: 'Math', stat: true }, { log1p: log1p }); - // If a custom `cwd` was specified, we need to change the process cwd - // because `which` will do stat calls but does not support a custom cwd - if (hasCustomCwd) { - try { - process.chdir(parsed.options.cwd); - } catch (err) { - /* Empty */ - } - } +},{"../internals/export":86,"../internals/math-log1p":122}],243:[function(require,module,exports){ +var $ = require('../internals/export'); - let resolved; +var log = Math.log; +var LN2 = Math.LN2; - try { - resolved = which.sync(parsed.command, { - path: (parsed.options.env || process.env)[pathKey], - pathExt: withoutPathExt ? path.delimiter : undefined, - }); - } catch (e) { - /* Empty */ - } finally { - process.chdir(cwd); - } +// `Math.log2` method +// https://tc39.github.io/ecma262/#sec-math.log2 +$({ target: 'Math', stat: true }, { + log2: function log2(x) { + return log(x) / LN2; + } +}); - // If we successfully resolved, ensure that an absolute path is returned - // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it - if (resolved) { - resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved); - } +},{"../internals/export":86}],244:[function(require,module,exports){ +var $ = require('../internals/export'); +var sign = require('../internals/math-sign'); - return resolved; -} +// `Math.sign` method +// https://tc39.github.io/ecma262/#sec-math.sign +$({ target: 'Math', stat: true }, { + sign: sign +}); -function resolveCommand(parsed) { - return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true); -} +},{"../internals/export":86,"../internals/math-sign":123}],245:[function(require,module,exports){ +var $ = require('../internals/export'); +var fails = require('../internals/fails'); +var expm1 = require('../internals/math-expm1'); -module.exports = resolveCommand; +var abs = Math.abs; +var exp = Math.exp; +var E = Math.E; -}).call(this,require('_process')) -},{"_process":265,"path":260,"path-key":262,"which":326}],153:[function(require,module,exports){ -'use strict'; +var FORCED = fails(function () { + return Math.sinh(-2e-17) != -2e-17; +}); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +// `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); + } +}); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +},{"../internals/export":86,"../internals/fails":87,"../internals/math-expm1":120}],246:[function(require,module,exports){ +var $ = require('../internals/export'); +var expm1 = require('../internals/math-expm1'); -var _require = require('./errors'), - CucumberExpressionError = _require.CucumberExpressionError; +var exp = Math.exp; -var Argument = function () { - _createClass(Argument, null, [{ - key: 'build', - value: function build(treeRegexp, text, parameterTypes) { - var group = treeRegexp.match(text); - if (!group) return null; +// `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)); + } +}); - var argGroups = group.children; +},{"../internals/export":86,"../internals/math-expm1":120}],247:[function(require,module,exports){ +var setToStringTag = require('../internals/set-to-string-tag'); - if (argGroups.length !== parameterTypes.length) { - throw new 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; - }) + ')'); - } +// Math[@@toStringTag] property +// https://tc39.github.io/ecma262/#sec-math-@@tostringtag +setToStringTag(Math, 'Math', true); - return parameterTypes.map(function (parameterType, i) { - return new Argument(argGroups[i], parameterType); - }); - } - }]); +},{"../internals/set-to-string-tag":163}],248:[function(require,module,exports){ +var $ = require('../internals/export'); - function Argument(group, parameterType) { - _classCallCheck(this, Argument); +var ceil = Math.ceil; +var floor = Math.floor; - this._group = group; - this._parameterType = parameterType; +// `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); } +}); - _createClass(Argument, [{ - key: 'getValue', - - - /** - * Get the value returned by the parameter type's transformer function. - * - * @param thisObj the object in which the transformer function is applied. - */ - value: function getValue(thisObj) { - var groupValues = this._group ? this._group.values : null; - return this._parameterType.transform(thisObj, groupValues); - } - }, { - key: 'group', - get: function get() { - return this._group; +},{"../internals/export":86}],249:[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); +} - return Argument; -}(); +},{"../internals/classof-raw":66,"../internals/descriptors":82,"../internals/fails":87,"../internals/global":99,"../internals/has":100,"../internals/inherit-if-required":107,"../internals/is-forced":112,"../internals/object-create":133,"../internals/object-define-property":135,"../internals/object-get-own-property-descriptor":136,"../internals/object-get-own-property-names":138,"../internals/redefine":155,"../internals/string-trim":171,"../internals/to-primitive":181}],250:[function(require,module,exports){ +var $ = require('../internals/export'); -module.exports = Argument; -},{"./errors":157}],154:[function(require,module,exports){ -'use strict'; +// `Number.EPSILON` constant +// https://tc39.github.io/ecma262/#sec-number.epsilon +$({ target: 'Number', stat: true }, { + EPSILON: Math.pow(2, -52) +}); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +},{"../internals/export":86}],251:[function(require,module,exports){ +var $ = require('../internals/export'); +var numberIsFinite = require('../internals/number-is-finite'); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +// `Number.isFinite` method +// https://tc39.github.io/ecma262/#sec-number.isfinite +$({ target: 'Number', stat: true }, { isFinite: numberIsFinite }); -var GeneratedExpression = require('./generated_expression'); +},{"../internals/export":86,"../internals/number-is-finite":131}],252:[function(require,module,exports){ +var $ = require('../internals/export'); +var isInteger = require('../internals/is-integer'); -var CombinatorialGeneratedExpressionFactory = function () { - function CombinatorialGeneratedExpressionFactory(expressionTemplate, parameterTypeCombinations) { - _classCallCheck(this, CombinatorialGeneratedExpressionFactory); +// `Number.isInteger` method +// https://tc39.github.io/ecma262/#sec-number.isinteger +$({ target: 'Number', stat: true }, { + isInteger: isInteger +}); - this._expressionTemplate = expressionTemplate; - this._parameterTypeCombinations = parameterTypeCombinations; - } +},{"../internals/export":86,"../internals/is-integer":113}],253:[function(require,module,exports){ +var $ = require('../internals/export'); - _createClass(CombinatorialGeneratedExpressionFactory, [{ - key: 'generateExpressions', - value: function generateExpressions() { - var generatedExpressions = []; - this._generatePermutations(generatedExpressions, 0, []); - return generatedExpressions; - } - }, { - key: '_generatePermutations', - value: function _generatePermutations(generatedExpressions, depth, currentParameterTypes) { - if (depth === this._parameterTypeCombinations.length) { - generatedExpressions.push(new GeneratedExpression(this._expressionTemplate, currentParameterTypes)); - return; - } +// `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; + } +}); - for (var i = 0; i < this._parameterTypeCombinations[depth].length; ++i) { - var newCurrentParameterTypes = currentParameterTypes.slice(); // clone - newCurrentParameterTypes.push(this._parameterTypeCombinations[depth][i]); - this._generatePermutations(generatedExpressions, depth + 1, newCurrentParameterTypes); - } - } - }]); +},{"../internals/export":86}],254:[function(require,module,exports){ +var $ = require('../internals/export'); +var isInteger = require('../internals/is-integer'); - return CombinatorialGeneratedExpressionFactory; -}(); +var abs = Math.abs; -module.exports = CombinatorialGeneratedExpressionFactory; -},{"./generated_expression":158}],155:[function(require,module,exports){ -'use strict'; +// `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; + } +}); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +},{"../internals/export":86,"../internals/is-integer":113}],255:[function(require,module,exports){ +var $ = require('../internals/export'); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +// `Number.MAX_SAFE_INTEGER` constant +// https://tc39.github.io/ecma262/#sec-number.max_safe_integer +$({ target: 'Number', stat: true }, { + MAX_SAFE_INTEGER: 0x1FFFFFFFFFFFFF +}); -var Argument = require('./argument'); -var TreeRegexp = require('./tree_regexp'); -var ParameterType = require('./parameter_type'); +},{"../internals/export":86}],256:[function(require,module,exports){ +var $ = require('../internals/export'); -var _require = require('./errors'), - UndefinedParameterTypeError = _require.UndefinedParameterTypeError, - CucumberExpressionError = _require.CucumberExpressionError; +// `Number.MIN_SAFE_INTEGER` constant +// https://tc39.github.io/ecma262/#sec-number.min_safe_integer +$({ target: 'Number', stat: true }, { + MIN_SAFE_INTEGER: -0x1FFFFFFFFFFFFF +}); -// 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 +},{"../internals/export":86}],257:[function(require,module,exports){ +var $ = require('../internals/export'); +var parseFloat = require('../internals/parse-float'); -// Does not include (){} characters because they have special meaning +// `Number.parseFloat` method +// https://tc39.github.io/ecma262/#sec-number.parseFloat +$({ target: 'Number', stat: true, forced: Number.parseFloat != parseFloat }, { + parseFloat: parseFloat +}); +},{"../internals/export":86,"../internals/parse-float":148}],258:[function(require,module,exports){ +var $ = require('../internals/export'); +var parseInt = require('../internals/parse-int'); -var ESCAPE_REGEXP = function ESCAPE_REGEXP() { - return (/([\\^[$.|?*+])/g - ); -}; -var PARAMETER_REGEXP = function PARAMETER_REGEXP() { - return (/(\\\\)?{([^}]+)}/g - ); -}; -var OPTIONAL_REGEXP = function OPTIONAL_REGEXP() { - return (/(\\\\)?\(([^)]+)\)/g - ); -}; -var ALTERNATIVE_NON_WHITESPACE_TEXT_REGEXP = function ALTERNATIVE_NON_WHITESPACE_TEXT_REGEXP() { - 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: '; +// `Number.parseInt` method +// https://tc39.github.io/ecma262/#sec-number.parseint +$({ target: 'Number', stat: true, forced: Number.parseInt != parseInt }, { + parseInt: parseInt +}); -var CucumberExpression = function () { - /** - * @param expression - * @param parameterTypeRegistry - */ - function CucumberExpression(expression, parameterTypeRegistry) { - _classCallCheck(this, CucumberExpression); +},{"../internals/export":86,"../internals/parse-int":149}],259:[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'); - this._expression = expression; - this._parameterTypes = []; +var nativeToFixed = 1.0.toFixed; +var floor = Math.floor; - expression = this.processEscapes(expression); - expression = this.processOptional(expression); - expression = this.processAlternation(expression); - expression = this.processParameters(expression, parameterTypeRegistry); - expression = '^' + expression + '$'; +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); +}; - this._treeRegexp = new TreeRegexp(expression); +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; +}; - _createClass(CucumberExpression, [{ - key: 'processEscapes', - value: function processEscapes(expression) { - return expression.replace(ESCAPE_REGEXP(), '\\$1'); - } - }, { - key: 'processOptional', - value: function processOptional(expression) { - var _this = this; - - return expression.replace(OPTIONAL_REGEXP(), function (match, p1, p2) { - _this._checkNoParameterType(p2, PARAMETER_TYPES_CANNOT_BE_OPTIONAL); - return p1 === DOUBLE_ESCAPE ? '\\(' + p2 + '\\)' : '(?:' + p2 + ')?'; - }); - } - }, { - key: 'processAlternation', - value: function processAlternation(expression) { - var _this2 = this; - - return expression.replace(ALTERNATIVE_NON_WHITESPACE_TEXT_REGEXP(), function (match) { - // replace \/ with / - // replace / with | - var replacement = match.replace(/\//g, '|').replace(/\\\|/g, '/'); - if (replacement.indexOf('|') !== -1) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; +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({}); +}); - try { - for (var _iterator = replacement.split(/\|/)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var part = _step.value; +// `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); + } + }; - _this2._checkNoParameterType(part, PARAMETER_TYPES_CANNOT_BE_ALTERNATIVE); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } + 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; + } + }; - return '(?:' + replacement + ')'; - } else { - return replacement; + 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; } - }); - } - }, { - key: 'processParameters', - value: function processParameters(expression, parameterTypeRegistry) { - var _this3 = this; - - return expression.replace(PARAMETER_REGEXP(), function (match, p1, p2) { - if (p1 === DOUBLE_ESCAPE) return '\\{' + p2 + '\\}'; + } return s; + }; - var typeName = p2; - ParameterType.checkParameterTypeName(typeName); - var parameterType = parameterTypeRegistry.lookupByTypeName(typeName); - if (!parameterType) throw new UndefinedParameterTypeError(typeName); - _this3._parameterTypes.push(parameterType); - return buildCaptureRegexp(parameterType.regexps); - }); - } - }, { - key: 'match', - value: function match(text) { - return Argument.build(this._treeRegexp, text, this._parameterTypes); - } - }, { - key: '_checkNoParameterType', - value: function _checkNoParameterType(s, message) { - if (s.match(PARAMETER_REGEXP())) { - throw new CucumberExpressionError(message + this.source); + 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); } } - }, { - key: 'regexp', - get: function get() { - return this._treeRegexp.regexp; - } - }, { - key: 'source', - get: function get() { - return this._expression; - } - }]); + 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; + } +}); - return CucumberExpression; -}(); +},{"../internals/export":86,"../internals/fails":87,"../internals/string-repeat":170,"../internals/this-number-value":173,"../internals/to-integer":177}],260:[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({}); +}); -function buildCaptureRegexp(regexps) { - if (regexps.length === 1) { - return '(' + regexps[0] + ')'; +// `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); } +}); - var captureGroups = regexps.map(function (group) { - return '(?:' + group + ')'; - }); +},{"../internals/export":86,"../internals/fails":87,"../internals/this-number-value":173}],261:[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 +}); - return '(' + captureGroups.join('|') + ')'; +},{"../internals/export":86,"../internals/object-assign":132}],262:[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 }); + } + }); } -module.exports = CucumberExpression; -},{"./argument":153,"./errors":157,"./parameter_type":162,"./tree_regexp":166}],156:[function(require,module,exports){ + +},{"../internals/a-function":45,"../internals/descriptors":82,"../internals/export":86,"../internals/forced-object-prototype-accessors-methods":90,"../internals/object-define-property":135,"../internals/to-object":179}],263:[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 }); + } + }); +} -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +},{"../internals/a-function":45,"../internals/descriptors":82,"../internals/export":86,"../internals/forced-object-prototype-accessors-methods":90,"../internals/object-define-property":135,"../internals/to-object":179}],264:[function(require,module,exports){ +var $ = require('../internals/export'); +var $entries = require('../internals/object-to-array').entries; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +// `Object.entries` method +// https://tc39.github.io/ecma262/#sec-object.entries +$({ target: 'Object', stat: true }, { + entries: function entries(O) { + return $entries(O); + } +}); -var util = require('util'); -var ParameterTypeMatcher = require('./parameter_type_matcher'); -var ParameterType = require('./parameter_type'); -var CombinatorialGeneratedExpressionFactory = require('./combinatorial_generated_expression_factory'); +},{"../internals/export":86,"../internals/object-to-array":145}],265:[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 CucumberExpressionGenerator = function () { - function CucumberExpressionGenerator(parameterTypeRegistry) { - _classCallCheck(this, CucumberExpressionGenerator); +var nativeFreeze = Object.freeze; +var FAILS_ON_PRIMITIVES = fails(function () { nativeFreeze(1); }); - this._parameterTypeRegistry = parameterTypeRegistry; +// `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; } +}); - _createClass(CucumberExpressionGenerator, [{ - key: 'generateExpressions', - value: function generateExpressions(text) { - var parameterTypeCombinations = []; - var parameterTypeMatchers = this._createParameterTypeMatchers(text); - var expressionTemplate = ''; - var pos = 0; +},{"../internals/export":86,"../internals/fails":87,"../internals/freezing":93,"../internals/internal-metadata":108,"../internals/is-object":114}],266:[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; + } +}); - // eslint-disable-next-line no-constant-condition - while (true) { - var matchingParameterTypeMatchers = []; +},{"../internals/create-property":77,"../internals/export":86,"../internals/iterate":117}],267:[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 _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; +var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); }); +var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES; - try { - for (var _iterator = parameterTypeMatchers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var parameterTypeMatcher = _step.value; +// `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); + } +}); - var advancedParameterTypeMatcher = parameterTypeMatcher.advanceTo(pos); - if (advancedParameterTypeMatcher.find) { - matchingParameterTypeMatchers.push(advancedParameterTypeMatcher); - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } +},{"../internals/descriptors":82,"../internals/export":86,"../internals/fails":87,"../internals/object-get-own-property-descriptor":136,"../internals/to-indexed-object":176}],268:[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; + } +}); - if (matchingParameterTypeMatchers.length > 0) { - (function () { - matchingParameterTypeMatchers = matchingParameterTypeMatchers.sort(ParameterTypeMatcher.compare); +},{"../internals/create-property":77,"../internals/descriptors":82,"../internals/export":86,"../internals/object-get-own-property-descriptor":136,"../internals/own-keys":147,"../internals/to-indexed-object":176}],269:[function(require,module,exports){ +var $ = require('../internals/export'); +var fails = require('../internals/fails'); +var nativeGetOwnPropertyNames = require('../internals/object-get-own-property-names-external').f; - // Find all the best parameter type matchers, they are all candidates. - var bestParameterTypeMatcher = matchingParameterTypeMatchers[0]; - var bestParameterTypeMatchers = matchingParameterTypeMatchers.filter(function (m) { - return ParameterTypeMatcher.compare(m, bestParameterTypeMatcher) === 0; - }); +var FAILS_ON_PRIMITIVES = fails(function () { return !Object.getOwnPropertyNames(1); }); - // 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 = []; - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; +// `Object.getOwnPropertyNames` method +// https://tc39.github.io/ecma262/#sec-object.getownpropertynames +$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { + getOwnPropertyNames: nativeGetOwnPropertyNames +}); - try { - for (var _iterator2 = bestParameterTypeMatchers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var _parameterTypeMatcher = _step2.value; +},{"../internals/export":86,"../internals/fails":87,"../internals/object-get-own-property-names-external":137}],270:[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'); - if (parameterTypes.indexOf(_parameterTypeMatcher.parameterType) === -1) { - parameterTypes.push(_parameterTypeMatcher.parameterType); - } - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } +var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); }); - parameterTypes = parameterTypes.sort(ParameterType.compare); +// `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)); + } +}); - parameterTypeCombinations.push(parameterTypes); - expressionTemplate += escape(text.slice(pos, bestParameterTypeMatcher.start)); - expressionTemplate += '{%s}'; +},{"../internals/correct-prototype-getter":73,"../internals/export":86,"../internals/fails":87,"../internals/object-get-prototype-of":140,"../internals/to-object":179}],271:[function(require,module,exports){ +var $ = require('../internals/export'); +var fails = require('../internals/fails'); +var isObject = require('../internals/is-object'); - pos = bestParameterTypeMatcher.start + bestParameterTypeMatcher.group.length; - })(); - } else { - break; - } +var nativeIsExtensible = Object.isExtensible; +var FAILS_ON_PRIMITIVES = fails(function () { nativeIsExtensible(1); }); - if (pos >= text.length) { - break; - } - } +// `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; + } +}); - expressionTemplate += escape(text.slice(pos)); - return new CombinatorialGeneratedExpressionFactory(expressionTemplate, parameterTypeCombinations).generateExpressions(); - } +},{"../internals/export":86,"../internals/fails":87,"../internals/is-object":114}],272:[function(require,module,exports){ +var $ = require('../internals/export'); +var fails = require('../internals/fails'); +var isObject = require('../internals/is-object'); - /** - * @deprecated - */ +var nativeIsFrozen = Object.isFrozen; +var FAILS_ON_PRIMITIVES = fails(function () { nativeIsFrozen(1); }); - }, { - key: 'generateExpression', - value: function generateExpression(text) { - var _this = this; +// `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; + } +}); - return util.deprecate(function () { - return _this.generateExpressions(text)[0]; - }, 'CucumberExpressionGenerator.generateExpression: Use CucumberExpressionGenerator.generateExpressions instead')(); - } - }, { - key: '_createParameterTypeMatchers', - value: function _createParameterTypeMatchers(text) { - var parameterMatchers = []; - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; +},{"../internals/export":86,"../internals/fails":87,"../internals/is-object":114}],273:[function(require,module,exports){ +var $ = require('../internals/export'); +var fails = require('../internals/fails'); +var isObject = require('../internals/is-object'); - try { - for (var _iterator3 = this._parameterTypeRegistry.parameterTypes[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var parameterType = _step3.value; +var nativeIsSealed = Object.isSealed; +var FAILS_ON_PRIMITIVES = fails(function () { nativeIsSealed(1); }); - if (parameterType.useForSnippets) { - parameterMatchers = parameterMatchers.concat(this._createParameterTypeMatchers2(parameterType, text)); - } - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } +// `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; + } +}); - return parameterMatchers; - } - }, { - key: '_createParameterTypeMatchers2', - value: function _createParameterTypeMatchers2(parameterType, text) { - // TODO: [].map - var result = []; - var _iteratorNormalCompletion4 = true; - var _didIteratorError4 = false; - var _iteratorError4 = undefined; +},{"../internals/export":86,"../internals/fails":87,"../internals/is-object":114}],274:[function(require,module,exports){ +var $ = require('../internals/export'); +var is = require('../internals/same-value'); - try { - for (var _iterator4 = parameterType.regexps[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { - var regexp = _step4.value; +// `Object.is` method +// https://tc39.github.io/ecma262/#sec-object.is +$({ target: 'Object', stat: true }, { + is: is +}); - result.push(new ParameterTypeMatcher(parameterType, regexp, text)); - } - } catch (err) { - _didIteratorError4 = true; - _iteratorError4 = err; - } finally { - try { - if (!_iteratorNormalCompletion4 && _iterator4.return) { - _iterator4.return(); - } - } finally { - if (_didIteratorError4) { - throw _iteratorError4; - } - } - } +},{"../internals/export":86,"../internals/same-value":160}],275:[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'); - return result; - } - }]); +var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); }); - return CucumberExpressionGenerator; -}(); +// `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)); + } +}); -function escape(s) { - return s.replace(/%/g, '%%') // for util.format - .replace(/\(/g, '\\(').replace(/{/g, '\\{').replace(/\//g, '\\/'); +},{"../internals/export":86,"../internals/fails":87,"../internals/object-keys":142,"../internals/to-object":179}],276:[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)); + } + }); } -module.exports = CucumberExpressionGenerator; -},{"./combinatorial_generated_expression_factory":154,"./parameter_type":162,"./parameter_type_matcher":163,"util":324}],157:[function(require,module,exports){ +},{"../internals/descriptors":82,"../internals/export":86,"../internals/forced-object-prototype-accessors-methods":90,"../internals/object-get-own-property-descriptor":136,"../internals/object-get-prototype-of":140,"../internals/to-object":179,"../internals/to-primitive":181}],277:[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)); + } + }); +} -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +},{"../internals/descriptors":82,"../internals/export":86,"../internals/forced-object-prototype-accessors-methods":90,"../internals/object-get-own-property-descriptor":136,"../internals/object-get-prototype-of":140,"../internals/to-object":179,"../internals/to-primitive":181}],278:[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'); -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +var nativePreventExtensions = Object.preventExtensions; +var FAILS_ON_PRIMITIVES = fails(function () { nativePreventExtensions(1); }); -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +// `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; + } +}); -var CucumberExpressionError = function (_Error) { - _inherits(CucumberExpressionError, _Error); +},{"../internals/export":86,"../internals/fails":87,"../internals/freezing":93,"../internals/internal-metadata":108,"../internals/is-object":114}],279:[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'); - function CucumberExpressionError() { - _classCallCheck(this, CucumberExpressionError); +var nativeSeal = Object.seal; +var FAILS_ON_PRIMITIVES = fails(function () { nativeSeal(1); }); - return _possibleConstructorReturn(this, (CucumberExpressionError.__proto__ || Object.getPrototypeOf(CucumberExpressionError)).apply(this, arguments)); +// `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; } +}); - return CucumberExpressionError; -}(Error); +},{"../internals/export":86,"../internals/fails":87,"../internals/freezing":93,"../internals/internal-metadata":108,"../internals/is-object":114}],280:[function(require,module,exports){ +var $ = require('../internals/export'); +var setPrototypeOf = require('../internals/object-set-prototype-of'); -var AmbiguousParameterTypeError = function (_CucumberExpressionEr) { - _inherits(AmbiguousParameterTypeError, _CucumberExpressionEr); +// `Object.setPrototypeOf` method +// https://tc39.github.io/ecma262/#sec-object.setprototypeof +$({ target: 'Object', stat: true }, { + setPrototypeOf: setPrototypeOf +}); - function AmbiguousParameterTypeError() { - _classCallCheck(this, AmbiguousParameterTypeError); +},{"../internals/export":86,"../internals/object-set-prototype-of":144}],281:[function(require,module,exports){ +var redefine = require('../internals/redefine'); +var toString = require('../internals/object-to-string'); - return _possibleConstructorReturn(this, (AmbiguousParameterTypeError.__proto__ || Object.getPrototypeOf(AmbiguousParameterTypeError)).apply(this, arguments)); - } +var ObjectPrototype = Object.prototype; - _createClass(AmbiguousParameterTypeError, null, [{ - key: 'forConstructor', - value: function forConstructor(keyName, keyValue, parameterTypes, generatedExpressions) { - return new this('parameter type with ' + keyName + '=' + keyValue + ' is used by several parameter types: ' + parameterTypes + ', ' + generatedExpressions); - } - }, { - key: 'forRegExp', - value: function forRegExp(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'); - } - }, { - key: '_parameterTypeNames', - value: function _parameterTypeNames(parameterTypes) { - return parameterTypes.map(function (p) { - return '{' + p.name + '}'; - }).join('\n '); - } - }, { - key: '_expressions', - value: function _expressions(generatedExpressions) { - return generatedExpressions.map(function (e) { - return e.source; - }).join('\n '); - } - }]); +// `Object.prototype.toString` method +// https://tc39.github.io/ecma262/#sec-object.prototype.tostring +if (toString !== ObjectPrototype.toString) { + redefine(ObjectPrototype, 'toString', toString, { unsafe: true }); +} - return AmbiguousParameterTypeError; -}(CucumberExpressionError); +},{"../internals/object-to-string":146,"../internals/redefine":155}],282:[function(require,module,exports){ +var $ = require('../internals/export'); +var $values = require('../internals/object-to-array').values; -var UndefinedParameterTypeError = function (_CucumberExpressionEr2) { - _inherits(UndefinedParameterTypeError, _CucumberExpressionEr2); +// `Object.values` method +// https://tc39.github.io/ecma262/#sec-object.values +$({ target: 'Object', stat: true }, { + values: function values(O) { + return $values(O); + } +}); - function UndefinedParameterTypeError(typeName) { - _classCallCheck(this, UndefinedParameterTypeError); +},{"../internals/export":86,"../internals/object-to-array":145}],283:[function(require,module,exports){ +var $ = require('../internals/export'); +var parseFloatImplementation = require('../internals/parse-float'); - return _possibleConstructorReturn(this, (UndefinedParameterTypeError.__proto__ || Object.getPrototypeOf(UndefinedParameterTypeError)).call(this, 'Undefined parameter type {' + typeName + '}')); - } +// `parseFloat` method +// https://tc39.github.io/ecma262/#sec-parsefloat-string +$({ global: true, forced: parseFloat != parseFloatImplementation }, { + parseFloat: parseFloatImplementation +}); - return UndefinedParameterTypeError; -}(CucumberExpressionError); +},{"../internals/export":86,"../internals/parse-float":148}],284:[function(require,module,exports){ +var $ = require('../internals/export'); +var parseIntImplementation = require('../internals/parse-int'); -module.exports = { - AmbiguousParameterTypeError: AmbiguousParameterTypeError, - UndefinedParameterTypeError: UndefinedParameterTypeError, - CucumberExpressionError: CucumberExpressionError -}; -},{}],158:[function(require,module,exports){ +// `parseInt` method +// https://tc39.github.io/ecma262/#sec-parseint-string-radix +$({ global: true, forced: parseInt != parseIntImplementation }, { + parseInt: parseIntImplementation +}); + +},{"../internals/export":86,"../internals/parse-int":149}],285:[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 + ); + } +}); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +// 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']); +} -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } +},{"../internals/export":86,"../internals/get-built-in":96,"../internals/is-pure":115,"../internals/native-promise-constructor":125,"../internals/promise-resolve":152,"../internals/redefine":155,"../internals/species-constructor":167}],286:[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); +}); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) { + PromiseConstructor.all(iterable)['catch'](function () { /* empty */ }); +}); -var util = require('util'); +// helpers +var isThenable = function (it) { + var then; + return isObject(it) && typeof (then = it.then) == 'function' ? then : false; +}; -var GeneratedExpression = function () { - function GeneratedExpression(expressionTemplate, parameterTypes) { - _classCallCheck(this, GeneratedExpression); +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); + }); +}; - this._expressionTemplate = expressionTemplate; - this._parameterTypes = parameterTypes; - } +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); +}; - _createClass(GeneratedExpression, [{ - key: 'source', - get: function get() { - return util.format.apply(util, [this._expressionTemplate].concat(_toConsumableArray(this._parameterTypes.map(function (t) { - return t.name; - })))); +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; } + }); +}; - /** - * Returns an array of parameter names to use in generated function/method signatures - * - * @returns {Array.} - */ +var isUnhandled = function (state) { + return state.rejection !== HANDLED && !state.parent; +}; - }, { - key: 'parameterNames', - get: function get() { - var usageByTypeName = {}; - return this._parameterTypes.map(function (t) { - return getParameterName(t.name, usageByTypeName); +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); + } +}; - /** - * @returns {Array.} - */ - - }, { - key: 'parameterTypes', - get: function get() { - return this._parameterTypes; +// 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); + }; - return GeneratedExpression; -}(); + if (!IS_PURE && typeof NativePromise == 'function') { + nativeThen = NativePromise.prototype.then; -function getParameterName(typeName, usageByTypeName) { - var count = usageByTypeName[typeName]; - count = count ? count + 1 : 1; - usageByTypeName[typeName] = count; + // 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); + }); - return count === 1 ? typeName : '' + typeName + count; + // 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)); + } + }); + } } -module.exports = GeneratedExpression; -},{"util":324}],159:[function(require,module,exports){ -"use strict"; +$({ global: true, wrap: true, forced: FORCED }, { + Promise: PromiseConstructor +}); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +setToStringTag(PromiseConstructor, PROMISE, false, true); +setSpecies(PROMISE); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +PromiseWrapper = path[PROMISE]; -var Group = function () { - function Group(value, start, end, children) { - _classCallCheck(this, Group); +// 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; + } +}); - this._value = value; - this._start = start; - this._end = end; - this._children = children; +$({ 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); } +}); - _createClass(Group, [{ - key: "value", - get: function get() { - return this._value; - } - }, { - key: "start", - get: function get() { - return this._start; - } - }, { - key: "end", - get: function get() { - return this._end; - } - }, { - key: "children", - get: function get() { - return this._children; - } - }, { - key: "values", - get: function get() { - return (this.children.length === 0 ? [this] : this.children).map(function (g) { - return g.value; - }).filter(function (v) { - return v !== undefined; +$({ 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; + } +}); - return Group; -}(); +},{"../internals/a-function":45,"../internals/an-instance":49,"../internals/check-correctness-of-iteration":65,"../internals/classof-raw":66,"../internals/export":86,"../internals/global":99,"../internals/host-report-errors":103,"../internals/internal-state":109,"../internals/is-forced":112,"../internals/is-object":114,"../internals/is-pure":115,"../internals/iterate":117,"../internals/microtask":124,"../internals/native-promise-constructor":125,"../internals/new-promise-capability":129,"../internals/path":150,"../internals/perform":151,"../internals/promise-resolve":152,"../internals/redefine":155,"../internals/redefine-all":154,"../internals/set-species":162,"../internals/set-to-string-tag":163,"../internals/species-constructor":167,"../internals/task":172,"../internals/user-agent":186,"../internals/well-known-symbol":188}],287:[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'); -module.exports = Group; -},{}],160:[function(require,module,exports){ -'use strict'; +var nativeApply = getBuiltIn('Reflect', 'apply'); +var functionApply = Function.apply; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +// MS Edge argumentsList argument is optional +var OPTIONAL_ARGUMENTS_LIST = !fails(function () { + nativeApply(function () { /* empty */ }); +}); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +// `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); + } +}); -var Group = require('./group'); +},{"../internals/a-function":45,"../internals/an-object":50,"../internals/export":86,"../internals/fails":87,"../internals/get-built-in":96}],288:[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; + } +}); -var GroupBuilder = function () { - function GroupBuilder() { - _classCallCheck(this, GroupBuilder); +},{"../internals/a-function":45,"../internals/an-object":50,"../internals/export":86,"../internals/fails":87,"../internals/function-bind":94,"../internals/get-built-in":96,"../internals/is-object":114,"../internals/object-create":133}],289:[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 }); +}); - this._groupBuilders = []; - this._capturing = true; +// `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; + } } +}); - _createClass(GroupBuilder, [{ - key: 'add', - value: function add(groupBuilder) { - this._groupBuilders.push(groupBuilder); - } - }, { - key: 'build', - value: function build(match, nextGroupIndex) { - var groupIndex = nextGroupIndex(); - var children = this._groupBuilders.map(function (gb) { - return gb.build(match, nextGroupIndex); - }); - return new Group(match[groupIndex], match.index[groupIndex], match.index[groupIndex] + (match[groupIndex] || '').length, children); - } - }, { - key: 'setNonCapturing', - value: function setNonCapturing() { - this._capturing = false; - } - }, { - key: 'moveChildrenTo', - value: function moveChildrenTo(groupBuilder) { - this._groupBuilders.forEach(function (child) { - return groupBuilder.add(child); - }); - } - }, { - key: 'capturing', - get: function get() { - return this._capturing; - } - }, { - key: 'children', - get: function get() { - return this._groupBuilders; - } - }]); +},{"../internals/an-object":50,"../internals/descriptors":82,"../internals/export":86,"../internals/fails":87,"../internals/object-define-property":135,"../internals/to-primitive":181}],290:[function(require,module,exports){ +var $ = require('../internals/export'); +var anObject = require('../internals/an-object'); +var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; - return GroupBuilder; -}(); +// `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]; + } +}); -module.exports = GroupBuilder; -},{"./group":159}],161:[function(require,module,exports){ -'use strict'; +},{"../internals/an-object":50,"../internals/export":86,"../internals/object-get-own-property-descriptor":136}],291:[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'); -var CucumberExpression = require('./cucumber_expression'); -var RegularExpression = require('./regular_expression'); -var CucumberExpressionGenerator = require('./cucumber_expression_generator'); -var ParameterTypeRegistry = require('./parameter_type_registry'); -var ParameterType = require('./parameter_type'); +// `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); + } +}); -module.exports = { - CucumberExpression: CucumberExpression, - RegularExpression: RegularExpression, - CucumberExpressionGenerator: CucumberExpressionGenerator, - ParameterTypeRegistry: ParameterTypeRegistry, - ParameterType: ParameterType -}; -},{"./cucumber_expression":155,"./cucumber_expression_generator":156,"./parameter_type":162,"./parameter_type_registry":164,"./regular_expression":165}],162:[function(require,module,exports){ -'use strict'; +},{"../internals/an-object":50,"../internals/descriptors":82,"../internals/export":86,"../internals/object-get-own-property-descriptor":136}],292:[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'); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +// `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)); + } +}); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +},{"../internals/an-object":50,"../internals/correct-prototype-getter":73,"../internals/export":86,"../internals/object-get-prototype-of":140}],293:[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); +} -var _require = require('./errors'), - CucumberExpressionError = _require.CucumberExpressionError; +$({ target: 'Reflect', stat: true }, { + get: get +}); -var ILLEGAL_PARAMETER_NAME_PATTERN = /([[\]()$.|?*+])/; -var UNESCAPE_PATTERN = function UNESCAPE_PATTERN() { - return (/(\\([[$.|?*+\]]))/g - ); -}; +},{"../internals/an-object":50,"../internals/export":86,"../internals/has":100,"../internals/is-object":114,"../internals/object-get-own-property-descriptor":136,"../internals/object-get-prototype-of":140}],294:[function(require,module,exports){ +var $ = require('../internals/export'); -var ParameterType = function () { - _createClass(ParameterType, null, [{ - key: 'compare', - value: function compare(pt1, pt2) { - if (pt1.preferForRegexpMatch && !pt2.preferForRegexpMatch) return -1; - if (pt2.preferForRegexpMatch && !pt1.preferForRegexpMatch) return 1; - return pt1.name.localeCompare(pt2.name); - } - }, { - key: 'checkParameterTypeName', - value: function checkParameterTypeName(typeName) { - var unescapedTypeName = typeName.replace(UNESCAPE_PATTERN(), '$2'); - var match = unescapedTypeName.match(ILLEGAL_PARAMETER_NAME_PATTERN); - if (match) throw new CucumberExpressionError('Illegal character \'' + match[1] + '\' in parameter name {' + unescapedTypeName + '}'); - } +// `Reflect.has` method +// https://tc39.github.io/ecma262/#sec-reflect.has +$({ target: 'Reflect', stat: true }, { + has: function has(target, propertyKey) { + return propertyKey in target; + } +}); - /** - * @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. - */ +},{"../internals/export":86}],295:[function(require,module,exports){ +var $ = require('../internals/export'); +var anObject = require('../internals/an-object'); - }]); +var objectIsExtensible = Object.isExtensible; - function ParameterType(name, regexps, type, transform, useForSnippets, preferForRegexpMatch) { - _classCallCheck(this, ParameterType); +// `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; + } +}); - if (transform === undefined) transform = function transform(s) { - return s; - }; - if (useForSnippets === undefined) useForSnippets = true; - if (preferForRegexpMatch === undefined) preferForRegexpMatch = false; +},{"../internals/an-object":50,"../internals/export":86}],296:[function(require,module,exports){ +var $ = require('../internals/export'); +var ownKeys = require('../internals/own-keys'); - if (name) ParameterType.checkParameterTypeName(name); +// `Reflect.ownKeys` method +// https://tc39.github.io/ecma262/#sec-reflect.ownkeys +$({ target: 'Reflect', stat: true }, { + ownKeys: ownKeys +}); - this._name = name; - this._regexps = stringArray(regexps); - this._type = type; - this._transform = transform; - this._useForSnippets = useForSnippets; - this._preferForRegexpMatch = preferForRegexpMatch; +},{"../internals/export":86,"../internals/own-keys":147}],297:[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; + } } +}); - _createClass(ParameterType, [{ - key: 'transform', - value: function transform(thisObj, groupValues) { - return this._transform.apply(thisObj, groupValues); - } - }, { - key: 'name', - get: function get() { - return this._name; - } - }, { - key: 'regexps', - get: function get() { - return this._regexps; - } - }, { - key: 'type', - get: function get() { - return this._type; - } - }, { - key: 'preferForRegexpMatch', - get: function get() { - return this._preferForRegexpMatch; - } - }, { - key: 'useForSnippets', - get: function get() { - return this._useForSnippets; +},{"../internals/an-object":50,"../internals/export":86,"../internals/freezing":93,"../internals/get-built-in":96}],298:[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; } - }]); + } +}); - return ParameterType; -}(); +},{"../internals/a-possible-prototype":46,"../internals/an-object":50,"../internals/export":86,"../internals/object-set-prototype-of":144}],299:[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); +} -function stringArray(regexps) { - var array = Array.isArray(regexps) ? regexps : [regexps]; - return array.map(function (r) { - return typeof r === 'string' ? r : regexpSource(r); +$({ target: 'Reflect', stat: true }, { + set: set +}); + +},{"../internals/an-object":50,"../internals/create-property-descriptor":76,"../internals/export":86,"../internals/has":100,"../internals/is-object":114,"../internals/object-define-property":135,"../internals/object-get-own-property-descriptor":136,"../internals/object-get-prototype-of":140}],300:[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":82,"../internals/fails":87,"../internals/global":99,"../internals/inherit-if-required":107,"../internals/is-forced":112,"../internals/is-regexp":116,"../internals/object-define-property":135,"../internals/object-get-own-property-names":138,"../internals/redefine":155,"../internals/regexp-flags":158,"../internals/set-species":162,"../internals/well-known-symbol":188}],301:[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":86,"../internals/regexp-exec":157}],302:[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 }); } -function regexpSource(regexp) { - var flags = regexpFlags(regexp); +},{"../internals/descriptors":82,"../internals/object-define-property":135,"../internals/regexp-flags":158}],303:[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 _arr = ['g', 'i', 'm', 'y']; - for (var _i = 0; _i < _arr.length; _i++) { - var flag = _arr[_i]; - if (flags.indexOf(flag) !== -1) throw new CucumberExpressionError('ParameterType Regexps can\'t use flag \'' + flag + '\''); - } - return regexp.source; +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 }); } -// Backport RegExp.flags for Node 4.x -// https://github.com/nodejs/node/issues/8390 -// -// For some strange reason this is not needed for -// `./mocha dist/test`, but it is needed for -// `./mocha dist/test/parameter_type_test.js` -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'; +},{"../internals/an-object":50,"../internals/fails":87,"../internals/redefine":155,"../internals/regexp-flags":158}],304:[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":70,"../internals/collection-strong":68}],305:[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); } - return flags; -} +}); -module.exports = ParameterType; -},{"./errors":157}],163:[function(require,module,exports){ +},{"../internals/create-html":74,"../internals/export":86,"../internals/forced-string-html-method":91}],306:[function(require,module,exports){ 'use strict'; +var $ = require('../internals/export'); +var createHTML = require('../internals/create-html'); +var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +// `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', '', ''); + } +}); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +},{"../internals/create-html":74,"../internals/export":86,"../internals/forced-string-html-method":91}],307:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var createHTML = require('../internals/create-html'); +var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); -var ParameterTypeMatcher = function () { - function ParameterTypeMatcher(parameter, regexp, text, matchPosition) { - _classCallCheck(this, ParameterTypeMatcher); +// `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', '', ''); + } +}); - this._parameterType = parameter; - this._treeRegexp = regexp; - this._text = text; - this._matchPosition = matchPosition || 0; +},{"../internals/create-html":74,"../internals/export":86,"../internals/forced-string-html-method":91}],308:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var createHTML = require('../internals/create-html'); +var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - var captureGroupRegexp = new RegExp('(' + regexp + ')'); - this._match = captureGroupRegexp.exec(text.slice(this._matchPosition)); +// `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', '', ''); } +}); - _createClass(ParameterTypeMatcher, [{ - key: 'advanceTo', - value: function advanceTo(newMatchPosition) { - return new ParameterTypeMatcher(this._parameterType, this._treeRegexp, this._text, newMatchPosition); - } - }, { - key: 'parameterType', - get: function get() { - return this._parameterType; - } - }, { - key: 'find', - get: function get() { - return this._match && this.group !== ''; - } - }, { - key: 'start', - get: function get() { - return this._matchPosition + this._match.index; - } - }, { - key: 'group', - get: function get() { - return this._match[0]; - } - }], [{ - key: 'compare', - value: function compare(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; - } - }]); +},{"../internals/create-html":74,"../internals/export":86,"../internals/forced-string-html-method":91}],309:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var codeAt = require('../internals/string-multibyte').codeAt; - return ParameterTypeMatcher; -}(); +// `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); + } +}); -module.exports = ParameterTypeMatcher; -},{}],164:[function(require,module,exports){ +},{"../internals/export":86,"../internals/string-multibyte":168}],310:[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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var nativeEndsWith = ''.endsWith; +var min = Math.min; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +// `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; + } +}); -var ParameterType = require('./parameter_type'); -var CucumberExpressionGenerator = require('./cucumber_expression_generator.js'); +},{"../internals/correct-is-regexp-logic":72,"../internals/export":86,"../internals/not-a-regexp":130,"../internals/require-object-coercible":159,"../internals/to-length":178}],311:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var createHTML = require('../internals/create-html'); +var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); -var _require = require('./errors'), - CucumberExpressionError = _require.CucumberExpressionError, - AmbiguousParameterTypeError = _require.AmbiguousParameterTypeError; +// `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', '', ''); + } +}); -var INTEGER_REGEXPS = [/-?\d+/, /\d+/]; -var FLOAT_REGEXP = /-?\d*\.\d+/; -var WORD_REGEXP = /\w+/; -var STRING_REGEXP = /"([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'/; +},{"../internals/create-html":74,"../internals/export":86,"../internals/forced-string-html-method":91}],312:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var createHTML = require('../internals/create-html'); +var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); -var ParameterTypeRegistry = function () { - function ParameterTypeRegistry() { - _classCallCheck(this, ParameterTypeRegistry); +// `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); + } +}); - this._parameterTypeByName = new Map(); - this._parameterTypesByRegexp = new Map(); +},{"../internals/create-html":74,"../internals/export":86,"../internals/forced-string-html-method":91}],313:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var createHTML = require('../internals/create-html'); +var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); - this.defineParameterType(new ParameterType('int', INTEGER_REGEXPS, Number, function (s) { - return s && parseInt(s); - }, true, true)); - this.defineParameterType(new ParameterType('float', FLOAT_REGEXP, Number, function (s) { - return s && parseFloat(s); - }, true, false)); - this.defineParameterType(new ParameterType('word', WORD_REGEXP, String, function (s) { - return s; - }, false, false)); - this.defineParameterType(new ParameterType('string', STRING_REGEXP, String, function (s) { - return s.replace(/\\"/g, '"').replace(/\\'/g, "'"); - }, true, false)); +// `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); } +}); - _createClass(ParameterTypeRegistry, [{ - key: 'lookupByTypeName', - value: function lookupByTypeName(typeName) { - return this._parameterTypeByName.get(typeName); - } - }, { - key: 'lookupByRegexp', - value: function lookupByRegexp(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(this).generateExpressions(text); - throw new AmbiguousParameterTypeError.forRegExp(parameterTypeRegexp, expressionRegexp, parameterTypes, generatedExpressions); - } - return parameterTypes[0]; - } - }, { - key: 'defineParameterType', - value: function defineParameterType(parameterType) { - if (parameterType.name) { - if (this._parameterTypeByName.has(parameterType.name)) throw new Error('There is already a parameter type with name ' + parameterType.name); - this._parameterTypeByName.set(parameterType.name, parameterType); - } +},{"../internals/create-html":74,"../internals/export":86,"../internals/forced-string-html-method":91}],314:[function(require,module,exports){ +var $ = require('../internals/export'); +var toAbsoluteIndex = require('../internals/to-absolute-index'); - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; +var fromCharCode = String.fromCharCode; +var nativeFromCodePoint = String.fromCodePoint; - try { - for (var _iterator = parameterType.regexps[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var parameterTypeRegexp = _step.value; +// length should be 1, old FF problem +var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1; - 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 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.compare)); - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } +// `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":86,"../internals/to-absolute-index":174}],315:[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":72,"../internals/export":86,"../internals/not-a-regexp":130,"../internals/require-object-coercible":159}],316:[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":74,"../internals/export":86,"../internals/forced-string-html-method":91}],317:[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":80,"../internals/internal-state":109,"../internals/string-multibyte":168}],318:[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":74,"../internals/export":86,"../internals/forced-string-html-method":91}],319:[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; } - }, { - key: 'parameterTypes', - get: function get() { - return this._parameterTypeByName.values(); - } - }]); + ]; +}); - return ParameterTypeRegistry; -}(); +},{"../internals/advance-string-index":48,"../internals/an-object":50,"../internals/fix-regexp-well-known-symbol-logic":88,"../internals/regexp-exec-abstract":156,"../internals/require-object-coercible":159,"../internals/to-length":178}],320:[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'); -module.exports = ParameterTypeRegistry; -},{"./cucumber_expression_generator.js":156,"./errors":157,"./parameter_type":162}],165:[function(require,module,exports){ +// `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":86,"../internals/string-pad":169,"../internals/webkit-string-pad-bug":187}],321:[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'); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +// `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); + } +}); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +},{"../internals/export":86,"../internals/string-pad":169,"../internals/webkit-string-pad-bug":187}],322:[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(''); + } +}); -var Argument = require('./argument'); -var TreeRegexp = require('./tree_regexp'); -var ParameterType = require('./parameter_type'); +},{"../internals/export":86,"../internals/to-indexed-object":176,"../internals/to-length":178}],323:[function(require,module,exports){ +var $ = require('../internals/export'); +var repeat = require('../internals/string-repeat'); -var RegularExpression = function () { - function RegularExpression(expressionRegexp, parameterTypeRegistry) { - _classCallCheck(this, RegularExpression); +// `String.prototype.repeat` method +// https://tc39.github.io/ecma262/#sec-string.prototype.repeat +$({ target: 'String', proto: true }, { + repeat: repeat +}); - this._expressionRegexp = expressionRegexp; - this._parameterTypeRegistry = parameterTypeRegistry; - this._treeRegexp = new TreeRegexp(expressionRegexp); - } +},{"../internals/export":86,"../internals/string-repeat":170}],324:[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'); - _createClass(RegularExpression, [{ - key: 'match', - value: function match(text) { - var _this = this; +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); +}; - var parameterTypes = this._treeRegexp.groupBuilder.children.map(function (groupBuilder) { - var parameterTypeRegexp = groupBuilder.source; +// @@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; - return _this._parameterTypeRegistry.lookupByRegexp(parameterTypeRegexp, _this._treeRegexp, text) || new ParameterType(null, parameterTypeRegexp, String, function (s) { - return s; - }, false, false); - }); + var rx = anObject(regexp); + var S = String(this); - return Argument.build(this._treeRegexp, text, parameterTypes); - } - }, { - key: 'regexp', - get: function get() { - return this._expressionRegexp; - } - }, { - key: 'source', - get: function get() { - return this._expressionRegexp.source; + 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); } - }]); + ]; - return RegularExpression; -}(); + // 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; + }); + } +}); -module.exports = RegularExpression; -},{"./argument":153,"./parameter_type":162,"./tree_regexp":166}],166:[function(require,module,exports){ +},{"../internals/advance-string-index":48,"../internals/an-object":50,"../internals/fix-regexp-well-known-symbol-logic":88,"../internals/regexp-exec-abstract":156,"../internals/require-object-coercible":159,"../internals/to-integer":177,"../internals/to-length":178,"../internals/to-object":179}],325:[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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + var rx = anObject(regexp); + var S = String(this); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + 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; + } + ]; +}); -var Regex = require('becke-ch--regex--s0-0-v1--base--pl--lib'); -var GroupBuilder = require('./group_builder'); +},{"../internals/an-object":50,"../internals/fix-regexp-well-known-symbol-logic":88,"../internals/regexp-exec-abstract":156,"../internals/require-object-coercible":159,"../internals/same-value":160}],326:[function(require,module,exports){ +'use strict'; +var $ = require('../internals/export'); +var createHTML = require('../internals/create-html'); +var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); -var TreeRegexp = function () { - function TreeRegexp(regexp) { - var _this = this; +// `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', '', ''); + } +}); - _classCallCheck(this, TreeRegexp); - - this._re = 'string' === typeof regexp ? new RegExp(regexp) : regexp; - this._regex = new Regex(this._re.source, this._re.flags); - - var stack = [new GroupBuilder()]; - var groupStartStack = []; - var last = null; - var escaping = false; - var nonCapturingMaybe = false; - this._re.source.split('').forEach(function (c, n) { - if (c === '(' && !escaping) { - stack.push(new GroupBuilder()); - groupStartStack.push(n + 1); - nonCapturingMaybe = false; - } else if (c === ')' && !escaping) { - var gb = stack.pop(); - var groupStart = groupStartStack.pop(); - if (gb.capturing) { - gb.source = _this._re.source.substring(groupStart, n); - stack[stack.length - 1].add(gb); - } else { - gb.moveChildrenTo(stack[stack.length - 1]); +},{"../internals/create-html":74,"../internals/export":86,"../internals/forced-string-html-method":91}],327:[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; } - nonCapturingMaybe = false; - } else if (c === '?' && last === '(') { - nonCapturingMaybe = true; - } else if (c === ':' && nonCapturingMaybe) { - stack[stack.length - 1].setNonCapturing(); - nonCapturingMaybe = false; + if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop } - escaping = c === '\\' && !escaping; - last = c; + 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":48,"../internals/an-object":50,"../internals/fails":87,"../internals/fix-regexp-well-known-symbol-logic":88,"../internals/is-regexp":116,"../internals/regexp-exec":157,"../internals/regexp-exec-abstract":156,"../internals/require-object-coercible":159,"../internals/species-constructor":167,"../internals/to-length":178}],328:[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":72,"../internals/export":86,"../internals/not-a-regexp":130,"../internals/require-object-coercible":159,"../internals/to-length":178}],329:[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":74,"../internals/export":86,"../internals/forced-string-html-method":91}],330:[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":74,"../internals/export":86,"../internals/forced-string-html-method":91}],331:[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":74,"../internals/export":86,"../internals/forced-string-html-method":91}],332:[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":86,"../internals/forced-string-trim-method":92,"../internals/string-trim":171}],333:[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":86,"../internals/forced-string-trim-method":92,"../internals/string-trim":171}],334:[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":86,"../internals/forced-string-trim-method":92,"../internals/string-trim":171}],335:[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":81}],336:[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":71,"../internals/descriptors":82,"../internals/export":86,"../internals/global":99,"../internals/has":100,"../internals/is-object":114,"../internals/object-define-property":135}],337:[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":81}],338:[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":81}],339:[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":81}],340:[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":50,"../internals/array-iteration":58,"../internals/create-property-descriptor":76,"../internals/define-well-known-symbol":81,"../internals/descriptors":82,"../internals/export":86,"../internals/fails":87,"../internals/global":99,"../internals/has":100,"../internals/hidden-keys":101,"../internals/hide":102,"../internals/internal-state":109,"../internals/is-array":111,"../internals/is-object":114,"../internals/is-pure":115,"../internals/native-symbol":126,"../internals/object-create":133,"../internals/object-define-property":135,"../internals/object-get-own-property-descriptor":136,"../internals/object-get-own-property-names":138,"../internals/object-get-own-property-names-external":137,"../internals/object-get-own-property-symbols":139,"../internals/object-keys":142,"../internals/object-property-is-enumerable":143,"../internals/redefine":155,"../internals/set-to-string-tag":163,"../internals/shared":165,"../internals/shared-key":164,"../internals/to-indexed-object":176,"../internals/to-object":179,"../internals/to-primitive":181,"../internals/uid":185,"../internals/well-known-symbol":188,"../internals/wrapped-well-known-symbol":190}],341:[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":81}],342:[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":81}],343:[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":81}],344:[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":81}],345:[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":81}],346:[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":81}],347:[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":81}],348:[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":81}],349:[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":51,"../internals/array-copy-within":53}],350:[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":51,"../internals/array-iteration":58}],351:[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":51,"../internals/array-fill":54}],352:[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":51,"../internals/array-iteration":58,"../internals/species-constructor":167}],353:[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":51,"../internals/array-iteration":58}],354:[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":51,"../internals/array-iteration":58}],355:[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":182}],356:[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":182}],357:[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":51,"../internals/array-iteration":58}],358:[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":51,"../internals/typed-array-from":183,"../internals/typed-arrays-constructors-requires-wrappers":184}],359:[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":51,"../internals/array-includes":57}],360:[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":51,"../internals/array-includes":57}],361:[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":182}],362:[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":182}],363:[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":182}],364:[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":51,"../internals/global":99,"../internals/well-known-symbol":188,"../modules/es.array.iterator":207}],365:[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":51}],366:[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":51,"../internals/array-last-index-of":59}],367:[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":51,"../internals/array-iteration":58,"../internals/species-constructor":167}],368:[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":51,"../internals/typed-arrays-constructors-requires-wrappers":184}],369:[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":51,"../internals/array-reduce":61}],370:[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":51,"../internals/array-reduce":61}],371:[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":51}],372:[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":51,"../internals/fails":87,"../internals/to-length":178,"../internals/to-object":179,"../internals/to-offset":180}],373:[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":51,"../internals/fails":87,"../internals/species-constructor":167}],374:[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":51,"../internals/array-iteration":58}],375:[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":51}],376:[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":51,"../internals/species-constructor":167,"../internals/to-absolute-index":174,"../internals/to-length":178}],377:[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":51,"../internals/fails":87,"../internals/global":99}],378:[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":51,"../internals/fails":87,"../internals/global":99}],379:[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":182}],380:[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":182}],381:[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":182}],382:[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":182}],383:[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":70,"../internals/collection-weak":69,"../internals/global":99,"../internals/internal-metadata":108,"../internals/internal-state":109,"../internals/is-object":114,"../internals/native-weak-map":128,"../internals/redefine-all":154}],384:[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":70,"../internals/collection-weak":69}],385:[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":55,"../internals/dom-iterables":84,"../internals/global":99,"../internals/hide":102}],386:[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":84,"../internals/global":99,"../internals/hide":102,"../internals/well-known-symbol":188,"../modules/es.array.iterator":207}],387:[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":86,"../internals/global":99,"../internals/task":172}],388:[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":66,"../internals/export":86,"../internals/global":99,"../internals/microtask":124}],389:[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":49,"../internals/an-object":50,"../internals/bind-context":63,"../internals/create-iterator-constructor":75,"../internals/export":86,"../internals/get-iterator":98,"../internals/get-iterator-method":97,"../internals/has":100,"../internals/internal-state":109,"../internals/is-object":114,"../internals/native-url":127,"../internals/redefine":155,"../internals/redefine-all":154,"../internals/set-to-string-tag":163,"../internals/well-known-symbol":188,"../modules/es.array.iterator":207}],390:[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":49,"../internals/array-from":56,"../internals/descriptors":82,"../internals/export":86,"../internals/global":99,"../internals/has":100,"../internals/internal-state":109,"../internals/native-url":127,"../internals/object-assign":132,"../internals/object-define-properties":134,"../internals/punycode-to-ascii":153,"../internals/redefine":155,"../internals/set-to-string-tag":163,"../internals/string-multibyte":168,"../modules/es.string.iterator":317,"../modules/web.url-search-params":389}],391:[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":86}],392:[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":475}],393:[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); + }; + return Argument; +}()); +exports.default = Argument; +module.exports = Argument; + +},{"./Errors":397}],394:[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":398}],395:[function(require,module,exports){ +"use strict"; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +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":393,"./Errors":397,"./ParameterType":401,"./TreeRegexp":405}],396:[function(require,module,exports){ +"use strict"; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +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":394,"./ParameterType":401,"./ParameterTypeMatcher":402,"util":560}],397:[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; + +},{}],398:[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":560}],399:[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) + .map(function (g) { return g.value; }) + .filter(function (v) { return v !== null; }); + }, + enumerable: true, + configurable: true + }); + return Group; +}()); +exports.default = Group; + +},{}],400:[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":399}],401:[function(require,module,exports){ +"use strict"; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +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) { + var result = this.transformFn.apply(thisObj, groupValues); + return result; + }; + 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":397}],402:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +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 !== ''; + }, + 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, "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; + +},{}],403:[function(require,module,exports){ +"use strict"; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +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 INTEGER_REGEXPS = [/-?\d+/, /\d+/]; +var FLOAT_REGEXP = /-?\d*\.?\d+/; +var WORD_REGEXP = /[^\s]+/; +var STRING_REGEXP = /"([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'/; +var ANONYMOUS_REGEXP = /.*/; +var ParameterTypeRegistry = /** @class */ (function () { + function ParameterTypeRegistry() { + this.parameterTypeByName = new Map(); + this.parameterTypesByRegexp = new Map(); + this.defineParameterType(new ParameterType_1.default('int', INTEGER_REGEXPS, Number, function (s) { return (s === undefined ? null : Number(s)); }, true, true)); + this.defineParameterType(new ParameterType_1.default('float', FLOAT_REGEXP, Number, function (s) { return (s === undefined ? null : parseFloat(s)); }, true, false)); + this.defineParameterType(new ParameterType_1.default('word', WORD_REGEXP, String, function (s) { return s; }, false, false)); + this.defineParameterType(new ParameterType_1.default('string', STRING_REGEXP, String, function (s) { return s.replace(/\\"/g, '"').replace(/\\'/g, "'"); }, true, false)); + this.defineParameterType(new ParameterType_1.default('', 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; } + } + }; + return ParameterTypeRegistry; +}()); +exports.default = ParameterTypeRegistry; +module.exports = ParameterTypeRegistry; + +},{"./CucumberExpressionGenerator":396,"./Errors":397,"./ParameterType":401}],404:[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 }); - this._groupBuilder = stack.pop(); - } + return RegularExpression; +}()); +exports.default = RegularExpression; - _createClass(TreeRegexp, [{ - key: 'match', - value: function match(s) { - var match = this._regex.exec(s); - if (!match) return null; - var groupIndex = 0; - var nextGroupIndex = function nextGroupIndex() { - return groupIndex++; - }; - return this._groupBuilder.build(match, nextGroupIndex); - } - }, { - key: 'regexp', - get: function get() { - return this._re; - } - }, { - key: 'groupBuilder', - get: function get() { - return this._groupBuilder; +},{"./Argument":393,"./ParameterType":401,"./TreeRegexp":405}],405:[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 === ':' && nonCapturingMaybe) { + stack[stack.length - 1].setNonCapturing(); + nonCapturingMaybe = false; + } + escaping = c === '\\' && !escaping; + last = c; + }); + this.groupBuilder = stack.pop(); } - }]); - - return TreeRegexp; -}(); + 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; -module.exports = TreeRegexp; -},{"./group_builder":160,"becke-ch--regex--s0-0-v1--base--pl--lib":17}],167:[function(require,module,exports){ +},{"./GroupBuilder":400,"becke-ch--regex--s0-0-v1--base--pl--lib":20}],406:[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 = { - TagExpressionParser: require('./lib/tag_expression_parser') + CucumberExpression: CucumberExpression_1.default, + RegularExpression: RegularExpression_1.default, + CucumberExpressionGenerator: CucumberExpressionGenerator_1.default, + ParameterTypeRegistry: ParameterTypeRegistry_1.default, + ParameterType: ParameterType_1.default, }; -},{"./lib/tag_expression_parser":168}],168:[function(require,module,exports){ -const OPERAND = 'operand' -const OPERATOR = 'operator' - -module.exports = function TagExpressionParser() { - /** - * 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 - */ - this.parse = function(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) - } - - var ASSOC = { - or: 'left', - and: 'left', - not: 'right', - } - - var PREC = { +},{"./CucumberExpression":395,"./CucumberExpressionGenerator":396,"./ParameterType":401,"./ParameterTypeRegistry":403,"./RegularExpression":404}],407:[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, - } - - function tokenize(expr) { - var tokens = [] - var isEscaped = false - var token = undefined +}; +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 { - switch (c) { - case '(': - case ')': - if (!isEscaped) { + 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 + // end of token + tokens.push(token.join('')); + token = undefined; } - tokens.push(c) - break - } - default: - token = token ? token : [] // start of token - token.push(c) - break - } + } + 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; } - isEscaped = false - } } if (token) { - tokens.push(token.join('')) + 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) { + 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) + 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)) - } - } - - function Literal(value) { - this.evaluate = function(variables) { - return variables.indexOf(value) !== -1 +} +function peek(stack) { + return stack[stack.length - 1]; +} +function pop(stack) { + if (stack.length === 0) { + throw new Error('empty stack'); } - - this.toString = function() { - return value.replace(/\(/g, '\\(').replace(/\)/g, '\\)') + return stack.pop(); +} +function pushExpr(token, stack) { + if (token === 'and') { + var rightAndExpr = pop(stack); + stack.push(new And(pop(stack), rightAndExpr)); } - } - - function Or(leftExpr, rightExpr) { - this.evaluate = function(variables) { - return leftExpr.evaluate(variables) || rightExpr.evaluate(variables) + else if (token === 'or') { + var rightOrExpr = pop(stack); + stack.push(new Or(pop(stack), rightOrExpr)); } - - this.toString = function() { - return '( ' + leftExpr.toString() + ' or ' + rightExpr.toString() + ' )' + else if (token === 'not') { + stack.push(new Not(pop(stack))); } - } - - function And(leftExpr, rightExpr) { - this.evaluate = function(variables) { - return leftExpr.evaluate(variables) && rightExpr.evaluate(variables) + else { + stack.push(new Literal(token)); } - - this.toString = function() { - return '( ' + leftExpr.toString() + ' and ' + rightExpr.toString() + ' )' +} +var Literal = /** @class */ (function () { + function Literal(value) { + this.value = value; } - } - - function Not(expr) { - this.evaluate = function(variables) { - return !expr.evaluate(variables) + 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; } - - this.toString = function() { - return 'not ( ' + expr.toString() + ' )' + 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; } - } - - function True() { - this.evaluate = function() { - return true + 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; } - - this.toString = function() { - return 'true' + 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() { } - } -} - -},{}],169:[function(require,module,exports){ -'use strict'; + True.prototype.evaluate = function (variables) { + return true; + }; + True.prototype.toString = function () { + return 'true'; + }; + return True; +}()); -var assign = require('es5-ext/object/assign') - , normalizeOpts = require('es5-ext/object/normalize-options') - , isCallable = require('es5-ext/object/is-callable') - , contains = require('es5-ext/string/#/contains') +},{}],408:[function(require,module,exports){ +"use strict"; - , d; +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"); -d = module.exports = function (dscr, value/*, options*/) { +var d = (module.exports = function (dscr, value/*, options*/) { var c, e, w, options, desc; - if ((arguments.length < 2) || (typeof dscr !== 'string')) { + if (arguments.length < 2 || typeof dscr !== "string") { options = value; value = dscr; dscr = null; } else { options = arguments[2]; } - if (dscr == null) { + if (isValue(dscr)) { + c = contains.call(dscr, "c"); + e = contains.call(dscr, "e"); + w = contains.call(dscr, "w"); + } else { c = w = true; e = false; - } else { - c = contains.call(dscr, 'c'); - e = contains.call(dscr, 'e'); - w = contains.call(dscr, 'w'); } 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') { + if (typeof dscr !== "string") { options = set; set = get; get = dscr; @@ -18600,30 +26601,30 @@ d.gs = function (dscr, get, set/*, options*/) { } else { options = arguments[3]; } - if (get == null) { + if (!isValue(get)) { get = undefined; - } else if (!isCallable(get)) { + } else if (!isPlainFunction(get)) { options = get; get = set = undefined; - } else if (set == null) { + } else if (!isValue(set)) { set = undefined; - } else if (!isCallable(set)) { + } else if (!isPlainFunction(set)) { options = set; set = undefined; } - if (dscr == null) { + if (isValue(dscr)) { + c = contains.call(dscr, "c"); + e = contains.call(dscr, "e"); + } else { c = true; e = false; - } else { - c = contains.call(dscr, 'c'); - e = contains.call(dscr, 'e'); } desc = { get: get, set: set, configurable: c, enumerable: e }; return !options ? desc : assign(normalizeOpts(options), desc); }; -},{"es5-ext/object/assign":195,"es5-ext/object/is-callable":198,"es5-ext/object/normalize-options":203,"es5-ext/string/#/contains":205}],170:[function(require,module,exports){ +},{"es5-ext/object/assign":425,"es5-ext/object/normalize-options":433,"es5-ext/string/#/contains":435,"type/plain-function/is":552,"type/value/is":554}],409:[function(require,module,exports){ "use strict"; var d = require("d") @@ -18674,21 +26675,29 @@ Duration = module.exports = function (from, to) { }; Duration.prototype = Object.create(Object.prototype, { - valueOf: d(toPrimitive = function () { return this.to - this.from; }), + 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), x = copy.call(data.to); - x.setMonth(x.getMonth() - 1); - x = daysInMonth.call(x); - return ( - data.sign * - (((x - data.from.getDate() + data.to.getDate()) % x) - - (data.from - dfloor.call(copy.call(data.from)) > - data.to - dfloor.call(copy.call(data.to)))) - ); + 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); @@ -18700,7 +26709,7 @@ Duration.prototype = Object.create(Object.prototype, { ); }), year: d.gs( - getYear = function () { + (getYear = function () { var data = getCalcData(this); return ( data.sign * @@ -18709,7 +26718,7 @@ Duration.prototype = Object.create(Object.prototype, { (data.from - yfloor.call(copy.call(data.from)) > data.to - yfloor.call(copy.call(data.to)))) ); - } + }) ), milliseconds: d.gs(toPrimitive, null), @@ -18736,15 +26745,17 @@ Duration.prototype = Object.create(Object.prototype, { }), _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 (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; + 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 (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; @@ -18759,24 +26770,24 @@ Duration.prototype = Object.create(Object.prototype, { s; } if (!this.hours && threshold < 0) return this._resolveSign(isNonZero) + s; - if (threshold-- <= 0) s = pad.call(abs(isNonZero = this.hour), 2) + (s ? ":" : "") + 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 (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 (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 (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 (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 (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 (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"); + tokens.unshift(abs((isNonZero = this.year)) + "y"); return this._resolveSign(isNonZero) + tokens.join(" "); }), toString: d(function (pattern/*, threshold*/) { @@ -18790,280 +26801,7 @@ Duration.prototype = Object.create(Object.prototype, { }) }); -},{"d":169,"es5-ext/date/#/copy":171,"es5-ext/date/#/days-in-month":172,"es5-ext/date/#/floor-day":173,"es5-ext/date/#/floor-month":174,"es5-ext/date/#/floor-year":175,"es5-ext/date/valid-date":177,"es5-ext/number/#/pad":182,"es5-ext/number/to-integer":183,"es5-ext/number/to-pos-integer":184,"es5-ext/object/is-value":186,"es5-ext/string/format-method":192}],171:[function(require,module,exports){ -"use strict"; - -var getTime = Date.prototype.getTime; - -module.exports = function () { - return new Date(getTime.call(this)); -}; - -},{}],172:[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; - } -}; - -},{}],173:[function(require,module,exports){ -"use strict"; - -var setHours = Date.prototype.setHours; - -module.exports = function () { - setHours.call(this, 0, 0, 0, 0); - return this; -}; - -},{}],174:[function(require,module,exports){ -"use strict"; - -var floorDay = require("./floor-day"); - -module.exports = function () { - floorDay.call(this).setDate(1); - return this; -}; - -},{"./floor-day":173}],175:[function(require,module,exports){ -"use strict"; - -var floorMonth = require("./floor-month"); - -module.exports = function () { - floorMonth.call(this).setMonth(0); - return this; -}; - -},{"./floor-month":174}],176:[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 - ); -}; - -},{}],177:[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":176}],178:[function(require,module,exports){ -"use strict"; - -// eslint-disable-next-line no-empty-function -module.exports = function () {}; - -},{}],179:[function(require,module,exports){ -"use strict"; - -module.exports = require("./is-implemented")() - ? Math.sign - : require("./shim"); - -},{"./is-implemented":180,"./shim":181}],180:[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); -}; - -},{}],181:[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; -}; - -},{}],182:[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":188,"../to-pos-integer":184}],183:[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":179}],184:[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":183}],185:[function(require,module,exports){ -// Deprecated - -"use strict"; - -module.exports = function (obj) { - return typeof obj === "function"; -}; - -},{}],186:[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":178}],187:[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":186}],188:[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":183,"../../object/valid-value":187,"./repeat":189}],189:[function(require,module,exports){ -"use strict"; - -module.exports = require("./is-implemented")() - ? String.prototype.repeat - : require("./shim"); - -},{"./is-implemented":190,"./shim":191}],190:[function(require,module,exports){ -"use strict"; - -var str = "foo"; - -module.exports = function () { - if (typeof str.repeat !== "function") return false; - return str.repeat(2) === "foofoo"; -}; - -},{}],191:[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":183,"../../../object/valid-value":187}],192:[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":185,"../object/valid-value":187}],193:[function(require,module,exports){ +},{"d":408,"es5-ext/date/#/copy":411,"es5-ext/date/#/days-in-month":412,"es5-ext/date/#/floor-day":413,"es5-ext/date/#/floor-month":414,"es5-ext/date/#/floor-year":415,"es5-ext/date/valid-date":417,"es5-ext/number/#/pad":422,"es5-ext/number/to-integer":423,"es5-ext/number/to-pos-integer":424,"es5-ext/object/is-value":429,"es5-ext/string/format-method":442}],410:[function(require,module,exports){ (function(root, factory) { 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers. @@ -19124,8 +26862,18 @@ module.exports = function (fmap) { // Throw away eval information until we implement stacktrace.js/stackframe#8 line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, ''); } - var tokens = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').split(/\s+/).slice(1); - var locationParts = this.extractLocation(tokens.pop()); + 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]; @@ -19156,9 +26904,10 @@ module.exports = function (fmap) { functionName: line }); } else { - var tokens = line.split('@'); - var locationParts = this.extractLocation(tokens.pop()); - var functionName = tokens.join('@') || undefined; + 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, @@ -19256,16 +27005,159 @@ module.exports = function (fmap) { }; })); -},{"stackframe":301}],194:[function(require,module,exports){ -arguments[4][178][0].apply(exports,arguments) -},{"dup":178}],195:[function(require,module,exports){ +},{"stackframe":531}],411:[function(require,module,exports){ +"use strict"; + +var getTime = Date.prototype.getTime; + +module.exports = function () { return new Date(getTime.call(this)); }; + +},{}],412:[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; + } +}; + +},{}],413:[function(require,module,exports){ +"use strict"; + +var setHours = Date.prototype.setHours; + +module.exports = function () { + setHours.call(this, 0, 0, 0, 0); + return this; +}; + +},{}],414:[function(require,module,exports){ +"use strict"; + +var floorDay = require("./floor-day"); + +module.exports = function () { + floorDay.call(this).setDate(1); + return this; +}; + +},{"./floor-day":413}],415:[function(require,module,exports){ +"use strict"; + +var floorMonth = require("./floor-month"); + +module.exports = function () { + floorMonth.call(this).setMonth(0); + return this; +}; + +},{"./floor-month":414}],416:[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 + ); +}; + +},{}],417:[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":416}],418:[function(require,module,exports){ +"use strict"; + +// eslint-disable-next-line no-empty-function +module.exports = function () {}; + +},{}],419:[function(require,module,exports){ +"use strict"; + +module.exports = require("./is-implemented")() ? Math.sign : require("./shim"); + +},{"./is-implemented":420,"./shim":421}],420:[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; +}; + +},{}],421:[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; +}; + +},{}],422:[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":438,"../to-pos-integer":424}],423:[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":419}],424:[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":423}],425:[function(require,module,exports){ "use strict"; -module.exports = require("./is-implemented")() - ? Object.assign - : require("./shim"); +module.exports = require("./is-implemented")() ? Object.assign : require("./shim"); -},{"./is-implemented":196,"./shim":197}],196:[function(require,module,exports){ +},{"./is-implemented":426,"./shim":427}],426:[function(require,module,exports){ "use strict"; module.exports = function () { @@ -19273,17 +27165,17 @@ module.exports = function () { if (typeof assign !== "function") return false; obj = { foo: "raz" }; assign(obj, { bar: "dwa" }, { trzy: "trzy" }); - return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy"; + return obj.foo + obj.bar + obj.trzy === "razdwatrzy"; }; -},{}],197:[function(require,module,exports){ +},{}],427:[function(require,module,exports){ "use strict"; var keys = require("../keys") , value = require("../valid-value") , max = Math.max; -module.exports = function (dest, src /*, …srcn*/) { +module.exports = function (dest, src/*, …srcn*/) { var error, i, length = max(arguments.length, 2), assign; dest = Object(value(dest)); assign = function (key) { @@ -19301,18 +27193,26 @@ module.exports = function (dest, src /*, …srcn*/) { return dest; }; -},{"../keys":200,"../valid-value":204}],198:[function(require,module,exports){ -arguments[4][185][0].apply(exports,arguments) -},{"dup":185}],199:[function(require,module,exports){ -arguments[4][186][0].apply(exports,arguments) -},{"../function/noop":194,"dup":186}],200:[function(require,module,exports){ +},{"../keys":430,"../valid-value":434}],428:[function(require,module,exports){ +// Deprecated + +"use strict"; + +module.exports = function (obj) { return typeof obj === "function"; }; + +},{}],429:[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":418}],430:[function(require,module,exports){ "use strict"; -module.exports = require("./is-implemented")() - ? Object.keys - : require("./shim"); +module.exports = require("./is-implemented")() ? Object.keys : require("./shim"); -},{"./is-implemented":201,"./shim":202}],201:[function(require,module,exports){ +},{"./is-implemented":431,"./shim":432}],431:[function(require,module,exports){ "use strict"; module.exports = function () { @@ -19320,22 +27220,20 @@ module.exports = function () { Object.keys("primitive"); return true; } catch (e) { - return false; -} + return false; + } }; -},{}],202:[function(require,module,exports){ +},{}],432:[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); -}; +module.exports = function (object) { return keys(isValue(object) ? Object(object) : object); }; -},{"../is-value":199}],203:[function(require,module,exports){ +},{"../is-value":429}],433:[function(require,module,exports){ "use strict"; var isValue = require("./is-value"); @@ -19348,7 +27246,7 @@ var process = function (src, obj) { }; // eslint-disable-next-line no-unused-vars -module.exports = function (opts1 /*, …options*/) { +module.exports = function (opts1/*, …options*/) { var result = create(null); forEach.call(arguments, function (options) { if (!isValue(options)) return; @@ -19357,26 +27255,32 @@ module.exports = function (opts1 /*, …options*/) { return result; }; -},{"./is-value":199}],204:[function(require,module,exports){ -arguments[4][187][0].apply(exports,arguments) -},{"./is-value":199,"dup":187}],205:[function(require,module,exports){ +},{"./is-value":429}],434:[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":429}],435:[function(require,module,exports){ "use strict"; -module.exports = require("./is-implemented")() - ? String.prototype.contains - : require("./shim"); +module.exports = require("./is-implemented")() ? String.prototype.contains : require("./shim"); -},{"./is-implemented":206,"./shim":207}],206:[function(require,module,exports){ +},{"./is-implemented":436,"./shim":437}],436:[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); + return str.contains("dwa") === true && str.contains("foo") === false; }; -},{}],207:[function(require,module,exports){ +},{}],437:[function(require,module,exports){ "use strict"; var indexOf = String.prototype.indexOf; @@ -19385,20 +27289,108 @@ module.exports = function (searchString/*, position*/) { return indexOf.call(this, searchString, arguments[1]) > -1; }; -},{}],208:[function(require,module,exports){ +},{}],438:[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":423,"../../object/valid-value":434,"./repeat":439}],439:[function(require,module,exports){ +"use strict"; + +module.exports = require("./is-implemented")() ? String.prototype.repeat : require("./shim"); + +},{"./is-implemented":440,"./shim":441}],440:[function(require,module,exports){ +"use strict"; + +var str = "foo"; + +module.exports = function () { + if (typeof str.repeat !== "function") return false; + return str.repeat(2) === "foofoo"; +}; + +},{}],441:[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":423,"../../../object/valid-value":434}],442:[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":428,"../object/valid-value":434}],443:[function(require,module,exports){ 'use strict'; -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; +const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g; -module.exports = function (str) { - if (typeof str !== 'string') { +module.exports = string => { + if (typeof string !== 'string') { throw new TypeError('Expected a string'); } - return str.replace(matchOperatorsRe, '\\$&'); + return string.replace(matchOperatorsRegex, '\\$&'); }; -},{}],209:[function(require,module,exports){ +},{}],444:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -19923,7 +27915,7 @@ function functionBindPolyfill(context) { }; } -},{}],210:[function(require,module,exports){ +},{}],445:[function(require,module,exports){ (function (process){ /* * extsprintf.js: extended POSIX-style sprintf @@ -20152,12 +28144,13 @@ function dumpException(ex) } }).call(this,require('_process')) -},{"_process":265,"assert":5,"util":324}],211:[function(require,module,exports){ + +},{"_process":497,"assert":5,"util":560}],446:[function(require,module,exports){ (function (process){ 'use strict'; const escapeStringRegexp = require('escape-string-regexp'); -const platform = process.platform; +const {platform} = process; const main = { tick: '✔', @@ -20218,7 +28211,7 @@ const main = { sevenEighths: '⅞' }; -const win = { +const windows = { tick: '√', cross: '×', star: '*', @@ -20278,32 +28271,46 @@ const win = { }; if (platform === 'linux') { - // the main one doesn't look that good on Ubuntu + // The main one doesn't look that good on Ubuntu main.questionMarkPrefix = '?'; } -const figures = platform === 'win32' ? win : main; +const figures = platform === 'win32' ? windows : main; -const fn = str => { +const fn = string => { if (figures === main) { - return str; + return string; } - Object.keys(main).forEach(key => { - if (main[key] === figures[key]) { - return; + for (const [key, value] of Object.entries(main)) { + if (value === figures[key]) { + continue; } - str = str.replace(new RegExp(escapeStringRegexp(main[key]), 'g'), figures[key]); - }); + string = string.replace(new RegExp(escapeStringRegexp(value), 'g'), figures[key]); + } - return str; + return string; }; module.exports = Object.assign(fn, figures); }).call(this,require('_process')) -},{"_process":265,"escape-string-regexp":208}],212:[function(require,module,exports){ + +},{"_process":497,"escape-string-regexp":447}],447:[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, '\\$&'); +}; + +},{}],448:[function(require,module,exports){ (function (process){ module.exports = realpath realpath.realpath = realpath @@ -20373,7 +28380,8 @@ function unmonkeypatch () { } }).call(this,require('_process')) -},{"./old.js":213,"_process":265,"fs":21}],213:[function(require,module,exports){ + +},{"./old.js":449,"_process":497,"fs":24}],449:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -20680,7 +28688,8 @@ exports.realpath = function realpath(p, cache, cb) { }; }).call(this,require('_process')) -},{"_process":265,"fs":21,"path":260}],214:[function(require,module,exports){ + +},{"_process":497,"fs":24,"path":493}],450:[function(require,module,exports){ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module @@ -20706,7 +28715,7 @@ exports.realpath = function realpath(p, cache, cb) { }; })); -},{"./lib/gherkin/ast_builder":215,"./lib/gherkin/dialects":218,"./lib/gherkin/generate_events":220,"./lib/gherkin/parser":223,"./lib/gherkin/pickles/compiler":224,"./lib/gherkin/token_matcher":226,"./lib/gherkin/token_scanner":227}],215:[function(require,module,exports){ +},{"./lib/gherkin/ast_builder":451,"./lib/gherkin/dialects":454,"./lib/gherkin/generate_events":456,"./lib/gherkin/parser":459,"./lib/gherkin/pickles/compiler":460,"./lib/gherkin/token_matcher":462,"./lib/gherkin/token_scanner":463}],451:[function(require,module,exports){ var AstNode = require('./ast_node'); var Errors = require('./errors'); @@ -20972,7 +28981,7 @@ module.exports = function AstBuilder () { }; -},{"./ast_node":216,"./errors":219}],216:[function(require,module,exports){ +},{"./ast_node":452,"./errors":455}],452:[function(require,module,exports){ function AstNode (ruleType) { this.ruleType = ruleType; this._subItems = {}; @@ -21002,7 +29011,7 @@ AstNode.prototype.getTokens = function (tokenType) { module.exports = AstNode; -},{}],217:[function(require,module,exports){ +},{}],453:[function(require,module,exports){ // https://mathiasbynens.be/notes/javascript-unicode var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; @@ -21010,10 +29019,10 @@ module.exports = function countSymbols(string) { return string.replace(regexAstralSymbols, '_').length; } -},{}],218:[function(require,module,exports){ +},{}],454:[function(require,module,exports){ module.exports = require('./gherkin-languages.json'); -},{"./gherkin-languages.json":221}],219:[function(require,module,exports){ +},{"./gherkin-languages.json":457}],455:[function(require,module,exports){ var Errors = {}; [ @@ -21076,7 +29085,7 @@ function createError(Ctor, message, location) { module.exports = Errors; -},{}],220:[function(require,module,exports){ +},{}],456:[function(require,module,exports){ var Parser = require('./parser') var Compiler = require('./pickles/compiler') @@ -21154,7 +29163,7 @@ function generateEvents(data, uri, types, language) { module.exports = generateEvents -},{"./parser":223,"./pickles/compiler":224}],221:[function(require,module,exports){ +},{"./parser":459,"./pickles/compiler":460}],457:[function(require,module,exports){ module.exports={ "af": { "and": [ @@ -24349,7 +32358,7 @@ module.exports={ } } -},{}],222:[function(require,module,exports){ +},{}],458:[function(require,module,exports){ var countSymbols = require('./count_symbols') function GherkinLine(lineText, lineNumber) { @@ -24434,7 +32443,7 @@ GherkinLine.prototype.getTags = function getTags() { module.exports = GherkinLine; -},{"./count_symbols":217}],223:[function(require,module,exports){ +},{"./count_symbols":453}],459:[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'); @@ -26859,7 +34868,7 @@ module.exports = function Parser(builder) { } -},{"./ast_builder":215,"./errors":219,"./token_matcher":226,"./token_scanner":227}],224:[function(require,module,exports){ +},{"./ast_builder":451,"./errors":455,"./token_matcher":462,"./token_scanner":463}],460:[function(require,module,exports){ var countSymbols = require('../count_symbols'); function Compiler() { @@ -27024,7 +35033,7 @@ function Compiler() { module.exports = Compiler; -},{"../count_symbols":217}],225:[function(require,module,exports){ +},{"../count_symbols":453}],461:[function(require,module,exports){ function Token(line, location) { this.line = line; this.location = location; @@ -27041,7 +35050,7 @@ Token.prototype.detach = function () { module.exports = Token; -},{}],226:[function(require,module,exports){ +},{}],462:[function(require,module,exports){ var DIALECTS = require('./dialects'); var Errors = require('./errors'); var LANGUAGE_PATTERN = /^\s*#\s*language\s*:\s*([a-zA-Z\-_]+)\s*$/; @@ -27232,7 +35241,7 @@ module.exports = function TokenMatcher(defaultDialectName) { } }; -},{"./dialects":218,"./errors":219}],227:[function(require,module,exports){ +},{"./dialects":454,"./errors":455}],463:[function(require,module,exports){ var Token = require('./token'); var GherkinLine = require('./gherkin_line'); @@ -27257,7 +35266,7 @@ module.exports = function TokenScanner(source) { } }; -},{"./gherkin_line":222,"./token":225}],228:[function(require,module,exports){ +},{"./gherkin_line":458,"./token":461}],464:[function(require,module,exports){ (function (process){ exports.alphasort = alphasort exports.alphasorti = alphasorti @@ -27501,7 +35510,8 @@ function childrenIgnored (self, path) { } }).call(this,require('_process')) -},{"_process":265,"minimatch":250,"path":260,"path-is-absolute":261}],229:[function(require,module,exports){ + +},{"_process":497,"minimatch":483,"path":493,"path-is-absolute":494}],465:[function(require,module,exports){ (function (process){ // Approach: // @@ -28295,7 +36305,8 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) { } }).call(this,require('_process')) -},{"./common.js":228,"./sync.js":230,"_process":265,"assert":5,"events":209,"fs":21,"fs.realpath":212,"inflight":237,"inherits":238,"minimatch":250,"once":258,"path":260,"path-is-absolute":261,"util":324}],230:[function(require,module,exports){ + +},{"./common.js":464,"./sync.js":466,"_process":497,"assert":5,"events":444,"fs":24,"fs.realpath":448,"inflight":473,"inherits":474,"minimatch":483,"once":490,"path":493,"path-is-absolute":494,"util":560}],466:[function(require,module,exports){ (function (process){ module.exports = globSync globSync.GlobSync = GlobSync @@ -28785,12 +36796,11 @@ GlobSync.prototype._makeAbs = function (f) { } }).call(this,require('_process')) -},{"./common.js":228,"./glob.js":229,"_process":265,"assert":5,"fs":21,"fs.realpath":212,"minimatch":250,"path":260,"path-is-absolute":261,"util":324}],231:[function(require,module,exports){ -'use strict' -var fs = require('fs') +},{"./common.js":464,"./glob.js":465,"_process":497,"assert":5,"fs":24,"fs.realpath":448,"minimatch":483,"path":493,"path-is-absolute":494,"util":560}],467:[function(require,module,exports){ +'use strict' -module.exports = clone(fs) +module.exports = clone function clone (obj) { if (obj === null || typeof obj !== 'object') @@ -28808,15 +36818,29 @@ function clone (obj) { return copy } -},{"fs":21}],232:[function(require,module,exports){ -(function (process){ +},{}],468:[function(require,module,exports){ +(function (process,global){ var fs = require('fs') var polyfills = require('./polyfills.js') var legacy = require('./legacy-streams.js') -var queue = [] +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 @@ -28829,48 +36853,71 @@ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) console.error(m) } -if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(queue) - require('assert').equal(queue.length, 0) +// 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 + } }) -} -module.exports = patch(require('./fs.js')) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH) { - module.exports = patch(fs) -} + // 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) -// Always patch fs.close/closeSync, because we want 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. -module.exports.close = -fs.close = (function (fs$close) { return function (fd, cb) { - return fs$close.call(fs, fd, function (err) { - if (!err) + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) retry() + } - if (typeof cb === 'function') - cb.apply(this, arguments) - }) -}})(fs.close) + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) -module.exports.closeSync = -fs.closeSync = (function (fs$closeSync) { return function (fd) { - // Note that graceful-fs also retries when fs.closeSync() fails. - // Looks like a bug to me, although it's probably a harmless one. - var rval = fs$closeSync.apply(fs, arguments) - retry() - return rval -}})(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.FileReadStream = ReadStream; // Legacy name. - fs.FileWriteStream = WriteStream; // Legacy name. + fs.createReadStream = createReadStream fs.createWriteStream = createWriteStream var fs$readFile = fs.readFile @@ -28956,6 +37003,7 @@ function patch (fs) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) enqueue([go$readdir, [args]]) + else { if (typeof cb === 'function') cb.apply(this, arguments) @@ -28975,15 +37023,59 @@ function patch (fs) { } var fs$ReadStream = fs.ReadStream - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } var fs$WriteStream = fs.WriteStream - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open + 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 + }) - fs.ReadStream = ReadStream - fs.WriteStream = WriteStream + // 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) @@ -29029,11 +37121,11 @@ function patch (fs) { } function createReadStream (path, options) { - return new ReadStream(path, options) + return new fs.ReadStream(path, options) } function createWriteStream (path, options) { - return new WriteStream(path, options) + return new fs.WriteStream(path, options) } var fs$open = fs.open @@ -29062,19 +37154,20 @@ function patch (fs) { function enqueue (elem) { debug('ENQUEUE', elem[0].name, elem[1]) - queue.push(elem) + global[gracefulQueue].push(elem) } function retry () { - var elem = queue.shift() + var elem = global[gracefulQueue].shift() if (elem) { debug('RETRY', elem[0].name, elem[1]) elem[0].apply(null, elem[1]) } } -}).call(this,require('_process')) -},{"./fs.js":231,"./legacy-streams.js":233,"./polyfills.js":234,"_process":265,"assert":5,"fs":21,"util":324}],233:[function(require,module,exports){ +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"./clone.js":467,"./legacy-streams.js":469,"./polyfills.js":470,"_process":497,"assert":5,"fs":24,"util":560}],469:[function(require,module,exports){ (function (process){ var Stream = require('stream').Stream @@ -29196,9 +37289,9 @@ function legacy (fs) { } }).call(this,require('_process')) -},{"_process":265,"stream":311}],234:[function(require,module,exports){ + +},{"_process":497,"stream":541}],470:[function(require,module,exports){ (function (process){ -var fs = require('./fs.js') var constants = require('constants') var origCwd = process.cwd @@ -29316,20 +37409,26 @@ function patch (fs) { } // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { return function (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) + 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) } - callback_.apply(this, arguments) } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - }})(fs.read) + + // 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 @@ -29345,73 +37444,36 @@ function patch (fs) { } } }})(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) + 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 } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) + // 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.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret + 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.futimesSync(fd, at, mt) + ret = fs.fchmodSync(fd, mode) threw = false } finally { if (threw) { @@ -29424,116 +37486,161 @@ function patchLutimes (fs) { } return ret } + } - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} + 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 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 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 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 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 statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, cb) { - return orig.call(fs, target, function (er, stats) { - if (!stats) return cb.apply(this, arguments) + 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 - if (cb) cb.apply(this, arguments) - }) + return stats; + } } -} -function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target) { - var stats = 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 -// 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 - if (er.code === "ENOSYS") - return true + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true + return false } - - return false } }).call(this,require('_process')) -},{"./fs.js":231,"_process":265,"constants":40}],235:[function(require,module,exports){ + +},{"_process":497,"constants":44}],471:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m - var eLen = nBytes * 8 - mLen - 1 + var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var nBits = -7 @@ -29546,12 +37653,12 @@ exports.read = function (buffer, offset, isLE, mLen, nBytes) { e = s & ((1 << (-nBits)) - 1) s >>= (-nBits) nBits += eLen - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} + 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) {} + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} if (e === 0) { e = 1 - eBias @@ -29566,7 +37673,7 @@ exports.read = function (buffer, offset, isLE, mLen, nBytes) { exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var e, m, c - var eLen = nBytes * 8 - mLen - 1 + 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) @@ -29599,7 +37706,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { m = 0 e = eMax } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen) + m = ((value * c) - 1) * Math.pow(2, mLen) e = e + eBias } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) @@ -29616,36 +37723,44 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],236:[function(require,module,exports){ +},{}],472:[function(require,module,exports){ 'use strict'; -module.exports = (str, count, opts) => { - // Support older versions: use the third parameter as options.indent - // TODO: Remove the workaround in the next major version - const options = typeof opts === 'object' ? Object.assign({indent: ' '}, opts) : {indent: opts || ' '}; - count = count === undefined ? 1 : count; - if (typeof str !== 'string') { - throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof str}\``); +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}\``); + 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}\``); + throw new TypeError( + `Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\`` + ); } if (count === 0) { - return str; + return string; } - const regex = options.includeEmptyLines ? /^/mg : /^(?!\s*$)/mg; - return str.replace(regex, options.indent.repeat(count)); -} -; + const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm; + + return string.replace(regex, options.indent.repeat(count)); +}; -},{}],237:[function(require,module,exports){ +},{}],473:[function(require,module,exports){ (function (process){ var wrappy = require('wrappy') var reqs = Object.create(null) @@ -29703,36 +37818,41 @@ function slice (args) { } }).call(this,require('_process')) -},{"_process":265,"once":258,"wrappy":327}],238:[function(require,module,exports){ + +},{"_process":497,"once":490,"wrappy":562}],474:[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 - } - }); + 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) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } } } -},{}],239:[function(require,module,exports){ +},{}],475:[function(require,module,exports){ /*! * Determine if an object is a Buffer * - * @author Feross Aboukhadijeh + * @author Feross Aboukhadijeh * @license MIT */ @@ -29751,7 +37871,7 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],240:[function(require,module,exports){ +},{}],476:[function(require,module,exports){ 'use strict'; /* eslint-disable yoda */ module.exports = x => { @@ -29799,7 +37919,7 @@ module.exports = x => { return false; }; -},{}],241:[function(require,module,exports){ +},{}],477:[function(require,module,exports){ /** * Export generator function checks. */ @@ -29830,189 +37950,45 @@ function isGeneratorFunction (fn) { fn.constructor.name === 'GeneratorFunction' } -},{}],242:[function(require,module,exports){ +},{}],478:[function(require,module,exports){ 'use strict'; -var isStream = module.exports = function (stream) { - return stream !== null && typeof stream === 'object' && typeof stream.pipe === 'function'; -}; +const isStream = stream => + stream !== null && + typeof stream === 'object' && + typeof stream.pipe === 'function'; -isStream.writable = function (stream) { - return isStream(stream) && stream.writable !== false && typeof stream._write === 'function' && typeof stream._writableState === 'object'; -}; +isStream.writable = stream => + isStream(stream) && + stream.writable !== false && + typeof stream._write === 'function' && + typeof stream._writableState === 'object'; -isStream.readable = function (stream) { - return isStream(stream) && stream.readable !== false && typeof stream._read === 'function' && typeof stream._readableState === 'object'; -}; +isStream.readable = stream => + isStream(stream) && + stream.readable !== false && + typeof stream._read === 'function' && + typeof stream._readableState === 'object'; -isStream.duplex = function (stream) { - return isStream.writable(stream) && isStream.readable(stream); -}; +isStream.duplex = stream => + isStream.writable(stream) && + isStream.readable(stream); -isStream.transform = function (stream) { - return isStream.duplex(stream) && typeof stream._transform === 'function' && typeof stream._transformState === 'object'; -}; +isStream.transform = stream => + isStream.duplex(stream) && + typeof stream._transform === 'function' && + typeof stream._transformState === 'object'; -},{}],243:[function(require,module,exports){ +module.exports = isStream; + +},{}],479:[function(require,module,exports){ var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; -},{}],244:[function(require,module,exports){ -(function (process,global){ -var fs = require('fs') -var core -if (process.platform === 'win32' || global.TESTING_WINDOWS) { - core = require('./windows.js') -} else { - core = require('./mode.js') -} - -module.exports = isexe -isexe.sync = sync - -function isexe (path, options, cb) { - if (typeof options === 'function') { - cb = options - options = {} - } - - if (!cb) { - if (typeof Promise !== 'function') { - throw new TypeError('callback not provided') - } - - return new Promise(function (resolve, reject) { - isexe(path, options || {}, function (er, is) { - if (er) { - reject(er) - } else { - resolve(is) - } - }) - }) - } - - core(path, options || {}, function (er, is) { - // ignore EACCES because that just means we aren't allowed to run it - if (er) { - if (er.code === 'EACCES' || options && options.ignoreErrors) { - er = null - is = false - } - } - cb(er, is) - }) -} - -function sync (path, options) { - // my kingdom for a filtered catch - try { - return core.sync(path, options || {}) - } catch (er) { - if (options && options.ignoreErrors || er.code === 'EACCES') { - return false - } else { - throw er - } - } -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./mode.js":245,"./windows.js":246,"_process":265,"fs":21}],245:[function(require,module,exports){ -(function (process){ -module.exports = isexe -isexe.sync = sync - -var fs = require('fs') - -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, options)) - }) -} - -function sync (path, options) { - return checkStat(fs.statSync(path), options) -} - -function checkStat (stat, options) { - return stat.isFile() && checkMode(stat, options) -} - -function checkMode (stat, options) { - var mod = stat.mode - var uid = stat.uid - var gid = stat.gid - - var myUid = options.uid !== undefined ? - options.uid : process.getuid && process.getuid() - var myGid = options.gid !== undefined ? - options.gid : process.getgid && process.getgid() - - var u = parseInt('100', 8) - var g = parseInt('010', 8) - var o = parseInt('001', 8) - var ug = u | g - - var ret = (mod & o) || - (mod & g) && gid === myGid || - (mod & u) && uid === myUid || - (mod & ug) && myUid === 0 - - return ret -} - -}).call(this,require('_process')) -},{"_process":265,"fs":21}],246:[function(require,module,exports){ -(function (process){ -module.exports = isexe -isexe.sync = sync - -var fs = require('fs') - -function checkPathExt (path, options) { - var pathext = options.pathExt !== undefined ? - options.pathExt : process.env.PATHEXT - - if (!pathext) { - return true - } - - pathext = pathext.split(';') - if (pathext.indexOf('') !== -1) { - return true - } - for (var i = 0; i < pathext.length; i++) { - var p = pathext[i].toLowerCase() - if (p && path.substr(-p.length).toLowerCase() === p) { - return true - } - } - return false -} - -function checkStat (stat, path, options) { - if (!stat.isSymbolicLink() && !stat.isFile()) { - return false - } - return checkPathExt(path, options) -} - -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, path, options)) - }) -} - -function sync (path, options) { - return checkStat(fs.statSync(path), path, options) -} - -}).call(this,require('_process')) -},{"_process":265,"fs":21}],247:[function(require,module,exports){ +},{}],480:[function(require,module,exports){ /* * Copyright 2013 AJ O'Neal * Copyright 2015 Tiancheng "Timothy" Gu @@ -30083,12 +38059,12 @@ module.exports = function shuffle(array, seed) { return array } -},{"seed-random":292}],248:[function(require,module,exports){ +},{"seed-random":525}],481:[function(require,module,exports){ (function (global){ /** * @license * Lodash - * Copyright JS Foundation and other contributors + * 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 @@ -30099,7 +38075,7 @@ module.exports = function shuffle(array, seed) { var undefined; /** Used as the semantic version number. */ - var VERSION = '4.17.10'; + var VERSION = '4.17.15'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -30363,7 +38339,7 @@ module.exports = function shuffle(array, seed) { 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 ]/; + 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 = [ @@ -31311,20 +39287,6 @@ module.exports = function shuffle(array, seed) { return result; } - /** - * Gets the value at `key`, unless `key` is "__proto__". - * - * @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) { - return key == '__proto__' - ? undefined - : object[key]; - } - /** * Converts `set` to an array of its values. * @@ -32772,16 +40734,10 @@ module.exports = function shuffle(array, seed) { value.forEach(function(subValue) { result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); }); - - return result; - } - - if (isMap(value)) { + } else if (isMap(value)) { value.forEach(function(subValue, key) { result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); - - return result; } var keysFunc = isFull @@ -33705,8 +41661,8 @@ module.exports = function shuffle(array, seed) { return; } baseFor(source, function(srcValue, key) { + stack || (stack = new Stack); if (isObject(srcValue)) { - stack || (stack = new Stack); baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { @@ -33782,7 +41738,7 @@ module.exports = function shuffle(array, seed) { if (isArguments(objValue)) { newValue = toPlainObject(objValue); } - else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { + else if (!isObject(objValue) || isFunction(objValue)) { newValue = initCloneObject(srcValue); } } @@ -35523,7 +43479,7 @@ module.exports = function shuffle(array, seed) { return function(number, precision) { number = toNumber(number); precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); - if (precision) { + 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'), @@ -36705,6 +44661,26 @@ module.exports = function shuffle(array, seed) { 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`. * @@ -40498,6 +48474,7 @@ module.exports = function shuffle(array, seed) { } if (maxing) { // Handle invocations in a tight loop. + clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } @@ -44884,9 +52861,12 @@ module.exports = function shuffle(array, seed) { , 'g'); // Use a sourceURL for easier debugging. + // The sourceURL gets injected into the source that's eval-ed, so be careful + // with lookup (in case of e.g. prototype pollution), and strip newlines if any. + // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection. var sourceURL = '//# sourceURL=' + - ('sourceURL' in options - ? options.sourceURL + (hasOwnProperty.call(options, 'sourceURL') + ? (options.sourceURL + '').replace(/[\r\n]/g, ' ') : ('lodash.templateSources[' + (++templateCounter) + ']') ) + '\n'; @@ -44919,7 +52899,9 @@ module.exports = function shuffle(array, seed) { // If `variable` is not specified wrap a with-statement around the generated // code to add the data object to the top of the scope chain. - var variable = options.variable; + // Like with sourceURL, we take care to not check the option's prototype, + // as this configuration is a code injection vector. + var variable = hasOwnProperty.call(options, 'variable') && options.variable; if (!variable) { source = 'with (obj) {\n' + source + '\n}\n'; } @@ -47124,10 +55106,11 @@ module.exports = function shuffle(array, seed) { baseForOwn(LazyWrapper.prototype, function(func, methodName) { var lodashFunc = lodash[methodName]; if (lodashFunc) { - var key = (lodashFunc.name + ''), - names = realNames[key] || (realNames[key] = []); - - names.push({ 'name': methodName, 'func': lodashFunc }); + var key = lodashFunc.name + ''; + if (!hasOwnProperty.call(realNames, key)) { + realNames[key] = []; + } + realNames[key].push({ 'name': methodName, 'func': lodashFunc }); } }); @@ -47192,7 +55175,8 @@ module.exports = function shuffle(array, seed) { }.call(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],249:[function(require,module,exports){ + +},{}],482:[function(require,module,exports){ /** * Special language-specific overrides. * @@ -47248,7 +55232,7 @@ module.exports = function (str, locale) { return str.toLowerCase() } -},{}],250:[function(require,module,exports){ +},{}],483:[function(require,module,exports){ module.exports = minimatch minimatch.Minimatch = Minimatch @@ -48173,7 +56157,7 @@ function regExpEscape (s) { return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') } -},{"brace-expansion":19,"path":260}],251:[function(require,module,exports){ +},{"brace-expansion":22,"path":493}],484:[function(require,module,exports){ var Promise = require('any-promise') var fs @@ -48237,20 +56221,7 @@ exports.exists = function (filename, callback) { }) } -},{"any-promise":1,"fs":21,"graceful-fs":232,"thenify-all":316}],252:[function(require,module,exports){ -'use strict' - -/** - * Tries to execute a function and discards any error that occurs. - * @param {Function} fn - Function that might or might not throw an error. - * @returns {?*} Return-value of the function when no error occurred. - */ -module.exports = function(fn) { - - try { return fn() } catch (e) {} - -} -},{}],253:[function(require,module,exports){ +},{"any-promise":1,"fs":24,"graceful-fs":468,"thenify-all":546}],485:[function(require,module,exports){ var lowerCase = require('lower-case') var NON_WORD_REGEXP = require('./vendor/non-word-regexp') @@ -48292,16 +56263,16 @@ module.exports = function (str, locale, replacement) { return lowerCase(str, locale) } -},{"./vendor/camel-case-regexp":254,"./vendor/camel-case-upper-regexp":255,"./vendor/non-word-regexp":256,"lower-case":249}],254:[function(require,module,exports){ +},{"./vendor/camel-case-regexp":486,"./vendor/camel-case-upper-regexp":487,"./vendor/non-word-regexp":488,"lower-case":482}],486:[function(require,module,exports){ module.exports = /([a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])([A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A])/g -},{}],255:[function(require,module,exports){ +},{}],487:[function(require,module,exports){ module.exports = /([A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A])([A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A][a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A])/g -},{}],256:[function(require,module,exports){ +},{}],488:[function(require,module,exports){ module.exports = /[^A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]+/g -},{}],257:[function(require,module,exports){ +},{}],489:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @@ -48393,7 +56364,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],258:[function(require,module,exports){ +},{}],490:[function(require,module,exports){ var wrappy = require('wrappy') module.exports = wrappy(once) module.exports.strict = wrappy(onceStrict) @@ -48437,7 +56408,58 @@ function onceStrict (fn) { return f } -},{"wrappy":327}],259:[function(require,module,exports){ +},{"wrappy":562}],491:[function(require,module,exports){ +exports.endianness = function () { return 'LE' }; + +exports.hostname = function () { + if (typeof location !== 'undefined') { + return location.hostname + } + else return ''; +}; + +exports.loadavg = function () { return [] }; + +exports.uptime = function () { return 0 }; + +exports.freemem = function () { + return Number.MAX_VALUE; +}; + +exports.totalmem = function () { + return Number.MAX_VALUE; +}; + +exports.cpus = function () { return [] }; + +exports.type = function () { return 'Browser' }; + +exports.release = function () { + if (typeof navigator !== 'undefined') { + return navigator.appVersion; + } + return ''; +}; + +exports.networkInterfaces += exports.getNetworkInterfaces += function () { return {} }; + +exports.arch = function () { return 'javascript' }; + +exports.platform = function () { return 'browser' }; + +exports.tmpdir = exports.tmpDir = function () { + return '/tmp'; +}; + +exports.EOL = '\n'; + +exports.homedir = function () { + return '/' +}; + +},{}],492:[function(require,module,exports){ 'use strict'; var repeat = require('repeat-string'); @@ -48459,8 +56481,11 @@ module.exports = function padLeft(val, num, str) { return val + padding.slice(0, diff); }; -},{"repeat-string":284}],260:[function(require,module,exports){ +},{"repeat-string":516}],493:[function(require,module,exports){ (function (process){ +// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, +// backported and transplited with Babel, with backwards-compat fixes + // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -48512,14 +56537,6 @@ function normalizeArray(parts, allowAboveRoot) { return parts; } -// Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; -var splitPath = function(filename) { - return splitPathRe.exec(filename).slice(1); -}; - // path.resolve([from ...], to) // posix version exports.resolve = function() { @@ -48635,37 +56652,120 @@ exports.relative = function(from, to) { exports.sep = '/'; exports.delimiter = ':'; -exports.dirname = function(path) { - var result = splitPath(path), - root = result[0], - dir = result[1]; - - if (!root && !dir) { - // No dirname whatsoever - return '.'; +exports.dirname = function (path) { + if (typeof path !== 'string') path = path + ''; + if (path.length === 0) return '.'; + var code = path.charCodeAt(0); + var hasRoot = code === 47 /*/*/; + var end = -1; + var matchedSlash = true; + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i); + if (code === 47 /*/*/) { + if (!matchedSlash) { + end = i; + break; + } + } else { + // We saw the first non-path separator + matchedSlash = false; + } } - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); + if (end === -1) return hasRoot ? '/' : '.'; + if (hasRoot && end === 1) { + // return '//'; + // Backwards-compat fix: + return '/'; } - - return root + dir; + return path.slice(0, end); }; +function basename(path) { + if (typeof path !== 'string') path = path + ''; -exports.basename = function(path, ext) { - var f = splitPath(path)[2]; - // TODO: make this comparison case-insensitive on windows? + var start = 0; + var end = -1; + var matchedSlash = true; + var i; + + for (i = path.length - 1; i >= 0; --i) { + if (path.charCodeAt(i) === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false; + end = i + 1; + } + } + + if (end === -1) return ''; + return path.slice(start, end); +} + +// Uses a mixed approach for backwards-compatibility, as ext behavior changed +// in new Node.js versions, so only basename() above is backported here +exports.basename = function (path, ext) { + var f = basename(path); if (ext && f.substr(-1 * ext.length) === ext) { f = f.substr(0, f.length - ext.length); } return f; }; - -exports.extname = function(path) { - return splitPath(path)[3]; +exports.extname = function (path) { + if (typeof path !== 'string') path = path + ''; + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + for (var i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46 /*.*/) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + startDot = i; + else if (preDotState !== 1) + preDotState = 1; + } else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + + if (startDot === -1 || end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + return ''; + } + return path.slice(startDot, end); }; function filter (xs, f) { @@ -48687,7 +56787,8 @@ var substr = 'ab'.substr(-1) === 'b' ; }).call(this,require('_process')) -},{"_process":265}],261:[function(require,module,exports){ + +},{"_process":497}],494:[function(require,module,exports){ (function (process){ 'use strict'; @@ -48711,24 +56812,8 @@ module.exports.posix = posix; module.exports.win32 = win32; }).call(this,require('_process')) -},{"_process":265}],262:[function(require,module,exports){ -(function (process){ -'use strict'; -module.exports = opts => { - opts = opts || {}; - - const env = opts.env || process.env; - const platform = opts.platform || process.platform; - - if (platform !== 'win32') { - return 'PATH'; - } - - return Object.keys(env).find(x => x.toUpperCase() === 'PATH') || 'Path'; -}; -}).call(this,require('_process')) -},{"_process":265}],263:[function(require,module,exports){ +},{"_process":497}],495:[function(require,module,exports){ (function (process){ 'use strict'; @@ -48825,16 +56910,18 @@ module.exports.posix = posix.parse; module.exports.win32 = win32.parse; }).call(this,require('_process')) -},{"_process":265}],264:[function(require,module,exports){ + +},{"_process":497}],496:[function(require,module,exports){ (function (process){ 'use strict'; -if (!process.version || +if (typeof process === 'undefined' || + !process.version || process.version.indexOf('v0.') === 0 || process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = nextTick; + module.exports = { nextTick: nextTick }; } else { - module.exports = process.nextTick; + module.exports = process } function nextTick(fn, arg1, arg2, arg3) { @@ -48871,8 +56958,10 @@ function nextTick(fn, arg1, arg2, arg3) { } } + }).call(this,require('_process')) -},{"_process":265}],265:[function(require,module,exports){ + +},{"_process":497}],497:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -49058,10 +57147,10 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],266:[function(require,module,exports){ +},{}],498:[function(require,module,exports){ module.exports = require('./lib/node-progress'); -},{"./lib/node-progress":267}],267:[function(require,module,exports){ +},{"./lib/node-progress":499}],499:[function(require,module,exports){ (function (process){ /*! * node-progress @@ -49131,6 +57220,7 @@ function ProgressBar(fmt, options) { head : options.head || (options.complete || '=') }; this.renderThrottle = options.renderThrottle !== 0 ? (options.renderThrottle || 16) : 0; + this.lastRender = -Infinity; this.callback = options.callback || function () {}; this.tokens = {}; this.lastDraw = ''; @@ -49157,14 +57247,12 @@ ProgressBar.prototype.tick = function(len, tokens){ this.curr += len - // schedule render - if (!this.renderThrottleTimeout) { - this.renderThrottleTimeout = setTimeout(this.render.bind(this), this.renderThrottle); - } + // try to render + this.render(); // progress complete if (this.curr >= this.total) { - if (this.renderThrottleTimeout) this.render(); + this.render(undefined, true); this.complete = true; this.terminate(); this.callback(this); @@ -49180,18 +57268,24 @@ ProgressBar.prototype.tick = function(len, tokens){ * @api public */ -ProgressBar.prototype.render = function (tokens) { - clearTimeout(this.renderThrottleTimeout); - this.renderThrottleTimeout = null; - +ProgressBar.prototype.render = function (tokens, force) { + force = force !== undefined ? force : false; if (tokens) this.tokens = tokens; if (!this.stream.isTTY) return; + var now = Date.now(); + var delta = now - this.lastRender; + if (!force && (delta < this.renderThrottle)) { + return; + } else { + this.lastRender = now; + } + var ratio = this.curr / this.total; ratio = Math.min(Math.max(ratio, 0), 1); - var percent = ratio * 100; + var percent = Math.floor(ratio * 100); var incomplete, complete, completeLength; var elapsed = new Date - this.start; var eta = (percent == 100) ? 0 : elapsed * (this.total / this.curr - 1); @@ -49296,10 +57390,11 @@ ProgressBar.prototype.terminate = function () { }; }).call(this,require('_process')) -},{"_process":265}],268:[function(require,module,exports){ + +},{"_process":497}],500:[function(require,module,exports){ module.exports = require('./lib/_stream_duplex.js'); -},{"./lib/_stream_duplex.js":269}],269:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":501}],501:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -49330,7 +57425,7 @@ module.exports = require('./lib/_stream_duplex.js'); /**/ -var processNextTick = require('process-nextick-args'); +var pna = require('process-nextick-args'); /**/ /**/ @@ -49354,10 +57449,13 @@ var Writable = require('./_stream_writable'); util.inherits(Duplex, Readable); -var keys = objectKeys(Writable.prototype); -for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; +{ + // avoid scope creep, the keys array can then be collected + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } } function Duplex(options) { @@ -49376,6 +57474,16 @@ function Duplex(options) { this.once('end', onend); } +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + // the no-half-open enforcer function onend() { // if we allow half-open state, or if the writable side ended, @@ -49384,7 +57492,7 @@ function onend() { // no more data can be written. // But allow more writes to happen in this tick. - processNextTick(onEndNT, this); + pna.nextTick(onEndNT, this); } function onEndNT(self) { @@ -49416,15 +57524,9 @@ Duplex.prototype._destroy = function (err, cb) { this.push(null); this.end(); - processNextTick(cb, err); + pna.nextTick(cb, err); }; - -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} -},{"./_stream_readable":271,"./_stream_writable":273,"core-util-is":146,"inherits":238,"process-nextick-args":264}],270:[function(require,module,exports){ +},{"./_stream_readable":503,"./_stream_writable":505,"core-util-is":392,"inherits":474,"process-nextick-args":496}],502:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -49472,7 +57574,7 @@ function PassThrough(options) { PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; -},{"./_stream_transform":272,"core-util-is":146,"inherits":238}],271:[function(require,module,exports){ +},{"./_stream_transform":504,"core-util-is":392,"inherits":474}],503:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -49499,7 +57601,7 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { /**/ -var processNextTick = require('process-nextick-args'); +var pna = require('process-nextick-args'); /**/ module.exports = Readable; @@ -49526,9 +57628,8 @@ var EElistenerCount = function (emitter, type) { var Stream = require('./internal/streams/stream'); /**/ -// TODO(bmeurer): Change this back to const once hole checks are -// properly optimized away early in Ignition+TurboFan. /**/ + var Buffer = require('safe-buffer').Buffer; var OurUint8Array = global.Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { @@ -49537,6 +57638,7 @@ function _uint8ArrayToBuffer(chunk) { function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } + /**/ /**/ @@ -49565,15 +57667,13 @@ var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; function prependListener(emitter, event, fn) { // Sadly this is not cacheable as some libraries bundle their own // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') { - return emitter.prependListener(event, fn); - } else { - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; - } + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; } function ReadableState(options, stream) { @@ -49581,17 +57681,26 @@ function ReadableState(options, stream) { options = options || {}; + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + // object stream flag. Used to make read(n) ignore n and to // make all the buffer merging and length checks go away this.objectMode = !!options.objectMode; - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer // Note: 0 is a valid value, means "don't call _read preemptively ever" var hwm = options.highWaterMark; + var readableHwm = options.readableHighWaterMark; var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; // cast to ints. this.highWaterMark = Math.floor(this.highWaterMark); @@ -49964,7 +58073,7 @@ function emitReadable(stream) { if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; - if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); + if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); } } @@ -49983,7 +58092,7 @@ function emitReadable_(stream) { function maybeReadMore(stream, state) { if (!state.readingMore) { state.readingMore = true; - processNextTick(maybeReadMore_, stream, state); + pna.nextTick(maybeReadMore_, stream, state); } } @@ -50028,7 +58137,7 @@ Readable.prototype.pipe = function (dest, pipeOpts) { var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); + if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); dest.on('unpipe', onunpipe); function onunpipe(readable, unpipeInfo) { @@ -50218,7 +58327,7 @@ Readable.prototype.on = function (ev, fn) { state.readableListening = state.needReadable = true; state.emittedReadable = false; if (!state.reading) { - processNextTick(nReadingNextTick, this); + pna.nextTick(nReadingNextTick, this); } else if (state.length) { emitReadable(this); } @@ -50249,7 +58358,7 @@ Readable.prototype.resume = function () { function resume(stream, state) { if (!state.resumeScheduled) { state.resumeScheduled = true; - processNextTick(resume_, stream, state); + pna.nextTick(resume_, stream, state); } } @@ -50286,18 +58395,19 @@ function flow(stream) { // This is *not* part of the readable stream interface. // It is an ugly unfortunate mess of history. Readable.prototype.wrap = function (stream) { + var _this = this; + var state = this._readableState; var paused = false; - var self = this; stream.on('end', function () { debug('wrapped end'); if (state.decoder && !state.ended) { var chunk = state.decoder.end(); - if (chunk && chunk.length) self.push(chunk); + if (chunk && chunk.length) _this.push(chunk); } - self.push(null); + _this.push(null); }); stream.on('data', function (chunk) { @@ -50307,7 +58417,7 @@ Readable.prototype.wrap = function (stream) { // don't skip over falsy values in objectMode if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - var ret = self.push(chunk); + var ret = _this.push(chunk); if (!ret) { paused = true; stream.pause(); @@ -50328,12 +58438,12 @@ Readable.prototype.wrap = function (stream) { // proxy certain important events. for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], self.emit.bind(self, kProxyEvents[n])); + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); } // when we try to consume some more bytes, simply unpause the // underlying stream. - self._read = function (n) { + this._read = function (n) { debug('wrapped _read', n); if (paused) { paused = false; @@ -50341,9 +58451,19 @@ Readable.prototype.wrap = function (stream) { } }; - return self; + return this; }; +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._readableState.highWaterMark; + } +}); + // exposed for testing purposes only. Readable._fromList = fromList; @@ -50456,7 +58576,7 @@ function endReadable(stream) { if (!state.endEmitted) { state.ended = true; - processNextTick(endReadableNT, state, stream); + pna.nextTick(endReadableNT, state, stream); } } @@ -50469,12 +58589,6 @@ function endReadableNT(state, stream) { } } -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} - function indexOf(xs, x) { for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) return i; @@ -50482,7 +58596,8 @@ function indexOf(xs, x) { return -1; } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":269,"./internal/streams/BufferList":274,"./internal/streams/destroy":275,"./internal/streams/stream":276,"_process":265,"core-util-is":146,"events":209,"inherits":238,"isarray":243,"process-nextick-args":264,"safe-buffer":277,"string_decoder/":278,"util":20}],272:[function(require,module,exports){ + +},{"./_stream_duplex":501,"./internal/streams/BufferList":506,"./internal/streams/destroy":507,"./internal/streams/stream":508,"_process":497,"core-util-is":392,"events":444,"inherits":474,"isarray":479,"process-nextick-args":496,"safe-buffer":509,"string_decoder/":510,"util":23}],504:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -50559,39 +58674,28 @@ util.inherits = require('inherits'); util.inherits(Transform, Duplex); -function TransformState(stream) { - this.afterTransform = function (er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; - this.writeencoding = null; -} - -function afterTransform(stream, er, data) { - var ts = stream._transformState; +function afterTransform(er, data) { + var ts = this._transformState; ts.transforming = false; var cb = ts.writecb; if (!cb) { - return stream.emit('error', new Error('write callback called multiple times')); + return this.emit('error', new Error('write callback called multiple times')); } ts.writechunk = null; ts.writecb = null; - if (data !== null && data !== undefined) stream.push(data); + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); cb(er); - var rs = stream._readableState; + var rs = this._readableState; rs.reading = false; if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); + this._read(rs.highWaterMark); } } @@ -50600,9 +58704,14 @@ function Transform(options) { Duplex.call(this, options); - this._transformState = new TransformState(this); - - var stream = this; + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; // start out asking for a readable event once data is transformed. this._readableState.needReadable = true; @@ -50619,11 +58728,19 @@ function Transform(options) { } // When the writable side finishes, then flush out anything remaining. - this.once('prefinish', function () { - if (typeof this._flush === 'function') this._flush(function (er, data) { - done(stream, er, data); - });else done(stream); - }); + this.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function') { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } } Transform.prototype.push = function (chunk, encoding) { @@ -50673,32 +58790,30 @@ Transform.prototype._read = function (n) { }; Transform.prototype._destroy = function (err, cb) { - var _this = this; + var _this2 = this; Duplex.prototype._destroy.call(this, err, function (err2) { cb(err2); - _this.emit('close'); + _this2.emit('close'); }); }; function done(stream, er, data) { if (er) return stream.emit('error', er); - if (data !== null && data !== undefined) stream.push(data); + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); // if there's nothing in the write buffer, then that means // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; - - if (ws.length) throw new Error('Calling transform done when ws.length != 0'); + if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); - if (ts.transforming) throw new Error('Calling transform done when still transforming'); + if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); return stream.push(null); } -},{"./_stream_duplex":269,"core-util-is":146,"inherits":238}],273:[function(require,module,exports){ -(function (process,global){ +},{"./_stream_duplex":501,"core-util-is":392,"inherits":474}],505:[function(require,module,exports){ +(function (process,global,setImmediate){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -50728,7 +58843,7 @@ function done(stream, er, data) { /**/ -var processNextTick = require('process-nextick-args'); +var pna = require('process-nextick-args'); /**/ module.exports = Writable; @@ -50755,7 +58870,7 @@ function CorkedRequest(state) { /* */ /**/ -var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; /**/ /**/ @@ -50780,6 +58895,7 @@ var Stream = require('./internal/streams/stream'); /**/ /**/ + var Buffer = require('safe-buffer').Buffer; var OurUint8Array = global.Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { @@ -50788,6 +58904,7 @@ function _uint8ArrayToBuffer(chunk) { function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } + /**/ var destroyImpl = require('./internal/streams/destroy'); @@ -50801,18 +58918,27 @@ function WritableState(options, stream) { options = options || {}; + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + // object stream flag to indicate whether or not this stream // contains buffers or objects. this.objectMode = !!options.objectMode; - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false // Note: 0 is a valid value, means that we always return false if // the entire buffer is not flushed immediately on write() var hwm = options.highWaterMark; + var writableHwm = options.writableHighWaterMark; var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; // cast to ints. this.highWaterMark = Math.floor(this.highWaterMark); @@ -50926,6 +59052,7 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot Object.defineProperty(Writable, Symbol.hasInstance, { value: function (object) { if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; return object && object._writableState instanceof WritableState; } @@ -50977,7 +59104,7 @@ function writeAfterEnd(stream, cb) { var er = new Error('write after end'); // TODO: defer error events consistently everywhere, not just the cb stream.emit('error', er); - processNextTick(cb, er); + pna.nextTick(cb, er); } // Checks that a user-supplied chunk is valid, especially for the particular @@ -50994,7 +59121,7 @@ function validChunk(stream, state, chunk, cb) { } if (er) { stream.emit('error', er); - processNextTick(cb, er); + pna.nextTick(cb, er); valid = false; } return valid; @@ -51003,7 +59130,7 @@ function validChunk(stream, state, chunk, cb) { Writable.prototype.write = function (chunk, encoding, cb) { var state = this._writableState; var ret = false; - var isBuf = _isUint8Array(chunk) && !state.objectMode; + var isBuf = !state.objectMode && _isUint8Array(chunk); if (isBuf && !Buffer.isBuffer(chunk)) { chunk = _uint8ArrayToBuffer(chunk); @@ -51057,6 +59184,16 @@ function decodeChunk(state, chunk, encoding) { return chunk; } +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + // if we're already writing something, then just put this // in the queue, and wait our turn. Otherwise, call _write // If we return false, then we need a drain event, so set that flag. @@ -51114,10 +59251,10 @@ function onwriteError(stream, state, sync, er, cb) { if (sync) { // defer the callback if we are being called synchronously // to avoid piling up things on the stack - processNextTick(cb, er); + pna.nextTick(cb, er); // this can emit finish, and it will always happen // after error - processNextTick(finishMaybe, stream, state); + pna.nextTick(finishMaybe, stream, state); stream._writableState.errorEmitted = true; stream.emit('error', er); } else { @@ -51215,6 +59352,7 @@ function clearBuffer(stream, state) { } else { state.corkedRequestsFree = new CorkedRequest(state); } + state.bufferedRequestCount = 0; } else { // Slow case, write chunks one-by-one while (entry) { @@ -51225,6 +59363,7 @@ function clearBuffer(stream, state) { doWrite(stream, state, false, len, chunk, encoding, cb); entry = entry.next; + state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then // it means that we need to wait until it does. // also, that means that the chunk and cb are currently @@ -51237,7 +59376,6 @@ function clearBuffer(stream, state) { if (entry === null) state.lastBufferedRequest = null; } - state.bufferedRequestCount = 0; state.bufferedRequest = entry; state.bufferProcessing = false; } @@ -51291,7 +59429,7 @@ function prefinish(stream, state) { if (typeof stream._final === 'function') { state.pendingcb++; state.finalCalled = true; - processNextTick(callFinal, stream, state); + pna.nextTick(callFinal, stream, state); } else { state.prefinished = true; stream.emit('prefinish'); @@ -51315,7 +59453,7 @@ function endWritable(stream, state, cb) { state.ending = true; finishMaybe(stream, state); if (cb) { - if (state.finished) processNextTick(cb);else stream.once('finish', cb); + if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); } state.ended = true; stream.writable = false; @@ -51363,16 +59501,15 @@ Writable.prototype._destroy = function (err, cb) { this.end(); cb(err); }; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":269,"./internal/streams/destroy":275,"./internal/streams/stream":276,"_process":265,"core-util-is":146,"inherits":238,"process-nextick-args":264,"safe-buffer":277,"util-deprecate":321}],274:[function(require,module,exports){ -'use strict'; +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) -/**/ +},{"./_stream_duplex":501,"./internal/streams/destroy":507,"./internal/streams/stream":508,"_process":497,"core-util-is":392,"inherits":474,"process-nextick-args":496,"safe-buffer":509,"timers":548,"util-deprecate":557}],506:[function(require,module,exports){ +'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Buffer = require('safe-buffer').Buffer; -/**/ +var util = require('util'); function copyBuffer(src, target, offset) { src.copy(target, offset); @@ -51439,12 +59576,19 @@ module.exports = function () { return BufferList; }(); -},{"safe-buffer":277}],275:[function(require,module,exports){ + +if (util && util.inspect && util.inspect.custom) { + module.exports.prototype[util.inspect.custom] = function () { + var obj = util.inspect({ length: this.length }); + return this.constructor.name + ' ' + obj; + }; +} +},{"safe-buffer":509,"util":23}],507:[function(require,module,exports){ 'use strict'; /**/ -var processNextTick = require('process-nextick-args'); +var pna = require('process-nextick-args'); /**/ // undocumented cb() API, needed for core, not for public API @@ -51458,9 +59602,9 @@ function destroy(err, cb) { if (cb) { cb(err); } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { - processNextTick(emitErrorNT, this, err); + pna.nextTick(emitErrorNT, this, err); } - return; + return this; } // we set destroyed to true before firing error callbacks in order @@ -51477,7 +59621,7 @@ function destroy(err, cb) { this._destroy(err || null, function (err) { if (!cb && err) { - processNextTick(emitErrorNT, _this, err); + pna.nextTick(emitErrorNT, _this, err); if (_this._writableState) { _this._writableState.errorEmitted = true; } @@ -51485,6 +59629,8 @@ function destroy(err, cb) { cb(err); } }); + + return this; } function undestroy() { @@ -51512,10 +59658,10 @@ module.exports = { destroy: destroy, undestroy: undestroy }; -},{"process-nextick-args":264}],276:[function(require,module,exports){ +},{"process-nextick-args":496}],508:[function(require,module,exports){ module.exports = require('events').EventEmitter; -},{"events":209}],277:[function(require,module,exports){ +},{"events":444}],509:[function(require,module,exports){ /* eslint-disable node/no-deprecated-api */ var buffer = require('buffer') var Buffer = buffer.Buffer @@ -51579,10 +59725,34 @@ SafeBuffer.allocUnsafeSlow = function (size) { return buffer.SlowBuffer(size) } -},{"buffer":22}],278:[function(require,module,exports){ +},{"buffer":25}],510:[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. + 'use strict'; +/**/ + var Buffer = require('safe-buffer').Buffer; +/**/ var isEncoding = Buffer.isEncoding || function (encoding) { encoding = '' + encoding; @@ -51694,10 +59864,10 @@ StringDecoder.prototype.fillLast = function (buf) { }; // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. +// continuation byte. If an invalid byte is detected, -2 is returned. function utf8CheckByte(byte) { if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return -1; + return byte >> 6 === 0x02 ? -1 : -2; } // Checks at most 3 bytes at the end of a Buffer in order to detect an @@ -51711,13 +59881,13 @@ function utf8CheckIncomplete(self, buf, i) { if (nb > 0) self.lastNeed = nb - 1; return nb; } - if (--j < i) return 0; + if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 2; return nb; } - if (--j < i) return 0; + if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) { @@ -51731,7 +59901,7 @@ function utf8CheckIncomplete(self, buf, i) { // Validates as many continuation bytes for a multi-byte UTF-8 character as // needed or are available. If we see a non-continuation byte where we expect // one, we "replace" the validated continuation bytes we've seen so far with -// UTF-8 replacement characters ('\ufffd'), to match v8's UTF-8 decoding +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding // behavior. The continuation byte check is included three times in the case // where all of the continuation bytes for a character exist in the same buffer. // It is also done this way as a slight performance increase instead of using a @@ -51739,17 +59909,17 @@ function utf8CheckIncomplete(self, buf, i) { function utf8CheckExtraBytes(self, buf, p) { if ((buf[0] & 0xC0) !== 0x80) { self.lastNeed = 0; - return '\ufffd'.repeat(p); + return '\ufffd'; } if (self.lastNeed > 1 && buf.length > 1) { if ((buf[1] & 0xC0) !== 0x80) { self.lastNeed = 1; - return '\ufffd'.repeat(p + 1); + return '\ufffd'; } if (self.lastNeed > 2 && buf.length > 2) { if ((buf[2] & 0xC0) !== 0x80) { self.lastNeed = 2; - return '\ufffd'.repeat(p + 2); + return '\ufffd'; } } } @@ -51780,11 +59950,11 @@ function utf8Text(buf, i) { return buf.toString('utf8', i, end); } -// For UTF-8, a replacement character for each buffered byte of a (partial) -// character needs to be added to the output. +// For UTF-8, a replacement character is added when ending on a partial +// character. function utf8End(buf) { var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'.repeat(this.lastTotal - this.lastNeed); + if (this.lastNeed) return r + '\ufffd'; return r; } @@ -51852,10 +60022,10 @@ function simpleWrite(buf) { function simpleEnd(buf) { return buf && buf.length ? this.write(buf) : ''; } -},{"safe-buffer":277}],279:[function(require,module,exports){ +},{"safe-buffer":509}],511:[function(require,module,exports){ module.exports = require('./readable').PassThrough -},{"./readable":280}],280:[function(require,module,exports){ +},{"./readable":512}],512:[function(require,module,exports){ exports = module.exports = require('./lib/_stream_readable.js'); exports.Stream = exports; exports.Readable = exports; @@ -51864,13 +60034,13 @@ exports.Duplex = require('./lib/_stream_duplex.js'); exports.Transform = require('./lib/_stream_transform.js'); exports.PassThrough = require('./lib/_stream_passthrough.js'); -},{"./lib/_stream_duplex.js":269,"./lib/_stream_passthrough.js":270,"./lib/_stream_readable.js":271,"./lib/_stream_transform.js":272,"./lib/_stream_writable.js":273}],281:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":501,"./lib/_stream_passthrough.js":502,"./lib/_stream_readable.js":503,"./lib/_stream_transform.js":504,"./lib/_stream_writable.js":505}],513:[function(require,module,exports){ module.exports = require('./readable').Transform -},{"./readable":280}],282:[function(require,module,exports){ +},{"./readable":512}],514:[function(require,module,exports){ module.exports = require('./lib/_stream_writable.js'); -},{"./lib/_stream_writable.js":273}],283:[function(require,module,exports){ +},{"./lib/_stream_writable.js":505}],515:[function(require,module,exports){ /** * Copyright (c) 2014-present, Facebook, Inc. * @@ -51878,7 +60048,7 @@ module.exports = require('./lib/_stream_writable.js'); * LICENSE file in the root directory of this source tree. */ -!(function(global) { +var runtime = (function (exports) { "use strict"; var Op = Object.prototype; @@ -51889,23 +60059,6 @@ module.exports = require('./lib/_stream_writable.js'); var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - var inModule = typeof module === "object"; - var runtime = global.regeneratorRuntime; - if (runtime) { - if (inModule) { - // If regeneratorRuntime is defined globally and we're in a module, - // make the exports object identical to regeneratorRuntime. - module.exports = runtime; - } - // Don't bother evaluating the rest of this file if the runtime was - // already defined globally. - return; - } - - // Define the runtime globally (as expected by generated code) as either - // module.exports (if we're in a module) or a new, empty object. - runtime = global.regeneratorRuntime = inModule ? module.exports : {}; - function wrap(innerFn, outerFn, self, tryLocsList) { // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; @@ -51918,7 +60071,7 @@ module.exports = require('./lib/_stream_writable.js'); return generator; } - runtime.wrap = wrap; + exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion // record like context.tryEntries[i].completion. This interface could @@ -51989,7 +60142,7 @@ module.exports = require('./lib/_stream_writable.js'); }); } - runtime.isGeneratorFunction = function(genFun) { + exports.isGeneratorFunction = function(genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || @@ -51999,7 +60152,7 @@ module.exports = require('./lib/_stream_writable.js'); : false; }; - runtime.mark = function(genFun) { + exports.mark = function(genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { @@ -52016,7 +60169,7 @@ module.exports = require('./lib/_stream_writable.js'); // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test // `hasOwn.call(value, "__await")` to determine if the yielded value is // meant to be awaited. - runtime.awrap = function(arg) { + exports.awrap = function(arg) { return { __await: arg }; }; @@ -52091,17 +60244,17 @@ module.exports = require('./lib/_stream_writable.js'); AsyncIterator.prototype[asyncIteratorSymbol] = function () { return this; }; - runtime.AsyncIterator = AsyncIterator; + exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of // AsyncIterator objects; they just return a Promise for the value of // the final result produced by the iterator. - runtime.async = function(innerFn, outerFn, self, tryLocsList) { + exports.async = function(innerFn, outerFn, self, tryLocsList) { var iter = new AsyncIterator( wrap(innerFn, outerFn, self, tryLocsList) ); - return runtime.isGeneratorFunction(outerFn) + return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. : iter.next().then(function(result) { return result.done ? result.value : iter.next(); @@ -52198,7 +60351,8 @@ module.exports = require('./lib/_stream_writable.js'); context.delegate = null; if (context.method === "throw") { - if (delegate.iterator.return) { + // Note: ["return"] must be used for ES3 parsing compatibility. + if (delegate.iterator["return"]) { // If the delegate iterator has a return method, give it a // chance to clean up. context.method = "return"; @@ -52318,7 +60472,7 @@ module.exports = require('./lib/_stream_writable.js'); this.reset(true); } - runtime.keys = function(object) { + exports.keys = function(object) { var keys = []; for (var key in object) { keys.push(key); @@ -52379,7 +60533,7 @@ module.exports = require('./lib/_stream_writable.js'); // Return an iterator with no values. return { next: doneResult }; } - runtime.values = values; + exports.values = values; function doneResult() { return { value: undefined, done: true }; @@ -52584,16 +60738,37 @@ module.exports = require('./lib/_stream_writable.js'); return ContinueSentinel; } }; -})( - // In sloppy mode, unbound `this` refers to the global object, fallback to - // Function constructor if we're in global strict mode. That is sadly a form - // of indirect eval which violates Content Security Policy. - (function() { - return this || (typeof self === "object" && self); - })() || Function("return this")() -); - -},{}],284:[function(require,module,exports){ + + // Regardless of whether this script is executing as a CommonJS module + // or not, return the runtime object so that we can declare the variable + // regeneratorRuntime in the outer scope, which allows this module to be + // injected easily by `bin/regenerator --include-runtime script.js`. + return exports; + +}( + // If this script is executing as a CommonJS module, use module.exports + // as the regeneratorRuntime namespace. Otherwise create a new empty + // object. Either way, the resulting object will be used to initialize + // the regeneratorRuntime variable at the top of this file. + typeof module === "object" ? module.exports : {} +)); + +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + // This module should not be running in strict mode, so the above + // assignment should always work unless something is misconfigured. Just + // in case runtime.js accidentally runs in strict mode, we can escape + // strict mode using a global Function call. This could conceivably fail + // if a Content Security Policy forbids using Function, but in that case + // the proper solution is to fix the accidental strict mode problem. If + // you've misconfigured your bundler to force strict mode and applied a + // CSP to forbid Function, and you're not willing to fix either of those + // problems, please detail your unique predicament in a GitHub issue. + Function("r", "regeneratorRuntime = r")(runtime); +} + +},{}],516:[function(require,module,exports){ /*! * repeat-string * @@ -52665,7 +60840,7 @@ function repeat(str, num) { return res; } -},{}],285:[function(require,module,exports){ +},{}],517:[function(require,module,exports){ var core = require('./lib/core'); var async = require('./lib/async'); async.core = core; @@ -52675,18 +60850,50 @@ async.sync = require('./lib/sync'); exports = async; module.exports = async; -},{"./lib/async":286,"./lib/core":289,"./lib/sync":291}],286:[function(require,module,exports){ +},{"./lib/async":518,"./lib/core":521,"./lib/sync":524}],518:[function(require,module,exports){ (function (process){ var core = require('./core'); var fs = require('fs'); var path = require('path'); var caller = require('./caller.js'); var nodeModulesPaths = require('./node-modules-paths.js'); +var normalizeOptions = require('./normalize-options.js'); + +var defaultIsFile = function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultIsDir = function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var maybeUnwrapSymlink = function maybeUnwrapSymlink(x, opts, cb) { + if (opts && opts.preserveSymlinks === false) { + fs.realpath(x, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); + else cb(null, realPathErr ? x : realPath); + }); + } else { + cb(null, x); + } +}; module.exports = function resolve(x, options, callback) { var cb = callback; - var opts = options || {}; - if (typeof opts === 'function') { + var opts = options; + if (typeof options === 'function') { cb = opts; opts = {}; } @@ -52697,47 +60904,72 @@ module.exports = function resolve(x, options, callback) { }); } - var isFile = opts.isFile || function (file, cb) { - fs.stat(file, function (err, stat) { - if (!err) { - return cb(null, stat.isFile() || stat.isFIFO()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); - }; + opts = normalizeOptions(x, opts); + + var isFile = opts.isFile || defaultIsFile; + var isDirectory = opts.isDirectory || defaultIsDir; var readFile = opts.readFile || fs.readFile; var extensions = opts.extensions || ['.js']; - var y = opts.basedir || path.dirname(caller()); + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; opts.paths = opts.paths || []; - if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) { - var res = path.resolve(y, x); - if (x === '..' || x.slice(-1) === '/') res += '/'; - if (/\/$/.test(x) && res === y) { - loadAsDirectory(res, opts.package, onfile); - } else loadAsFile(res, opts.package, onfile); - } else loadNodeModules(x, y, function (err, n, pkg) { - if (err) cb(err); - else if (n) cb(null, n, pkg); - else if (core[x]) return cb(null, x); - else { - var moduleError = new Error("Cannot find module '" + x + "' from '" + y + "'"); - moduleError.code = 'MODULE_NOT_FOUND'; - cb(moduleError); + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = path.resolve(basedir); + + maybeUnwrapSymlink( + absoluteStart, + opts, + function (err, realStart) { + if (err) cb(err); + else init(realStart); } - }); + ); + + var res; + function init(basedir) { + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + res = path.resolve(basedir, x); + if (x === '..' || x.slice(-1) === '/') res += '/'; + if ((/\/$/).test(x) && res === basedir) { + loadAsDirectory(res, opts.package, onfile); + } else loadAsFile(res, opts.package, onfile); + } else loadNodeModules(x, basedir, function (err, n, pkg) { + if (err) cb(err); + else if (core[x]) return cb(null, x); + else if (n) { + return maybeUnwrapSymlink(n, opts, function (err, realN) { + if (err) { + cb(err); + } else { + cb(null, realN, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } function onfile(err, m, pkg) { if (err) cb(err); else if (m) cb(null, m, pkg); else loadAsDirectory(res, function (err, d, pkg) { if (err) cb(err); - else if (d) cb(null, d, pkg); - else { - var moduleError = new Error("Cannot find module '" + x + "' from '" + y + "'"); + else if (d) { + maybeUnwrapSymlink(d, opts, function (err, realD) { + if (err) { + cb(err); + } else { + cb(null, realD, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); moduleError.code = 'MODULE_NOT_FOUND'; cb(moduleError); } @@ -52791,7 +61023,7 @@ module.exports = function resolve(x, options, callback) { if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { return cb(null); } - if (/[/\\]node_modules[/\\]*$/.test(dir)) return cb(null); + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); var pkgfile = path.join(dir, 'package.json'); isFile(pkgfile, function (err, ex) { @@ -52834,6 +61066,11 @@ module.exports = function resolve(x, options, callback) { } if (pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + return cb(mainError); + } if (pkg.main === '.' || pkg.main === './') { pkg.main = 'index'; } @@ -52861,13 +61098,19 @@ module.exports = function resolve(x, options, callback) { if (dirs.length === 0) return cb(null, undefined); var dir = dirs[0]; - var file = path.join(dir, x); - loadAsFile(file, undefined, onfile); + isDirectory(dir, isdir); + + function isdir(err, isdir) { + if (err) return cb(err); + if (!isdir) return processDirs(cb, dirs.slice(1)); + var file = path.join(dir, x); + loadAsFile(file, opts.package, onfile); + } function onfile(err, m, pkg) { if (err) return cb(err); if (m) return cb(null, m, pkg); - loadAsDirectory(path.join(dir, x), undefined, ondir); + loadAsDirectory(path.join(dir, x), opts.package, ondir); } function ondir(err, n, pkg) { @@ -52877,12 +61120,13 @@ module.exports = function resolve(x, options, callback) { } } function loadNodeModules(x, start, cb) { - processDirs(cb, nodeModulesPaths(start, opts)); + processDirs(cb, nodeModulesPaths(start, opts, x)); } }; }).call(this,require('_process')) -},{"./caller.js":287,"./core":289,"./node-modules-paths.js":290,"_process":265,"fs":21,"path":260}],287:[function(require,module,exports){ + +},{"./caller.js":519,"./core":521,"./node-modules-paths.js":522,"./normalize-options.js":523,"_process":497,"fs":24,"path":493}],519:[function(require,module,exports){ module.exports = function () { // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi var origPrepareStackTrace = Error.prepareStackTrace; @@ -52892,109 +61136,149 @@ module.exports = function () { return stack[2].getFileName(); }; -},{}],288:[function(require,module,exports){ +},{}],520:[function(require,module,exports){ module.exports={ - "*": [ - "assert", - "buffer_ieee754", - "buffer", - "child_process", - "cluster", - "console", - "constants", - "crypto", - "_debugger", - "dgram", - "dns", - "domain", - "events", - "freelist", - "fs", - "http", - "https", - "_linklist", - "module", - "net", - "os", - "path", - "punycode", - "querystring", - "readline", - "repl", - "stream", - "string_decoder", - "sys", - "timers", - "tls", - "tty", - "url", - "util", - "vm", - "zlib" - ], - "0.11": [ - "_http_server" - ], - "1.0": [ - "process", - "v8" - ] -} - -},{}],289:[function(require,module,exports){ + "assert": true, + "async_hooks": ">= 8", + "buffer_ieee754": "< 0.9.7", + "buffer": true, + "child_process": true, + "cluster": true, + "console": true, + "constants": true, + "crypto": true, + "_debug_agent": ">= 1 && < 8", + "_debugger": "< 8", + "dgram": true, + "dns": true, + "domain": true, + "events": true, + "freelist": "< 6", + "fs": true, + "fs/promises": ">= 10 && < 10.1", + "_http_agent": ">= 0.11.1", + "_http_client": ">= 0.11.1", + "_http_common": ">= 0.11.1", + "_http_incoming": ">= 0.11.1", + "_http_outgoing": ">= 0.11.1", + "_http_server": ">= 0.11.1", + "http": true, + "http2": ">= 8.8", + "https": true, + "inspector": ">= 8.0.0", + "_linklist": "< 8", + "module": true, + "net": true, + "node-inspect/lib/_inspect": ">= 7.6.0 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12", + "os": true, + "path": true, + "perf_hooks": ">= 8.5", + "process": ">= 1", + "punycode": true, + "querystring": true, + "readline": true, + "repl": true, + "smalloc": ">= 0.11.5 && < 3", + "_stream_duplex": ">= 0.9.4", + "_stream_transform": ">= 0.9.4", + "_stream_wrap": ">= 1.4.1", + "_stream_passthrough": ">= 0.9.4", + "_stream_readable": ">= 0.9.4", + "_stream_writable": ">= 0.9.4", + "stream": true, + "string_decoder": true, + "sys": true, + "timers": true, + "_tls_common": ">= 0.11.13", + "_tls_legacy": ">= 0.11.3 && < 10", + "_tls_wrap": ">= 0.11.3", + "tls": true, + "trace_events": ">= 10", + "tty": true, + "url": true, + "util": true, + "v8/tools/arguments": ">= 10 && < 12", + "v8/tools/codemap": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/consarray": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/csvparser": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/logreader": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/profile_view": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/splaytree": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8": ">= 1", + "vm": true, + "worker_threads": ">= 11.7", + "zlib": true +} + +},{}],521:[function(require,module,exports){ (function (process){ var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; -function versionIncluded(version) { - if (version === '*') return true; - var versionParts = version.split('.'); +function specifierIncluded(specifier) { + var parts = specifier.split(' '); + var op = parts.length > 1 ? parts[0] : '='; + var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); + for (var i = 0; i < 3; ++i) { - if ((current[i] || 0) >= (versionParts[i] || 0)) return true; + var cur = Number(current[i] || 0); + var ver = Number(versionParts[i] || 0); + if (cur === ver) { + continue; // eslint-disable-line no-restricted-syntax, no-continue + } + if (op === '<') { + return cur < ver; + } else if (op === '>=') { + return cur >= ver; + } else { + return false; + } } - return false; + return op === '>='; +} + +function matchesRange(range) { + var specifiers = range.split(/ ?&& ?/); + if (specifiers.length === 0) { return false; } + for (var i = 0; i < specifiers.length; ++i) { + if (!specifierIncluded(specifiers[i])) { return false; } + } + return true; +} + +function versionIncluded(specifierValue) { + if (typeof specifierValue === 'boolean') { return specifierValue; } + if (specifierValue && typeof specifierValue === 'object') { + for (var i = 0; i < specifierValue.length; ++i) { + if (matchesRange(specifierValue[i])) { return true; } + } + return false; + } + return matchesRange(specifierValue); } var data = require('./core.json'); var core = {}; -for (var version in data) { // eslint-disable-line no-restricted-syntax - if (Object.prototype.hasOwnProperty.call(data, version) && versionIncluded(version)) { - for (var i = 0; i < data[version].length; ++i) { - core[data[version][i]] = true; - } +for (var mod in data) { // eslint-disable-line no-restricted-syntax + if (Object.prototype.hasOwnProperty.call(data, mod)) { + core[mod] = versionIncluded(data[mod]); } } module.exports = core; }).call(this,require('_process')) -},{"./core.json":288,"_process":265}],290:[function(require,module,exports){ + +},{"./core.json":520,"_process":497}],522:[function(require,module,exports){ var path = require('path'); -var fs = require('fs'); var parse = path.parse || require('path-parse'); -module.exports = function nodeModulesPaths(start, opts) { - var modules = opts && opts.moduleDirectory - ? [].concat(opts.moduleDirectory) - : ['node_modules']; - - // ensure that `start` is an absolute path at this point, - // resolving against the process' current working directory - var absoluteStart = path.resolve(start); - - if (opts && opts.preserveSymlinks === false) { - try { - absoluteStart = fs.realpathSync(absoluteStart); - } catch (err) { - if (err.code !== 'ENOENT') { - throw err; - } - } - } - +var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { var prefix = '/'; - if (/^([A-Za-z]:)/.test(absoluteStart)) { + if ((/^([A-Za-z]:)/).test(absoluteStart)) { prefix = ''; - } else if (/^\\\\/.test(absoluteStart)) { + } else if ((/^\\\\/).test(absoluteStart)) { prefix = '\\\\'; } @@ -53005,1641 +61289,399 @@ module.exports = function nodeModulesPaths(start, opts) { parsed = parse(parsed.dir); } - var dirs = paths.reduce(function (dirs, aPath) { - return dirs.concat(modules.map(function (moduleDir) { - return path.join(prefix, aPath, moduleDir); - })); - }, []); - - return opts && opts.paths ? dirs.concat(opts.paths) : dirs; -}; - -},{"fs":21,"path":260,"path-parse":263}],291:[function(require,module,exports){ -var core = require('./core'); -var fs = require('fs'); -var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); - -module.exports = function (x, options) { - if (typeof x !== 'string') { - throw new TypeError('Path must be a string.'); - } - var opts = options || {}; - var isFile = opts.isFile || function (file) { - try { - var stat = fs.statSync(file); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isFile() || stat.isFIFO(); - }; - var readFileSync = opts.readFileSync || fs.readFileSync; - - var extensions = opts.extensions || ['.js']; - var y = opts.basedir || path.dirname(caller()); - - opts.paths = opts.paths || []; - - if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) { - var res = path.resolve(y, x); - if (x === '..' || x.slice(-1) === '/') res += '/'; - var m = loadAsFileSync(res) || loadAsDirectorySync(res); - if (m) return m; - } else { - var n = loadNodeModulesSync(x, y); - if (n) return n; - } - - if (core[x]) return x; - - var err = new Error("Cannot find module '" + x + "' from '" + y + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; - - function loadAsFileSync(x) { - if (isFile(x)) { - return x; - } - - for (var i = 0; i < extensions.length; i++) { - var file = x + extensions[i]; - if (isFile(file)) { - return file; - } - } - } - - function loadAsDirectorySync(x) { - var pkgfile = path.join(x, '/package.json'); - if (isFile(pkgfile)) { - try { - var body = readFileSync(pkgfile, 'UTF8'); - var pkg = JSON.parse(body); - - if (opts.packageFilter) { - pkg = opts.packageFilter(pkg, x); - } - - if (pkg.main) { - if (pkg.main === '.' || pkg.main === './') { - pkg.main = 'index'; - } - var m = loadAsFileSync(path.resolve(x, pkg.main)); - if (m) return m; - var n = loadAsDirectorySync(path.resolve(x, pkg.main)); - if (n) return n; - } - } catch (e) {} - } - - return loadAsFileSync(path.join(x, '/index')); - } - - function loadNodeModulesSync(x, start) { - var dirs = nodeModulesPaths(start, opts); - for (var i = 0; i < dirs.length; i++) { - var dir = dirs[i]; - var m = loadAsFileSync(path.join(dir, '/', x)); - if (m) return m; - var n = loadAsDirectorySync(path.join(dir, '/', x)); - if (n) return n; - } - } -}; - -},{"./caller.js":287,"./core":289,"./node-modules-paths.js":290,"fs":21,"path":260}],292:[function(require,module,exports){ -(function (global){ -'use strict'; - -var width = 256;// each RC4 output is 0 <= x < 256 -var chunks = 6;// at least six RC4 outputs for each double -var digits = 52;// there are 52 significant digits in a double -var pool = [];// pool: entropy pool starts empty -var GLOBAL = typeof global === 'undefined' ? window : global; - -// -// The following constants are related to IEEE 754 limits. -// -var startdenom = Math.pow(width, chunks), - significance = Math.pow(2, digits), - overflow = significance * 2, - mask = width - 1; - - -var oldRandom = Math.random; - -// -// seedrandom() -// This is the seedrandom function described above. -// -module.exports = function(seed, options) { - if (options && options.global === true) { - options.global = false; - Math.random = module.exports(seed, options); - options.global = true; - return Math.random; - } - var use_entropy = (options && options.entropy) || false; - var key = []; - - // Flatten the seed string or build one from local entropy if needed. - var shortseed = mixkey(flatten( - use_entropy ? [seed, tostring(pool)] : - 0 in arguments ? seed : autoseed(), 3), key); - - // Use the seed to initialize an ARC4 generator. - var arc4 = new ARC4(key); - - // Mix the randomness into accumulated entropy. - mixkey(tostring(arc4.S), pool); - - // Override Math.random - - // This function returns a random double in [0, 1) that contains - // randomness in every bit of the mantissa of the IEEE 754 value. - - return function() { // Closure to return a random double: - var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48 - d = startdenom, // and denominator d = 2 ^ 48. - x = 0; // and no 'extra last byte'. - while (n < significance) { // Fill up all significant digits by - n = (n + x) * width; // shifting numerator and - d *= width; // denominator and generating a - x = arc4.g(1); // new least-significant-byte. - } - while (n >= overflow) { // To avoid rounding up, before adding - n /= 2; // last byte, shift everything - d /= 2; // right using integer Math until - x >>>= 1; // we have exactly the desired bits. - } - return (n + x) / d; // Form the number within [0, 1). - }; -}; - -module.exports.resetGlobal = function () { - Math.random = oldRandom; -}; - -// -// ARC4 -// -// An ARC4 implementation. The constructor takes a key in the form of -// an array of at most (width) integers that should be 0 <= x < (width). -// -// The g(count) method returns a pseudorandom integer that concatenates -// the next (count) outputs from ARC4. Its return value is a number x -// that is in the range 0 <= x < (width ^ count). -// -/** @constructor */ -function ARC4(key) { - var t, keylen = key.length, - me = this, i = 0, j = me.i = me.j = 0, s = me.S = []; - - // The empty key [] is treated as [0]. - if (!keylen) { key = [keylen++]; } - - // Set up S using the standard key scheduling algorithm. - while (i < width) { - s[i] = i++; - } - for (i = 0; i < width; i++) { - s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))]; - s[j] = t; - } - - // The "g" method returns the next (count) outputs as one number. - (me.g = function(count) { - // Using instance members instead of closure state nearly doubles speed. - var t, r = 0, - i = me.i, j = me.j, s = me.S; - while (count--) { - t = s[i = mask & (i + 1)]; - r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))]; - } - me.i = i; me.j = j; - return r; - // For robust unpredictability discard an initial batch of values. - // See http://www.rsa.com/rsalabs/node.asp?id=2009 - })(width); -} - -// -// flatten() -// Converts an object tree to nested arrays of strings. -// -function flatten(obj, depth) { - var result = [], typ = (typeof obj)[0], prop; - if (depth && typ == 'o') { - for (prop in obj) { - try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {} - } - } - return (result.length ? result : typ == 's' ? obj : obj + '\0'); -} - -// -// mixkey() -// Mixes a string seed into a key that is an array of integers, and -// returns a shortened string seed that is equivalent to the result key. -// -function mixkey(seed, key) { - var stringseed = seed + '', smear, j = 0; - while (j < stringseed.length) { - key[mask & j] = - mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++)); - } - return tostring(key); -} - -// -// autoseed() -// Returns an object for autoseeding, using window.crypto if available. -// -/** @param {Uint8Array=} seed */ -function autoseed(seed) { - try { - GLOBAL.crypto.getRandomValues(seed = new Uint8Array(width)); - return tostring(seed); - } catch (e) { - return [+new Date, GLOBAL, GLOBAL.navigator && GLOBAL.navigator.plugins, - GLOBAL.screen, tostring(pool)]; - } -} - -// -// tostring() -// Converts an array of charcodes to a string -// -function tostring(a) { - return String.fromCharCode.apply(0, a); -} - -// -// When seedrandom.js is loaded, we immediately mix a few bits -// from the built-in RNG into the entropy pool. Because we do -// not want to intefere with determinstic PRNG state later, -// seedrandom will not call Math.random on its own again after -// initialization. -// -mixkey(Math.random(), pool); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],293:[function(require,module,exports){ -(function (process){ -exports = module.exports = SemVer; - -// The debug function is excluded entirely from the minified version. -/* nomin */ var debug; -/* nomin */ if (typeof process === 'object' && - /* nomin */ process.env && - /* nomin */ process.env.NODE_DEBUG && - /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG)) - /* nomin */ debug = function() { - /* nomin */ var args = Array.prototype.slice.call(arguments, 0); - /* nomin */ args.unshift('SEMVER'); - /* nomin */ console.log.apply(console, args); - /* nomin */ }; -/* nomin */ else - /* nomin */ debug = function() {}; - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -exports.SEMVER_SPEC_VERSION = '2.0.0'; - -var MAX_LENGTH = 256; -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; - -// Max safe segment length for coercion. -var MAX_SAFE_COMPONENT_LENGTH = 16; - -// The actual regexps go on exports.re -var re = exports.re = []; -var src = exports.src = []; -var R = 0; - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -var NUMERICIDENTIFIER = R++; -src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; -var NUMERICIDENTIFIERLOOSE = R++; -src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; - - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -var NONNUMERICIDENTIFIER = R++; -src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; - - -// ## Main Version -// Three dot-separated numeric identifiers. - -var MAINVERSION = R++; -src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')'; - -var MAINVERSIONLOOSE = R++; -src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -var PRERELEASEIDENTIFIER = R++; -src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + - '|' + src[NONNUMERICIDENTIFIER] + ')'; - -var PRERELEASEIDENTIFIERLOOSE = R++; -src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + - '|' + src[NONNUMERICIDENTIFIER] + ')'; - - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -var PRERELEASE = R++; -src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + - '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; - -var PRERELEASELOOSE = R++; -src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + - '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -var BUILDIDENTIFIER = R++; -src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -var BUILD = R++; -src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + - '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; - - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -var FULL = R++; -var FULLPLAIN = 'v?' + src[MAINVERSION] + - src[PRERELEASE] + '?' + - src[BUILD] + '?'; - -src[FULL] = '^' + FULLPLAIN + '$'; - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + - src[PRERELEASELOOSE] + '?' + - src[BUILD] + '?'; - -var LOOSE = R++; -src[LOOSE] = '^' + LOOSEPLAIN + '$'; - -var GTLT = R++; -src[GTLT] = '((?:<|>)?=?)'; - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -var XRANGEIDENTIFIERLOOSE = R++; -src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; -var XRANGEIDENTIFIER = R++; -src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; - -var XRANGEPLAIN = R++; -src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:' + src[PRERELEASE] + ')?' + - src[BUILD] + '?' + - ')?)?'; - -var XRANGEPLAINLOOSE = R++; -src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:' + src[PRERELEASELOOSE] + ')?' + - src[BUILD] + '?' + - ')?)?'; - -var XRANGE = R++; -src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; -var XRANGELOOSE = R++; -src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -var COERCE = R++; -src[COERCE] = '(?:^|[^\\d])' + - '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:$|[^\\d])'; - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -var LONETILDE = R++; -src[LONETILDE] = '(?:~>?)'; - -var TILDETRIM = R++; -src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; -re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); -var tildeTrimReplace = '$1~'; - -var TILDE = R++; -src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; -var TILDELOOSE = R++; -src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -var LONECARET = R++; -src[LONECARET] = '(?:\\^)'; - -var CARETTRIM = R++; -src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; -re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); -var caretTrimReplace = '$1^'; - -var CARET = R++; -src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; -var CARETLOOSE = R++; -src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -var COMPARATORLOOSE = R++; -src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; -var COMPARATOR = R++; -src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; - - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -var COMPARATORTRIM = R++; -src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + - '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; - -// this one has to use the /g flag -re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); -var comparatorTrimReplace = '$1$2$3'; - - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -var HYPHENRANGE = R++; -src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAIN] + ')' + - '\\s*$'; - -var HYPHENRANGELOOSE = R++; -src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s*$'; - -// Star ranges basically just allow anything at all. -var STAR = R++; -src[STAR] = '(<|>)?=?\\s*\\*'; - -// Compile to actual regexp objects. -// All are flag-free, unless they were created above with a flag. -for (var i = 0; i < R; i++) { - debug(i, src[i]); - if (!re[i]) - re[i] = new RegExp(src[i]); -} - -exports.parse = parse; -function parse(version, loose) { - if (version instanceof SemVer) - return version; - - if (typeof version !== 'string') - return null; - - if (version.length > MAX_LENGTH) - return null; - - var r = loose ? re[LOOSE] : re[FULL]; - if (!r.test(version)) - return null; - - try { - return new SemVer(version, loose); - } catch (er) { - return null; - } -} - -exports.valid = valid; -function valid(version, loose) { - var v = parse(version, loose); - return v ? v.version : null; -} - - -exports.clean = clean; -function clean(version, loose) { - var s = parse(version.trim().replace(/^[=v]+/, ''), loose); - return s ? s.version : null; -} - -exports.SemVer = SemVer; - -function SemVer(version, loose) { - if (version instanceof SemVer) { - if (version.loose === loose) - return version; - else - version = version.version; - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version); - } - - if (version.length > MAX_LENGTH) - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') - - if (!(this instanceof SemVer)) - return new SemVer(version, loose); - - debug('SemVer', version, loose); - this.loose = loose; - var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); - - if (!m) - throw new TypeError('Invalid Version: ' + version); - - this.raw = version; - - // these are actually numbers - this.major = +m[1]; - this.minor = +m[2]; - this.patch = +m[3]; - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) - throw new TypeError('Invalid major version') - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) - throw new TypeError('Invalid minor version') - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) - throw new TypeError('Invalid patch version') - - // numberify any prerelease numeric ids - if (!m[4]) - this.prerelease = []; - else - this.prerelease = m[4].split('.').map(function(id) { - if (/^[0-9]+$/.test(id)) { - var num = +id; - if (num >= 0 && num < MAX_SAFE_INTEGER) - return num; - } - return id; - }); - - this.build = m[5] ? m[5].split('.') : []; - this.format(); -} - -SemVer.prototype.format = function() { - this.version = this.major + '.' + this.minor + '.' + this.patch; - if (this.prerelease.length) - this.version += '-' + this.prerelease.join('.'); - return this.version; -}; - -SemVer.prototype.toString = function() { - return this.version; -}; - -SemVer.prototype.compare = function(other) { - debug('SemVer.compare', this.version, this.loose, other); - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); - - return this.compareMain(other) || this.comparePre(other); -}; - -SemVer.prototype.compareMain = function(other) { - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); - - return compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch); -}; - -SemVer.prototype.comparePre = function(other) { - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) - return -1; - else if (!this.prerelease.length && other.prerelease.length) - return 1; - else if (!this.prerelease.length && !other.prerelease.length) - return 0; - - var i = 0; - do { - var a = this.prerelease[i]; - var b = other.prerelease[i]; - debug('prerelease compare', i, a, b); - if (a === undefined && b === undefined) - return 0; - else if (b === undefined) - return 1; - else if (a === undefined) - return -1; - else if (a === b) - continue; - else - return compareIdentifiers(a, b); - } while (++i); -}; - -// preminor will bump the version up to the next minor release, and immediately -// down to pre-release. premajor and prepatch work the same way. -SemVer.prototype.inc = function(release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0; - this.patch = 0; - this.minor = 0; - this.major++; - this.inc('pre', identifier); - break; - case 'preminor': - this.prerelease.length = 0; - this.patch = 0; - this.minor++; - this.inc('pre', identifier); - break; - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0; - this.inc('patch', identifier); - this.inc('pre', identifier); - break; - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) - this.inc('patch', identifier); - this.inc('pre', identifier); - break; - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) - this.major++; - this.minor = 0; - this.patch = 0; - this.prerelease = []; - break; - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) - this.minor++; - this.patch = 0; - this.prerelease = []; - break; - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) - this.patch++; - this.prerelease = []; - break; - // This probably shouldn't be used publicly. - // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) - this.prerelease = [0]; - else { - var i = this.prerelease.length; - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++; - i = -2; - } - } - if (i === -1) // didn't increment anything - this.prerelease.push(0); - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) - this.prerelease = [identifier, 0]; - } else - this.prerelease = [identifier, 0]; - } - break; - - default: - throw new Error('invalid increment argument: ' + release); - } - this.format(); - this.raw = this.version; - return this; -}; - -exports.inc = inc; -function inc(version, release, loose, identifier) { - if (typeof(loose) === 'string') { - identifier = loose; - loose = undefined; - } - - try { - return new SemVer(version, loose).inc(release, identifier).version; - } catch (er) { - return null; - } -} - -exports.diff = diff; -function diff(version1, version2) { - if (eq(version1, version2)) { - return null; - } else { - var v1 = parse(version1); - var v2 = parse(version2); - if (v1.prerelease.length || v2.prerelease.length) { - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return 'pre'+key; - } - } - } - return 'prerelease'; - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return key; - } - } - } - } -} - -exports.compareIdentifiers = compareIdentifiers; - -var numeric = /^[0-9]+$/; -function compareIdentifiers(a, b) { - var anum = numeric.test(a); - var bnum = numeric.test(b); - - if (anum && bnum) { - a = +a; - b = +b; - } - - return (anum && !bnum) ? -1 : - (bnum && !anum) ? 1 : - a < b ? -1 : - a > b ? 1 : - 0; -} - -exports.rcompareIdentifiers = rcompareIdentifiers; -function rcompareIdentifiers(a, b) { - return compareIdentifiers(b, a); -} - -exports.major = major; -function major(a, loose) { - return new SemVer(a, loose).major; -} - -exports.minor = minor; -function minor(a, loose) { - return new SemVer(a, loose).minor; -} - -exports.patch = patch; -function patch(a, loose) { - return new SemVer(a, loose).patch; -} - -exports.compare = compare; -function compare(a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)); -} - -exports.compareLoose = compareLoose; -function compareLoose(a, b) { - return compare(a, b, true); -} - -exports.rcompare = rcompare; -function rcompare(a, b, loose) { - return compare(b, a, loose); -} - -exports.sort = sort; -function sort(list, loose) { - return list.sort(function(a, b) { - return exports.compare(a, b, loose); - }); -} - -exports.rsort = rsort; -function rsort(list, loose) { - return list.sort(function(a, b) { - return exports.rcompare(a, b, loose); - }); -} - -exports.gt = gt; -function gt(a, b, loose) { - return compare(a, b, loose) > 0; -} - -exports.lt = lt; -function lt(a, b, loose) { - return compare(a, b, loose) < 0; -} - -exports.eq = eq; -function eq(a, b, loose) { - return compare(a, b, loose) === 0; -} - -exports.neq = neq; -function neq(a, b, loose) { - return compare(a, b, loose) !== 0; -} - -exports.gte = gte; -function gte(a, b, loose) { - return compare(a, b, loose) >= 0; -} - -exports.lte = lte; -function lte(a, b, loose) { - return compare(a, b, loose) <= 0; -} - -exports.cmp = cmp; -function cmp(a, op, b, loose) { - var ret; - switch (op) { - case '===': - if (typeof a === 'object') a = a.version; - if (typeof b === 'object') b = b.version; - ret = a === b; - break; - case '!==': - if (typeof a === 'object') a = a.version; - if (typeof b === 'object') b = b.version; - ret = a !== b; - break; - case '': case '=': case '==': ret = eq(a, b, loose); break; - case '!=': ret = neq(a, b, loose); break; - case '>': ret = gt(a, b, loose); break; - case '>=': ret = gte(a, b, loose); break; - case '<': ret = lt(a, b, loose); break; - case '<=': ret = lte(a, b, loose); break; - default: throw new TypeError('Invalid operator: ' + op); - } - return ret; -} - -exports.Comparator = Comparator; -function Comparator(comp, loose) { - if (comp instanceof Comparator) { - if (comp.loose === loose) - return comp; - else - comp = comp.value; - } - - if (!(this instanceof Comparator)) - return new Comparator(comp, loose); - - debug('comparator', comp, loose); - this.loose = loose; - this.parse(comp); - - if (this.semver === ANY) - this.value = ''; - else - this.value = this.operator + this.semver.version; - - debug('comp', this); -} - -var ANY = {}; -Comparator.prototype.parse = function(comp) { - var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; - var m = comp.match(r); - - if (!m) - throw new TypeError('Invalid comparator: ' + comp); - - this.operator = m[1]; - if (this.operator === '=') - this.operator = ''; - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) - this.semver = ANY; - else - this.semver = new SemVer(m[2], this.loose); -}; - -Comparator.prototype.toString = function() { - return this.value; + return paths.reduce(function (dirs, aPath) { + return dirs.concat(modules.map(function (moduleDir) { + return path.resolve(prefix, aPath, moduleDir); + })); + }, []); }; -Comparator.prototype.test = function(version) { - debug('Comparator.test', version, this.loose); - - if (this.semver === ANY) - return true; +module.exports = function nodeModulesPaths(start, opts, request) { + var modules = opts && opts.moduleDirectory + ? [].concat(opts.moduleDirectory) + : ['node_modules']; - if (typeof version === 'string') - version = new SemVer(version, this.loose); + if (opts && typeof opts.paths === 'function') { + return opts.paths( + request, + start, + function () { return getNodeModulesDirs(start, modules); }, + opts + ); + } - return cmp(version, this.operator, this.semver, this.loose); + var dirs = getNodeModulesDirs(start, modules); + return opts && opts.paths ? dirs.concat(opts.paths) : dirs; }; -Comparator.prototype.intersects = function(comp, loose) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required'); - } - - var rangeTmp; - - if (this.operator === '') { - rangeTmp = new Range(comp.value, loose); - return satisfies(this.value, rangeTmp, loose); - } else if (comp.operator === '') { - rangeTmp = new Range(this.value, loose); - return satisfies(comp.semver, rangeTmp, loose); - } - - var sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>'); - var sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<'); - var sameSemVer = this.semver.version === comp.semver.version; - var differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<='); - var oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, loose) && - ((this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<')); - var oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, loose) && - ((this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>')); +},{"path":493,"path-parse":495}],523:[function(require,module,exports){ +module.exports = function (x, opts) { + /** + * This file is purposefully a passthrough. It's expected that third-party + * environments will override it at runtime in order to inject special logic + * into `resolve` (by manipulating the options). One such example is the PnP + * code path in Yarn. + */ - return sameDirectionIncreasing || sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; + return opts || {}; }; +},{}],524:[function(require,module,exports){ +(function (process){ +var core = require('./core'); +var fs = require('fs'); +var path = require('path'); +var caller = require('./caller.js'); +var nodeModulesPaths = require('./node-modules-paths.js'); +var normalizeOptions = require('./normalize-options.js'); -exports.Range = Range; -function Range(range, loose) { - if (range instanceof Range) { - if (range.loose === loose) { - return range; - } else { - return new Range(range.raw, loose); +var defaultIsFile = function isFile(file) { + try { + var stat = fs.statSync(file); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; } - } - - if (range instanceof Comparator) { - return new Range(range.value, loose); - } - - if (!(this instanceof Range)) - return new Range(range, loose); - - this.loose = loose; - - // First, split based on boolean or || - this.raw = range; - this.set = range.split(/\s*\|\|\s*/).map(function(range) { - return this.parseRange(range.trim()); - }, this).filter(function(c) { - // throw out any that are not relevant for whatever reason - return c.length; - }); - - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range); - } - - this.format(); -} + return stat.isFile() || stat.isFIFO(); +}; -Range.prototype.format = function() { - this.range = this.set.map(function(comps) { - return comps.join(' ').trim(); - }).join('||').trim(); - return this.range; +var defaultIsDir = function isDirectory(dir) { + try { + var stat = fs.statSync(dir); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isDirectory(); }; -Range.prototype.toString = function() { - return this.range; +var maybeUnwrapSymlink = function maybeUnwrapSymlink(x, opts) { + if (opts && opts.preserveSymlinks === false) { + try { + return fs.realpathSync(x); + } catch (realPathErr) { + if (realPathErr.code !== 'ENOENT') { + throw realPathErr; + } + } + } + return x; }; -Range.prototype.parseRange = function(range) { - var loose = this.loose; - range = range.trim(); - debug('range', range, loose); - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; - range = range.replace(hr, hyphenReplace); - debug('hyphen replace', range); - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); - debug('comparator trim', range, re[COMPARATORTRIM]); +module.exports = function (x, options) { + if (typeof x !== 'string') { + throw new TypeError('Path must be a string.'); + } + var opts = normalizeOptions(x, options); - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[TILDETRIM], tildeTrimReplace); + var isFile = opts.isFile || defaultIsFile; + var readFileSync = opts.readFileSync || fs.readFileSync; + var isDirectory = opts.isDirectory || defaultIsDir; - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[CARETTRIM], caretTrimReplace); + var extensions = opts.extensions || ['.js']; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; - // normalize spaces - range = range.split(/\s+/).join(' '); + opts.paths = opts.paths || []; - // At this point, the range is completely trimmed and - // ready to be split into comparators. + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = maybeUnwrapSymlink(path.resolve(basedir), opts); - var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; - var set = range.split(' ').map(function(comp) { - return parseComparator(comp, loose); - }).join(' ').split(/\s+/); - if (this.loose) { - // in loose mode, throw out any that are not valid comparators - set = set.filter(function(comp) { - return !!comp.match(compRe); - }); - } - set = set.map(function(comp) { - return new Comparator(comp, loose); - }); + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + var res = path.resolve(absoluteStart, x); + if (x === '..' || x.slice(-1) === '/') res += '/'; + var m = loadAsFileSync(res) || loadAsDirectorySync(res); + if (m) return maybeUnwrapSymlink(m, opts); + } else if (core[x]) { + return x; + } else { + var n = loadNodeModulesSync(x, absoluteStart); + if (n) return maybeUnwrapSymlink(n, opts); + } - return set; -}; + if (core[x]) return x; -Range.prototype.intersects = function(range, loose) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required'); - } + var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; - return this.set.some(function(thisComparators) { - return thisComparators.every(function(thisComparator) { - return range.set.some(function(rangeComparators) { - return rangeComparators.every(function(rangeComparator) { - return thisComparator.intersects(rangeComparator, loose); - }); - }); - }); - }); -}; + function loadAsFileSync(x) { + var pkg = loadpkg(path.dirname(x)); -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators; -function toComparators(range, loose) { - return new Range(range, loose).set.map(function(comp) { - return comp.map(function(c) { - return c.value; - }).join(' ').trim().split(' '); - }); -} + if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { + var rfile = path.relative(pkg.dir, x); + var r = opts.pathFilter(pkg.pkg, x, rfile); + if (r) { + x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign + } + } -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -function parseComparator(comp, loose) { - debug('comp', comp); - comp = replaceCarets(comp, loose); - debug('caret', comp); - comp = replaceTildes(comp, loose); - debug('tildes', comp); - comp = replaceXRanges(comp, loose); - debug('xrange', comp); - comp = replaceStars(comp, loose); - debug('stars', comp); - return comp; -} - -function isX(id) { - return !id || id.toLowerCase() === 'x' || id === '*'; -} - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 -function replaceTildes(comp, loose) { - return comp.trim().split(/\s+/).map(function(comp) { - return replaceTilde(comp, loose); - }).join(' '); -} + if (isFile(x)) { + return x; + } -function replaceTilde(comp, loose) { - var r = loose ? re[TILDELOOSE] : re[TILDE]; - return comp.replace(r, function(_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr); - var ret; + for (var i = 0; i < extensions.length; i++) { + var file = x + extensions[i]; + if (isFile(file)) { + return file; + } + } + } - if (isX(M)) - ret = ''; - else if (isX(m)) - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - else if (isX(p)) - // ~1.2 == >=1.2.0 <1.3.0 - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; - else if (pr) { - debug('replaceTilde pr', pr); - if (pr.charAt(0) !== '-') - pr = '-' + pr; - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + M + '.' + (+m + 1) + '.0'; - } else - // ~1.2.3 == >=1.2.3 <1.3.0 - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0'; + function loadpkg(dir) { + if (dir === '' || dir === '/') return; + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return; + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; - debug('tilde return', ret); - return ret; - }); -} + var pkgfile = path.join(dir, 'package.json'); -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2.0 --> >=1.2.0 <2.0.0 -function replaceCarets(comp, loose) { - return comp.trim().split(/\s+/).map(function(comp) { - return replaceCaret(comp, loose); - }).join(' '); -} + if (!isFile(pkgfile)) { + return loadpkg(path.dirname(dir)); + } -function replaceCaret(comp, loose) { - debug('caret', comp, loose); - var r = loose ? re[CARETLOOSE] : re[CARET]; - return comp.replace(r, function(_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr); - var ret; + var body = readFileSync(pkgfile); - if (isX(M)) - ret = ''; - else if (isX(m)) - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - else if (isX(p)) { - if (M === '0') - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; - else - ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; - } else if (pr) { - debug('replaceCaret pr', pr); - if (pr.charAt(0) !== '-') - pr = '-' + pr; - if (M === '0') { - if (m === '0') - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + M + '.' + m + '.' + (+p + 1); - else - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + M + '.' + (+m + 1) + '.0'; - } else - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + (+M + 1) + '.0.0'; - } else { - debug('no pr'); - if (M === '0') { - if (m === '0') - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + m + '.' + (+p + 1); - else - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0'; - } else - ret = '>=' + M + '.' + m + '.' + p + - ' <' + (+M + 1) + '.0.0'; - } + try { + var pkg = JSON.parse(body); + } catch (jsonErr) {} - debug('caret return', ret); - return ret; - }); -} + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, dir); + } -function replaceXRanges(comp, loose) { - debug('replaceXRanges', comp, loose); - return comp.split(/\s+/).map(function(comp) { - return replaceXRange(comp, loose); - }).join(' '); -} + return { pkg: pkg, dir: dir }; + } -function replaceXRange(comp, loose) { - comp = comp.trim(); - var r = loose ? re[XRANGELOOSE] : re[XRANGE]; - return comp.replace(r, function(ret, gtlt, M, m, p, pr) { - debug('xRange', comp, ret, gtlt, M, m, p, pr); - var xM = isX(M); - var xm = xM || isX(m); - var xp = xm || isX(p); - var anyX = xp; + function loadAsDirectorySync(x) { + var pkgfile = path.join(x, '/package.json'); + if (isFile(pkgfile)) { + try { + var body = readFileSync(pkgfile, 'UTF8'); + var pkg = JSON.parse(body); + } catch (e) {} - if (gtlt === '=' && anyX) - gtlt = ''; + if (opts.packageFilter) { + pkg = opts.packageFilter(pkg, x); + } - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0'; - } else { - // nothing is forbidden - ret = '*'; - } - } else if (gtlt && anyX) { - // replace X with 0 - if (xm) - m = 0; - if (xp) - p = 0; - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - // >1.2.3 => >= 1.2.4 - gtlt = '>='; - if (xm) { - M = +M + 1; - m = 0; - p = 0; - } else if (xp) { - m = +m + 1; - p = 0; - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<'; - if (xm) - M = +M + 1; - else - m = +m + 1; - } + if (pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + throw mainError; + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + try { + var m = loadAsFileSync(path.resolve(x, pkg.main)); + if (m) return m; + var n = loadAsDirectorySync(path.resolve(x, pkg.main)); + if (n) return n; + } catch (e) {} + } + } - ret = gtlt + M + '.' + m + '.' + p; - } else if (xm) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - } else if (xp) { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + return loadAsFileSync(path.join(x, '/index')); } - debug('xRange return', ret); - - return ret; - }); -} + function loadNodeModulesSync(x, start) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + if (isDirectory(dir)) { + var m = loadAsFileSync(path.join(dir, '/', x)); + if (m) return m; + var n = loadAsDirectorySync(path.join(dir, '/', x)); + if (n) return n; + } + } + } +}; -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars(comp, loose) { - debug('replaceStars', comp, loose); - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[STAR], ''); -} - -// This function is passed to string.replace(re[HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0 -function hyphenReplace($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) { - - if (isX(fM)) - from = ''; - else if (isX(fm)) - from = '>=' + fM + '.0.0'; - else if (isX(fp)) - from = '>=' + fM + '.' + fm + '.0'; - else - from = '>=' + from; - - if (isX(tM)) - to = ''; - else if (isX(tm)) - to = '<' + (+tM + 1) + '.0.0'; - else if (isX(tp)) - to = '<' + tM + '.' + (+tm + 1) + '.0'; - else if (tpr) - to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; - else - to = '<=' + to; +}).call(this,require('_process')) - return (from + ' ' + to).trim(); -} +},{"./caller.js":519,"./core":521,"./node-modules-paths.js":522,"./normalize-options.js":523,"_process":497,"fs":24,"path":493}],525:[function(require,module,exports){ +(function (global){ +'use strict'; +var width = 256;// each RC4 output is 0 <= x < 256 +var chunks = 6;// at least six RC4 outputs for each double +var digits = 52;// there are 52 significant digits in a double +var pool = [];// pool: entropy pool starts empty +var GLOBAL = typeof global === 'undefined' ? window : global; -// if ANY of the sets match ALL of its comparators, then pass -Range.prototype.test = function(version) { - if (!version) - return false; +// +// The following constants are related to IEEE 754 limits. +// +var startdenom = Math.pow(width, chunks), + significance = Math.pow(2, digits), + overflow = significance * 2, + mask = width - 1; - if (typeof version === 'string') - version = new SemVer(version, this.loose); - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version)) - return true; - } - return false; -}; +var oldRandom = Math.random; -function testSet(set, version) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) - return false; +// +// seedrandom() +// This is the seedrandom function described above. +// +module.exports = function(seed, options) { + if (options && options.global === true) { + options.global = false; + Math.random = module.exports(seed, options); + options.global = true; + return Math.random; } + var use_entropy = (options && options.entropy) || false; + var key = []; - if (version.prerelease.length) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (var i = 0; i < set.length; i++) { - debug(set[i].semver); - if (set[i].semver === ANY) - continue; + // Flatten the seed string or build one from local entropy if needed. + var shortseed = mixkey(flatten( + use_entropy ? [seed, tostring(pool)] : + 0 in arguments ? seed : autoseed(), 3), key); - if (set[i].semver.prerelease.length > 0) { - var allowed = set[i].semver; - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) - return true; - } - } + // Use the seed to initialize an ARC4 generator. + var arc4 = new ARC4(key); - // Version has a -pre, but it's not one of the ones we like. - return false; - } + // Mix the randomness into accumulated entropy. + mixkey(tostring(arc4.S), pool); - return true; -} + // Override Math.random -exports.satisfies = satisfies; -function satisfies(version, range, loose) { - try { - range = new Range(range, loose); - } catch (er) { - return false; - } - return range.test(version); -} + // This function returns a random double in [0, 1) that contains + // randomness in every bit of the mantissa of the IEEE 754 value. -exports.maxSatisfying = maxSatisfying; -function maxSatisfying(versions, range, loose) { - var max = null; - var maxSV = null; - try { - var rangeObj = new Range(range, loose); - } catch (er) { - return null; - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { // satisfies(v, range, loose) - if (!max || maxSV.compare(v) === -1) { // compare(max, v, true) - max = v; - maxSV = new SemVer(max, loose); - } + return function() { // Closure to return a random double: + var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48 + d = startdenom, // and denominator d = 2 ^ 48. + x = 0; // and no 'extra last byte'. + while (n < significance) { // Fill up all significant digits by + n = (n + x) * width; // shifting numerator and + d *= width; // denominator and generating a + x = arc4.g(1); // new least-significant-byte. } - }) - return max; -} - -exports.minSatisfying = minSatisfying; -function minSatisfying(versions, range, loose) { - var min = null; - var minSV = null; - try { - var rangeObj = new Range(range, loose); - } catch (er) { - return null; - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { // satisfies(v, range, loose) - if (!min || minSV.compare(v) === 1) { // compare(min, v, true) - min = v; - minSV = new SemVer(min, loose); - } + while (n >= overflow) { // To avoid rounding up, before adding + n /= 2; // last byte, shift everything + d /= 2; // right using integer Math until + x >>>= 1; // we have exactly the desired bits. } - }) - return min; -} - -exports.validRange = validRange; -function validRange(range, loose) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, loose).range || '*'; - } catch (er) { - return null; - } -} + return (n + x) / d; // Form the number within [0, 1). + }; +}; -// Determine if version is less than all the versions possible in the range -exports.ltr = ltr; -function ltr(version, range, loose) { - return outside(version, range, '<', loose); -} +module.exports.resetGlobal = function () { + Math.random = oldRandom; +}; -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr; -function gtr(version, range, loose) { - return outside(version, range, '>', loose); -} +// +// ARC4 +// +// An ARC4 implementation. The constructor takes a key in the form of +// an array of at most (width) integers that should be 0 <= x < (width). +// +// The g(count) method returns a pseudorandom integer that concatenates +// the next (count) outputs from ARC4. Its return value is a number x +// that is in the range 0 <= x < (width ^ count). +// +/** @constructor */ +function ARC4(key) { + var t, keylen = key.length, + me = this, i = 0, j = me.i = me.j = 0, s = me.S = []; -exports.outside = outside; -function outside(version, range, hilo, loose) { - version = new SemVer(version, loose); - range = new Range(range, loose); + // The empty key [] is treated as [0]. + if (!keylen) { key = [keylen++]; } - var gtfn, ltefn, ltfn, comp, ecomp; - switch (hilo) { - case '>': - gtfn = gt; - ltefn = lte; - ltfn = lt; - comp = '>'; - ecomp = '>='; - break; - case '<': - gtfn = lt; - ltefn = gte; - ltfn = gt; - comp = '<'; - ecomp = '<='; - break; - default: - throw new TypeError('Must provide a hilo val of "<" or ">"'); + // Set up S using the standard key scheduling algorithm. + while (i < width) { + s[i] = i++; } - - // If it satisifes the range it is not outside - if (satisfies(version, range, loose)) { - return false; + for (i = 0; i < width; i++) { + s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))]; + s[j] = t; } - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i]; - - var high = null; - var low = null; - - comparators.forEach(function(comparator) { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator; - low = low || comparator; - if (gtfn(comparator.semver, high.semver, loose)) { - high = comparator; - } else if (ltfn(comparator.semver, low.semver, loose)) { - low = comparator; - } - }); - - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false; + // The "g" method returns the next (count) outputs as one number. + (me.g = function(count) { + // Using instance members instead of closure state nearly doubles speed. + var t, r = 0, + i = me.i, j = me.j, s = me.S; + while (count--) { + t = s[i = mask & (i + 1)]; + r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))]; } + me.i = i; me.j = j; + return r; + // For robust unpredictability discard an initial batch of values. + // See http://www.rsa.com/rsalabs/node.asp?id=2009 + })(width); +} - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false; - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false; +// +// flatten() +// Converts an object tree to nested arrays of strings. +// +function flatten(obj, depth) { + var result = [], typ = (typeof obj)[0], prop; + if (depth && typ == 'o') { + for (prop in obj) { + try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {} } } - return true; + return (result.length ? result : typ == 's' ? obj : obj + '\0'); } -exports.prerelease = prerelease; -function prerelease(version, loose) { - var parsed = parse(version, loose); - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; +// +// mixkey() +// Mixes a string seed into a key that is an array of integers, and +// returns a shortened string seed that is equivalent to the result key. +// +function mixkey(seed, key) { + var stringseed = seed + '', smear, j = 0; + while (j < stringseed.length) { + key[mask & j] = + mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++)); + } + return tostring(key); } -exports.intersects = intersects; -function intersects(r1, r2, loose) { - r1 = new Range(r1, loose) - r2 = new Range(r2, loose) - return r1.intersects(r2) +// +// autoseed() +// Returns an object for autoseeding, using window.crypto if available. +// +/** @param {Uint8Array=} seed */ +function autoseed(seed) { + try { + GLOBAL.crypto.getRandomValues(seed = new Uint8Array(width)); + return tostring(seed); + } catch (e) { + return [+new Date, GLOBAL, GLOBAL.navigator && GLOBAL.navigator.plugins, + GLOBAL.screen, tostring(pool)]; + } } -exports.coerce = coerce; -function coerce(version) { - if (version instanceof SemVer) - return version; - - if (typeof version !== 'string') - return null; - - var match = version.match(re[COERCE]); - - if (match == null) - return null; - - return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0')); +// +// tostring() +// Converts an array of charcodes to a string +// +function tostring(a) { + return String.fromCharCode.apply(0, a); } -}).call(this,require('_process')) -},{"_process":265}],294:[function(require,module,exports){ -'use strict'; -var shebangRegex = require('shebang-regex'); - -module.exports = function (str) { - var match = str.match(shebangRegex); - - if (!match) { - return null; - } - - var arr = match[0].replace(/#! ?/, '').split(' '); - var bin = arr[0].split('/').pop(); - var arg = arr[1]; - - return (bin === 'env' ? - arg : - bin + (arg ? ' ' + arg : '') - ); -}; +// +// When seedrandom.js is loaded, we immediately mix a few bits +// from the built-in RNG into the entropy pool. Because we do +// not want to intefere with determinstic PRNG state later, +// seedrandom will not call Math.random on its own again after +// initialization. +// +mixkey(Math.random(), pool); -},{"shebang-regex":295}],295:[function(require,module,exports){ -'use strict'; -module.exports = /^#!.*/; +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],296:[function(require,module,exports){ +},{}],526:[function(require,module,exports){ // Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -54700,7 +61742,7 @@ module.exports = function FormatStackTrace(error, frames) { return lines.join("\n"); }; -},{}],297:[function(require,module,exports){ +},{}],527:[function(require,module,exports){ (function (global){ // If a another copy (same version or not) of stack-chain exists it will result // in wrong stack traces (most likely dublicate callSites). @@ -54720,7 +61762,8 @@ else { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./package.json":298,"./stack-chain":299}],298:[function(require,module,exports){ + +},{"./package.json":528,"./stack-chain":529}],528:[function(require,module,exports){ module.exports={ "name": "stack-chain", "description": "API for combining call site modifiers", @@ -54748,7 +61791,7 @@ module.exports={ "license": "MIT" } -},{}],299:[function(require,module,exports){ +},{}],529:[function(require,module,exports){ // use a already existing formater or fallback to the default v8 formater var defaultFormater = require('./format.js'); @@ -54930,7 +61973,7 @@ Object.defineProperty(Error, 'prepareStackTrace', { module.exports = chain; -},{"./format.js":296,"./package.json":298}],300:[function(require,module,exports){ +},{"./format.js":526,"./package.json":528}],530:[function(require,module,exports){ (function(root, factory) { 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers. @@ -54954,7 +61997,7 @@ module.exports = chain; } var curr = arguments.callee; - while (curr && stack.length < maxStackSize) { + while (curr && stack.length < maxStackSize && curr['arguments']) { // Allow V8 optimizations var args = new Array(curr['arguments'].length); for (var i = 0; i < args.length; ++i) { @@ -54977,7 +62020,7 @@ module.exports = chain; }; })); -},{"stackframe":301}],301:[function(require,module,exports){ +},{"stackframe":531}],531:[function(require,module,exports){ (function(root, factory) { 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers. @@ -55090,7 +62133,7 @@ module.exports = chain; return StackFrame; })); -},{}],302:[function(require,module,exports){ +},{}],532:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -55196,7 +62239,7 @@ ArraySet.prototype.toArray = function ArraySet_toArray() { exports.ArraySet = ArraySet; -},{"./util":308}],303:[function(require,module,exports){ +},{"./util":538}],533:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -55338,7 +62381,7 @@ exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { aOutParam.rest = aIndex; }; -},{"./base64":304}],304:[function(require,module,exports){ +},{"./base64":534}],534:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -55407,7 +62450,7 @@ exports.decode = function (charCode) { return -1; }; -},{}],305:[function(require,module,exports){ +},{}],535:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -55520,7 +62563,7 @@ exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { return index; }; -},{}],306:[function(require,module,exports){ +},{}],536:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -55636,7 +62679,7 @@ exports.quickSort = function (ary, comparator) { doQuickSort(ary, comparator, 0, ary.length - 1); }; -},{}],307:[function(require,module,exports){ +},{}],537:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -56720,7 +63763,7 @@ IndexedSourceMapConsumer.prototype._parseMappings = exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; -},{"./array-set":302,"./base64-vlq":303,"./binary-search":305,"./quick-sort":306,"./util":308}],308:[function(require,module,exports){ +},{"./array-set":532,"./base64-vlq":533,"./binary-search":535,"./quick-sort":536,"./util":538}],538:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -57139,7 +64182,7 @@ function compareByGeneratedPositionsInflated(mappingA, mappingB) { } exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; -},{}],309:[function(require,module,exports){ +},{}],539:[function(require,module,exports){ (function(root, factory) { 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers. @@ -57481,7 +64524,7 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate }; })); -},{"source-map/lib/source-map-consumer":307,"stackframe":301}],310:[function(require,module,exports){ +},{"source-map/lib/source-map-consumer":537,"stackframe":531}],540:[function(require,module,exports){ (function(root, factory) { 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers. @@ -57710,7 +64753,7 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate }; })); -},{"error-stack-parser":193,"stack-generator":300,"stacktrace-gps":309}],311:[function(require,module,exports){ +},{"error-stack-parser":410,"stack-generator":530,"stacktrace-gps":539}],541:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -57839,44 +64882,53 @@ Stream.prototype.pipe = function(dest, options) { return dest; }; -},{"events":209,"inherits":238,"readable-stream/duplex.js":268,"readable-stream/passthrough.js":279,"readable-stream/readable.js":280,"readable-stream/transform.js":281,"readable-stream/writable.js":282}],312:[function(require,module,exports){ +},{"events":444,"inherits":474,"readable-stream/duplex.js":500,"readable-stream/passthrough.js":511,"readable-stream/readable.js":512,"readable-stream/transform.js":513,"readable-stream/writable.js":514}],542:[function(require,module,exports){ "use strict"; - -module.exports = parseArgsStringToArgv; -module.exports.parseArgsStringToArgv = parseArgsStringToArgv; - +exports.__esModule = true; function parseArgsStringToArgv(value, env, file) { - // ([^\s'"]+(['"])([^\2]*?)\2) Match `text"quotes text"` - - // [^\s'"] or Match if not a space ' or " - - // (['"])([^\4]*?)\4 or Match "quoted text" without quotes - // `\2` and `\4` are a backreference to the quote style (' or ") captured - var myRegexp = /([^\s'"]+(['"])([^\2]*?)\2)|[^\s'"]+|(['"])([^\4]*?)\4/gi; - var myString = value; - var myArray = [ - ]; - if (env) { - myArray.push(env); - } - if (file) { - myArray.push(file); - } - var match; - do { + // ([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*) Matches nested quotes until the first space outside of quotes + // [^\s'"]+ or Match if not a space ' or " + // (['"])([^\5]*?)\5 or Match "quoted text" without quotes + // `\3` and `\5` are a backreference to the quote style (' or ") captured + var myRegexp = /([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi; + var myString = value; + var myArray = []; + if (env) { + myArray.push(env); + } + if (file) { + myArray.push(file); + } + var match; + do { // Each call to exec returns the next regex match as an array - match = myRegexp.exec(myString); - if (match !== null) { - // Index 1 in the array is the captured group if it exists - // Index 0 is the matched text, which we use if no captured group exists - myArray.push(match[1] || match[5] || match[0]); + match = myRegexp.exec(myString); + if (match !== null) { + // Index 1 in the array is the captured group if it exists + // Index 0 is the matched text, which we use if no captured group exists + myArray.push(firstString(match[1], match[6], match[0])); + } + } while (match !== null); + return myArray; +} +exports["default"] = parseArgsStringToArgv; +exports.parseArgsStringToArgv = parseArgsStringToArgv; +// Accepts any number of arguments, and returns the first one that is a string +// (even an empty string) +function firstString() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + if (typeof arg === "string") { + return arg; + } } - } while (match !== null); - - return myArray; } -},{}],313:[function(require,module,exports){ +},{}],543:[function(require,module,exports){ 'use strict'; const stripAnsi = require('strip-ansi'); const isFullwidthCodePoint = require('is-fullwidth-code-point'); @@ -57914,7 +64966,7 @@ module.exports = str => { return width; }; -},{"is-fullwidth-code-point":240,"strip-ansi":315}],314:[function(require,module,exports){ +},{"is-fullwidth-code-point":476,"strip-ansi":545}],544:[function(require,module,exports){ 'use strict'; module.exports = () => { @@ -57926,13 +64978,13 @@ module.exports = () => { return new RegExp(pattern, 'g'); }; -},{}],315:[function(require,module,exports){ +},{}],545:[function(require,module,exports){ 'use strict'; const ansiRegex = require('ansi-regex'); module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; -},{"ansi-regex":314}],316:[function(require,module,exports){ +},{"ansi-regex":544}],546:[function(require,module,exports){ var thenify = require('thenify') @@ -58007,7 +65059,7 @@ function deprecated(source, name) { return false } -},{"thenify":317}],317:[function(require,module,exports){ +},{"thenify":547}],547:[function(require,module,exports){ var Promise = require('any-promise') var assert = require('assert') @@ -58089,7 +65141,87 @@ function createWrapper(name, options) { + '})' } -},{"any-promise":1,"assert":5}],318:[function(require,module,exports){ +},{"any-promise":1,"assert":5}],548:[function(require,module,exports){ +(function (setImmediate,clearImmediate){ +var nextTick = require('process/browser.js').nextTick; +var apply = Function.prototype.apply; +var slice = Array.prototype.slice; +var immediateIds = {}; +var nextImmediateId = 0; + +// DOM APIs, for completeness + +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { timeout.close(); }; + +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; +} +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(window, this._id); +}; + +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; +}; + +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; + +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); + + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; + +// That's not how node.js implements it but the exposed api is the same. +exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + + immediateIds[id] = true; + + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); + } + }); + + return id; +}; + +exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { + delete immediateIds[id]; +}; +}).call(this,require("timers").setImmediate,require("timers").clearImmediate) + +},{"process/browser.js":497,"timers":548}],549:[function(require,module,exports){ var noCase = require('no-case') var upperCase = require('upper-case') @@ -58106,7 +65238,77 @@ module.exports = function (value, locale) { }) } -},{"no-case":253,"upper-case":319}],319:[function(require,module,exports){ +},{"no-case":485,"upper-case":555}],550:[function(require,module,exports){ +"use strict"; + +var isPrototype = require("../prototype/is"); + +module.exports = function (value) { + if (typeof value !== "function") return false; + + if (!hasOwnProperty.call(value, "length")) return false; + + try { + if (typeof value.length !== "number") return false; + if (typeof value.call !== "function") return false; + if (typeof value.apply !== "function") return false; + } catch (error) { + return false; + } + + return !isPrototype(value); +}; + +},{"../prototype/is":553}],551:[function(require,module,exports){ +"use strict"; + +var isValue = require("../value/is"); + +// prettier-ignore +var possibleTypes = { "object": true, "function": true, "undefined": true /* document.all */ }; + +module.exports = function (value) { + if (!isValue(value)) return false; + return hasOwnProperty.call(possibleTypes, typeof value); +}; + +},{"../value/is":554}],552:[function(require,module,exports){ +"use strict"; + +var isFunction = require("../function/is"); + +var classRe = /^\s*class[\s{/}]/, functionToString = Function.prototype.toString; + +module.exports = function (value) { + if (!isFunction(value)) return false; + if (classRe.test(functionToString.call(value))) return false; + return true; +}; + +},{"../function/is":550}],553:[function(require,module,exports){ +"use strict"; + +var isObject = require("../object/is"); + +module.exports = function (value) { + if (!isObject(value)) return false; + try { + if (!value.constructor) return false; + return value.constructor.prototype === value; + } catch (error) { + return false; + } +}; + +},{"../object/is":551}],554:[function(require,module,exports){ +"use strict"; + +// ES3 safe +var _undefined = void 0; + +module.exports = function (value) { return value !== _undefined && value !== null; }; + +},{}],555:[function(require,module,exports){ /** * Special language-specific overrides. * @@ -58158,7 +65360,7 @@ module.exports = function (str, locale) { return str.toUpperCase() } -},{}],320:[function(require,module,exports){ +},{}],556:[function(require,module,exports){ var FUNCTIONS = {}; /** @@ -58189,7 +65391,7 @@ module.exports = function (arity, fn) { return FUNCTIONS[arity](fn); }; -},{}],321:[function(require,module,exports){ +},{}],557:[function(require,module,exports){ (function (global){ /** @@ -58260,16 +65462,12 @@ function config (name) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],322:[function(require,module,exports){ -arguments[4][238][0].apply(exports,arguments) -},{"dup":238}],323:[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'; -} -},{}],324:[function(require,module,exports){ + +},{}],558:[function(require,module,exports){ +arguments[4][6][0].apply(exports,arguments) +},{"dup":6}],559:[function(require,module,exports){ +arguments[4][7][0].apply(exports,arguments) +},{"dup":7}],560:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -58859,7 +66057,8 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":323,"_process":265,"inherits":322}],325:[function(require,module,exports){ + +},{"./support/isBuffer":559,"_process":497,"inherits":558}],561:[function(require,module,exports){ /* * verror.js: richer JavaScript errors */ @@ -59312,146 +66511,7 @@ WError.prototype.cause = function we_cause(c) return (this.jse_cause); }; -},{"assert-plus":4,"core-util-is":146,"extsprintf":210,"util":324}],326:[function(require,module,exports){ -(function (process){ -module.exports = which -which.sync = whichSync - -var isWindows = process.platform === 'win32' || - process.env.OSTYPE === 'cygwin' || - process.env.OSTYPE === 'msys' - -var path = require('path') -var COLON = isWindows ? ';' : ':' -var isexe = require('isexe') - -function getNotFoundError (cmd) { - var er = new Error('not found: ' + cmd) - er.code = 'ENOENT' - - return er -} - -function getPathInfo (cmd, opt) { - var colon = opt.colon || COLON - var pathEnv = opt.path || process.env.PATH || '' - var pathExt = [''] - - pathEnv = pathEnv.split(colon) - - var pathExtExe = '' - if (isWindows) { - pathEnv.unshift(process.cwd()) - pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM') - pathExt = pathExtExe.split(colon) - - - // Always test the cmd itself first. isexe will check to make sure - // it's found in the pathExt set. - if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') - pathExt.unshift('') - } - - // If it has a slash, then we don't bother searching the pathenv. - // just check the file itself, and that's it. - if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) - pathEnv = [''] - - return { - env: pathEnv, - ext: pathExt, - extExe: pathExtExe - } -} - -function which (cmd, opt, cb) { - if (typeof opt === 'function') { - cb = opt - opt = {} - } - - var info = getPathInfo(cmd, opt) - var pathEnv = info.env - var pathExt = info.ext - var pathExtExe = info.extExe - var found = [] - - ;(function F (i, l) { - if (i === l) { - if (opt.all && found.length) - return cb(null, found) - else - return cb(getNotFoundError(cmd)) - } - - var pathPart = pathEnv[i] - if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') - pathPart = pathPart.slice(1, -1) - - var p = path.join(pathPart, cmd) - if (!pathPart && (/^\.[\\\/]/).test(cmd)) { - p = cmd.slice(0, 2) + p - } - ;(function E (ii, ll) { - if (ii === ll) return F(i + 1, l) - var ext = pathExt[ii] - isexe(p + ext, { pathExt: pathExtExe }, function (er, is) { - if (!er && is) { - if (opt.all) - found.push(p + ext) - else - return cb(null, p + ext) - } - return E(ii + 1, ll) - }) - })(0, pathExt.length) - })(0, pathEnv.length) -} - -function whichSync (cmd, opt) { - opt = opt || {} - - var info = getPathInfo(cmd, opt) - var pathEnv = info.env - var pathExt = info.ext - var pathExtExe = info.extExe - var found = [] - - for (var i = 0, l = pathEnv.length; i < l; i ++) { - var pathPart = pathEnv[i] - if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') - pathPart = pathPart.slice(1, -1) - - var p = path.join(pathPart, cmd) - if (!pathPart && /^\.[\\\/]/.test(cmd)) { - p = cmd.slice(0, 2) + p - } - for (var j = 0, ll = pathExt.length; j < ll; j ++) { - var cur = p + pathExt[j] - var is - try { - is = isexe.sync(cur, { pathExt: pathExtExe }) - if (is) { - if (opt.all) - found.push(cur) - else - return cur - } - } catch (ex) {} - } - } - - if (opt.all && found.length) - return found - - if (opt.nothrow) - return null - - throw getNotFoundError(cmd) -} - -}).call(this,require('_process')) -},{"_process":265,"isexe":244,"path":260}],327:[function(require,module,exports){ +},{"assert-plus":4,"core-util-is":392,"extsprintf":445,"util":560}],562:[function(require,module,exports){ // Returns a wrapper function that returns a wrapped callback // The wrapper function should do some stuff, and return a // presumably different callback function. @@ -59486,7 +66546,7 @@ function wrappy (fn, cb) { } } -},{}],328:[function(require,module,exports){ +},{}],563:[function(require,module,exports){ module.exports={ "name": "cucumber", "description": "The official JavaScript implementation of Cucumber.", @@ -59497,7 +66557,7 @@ module.exports={ "gherkin", "tests" ], - "version": "5.1.0", + "version": "6.0.0", "homepage": "http://github.com/cucumber/cucumber-js", "author": "Julien Biezemans (http://jbpros.net)", "contributors": [ @@ -59617,7 +66677,14 @@ module.exports={ "David H. Gutteridge ", "lopesc ", "Honza Javorek ", - "Josh Chisholm " + "Josh Chisholm ", + "Izhaki ", + "Niyaz Akhmetov ", + "Sérgio Junior ", + "mgonnet ", + "Joey Jan ", + "David Goss ", + "Artur Neumann " ], "repository": { "type": "git", @@ -59632,35 +66699,33 @@ module.exports={ }, "main": "./lib/index", "engines": { - "node": ">=0.10" + "node": ">=8" }, "dependencies": { - "@babel/polyfill": "^7.2.3", - "assertion-error-formatter": "^2.0.1", + "assertion-error-formatter": "^3.0.0", "bluebird": "^3.4.1", "cli-table3": "^0.5.1", "colors": "^1.1.2", - "commander": "^2.9.0", - "cross-spawn": "^6.0.5", - "cucumber-expressions": "^6.0.0", - "cucumber-tag-expressions": "^1.1.1", + "commander": "^3.0.1", + "cucumber-expressions": "^7.0.0", + "cucumber-tag-expressions": "^2.0.2", "duration": "^0.2.1", - "escape-string-regexp": "^1.0.5", - "figures": "2.0.0", - "gherkin": "^5.0.0", + "escape-string-regexp": "^2.0.0", + "figures": "^3.0.0", + "gherkin": "5.0.0", "glob": "^7.1.3", - "indent-string": "^3.1.0", + "indent-string": "^4.0.0", "is-generator": "^1.0.2", - "is-stream": "^1.1.0", + "is-stream": "^2.0.0", "knuth-shuffle-seeded": "^1.0.6", - "lodash": "^4.17.10", + "lodash": "^4.17.14", "mz": "^2.4.0", "progress": "^2.0.0", "resolve": "^1.3.3", - "serialize-error": "^3.0.0", + "serialize-error": "^4.1.0", "stack-chain": "^2.0.0", "stacktrace-js": "^2.0.0", - "string-argv": "0.1.1", + "string-argv": "^0.3.0", "title-case": "^2.1.1", "util-arity": "^1.0.2", "verror": "^1.9.0" @@ -59675,41 +66740,43 @@ module.exports={ "babel-eslint": "^10.0.1", "babel-plugin-istanbul": "^5.1.0", "babelify": "^10.0.0", - "browserify": "16.2.2", + "browserify": "^16.2.2", "chai": "^4.0.1", - "coffee-script": "^1.10.0", + "coffeescript": "^2.4.1", "connect": "^3.4.0", + "core-js": "^3.2.1", "coveralls": "^3.0.0", - "dependency-lint": "^5.0.1", - "eslint": "^5.10.0", - "eslint-config-prettier": "^3.3.0", - "eslint-config-standard": "^12.0.0", + "dependency-lint": "^6.0.0", + "eslint": "^6.3.0", + "eslint-config-prettier": "^6.1.0", + "eslint-config-standard": "^14.1.0", "eslint-plugin-babel": "^5.3.0", - "eslint-plugin-import": "^2.14.0", - "eslint-plugin-node": "^8.0.0", + "eslint-plugin-import": "^2.17.1", + "eslint-plugin-node": "^9.0.0", "eslint-plugin-prettier": "^3.0.0", - "eslint-plugin-promise": "^4.0.1", + "eslint-plugin-promise": "^4.1.1", "eslint-plugin-standard": "^4.0.0", - "fs-extra": "^6.0.1", - "mocha": "^5.2.0", - "mustache": "^2.3.0", - "nyc": "^12.0.2", + "fs-extra": "^8.0.0", + "mocha": "^6.1.3", + "mustache": "^3.0.1", + "nyc": "^14.0.0", "prettier": "^1.5.2", + "regenerator-runtime": "^0.13.3", "serve-static": "^1.10.0", - "sinon": "^6.0.0", - "sinon-chai": "^3.2.0", + "sinon": "^7.3.1", + "sinon-chai": "^3.3.0", "stream-to-string": "^1.1.0", - "tmp": "^0.0.33" + "tmp": "^0.1.0" }, "scripts": { "build-browser-example": "BABEL_ENV=browser browserify example/index.js -o dist/browser-example.js -t babelify", "build-local-continuous": "babel src --watch -d lib --ignore '**/*_spec.js'", "build-local": "babel src -d lib --ignore '**/*_spec.js'", - "build-release": "BABEL_ENV=browser browserify src/index.js -o dist/cucumber.js -t babelify --standalone Cucumber", + "build-release": "BABEL_ENV=browser browserify scripts/cucumber.js -o dist/cucumber.js -t babelify --standalone Cucumber --debug", "feature-test": "node ./bin/cucumber-js", - "lint-dependencies": "dependency-lint", - "lint-code": "eslint \"{example,features,scripts,src,test}/**/*.js\"", "lint-autofix": "eslint --fix \"{example,features,scripts,src,test}/**/*.js\"", + "lint-code": "eslint \"{example,features,scripts,src,test}/**/*.js\"", + "lint-dependencies": "dependency-lint", "lint": "yarn run lint-code && yarn run lint-dependencies", "prefeature-test": "yarn run build-local", "prepublish": "yarn run build-local", @@ -59728,21 +66795,436 @@ module.exports={ ] } -},{}],329:[function(require,module,exports){ +},{}],564:[function(require,module,exports){ "use strict"; +require("core-js/modules/es.symbol"); + +require("core-js/modules/es.symbol.description"); + +require("core-js/modules/es.symbol.async-iterator"); + +require("core-js/modules/es.symbol.has-instance"); + +require("core-js/modules/es.symbol.is-concat-spreadable"); + +require("core-js/modules/es.symbol.iterator"); + +require("core-js/modules/es.symbol.match"); + +require("core-js/modules/es.symbol.replace"); + +require("core-js/modules/es.symbol.search"); + +require("core-js/modules/es.symbol.species"); + +require("core-js/modules/es.symbol.split"); + +require("core-js/modules/es.symbol.to-primitive"); + +require("core-js/modules/es.symbol.to-string-tag"); + +require("core-js/modules/es.symbol.unscopables"); + +require("core-js/modules/es.array.concat"); + +require("core-js/modules/es.array.copy-within"); + +require("core-js/modules/es.array.every"); + +require("core-js/modules/es.array.fill"); + +require("core-js/modules/es.array.filter"); + +require("core-js/modules/es.array.find"); + +require("core-js/modules/es.array.find-index"); + +require("core-js/modules/es.array.flat"); + +require("core-js/modules/es.array.flat-map"); + +require("core-js/modules/es.array.for-each"); + +require("core-js/modules/es.array.from"); + +require("core-js/modules/es.array.includes"); + +require("core-js/modules/es.array.index-of"); + +require("core-js/modules/es.array.iterator"); + +require("core-js/modules/es.array.join"); + +require("core-js/modules/es.array.last-index-of"); + +require("core-js/modules/es.array.map"); + +require("core-js/modules/es.array.of"); + +require("core-js/modules/es.array.reduce"); + +require("core-js/modules/es.array.reduce-right"); + +require("core-js/modules/es.array.reverse"); + +require("core-js/modules/es.array.slice"); + +require("core-js/modules/es.array.some"); + +require("core-js/modules/es.array.sort"); + +require("core-js/modules/es.array.species"); + +require("core-js/modules/es.array.splice"); + +require("core-js/modules/es.array.unscopables.flat"); + +require("core-js/modules/es.array.unscopables.flat-map"); + +require("core-js/modules/es.array-buffer.constructor"); + +require("core-js/modules/es.array-buffer.is-view"); + +require("core-js/modules/es.array-buffer.slice"); + +require("core-js/modules/es.data-view"); + +require("core-js/modules/es.date.to-iso-string"); + +require("core-js/modules/es.date.to-json"); + +require("core-js/modules/es.date.to-primitive"); + +require("core-js/modules/es.date.to-string"); + +require("core-js/modules/es.function.has-instance"); + +require("core-js/modules/es.function.name"); + +require("core-js/modules/es.json.to-string-tag"); + +require("core-js/modules/es.map"); + +require("core-js/modules/es.math.acosh"); + +require("core-js/modules/es.math.asinh"); + +require("core-js/modules/es.math.atanh"); + +require("core-js/modules/es.math.cbrt"); + +require("core-js/modules/es.math.clz32"); + +require("core-js/modules/es.math.cosh"); + +require("core-js/modules/es.math.expm1"); + +require("core-js/modules/es.math.fround"); + +require("core-js/modules/es.math.hypot"); + +require("core-js/modules/es.math.imul"); + +require("core-js/modules/es.math.log10"); + +require("core-js/modules/es.math.log1p"); + +require("core-js/modules/es.math.log2"); + +require("core-js/modules/es.math.sign"); + +require("core-js/modules/es.math.sinh"); + +require("core-js/modules/es.math.tanh"); + +require("core-js/modules/es.math.to-string-tag"); + +require("core-js/modules/es.math.trunc"); + +require("core-js/modules/es.number.constructor"); + +require("core-js/modules/es.number.epsilon"); + +require("core-js/modules/es.number.is-finite"); + +require("core-js/modules/es.number.is-integer"); + +require("core-js/modules/es.number.is-nan"); + +require("core-js/modules/es.number.is-safe-integer"); + +require("core-js/modules/es.number.max-safe-integer"); + +require("core-js/modules/es.number.min-safe-integer"); + +require("core-js/modules/es.number.parse-float"); + +require("core-js/modules/es.number.parse-int"); + +require("core-js/modules/es.number.to-fixed"); + +require("core-js/modules/es.number.to-precision"); + +require("core-js/modules/es.object.assign"); + +require("core-js/modules/es.object.define-getter"); + +require("core-js/modules/es.object.define-setter"); + +require("core-js/modules/es.object.entries"); + +require("core-js/modules/es.object.freeze"); + +require("core-js/modules/es.object.from-entries"); + +require("core-js/modules/es.object.get-own-property-descriptor"); + +require("core-js/modules/es.object.get-own-property-descriptors"); + +require("core-js/modules/es.object.get-own-property-names"); + +require("core-js/modules/es.object.get-prototype-of"); + +require("core-js/modules/es.object.is"); + +require("core-js/modules/es.object.is-extensible"); + +require("core-js/modules/es.object.is-frozen"); + +require("core-js/modules/es.object.is-sealed"); + +require("core-js/modules/es.object.keys"); + +require("core-js/modules/es.object.lookup-getter"); + +require("core-js/modules/es.object.lookup-setter"); + +require("core-js/modules/es.object.prevent-extensions"); + +require("core-js/modules/es.object.seal"); + +require("core-js/modules/es.object.set-prototype-of"); + +require("core-js/modules/es.object.to-string"); + +require("core-js/modules/es.object.values"); + +require("core-js/modules/es.parse-float"); + +require("core-js/modules/es.parse-int"); + +require("core-js/modules/es.promise"); + +require("core-js/modules/es.promise.finally"); + +require("core-js/modules/es.reflect.apply"); + +require("core-js/modules/es.reflect.construct"); + +require("core-js/modules/es.reflect.define-property"); + +require("core-js/modules/es.reflect.delete-property"); + +require("core-js/modules/es.reflect.get"); + +require("core-js/modules/es.reflect.get-own-property-descriptor"); + +require("core-js/modules/es.reflect.get-prototype-of"); + +require("core-js/modules/es.reflect.has"); + +require("core-js/modules/es.reflect.is-extensible"); + +require("core-js/modules/es.reflect.own-keys"); + +require("core-js/modules/es.reflect.prevent-extensions"); + +require("core-js/modules/es.reflect.set"); + +require("core-js/modules/es.reflect.set-prototype-of"); + +require("core-js/modules/es.regexp.constructor"); + +require("core-js/modules/es.regexp.exec"); + +require("core-js/modules/es.regexp.flags"); + +require("core-js/modules/es.regexp.to-string"); + +require("core-js/modules/es.set"); + +require("core-js/modules/es.string.code-point-at"); + +require("core-js/modules/es.string.ends-with"); + +require("core-js/modules/es.string.from-code-point"); + +require("core-js/modules/es.string.includes"); + +require("core-js/modules/es.string.iterator"); + +require("core-js/modules/es.string.match"); + +require("core-js/modules/es.string.pad-end"); + +require("core-js/modules/es.string.pad-start"); + +require("core-js/modules/es.string.raw"); + +require("core-js/modules/es.string.repeat"); + +require("core-js/modules/es.string.replace"); + +require("core-js/modules/es.string.search"); + +require("core-js/modules/es.string.split"); + +require("core-js/modules/es.string.starts-with"); + +require("core-js/modules/es.string.trim"); + +require("core-js/modules/es.string.trim-end"); + +require("core-js/modules/es.string.trim-start"); + +require("core-js/modules/es.string.anchor"); + +require("core-js/modules/es.string.big"); + +require("core-js/modules/es.string.blink"); + +require("core-js/modules/es.string.bold"); + +require("core-js/modules/es.string.fixed"); + +require("core-js/modules/es.string.fontcolor"); + +require("core-js/modules/es.string.fontsize"); + +require("core-js/modules/es.string.italics"); + +require("core-js/modules/es.string.link"); + +require("core-js/modules/es.string.small"); + +require("core-js/modules/es.string.strike"); + +require("core-js/modules/es.string.sub"); + +require("core-js/modules/es.string.sup"); + +require("core-js/modules/es.typed-array.float32-array"); + +require("core-js/modules/es.typed-array.float64-array"); + +require("core-js/modules/es.typed-array.int8-array"); + +require("core-js/modules/es.typed-array.int16-array"); + +require("core-js/modules/es.typed-array.int32-array"); + +require("core-js/modules/es.typed-array.uint8-array"); + +require("core-js/modules/es.typed-array.uint8-clamped-array"); + +require("core-js/modules/es.typed-array.uint16-array"); + +require("core-js/modules/es.typed-array.uint32-array"); + +require("core-js/modules/es.typed-array.copy-within"); + +require("core-js/modules/es.typed-array.every"); + +require("core-js/modules/es.typed-array.fill"); + +require("core-js/modules/es.typed-array.filter"); + +require("core-js/modules/es.typed-array.find"); + +require("core-js/modules/es.typed-array.find-index"); + +require("core-js/modules/es.typed-array.for-each"); + +require("core-js/modules/es.typed-array.from"); + +require("core-js/modules/es.typed-array.includes"); + +require("core-js/modules/es.typed-array.index-of"); + +require("core-js/modules/es.typed-array.iterator"); + +require("core-js/modules/es.typed-array.join"); + +require("core-js/modules/es.typed-array.last-index-of"); + +require("core-js/modules/es.typed-array.map"); + +require("core-js/modules/es.typed-array.of"); + +require("core-js/modules/es.typed-array.reduce"); + +require("core-js/modules/es.typed-array.reduce-right"); + +require("core-js/modules/es.typed-array.reverse"); + +require("core-js/modules/es.typed-array.set"); + +require("core-js/modules/es.typed-array.slice"); + +require("core-js/modules/es.typed-array.some"); + +require("core-js/modules/es.typed-array.sort"); + +require("core-js/modules/es.typed-array.subarray"); + +require("core-js/modules/es.typed-array.to-locale-string"); + +require("core-js/modules/es.typed-array.to-string"); + +require("core-js/modules/es.weak-map"); + +require("core-js/modules/es.weak-set"); + +require("core-js/modules/web.dom-collections.for-each"); + +require("core-js/modules/web.dom-collections.iterator"); + +require("core-js/modules/web.immediate"); + +require("core-js/modules/web.queue-microtask"); + +require("core-js/modules/web.url"); + +require("core-js/modules/web.url.to-json"); + +require("core-js/modules/web.url-search-params"); + Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; -require("core-js/modules/web.dom.iterable"); +require("regenerator-runtime/runtime"); -require("core-js/modules/es6.array.iterator"); +var _index = require("../src/index"); -require("core-js/modules/es7.array.includes"); +Object.keys(_index).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _index[key]; + } + }); +}); -require("core-js/modules/es6.string.includes"); +},{"../src/index":600,"core-js/modules/es.array-buffer.constructor":191,"core-js/modules/es.array-buffer.is-view":192,"core-js/modules/es.array-buffer.slice":193,"core-js/modules/es.array.concat":194,"core-js/modules/es.array.copy-within":195,"core-js/modules/es.array.every":196,"core-js/modules/es.array.fill":197,"core-js/modules/es.array.filter":198,"core-js/modules/es.array.find":200,"core-js/modules/es.array.find-index":199,"core-js/modules/es.array.flat":202,"core-js/modules/es.array.flat-map":201,"core-js/modules/es.array.for-each":203,"core-js/modules/es.array.from":204,"core-js/modules/es.array.includes":205,"core-js/modules/es.array.index-of":206,"core-js/modules/es.array.iterator":207,"core-js/modules/es.array.join":208,"core-js/modules/es.array.last-index-of":209,"core-js/modules/es.array.map":210,"core-js/modules/es.array.of":211,"core-js/modules/es.array.reduce":213,"core-js/modules/es.array.reduce-right":212,"core-js/modules/es.array.reverse":214,"core-js/modules/es.array.slice":215,"core-js/modules/es.array.some":216,"core-js/modules/es.array.sort":217,"core-js/modules/es.array.species":218,"core-js/modules/es.array.splice":219,"core-js/modules/es.array.unscopables.flat":221,"core-js/modules/es.array.unscopables.flat-map":220,"core-js/modules/es.data-view":222,"core-js/modules/es.date.to-iso-string":223,"core-js/modules/es.date.to-json":224,"core-js/modules/es.date.to-primitive":225,"core-js/modules/es.date.to-string":226,"core-js/modules/es.function.has-instance":227,"core-js/modules/es.function.name":228,"core-js/modules/es.json.to-string-tag":229,"core-js/modules/es.map":230,"core-js/modules/es.math.acosh":231,"core-js/modules/es.math.asinh":232,"core-js/modules/es.math.atanh":233,"core-js/modules/es.math.cbrt":234,"core-js/modules/es.math.clz32":235,"core-js/modules/es.math.cosh":236,"core-js/modules/es.math.expm1":237,"core-js/modules/es.math.fround":238,"core-js/modules/es.math.hypot":239,"core-js/modules/es.math.imul":240,"core-js/modules/es.math.log10":241,"core-js/modules/es.math.log1p":242,"core-js/modules/es.math.log2":243,"core-js/modules/es.math.sign":244,"core-js/modules/es.math.sinh":245,"core-js/modules/es.math.tanh":246,"core-js/modules/es.math.to-string-tag":247,"core-js/modules/es.math.trunc":248,"core-js/modules/es.number.constructor":249,"core-js/modules/es.number.epsilon":250,"core-js/modules/es.number.is-finite":251,"core-js/modules/es.number.is-integer":252,"core-js/modules/es.number.is-nan":253,"core-js/modules/es.number.is-safe-integer":254,"core-js/modules/es.number.max-safe-integer":255,"core-js/modules/es.number.min-safe-integer":256,"core-js/modules/es.number.parse-float":257,"core-js/modules/es.number.parse-int":258,"core-js/modules/es.number.to-fixed":259,"core-js/modules/es.number.to-precision":260,"core-js/modules/es.object.assign":261,"core-js/modules/es.object.define-getter":262,"core-js/modules/es.object.define-setter":263,"core-js/modules/es.object.entries":264,"core-js/modules/es.object.freeze":265,"core-js/modules/es.object.from-entries":266,"core-js/modules/es.object.get-own-property-descriptor":267,"core-js/modules/es.object.get-own-property-descriptors":268,"core-js/modules/es.object.get-own-property-names":269,"core-js/modules/es.object.get-prototype-of":270,"core-js/modules/es.object.is":274,"core-js/modules/es.object.is-extensible":271,"core-js/modules/es.object.is-frozen":272,"core-js/modules/es.object.is-sealed":273,"core-js/modules/es.object.keys":275,"core-js/modules/es.object.lookup-getter":276,"core-js/modules/es.object.lookup-setter":277,"core-js/modules/es.object.prevent-extensions":278,"core-js/modules/es.object.seal":279,"core-js/modules/es.object.set-prototype-of":280,"core-js/modules/es.object.to-string":281,"core-js/modules/es.object.values":282,"core-js/modules/es.parse-float":283,"core-js/modules/es.parse-int":284,"core-js/modules/es.promise":286,"core-js/modules/es.promise.finally":285,"core-js/modules/es.reflect.apply":287,"core-js/modules/es.reflect.construct":288,"core-js/modules/es.reflect.define-property":289,"core-js/modules/es.reflect.delete-property":290,"core-js/modules/es.reflect.get":293,"core-js/modules/es.reflect.get-own-property-descriptor":291,"core-js/modules/es.reflect.get-prototype-of":292,"core-js/modules/es.reflect.has":294,"core-js/modules/es.reflect.is-extensible":295,"core-js/modules/es.reflect.own-keys":296,"core-js/modules/es.reflect.prevent-extensions":297,"core-js/modules/es.reflect.set":299,"core-js/modules/es.reflect.set-prototype-of":298,"core-js/modules/es.regexp.constructor":300,"core-js/modules/es.regexp.exec":301,"core-js/modules/es.regexp.flags":302,"core-js/modules/es.regexp.to-string":303,"core-js/modules/es.set":304,"core-js/modules/es.string.anchor":305,"core-js/modules/es.string.big":306,"core-js/modules/es.string.blink":307,"core-js/modules/es.string.bold":308,"core-js/modules/es.string.code-point-at":309,"core-js/modules/es.string.ends-with":310,"core-js/modules/es.string.fixed":311,"core-js/modules/es.string.fontcolor":312,"core-js/modules/es.string.fontsize":313,"core-js/modules/es.string.from-code-point":314,"core-js/modules/es.string.includes":315,"core-js/modules/es.string.italics":316,"core-js/modules/es.string.iterator":317,"core-js/modules/es.string.link":318,"core-js/modules/es.string.match":319,"core-js/modules/es.string.pad-end":320,"core-js/modules/es.string.pad-start":321,"core-js/modules/es.string.raw":322,"core-js/modules/es.string.repeat":323,"core-js/modules/es.string.replace":324,"core-js/modules/es.string.search":325,"core-js/modules/es.string.small":326,"core-js/modules/es.string.split":327,"core-js/modules/es.string.starts-with":328,"core-js/modules/es.string.strike":329,"core-js/modules/es.string.sub":330,"core-js/modules/es.string.sup":331,"core-js/modules/es.string.trim":334,"core-js/modules/es.string.trim-end":332,"core-js/modules/es.string.trim-start":333,"core-js/modules/es.symbol":340,"core-js/modules/es.symbol.async-iterator":335,"core-js/modules/es.symbol.description":336,"core-js/modules/es.symbol.has-instance":337,"core-js/modules/es.symbol.is-concat-spreadable":338,"core-js/modules/es.symbol.iterator":339,"core-js/modules/es.symbol.match":341,"core-js/modules/es.symbol.replace":342,"core-js/modules/es.symbol.search":343,"core-js/modules/es.symbol.species":344,"core-js/modules/es.symbol.split":345,"core-js/modules/es.symbol.to-primitive":346,"core-js/modules/es.symbol.to-string-tag":347,"core-js/modules/es.symbol.unscopables":348,"core-js/modules/es.typed-array.copy-within":349,"core-js/modules/es.typed-array.every":350,"core-js/modules/es.typed-array.fill":351,"core-js/modules/es.typed-array.filter":352,"core-js/modules/es.typed-array.find":354,"core-js/modules/es.typed-array.find-index":353,"core-js/modules/es.typed-array.float32-array":355,"core-js/modules/es.typed-array.float64-array":356,"core-js/modules/es.typed-array.for-each":357,"core-js/modules/es.typed-array.from":358,"core-js/modules/es.typed-array.includes":359,"core-js/modules/es.typed-array.index-of":360,"core-js/modules/es.typed-array.int16-array":361,"core-js/modules/es.typed-array.int32-array":362,"core-js/modules/es.typed-array.int8-array":363,"core-js/modules/es.typed-array.iterator":364,"core-js/modules/es.typed-array.join":365,"core-js/modules/es.typed-array.last-index-of":366,"core-js/modules/es.typed-array.map":367,"core-js/modules/es.typed-array.of":368,"core-js/modules/es.typed-array.reduce":370,"core-js/modules/es.typed-array.reduce-right":369,"core-js/modules/es.typed-array.reverse":371,"core-js/modules/es.typed-array.set":372,"core-js/modules/es.typed-array.slice":373,"core-js/modules/es.typed-array.some":374,"core-js/modules/es.typed-array.sort":375,"core-js/modules/es.typed-array.subarray":376,"core-js/modules/es.typed-array.to-locale-string":377,"core-js/modules/es.typed-array.to-string":378,"core-js/modules/es.typed-array.uint16-array":379,"core-js/modules/es.typed-array.uint32-array":380,"core-js/modules/es.typed-array.uint8-array":381,"core-js/modules/es.typed-array.uint8-clamped-array":382,"core-js/modules/es.weak-map":383,"core-js/modules/es.weak-set":384,"core-js/modules/web.dom-collections.for-each":385,"core-js/modules/web.dom-collections.iterator":386,"core-js/modules/web.immediate":387,"core-js/modules/web.queue-microtask":388,"core-js/modules/web.url":390,"core-js/modules/web.url-search-params":389,"core-js/modules/web.url.to-json":391,"regenerator-runtime/runtime":515}],565:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; var _lodash = _interopRequireDefault(require("lodash")); @@ -59799,6 +67281,17 @@ function () { value: function mergeTags(val, memo) { return memo === '' ? "(".concat(val, ")") : "".concat(memo, " and (").concat(val, ")"); } + }, { + key: "validateCountOption", + value: function validateCountOption(val, optionName) { + val = parseInt(val); + + if (isNaN(val) || val < 0) { + throw new Error("".concat(optionName, " must be a non negative integer")); + } + + return val; + } }, { key: "validateLanguage", value: function validateLanguage(val) { @@ -59808,19 +67301,32 @@ function () { return val; } + }, { + key: "validateRetryOptions", + value: function validateRetryOptions(options) { + if (options.retryTagFilter && !options.retry) { + throw new Error("a positive --retry count must be specified when setting --retryTagFilter"); + } + } }, { key: "parse", value: function parse(argv) { var program = new _commander.Command(_path.default.basename(argv[1])); - program.usage('[options] [...]').version(_package.version, '-v, --version').option('-b, --backtrace', 'show full backtrace for errors').option('-d, --dry-run', 'invoke formatters without executing steps').option('--exit', 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit').option('--fail-fast', 'abort the run on first failure').option('-f, --format ', 'specify the output format, optionally supply PATH to redirect formatter output (repeatable)', ArgvParser.collect, []).option('--format-options ', 'provide options for formatters (repeatable)', ArgvParser.mergeJson('--format-options'), {}).option('--i18n-keywords ', 'list language keywords', ArgvParser.validateLanguage, '').option('--i18n-languages', 'list languages').option('--language ', 'provide the default language for feature files', '').option('--name ', 'only execute the scenarios with name matching the expression (repeatable)', ArgvParser.collect, []).option('--no-strict', 'succeed even if there are pending steps').option('--order ', 'run scenarios in the specified order. Type should be `defined` or `random`', 'defined').option('-p, --profile ', 'specify the profile to use (repeatable)', ArgvParser.collect, []).option('--parallel ', 'run in parallel with the given number of slaves', parseInt, 0).option('-r, --require ', 'require files before executing features (repeatable)', ArgvParser.collect, []).option('--require-module ', 'require node modules before requiring files (repeatable)', ArgvParser.collect, []).option('-t, --tags ', 'only execute the features or scenarios with tags matching the expression (repeatable)', ArgvParser.mergeTags, '').option('--world-parameters ', 'provide parameters that will be passed to the world constructor (repeatable)', ArgvParser.mergeJson('--world-parameters'), {}); + program.usage('[options] [...]').version(_package.version, '-v, --version').option('-b, --backtrace', 'show full backtrace for errors').option('-d, --dry-run', 'invoke formatters without executing steps').option('--exit', 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit').option('--fail-fast', 'abort the run on first failure').option('-f, --format ', 'specify the output format, optionally supply PATH to redirect formatter output (repeatable)', ArgvParser.collect, []).option('--format-options ', 'provide options for formatters (repeatable)', ArgvParser.mergeJson('--format-options'), {}).option('--i18n-keywords ', 'list language keywords', ArgvParser.validateLanguage, '').option('--i18n-languages', 'list languages').option('--language ', 'provide the default language for feature files', '').option('--name ', 'only execute the scenarios with name matching the expression (repeatable)', ArgvParser.collect, []).option('--no-strict', 'succeed even if there are pending steps').option('--order ', 'run scenarios in the specified order. Type should be `defined` or `random`', 'defined').option('-p, --profile ', 'specify the profile to use (repeatable)', ArgvParser.collect, []).option('--parallel ', 'run in parallel with the given number of slaves', function (val) { + return ArgvParser.validateCountOption(val, '--parallel'); + }, 0).option('-r, --require ', 'require files before executing features (repeatable)', ArgvParser.collect, []).option('--require-module ', 'require node modules before requiring files (repeatable)', ArgvParser.collect, []).option('--retry ', 'specify the number of times to retry failing test cases (default: 0)', function (val) { + return ArgvParser.validateCountOption(val, '--retry'); + }, 0).option('--retryTagFilter ', "only retries the features or scenarios with tags matching the expression (repeatable).\n This option requires '--retry' to be specified.", ArgvParser.mergeTags, '').option('-t, --tags ', 'only execute the features or scenarios with tags matching the expression (repeatable)', ArgvParser.mergeTags, '').option('--world-parameters ', 'provide parameters that will be passed to the world constructor (repeatable)', ArgvParser.mergeJson('--world-parameters'), {}); program.on('--help', function () { /* eslint-disable no-console */ - console.log(' For more details please visit https://github.com/cucumber/cucumber-js#cli\n'); + console.log(' For more details please visit https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md\n'); /* eslint-enable no-console */ }); program.parse(argv); + var options = program.opts(); + ArgvParser.validateRetryOptions(options); return { - options: program.opts(), + options: options, args: program.args }; } @@ -59831,7 +67337,7 @@ function () { exports.default = ArgvParser; -},{"../../package.json":328,"commander":38,"core-js/modules/es6.array.iterator":128,"core-js/modules/es6.string.includes":139,"core-js/modules/es7.array.includes":143,"core-js/modules/web.dom.iterable":145,"gherkin":214,"lodash":248,"path":260}],330:[function(require,module,exports){ +},{"../../package.json":563,"commander":42,"gherkin":450,"lodash":481,"path":493}],566:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -59839,22 +67345,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.promise"); - -require("core-js/modules/es6.regexp.split"); - -require("core-js/modules/web.dom.iterable"); - -require("core-js/modules/es6.regexp.replace"); - -require("core-js/modules/es6.function.name"); - -require("regenerator-runtime/runtime"); - var _lodash = _interopRequireDefault(require("lodash")); var _argv_parser = _interopRequireDefault(require("./argv_parser")); @@ -59915,7 +67405,7 @@ function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); function build(_x) { @@ -60003,6 +67493,8 @@ function () { dryRun: !!this.options.dryRun, failFast: !!this.options.failFast, filterStacktraces: !this.options.backtrace, + retry: this.options.retry, + retryTagFilter: this.options.retryTagFilter, strict: !!this.options.strict, worldParameters: this.options.worldParameters }, @@ -60083,7 +67575,7 @@ function () { return _context3.stop(); } } - }, _callee3, this); + }, _callee3); })); return function (_x5) { @@ -60096,7 +67588,7 @@ function () { return _context4.stop(); } } - }, _callee4, this); + }, _callee4); })); return function (_x4) { @@ -60115,7 +67607,7 @@ function () { return _context5.stop(); } } - }, _callee5, this); + }, _callee5); })); function expandPaths(_x2, _x3) { @@ -60260,7 +67752,7 @@ function () { return _context7.stop(); } } - }, _callee7, this); + }, _callee7); })); return function (_x7) { @@ -60303,7 +67795,7 @@ function () { exports.default = ConfigurationBuilder; -},{"./argv_parser":329,"./option_splitter":335,"bluebird":18,"core-js/modules/es6.function.name":129,"core-js/modules/es6.promise":132,"core-js/modules/es6.regexp.replace":136,"core-js/modules/es6.regexp.split":137,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"core-js/modules/web.dom.iterable":145,"glob":229,"lodash":248,"mz/fs":251,"path":260,"regenerator-runtime/runtime":283}],331:[function(require,module,exports){ +},{"./argv_parser":565,"./option_splitter":571,"bluebird":21,"glob":465,"lodash":481,"mz/fs":484,"path":493}],567:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -60314,20 +67806,6 @@ exports.getTestCasesFromFilesystem = getTestCasesFromFilesystem; exports.getTestCases = getTestCases; exports.orderTestCases = orderTestCases; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/web.dom.iterable"); - -require("regenerator-runtime/runtime"); - -require("core-js/modules/es6.promise"); - -require("core-js/modules/es6.regexp.to-string"); - -require("core-js/modules/es6.regexp.split"); - var _lodash = _interopRequireDefault(require("lodash")); var _argv_parser = _interopRequireDefault(require("./argv_parser")); @@ -60392,7 +67870,7 @@ function _getExpandedArgv() { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return _getExpandedArgv.apply(this, arguments); } @@ -60448,7 +67926,7 @@ function _getTestCasesFromFilesystem() { return _context2.stop(); } } - }, _callee2, this); + }, _callee2); })); return function (_x4) { @@ -60465,7 +67943,7 @@ function _getTestCasesFromFilesystem() { return _context3.stop(); } } - }, _callee3, this); + }, _callee3); })); return _getTestCasesFromFilesystem.apply(this, arguments); } @@ -60524,7 +68002,7 @@ function _getTestCases() { return _context4.stop(); } } - }, _callee4, this); + }, _callee4); })); return _getTestCases.apply(this, arguments); } @@ -60553,7 +68031,7 @@ function orderTestCases(testCases, order) { } } -},{"./argv_parser":329,"./profile_loader":336,"bluebird":18,"core-js/modules/es6.promise":132,"core-js/modules/es6.regexp.split":137,"core-js/modules/es6.regexp.to-string":138,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"core-js/modules/web.dom.iterable":145,"gherkin":214,"knuth-shuffle-seeded":247,"lodash":248,"mz/fs":251,"path":260,"regenerator-runtime/runtime":283}],332:[function(require,module,exports){ +},{"./argv_parser":565,"./profile_loader":572,"bluebird":21,"gherkin":450,"knuth-shuffle-seeded":480,"lodash":481,"mz/fs":484,"path":493}],568:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -60562,20 +68040,6 @@ Object.defineProperty(exports, "__esModule", { exports.getLanguages = getLanguages; exports.getKeywords = getKeywords; -require("core-js/modules/es6.string.iterator"); - -require("core-js/modules/es6.array.from"); - -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/web.dom.iterable"); - -require("core-js/modules/es6.function.name"); - -require("core-js/modules/es6.regexp.to-string"); - var _lodash = _interopRequireDefault(require("lodash")); var _gherkin = _interopRequireDefault(require("gherkin")); @@ -60648,7 +68112,7 @@ function getKeywords(isoCode) { return getAsTable(['ENGLISH KEYWORD', 'NATIVE KEYWORDS'], rows); } -},{"cli-table3":23,"core-js/modules/es6.array.from":127,"core-js/modules/es6.function.name":129,"core-js/modules/es6.regexp.to-string":138,"core-js/modules/es6.string.iterator":140,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"core-js/modules/web.dom.iterable":145,"gherkin":214,"lodash":248,"title-case":318}],333:[function(require,module,exports){ +},{"cli-table3":26,"gherkin":450,"lodash":481,"title-case":549}],569:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -60656,16 +68120,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es6.array.iterator"); - -require("core-js/modules/es6.object.keys"); - -require("core-js/modules/es6.promise"); - -require("core-js/modules/web.dom.iterable"); - -require("regenerator-runtime/runtime"); - var _helpers = require("../formatter/helpers"); var _helpers2 = require("./helpers"); @@ -60690,7 +68144,7 @@ var _bluebird = _interopRequireDefault(require("bluebird")); var _master = _interopRequireDefault(require("../runtime/parallel/master")); -var _runtime2 = _interopRequireDefault(require("../runtime")); +var _runtime = _interopRequireDefault(require("../runtime")); var _support_code_library_builder = _interopRequireDefault(require("../support_code_library_builder")); @@ -60698,7 +68152,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -60822,7 +68278,7 @@ function () { supportCodeLibrary: supportCodeLibrary }, formatOptions); - if (!formatOptions.hasOwnProperty('colorsEnabled')) { + if (!Object.prototype.hasOwnProperty.call(formatOptions, 'colorsEnabled')) { typeOptions.colorsEnabled = !!stream.isTTY; } @@ -60838,7 +68294,7 @@ function () { return _context3.stop(); } } - }, _callee2, this); + }, _callee2); })); return function (_x2) { @@ -60858,7 +68314,7 @@ function () { return _context4.stop(); } } - }, _callee3, this); + }, _callee3); })); function initializeFormatters(_x) { @@ -60957,6 +68413,7 @@ function () { } parallelRuntimeMaster = new _master.default({ + cwd: this.cwd, eventBroadcaster: eventBroadcaster, options: configuration.runtimeOptions, supportCodePaths: configuration.supportCodePaths, @@ -60976,7 +68433,7 @@ function () { break; case 25: - runtime = new _runtime2.default({ + runtime = new _runtime.default({ eventBroadcaster: eventBroadcaster, options: configuration.runtimeOptions, supportCodeLibrary: supportCodeLibrary, @@ -61019,7 +68476,7 @@ function () { exports.default = Cli; -},{"../formatter/builder":337,"../formatter/helpers":343,"../pickle_filter":368,"../runtime":371,"../runtime/parallel/master":373,"../support_code_library_builder":381,"./configuration_builder":330,"./helpers":331,"./i18n":332,"./install_validator":334,"bluebird":18,"core-js/modules/es6.array.iterator":128,"core-js/modules/es6.object.keys":130,"core-js/modules/es6.promise":132,"core-js/modules/web.dom.iterable":145,"events":209,"mz/fs":251,"path":260,"regenerator-runtime/runtime":283}],334:[function(require,module,exports){ +},{"../formatter/builder":573,"../formatter/helpers":579,"../pickle_filter":606,"../runtime":609,"../runtime/parallel/master":611,"../support_code_library_builder":619,"./configuration_builder":566,"./helpers":567,"./i18n":568,"./install_validator":570,"bluebird":21,"events":444,"mz/fs":484,"path":493}],570:[function(require,module,exports){ (function (__dirname){ "use strict"; @@ -61028,10 +68485,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.validateInstall = validateInstall; -require("regenerator-runtime/runtime"); - -require("core-js/modules/es6.promise"); - var _bluebird = require("bluebird"); var _fs = _interopRequireDefault(require("mz/fs")); @@ -61095,13 +68548,14 @@ function _validateInstall() { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return _validateInstall.apply(this, arguments); } }).call(this,"/src/cli") -},{"bluebird":18,"core-js/modules/es6.promise":132,"mz/fs":251,"path":260,"regenerator-runtime/runtime":283,"resolve":285}],335:[function(require,module,exports){ + +},{"bluebird":21,"mz/fs":484,"path":493,"resolve":517}],571:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -61109,8 +68563,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es6.regexp.split"); - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } @@ -61147,7 +68599,7 @@ function partNeedsRecombined(i) { return i % 2 === 0; } -},{"core-js/modules/es6.regexp.split":137}],336:[function(require,module,exports){ +},{}],572:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -61155,14 +68607,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.promise"); - -require("regenerator-runtime/runtime"); - var _lodash = _interopRequireDefault(require("lodash")); var _fs = _interopRequireDefault(require("mz/fs")); @@ -61297,7 +68741,7 @@ function () { exports.default = ProfileLoader; -},{"core-js/modules/es6.promise":132,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"lodash":248,"mz/fs":251,"path":260,"regenerator-runtime/runtime":283,"string-argv":312}],337:[function(require,module,exports){ +},{"lodash":481,"mz/fs":484,"path":493,"string-argv":542}],573:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -61305,12 +68749,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/web.dom.iterable"); - -require("core-js/modules/es6.array.iterator"); - -require("core-js/modules/es6.object.keys"); - var _event_protocol_formatter = _interopRequireDefault(require("./event_protocol_formatter")); var _get_color_fns = _interopRequireDefault(require("./get_color_fns")); @@ -61339,7 +68777,9 @@ var _usage_json_formatter = _interopRequireDefault(require("./usage_json_formatt function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -61452,7 +68892,7 @@ function () { exports.default = FormatterBuilder; -},{"./event_protocol_formatter":338,"./get_color_fns":339,"./json_formatter":352,"./progress_bar_formatter":353,"./progress_formatter":354,"./rerun_formatter":355,"./snippets_formatter":356,"./step_definition_snippet_builder":357,"./step_definition_snippet_builder/javascript_snippet_syntax":358,"./summary_formatter":359,"./usage_formatter":360,"./usage_json_formatter":361,"core-js/modules/es6.array.iterator":128,"core-js/modules/es6.object.keys":130,"core-js/modules/web.dom.iterable":145,"path":260}],338:[function(require,module,exports){ +},{"./event_protocol_formatter":574,"./get_color_fns":575,"./json_formatter":590,"./progress_bar_formatter":591,"./progress_formatter":592,"./rerun_formatter":593,"./snippets_formatter":594,"./step_definition_snippet_builder":595,"./step_definition_snippet_builder/javascript_snippet_syntax":596,"./summary_formatter":597,"./usage_formatter":598,"./usage_json_formatter":599,"path":493}],574:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -61460,22 +68900,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/web.dom.iterable"); - -require("core-js/modules/es6.array.iterator"); - -require("core-js/modules/es6.object.keys"); - -require("core-js/modules/es6.object.set-prototype-of"); - -require("core-js/modules/es6.regexp.replace"); - -require("core-js/modules/es6.regexp.constructor"); - var _escapeStringRegexp = _interopRequireDefault(require("escape-string-regexp")); var _ = _interopRequireDefault(require("./")); @@ -61486,7 +68910,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -61556,7 +68982,7 @@ function (_Formatter) { exports.default = EventProtocolFormatter; -},{"./":351,"core-js/modules/es6.array.iterator":128,"core-js/modules/es6.object.keys":130,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.regexp.constructor":133,"core-js/modules/es6.regexp.replace":136,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"core-js/modules/web.dom.iterable":145,"escape-string-regexp":208,"path":260}],339:[function(require,module,exports){ +},{"./":589,"escape-string-regexp":443,"path":493}],575:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -61588,7 +69014,7 @@ function getColorFns(enabled) { } } -},{"../status":377,"colors/safe":37,"lodash":248}],340:[function(require,module,exports){ +},{"../status":615,"colors/safe":41,"lodash":481}],576:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -61604,7 +69030,7 @@ function formatError(error, colorFns) { }); } -},{"assertion-error-formatter":13}],341:[function(require,module,exports){ +},{"assertion-error-formatter":16}],577:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -61612,9 +69038,23 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _gherkin_document_parser = require("./gherkin_document_parser"); +var _lodash = _interopRequireDefault(require("lodash")); -var _pickle_parser = require("./pickle_parser"); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -61628,113 +69068,156 @@ function () { function EventDataCollector(eventBroadcaster) { _classCallCheck(this, EventDataCollector); - eventBroadcaster.on('gherkin-document', this.storeGherkinDocument.bind(this)).on('pickle-accepted', this.storePickle.bind(this)).on('test-case-prepared', this.storeTestCase.bind(this)).on('test-step-attachment', this.storeTestStepAttachment.bind(this)).on('test-step-finished', this.storeTestStepResult.bind(this)).on('test-case-finished', this.storeTestCaseResult.bind(this)); + eventBroadcaster.on('gherkin-document', this.storeGherkinDocument.bind(this)).on('pickle', this.storePickle.bind(this)).on('test-case-prepared', this.storeTestCase.bind(this)).on('test-step-attachment', this.storeTestStepAttachment.bind(this)).on('test-case-started', this.initTestCaseResult.bind(this)).on('test-step-finished', this.storeTestStepResult.bind(this)).on('test-case-finished', this.storeTestCaseResult.bind(this)); this.gherkinDocumentMap = {}; // uri to gherkinDocument - this.pickleMap = {}; // uri:line to {pickle, uri} + this.pickleMap = {}; // uri:line to pickle + + this.testCaseMap = {}; // uri:line to {sourceLocation, steps} - this.testCaseMap = {}; // uri:line to {sourceLocation, steps, result} + this.testCaseAttemptMap = {}; // uri:line:attemptNumber to {result, stepAttachments, stepResults} } _createClass(EventDataCollector, [{ - key: "getTestCaseKey", - value: function getTestCaseKey(_ref) { - var uri = _ref.uri, - line = _ref.line; - return "".concat(uri, ":").concat(line); + key: "getTestCaseAttempts", + value: function getTestCaseAttempts() { + var _this = this; + + return _lodash.default.keys(this.testCaseAttemptMap).map(function (testCaseAttemptKey) { + var _testCaseAttemptKey$s = testCaseAttemptKey.split(':'), + _testCaseAttemptKey$s2 = _slicedToArray(_testCaseAttemptKey$s, 2), + uri = _testCaseAttemptKey$s2[0], + line = _testCaseAttemptKey$s2[1]; + + var testCaseKey = _this.getTestCaseKey({ + uri: uri, + line: line + }); + + return _this.internalGetTestCaseAttempt({ + uri: uri, + testCaseKey: testCaseKey, + testCaseAttemptKey: testCaseAttemptKey + }); + }); } }, { - key: "getTestCaseData", - value: function getTestCaseData(sourceLocation) { - return { - gherkinDocument: this.gherkinDocumentMap[sourceLocation.uri], - pickle: this.pickleMap[this.getTestCaseKey(sourceLocation)], - testCase: this.testCaseMap[this.getTestCaseKey(sourceLocation)] - }; + key: "getTestCaseAttempt", + value: function getTestCaseAttempt(_ref) { + var attemptNumber = _ref.attemptNumber, + sourceLocation = _ref.sourceLocation; + var testCaseKey = this.getTestCaseKey(sourceLocation); + var testCaseAttemptKey = this.getTestCaseAttemptKey({ + attemptNumber: attemptNumber, + sourceLocation: sourceLocation + }); + return this.internalGetTestCaseAttempt({ + uri: sourceLocation.uri, + testCaseKey: testCaseKey, + testCaseAttemptKey: testCaseAttemptKey + }); } }, { - key: "getTestStepData", - value: function getTestStepData(_ref2) { - var sourceLocation = _ref2.testCase.sourceLocation, - index = _ref2.index; - - var _this$getTestCaseData = this.getTestCaseData(sourceLocation), - gherkinDocument = _this$getTestCaseData.gherkinDocument, - pickle = _this$getTestCaseData.pickle, - testCase = _this$getTestCaseData.testCase; - - var result = { - testStep: testCase.steps[index] - }; - - if (result.testStep.sourceLocation) { - var line = result.testStep.sourceLocation.line; - result.gherkinKeyword = (0, _gherkin_document_parser.getStepLineToKeywordMap)(gherkinDocument)[line]; - result.pickleStep = (0, _pickle_parser.getStepLineToPickledStepMap)(pickle)[line]; - } - - return result; + key: "internalGetTestCaseAttempt", + value: function internalGetTestCaseAttempt(_ref2) { + var uri = _ref2.uri, + testCaseKey = _ref2.testCaseKey, + testCaseAttemptKey = _ref2.testCaseAttemptKey; + return _objectSpread({ + gherkinDocument: this.gherkinDocumentMap[uri], + pickle: this.pickleMap[testCaseKey], + testCase: this.testCaseMap[testCaseKey] + }, this.testCaseAttemptMap[testCaseAttemptKey]); + } + }, { + key: "getTestCaseKey", + value: function getTestCaseKey(_ref3) { + var uri = _ref3.uri, + line = _ref3.line; + return "".concat(uri, ":").concat(line); + } + }, { + key: "getTestCaseAttemptKey", + value: function getTestCaseAttemptKey(_ref4) { + var attemptNumber = _ref4.attemptNumber, + _ref4$sourceLocation = _ref4.sourceLocation, + uri = _ref4$sourceLocation.uri, + line = _ref4$sourceLocation.line; + return "".concat(uri, ":").concat(line, ":").concat(attemptNumber); } }, { key: "storeGherkinDocument", - value: function storeGherkinDocument(_ref3) { - var document = _ref3.document, - uri = _ref3.uri; - this.gherkinDocumentMap[uri] = document; + value: function storeGherkinDocument(_ref5) { + var document = _ref5.document, + uri = _ref5.uri; + this.gherkinDocumentMap[uri] = _objectSpread({}, document, { + uri: uri + }); } }, { key: "storePickle", - value: function storePickle(_ref4) { - var pickle = _ref4.pickle, - uri = _ref4.uri; - this.pickleMap["".concat(uri, ":").concat(pickle.locations[0].line)] = pickle; + value: function storePickle(_ref6) { + var pickle = _ref6.pickle, + uri = _ref6.uri; + this.pickleMap["".concat(uri, ":").concat(pickle.locations[0].line)] = _objectSpread({}, pickle, { + uri: uri + }); } }, { key: "storeTestCase", - value: function storeTestCase(_ref5) { - var sourceLocation = _ref5.sourceLocation, - steps = _ref5.steps; + value: function storeTestCase(_ref7) { + var sourceLocation = _ref7.sourceLocation, + steps = _ref7.steps; var key = this.getTestCaseKey(sourceLocation); this.testCaseMap[key] = { sourceLocation: sourceLocation, steps: steps }; } + }, { + key: "initTestCaseResult", + value: function initTestCaseResult(testCaseStartedEvent) { + var testCaseKey = this.getTestCaseKey(testCaseStartedEvent.sourceLocation); + var testCase = this.testCaseMap[testCaseKey]; + var testCaseAttemptKey = this.getTestCaseAttemptKey(testCaseStartedEvent); + this.testCaseAttemptMap[testCaseAttemptKey] = { + attemptNumber: testCaseStartedEvent.attemptNumber, + result: {}, + stepAttachments: testCase.steps.map(function (_) { + return []; + }), + stepResults: testCase.steps.map(function (_) { + return null; + }) + }; + } }, { key: "storeTestStepAttachment", - value: function storeTestStepAttachment(_ref6) { - var index = _ref6.index, - testCase = _ref6.testCase, - data = _ref6.data, - media = _ref6.media; - var key = this.getTestCaseKey(testCase.sourceLocation); - var step = this.testCaseMap[key].steps[index]; - - if (!step.attachments) { - step.attachments = []; - } - - step.attachments.push({ + value: function storeTestStepAttachment(_ref8) { + var index = _ref8.index, + testCase = _ref8.testCase, + data = _ref8.data, + media = _ref8.media; + var key = this.getTestCaseAttemptKey(testCase); + this.testCaseAttemptMap[key].stepAttachments[index].push({ data: data, media: media }); } }, { key: "storeTestStepResult", - value: function storeTestStepResult(_ref7) { - var index = _ref7.index, - testCase = _ref7.testCase, - result = _ref7.result; - var key = this.getTestCaseKey(testCase.sourceLocation); - this.testCaseMap[key].steps[index].result = result; + value: function storeTestStepResult(_ref9) { + var index = _ref9.index, + testCase = _ref9.testCase, + result = _ref9.result; + var key = this.getTestCaseAttemptKey(testCase); + this.testCaseAttemptMap[key].stepResults[index] = result; } }, { key: "storeTestCaseResult", - value: function storeTestCaseResult(_ref8) { - var sourceLocation = _ref8.sourceLocation, - result = _ref8.result; - var key = this.getTestCaseKey(sourceLocation); - this.testCaseMap[key].result = result; + value: function storeTestCaseResult(testCaseFinishedEvent) { + var key = this.getTestCaseAttemptKey(testCaseFinishedEvent); + this.testCaseAttemptMap[key].result = testCaseFinishedEvent.result; } }]); @@ -61743,7 +69226,7 @@ function () { exports.default = EventDataCollector; -},{"./gherkin_document_parser":342,"./pickle_parser":347}],342:[function(require,module,exports){ +},{"lodash":481}],578:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -61768,12 +69251,18 @@ function getScenarioLineToDescriptionMap(gherkinDocument) { }).fromPairs().value(); } -},{"lodash":248}],343:[function(require,module,exports){ +},{"lodash":481}],579:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +Object.defineProperty(exports, "parseTestCaseAttempt", { + enumerable: true, + get: function get() { + return _test_case_attempt_parser.parseTestCaseAttempt; + } +}); Object.defineProperty(exports, "EventDataCollector", { enumerable: true, get: function get() { @@ -61804,6 +69293,18 @@ Object.defineProperty(exports, "formatIssue", { return _issue_helpers.formatIssue; } }); +Object.defineProperty(exports, "isWarning", { + enumerable: true, + get: function get() { + return _issue_helpers.isWarning; + } +}); +Object.defineProperty(exports, "isFailure", { + enumerable: true, + get: function get() { + return _issue_helpers.isFailure; + } +}); Object.defineProperty(exports, "isIssue", { enumerable: true, get: function get() { @@ -61838,6 +69339,8 @@ var PickleParser = _interopRequireWildcard(require("./pickle_parser")); exports.PickleParser = PickleParser; +var _test_case_attempt_parser = require("./test_case_attempt_parser"); + var _event_data_collector = _interopRequireDefault(require("./event_data_collector")); var _keyword_type = _interopRequireWildcard(require("./keyword_type")); @@ -61856,233 +69359,62 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } -},{"./error_helpers":340,"./event_data_collector":341,"./gherkin_document_parser":342,"./issue_helpers":344,"./keyword_type":345,"./location_helpers":346,"./pickle_parser":347,"./summary_helpers":349,"./usage_helpers":350}],344:[function(require,module,exports){ +},{"./error_helpers":576,"./event_data_collector":577,"./gherkin_document_parser":578,"./issue_helpers":580,"./keyword_type":581,"./location_helpers":582,"./pickle_parser":583,"./summary_helpers":585,"./test_case_attempt_parser":587,"./usage_helpers":588}],580:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.isFailure = isFailure; +exports.isWarning = isWarning; exports.isIssue = isIssue; exports.formatIssue = formatIssue; -require("core-js/modules/es6.string.iterator"); - -require("core-js/modules/es6.array.from"); - -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.function.name"); - -require("core-js/modules/web.dom.iterable"); - -require("core-js/modules/es6.regexp.to-string"); - -require("core-js/modules/es6.regexp.replace"); - var _lodash = _interopRequireDefault(require("lodash")); -var _location_helpers = require("./location_helpers"); - -var _step_result_helpers = require("./step_result_helpers"); - var _indentString = _interopRequireDefault(require("indent-string")); var _status = _interopRequireDefault(require("../../status")); -var _figures = _interopRequireDefault(require("figures")); - -var _cliTable = _interopRequireDefault(require("cli-table3")); - -var _keyword_type = _interopRequireWildcard(require("./keyword_type")); - -var _step_arguments = require("../../step_arguments"); - -var _gherkin_document_parser = require("./gherkin_document_parser"); - -var _pickle_parser = require("./pickle_parser"); - -var _CHARACTERS, _IS_ISSUE; - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } +var _test_case_attempt_formatter = require("./test_case_attempt_formatter"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -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 _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var CHARACTERS = (_CHARACTERS = {}, _defineProperty(_CHARACTERS, _status.default.AMBIGUOUS, _figures.default.cross), _defineProperty(_CHARACTERS, _status.default.FAILED, _figures.default.cross), _defineProperty(_CHARACTERS, _status.default.PASSED, _figures.default.tick), _defineProperty(_CHARACTERS, _status.default.PENDING, '?'), _defineProperty(_CHARACTERS, _status.default.SKIPPED, '-'), _defineProperty(_CHARACTERS, _status.default.UNDEFINED, '?'), _CHARACTERS); -var IS_ISSUE = (_IS_ISSUE = {}, _defineProperty(_IS_ISSUE, _status.default.AMBIGUOUS, true), _defineProperty(_IS_ISSUE, _status.default.FAILED, true), _defineProperty(_IS_ISSUE, _status.default.PASSED, false), _defineProperty(_IS_ISSUE, _status.default.PENDING, true), _defineProperty(_IS_ISSUE, _status.default.SKIPPED, false), _defineProperty(_IS_ISSUE, _status.default.UNDEFINED, true), _IS_ISSUE); +function isFailure(result) { + return result.status === _status.default.AMBIGUOUS || result.status === _status.default.FAILED && !result.retried; +} -function formatDataTable(arg) { - var rows = arg.rows.map(function (row) { - return row.cells.map(function (cell) { - return cell.value.replace(/\\/g, '\\\\').replace(/\n/g, '\\n'); - }); - }); - var table = new _cliTable.default({ - chars: { - bottom: '', - 'bottom-left': '', - 'bottom-mid': '', - 'bottom-right': '', - left: '|', - 'left-mid': '', - mid: '', - 'mid-mid': '', - middle: '|', - right: '|', - 'right-mid': '', - top: '', - 'top-left': '', - 'top-mid': '', - 'top-right': '' - }, - style: { - border: [], - 'padding-left': 1, - 'padding-right': 1 - } - }); - table.push.apply(table, _toConsumableArray(rows)); - return table.toString(); +function isWarning(result) { + return _lodash.default.includes([_status.default.PENDING, _status.default.UNDEFINED], result.status) || result.status === _status.default.FAILED && result.retried; } -function formatDocString(arg) { - return "\"\"\"\n".concat(arg.content, "\n\"\"\""); +function isIssue(result) { + return isFailure(result) || isWarning(result); } -function formatStep(_ref) { +function formatIssue(_ref) { var colorFns = _ref.colorFns, - isBeforeHook = _ref.isBeforeHook, - keyword = _ref.keyword, - keywordType = _ref.keywordType, - pickleStep = _ref.pickleStep, + number = _ref.number, snippetBuilder = _ref.snippetBuilder, - testStep = _ref.testStep; - var status = testStep.result.status; - var colorFn = colorFns[status]; - var identifier; - - if (testStep.sourceLocation) { - identifier = keyword + (pickleStep.text || ''); - } else { - identifier = isBeforeHook ? 'Before' : 'After'; - } - - var text = colorFn("".concat(CHARACTERS[status], " ").concat(identifier)); - var actionLocation = testStep.actionLocation; - - if (actionLocation) { - text += " # ".concat(colorFns.location((0, _location_helpers.formatLocation)(actionLocation))); - } - - text += '\n'; - - if (pickleStep) { - var str; - var iterator = (0, _step_arguments.buildStepArgumentIterator)({ - dataTable: function dataTable(arg) { - return str = formatDataTable(arg); - }, - docString: function docString(arg) { - return str = formatDocString(arg); - } - }); - - _lodash.default.each(pickleStep.arguments, iterator); - - if (str) { - text += (0, _indentString.default)("".concat(colorFn(str), "\n"), 4); - } - } - - if (testStep.attachments) { - testStep.attachments.forEach(function (_ref2) { - var media = _ref2.media, - data = _ref2.data; - var message = media.type === 'text/plain' ? ": ".concat(data) : ''; - text += (0, _indentString.default)("Attachment (".concat(media.type, ")").concat(message, "\n"), 4); - }); - } - - var message = (0, _step_result_helpers.getStepMessage)({ + testCaseAttempt = _ref.testCaseAttempt; + var prefix = "".concat(number, ") "); + var formattedTestCaseAttempt = (0, _test_case_attempt_formatter.formatTestCaseAttempt)({ colorFns: colorFns, - keywordType: keywordType, - pickleStep: pickleStep, snippetBuilder: snippetBuilder, - testStep: testStep + testCaseAttempt: testCaseAttempt }); - - if (message) { - text += "".concat((0, _indentString.default)(message, 4), "\n"); - } - - return text; -} - -function isIssue(status) { - return IS_ISSUE[status]; -} - -function formatIssue(_ref3) { - var colorFns = _ref3.colorFns, - gherkinDocument = _ref3.gherkinDocument, - number = _ref3.number, - pickle = _ref3.pickle, - snippetBuilder = _ref3.snippetBuilder, - testCase = _ref3.testCase; - var prefix = "".concat(number, ") "); - var text = prefix; - var scenarioLocation = (0, _location_helpers.formatLocation)(testCase.sourceLocation); - text += "Scenario: ".concat(pickle.name, " # ").concat(colorFns.location(scenarioLocation), "\n"); - var stepLineToKeywordMap = (0, _gherkin_document_parser.getStepLineToKeywordMap)(gherkinDocument); - var stepLineToPickledStepMap = (0, _pickle_parser.getStepLineToPickledStepMap)(pickle); - var isBeforeHook = true; - var previousKeywordType = _keyword_type.default.PRECONDITION; - - _lodash.default.each(testCase.steps, function (testStep) { - isBeforeHook = isBeforeHook && !testStep.sourceLocation; - var keyword, keywordType, pickleStep; - - if (testStep.sourceLocation) { - pickleStep = stepLineToPickledStepMap[testStep.sourceLocation.line]; - keyword = (0, _pickle_parser.getStepKeyword)({ - pickleStep: pickleStep, - stepLineToKeywordMap: stepLineToKeywordMap - }); - keywordType = (0, _keyword_type.getStepKeywordType)({ - keyword: keyword, - language: gherkinDocument.feature.language, - previousKeywordType: previousKeywordType - }); + var lines = formattedTestCaseAttempt.split('\n'); + var updatedLines = lines.map(function (line, index) { + if (index === 0) { + return "".concat(prefix).concat(line); } - var formattedStep = formatStep({ - colorFns: colorFns, - isBeforeHook: isBeforeHook, - keyword: keyword, - keywordType: keywordType, - pickleStep: pickleStep, - snippetBuilder: snippetBuilder, - testStep: testStep - }); - text += (0, _indentString.default)(formattedStep, prefix.length); - previousKeywordType = keywordType; + return (0, _indentString.default)(line, prefix.length); }); - - return "".concat(text, "\n"); + return updatedLines.join('\n'); } -},{"../../status":377,"../../step_arguments":378,"./gherkin_document_parser":342,"./keyword_type":345,"./location_helpers":346,"./pickle_parser":347,"./step_result_helpers":348,"cli-table3":23,"core-js/modules/es6.array.from":127,"core-js/modules/es6.function.name":129,"core-js/modules/es6.regexp.replace":136,"core-js/modules/es6.regexp.to-string":138,"core-js/modules/es6.string.iterator":140,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"core-js/modules/web.dom.iterable":145,"figures":211,"indent-string":236,"lodash":248}],345:[function(require,module,exports){ +},{"../../status":615,"./test_case_attempt_formatter":586,"indent-string":472,"lodash":481}],581:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -62091,12 +69423,6 @@ Object.defineProperty(exports, "__esModule", { exports.getStepKeywordType = getStepKeywordType; exports.default = void 0; -require("core-js/modules/es7.array.includes"); - -require("core-js/modules/es6.string.includes"); - -require("core-js/modules/es6.array.find"); - var _lodash = _interopRequireDefault(require("lodash")); var _gherkin = _interopRequireDefault(require("gherkin")); @@ -62141,7 +69467,7 @@ function getStepKeywordType(_ref) { } } -},{"core-js/modules/es6.array.find":126,"core-js/modules/es6.string.includes":139,"core-js/modules/es7.array.includes":143,"gherkin":214,"lodash":248}],346:[function(require,module,exports){ +},{"gherkin":450,"lodash":481}],582:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -62153,7 +69479,7 @@ function formatLocation(obj) { return "".concat(obj.uri, ":").concat(obj.line); } -},{}],347:[function(require,module,exports){ +},{}],583:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -62162,6 +69488,7 @@ Object.defineProperty(exports, "__esModule", { exports.getScenarioDescription = getScenarioDescription; exports.getStepKeyword = getStepKeyword; exports.getStepLineToPickledStepMap = getStepLineToPickledStepMap; +exports.getPickleStepLine = getPickleStepLine; var _lodash = _interopRequireDefault(require("lodash")); @@ -62187,92 +69514,82 @@ function getStepKeyword(_ref3) { function getStepLineToPickledStepMap(pickle) { return _lodash.default.chain(pickle.steps).map(function (step) { - return [_lodash.default.last(step.locations).line, step]; + return [getPickleStepLine(step), step]; }).fromPairs().value(); } -},{"lodash":248}],348:[function(require,module,exports){ +function getPickleStepLine(pickleStep) { + return _lodash.default.last(pickleStep.locations).line; +} + +},{"lodash":481}],584:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getStepMessage = getStepMessage; +exports.formatStepArguments = formatStepArguments; -var _error_helpers = require("./error_helpers"); - -var _status = _interopRequireDefault(require("../../status")); +var _cliTable = _interopRequireDefault(require("cli-table3")); -var _indentString = _interopRequireDefault(require("indent-string")); +var _step_arguments = require("../../step_arguments"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function getAmbiguousStepResultMessage(_ref) { - var colorFns = _ref.colorFns, - testStep = _ref.testStep; - return colorFns.ambiguous(testStep.result.exception); -} - -function getFailedStepResultMessage(_ref2) { - var colorFns = _ref2.colorFns, - testStep = _ref2.testStep; - return (0, _error_helpers.formatError)(testStep.result.exception, colorFns); -} - -function getPendingStepResultMessage(_ref3) { - var colorFns = _ref3.colorFns; - return colorFns.pending('Pending'); -} +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } -function getStepMessage(_ref4) { - var colorFns = _ref4.colorFns, - keywordType = _ref4.keywordType, - snippetBuilder = _ref4.snippetBuilder, - testStep = _ref4.testStep, - pickleStep = _ref4.pickleStep; +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - switch (testStep.result.status) { - case _status.default.AMBIGUOUS: - return getAmbiguousStepResultMessage({ - colorFns: colorFns, - testStep: testStep - }); +function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - case _status.default.FAILED: - return getFailedStepResultMessage({ - colorFns: colorFns, - testStep: testStep - }); +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; } } - case _status.default.UNDEFINED: - return getUndefinedStepResultMessage({ - colorFns: colorFns, - keywordType: keywordType, - snippetBuilder: snippetBuilder, - pickleStep: pickleStep - }); +function formatDataTable(arg) { + var table = new _cliTable.default({ + chars: { + bottom: '', + 'bottom-left': '', + 'bottom-mid': '', + 'bottom-right': '', + left: '|', + 'left-mid': '', + mid: '', + 'mid-mid': '', + middle: '|', + right: '|', + 'right-mid': '', + top: '', + 'top-left': '', + 'top-mid': '', + 'top-right': '' + }, + style: { + border: [], + 'padding-left': 1, + 'padding-right': 1 + } + }); + table.push.apply(table, _toConsumableArray(arg.rows)); + return table.toString(); +} - case _status.default.PENDING: - return getPendingStepResultMessage({ - colorFns: colorFns - }); - } +function formatDocString(arg) { + return "\"\"\"\n".concat(arg.content, "\n\"\"\""); } -function getUndefinedStepResultMessage(_ref5) { - var colorFns = _ref5.colorFns, - keywordType = _ref5.keywordType, - snippetBuilder = _ref5.snippetBuilder, - pickleStep = _ref5.pickleStep; - var snippet = snippetBuilder.build({ - keywordType: keywordType, - pickleStep: pickleStep +function formatStepArguments(args) { + var iterator = (0, _step_arguments.buildStepArgumentIterator)({ + dataTable: function dataTable(arg) { + return formatDataTable(arg); + }, + docString: function docString(arg) { + return formatDocString(arg); + } }); - var message = "".concat('Undefined. Implement with the following snippet:' + '\n\n').concat((0, _indentString.default)(snippet, 2), "\n"); - return colorFns.undefined(message); + return args.map(iterator).join('\n'); } -},{"../../status":377,"./error_helpers":340,"indent-string":236}],349:[function(require,module,exports){ +},{"../../step_arguments":616,"cli-table3":26}],585:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -62280,39 +69597,39 @@ Object.defineProperty(exports, "__esModule", { }); exports.formatSummary = formatSummary; -require("core-js/modules/es6.regexp.to-string"); - -require("core-js/modules/web.dom.iterable"); - var _lodash = _interopRequireDefault(require("lodash")); var _duration = _interopRequireDefault(require("duration")); var _status = _interopRequireDefault(require("../../status")); +var _time = require("../../time"); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var STATUS_REPORT_ORDER = [_status.default.FAILED, _status.default.AMBIGUOUS, _status.default.UNDEFINED, _status.default.PENDING, _status.default.SKIPPED, _status.default.PASSED]; function formatSummary(_ref) { var colorFns = _ref.colorFns, - testCaseMap = _ref.testCaseMap, + testCaseAttempts = _ref.testCaseAttempts, testRun = _ref.testRun; var testCaseResults = []; var testStepResults = []; + testCaseAttempts.forEach(function (_ref2) { + var testCase = _ref2.testCase, + result = _ref2.result, + stepResults = _ref2.stepResults; - _lodash.default.each(testCaseMap, function (_ref2) { - var result = _ref2.result, - steps = _ref2.steps; - testCaseResults.push(result); + if (!result.retried) { + testCaseResults.push(result); - _lodash.default.each(steps, function (testStep) { - if (testStep.sourceLocation) { - testStepResults.push(testStep.result); - } - }); + _lodash.default.each(stepResults, function (stepResult, index) { + if (testCase.steps[index].sourceLocation) { + testStepResults.push(stepResult); + } + }); + } }); - var scenarioSummary = getCountSummary({ colorFns: colorFns, objects: testCaseResults, @@ -62352,22 +69669,303 @@ function getCountSummary(_ref3) { return text; } -function getDuration(milliseconds) { +function getDuration(nanoseconds) { var start = new Date(0); - var end = new Date(milliseconds); + var end = new Date(nanoseconds / _time.MILLISECONDS_IN_NANOSECOND); var duration = new _duration.default(start, end); return "".concat(duration.minutes, "m").concat(duration.toString('%S'), ".").concat(duration.toString('%L'), "s") + "\n"; } -},{"../../status":377,"core-js/modules/es6.regexp.to-string":138,"core-js/modules/web.dom.iterable":145,"duration":170,"lodash":248}],350:[function(require,module,exports){ +},{"../../status":615,"../../time":622,"duration":409,"lodash":481}],586:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getUsage = getUsage; +exports.formatTestCaseAttempt = formatTestCaseAttempt; + +var _indentString = _interopRequireDefault(require("indent-string")); + +var _status = _interopRequireDefault(require("../../status")); + +var _figures = _interopRequireDefault(require("figures")); + +var _error_helpers = require("./error_helpers"); + +var _location_helpers = require("./location_helpers"); + +var _test_case_attempt_parser = require("./test_case_attempt_parser"); + +var _step_argument_formatter = require("./step_argument_formatter"); + +var _CHARACTERS; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var CHARACTERS = (_CHARACTERS = {}, _defineProperty(_CHARACTERS, _status.default.AMBIGUOUS, _figures.default.cross), _defineProperty(_CHARACTERS, _status.default.FAILED, _figures.default.cross), _defineProperty(_CHARACTERS, _status.default.PASSED, _figures.default.tick), _defineProperty(_CHARACTERS, _status.default.PENDING, '?'), _defineProperty(_CHARACTERS, _status.default.SKIPPED, '-'), _defineProperty(_CHARACTERS, _status.default.UNDEFINED, '?'), _CHARACTERS); + +function getStepMessage(_ref) { + var colorFns = _ref.colorFns, + testStep = _ref.testStep; + + switch (testStep.result.status) { + case _status.default.AMBIGUOUS: + return colorFns.ambiguous(testStep.result.exception); + + case _status.default.FAILED: + return (0, _error_helpers.formatError)(testStep.result.exception, colorFns); + + case _status.default.UNDEFINED: + return "".concat('Undefined. Implement with the following snippet:' + '\n\n').concat((0, _indentString.default)(testStep.snippet, 2), "\n"); + + case _status.default.PENDING: + return colorFns.pending('Pending'); + } + + return ''; +} + +function formatStep(_ref2) { + var colorFns = _ref2.colorFns, + testStep = _ref2.testStep; + var status = testStep.result.status, + actionLocation = testStep.actionLocation, + attachments = testStep.attachments; + var colorFn = colorFns[status]; + var identifier = testStep.keyword + (testStep.text || ''); + var text = colorFn("".concat(CHARACTERS[status], " ").concat(identifier)); + + if (actionLocation) { + text += " # ".concat(colorFns.location((0, _location_helpers.formatLocation)(actionLocation))); + } + + text += '\n'; + + if (testStep.arguments) { + var argumentsText = (0, _step_argument_formatter.formatStepArguments)(testStep.arguments); + + if (argumentsText) { + text += (0, _indentString.default)("".concat(colorFn(argumentsText), "\n"), 4); + } + } + + if (attachments) { + attachments.forEach(function (_ref3) { + var media = _ref3.media, + data = _ref3.data; + var message = media.type === 'text/plain' ? ": ".concat(data) : ''; + text += (0, _indentString.default)("Attachment (".concat(media.type, ")").concat(message, "\n"), 4); + }); + } + + var message = getStepMessage({ + colorFns: colorFns, + testStep: testStep + }); + + if (message) { + text += "".concat((0, _indentString.default)(message, 4), "\n"); + } + + return text; +} + +function formatTestCaseAttempt(_ref4) { + var colorFns = _ref4.colorFns, + snippetBuilder = _ref4.snippetBuilder, + testCaseAttempt = _ref4.testCaseAttempt; + var parsed = (0, _test_case_attempt_parser.parseTestCaseAttempt)({ + snippetBuilder: snippetBuilder, + testCaseAttempt: testCaseAttempt + }); + var text = "Scenario: ".concat(parsed.testCase.name); + text += getAttemptText(parsed.testCase.attemptNumber, parsed.testCase.result.retried); + text += " # ".concat(colorFns.location((0, _location_helpers.formatLocation)(parsed.testCase.sourceLocation)), "\n"); + parsed.testSteps.forEach(function (testStep) { + text += formatStep({ + colorFns: colorFns, + testStep: testStep + }); + }); + return "".concat(text, "\n"); +} + +function getAttemptText(attemptNumber, retried) { + if (retried) { + return " (attempt ".concat(attemptNumber, ", retried)"); + } + + if (attemptNumber > 1) { + return " (attempt ".concat(attemptNumber, ")"); + } + + return ''; +} + +},{"../../status":615,"./error_helpers":576,"./location_helpers":582,"./step_argument_formatter":584,"./test_case_attempt_parser":587,"figures":446,"indent-string":472}],587:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.parseTestCaseAttempt = parseTestCaseAttempt; + +var _lodash = _interopRequireDefault(require("lodash")); + +var _status = _interopRequireDefault(require("../../status")); + +var _keyword_type = _interopRequireWildcard(require("./keyword_type")); + +var _step_arguments = require("../../step_arguments"); + +var _gherkin_document_parser = require("./gherkin_document_parser"); + +var _pickle_parser = require("./pickle_parser"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function parseDataTable(arg) { + var rows = arg.rows.map(function (row) { + return row.cells.map(function (cell) { + return cell.value.replace(/\\/g, '\\\\').replace(/\n/g, '\\n'); + }); + }); + return { + rows: rows + }; +} + +function parseDocString(arg) { + return { + content: arg.content + }; +} + +function parseStep(_ref) { + var isBeforeHook = _ref.isBeforeHook, + keyword = _ref.keyword, + keywordType = _ref.keywordType, + pickleStep = _ref.pickleStep, + snippetBuilder = _ref.snippetBuilder, + testStep = _ref.testStep, + testStepResult = _ref.testStepResult, + testStepAttachments = _ref.testStepAttachments; + var out = { + attachments: testStepAttachments, + result: testStepResult + }; + + if (testStep.actionLocation) { + out.actionLocation = testStep.actionLocation; + } + + if (testStep.sourceLocation) { + out.keyword = keyword; + out.sourceLocation = testStep.sourceLocation; + out.text = pickleStep.text; + } else { + out.keyword = isBeforeHook ? 'Before' : 'After'; + } + + if (pickleStep) { + var iterator = (0, _step_arguments.buildStepArgumentIterator)({ + dataTable: function dataTable(arg) { + return parseDataTable(arg); + }, + docString: function docString(arg) { + return parseDocString(arg); + } + }); + out.arguments = pickleStep.arguments.map(iterator); + } + + if (testStepResult.status === _status.default.UNDEFINED) { + out.snippet = snippetBuilder.build({ + keywordType: keywordType, + pickleStep: pickleStep + }); + } + + return out; +} // Converts a testCaseAttempt into a json object with all data needed for +// displaying it in a pretty format +// +// Returns the following +// { +// testCase: {sourceLocation, name, attemptNumber, result: { status, retried, duration}}, +// testSteps: [ +// {attachments, keyword, text?, result: {status, duration}, arguments?, snippet?, sourceLocation?, actionLocation?} +// ... +// ] +// } + + +function parseTestCaseAttempt(_ref2) { + var testCaseAttempt = _ref2.testCaseAttempt, + snippetBuilder = _ref2.snippetBuilder; + var testCase = testCaseAttempt.testCase, + pickle = testCaseAttempt.pickle, + gherkinDocument = testCaseAttempt.gherkinDocument; + var out = { + testCase: { + attemptNumber: testCaseAttempt.attemptNumber, + name: pickle.name, + result: testCaseAttempt.result, + sourceLocation: testCase.sourceLocation + }, + testSteps: [] + }; + var stepLineToKeywordMap = (0, _gherkin_document_parser.getStepLineToKeywordMap)(gherkinDocument); + var stepLineToPickledStepMap = (0, _pickle_parser.getStepLineToPickledStepMap)(pickle); + var isBeforeHook = true; + var previousKeywordType = _keyword_type.default.PRECONDITION; + + _lodash.default.each(testCaseAttempt.stepResults, function (testStepResult, index) { + var testStep = testCase.steps[index]; + isBeforeHook = isBeforeHook && !testStep.sourceLocation; + var keyword, keywordType, pickleStep; + + if (testStep.sourceLocation) { + pickleStep = stepLineToPickledStepMap[testStep.sourceLocation.line]; + keyword = (0, _pickle_parser.getStepKeyword)({ + pickleStep: pickleStep, + stepLineToKeywordMap: stepLineToKeywordMap + }); + keywordType = (0, _keyword_type.getStepKeywordType)({ + keyword: keyword, + language: gherkinDocument.feature.language, + previousKeywordType: previousKeywordType + }); + } + + var parsedStep = parseStep({ + isBeforeHook: isBeforeHook, + keyword: keyword, + keywordType: keywordType, + pickleStep: pickleStep, + snippetBuilder: snippetBuilder, + testStep: testStep, + testStepResult: testStepResult, + testStepAttachments: testCaseAttempt.stepAttachments[index] + }); + out.testSteps.push(parsedStep); + previousKeywordType = keywordType; + }); -require("core-js/modules/web.dom.iterable"); + return out; +} + +},{"../../status":615,"../../step_arguments":616,"./gherkin_document_parser":578,"./keyword_type":581,"./pickle_parser":583,"lodash":481}],588:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getUsage = getUsage; var _lodash = _interopRequireDefault(require("lodash")); @@ -62377,13 +69975,33 @@ var _pickle_parser = require("../pickle_parser"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function getCodeAsString(stepDefinition) { + if (typeof stepDefinition.unwrappedCode === 'function') { + return stepDefinition.unwrappedCode.toString(); + } + + return stepDefinition.code.toString(); +} + function buildEmptyMapping(stepDefinitions) { var mapping = {}; stepDefinitions.forEach(function (stepDefinition) { var location = (0, _location_helpers.formatLocation)(stepDefinition); mapping[location] = { + code: getCodeAsString(stepDefinition), line: stepDefinition.line, - pattern: stepDefinition.pattern, + pattern: stepDefinition.expression.source, + patternType: stepDefinition.expression.constructor.name, matches: [], uri: stepDefinition.uri }; @@ -62396,15 +70014,13 @@ function buildMapping(_ref) { eventDataCollector = _ref.eventDataCollector; var mapping = buildEmptyMapping(stepDefinitions); - _lodash.default.each(eventDataCollector.testCaseMap, function (testCase) { - var _eventDataCollector$g = eventDataCollector.getTestCaseData(testCase.sourceLocation), - pickle = _eventDataCollector$g.pickle; - - var stepLineToPickledStepMap = (0, _pickle_parser.getStepLineToPickledStepMap)(pickle); - testCase.steps.forEach(function (testStep) { - var actionLocation = testStep.actionLocation, - sourceLocation = testStep.sourceLocation, - duration = testStep.result.duration; + _lodash.default.each(eventDataCollector.getTestCaseAttempts(), function (testCaseAttempt) { + var stepLineToPickledStepMap = (0, _pickle_parser.getStepLineToPickledStepMap)(testCaseAttempt.pickle); + testCaseAttempt.stepResults.forEach(function (testStepResult, index) { + var _testCaseAttempt$test = testCaseAttempt.testCase.steps[index], + actionLocation = _testCaseAttempt$test.actionLocation, + sourceLocation = _testCaseAttempt$test.sourceLocation; + var duration = testStepResult.duration; if (actionLocation && sourceLocation) { var location = (0, _location_helpers.formatLocation)(actionLocation); @@ -62442,19 +70058,14 @@ function invertNumber(key) { function buildResult(mapping) { return _lodash.default.chain(mapping).map(function (_ref2) { - var line = _ref2.line, - matches = _ref2.matches, - pattern = _ref2.pattern, - uri = _ref2.uri; + var matches = _ref2.matches, + rest = _objectWithoutProperties(_ref2, ["matches"]); var sortedMatches = _lodash.default.sortBy(matches, [invertNumber('duration'), 'text']); - var result = { - line: line, - matches: sortedMatches, - pattern: pattern, - uri: uri - }; + var result = _objectSpread({ + matches: sortedMatches + }, rest); var meanDuration = _lodash.default.meanBy(matches, 'duration'); @@ -62476,7 +70087,7 @@ function getUsage(_ref3) { return buildResult(mapping); } -},{"../location_helpers":346,"../pickle_parser":347,"core-js/modules/web.dom.iterable":145,"lodash":248}],351:[function(require,module,exports){ +},{"../location_helpers":582,"../pickle_parser":583,"lodash":481}],589:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -62498,7 +70109,7 @@ var Formatter = function Formatter(options) { exports.default = Formatter; -},{"lodash":248}],352:[function(require,module,exports){ +},{"lodash":481}],590:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -62506,28 +70117,12 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - -require("core-js/modules/es6.function.name"); - -require("core-js/modules/es6.regexp.replace"); - var _lodash = _interopRequireDefault(require("lodash")); var _2 = _interopRequireDefault(require("./")); -var _status = _interopRequireDefault(require("../status")); - var _helpers = require("./helpers"); -var _step_arguments = require("../step_arguments"); - -var _assertionErrorFormatter = require("assertion-error-formatter"); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -62548,12 +70143,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -var getStepLineToKeywordMap = _helpers.GherkinDocumentParser.getStepLineToKeywordMap, - getScenarioLineToDescriptionMap = _helpers.GherkinDocumentParser.getScenarioLineToDescriptionMap; -var getScenarioDescription = _helpers.PickleParser.getScenarioDescription, - getStepLineToPickledStepMap = _helpers.PickleParser.getStepLineToPickledStepMap, - getStepKeyword = _helpers.PickleParser.getStepKeyword; - var JsonFormatter = /*#__PURE__*/ function (_Formatter) { @@ -62572,190 +70161,37 @@ function (_Formatter) { } _createClass(JsonFormatter, [{ - key: "convertNameToId", - value: function convertNameToId(obj) { - return obj.name.replace(/ /g, '-').toLowerCase(); - } - }, { - key: "formatDataTable", - value: function formatDataTable(dataTable) { - return { - rows: dataTable.rows.map(function (row) { - return { - cells: _lodash.default.map(row.cells, 'value') - }; - }) - }; - } - }, { - key: "formatDocString", - value: function formatDocString(docString) { - return { - content: docString.content, - line: docString.location.line - }; - } - }, { - key: "formatStepArguments", - value: function formatStepArguments(stepArguments) { - var iterator = (0, _step_arguments.buildStepArgumentIterator)({ - dataTable: this.formatDataTable.bind(this), - docString: this.formatDocString.bind(this) - }); - return _lodash.default.map(stepArguments, iterator); + key: "formatExceptionIfNeeded", + value: function formatExceptionIfNeeded(obj) { + if (obj.result.exception) { + obj.result.exception = (0, _helpers.formatError)(obj.result.exception); + } } }, { key: "onTestRunFinished", value: function onTestRunFinished() { var _this2 = this; - var groupedTestCases = {}; - - _lodash.default.each(this.eventDataCollector.testCaseMap, function (testCase) { - var uri = testCase.sourceLocation.uri; - - if (!groupedTestCases[uri]) { - groupedTestCases[uri] = []; - } - - groupedTestCases[uri].push(testCase); - }); - - var features = _lodash.default.map(groupedTestCases, function (group, uri) { - var gherkinDocument = _this2.eventDataCollector.gherkinDocumentMap[uri]; - - var featureData = _this2.getFeatureData(gherkinDocument.feature, uri); - - var stepLineToKeywordMap = getStepLineToKeywordMap(gherkinDocument); - var scenarioLineToDescriptionMap = getScenarioLineToDescriptionMap(gherkinDocument); - featureData.elements = group.map(function (testCase) { - var _this2$eventDataColle = _this2.eventDataCollector.getTestCaseData(testCase.sourceLocation), - pickle = _this2$eventDataColle.pickle; - - var scenarioData = _this2.getScenarioData({ - featureId: featureData.id, - pickle: pickle, - scenarioLineToDescriptionMap: scenarioLineToDescriptionMap - }); - - var stepLineToPickledStepMap = getStepLineToPickledStepMap(pickle); - var isBeforeHook = true; - scenarioData.steps = testCase.steps.map(function (testStep) { - isBeforeHook = isBeforeHook && !testStep.sourceLocation; - return _this2.getStepData({ - isBeforeHook: isBeforeHook, - stepLineToKeywordMap: stepLineToKeywordMap, - stepLineToPickledStepMap: stepLineToPickledStepMap, - testStep: testStep - }); - }); - return scenarioData; + var testCaseAttempts = this.eventDataCollector.getTestCaseAttempts(); + var testCaseAttemptsData = testCaseAttempts.map(function (testCaseAttempt) { + var parsed = (0, _helpers.parseTestCaseAttempt)({ + snippetBuilder: _this2.snippetBuilder, + testCaseAttempt: testCaseAttempt }); - return featureData; - }); - this.log(JSON.stringify(features, null, 2)); - } - }, { - key: "getFeatureData", - value: function getFeatureData(feature, uri) { - return { - description: feature.description, - keyword: feature.keyword, - name: feature.name, - line: feature.location.line, - id: this.convertNameToId(feature), - tags: this.getTags(feature), - uri: uri - }; - } - }, { - key: "getScenarioData", - value: function getScenarioData(_ref) { - var featureId = _ref.featureId, - pickle = _ref.pickle, - scenarioLineToDescriptionMap = _ref.scenarioLineToDescriptionMap; - var description = getScenarioDescription({ - pickle: pickle, - scenarioLineToDescriptionMap: scenarioLineToDescriptionMap - }); - return { - description: description, - id: "".concat(featureId, ";").concat(this.convertNameToId(pickle)), - keyword: 'Scenario', - line: pickle.locations[0].line, - name: pickle.name, - tags: this.getTags(pickle), - type: 'scenario' - }; - } - }, { - key: "getStepData", - value: function getStepData(_ref2) { - var isBeforeHook = _ref2.isBeforeHook, - stepLineToKeywordMap = _ref2.stepLineToKeywordMap, - stepLineToPickledStepMap = _ref2.stepLineToPickledStepMap, - testStep = _ref2.testStep; - var data = {}; - - if (testStep.sourceLocation) { - var line = testStep.sourceLocation.line; - var pickleStep = stepLineToPickledStepMap[line]; - data.arguments = this.formatStepArguments(pickleStep.arguments); - data.keyword = getStepKeyword({ - pickleStep: pickleStep, - stepLineToKeywordMap: stepLineToKeywordMap - }); - data.line = line; - data.name = pickleStep.text; - } else { - data.keyword = isBeforeHook ? 'Before' : 'After'; - data.hidden = true; - } + _this2.formatExceptionIfNeeded(parsed.testCase); - if (testStep.actionLocation) { - data.match = { - location: (0, _helpers.formatLocation)(testStep.actionLocation) - }; - } - - if (testStep.result) { - var _testStep$result = testStep.result, - exception = _testStep$result.exception, - status = _testStep$result.status; - data.result = { - status: status - }; - - if (testStep.result.duration) { - data.result.duration = testStep.result.duration * 1000000; - } - - if (status === _status.default.FAILED && exception) { - data.result.error_message = (0, _assertionErrorFormatter.format)(exception); - } - } - - if (_lodash.default.size(testStep.attachments) > 0) { - data.embeddings = testStep.attachments.map(function (attachment) { - return { - data: attachment.data, - mime_type: attachment.media.type - }; + parsed.testSteps.forEach(function (s) { + return _this2.formatExceptionIfNeeded(s); }); - } - - return data; - } - }, { - key: "getTags", - value: function getTags(obj) { - return _lodash.default.map(obj.tags, function (tagData) { - return { - name: tagData.name, - line: tagData.location.line - }; + return parsed; }); + var data = { + gherkinDocuments: _lodash.default.values(this.eventDataCollector.gherkinDocumentMap), + pickles: _lodash.default.values(this.eventDataCollector.pickleMap), + testCaseAttempts: testCaseAttemptsData + }; + this.log(JSON.stringify(data, null, 2)); } }]); @@ -62764,7 +70200,7 @@ function (_Formatter) { exports.default = JsonFormatter; -},{"../status":377,"../step_arguments":378,"./":351,"./helpers":343,"assertion-error-formatter":13,"core-js/modules/es6.function.name":129,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.regexp.replace":136,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"lodash":248}],353:[function(require,module,exports){ +},{"./":589,"./helpers":579,"lodash":481}],591:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -62772,12 +70208,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - var _helpers = require("./helpers"); var _ = _interopRequireDefault(require("./")); @@ -62818,7 +70248,7 @@ function (_Formatter) { _classCallCheck(this, ProgressBarFormatter); _this = _possibleConstructorReturn(this, _getPrototypeOf(ProgressBarFormatter).call(this, options)); - options.eventBroadcaster.on('pickle-accepted', (_context = _this).incrementStepCount.bind(_context)).once('test-case-started', (_context = _this).initializeProgressBar.bind(_context)).on('test-step-finished', (_context = _this).logProgress.bind(_context)).on('test-case-finished', (_context = _this).logErrorIfNeeded.bind(_context)).on('test-run-finished', (_context = _this).logSummary.bind(_context)); + options.eventBroadcaster.on('pickle-accepted', (_context = _this).incrementStepCount.bind(_context)).once('test-step-started', (_context = _this).initializeProgressBar.bind(_context)).on('test-step-finished', (_context = _this).logProgress.bind(_context)).on('test-case-finished', (_context = _this).logErrorIfNeeded.bind(_context)).on('test-run-finished', (_context = _this).logSummary.bind(_context)); _this.numberOfSteps = 0; _this.issueCount = 0; return _this; @@ -62845,37 +70275,32 @@ function (_Formatter) { key: "logProgress", value: function logProgress(_ref2) { var index = _ref2.index, - sourceLocation = _ref2.testCase.sourceLocation; + testCase = _ref2.testCase; + var testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(testCase); - var _this$eventDataCollec = this.eventDataCollector.getTestCaseData(sourceLocation), - testCase = _this$eventDataCollec.testCase; - - if (testCase.steps[index].sourceLocation) { + if (testCaseAttempt.testCase.steps[index].sourceLocation) { this.progressBar.tick(); } } }, { key: "logErrorIfNeeded", - value: function logErrorIfNeeded(_ref3) { - var sourceLocation = _ref3.sourceLocation, - result = _ref3.result; - - if ((0, _helpers.isIssue)(result.status)) { + value: function logErrorIfNeeded(testCaseFinishedEvent) { + if ((0, _helpers.isIssue)(testCaseFinishedEvent.result)) { this.issueCount += 1; - - var _this$eventDataCollec2 = this.eventDataCollector.getTestCaseData(sourceLocation), - gherkinDocument = _this$eventDataCollec2.gherkinDocument, - pickle = _this$eventDataCollec2.pickle, - testCase = _this$eventDataCollec2.testCase; - + var testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(testCaseFinishedEvent); this.progressBar.interrupt((0, _helpers.formatIssue)({ colorFns: this.colorFns, - gherkinDocument: gherkinDocument, number: this.issueCount, - pickle: pickle, snippetBuilder: this.snippetBuilder, - testCase: testCase + testCaseAttempt: testCaseAttempt })); + + if (testCaseFinishedEvent.result.retried) { + var stepsToRetry = testCaseAttempt.testCase.steps.filter(function (s) { + return s.sourceLocation; + }).length; + this.progressBar.tick(-stepsToRetry); + } } } }, { @@ -62883,7 +70308,7 @@ function (_Formatter) { value: function logSummary(testRun) { this.log((0, _helpers.formatSummary)({ colorFns: this.colorFns, - testCaseMap: this.eventDataCollector.testCaseMap, + testCaseAttempts: this.eventDataCollector.getTestCaseAttempts(), testRun: testRun })); } @@ -62894,7 +70319,7 @@ function (_Formatter) { exports.default = ProgressBarFormatter; -},{"./":351,"./helpers":343,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"progress":266}],354:[function(require,module,exports){ +},{"./":589,"./helpers":579,"progress":498}],592:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -62902,12 +70327,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - var _status = _interopRequireDefault(require("../status")); var _summary_formatter = _interopRequireDefault(require("./summary_formatter")); @@ -62973,7 +70392,7 @@ function (_SummaryFormatter) { exports.default = ProgressFormatter; -},{"../status":377,"./summary_formatter":359,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144}],355:[function(require,module,exports){ +},{"../status":615,"./summary_formatter":597}],593:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -62981,12 +70400,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - var _lodash = _interopRequireDefault(require("lodash")); var _2 = _interopRequireDefault(require("./")); @@ -63066,7 +70479,7 @@ function (_Formatter) { exports.default = RerunFormatter; -},{"../status":377,"./":351,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"lodash":248}],356:[function(require,module,exports){ +},{"../status":615,"./":589,"lodash":481}],594:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -63074,12 +70487,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - var _ = _interopRequireDefault(require("./")); var _status = _interopRequireDefault(require("../status")); @@ -63119,69 +70526,28 @@ function (_Formatter) { _classCallCheck(this, SnippetsFormatter); _this = _possibleConstructorReturn(this, _getPrototypeOf(SnippetsFormatter).call(this, options)); - options.eventBroadcaster.on('test-step-finished', (_context = _this).logUndefinedTestStepSnippet.bind(_context)); + options.eventBroadcaster.on('test-run-finished', (_context = _this).logSnippets.bind(_context)); return _this; } _createClass(SnippetsFormatter, [{ - key: "logUndefinedTestStepSnippet", - value: function logUndefinedTestStepSnippet(_ref) { - var sourceLocation = _ref.testCase.sourceLocation, - index = _ref.index, - result = _ref.result; - - if (result.status === _status.default.UNDEFINED) { - var _this$eventDataCollec = this.eventDataCollector.getTestCaseData(sourceLocation), - gherkinDocument = _this$eventDataCollec.gherkinDocument, - testCase = _this$eventDataCollec.testCase; - - var _this$eventDataCollec2 = this.eventDataCollector.getTestStepData({ - testCase: testCase, - index: index - }), - pickleStep = _this$eventDataCollec2.pickleStep, - gherkinKeyword = _this$eventDataCollec2.gherkinKeyword; + key: "logSnippets", + value: function logSnippets() { + var _this2 = this; - var previousKeywordType = this.getPreviousKeywordType({ - gherkinDocument: gherkinDocument, - testCase: testCase, - index: index - }); - var keywordType = (0, _helpers.getStepKeywordType)({ - keyword: gherkinKeyword, - language: gherkinDocument.feature.language, - previousKeywordType: previousKeywordType - }); - var snippet = this.snippetBuilder.build({ - keywordType: keywordType, - pickleStep: pickleStep + var snippets = []; + this.eventDataCollector.getTestCaseAttempts().map(function (testCaseAttempt) { + var parsed = (0, _helpers.parseTestCaseAttempt)({ + snippetBuilder: _this2.snippetBuilder, + testCaseAttempt: testCaseAttempt }); - this.log("".concat(snippet, "\n\n")); - } - } - }, { - key: "getPreviousKeywordType", - value: function getPreviousKeywordType(_ref2) { - var gherkinDocument = _ref2.gherkinDocument, - testCase = _ref2.testCase, - index = _ref2.index; - var previousKeywordType = _helpers.KeywordType.PRECONDITION; - - for (var i = 0; i < index; i += 1) { - var _this$eventDataCollec3 = this.eventDataCollector.getTestStepData({ - testCase: testCase, - index: i - }), - gherkinKeyword = _this$eventDataCollec3.gherkinKeyword; - - previousKeywordType = (0, _helpers.getStepKeywordType)({ - keyword: gherkinKeyword, - language: gherkinDocument.feature.language, - previousKeywordType: previousKeywordType + parsed.testSteps.forEach(function (testStep) { + if (testStep.result.status === _status.default.UNDEFINED) { + snippets.push(testStep.snippet); + } }); - } - - return previousKeywordType; + }); + this.log(snippets.join('\n\n')); } }]); @@ -63190,7 +70556,7 @@ function (_Formatter) { exports.default = SnippetsFormatter; -},{"../status":377,"./":351,"./helpers":343,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144}],357:[function(require,module,exports){ +},{"../status":615,"./":589,"./helpers":579}],595:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -63273,7 +70639,7 @@ function () { exports.default = StepDefinitionSnippetBuilder; -},{"../../step_arguments":378,"../helpers":343,"cucumber-expressions":161}],358:[function(require,module,exports){ +},{"../../step_arguments":616,"../helpers":579,"cucumber-expressions":406}],596:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -63281,8 +70647,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es6.regexp.replace"); - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } @@ -63344,7 +70708,7 @@ function () { exports.default = JavaScriptSnippetSyntax; -},{"core-js/modules/es6.regexp.replace":136}],359:[function(require,module,exports){ +},{}],597:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -63352,26 +70716,12 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - -require("core-js/modules/web.dom.iterable"); - -require("core-js/modules/es7.array.includes"); - -require("core-js/modules/es6.string.includes"); - var _lodash = _interopRequireDefault(require("lodash")); var _helpers = require("./helpers"); var _2 = _interopRequireDefault(require("./")); -var _status = _interopRequireDefault(require("../status")); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -63410,28 +70760,17 @@ function (_Formatter) { } _createClass(SummaryFormatter, [{ - key: "isTestCaseFailure", - value: function isTestCaseFailure(testCase) { - return _lodash.default.includes([_status.default.AMBIGUOUS, _status.default.FAILED], testCase.result.status); - } - }, { - key: "isTestCaseWarning", - value: function isTestCaseWarning(testCase) { - return _lodash.default.includes([_status.default.PENDING, _status.default.UNDEFINED], testCase.result.status); - } - }, { key: "logSummary", value: function logSummary(testRun) { - var _this2 = this; - var failures = []; var warnings = []; + var testCaseAttempts = this.eventDataCollector.getTestCaseAttempts(); - _lodash.default.each(this.eventDataCollector.testCaseMap, function (testCase) { - if (_this2.isTestCaseFailure(testCase)) { - failures.push(testCase); - } else if (_this2.isTestCaseWarning(testCase)) { - warnings.push(testCase); + _lodash.default.each(testCaseAttempts, function (testCaseAttempt) { + if ((0, _helpers.isFailure)(testCaseAttempt.result)) { + failures.push(testCaseAttempt); + } else if ((0, _helpers.isWarning)(testCaseAttempt.result)) { + warnings.push(testCaseAttempt); } }); @@ -63451,30 +70790,24 @@ function (_Formatter) { this.log((0, _helpers.formatSummary)({ colorFns: this.colorFns, - testCaseMap: this.eventDataCollector.testCaseMap, + testCaseAttempts: testCaseAttempts, testRun: testRun })); } }, { key: "logIssues", value: function logIssues(_ref) { - var _this3 = this; + var _this2 = this; var issues = _ref.issues, title = _ref.title; this.log("".concat(title, ":\n\n")); - issues.forEach(function (testCase, index) { - var _this3$eventDataColle = _this3.eventDataCollector.getTestCaseData(testCase.sourceLocation), - gherkinDocument = _this3$eventDataColle.gherkinDocument, - pickle = _this3$eventDataColle.pickle; - - _this3.log((0, _helpers.formatIssue)({ - colorFns: _this3.colorFns, - gherkinDocument: gherkinDocument, + issues.forEach(function (testCaseAttempt, index) { + _this2.log((0, _helpers.formatIssue)({ + colorFns: _this2.colorFns, number: index + 1, - pickle: pickle, - snippetBuilder: _this3.snippetBuilder, - testCase: testCase + snippetBuilder: _this2.snippetBuilder, + testCaseAttempt: testCaseAttempt })); }); } @@ -63485,7 +70818,7 @@ function (_Formatter) { exports.default = SummaryFormatter; -},{"../status":377,"./":351,"./helpers":343,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.string.includes":139,"core-js/modules/es6.symbol":142,"core-js/modules/es7.array.includes":143,"core-js/modules/es7.symbol.async-iterator":144,"core-js/modules/web.dom.iterable":145,"lodash":248}],360:[function(require,module,exports){ +},{"./":589,"./helpers":579,"lodash":481}],598:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -63493,16 +70826,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - -require("core-js/modules/es6.regexp.to-string"); - -require("core-js/modules/web.dom.iterable"); - var _lodash = _interopRequireDefault(require("lodash")); var _helpers = require("./helpers"); @@ -63511,6 +70834,8 @@ var _2 = _interopRequireDefault(require("./")); var _cliTable = _interopRequireDefault(require("cli-table3")); +var _time = require("../time"); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -63573,13 +70898,20 @@ function (_Formatter) { matches = _ref.matches, meanDuration = _ref.meanDuration, pattern = _ref.pattern, + patternType = _ref.patternType, uri = _ref.uri; - var col1 = [pattern.toString()]; + var formattedPattern = pattern; + + if (patternType === 'RegularExpression') { + formattedPattern = '/' + formattedPattern + '/'; + } + + var col1 = [formattedPattern]; var col2 = []; if (matches.length > 0) { if (isFinite(meanDuration)) { - col2.push("".concat(parseFloat(meanDuration.toFixed(2)), "ms")); + col2.push("".concat((meanDuration / _time.MILLISECONDS_IN_NANOSECOND).toFixed(2), "ms")); } else { col2.push('-'); } @@ -63596,7 +70928,7 @@ function (_Formatter) { col1.push(" ".concat(match.text)); if (isFinite(match.duration)) { - col2.push("".concat(match.duration, "ms")); + col2.push("".concat(match.duration / _time.MILLISECONDS_IN_NANOSECOND, "ms")); } else { col2.push('-'); } @@ -63619,7 +70951,7 @@ function (_Formatter) { exports.default = UsageFormatter; -},{"./":351,"./helpers":343,"cli-table3":23,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.regexp.to-string":138,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"core-js/modules/web.dom.iterable":145,"lodash":248}],361:[function(require,module,exports){ +},{"../time":622,"./":589,"./helpers":579,"cli-table3":26,"lodash":481}],599:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -63627,12 +70959,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - var _helpers = require("./helpers"); var _ = _interopRequireDefault(require("./")); @@ -63690,7 +71016,7 @@ function (_Formatter) { exports.default = UsageJsonFormatter; -},{"./":351,"./helpers":343,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144}],362:[function(require,module,exports){ +},{"./":589,"./helpers":579}],600:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -63869,7 +71195,7 @@ exports.Then = Then; var When = methods.When; exports.When = When; -},{"./cli":333,"./cli/helpers":331,"./formatter":351,"./formatter/builder":337,"./formatter/helpers":343,"./formatter/json_formatter":352,"./formatter/progress_formatter":354,"./formatter/rerun_formatter":355,"./formatter/snippets_formatter":356,"./formatter/summary_formatter":359,"./formatter/usage_formatter":360,"./formatter/usage_json_formatter":361,"./pickle_filter":368,"./runtime":371,"./status":377,"./support_code_library_builder":381}],363:[function(require,module,exports){ +},{"./cli":569,"./cli/helpers":567,"./formatter":589,"./formatter/builder":573,"./formatter/helpers":579,"./formatter/json_formatter":590,"./formatter/progress_formatter":592,"./formatter/rerun_formatter":593,"./formatter/snippets_formatter":594,"./formatter/summary_formatter":597,"./formatter/usage_formatter":598,"./formatter/usage_json_formatter":599,"./pickle_filter":606,"./runtime":609,"./status":615,"./support_code_library_builder":619}],601:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -63944,7 +71270,7 @@ function () { exports.default = DataTable; -},{"lodash":248}],364:[function(require,module,exports){ +},{"lodash":481}],602:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -63992,7 +71318,7 @@ function () { exports.default = Definition; -},{}],365:[function(require,module,exports){ +},{}],603:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -64000,14 +71326,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - -require("core-js/modules/es6.regexp.match"); - var _data_table = _interopRequireDefault(require("./data_table")); var _step_arguments = require("../step_arguments"); @@ -64098,7 +71416,7 @@ function (_Definition) { exports.default = StepDefinition; -},{"../step_arguments":378,"./data_table":363,"./definition":364,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.regexp.match":135,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144}],366:[function(require,module,exports){ +},{"../step_arguments":616,"./data_table":601,"./definition":602}],604:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -64106,12 +71424,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - var _pickle_filter = _interopRequireDefault(require("../pickle_filter")); var _definition = _interopRequireDefault(require("./definition")); @@ -64192,7 +71504,7 @@ function (_Definition) { exports.default = TestCaseHookDefinition; -},{"../pickle_filter":368,"./definition":364,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144}],367:[function(require,module,exports){ +},{"../pickle_filter":606,"./definition":602}],605:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -64200,12 +71512,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/es6.object.set-prototype-of"); - var _definition = _interopRequireDefault(require("./definition")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -64261,7 +71567,7 @@ function (_Definition) { exports.default = TestRunHookDefinition; -},{"./definition":364,"core-js/modules/es6.object.set-prototype-of":131,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144}],368:[function(require,module,exports){ +},{"./definition":602}],606:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -64269,19 +71575,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es6.function.name"); - -require("core-js/modules/es6.regexp.match"); - -require("core-js/modules/es6.regexp.split"); - -require("core-js/modules/web.dom.iterable"); - var _lodash = _interopRequireDefault(require("lodash")); var _path = _interopRequireDefault(require("path")); -var _cucumberTagExpressions = require("cucumber-tag-expressions"); +var _cucumberTagExpressions = _interopRequireDefault(require("cucumber-tag-expressions")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -64292,7 +71590,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var FEATURE_LINENUM_REGEXP = /^(.*?)((?::[\d]+)+)?$/; -var tagExpressionParser = new _cucumberTagExpressions.TagExpressionParser(); var PickleFilter = /*#__PURE__*/ @@ -64308,7 +71605,7 @@ function () { this.names = names || []; if (tagExpression) { - this.tagExpressionNode = tagExpressionParser.parse(tagExpression || ''); + this.tagExpressionNode = (0, _cucumberTagExpressions.default)(tagExpression || ''); } } @@ -64388,7 +71685,7 @@ function () { exports.default = PickleFilter; -},{"core-js/modules/es6.function.name":129,"core-js/modules/es6.regexp.match":135,"core-js/modules/es6.regexp.split":137,"core-js/modules/web.dom.iterable":145,"cucumber-tag-expressions":167,"lodash":248,"path":260}],369:[function(require,module,exports){ +},{"cucumber-tag-expressions":407,"lodash":481,"path":493}],607:[function(require,module,exports){ (function (Buffer){ "use strict"; @@ -64397,8 +71694,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es6.regexp.to-string"); - var _isStream = _interopRequireDefault(require("is-stream")); var _bluebird = _interopRequireDefault(require("bluebird")); @@ -64495,25 +71790,15 @@ function () { exports.default = AttachmentManager; }).call(this,require("buffer").Buffer) -},{"bluebird":18,"buffer":22,"core-js/modules/es6.regexp.to-string":138,"is-stream":242}],370:[function(require,module,exports){ + +},{"bluebird":21,"buffer":25,"is-stream":478}],608:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getAmbiguousStepException = getAmbiguousStepException; - -require("core-js/modules/es6.string.iterator"); - -require("core-js/modules/es6.array.from"); - -require("core-js/modules/es7.symbol.async-iterator"); - -require("core-js/modules/es6.symbol"); - -require("core-js/modules/web.dom.iterable"); - -require("core-js/modules/es6.regexp.to-string"); +exports.retriesForTestCase = retriesForTestCase; var _location_helpers = require("../formatter/helpers/location_helpers"); @@ -64521,6 +71806,8 @@ var _cliTable = _interopRequireDefault(require("cli-table3")); var _indentString = _interopRequireDefault(require("indent-string")); +var _pickle_filter = _interopRequireDefault(require("../pickle_filter")); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } @@ -64563,7 +71850,31 @@ function getAmbiguousStepException(stepDefinitions) { return "".concat('Multiple step definitions match:' + '\n').concat((0, _indentString.default)(table.toString(), 2)); } -},{"../formatter/helpers/location_helpers":346,"cli-table3":23,"core-js/modules/es6.array.from":127,"core-js/modules/es6.regexp.to-string":138,"core-js/modules/es6.string.iterator":140,"core-js/modules/es6.symbol":142,"core-js/modules/es7.symbol.async-iterator":144,"core-js/modules/web.dom.iterable":145,"indent-string":236}],371:[function(require,module,exports){ +function retriesForTestCase(testCase, options) { + var retries = options.retry; + + if (!retries) { + return 0; + } + + var retryTagFilter = options.retryTagFilter; + + if (!retryTagFilter) { + return retries; + } + + var pickleFilter = new _pickle_filter.default({ + tagExpression: retryTagFilter + }); + + if (pickleFilter.matches(testCase)) { + return retries; + } + + return 0; +} + +},{"../formatter/helpers/location_helpers":582,"../pickle_filter":606,"cli-table3":26,"indent-string":472}],609:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -64571,14 +71882,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es6.promise"); - -require("core-js/modules/es7.array.includes"); - -require("core-js/modules/es6.string.includes"); - -require("regenerator-runtime/runtime"); - var _lodash = _interopRequireDefault(require("lodash")); var _helpers = require("../formatter/helpers"); @@ -64595,6 +71898,8 @@ var _user_code_runner = _interopRequireDefault(require("../user_code_runner")); var _verror = _interopRequireDefault(require("verror")); +var _helpers2 = require("./helpers"); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } @@ -64610,7 +71915,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d var Runtime = /*#__PURE__*/ function () { - // options - {dryRun, failFast, filterStacktraces, strict} + // options - {dryRun, failFast, filterStacktraces, retry, retryTagFilter, strict} function Runtime(_ref) { var eventBroadcaster = _ref.eventBroadcaster, options = _ref.options, @@ -64680,7 +71985,7 @@ function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return function (_x3) { @@ -64708,23 +72013,25 @@ function () { var _runTestCase = _asyncToGenerator( /*#__PURE__*/ regeneratorRuntime.mark(function _callee3(testCase) { - var skip, testCaseRunner, testCaseResult; + var retries, skip, testCaseRunner, testCaseResult; return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: + retries = (0, _helpers2.retriesForTestCase)(testCase, this.options); skip = this.options.dryRun || this.options.failFast && !this.result.success; testCaseRunner = new _test_case_runner.default({ eventBroadcaster: this.eventBroadcaster, + retries: retries, skip: skip, supportCodeLibrary: this.supportCodeLibrary, testCase: testCase, worldParameters: this.options.worldParameters }); - _context3.next = 4; + _context3.next = 5; return testCaseRunner.run(); - case 4: + case 5: testCaseResult = _context3.sent; if (testCaseResult.duration) { @@ -64735,7 +72042,7 @@ function () { this.result.success = false; } - case 7: + case 8: case "end": return _context3.stop(); } @@ -64812,7 +72119,7 @@ function () { exports.default = Runtime; -},{"../formatter/helpers":343,"../stack_trace_filter":376,"../status":377,"../user_code_runner":386,"./test_case_runner":375,"bluebird":18,"core-js/modules/es6.promise":132,"core-js/modules/es6.string.includes":139,"core-js/modules/es7.array.includes":143,"lodash":248,"regenerator-runtime/runtime":283,"verror":325}],372:[function(require,module,exports){ +},{"../formatter/helpers":579,"../stack_trace_filter":614,"../status":615,"../user_code_runner":624,"./helpers":608,"./test_case_runner":613,"bluebird":21,"lodash":481,"verror":561}],610:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -64829,7 +72136,7 @@ var commandTypes = { var _default = commandTypes; exports.default = _default; -},{}],373:[function(require,module,exports){ +},{}],611:[function(require,module,exports){ (function (process,__dirname){ "use strict"; @@ -64838,15 +72145,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.array.includes"); - -require("core-js/modules/es6.string.includes"); - -require("core-js/modules/es6.function.name"); - var _lodash = _interopRequireDefault(require("lodash")); -var _crossSpawn = _interopRequireDefault(require("cross-spawn")); +var _child_process = require("child_process"); var _command_types = _interopRequireDefault(require("./command_types")); @@ -64854,6 +72155,8 @@ var _path = _interopRequireDefault(require("path")); var _status = _interopRequireDefault(require("../../status")); +var _helpers = require("../helpers"); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -64867,9 +72170,10 @@ var slaveCommand = _path.default.resolve(__dirname, '..', '..', '..', 'bin', 'ru var Master = /*#__PURE__*/ function () { - // options - {dryRun, failFast, filterStacktraces, strict} + // options - {dryRun, failFast, filterStacktraces, retry, retryTagFilter, strict} function Master(_ref) { - var eventBroadcaster = _ref.eventBroadcaster, + var cwd = _ref.cwd, + eventBroadcaster = _ref.eventBroadcaster, options = _ref.options, supportCodePaths = _ref.supportCodePaths, supportCodeRequiredModules = _ref.supportCodeRequiredModules, @@ -64877,13 +72181,13 @@ function () { _classCallCheck(this, Master); + this.cwd = cwd; this.eventBroadcaster = eventBroadcaster; this.options = options || {}; this.supportCodePaths = supportCodePaths; this.supportCodeRequiredModules = supportCodeRequiredModules; this.testCases = testCases || []; this.nextTestCaseIndex = 0; - this.testCasesCompleted = 0; this.result = { duration: 0, success: true @@ -64917,7 +72221,8 @@ function () { value: function startSlave(id, total) { var _this = this; - var slaveProcess = (0, _crossSpawn.default)(slaveCommand, [], { + var slaveProcess = (0, _child_process.fork)(slaveCommand, [], { + cwd: this.cwd, env: _lodash.default.assign({}, process.env, { CUCUMBER_PARALLEL: 'true', CUCUMBER_TOTAL_SLAVES: total, @@ -64932,10 +72237,10 @@ function () { slave.process.on('message', function (message) { _this.parseSlaveMessage(slave, message); }); - slave.process.on('close', function () { + slave.process.on('close', function (error) { slave.closed = true; - _this.onSlaveClose(); + _this.onSlaveClose(error); }); slave.process.send({ command: _command_types.default.INITIALIZE, @@ -64947,7 +72252,11 @@ function () { } }, { key: "onSlaveClose", - value: function onSlaveClose() { + value: function onSlaveClose(error) { + if (error) { + this.result.success = false; + } + if (_lodash.default.every(this.slaves, 'closed')) { this.eventBroadcaster.emit('test-run-finished', { result: this.result @@ -64958,13 +72267,11 @@ function () { }, { key: "parseTestCaseResult", value: function parseTestCaseResult(testCaseResult) { - this.testCasesCompleted += 1; - if (testCaseResult.duration) { this.result.duration += testCaseResult.duration; } - if (this.shouldCauseFailure(testCaseResult.status)) { + if (!testCaseResult.retried && this.shouldCauseFailure(testCaseResult.status)) { this.result.success = false; } } @@ -64993,9 +72300,11 @@ function () { var testCase = this.testCases[this.nextTestCaseIndex]; this.nextTestCaseIndex += 1; + var retries = (0, _helpers.retriesForTestCase)(testCase, this.options); var skip = this.options.dryRun || this.options.failFast && !this.result.success; slave.process.send({ command: _command_types.default.RUN, + retries: retries, skip: skip, testCase: testCase }); @@ -65013,7 +72322,8 @@ function () { exports.default = Master; }).call(this,require('_process'),"/src/runtime/parallel") -},{"../../status":377,"./command_types":372,"_process":265,"core-js/modules/es6.function.name":129,"core-js/modules/es6.string.includes":139,"core-js/modules/es7.array.includes":143,"cross-spawn":147,"lodash":248,"path":260}],374:[function(require,module,exports){ + +},{"../../status":615,"../helpers":608,"./command_types":610,"_process":497,"child_process":24,"lodash":481,"path":493}],612:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -65021,24 +72331,18 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es7.array.includes"); - -require("core-js/modules/es6.string.includes"); - -require("regenerator-runtime/runtime"); - -require("core-js/modules/es6.promise"); - var _lodash = _interopRequireDefault(require("lodash")); var _status = _interopRequireDefault(require("../status")); -var _time = _interopRequireDefault(require("../time")); +var _time = _interopRequireWildcard(require("../time")); var _user_code_runner = _interopRequireDefault(require("../user_code_runner")); var _bluebird = _interopRequireDefault(require("bluebird")); +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } @@ -65115,7 +72419,7 @@ function _run() { case 23: testStepResult = { - duration: endTiming() + duration: endTiming() * _time.MILLISECONDS_IN_NANOSECOND }; if (result === 'skipped') { @@ -65136,7 +72440,7 @@ function _run() { return _context.stop(); } } - }, _callee, this, [[2, 8]]); + }, _callee, null, [[2, 8]]); })); return _run.apply(this, arguments); } @@ -65146,7 +72450,7 @@ var _default = { }; exports.default = _default; -},{"../status":377,"../time":384,"../user_code_runner":386,"bluebird":18,"core-js/modules/es6.promise":132,"core-js/modules/es6.string.includes":139,"core-js/modules/es7.array.includes":143,"lodash":248,"regenerator-runtime/runtime":283}],375:[function(require,module,exports){ +},{"../status":615,"../time":622,"../user_code_runner":624,"bluebird":21,"lodash":481}],613:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -65154,18 +72458,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es6.promise"); - -require("core-js/modules/es6.array.iterator"); - -require("core-js/modules/es6.object.keys"); - -require("regenerator-runtime/runtime"); - -require("core-js/modules/web.dom.iterable"); - -require("core-js/modules/es6.string.starts-with"); - var _lodash = _interopRequireDefault(require("lodash")); var _helpers = require("./helpers"); @@ -65184,7 +72476,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -65201,6 +72495,8 @@ function () { var _this = this; var eventBroadcaster = _ref.eventBroadcaster, + _ref$retries = _ref.retries, + retries = _ref$retries === void 0 ? 0 : _ref$retries, skip = _ref.skip, testCase = _ref.testCase, supportCodeLibrary = _ref.supportCodeLibrary, @@ -65223,6 +72519,7 @@ function () { }); }); this.eventBroadcaster = eventBroadcaster; + this.maxAttempts = 1 + (skip ? 0 : retries); this.skip = skip; this.testCase = testCase; this.supportCodeLibrary = supportCodeLibrary; @@ -65232,29 +72529,40 @@ function () { }); this.beforeHookDefinitions = this.getBeforeHookDefinitions(); this.afterHookDefinitions = this.getAfterHookDefinitions(); - this.testStepIndex = 0; this.maxTestStepIndex = this.beforeHookDefinitions.length + this.testCase.pickle.steps.length + this.afterHookDefinitions.length - 1; - this.result = { - duration: 0, - status: this.skip ? _status.default.SKIPPED : _status.default.PASSED - }; this.testCaseSourceLocation = { uri: this.testCase.uri, line: this.testCase.pickle.locations[0].line }; + this.resetTestProgressData(); } _createClass(TestCaseRunner, [{ + key: "resetTestProgressData", + value: function resetTestProgressData() { + this.testStepIndex = 0; + this.result = { + duration: 0, + status: this.skip ? _status.default.SKIPPED : _status.default.PASSED + }; + } + }, { key: "emit", value: function emit(name, data) { var eventData = _objectSpread({}, data); + var testCaseData = { + sourceLocation: this.testCaseSourceLocation + }; + + if (this.currentAttemptNumber) { + testCaseData.attemptNumber = this.currentAttemptNumber; + } + if (_lodash.default.startsWith(name, 'test-case')) { - eventData.sourceLocation = this.testCaseSourceLocation; + _lodash.default.merge(eventData, testCaseData); } else { - eventData.testCase = { - sourceLocation: this.testCaseSourceLocation - }; + eventData.testCase = testCaseData; } this.eventBroadcaster.emit(name, eventData); @@ -65359,12 +72667,13 @@ function () { key: "shouldUpdateStatus", value: function shouldUpdateStatus(testStepResult) { switch (testStepResult.status) { + case _status.default.UNDEFINED: case _status.default.FAILED: case _status.default.AMBIGUOUS: - return this.result.status !== _status.default.FAILED || this.result.status !== _status.default.AMBIGUOUS; + return !_lodash.default.some([_status.default.FAILED, _status.default.AMBIGUOUS, _status.default.UNDEFINED], this.result.status); default: - return this.result.status === _status.default.PASSED || this.result.status === _status.default.SKIPPED; + return this.result.status === _status.default.PASSED; } } }, { @@ -65425,37 +72734,69 @@ function () { var _run = _asyncToGenerator( /*#__PURE__*/ regeneratorRuntime.mark(function _callee2() { + var shouldRetry; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: this.emitPrepared(); - this.emit('test-case-started', {}); - _context2.next = 4; + this.currentAttemptNumber = 1; + + case 2: + if (!(this.currentAttemptNumber <= this.maxAttempts)) { + _context2.next = 19; + break; + } + + this.emit('test-case-started'); + _context2.next = 6; return this.runHooks(this.beforeHookDefinitions, { sourceLocation: this.testCaseSourceLocation, pickle: this.testCase.pickle }, true); - case 4: - _context2.next = 6; - return this.runSteps(); - case 6: _context2.next = 8; + return this.runSteps(); + + case 8: + shouldRetry = this.result.status === _status.default.FAILED && this.currentAttemptNumber < this.maxAttempts; + + if (shouldRetry) { + this.result.retried = true; + } + + _context2.next = 12; return this.runHooks(this.afterHookDefinitions, { sourceLocation: this.testCaseSourceLocation, pickle: this.testCase.pickle, result: this.result }, false); - case 8: + case 12: this.emit('test-case-finished', { result: this.result }); + + if (shouldRetry) { + _context2.next = 15; + break; + } + + return _context2.abrupt("break", 19); + + case 15: + this.resetTestProgressData(); + + case 16: + this.currentAttemptNumber++; + _context2.next = 2; + break; + + case 19: return _context2.abrupt("return", this.result); - case 10: + case 20: case "end": return _context2.stop(); } @@ -65538,7 +72879,7 @@ function () { return _context4.stop(); } } - }, _callee4, this); + }, _callee4); })); return function (_x8) { @@ -65551,7 +72892,7 @@ function () { return _context5.stop(); } } - }, _callee5, this); + }, _callee5); })); function runHooks(_x5, _x6, _x7) { @@ -65653,7 +72994,7 @@ function () { return _context7.stop(); } } - }, _callee7, this); + }, _callee7); })); return function (_x10) { @@ -65682,7 +73023,7 @@ function () { exports.default = TestCaseRunner; -},{"../status":377,"./attachment_manager":369,"./helpers":370,"./step_runner":374,"bluebird":18,"core-js/modules/es6.array.iterator":128,"core-js/modules/es6.object.keys":130,"core-js/modules/es6.promise":132,"core-js/modules/es6.string.starts-with":141,"core-js/modules/web.dom.iterable":145,"lodash":248,"regenerator-runtime/runtime":283}],376:[function(require,module,exports){ +},{"../status":615,"./attachment_manager":607,"./helpers":608,"./step_runner":612,"bluebird":21,"lodash":481}],614:[function(require,module,exports){ (function (__dirname){ "use strict"; @@ -65692,14 +73033,6 @@ Object.defineProperty(exports, "__esModule", { exports.isFileNameInCucumber = isFileNameInCucumber; exports.default = void 0; -require("core-js/modules/es7.array.includes"); - -require("core-js/modules/es6.string.includes"); - -require("core-js/modules/es6.array.find-index"); - -require("core-js/modules/es6.string.starts-with"); - var _lodash = _interopRequireDefault(require("lodash")); var _stackChain = _interopRequireDefault(require("stack-chain")); @@ -65782,7 +73115,8 @@ function () { exports.default = StackTraceFilter; }).call(this,"/src") -},{"core-js/modules/es6.array.find-index":125,"core-js/modules/es6.string.includes":139,"core-js/modules/es6.string.starts-with":141,"core-js/modules/es7.array.includes":143,"lodash":248,"path":260,"stack-chain":297}],377:[function(require,module,exports){ + +},{"lodash":481,"path":493,"stack-chain":527}],615:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -65812,7 +73146,7 @@ function getStatusMapping(initialValue) { }).fromPairs().value(); } -},{"lodash":248}],378:[function(require,module,exports){ +},{"lodash":481}],616:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -65826,9 +73160,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function buildStepArgumentIterator(mapping) { return function (arg) { - if (arg.hasOwnProperty('rows')) { + if (Object.prototype.hasOwnProperty.call(arg, 'rows')) { return mapping.dataTable(arg); - } else if (arg.hasOwnProperty('content')) { + } else if (Object.prototype.hasOwnProperty.call(arg, 'content')) { return mapping.docString(arg); } @@ -65836,7 +73170,7 @@ function buildStepArgumentIterator(mapping) { }; } -},{"util":324}],379:[function(require,module,exports){ +},{"util":560}],617:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -65848,10 +73182,6 @@ exports.buildStepDefinitionConfig = buildStepDefinitionConfig; exports.buildStepDefinitionFromConfig = buildStepDefinitionFromConfig; exports.buildParameterType = buildParameterType; -require("core-js/modules/es6.function.name"); - -require("core-js/modules/es6.array.find"); - var _util = require("util"); var _lodash = _interopRequireDefault(require("lodash")); @@ -66049,7 +73379,7 @@ function buildParameterType(_ref5) { return new _cucumberExpressions.ParameterType(_name, regexp, null, transformer, useForSnippets, preferForRegexpMatch); } -},{"../formatter/helpers":343,"../models/step_definition":365,"../models/test_case_hook_definition":366,"../models/test_run_hook_definition":367,"../stack_trace_filter":376,"./validate_arguments":383,"core-js/modules/es6.array.find":126,"core-js/modules/es6.function.name":129,"cucumber-expressions":161,"lodash":248,"path":260,"stacktrace-js":310,"util":324}],380:[function(require,module,exports){ +},{"../formatter/helpers":579,"../models/step_definition":603,"../models/test_case_hook_definition":604,"../models/test_run_hook_definition":605,"../stack_trace_filter":614,"./validate_arguments":621,"cucumber-expressions":406,"lodash":481,"path":493,"stacktrace-js":540,"util":560}],618:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -66057,8 +73387,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.wrapDefinitions = wrapDefinitions; -require("core-js/modules/web.dom.iterable"); - var _lodash = _interopRequireDefault(require("lodash")); var _utilArity = _interopRequireDefault(require("util-arity")); @@ -66080,6 +73408,7 @@ function wrapDefinitions(_ref) { var wrappedFn = definitionFunctionWrapper(definition.code, definition.options.wrapperOptions); if (wrappedFn !== definition.code) { + definition.unwrappedCode = definition.code; definition.code = (0, _utilArity.default)(codeLength, wrappedFn); } }); @@ -66098,7 +73427,7 @@ function wrapDefinitions(_ref) { } } -},{"core-js/modules/web.dom.iterable":145,"is-generator":241,"lodash":248,"path":260,"util-arity":320}],381:[function(require,module,exports){ +},{"is-generator":477,"lodash":481,"path":493,"util-arity":556}],619:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -66257,7 +73586,7 @@ var _default = new SupportCodeLibraryBuilder(); exports.default = _default; -},{"./build_helpers":379,"./finalize_helpers":380,"./parameter_type_registry_builder":382,"lodash":248,"util":324}],382:[function(require,module,exports){ +},{"./build_helpers":617,"./finalize_helpers":618,"./parameter_type_registry_builder":620,"lodash":481,"util":560}],620:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -66276,7 +73605,7 @@ var _default = { }; exports.default = _default; -},{"cucumber-expressions":161}],383:[function(require,module,exports){ +},{"cucumber-expressions":406}],621:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -66284,17 +73613,13 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = validateArguments; -require("core-js/modules/es6.array.iterator"); - -require("core-js/modules/es6.object.keys"); - -require("core-js/modules/web.dom.iterable"); - var _lodash = _interopRequireDefault(require("lodash")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -66367,14 +73692,16 @@ function validateArguments(_ref6) { }); } -},{"core-js/modules/es6.array.iterator":128,"core-js/modules/es6.object.keys":130,"core-js/modules/web.dom.iterable":145,"lodash":248}],384:[function(require,module,exports){ -(function (global){ +},{"lodash":481}],622:[function(require,module,exports){ +(function (global,setImmediate,clearImmediate){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; +exports.default = exports.MILLISECONDS_IN_NANOSECOND = void 0; +var MILLISECONDS_IN_NANOSECOND = 1000 * 1000; +exports.MILLISECONDS_IN_NANOSECOND = MILLISECONDS_IN_NANOSECOND; var previousTimestamp; var methods = { beginTiming: function beginTiming() { @@ -66402,8 +73729,9 @@ function getTimestamp() { var _default = methods; exports.default = _default; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],385:[function(require,module,exports){ +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate,require("timers").clearImmediate) + +},{"timers":548}],623:[function(require,module,exports){ (function (process){ "use strict"; @@ -66440,7 +73768,7 @@ function () { if (typeof window === 'undefined') { process.removeListener('uncaughtException', handler); } else { - window.onerror = void 0; + window.onerror = undefined; } } }]); @@ -66451,7 +73779,8 @@ function () { exports.default = UncaughtExceptionManager; }).call(this,require('_process')) -},{"_process":265}],386:[function(require,module,exports){ + +},{"_process":497}],624:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -66459,10 +73788,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -require("core-js/modules/es6.promise"); - -require("regenerator-runtime/runtime"); - var _bluebird = _interopRequireDefault(require("bluebird")); var _time = _interopRequireDefault(require("./time")); @@ -66618,7 +73943,7 @@ function () { return _context.stop(); } } - }, _callee, this, [[2, 6], [29, 35]]); + }, _callee, null, [[2, 6], [29, 35]]); })); function run(_x) { @@ -66634,5 +73959,7 @@ function () { exports.default = UserCodeRunner; -},{"./time":384,"./uncaught_exception_manager":385,"bluebird":18,"core-js/modules/es6.promise":132,"regenerator-runtime/runtime":283,"util":324}]},{},[362])(362) -}); \ No newline at end of file +},{"./time":622,"./uncaught_exception_manager":623,"bluebird":21,"util":560}]},{},[564])(564) +}); + +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvYW55LXByb21pc2UvaW5kZXguanMiLCJub2RlX21vZHVsZXMvYW55LXByb21pc2UvbG9hZGVyLmpzIiwibm9kZV9tb2R1bGV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1xuICAgIH0gZWxzZSB7XG4gICAgICAgIG91dCA9IGZ1bmN0aW9uIChhcmcsIG1zZykge1xuICAgICAgICAgICAgaWYgKCFhcmcpIHtcbiAgICAgICAgICAgICAgICBfdG9zcyhtc2csICd0cnVlJywgYXJnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICAvKiBzdGFuZGFyZCBjaGVja3MgKi9cbiAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24gKGspIHtcbiAgICAgICAgaWYgKG5kZWJ1Zykge1xuICAgICAgICAgICAgb3V0W2tdID0gbm9vcDtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB2YXIgdHlwZSA9IHR5cGVzW2tdO1xuICAgICAgICBvdXRba10gPSBmdW5jdGlvbiAoYXJnLCBtc2cpIHtcbiAgICAgICAgICAgIGlmICghdHlwZS5jaGVjayhhcmcpKSB7XG4gICAgICAgICAgICAgICAgX3Rvc3MobXNnLCBrLCB0eXBlLm9wZXJhdG9yLCBhcmcsIHR5cGUuYWN0dWFsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICB9KTtcblxuICAgIC8qIG9wdGlvbmFsIGNoZWNrcyAqL1xuICAgIGtleXMuZm9yRWFjaChmdW5jdGlvbiAoaykge1xuICAgICAgICB2YXIgbmFtZSA9ICdvcHRpb25hbCcgKyBfY2FwaXRhbGl6ZShrKTtcbiAgICAgICAgaWYgKG5kZWJ1Zykge1xuICAgICAgICAgICAgb3V0W25hbWVdID0gbm9vcDtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB2YXIgdHlwZSA9IHR5cGVzW2tdO1xuICAgICAgICBvdXRbbmFtZV0gPSBmdW5jdGlvbiAoYXJnLCBtc2cpIHtcbiAgICAgICAgICAgIGlmIChhcmcgPT09IHVuZGVmaW5lZCB8fCBhcmcgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIXR5cGUuY2hlY2soYXJnKSkge1xuICAgICAgICAgICAgICAgIF90b3NzKG1zZywgaywgdHlwZS5vcGVyYXRvciwgYXJnLCB0eXBlLmFjdHVhbCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgfSk7XG5cbiAgICAvKiBhcnJheU9mIGNoZWNrcyAqL1xuICAgIGtleXMuZm9yRWFjaChmdW5jdGlvbiAoaykge1xuICAgICAgICB2YXIgbmFtZSA9ICdhcnJheU9mJyArIF9jYXBpdGFsaXplKGspO1xuICAgICAgICBpZiAobmRlYnVnKSB7XG4gICAgICAgICAgICBvdXRbbmFtZV0gPSBub29wO1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHZhciB0eXBlID0gdHlwZXNba107XG4gICAgICAgIHZhciBleHBlY3RlZCA9ICdbJyArIGsgKyAnXSc7XG4gICAgICAgIG91dFtuYW1lXSA9IGZ1bmN0aW9uIChhcmcsIG1zZykge1xuICAgICAgICAgICAgaWYgKCFBcnJheS5pc0FycmF5KGFyZykpIHtcbiAgICAgICAgICAgICAgICBfdG9zcyhtc2csIGV4cGVjdGVkLCB0eXBlLm9wZXJhdG9yLCBhcmcsIHR5cGUuYWN0dWFsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBpO1xuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGFyZy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGlmICghdHlwZS5jaGVjayhhcmdbaV0pKSB7XG4gICAgICAgICAgICAgICAgICAgIF90b3NzKG1zZywgZXhwZWN0ZWQsIHR5cGUub3BlcmF0b3IsIGFyZywgdHlwZS5hY3R1YWwpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICB9KTtcblxuICAgIC8qIG9wdGlvbmFsQXJyYXlPZiBjaGVja3MgKi9cbiAgICBrZXlzLmZvckVhY2goZnVuY3Rpb24gKGspIHtcbiAgICAgICAgdmFyIG5hbWUgPSAnb3B0aW9uYWxBcnJheU9mJyArIF9jYXBpdGFsaXplKGspO1xuICAgICAgICBpZiAobmRlYnVnKSB7XG4gICAgICAgICAgICBvdXRbbmFtZV0gPSBub29wO1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHZhciB0eXBlID0gdHlwZXNba107XG4gICAgICAgIHZhciBleHBlY3RlZCA9ICdbJyArIGsgKyAnXSc7XG4gICAgICAgIG91dFtuYW1lXSA9IGZ1bmN0aW9uIChhcmcsIG1zZykge1xuICAgICAgICAgICAgaWYgKGFyZyA9PT0gdW5kZWZpbmVkIHx8IGFyZyA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICghQXJyYXkuaXNBcnJheShhcmcpKSB7XG4gICAgICAgICAgICAgICAgX3Rvc3MobXNnLCBleHBlY3RlZCwgdHlwZS5vcGVyYXRvciwgYXJnLCB0eXBlLmFjdHVhbCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgaTtcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBhcmcubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAoIXR5cGUuY2hlY2soYXJnW2ldKSkge1xuICAgICAgICAgICAgICAgICAgICBfdG9zcyhtc2csIGV4cGVjdGVkLCB0eXBlLm9wZXJhdG9yLCBhcmcsIHR5cGUuYWN0dWFsKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgfSk7XG5cbiAgICAvKiByZS1leHBvcnQgYnVpbHQtaW4gYXNzZXJ0aW9ucyAqL1xuICAgIE9iamVjdC5rZXlzKGFzc2VydCkuZm9yRWFjaChmdW5jdGlvbiAoaykge1xuICAgICAgICBpZiAoayA9PT0gJ0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RyaW5nW29sZFBvcyArIGldO1xuICAgICAgICAgICAgcmV0dXJuIG9sZFZhbHVlLmxlbmd0aCA+IHZhbHVlLmxlbmd0aCA/IG9sZFZhbHVlIDogdmFsdWU7XG4gICAgICAgICAgfSk7XG4gICAgICAgICAgY29tcG9uZW50LnZhbHVlID0gZGlmZi5qb2luKHZhbHVlKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBjb21wb25lbnQudmFsdWUgPSBkaWZmLmpvaW4obmV3U3RyaW5nLnNsaWNlKG5ld1BvcywgbmV3UG9zICsgY29tcG9uZW50LmNvdW50KSk7XG4gICAgICAgIH1cblxuICAgICAgICBuZXdQb3MgKz0gY29tcG9uZW50LmNvdW50OyAvLyBDb21tb24gY2FzZVxuXG4gICAgICAgIGlmICghY29tcG9uZW50LmFkZGVkKSB7XG4gICAgICAgICAgb2xkUG9zICs9IGNvbXBvbmVudC5jb3VudDtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgY29tcG9uZW50LnZhbHVlID0gZGlmZi5qb2luKG9sZFN0cmluZy5zbGljZShvbGRQb3MsIG9sZFBvcyArIGNvbXBvbmVudC5jb3VudCkpO1xuICAgICAgICBvbGRQb3MgKz0gY29tcG9uZW50LmNvdW50OyAvLyBSZXZlcnNlIGFkZCBhbmQgcmVtb3ZlIHNvIHJlbW92ZXMgYXJlIG91dHB1dCBmaXJzdCB0byBtYXRjaCBjb21tb24gY29udmVudGlvblxuICAgICAgICAvLyBUaGUgZGlmZmluZyBhbGdvcml0aG0gaXMgdGllZCB0byBhZGQgdGhlbiByZW1vdmUgb3V0cHV0IGFuZCB0aGlzIGlzIHRoZSBzaW1wbGVzdFxuICAgICAgICAvLyByb3V0ZSB0byBnZXQgdGhlIGRlc2lyZWQgb3V0cHV0IHdpdGggbWluaW1hbCBvdmVyaGVhZC5cblxuICAgICAgICBpZiAoY29tcG9uZW50UG9zICYmIGNvbXBvbmVudHNbY29tcG9uZW50UG9zIC0gMV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hY2sucG9wKCk7XG4gICAgICByZXBsYWNlbWVudFN0YWNrLnBvcCgpO1xuICAgICAgcmV0dXJuIGNhbm9uaWNhbGl6ZWRPYmo7XG4gICAgfVxuXG4gICAgaWYgKG9iaiAmJiBvYmoudG9KU09OKSB7XG4gICAgICBvYmogPSBvYmoudG9KU09OKCk7XG4gICAgfVxuXG4gICAgaWYgKF90eXBlb2Yob2JqKSA9PT0gJ29iamVjdCcgJiYgb2JqICE9PSBudWxsKSB7XG4gICAgICBzdGFjay5wdXNoKG9iaik7XG4gICAgICBjYW5vbmljYWxpemVkT2JqID0ge307XG4gICAgICByZXBsYWNlbWVudFN0YWNrLnB1c2goY2Fub25pY2FsaXplZE9iaik7XG5cbiAgICAgIHZhciBzb3J0ZWRLZXlzID0gW10sXG4gICAgICAgICAgX2tleTtcblxuICAgICAgZm9yIChfa2V5IGluIG9iaikge1xuICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgICBpZiAob2JqLmhhc093blByb3BlcnR5KF9rZXkpKSB7XG4gICAgICAgICAgc29ydGVkS2V5cy5wdXNoKF9rZXkpO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHNvcnRlZEtleXMuc29ydCgpO1xuXG4gICAgICBmb3IgKGkgPSAwOyBpIDwgc29ydGVkS2V5cy5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAgICBfa2V5ID0gc29ydGVkS2V5c1tpXTtcbiAgICAgICAgY2Fub25pY2FsaXplZE9ialtfa2V5XSA9IGNhbm9uaWNhbGl6ZShvYmpbX2tleV0sIHN0YWNrLCByZXBsYWNlbWVudFN0YWNrLCByZXBsYWNlciwgX2tleSk7XG4gICAgICB9XG5cbiAgICAgIHN0YWNrLnBvcCgpO1xuICAgICAgcmVwbGFjZW1lbnRTdGFjay5wb3AoKTtcbiAgICB9IGVsc2Uge1xuICAgICAgY2Fub25pY2FsaXplZE9iaiA9IG9iajtcbiAgICB9XG5cbiAgICByZXR1c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Xh0IGZpbGUuIFRoZXJlZm9yZSBwcnVuZSBzdWNoIGNhc2VzIG91dC5cbiAgICAgICAgaWYgKGRpZmZzdHJbaV0uaW5kZXhPZignLS0tICcpID09PSAwICYmIGkgKyAyIDwgZGlmZnN0ci5sZW5ndGggJiYgZGlmZnN0cltpICsgMV0uaW5kZXhPZignKysrICcpID09PSAwICYmIGRpZmZzdHJbaSArIDJdLmluZGV4T2YoJ0BAJykgPT09IDApIHtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBvcGVyYXRpb24gPSBkaWZmc3RyW2ldLmxlbmd0aCA9PSAwICYmIGkgIT0gZGlmZnN0ci5sZW5ndGggLSAxID8gJyAnIDogZGlmZnN0cltpXVswXTtcblxuICAgICAgICBpZiAob3BlcmF0aW9uID09PSAnKycgfHwgb3BlcmF0aW9uID09PSAnLScgfHwgb3BlcmF0aW9uID09PSAnICcgfHwgb3BlcmF0aW9uID09PSAnXFxcXCcpIHtcbiAgICAgICAgICBodW5rLmxpbmVzLnB1c2goZGlmZnN0cltpXSk7XG4gICAgICAgICAgaHVuay5saW5lZGVsaW1pdGVycy5wdXNoKGRlbGltaXRlcnNbaV0gfHwgJ1xcbicpO1xuXG4gICAgICAgICAgaWYgKG9wZXJhdGlvbiA9PT0gJysnKSB7XG4gICAgICAgICAgICBhZGRDb3VudCsrO1xuICAgICAgICAgIH0gZWxzZSBpZiAob3BlcmF0aW9uID09PSAnLScpIHtcbiAgICAgICAgICAgIHJlbW92ZUNvdW50Kys7XG4gICAgICAgICAgfSBlbHNlIGlmIChvcGVyYXRpb24gPT09ICcgJykge1xuICAgICAgICAgICAgYWRkQ291bnQrKztcbiAgICAgICAgICAgIHJlbW92ZUNvdW50Kys7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9IC8vIEhhbmRsZSB0aGUgZW1wdHkgYmxvY2sgY291bnQgY2Fz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VyYXRpb24gPSBsaW5lLmxlbmd0aCA+IDAgPyBsaW5lWzBdIDogJyAnLFxuICAgICAgICAgICAgY29udGVudCA9IGxpbmUubGVuZ3RoID4gMCA/IGxpbmUuc3Vic3RyKDEpIDogbGluZSxcbiAgICAgICAgICAgIGRlbGltaXRlciA9IF9odW5rLmxpbmVkZWxpbWl0ZXJzW2pdO1xuXG4gICAgICAgIGlmIChvcGVyYXRpb24gPT09ICcgJykge1xuICAgICAgICAgIF90b1BvcysrO1xuICAgICAgICB9IGVsc2UgaWYgKG9wZXJhdGlvbiA9PT0gJy0nKSB7XG4gICAgICAgICAgbGluZXMuc3BsaWNlKF90b1BvcywgMSk7XG4gICAgICAgICAgZGVsaW1pdGVycy5zcGxpY2UoX3RvUG9zLCAxKTtcbiAgICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgICB9IGVsc2UgaWYgKG9wZXJhdGlvbiA9PT0gJysnKSB7XG4gICAgICAgICAgbGluZXMuc3BsaWNlKF90b1BvcywgMCwgY29udGVudCk7XG4gICAgICAgICAgZGVsaW1pdGVycy5zcGxpY2UoX3RvUG9zLCAwLCBkZWxpbWl0ZXIpO1xuICAgICAgICAgIF90b1BvcysrO1xuICAgICAgICB9IGVsc2UgaWYgKG9wZXJhdGlvbiA9PT0gJ1xcXFwnKSB7XG4gICAgICAgICAgdmFyIHByZXZpb3VzT3BlcmF0aW9uID0gX2h1bmsubGluZXNbaiAtIDFdID8gX2h1bmsubGluZXNbaiAtIDFdWzBdIDogbnVsbDtcblxuICAgICAgICAgIGlmIChwcmV2aW91c09wZXJhdGlvbiA9PT0gJysnKSB7XG4gICAgICAgICAgICByZW1vdmVFT0ZOTCA9IHRydWU7XG4gICAgICAgICAgfSBlbHNlIGlmIChwcmV2aW91c09wZXJhdGlvbiA9PT0gJy0nKSB7XG4gICAgICAgICAgICBhZGRFT0ZOTCA9IHRydWU7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB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XMubWFwKGZ1bmN0aW9uIChlbnRyeSkge1xuICAgICAgICByZXR1cm4gJyAnICsgZW50cnk7XG4gICAgICB9KTtcbiAgICB9XG5cbiAgICB2YXIgaHVua3MgPSBbXTtcbiAgICB2YXIgb2xkUmFuZ2VTdGFydCA9IDAsXG4gICAgICAgIG5ld1JhbmdlU3RhcnQgPSAwLFxuICAgICAgICBjdXJSYW5nZSA9IFtdLFxuICAgICAgICBvbGRMaW5lID0gMSxcbiAgICAgICAgbmV3TGluZSA9IDE7XG5cbiAgICB2YXIgX2xvb3AgPSBmdW5jdGlvbiBfbG9vcChpKSB7XG4gICAgICB2YXIgY3VycmVudCA9IGRpZmZbaV0sXG4gICAgICAgICAgbGluZXMgPSBjdXJyZW50LmxpbmVzIHx8IGN1cnJlbnQudmFsdWUucmVwbGFjZSgvXFxuJC8sICcnKS5zcGxpdCgnXFxuJyk7XG4gICAgICBjdXJyZW50LmxpbmVzID0gbGluZXM7XG5cbiAgICAgIGlmIChjdXJyZW50LmFkZGVkIHx8IGN1cnJlbnQucmVtb3ZlZCkge1xuICAgICAgICB2YXIgX2N1clJhbmdlO1xuXG4gICAgICAgIC8vIElmIHdlIGhhdmUgcHJldmlvdXMgY29udGV4dCwgc3RhcnQgd2l0aCB0aGF0XG4gICAgICAgIGlmICghb2xkUmFuZ2VTdGFydCkge1xuICAgICAgICAgIHZhciBwcmV2ID0gZGlmZltpIC0gMV07XG4gICAgICAgICAgb2xkUmFuZ2VTdGFydCA9IG9sZExpbmU7XG4gICAgICAgICAgbmV3UmFuZ2VTdGFydCA9IG5ld0xpbmU7XG5cbiAgICAgICAgICBpZiAocHJldikge1xuICAgICAgICAgICAgY3VyUmFuZ2UgPSBvcHRpb25zLmNvbnRleHQgPiAwID8gY29udGV4dExpbmVzKHByZXYubGluZXMuc2xpY2UoLW9wdGlvbnMuY29udGV4dCkpIDogW107XG4gICAgICAgICAgICBvbGRSYW5nZVN0YXJ0IC09IGN1clJhbmdlLmxlbmd0aDtcbiA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gbm9ObEJlZm9yZUFkZHMgPSBsaW5lcy5sZW5ndGggPT0gMCAmJiBjdXJSYW5nZS5sZW5ndGggPiBodW5rLm9sZExpbmVzO1xuXG4gICAgICAgICAgICAgIGlmICghb2xkRU9GTmV3bGluZSAmJiBub05sQmVmb3JlQWRkcykge1xuICAgICAgICAgICAgICAgIC8vIHNwZWNpYWwgY2FzZTogb2xkIGhhcyBubyBlb2wgYW5kIG5vIHRyYWlsaW5nIGNvbnRleHQ7IG5vLW5sIGNhbiBlbmQgdXAgYmVmb3JlIGFkZHNcbiAgICAgICAgICAgICAgICBjdXJSYW5nZS5zcGxpY2UoaHVuay5vbGRMaW5lcywgMCwgJ1xcXFwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZScpO1xuICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgaWYgKCFvbGRFT0ZOZXdsaW5lICYmICFub05sQmVmb3JlQWRkcyB8fCAhbmV3RU9GTmV3bGluZSkge1xuICAgICAgICAgICAgICAgIGN1clJhbmdlLnB1c2goJ1xcXFwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZScpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGh1bmtzLnB1c2goaHVuayk7XG4gICAgICAgICAgICBvbGRSYW5nZVN0YXJ0ID0gMDtcbiAgICAgICAgICAgIG5ld1JhbmdlU3RhcnQgPSAwO1xuICAgICAgICAgICAgY3VyUmFuZ2UgPSBbXTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBvbGRMaW5lICs9IGxpbmVzLmxlbmd0aDtcbiAgICAgICAgbmV3TGluZSArPSBsaW5lcy5sZW5ndGg7XG4gICAgICB9XG4gICAgfTtcblxuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgZGlmZi5sZW5ndGg7IGkrKykge1xuICAgICAgX2xvb3AoaSk7XG4gICAgfVxuXG4gICAgcmV0dXJuIHtcbiAgICAgIG9sZEZpbG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gICAgLy8gTWluZSBpbnNlcnRlZFxuICAgICAgICAoX2h1bmskbGluZXMgPSBodW5rLmxpbmVzKS5wdXNoLmFwcGx5KF9odW5rJGxpbmVzLCBfdG9Db25zdW1hYmxlQXJyYXkoY29sbGVjdENoYW5nZShtaW5lKSkpO1xuICAgICAgfSBlbHNlIGlmICh0aGVpckN1cnJlbnRbMF0gPT09ICcrJyAmJiBtaW5lQ3VycmVudFswXSA9PT0gJyAnKSB7XG4gICAgICAgIHZhciBfaHVuayRsaW5lczI7XG5cbiAgICAgICAgLy8gVGhlaXJzIGluc2VydGVkXG4gICAgICAgIChfaHVuayRsaW5lczIgPSBodW5rLmxpbmVzKS5wdXNoLmFwcGx5KF9odW5rJGxpbmVzMiwgX3RvQ29uc3VtYWJsZUFycmF5KGNvbGxlY3RDaGFuZ2UodGhlaXIpKSk7XG4gICAgICB9IGVsc2UgaWYgKG1pbmVDdXJyZW50WzBdID09PSAnLScgJiYgdGhlaXJDdXJyZW50WzBdID09PSAnICcpIHtcbiAgICAgICAgLy8gTWluZSByZW1vdmVkIG9yIGVkaXRlZFxuICAgICAgICByZW1vdmFsKGh1bmssIG1pbmUsIHRoZWlyKTtcbiAgICAgIH0gZWxzZSBpZiAodGhlaXJDdXJyZW50WzBdID09PSAnLScgJiYgbWluZUN1cnJlbnRbMF0gPT09ICcgJykge1xuICAgICAgICAvLyBUaGVpciByZW1vdmVkIG9yIGVkaXRlZFxuICAgICAgICByZW1vdmFsKGh1bmssIHRoZWlyLCBtaW5lLCB0cnVlKTtcbiAgICAgIH0gZWxzZSBpZiAobWluZUN1cnJlbnQgPT09IHRoZWlyQ3VycmVudCkge1xuICAgICAgICAvLyBDb250ZXh0IGlkZW50aXR5XG4gICAgICAgIGh1bmsubGluZXMucHVzaChtaW5lQ3VycmVudCk7XG4gICAgICAgIG1pbmUuaW5kZXgrKztcbiAgICAgICAgdGhlaXIuaW5kZXgrKztcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIC8vIENvbnR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W5lcyA9IDA7XG4gICAgbGluZXMuZm9yRWFjaChmdW5jdGlvbiAobGluZSkge1xuICAgICAgaWYgKHR5cGVvZiBsaW5lICE9PSAnc3RyaW5nJykge1xuICAgICAgICB2YXIgbXlDb3VudCA9IGNhbGNPbGROZXdMaW5lQ291bnQobGluZS5taW5lKTtcbiAgICAgICAgdmFyIHRoZWlyQ291bnQgPSBjYWxjT2xkTmV3TGluZUNvdW50KGxpbmUudGhlaXJzKTtcblxuICAgICAgICBpZiAob2xkTGluZXMgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgIGlmIChteUNvdW50Lm9sZExpbmVzID09PSB0aGVpckNvdW50Lm9sZExpbmVzKSB7XG4gICAgICAgICAgICBvbGRMaW5lcyArPSBteUNvdW50Lm9sZExpbmVzO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBvbGRMaW5lcyA9IHVuZGVmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobmV3TGluZXMgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgIGlmIChteUNvdW50Lm5ld0xpbmVzID09PSB0aGVpckNvdW50Lm5ld0xpbmVzKSB7XG4gICAgICAgICAgICBuZXdMaW5lcyArPSBteUNvdW50Lm5ld0xpbmVzO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBuZXdMaW5lcyA9IHVuZGVmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGlmIChuZXdMaW5lcyAhPT0gdW5kZWZpbmVkICYmIChsaW5lWzBdID09PSAnKycgfHwgbGluZVswXSA9PT0gJyAnKSkge1xuICAgICAgICAgIG5ld0xpbmVzKys7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAob2xkTGluZXMgIT09IHVuZGVmaW5lZCAmJiAobGluZVswXSA9PT0gJy0nIHx8IGxpbmVbMF0gPT09ICcgJykpIHtcbiAgICAgICAgICB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DIpIHtcbiAgICB0bXAgPVxuICAgICAgKHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpKV0gPDwgMikgfFxuICAgICAgKHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpICsgMSldID4+IDQpXG4gICAgYXJyW2N1ckJ5dGUrK10gPSB0bXAgJiAweEZGXG4gIH1cblxuICBpZiAocGxhY2VIb2xkZXJzTGVuID09PSAxKSB7XG4gICAgdG1wID1cbiAgICAgIChyZXZMb29rdXBbYjY0LmNoYXJDb2RlQXQoaSldIDw8IDEwKSB8XG4gICAgICAocmV2TG9va3VwW2I2NC5jaGFyQ29kZUF0KGkgKyAxKV0gPDwgNCkgfFxuICAgICAgKHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpICsgMildID4+IDIpXG4gICAgYXJyW2N1ckJ5dGUrK10gPSAodG1wID4+IDgpICYgMHhGRlxuICAgIGFycltjdXJCeXRlKytdID0gdG1wICYgMHhGRlxuICB9XG5cbiAgcmV0dXJuIGFyclxufVxuXG5mdW5jdGlvbiB0cmlwbGV0VG9CYXNlNjQgKG51bSkge1xuICByZXR1cm4gbG9va3VwW251bSA+PiAxOCAmIDB4M0ZdICtcbiAgICBsb29rdXBbbnVtID4+IDEyICYgMHgzRl0gK1xuICAgIGxvb2t1cFtudW0gPj4gNiAmIDB4M0ZdICtcbiAgICBsb29rdXBbbnVtICYgMHgzRl1cbn1cblxuZnVuY3Rpb24gZW5jb2RlQ2h1bmsgKHVpbnQ4LCBzdGFydCwgZW5kKSB7XG4gIHZhciB0bXBcbiAgdmFyIG91dHB1dCA9IFtdXG4gIGZvciAodmFyIGkgPSBzdGFydDsgaSA8IGVuZDsgaSArPSAzKSB7XG4gICAgdG1wID1cbiAgICAgICgodWludDhbaV0gPDwgMTYpICYgMHhGRjAwMDApICtcbiAgICAgICgodWludDhbaSArIDFdIDw8IDgpICYgMHhGRjAwKSArXG4gICAgICAodWludDhbaSArIDJdICYgMHhGRilcbiAgICBvdXRwdXQucHVza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lja3k7XG4gICAgdGhpcy51bmljb2RlID0gdGhpcy5yZWdleC51bmljb2RlO1xuICAgIHRoaXMubGFzdEluZGV4ID0gdGhpcy5yZWdleC5sYXN0SW5kZXg7XG59XG5cblJlZ2V4LnByb3RvdHlwZSA9IE9iamVjdC5jcmVhdGUoUmVnRXhwLnByb3RvdHlwZSwge1xuICAgIGZsYWdzOiB7XG4gICAgICAgIHZhbHVlOiBudWxsLFxuICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLFxuICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgIHdyaXRhYmxlOiB0cnVlXG4gICAgfSxcbiAgICBnbG9iYWw6IHtcbiAgICAgICAgdmFsdWU6IG51bGwsXG4gICAgICAgIGVudW1lcmFibGU6IHRydWUsXG4gICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgd3JpdGFibGU6IHRydWVcbiAgICB9LFxuICAgIGlnbm9yZUNhc2U6IHtcbiAgICAgICAgdmFsdWU6IG51bGwsXG4gICAgICAgIGVudW1lcmFibGU6IHRydWUsXG4gICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgICAgd3JpdGFibGU6IHRydWVcbiAgICB9LFxuICAgIG11bHRpbGluZToge1xuICAgICAgICB2YWx1ZTogbnVsbCxcbiAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSxcbiAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICAgICAgICB3cml0YWJsZTogdHJ1ZVxuICAgIH0sXG4gICAgc291cmNlOiB7XG4gICAgICAgIHZhbHVlOiBudWxsLFxuICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLFxuICAgICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICAgIHdyaXRhYmxlOiB0cnVlXG4gICAgfSxcbiAgICBzdGlja3k6IHtcbiAgICAgICAgdmFsdWU6IG51bGwsXG4gICAgICAgIGVudW1lcmFibGU6IHRydWUsXG4gICAgICAgI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A9IDA7IGkgPCByZWdleEdyb3VwU3RydWN0dXJlQ2hpbGRyZW4ubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIHZhciBpbmRleCA9IHJlZ2V4R3JvdXBTdHJ1Y3R1cmVDaGlsZHJlbltpXVswXTtcbiAgICAgICAgICAgIHZhciBvcmlnaW5hbEluZGV4ID0gcmVnZXhHcm91cFN0cnVjdHVyZUNoaWxkcmVuW2ldWzFdO1xuICAgICAgICAgICAgaWYgKG9yaWdpbmFsSW5kZXgpIHtcbiAgICAgICAgICAgICAgICByZXN1bHRbb3JpZ2luYWxJbmRleF0gPSByZXN1bHRSZWdleFtpbmRleF07XG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiByZXN1bHRbb3JpZ2luYWxJbmRleF0gPT09IFwidW5kZWZpbmVkXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LmluZGV4W29yaWdpbmFsSW5kZXhdID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdC5pbmRleFtvcmlnaW5hbEluZGV4XSA9IGN1cnJlbnRTdHJQb3M7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHJlZ2V4R3JvdXBTdHJ1Y3R1cmVDaGlsZHJlbltpXVszXSkge1xuICAgICAgICAgICAgICAgIGV4ZWNJbnRlcm5hbChjdXJyZW50U3RyUG9zLCByZWdleEdyb3VwU3RydWN0dXJlQ2hpbGRyZW5baV1bM10pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHR5cGVvZiByZXN1bHRSZWdleFtpbmRleF0gIT09IFwidW5kZWZpbmVkXCIpIHtcbiAgICAgICAgICAgICAgICBjdXJyZW50U3RyUG9zICs9IHJlc3VsdFJlZ2V4W2luZGV4XS5sZW5ndGg7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuICAgIGl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zdHJpbmdGdW5jdGlvbkluZGV4XSk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hhckF0ID09PSBcIidcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29tcHV0ZWRTdHJpbmcgKz0gc3RyLnN1YnN0cmluZyhyZXN1bHRFeGVjLmluZGV4W25ld1N1YnN0cmluZ0Z1bmN0aW9uSW5kZXhdICsgcmVzdWx0RXhlY1tuZXdTdWJzdHJpbmdGdW5jdGlvbkluZGV4XS5sZW5ndGgpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoYXJBdCA+PSAnMCcgJiYgY2hhckF0IDw9ICc5Jykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGludCA9IGNoYXJBdDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGkrKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJBdCA9IG5ld1N1YnN0cmluZ0Z1bmN0aW9uLmNoYXJBdChpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChjaGFyQXQgPj0gJzAnICYmIGNoYXJBdCA8PSAnOScpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgKz0gY2hhckF0O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkrKztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyQXQgPSBuZXdTdWJzdHJpbmdGdW5jdGlvbi5jaGFyQXQoaSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpLS07XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzdWx0RXhlY1tpbnRdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcHV0ZWRTdHJpbmcgKz0gcmVzdWx0RXhlY1tpbnRdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wdXRlZFN0cmluZyArPSAnJCcgKyBpbnQ7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvL3N0cmFuZ2Ugbm90IHN1cmUgd2hldGhlciB0aGlzIGlzIGNvcnJlY3QgLSBpbml0aWFsbHkgaXQgd2FzOiBjb21wdXRlZFN0cmluZyArPSBjaGFyQXQ7XG4gICAgICAgICAgICAgICAgICAgICAgICAvL2J1dCB1bml0IHRlc3RzIGluIE5QTSB0b2xkIGRpZmZlcmVudGx5IS4uLlxuICAgICAgICAgICAgICAgICAgICAgICAgY29tcHV0ZWRTdHJpbmcgKz0gJyQnICsgY2hhckF0O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY29tcHV0ZWRTdHJpbmcgKz0gY2hhckF0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChuZXdTdWJzdHJpbmdGdW5jdGlvbiBpbnN0YW5jZW9mIEZ1bmN0aW9uKSB7XG4gICAgICAgICAgICB2YXIgYXJncyA9IFtyZXN1bHRFeGVjW25ld1N1YnN0cmluZ0Z1bmN0aW9uSW5kZXhdXTtcbiAgICAgICAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgcmVzdWx0RXhlYy5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgICAgIGFyZ3MucHVzaChyZXN1bHRFeGVjW2pdKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBqIDwgcmVzdWx0RXhlYy5pbmRleC5sZW5ndGg7IGsrKykge1xuICAgICAgICAgICAgICAgIGFyZ3MucHVzaChyZXN1bHRFeGVjLmluZGV4W2tdKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGFyZ3MucHVzaChzdHIpO1xuICAg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luZGV4T25Hcm91cGluZ1N0cnVjdHVyZSA9IGZ1bmN0aW9uIChncm91cGluZ1N0cnVjdHVyZUVsZW1lbnQpIHtcbiAgICAgICAgICAgIHZhciByZWdleEZvclRoaXNHcm91cCA9ICcnO1xuICAgICAgICAgICAgdmFyIGNoYXJBdDtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgZ3JvdXBpbmdTdHJ1Y3R1cmVFbGVtZW50WzJdLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgY2hhckF0ID0gZ3JvdXBpbmdTdHJ1Y3R1cmVFbGVtZW50WzJdLmNoYXJBdChpKTtcbiAgICAgICAgICAgICAgICByZWdleEZvclRoaXNHcm91cCArPSBjaGFyQXQ7XG4gICAgICAgICAgICAgICAgaWYgKGNoYXJBdCA9PT0gJ1xcXFwnKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpICsgMSA9PT0gZ3JvdXBpbmdTdHJ1Y3R1cmVFbGVtZW50WzJdLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaSsrO1xuICAgICAgICAgICAgICAgICAgICBjaGFyQXQgPSBncm91cGluZ1N0cnVjdHVyZUVsZW1lbnRbMl0uY2hhckF0KGkpO1xuICAgICAgICAgICAgICAgICAgICB2YXIgaW50ID0gJyc7XG4gICAgICAgICAgICAgICAgICAgIHdoaWxlIChjaGFyQXQgPj0gJzAnICYmIGNoYXJBdCA8PSAnOScpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGludCArPSBjaGFyQXQ7XG4gICAgICAgICAgICAgICAgICAgICAgICBpKys7XG4gICAgICAgICAgICAgICAgICAgICAgICBjaGFyQXQgPSBncm91cGluZ1N0cnVjdHVyZUVsZW1lbnRbMl0uY2hhckF0KGkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmIChpbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2V4Rm9yVGhpc0dyb3VwICs9IGluZGV4TWFwW2ludF07XG4gICAgICAgICAgICAgICAgICAgICAgICBpLS07XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWdleEZvclRoaXNHcm91cCArPSBjaGFyQXQ7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChjaGFyQXQgPT09ICdbJykge1xuICAgICAgICAgICAgICAgICAgICBpZiAoaSArIDEgPT09IGdyb3VwaW5nU3RydWN0dXJlRWxlbWVudFsyXS5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGkrKztcbiAgICAgICAgICAgICAgICAgICAgY2hhckF0ID0gZ3JvdXBpbmdTdHJ1Y3R1cmVFbGVtZW50WzJdLmNoYXJBdChpKTtcbiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKChjaGFyQXQgIT09ICddJyB8fCAoZ3JvdXBpbmdTdHJ1Y3R1cmVFbGVtZW50WzJdLmNoYXJBdChpIC0gMSkgPT09ICdcXFxcJyAmJiBncm91cGluZ1N0cnVjdHVyZUVsZW1lbnRbMl0uY2hhckF0KGkgLSAyKSAhPT0gJ1xcXFwnKSkgJiYgaSA8IGdyb3VwaW5nU3RydWN0dXJlRWxlbWVudFsyXS5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2V4Rm9yVGhpc0dyb3VwICs9IGNoYXJBdDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGkrKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJBdCA9IGdyb3VwaW5nU3RydWN0dXJlRWxlbWVudFsyXS5j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ICAgICAvLzIwMTcwNDE2IC0gYnVnIHRoZSBpbmRleCBtYXAgY2FuIGNoYW5nZSBsYXRlciBpZiBhZGRpdGlvbmFsIHN1cnJvdW5kaW5nIHBhcmFudGhlc2lzIGFyZSBhZGRlZFxuICAgICAgICAgICAgICAgICAgICAvL1RoZXJlZm9yZSB0aGlzIGNhbGN1bGF0aW9uIG5lZWRzIHRvIGJlIGRvbmUgaW4gdGhlIGVuZCFcbiAgICAgICAgICAgICAgICAgICAgLy90bXBTdHIgKz0gJ1xcXFwnICsgaW5kZXhNYXBbaW50XTtcbiAgICAgICAgICAgICAgICAgICAgdG1wU3RyICs9ICdcXFxcJyArIGludDtcbiAgICAgICAgICAgICAgICAgICAgY29udGFpbnNCYWNrUmVmZXJlbmNlWzBdID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAoaW50LmluZGV4T2YoJzgnKSA+PSAwIHx8IGludC5pbmRleE9mKCc5JykgPj0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy9pZiBpdCBpcyBhIG5vbiBvY3RhbCBkaWdpdCB0aGVuIHRyZWF0IGl0IGFzIHNpbXBsZSBudW1iZXJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRtcFN0ciArPSBpbnQ7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvL290aGVyd2lzZSBpdCBpcyBhIGNoYXJhY3RlciBlc2NhcGVcbiAgICAgICAgICAgICAgICAgICAgICAgIHRtcFN0ciArPSAnXFxcXCcgKyAneCcgKyAoXCIwXCIgKyAocGFyc2VJbnQoaW50LCA4KS50b1N0cmluZygxNikpKS5zbGljZSgtMikudG9VcHBlckNhc2UoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzb3VyY2VbMF0gKz0gJ1xcXFwnICsgaW50O1xuICAgICAgICAgICAgICAgIHBvc0luZGV4T3JpZ0luZGV4WzBdLS07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRtcFN0ciArPSAnXFxcXCcgKyBjaGFyQXQ7XG4gICAgICAgICAgICAgICAgc291cmNlWzBdICs9ICdcXFxcJyArIGNoYXJBdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICB9XG4gICAgICAgIGlmIChjaGFyQXQgPT09ICdbJykge1xuICAgICAgICAgICAgLy9wYXJzZSBjaGFyYWN0ZXIgc2V0XG4gICAgICAgICAgICB0bXBTdHIgKz0gJ1snO1xuICAgICAgICAgICAgc291cmNlWzBdICs9ICdbJztcbiAgICAgICAgICAgIGlmIChwb3NJbmRleE9yaWdJbmRleFswXSArIDEgPT09IHJlZ2V4Lmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcG9zSW5kZXhPcmlnSW5kZXhbMF0rKztcbiAgICAgICAgICAgIGNoYXJBdCA9IHJlZ2V4LmNoYXJBdChwb3NJbmRleE9yaWdJbmRleFswXSk7XG4gICAgICAgICAgICB3aGlsZSAoKGNoYXJBdCAhPT0gJ10nIHx8IChyZWdleC5jaGFyQXQocG9zSW5kZXhPcmlnSW5kZXhbMF0gLSAxKSA9PT0gJ1xcXFwnICYmIHJlZ2V4LmNoYXJBdChwb3NJbmRleE9yaWdJbmRleFswXSAtIDIpICE9PSAnXFxcXCcpKSAmJiBwb3NJbmRleE9yaWdJbmRleFswXSA8IHJlZ2V4Lmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHRtcFN0ciArPSBjaGFyQXQ7XG4gICAgICAgICAgICAgICAgc291cmNlWzBdICs9IGNoYXJBdDtcbiAgICAgICAgICAgICAgICBwb3NJbmRleE9yaWdJbmRleFswXSsrO1xuICAgICAgICAgICAgICAgIGNoYXJBdCA9IHJlZ2V4LmNoYXJBdChwb3NJbmRleE9yaWdJbmRleFswXSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0bXBTdHIgKz0gY2hhckF0O1xuICAgICAgICAgICAgc291cmNlWzBdICs9IGNoYXJBdDtcbiAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICB9XG4gICAgICAgIGlmIChjaGFyQXQgPT09ICd8Jykge1xuICAgICAgICAgICAgLy9maW5hbGl6ZSBwZW5kaW5nIHRtcCBncm91cCBzdHJpbmcgaWYgYW55XG4gICAgICAgICAgICAvLzIwMTcwMzI3IC0gdGhpcyBpcyBub3QgbmVjZXNzYXJ5XG4gICAgICAgICAgICAvLyBpZiAodG1wU3RyICYmIGdyb3VwU3RydWN0dXJlWzNdLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgIC8vICAgICAvL2NvbXBsZXRlIGdyb3VwaW5nOiBwdXQgdHJhaWxpbmcgYW5kIHBlbmRpbmcgY2hhcmFjdGVycyBzZXF1ZW5jZXMgaW50byBncm91cHNcbiAgICAgICAgICAgIC8vICAgICBwb3NJbmRleE9yaWdJbmRleFsxXSsrO1xuICAgICAgICAgICAgLy8gICAgIHRtcFN0ciA9ICcoJyArIHRtcFN0ciArICcpJztcbiAgICAgICAgICAgIC8vICAgICBncm91cFN0cnVjdHVyZVszXS5wdXNoKFtwb3NJbmRleE9yaWdJbmRleFsxXSwgLCB0bXBTdHIsIFtdXSk7XG4gICAgICAgICAgICAvLyB9XG4gICAgICAgICAgICBncm91cFN0cnVjdHVyZVsyXSArPSB0bXBTdHIgKyAnfCc7XG4gICAgICAgICAgICB0bXBTdHIgPSAnJztcbiAgICAgICAgICAgIHNvdXJjZVswXSArPSAnfCc7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoY2hhckF0ID09PSAnKScpIHtcbiAgICAgICAgICAgIC8vaGFuZGxlIGdyb3VwIGVuZGluZ1xuICAgICAgICAgICAgLy8yMDE3MDMyNyAtIG5vdCByZXF1aXJlZCB0byBncm91cCBoZXJlIGJlY2F1c2UgaXQgaXMgYWxyZWFkeSBjb250YWluZWQgaW4gYSBwYXJlbnQgZ3JvdXBcbiAgICAgICAgICAgIC8vIGlmICh0bXBTdHIgJiYgZ3JvdXBTdHJ1Y3R1cmVbM10ubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgLy8gICAgIC8vY29tcGxldGUgZ3JvdXBpbmc6IHB1dCB0cmFpbGluZyBhbmQgcGVuZGluZyBjaGFyYWN0ZXJzIHNlcXVlbmNlcyBpbnRvIGdyb3Vwc1xuICAgICAgICAgICAgLy8gICAgIHBvc0luZGV4T3JpZ0luZGV4WzFdKys7XG4gICAgICAgICAgICAvLyAgICAgdG1wU3RyID0gJygnICsgdG1wU3RyICsgJyknO1xuICAgICAgICAgICAgLy8gICAgIGdyb3VwU3RydWN0dXJlWzNdLnB1c2goW3Bvc0luZGV4T3JpZ0luZGV4WzFdLCAsIHRtcFN0ciwgW11dKTtcbiAgICAgICAgICAgIC8vIH1cbiAgICAgICAgICAgIGdyb3VwU3RydWN0dXJlWzJdICs9IHRtcFN0ciArICcpJztcbiAgICAgICAgICAgIHNvdXJjZVswXSArPSAnKSc7XG4gICAgICAgICAgICByZXR1cm4gZ3JvdXBTdHJ1Y3R1cmU7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNoYXJBdCA9PT0gJygnKSB7XG4gICAgICAgICAgICAvL2hhbmRsZSBncm91cCBzdGFydFxuICAgICAgICAgICAgaWYgKHRtcFN0cikge1xuICAgICAgICAgICAgICAgIC8vY29tcGxldGUgZ3JvdXBpbmc6IHB1dCB0cmFpbGluZyBhbmQgcGVuZGluZyBjaGFyYWN0ZXJzIHNlcXVlbmNlcyBpbnRvIG5vbiByZW1lbWJlcmluZyBncm91cHNcbiAgICAgICAgICAgICAgICBwb3NJbmRleE9yaWdJbmRleFsxXSsrO1xuICAgICAgICAgICAgICAgIHRtcFN0ciA9ICcoJyArIHRtcFN0ciArICcpJztc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bmRleE9yaWdJbmRleFswXTtcbiAgICAgICAgICAgIHZhciBxdWFudGlmaWVyU3RyaW5nID0gJyc7XG4gICAgICAgICAgICBpZiAocG9zSW5kZXhPcmlnSW5kZXhbMF0gKyAxIDwgcmVnZXgubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgLy9wYXJzZSBxdWFudGlmaWVyXG4gICAgICAgICAgICAgICAgY2hhckF0ID0gcmVnZXguY2hhckF0KHBvc0luZGV4T3JpZ0luZGV4WzBdICsgMSk7XG4gICAgICAgICAgICAgICAgaWYgKGNoYXJBdCA9PT0gJyonKSB7XG4gICAgICAgICAgICAgICAgICAgIHBvc0luZGV4T3JpZ0luZGV4WzBdKys7XG4gICAgICAgICAgICAgICAgICAgIHF1YW50aWZpZXJTdHJpbmcgPSAnKic7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaGFyQXQgPT09ICcrJykge1xuICAgICAgICAgICAgICAgICAgICBwb3NJbmRleE9yaWdJbmRleFswXSsrO1xuICAgICAgICAgICAgICAgICAgICBxdWFudGlmaWVyU3RyaW5nID0gJysnO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hhckF0ID09PSAnPycpIHtcbiAgICAgICAgICAgICAgICAgICAgcG9zSW5kZXhPcmlnSW5kZXhbMF0rKztcbiAgICAgICAgICAgICAgICAgICAgcXVhbnRpZmllclN0cmluZyA9ICc/JztcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoYXJBdCA9PT0gJ3snKSB7XG4gICAgICAgICAgICAgICAgICAgIHBvc0luZGV4T3JpZ0luZGV4WzBdKys7XG4gICAgICAgICAgICAgICAgICAgIHF1YW50aWZpZXJTdHJpbmcgPSAneyc7XG4gICAgICAgICAgICAgICAgICAgIHBvc0luZGV4T3JpZ0luZGV4WzBdKys7XG4gICAgICAgICAgICAgICAgICAgIGNoYXJBdCA9IHJlZ2V4LmNoYXJBdChwb3NJbmRleE9yaWdJbmRleFswXSk7XG4gICAgICAgICAgICAgICAgICAgIHdoaWxlIChjaGFyQXQgPj0gJzAnICYmIGNoYXJBdCA8PSAnOScgJiYgcG9zSW5kZXhPcmlnSW5kZXhbMF0gPCByZWdleC5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHF1YW50aWZpZXJTdHJpbmcgKz0gY2hhckF0O1xuICAgICAgICAgICAgICAgICAgICAgICAgcG9zSW5kZXhPcmlnSW5kZXhbMF0rKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJBdCA9IHJlZ2V4LmNoYXJBdChwb3NJbmRleE9yaWdJbmRleFswXSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKGNoYXJBdCA9PT0gJ30nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBxdWFudGlmaWVyU3RyaW5nICs9ICd9JztcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaGFyQXQgPT09ICcsJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1YW50aWZpZXJTdHJpbmcgKz0gJywnO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvc0luZGV4T3JpZ0luZGV4WzBdKys7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhckF0ID0gcmVnZXguY2hhckF0KHBvc0luZGV4T3JpZ0luZGV4WzBdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoY2hhckF0ID49ICcwJyAmJiBjaGFyQXQgPD0gJzknICYmIHBvc0luZGV4T3JpZ0luZGV4WzBdIDwgcmVnZXgubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1YW50aWZpZXJTdHJpbmcgKz0gY2hhckF0O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3NJbmRleE9yaWdJbmRleFswXSsrO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyQXQgPSByZWdleC5jaGFyQXQocG9zSW5kZXhPcmlnSW5kZXhbMF0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hhckF0ID09PSAnfScpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVhbnRpZmllclN0cmluZyArPSAnfSc7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVhbnRpZmllclN0cmluZyA9ICcnO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVhbnRpZmllclN0cmluZyA9ICcnO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChxdWFudGlmaWVyU3RyaW5nLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmVnZXhHcm91cFN0cnVjdHVyZUludGVybmFsWzJdICs9IHF1YW50aWZpZXJTdHJpbmc7XG4gICAgICAgICAgICAgICAgICAgIHNvdXJjZVswXSArPSBxdWFudGlmaWVyU3RyaW5nO1xuICAgICAgICAgICAgICAgICAgICBpZiAocmVnZXguY2hhckF0KHBvc0luZGV4T3JpZ0luZGV4WzBdICsgMSkgPT09ICc/Jykge1xuICAgICAgICAgICAgICAgICAgICAgICAgcG9zSW5kZXhPcmlnSW5kZXhbMF0rKztcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2V4R3JvdXBTdHJ1Y3R1cmVJbnRlcm5hbFsyXSArPSAnPyc7XG4gICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2VbMF0gKz0gJz8nO1xuICAgICAgICAgICAgICAgICAgICB9X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jcmVhdGU7XG5pZiAoY3IpIHtcbiAgICB2YXIgY2FsbGVyQ2FjaGUgPSBjcihudWxsKTtcbiAgICB2YXIgZ2V0dGVyQ2FjaGUgPSBjcihudWxsKTtcbiAgICBjYWxsZXJDYWNoZVtcIiBzaXplXCJdID0gZ2V0dGVyQ2FjaGVbXCIgc2l6ZVwiXSA9IDA7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24oUHJvbWlzZSkge1xudmFyIHV0aWwgPSBfZGVyZXFfKFwiLi91dGlsXCIpO1xudmFyIGNhbkV2YWx1YXRlID0gdXRpbC5jYW5FdmFsdWF0ZTtcbnZhciBpc0lkZW50aWZpZXIgPSB1dGlsLmlzSWRlbnRpZmllcjtcblxudmFyIGdldE1ldGhvZENhbGxlcjtcbnZhciBnZXRHZXR0ZXI7XG5pZiAoIXRydWUpIHtcbnZhciBtYWtlTWV0aG9kQ2FsbGVyID0gZnVuY3Rpb24gKG1ldGhvZE5hbWUpIHtcbiAgICByZXR1cm4gbmV3IEZ1bmN0aW9uKFwiZW5zdXJlTWV0aG9kXCIsIFwiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgcmV0dXJuIGZ1bmN0aW9uKG9iaikgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICd1c2Ugc3RyaWN0JyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIHZhciBsZW4gPSB0aGlzLmxlbmd0aDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIGVuc3VyZU1ldGhvZChvYmosICdtZXRob2ROYW1lJyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIHN3aXRjaChsZW4pIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBjYXNlIDE6IHJldHVybiBvYmoubWV0aG9kTmFtZSh0aGlzWzBdKTsgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBjYXNlIDI6IHJldHVybiBvYmoubWV0aG9kTmFtZSh0aGlzWzBdLCB0aGlzWzFdKTsgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBjYXNlIDM6IHJldHVybiBvYmoubWV0aG9kTmFtZSh0aGlzWzBdLCB0aGlzWzFdLCB0aGlzWzJdKTsgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBjYXNlIDA6IHJldHVybiBvYmoubWV0aG9kTmFtZSgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBkZWZhdWx0OiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9iai5tZXRob2ROYW1lLmFwcGx5KG9iaiwgdGhpcyk7ICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgfTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgXCIucmVwbGFjZSgvbWV0aG9kTmFtZS9nLCBtZXRob2ROYW1lKSkoZW5zdXJlTWV0aG9kKTtcbn07XG5cbnZhciBtYWtlR2V0dGVyID0gZnVuY3Rpb24gKHByb3BlcnR5TmFtZSkge1xuICAgIHJldHVybiBuZXcgRnVuY3Rpb24oXCJvYmpcIiwgXCIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICAndXNlIHN0cmljdCc7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICByZXR1cm4gb2JqLnByb3BlcnR5TmFtZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICBcIi5yZXBsYWNlKFwicHJvcGVydHlOYW1lXCIsIHByb3BlcnR5TmFtZSkpO1xufTtcblxudmFyIGdldENvbXBpbGVkID0gZnVuY3Rpb24obmFtZSwgY29tcGlsZXIsIGNhY2hlKSB7XG4gICAgdmFyIHJldCA9IGNhY2hlW25hbWVdO1xuICAgIGlmICh0eXBlb2YgcmV0ICE9PSBcImZ1bmN0aW9uXCIpIHtcbiAgICAgICAgaWYgKCFpc0lkZW50aWZpZXIobmFtZSkpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHJldCA9IGNvbXBpbGVyKG5hbWUpO1xuICAgICAgICBjYWNoZVtuYW1lXSA9IHJldDtcbiAgICAgICAgY2FjaGVbXCIgc2l6ZVwiXSsrO1xuICAgICAgICBpZiAoY2FjaGVbXCIgc2l6ZVwiXSA+IDUxMikge1xuICAgICAgICAgICAgdmFyIGtleXMgPSBPYmplY3Qua2V5cyhjYWNoZSk7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IDI1NjsgKytpKSBkZWxldGUgY2FjaGVba2V5c1tpXV07XG4gICAgICAgICAgICBjYWNoZVtcIiBzaXplXCJdID0ga2V5cy5sZW5ndGggLSAyNTY7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIHJldDtcbn07XG5cbmdldE1ldGhvZENhbGxlciA9IGZ1bmN0aW9uKG5hbWUpIHtcbiAgICByZXR1cm4gZ2V0Q29tcGlsZWQobmFtZSwgbWFrZU1ldGhvZENhbGxlciwgY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UcmFjZSwgcHJvbWlzZSkge1xuICAgIHJldHVybiB3YXJuKG1lc3NhZ2UsIHNob3VsZFVzZU93blRyYWNlLCBwcm9taXNlIHx8IHRoaXMpO1xufTtcblxuUHJvbWlzZS5vblBvc3NpYmx5VW5oYW5kbGVkUmVqZWN0aW9uID0gZnVuY3Rpb24gKGZuKSB7XG4gICAgdmFyIGRvbWFpbiA9IGdldERvbWFpbigpO1xuICAgIHBvc3NpYmx5VW5oYW5kbGVkUmVqZWN0aW9uID1cbiAgICAgICAgdHlwZW9mIGZuID09PSBcImZ1bmN0aW9uXCIgPyAoZG9tYWluID09PSBudWxsID9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm4gOiB1dGlsLmRvbWFpbkJpbmQoZG9tYWluLCBmbikpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbn07XG5cblByb21pc2Uub25VbmhhbmRsZWRSZWplY3Rpb25IYW5kbGVkID0gZnVuY3Rpb24gKGZuKSB7XG4gICAgdmFyIGRvbWFpbiA9IGdldERvbWFpbigpO1xuICAgIHVuaGFuZGxlZFJlamVjdGlvbkhhbmRsZWQgPVxuICAgICAgICB0eXBlb2YgZm4gPT09IFwiZnVuY3Rpb25cIiA/IChkb21haW4gPT09IG51bGwgP1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbiA6IHV0aWwuZG9tYWluQmluZChkb21haW4sIGZuKSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xufTtcblxudmFyIGRpc2FibGVMb25nU3RhY2tUcmFjZXMgPSBmdW5jdGlvbigpIHt9O1xuUHJvbWlzZS5sb25nU3RhY2tUcmFjZXMgPSBmdW5jdGlvbiAoKSB7XG4gICAgaWYgKGFzeW5jLmhhdmVJdGVtc1F1ZXVlZCgpICYmICFjb25maWcubG9uZ1N0YWNrVHJhY2VzKSB7XG4g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XZlbnQgPSAoZnVuY3Rpb24oKSB7XG4gICAgdHJ5IHtcbiAgICAgICAgaWYgKHR5cGVvZiBDdXN0b21FdmVudCA9PT0gXCJmdW5jdGlvblwiKSB7XG4gICAgICAgICAgICB2YXIgZXZlbnQgPSBuZXcgQ3VzdG9tRXZlbnQoXCJDdXN0b21FdmVudFwiKTtcbiAgICAgICAgICAgIHV0aWwuZ2xvYmFsLmRpc3BhdGNoRXZlbnQoZXZlbnQpO1xuICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uKG5hbWUsIGV2ZW50KSB7XG4gICAgICAgICAgICAgICAgdmFyIGV2ZW50RGF0YSA9IHtcbiAgICAgICAgICAgICAgICAgICAgZGV0YWlsOiBldmVudCxcbiAgICAgICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogdHJ1ZVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgZXM1LmRlZmluZVByb3BlcnR5KFxuICAgICAgICAgICAgICAgICAgICBldmVudERhdGEsIFwicHJvbWlzZVwiLCB7dmFsdWU6IGV2ZW50LnByb21pc2V9KTtcbiAgICAgICAgICAgICAgICBlczUuZGVmaW5lUHJvcGVydHkoZXZlbnREYXRhLCBcInJlYXNvblwiLCB7dmFsdWU6IGV2ZW50LnJlYXNvbn0pO1xuICAgICAgICAgICAgICAgIHZhciBkb21FdmVudCA9IG5ldyBDdXN0b21FdmVudChuYW1lLnRvTG93ZXJDYXNlKCksIGV2ZW50RGF0YSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuICF1dGlsLmdsb2JhbC5kaXNwYXRjaEV2ZW50KGRvbUV2ZW50KTtcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIEV2ZW50ID09PSBcImZ1bmN0aW9uXCIpIHtcbiAgICAgICAgICAgIHZhciBldmVudCA9IG5ldyBFdmVudChcIkN1c3RvbUV2ZW50XCIpO1xuICAgICAgICAgICAgdXRpbC5nbG9iYWwuZGlzcGF0Y2hFdmVudChldmVudCk7XG4gICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24obmFtZSwgZXZlbnQpIHtcbiAgICAgICAgICAgICAgICB2YXIgZG9tRXZlbnQgPSBuZXcgRXZlbnQobmFtZS50b0xvd2VyQ2FzZSgpLCB7XG4gICAgICAgICAgICAgICAgICAgIGNhbmNlbGFibGU6IHRydWVcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBkb21FdmVudC5kZXRhaWwgPSBldmVudDtcbiAgICAgICAgICAgICAgICBlczUuZGVmaW5lUHJvcGVydHkoZG9tRXZlbnQsIFwicHJvbWlzZVwiLCB7dmFsdWU6IGV2ZW50LnByb21pc2V9KTtcbiAgICAgICAgICAgICAgICBlczUuZGVmaW5lUHJvcGVydHkoZG9tRXZlbnQsIFwicmVhc29uXCIsIHt2YWx1ZTogZXZlbnQucmVhc29ufSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuICF1dGlsLmdsb2JhbC5kaXNwYXRjaEV2ZW50KGRvbUV2ZW50KTtcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB2YXIgZXZlbnQgPSBkb2N1bWVudC5jcmVhdGVFdmVudChcIkN1c3RvbUV2ZW50XCIpO1xuICAgICAgICAgICAgZXZlbnQuaW5pdEN1c3RvbUV2ZW50KFwidGVzdGluZ3RoZWV2ZW50XCIsIGZhbHNlLCB0cnVlLCB7fSk7XG4gICAgICAgICAgICB1dGlsLmdsb2JhbC5kaXNwYXRjaEV2ZW50KGV2ZW50KTtcbiAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbihuYW1lLCBldmVudCkge1xuICAgICAgICAgICAgICAgIHZhciBkb21FdmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KFwiQ3VzdG9tRXZlbnRcIik7XG4gICAgICAgICAgICAgICAgZG9tRXZlbnQuaW5pdEN1c3RvbUV2ZW50KG5hbWUudG9Mb3dlckNhc2UoKSwgZ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m47XG5cbiAgICAgICAgaWYgKG5hbWUpIG5hbWUgPSBuYW1lICsgXCIgXCI7XG4gICAgICAgIHZhciBoYW5kbGVyTGluZSA9IFwiXCI7XG4gICAgICAgIHZhciBjcmVhdG9yTGluZSA9IFwiXCI7XG4gICAgICAgIGlmIChwcm9taXNlQ3JlYXRlZC5fdHJhY2UpIHtcbiAgICAgICAgICAgIHZhciB0cmFjZUxpbmVzID0gcHJvbWlzZUNyZWF0ZWQuX3RyYWNlLnN0YWNrLnNwbGl0KFwiXFxuXCIpO1xuICAgICAgICAgICAgdmFyIHN0YWNrID0gY2xlYW5TdGFjayh0cmFjZUxpbmVzKTtcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSBzdGFjay5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICAgICAgICAgIHZhciBsaW5lID0gc3RhY2tbaV07XG4gICAgICAgICAgICAgICAgaWYgKCFub2RlRnJhbWVQYXR0ZXJuLnRlc3QobGluZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGxpbmVNYXRjaGVzID0gbGluZS5tYXRjaChwYXJzZUxpbmVQYXR0ZXJuKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxpbmVNYXRjaGVzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVyTGluZSAgPSBcImF0IFwiICsgbGluZU1hdGNoZXNbMV0gK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiOlwiICsgbGluZU1hdGNoZXNbMl0gKyBcIjpcIiArIGxpbmVNYXRjaGVzWzNdICsgXCIgXCI7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoc3RhY2subGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIHZhciBmaXJzdFVzZXJMaW5lID0gc3RhY2tbMF07XG4gICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCB0cmFjZUxpbmVzLmxlbmd0aDsgKytpKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgaWYgKHRyYWNlTGluZXNbaV0gPT09IGZpcnN0VXNlckxpbmUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0b3JMaW5lID0gXCJcXG5cIiArIHRyYWNlTGluZXNbaSAtIDFdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB2YXIgbXNnID0gXCJhIHByb21pc2Ugd2FzIGNyZWF0ZWQgaW4gYSBcIiArIG5hbWUgK1xuICAgICAgICAgICAgXCJoYW5kbGVyIFwiICsgaGFuZGxlckxpbmUgKyBcImJ1dCB3YXMgbm90IHJldHVybmVkIGZyb20gaXQsIFwiICtcbiAgICAgICAgICAgIFwic2VlIGh0dHA6Ly9nb28uZ2wvclJxTVV3XCIgK1xuICAgICAgICAgICAgY3JlYXRvckxpbmU7XG4gICAgICAgIHByb21pc2UuX3dhcm4obXNnLCB0cnVlLCBwcm9taXNlQ3JlYXRlZCk7XG4gICAgfVxufVxuXG5mdW5jdGlvbiBkZXByZWNhdGVkKG5hbWUsIHJlcGxhY2VtZW50KSB7XG4gICAgdmFyIG1lc3NhZ2UgPSBuYW1lICtcbiAgICAgICAgXCIgaXMgZGVwcmVjYXRlZCBhbmQgd2lsbCBiZSByZW1vdmVkIGluIGEgZnV0dXJlIHZlcnNpb24uXCI7XG4gICAgaWYgKHJlcGxhY2VtZW50KSBtZXNzYWdlICs9IFwiIFVzZSBcIiArIHJlcGxhY2VtZW50ICsgXCIgaW5zdGVhZC5cIjtcbiAgICByZXR1cm4gd2Fyb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ICAgICAgY29tbW9uUm9vdE1lZXRQb2ludCA9IGo7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKHZhciBqID0gY29tbW9uUm9vdE1lZXRQb2ludDsgaiA+PSAwOyAtLWopIHtcbiAgICAgICAgICAgIHZhciBsaW5lID0gcHJldltqXTtcbiAgICAgICAgICAgIGlmIChjdXJyZW50W2N1cnJlbnRMYXN0SW5kZXhdID09PSBsaW5lKSB7XG4gICAgICAgICAgICAgICAgY3VycmVudC5wb3AoKTtcbiAgICAgICAgICAgICAgICBjdXJyZW50TGFzdEluZGV4LS07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGN1cnJlbnQgPSBwcmV2O1xuICAgIH1cbn1cblxuZnVuY3Rpb24gY2xlYW5TdGFjayhzdGFjaykge1xuICAgIHZhciByZXQgPSBbXTtcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IHN0YWNrLmxlbmd0aDsgKytpKSB7XG4gICAgICAgIHZhciBsaW5lID0gc3RhY2tbaV07XG4gICAgICAgIHZhciBpc1RyYWNlTGluZSA9IFwiICAgIChObyBzdGFjayB0cmFjZSlcIiA9PT0gbGluZSB8fFxuICAgICAgICAgICAgc3RhY2tGcmFtZVBhdHRlcm4udGVzdChsaW5lKTtcbiAgICAgICAgdmFyIGlzSW50ZXJuYWxGcmFtZSA9IGlzVHJhY2VMaW5lICYmIHNob3VsZElnbm9yZShsaW5lKTtcbiAgICAgICAgaWYgKGlzVHJhY2VMaW5lICYmICFpc0ludGVybmFsRnJhbWUpIHtcbiAgICAgICAgICAgIGlmIChpbmRlbnRTdGFja0ZyYW1lcyAmJiBsaW5lLmNoYXJBdCgwKSAhPT0gXCIgXCIpIHtcbiAgICAgICAgICAgICAgICBsaW5lID0gXCIgICAgXCIgKyBsaW5lO1xuICA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pZiAobmFtZSA9PT0gXCJyZWplY3Rpb25IYW5kbGVkXCIpIHtcbiAgICAgICAgICAgICAgICBsb2NhbEhhbmRsZXIocHJvbWlzZSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxvY2FsSGFuZGxlcihyZWFzb24sIHByb21pc2UpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSBjYXRjaCAoZSkge1xuICAgICAgICBhc3luYy50aHJvd0xhdGVyKGUpO1xuICAgIH1cblxuICAgIGlmIChuYW1lID09PSBcInVuaGFuZGxlZFJlamVjdGlvblwiKSB7XG4gICAgICAgIGlmICghYWN0aXZlRmlyZUV2ZW50KG5hbWUsIHJlYXNvbiwgcHJvbWlzZSkgJiYgIWxvY2FsRXZlbnRGaXJlZCkge1xuICAgICAgICAgICAgZm9ybWF0QW5kTG9nRXJyb3IocmVhc29uLCBcIlVuaGFuZGxlZCByZWplY3Rpb24gXCIpO1xuICAgICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgICAgYWN0aXZlRmlyZUV2ZW50KG5hbWUsIHByb21pc2UpO1xuICAgIH1cbn1cblxuZnVuY3Rpb24gZm9ybWF0Tm9uRXJyb3Iob2JqKSB7XG4gICAgdmFyIHN0cjtcbiAgICBpZiAodHlwZW9mIG9iaiA9PT0gXCJmdW5jdGlvblwiKSB7XG4gICAgICAgIHN0ciA9IFwiW2Z1bmN0aW9uIFwiICtcbiAgICAgICAgICAgIChvYmoubmFtZSB8fCBcImFub255bW91c1wiKSArXG4gICAgICAgICAgICBcIl1cIjtcbiAgICB9IGVsc2Uge1xuICAgICAgICBzdHIgPSBvYmogJiYgdHlwZW9mIG9iai50b1N0cmluZyA9PT0gXCJmdW5jdGlvblwiXG4gICAgICAgICAgICA/IG9iai50b1N0cmluZygpIDogdXRpbC50b1N0cmluZyhvYmopO1xuICAgICAgICB2YXIgcnVzZWxlc3NUb1N0cmluZyA9IC9cXFtvYmplY3QgW2EtekEtWjAtO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pXS5zdGFjaztcbiAgICAgICAgdmFyIGluZGV4ID0gc3RhY2tUb0luZGV4W2N1cnJlbnRTdGFja107XG4gICAgICAgIGlmIChpbmRleCAhPT0gdW5kZWZpbmVkICYmIGluZGV4ICE9PSBpKSB7XG4gICAgICAgICAgICBpZiAoaW5kZXggPiAwKSB7XG4gICAgICAgICAgICAgICAgbm9kZXNbaW5kZXggLSAxXS5fcGFyZW50ID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIG5vZGVzW2luZGV4IC0gMV0uX2xlbmd0aCA9IDE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBub2Rlc1tpXS5fcGFyZW50ID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgbm9kZXNbaV0uX2xlbmd0aCA9IDE7XG4gICAgICAgICAgICB2YXIgY3ljbGVFZGdlTm9kZSA9IGkgPiAwID8gbm9kZXNbaSAtIDFdIDogdGhpcztcblxuICAgICAgICAgICAgaWYgKGluZGV4IDwgbGVuZ3RoIC0gMSkge1xuICAgICAgICAgICAgICAgIGN5Y2xlRWRnZU5vZGUuX3BhcmVudCA9IG5vZGVzW2luZGV4ICsgMV07XG4gICAgICAgICAgICAgICAgY3ljbGVFZGdlTm9kZS5fcGFyZW50LnVuY3ljbGUoKTtcbiAgICAgICAgICAgICAgICBjeWNsZUVkZ2VOb2RlLl9sZW5ndGggPVxuICAgICAgICAgICAgICAgICAgICBjeWNsZUVkZ2VOb2RlLl9wYXJlbnQuX2xlbmd0aCArIDE7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGN5Y2xlRWRnZU5vZGUuX3BhcmVudCA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICBjeWNsZUVkZ2VOb2RlLl9sZW5ndGggPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFyIGN1cnJlbnRDaGlsZExlbmd0aCA9IGN5Y2xlRWRnZU5vZGUuX2xlbmd0aCArIDE7XG4gICAgICA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V0UHJvdG90eXBlT2Y6IE9iamVjdC5nZXRQcm90b3R5cGVPZixcbiAgICAgICAgaXNBcnJheTogQXJyYXkuaXNBcnJheSxcbiAgICAgICAgaXNFUzU6IGlzRVM1LFxuICAgICAgICBwcm9wZXJ0eUlzV3JpdGFibGU6IGZ1bmN0aW9uKG9iaiwgcHJvcCkge1xuICAgICAgICAgICAgdmFyIGRlc2NyaXB0b3IgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKG9iaiwgcHJvcCk7XG4gICAgICAgICAgICByZXR1cm4gISEoIWRlc2NyaXB0b3IgfHwgZGVzY3JpcHRvci53cml0YWJsZSB8fCBkZXNjcmlwdG9yLnNldCk7XG4gICAgICAgIH1cbiAgICB9O1xufSBlbHNlIHtcbiAgICB2YXIgaGFzID0ge30uaGFzT3duUHJvcGVydHk7XG4gICAgdmFyIHN0ciA9IHt9LnRvU3RyaW5nO1xuICAgIHZhciBwcm90byA9IHt9LmNvbnN0cnVjdG9yLnByb3RvdHlwZTtcblxuICAgIHZhciBPYmplY3RLZXlzID0gZnVuY3Rpb24gKG8pIHtcbiAgICAgICAgdmFyIHJldCA9IFtdO1xuICAgICAgICBmb3IgKHZhciBrZXkgaW4gbykge1xuICAgICAgICAgICAgaWYgKGhhcy5jYWxsKG8sIGtleSkpIHtcbiAgICAgICAgICAgICAgICByZXQucHVzaChrZXkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXQ7XG4gICAgfTtcblxuICAgIHZhciBPYmplY3RHZXREZXNjcmlwdG9yID0gZnVuY3Rpb24obywga2V5KSB7XG4gICAgICAgIHJldHVybiB7dmFsdWU6IG9ba2V5XX07XG4gICAgfTtcblxuICAgIHZhciBPYmplY3REZWZpbmVQcm9wZXJ0eSA9IGZ1bmN0aW9uIChvLCBrZXksIGRlc2MpIHtcbiAgICAgICAgb1trZXldID0gZGVzYy52YWx1ZTtcbiAgICAgICAgcmV0dXJuIG87XG4gICAgfTtcblxuICAgIHZhciBPYmplY3RGcmVlemUgPSBmdW5jdGlvbiAob2JqKSB7XG4gICAgICAgIHJldHVybiBvYmo7XG4gICAgfTtcblxuICAgIHZhciBPYmplY3RHZXRQcm90b3R5cGVPZiA9IGZ1bmN0aW9uIChvYmopIHtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHJldHVybiBPYmplY3Qob2JqKS5jb25zdHJ1Y3Rvci5wcm90b3R5cGU7XG4gICAgICAgIH1cbiAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIHJldHVybiBwcm90bztcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICB2YXIgQXJyYXlJc0FycmF5ID0gZnVuY3Rpb24gKG9iaikge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmV0dXJuIHN0ci5jYWxsKG9iaikgPT09IFwiW29iamVjdCBBcnJheV1cIjtcbiAgICAgICAgfVxuICAgICAgICBjYXRjaChlKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgbW9kdWxlLmV4cG9ydHMgPSB7XG4gICAgICAgIGlzQXJyYXk6IEFycmF5SXNBcnJheSxcbiAgICAgICAga2V5czogT2JqZWN0S2V5cyxcbiAgICAgICAgbmFtZXM6IE9iamVjdEtleXMsXG4gICAgICAgIGRlZmluZVByb3BlcnR5OiBPYmplY3REZWZpbmVQcm9wZXJ0eSxcbiAgICAgICAgZ2V0RGVzY3JpcHRvcjogT2JqZWN0R2V0RGVzY3JpcHRvcixcbiAgICAgICAgZnJlZXplOiBPYmplY3RGcmVlemUsXG4gICAgICAgIGdldFByb3RvdHlwZU9mOiBPYmplY3RHZXRQcm90b3R5cGVPZixcbiAgICAgICAgaXNFUzU6IGlzRVM1LFxuICAgICAgICBwcm9wZXJ0eUlzV3JpdGFibGU6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cb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zQ2FuY2VsbGVkKCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZWFzb24gPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBDYW5jZWxsYXRpb25FcnJvcihcImxhdGUgY2FuY2VsbGF0aW9uIG9ic2VydmVyXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcHJvbWlzZS5fYXR0YWNoRXh0cmFUcmFjZShyZWFzb24pO1xuICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JPYmouZSA9IHJlYXNvbjtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlcnJvck9iajtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtYXliZVByb21pc2UuaXNQZW5kaW5nKCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1heWJlUHJvbWlzZS5fYXR0YWNoQ2FuY2VsbGF0aW9uQ2FsbGJhY2soXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEZpbmFsbHlIYW5kbGVyQ2FuY2VsUmVhY3Rpb24odGhpcykpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBtYXliZVByb21pc2UuX3RoZW4oXG4gICAgICAgICAgICAgICAgICAgIHN1Y2NlZWQsIGZhaWwsIHVuZGVmaW5lZCwgdGhpcywgdW5kZWZpbmVkKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGlmIChwcm9taXNlLmlzUmVqZWN0ZWQoKSkge1xuICAgICAgICBjaGVja0NhbmNlbCh0aGlzKTtcbiAgICAgICAgZXJyb3JPYmouZSA9IHJlYXNvbk9yVmFsdWU7XG4gICAgICAgIHJldHVybiBlcnJvck9iajtcbiAgICB9IGVsc2Uge1xuICAgICAgICBjaGVja0NhbmNlbCh0aGlzKTtcbiAgICAgICAgcmV0dXJuIHJlYXNvbk9yVmFsdWU7XG4gICAgf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AgICAgIHJldHVybiB0aGlzLl9wYXNzVGhyb3VnaChoYW5kbGVyT3JQcmVkaWNhdGUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWxseUhhbmRsZXIpO1xuICAgIH0gZWxzZSB7XG4gICAgICAgICB2YXIgY2F0Y2hJbnN0YW5jZXMgPSBuZXcgQXJyYXkobGVuIC0gMSksXG4gICAgICAgICAgICBqID0gMCwgaTtcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbiAtIDE7ICsraSkge1xuICAgICAgICAgICAgdmFyIGl0ZW0gPSBhcmd1bWVudHNbaV07XG4gICAgICAgICAgICBpZiAodXRpbC5pc09iamVjdChpdGVtKSkge1xuICAgICAgICAgICAgICAgIGNhdGNoSW5zdGFuY2VzW2orK10gPSBpdGVtO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QobmV3IFR5cGVFcnJvcihcbiAgICAgICAgICAgICAgICAgICAgXCJ0YXBDYXRjaCBzdGF0ZW1lbnQgcHJlZGljYXRlOiBcIlxuICAgICAgICAgICAgICAgICAgICArIFwiZXhwZWN0aW5nIGFuIG9iamVjdCBidXQgZ290IFwiICsgdXRpbC5jbGFzc1N0cmluZyhpdGVtKVxuICAgICAgICAgICAgICAgICkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGNhdGNoSW5zdGFuY2VzLmxlbmd0aCA9IGo7XG4gICAgICAgIHZhciBoYW5kbGVyID0gYXJndW1lbnRzW2ldO1xuICAgICAgICByZXR1cm4gdGhpcy5fcGFzc1Rocm91Z2goY2F0Y2hGaWx0ZXIoY2F0Y2hJbnN0YW5jZXMsIGhhbmRsZXIsIHRoaXMpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuZGVmaW5lZCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsbHlIYW5kbGVyKTtcbiAgICB9XG5cbn07XG5cbnJldHVybiBQYXNzVGhyb3VnaEhhbmRsZXJDb250ZXh0O1xufTtcblxufSx7XCIuL2NhdGNoX2ZpbHRlclwiOjcsXCIuL3V0aWxcIjozNn1dLDE2OltmdW5jdGlvbihfZGVyZXFfLG1vZHVsZSxleHBvcnRzKXtcblwidXNlIHN0cmljdFwiO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbihQcm9taXNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICBhcGlSZWplY3Rpb24sXG4gICAgICAgICAgICAgICAgICAgICAgICAgIElOVEVSTkFMLFxuICAgICAgICAgICAgICAgICAgICAgICAgICB0cnlDb252ZXJ0VG9Qcm9taXNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICBQcm94eWFibGUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgIGRlYnVnKSB7XG52YXIgZXJyb3JzID0gX2RlcmVxXyhcIi4vZXJyb3JzXCIpO1xudmFyIFR5cGVFcnJvciA9IGVycm9ycy5UeXBlRXJyb3I7XG52YXIgdXRpbCA9IF9kZXJlcV8oXCIuL3V0aWxcIik7XG52YXIgZXJyb3JPYmogPSB1dGlsLmVycm9yT2JqO1xudmFyIHRyeUNhdGNoID0gdXRpbC50cnlDYXRjaDtcbnZhciB5aWVsZEhhbmRsZXJzID0gW107XG5cbmZ1bmN0aW9uIHByb21pc2VGcm9tWWllbGRIYW5kbGVyKHZhbHVlLCB5aWVsZEhhbmRsZXJzLCB0cmFjZVBhcmVudCkge1xuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgeWllbGRIYW5kbGVycy5sZW5ndGg7ICsraSkge1xuICAgICAgICB0cmFjZVBhcmVudC5fcHVzaENvbnRleHQoKTtcbiAgICAgICA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5fcmVqZWN0Q2FsbGJhY2socmVzdWx0LmUsIGZhbHNlKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHZhciB2YWx1ZSA9IHJlc3VsdC52YWx1ZTtcbiAgICBpZiAocmVzdWx0LmRvbmUgPT09IHRydWUpIHtcbiAgICAgICAgdGhpcy5fY2xlYW51cCgpO1xuICAgICAgICBpZiAodGhpcy5fY2FuY2VsbGF0aW9uUGhhc2UpIHtcbiAgICAgICAgICAgIHJldHVybiBwcm9taXNlLmNhbmNlbCgpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHByb21pc2UuX3Jlc29sdmVDYWxsYmFjayh2YWx1ZSk7XG4gICAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgICB2YXIgbWF5YmVQcm9taXNlID0gdHJ5Q29udmVydFRvUHJvbWlzZSh2YWx1ZSwgdGhpcy5fcHJvbWlzZSk7XG4gICAgICAgIGlmICghKG1heWJlUHJvbWlzZSBpbnN0YW5jZW9mIFByb21pc2UpKSB7XG4gICAgICAgICAgICBtYXliZVByb21pc2UgPVxuICAgICAgICAgICAgICAgIHByb21pc2VGcm9tWWllbGRIYW5kbGVyKG1heWJlUHJvbWlzZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl95aWVsZEhhbmRsZXJzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3Byb21pc2UpO1xuICAgICAgICAgICAgaWYgKG1heWJlUHJvbWlzZSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHRoaXMuX3Byb21pc2VSZWplY3RlZChcbiAgICAgICAgICAgICAgICAgICAgbmV3IFR5cGVFcnJvcihcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiQSB2YWx1ZSAlcyB3YXMgeWllbGRlZCB0aGF0IGNvdWxkIG5vdCBiZSB0cmVhdGVkIGFzIGEgcHJvbWlzZVxcdTAwMGFcXHUwMDBhICAgIFNlZSBodHRwOi8vZ29vLmdsL01xckZtWFxcdTAwMGFcXHUwMDBhXCIucmVwbGFjZShcIiVzXCIsIFN0cmluZyh2YWx1ZSkpICtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiRnJvbSBjb3JvdXRpbmU6XFx1MDAwYVwiICtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3N0YWNrLnNwbGl0KFwiXFxuXCIpLnNsaWNlKDEsIC03KS5qb2luKFwiXFxuXCIpXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBtYXliZVByb21pc2UgPSBtYXliZVByb21pc2UuX3RhcmdldCgpO1xuICAgICAgICB2YXIgYml0RmllbGQgPSBtYXliZVByb21pc2UuX2JpdEZpZWxkO1xuICAgICAgICA7XG4gICAgICAgIGlmICgoKGJpdEZpZWxkICYgNTAzOTcxODQpID09PSAwKSkge1xuICAgICAgICAgICAgdGhpcy5feWllbGRlZFByb21pc2UgPSBtYXliZVByb21pc2U7XG4gICAgICAgICAgICBtYXliZVByb21pc2UuX3Byb3h5KHRoaXMsIG51bGwpO1xuICAgICAgICB9IGVsc2UgaWYgKCgoYml0RmllbGQgJiAzMzU1NDQzMikgIT09IDApKSB7XG4gICAgICAgICAgICBQcm9taXNlLl9hc3luYy5pbnZva2UoXG4gICAgICAgICAgICAgICAgdGhpcy5fcHJvbWlzZUZ1bGZpbGxlZCwgdGhpcywgbWF5YmVQcm9taXNlLl92YWx1ZSgpXG4gICAgICAgICAgICApO1xuICAgICAgICB9IGVsc2UgaWYgKCgoYml0RmllbGQgJiAxNjc3NzIxNikgIT09IDApKSB7XG4gICAgICAgICAgICBQcm9taXNlLl9hc3luYy5pbnZva2UoXG4gICAgICAgICAgICAgICAgdGhpcy5fcHJvbWlzZVJlamVjdGVkLCB0aGlzLCBtYXliZVByb21p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b21pc2VBcnJheSwgdHJ5Q29udmVydFRvUHJvbWlzZSwgSU5URVJOQUwsIGFzeW5jLFxuICAgICAgICAgZ2V0RG9tYWluKSB7XG52YXIgdXRpbCA9IF9kZXJlcV8oXCIuL3V0aWxcIik7XG52YXIgY2FuRXZhbHVhdGUgPSB1dGlsLmNhbkV2YWx1YXRlO1xudmFyIHRyeUNhdGNoID0gdXRpbC50cnlDYXRjaDtcbnZhciBlcnJvck9iaiA9IHV0aWwuZXJyb3JPYmo7XG52YXIgcmVqZWN0O1xuXG5pZiAoIXRydWUpIHtcbmlmIChjYW5FdmFsdWF0ZSkge1xuICAgIHZhciB0aGVuQ2FsbGJhY2sgPSBmdW5jdGlvbihpKSB7XG4gICAgICAgIHJldHVybiBuZXcgRnVuY3Rpb24oXCJ2YWx1ZVwiLCBcImhvbGRlclwiLCBcIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIGhvbGRlci5wSW5kZXggPSB2YWx1ZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIGhvbGRlci5jaGVja0Z1bGZpbGxtZW50KHRoaXMpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIFwiLnJlcGxhY2UoL0luZGV4L2csIGkpKTtcbiAgICB9O1xuXG4gICAgdmFyIHByb21pc2VTZXR0ZXIgPSBmdW5jdGlvbihpKSB7XG4gICAgICAgIHJldHVybiBuZXcgRnVuY3Rpb24oXCJwcm9taXNlXCIsIFwiaG9sZGVyXCIsIFwiICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIGhvbGRlci5wSW5kZXggPSBwcm9taXNlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIFwiLnJlcGxhY2UoL0luZGV4L2csIGkpKTtcbiAgICB9O1xuXG4gICAgdmFyIGdlbmVyYXRlSG9sZGVyQ2xhc3MgPSBmdW5jdGlvbih0b3RhbCkge1xuICAgICAgICB2YXIgcHJvcHMgPSBuZXcgQXJyYXkodG90YWwpO1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHByb3BzLmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICBwcm9wc1tpXSA9IFwidGhpcy5wXCIgKyAoaSsxKTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgYXNzaWdubWVudCA9IHByb3BzLmpvaW4oXCIgPSBcIikgKyBcIiA9IG51bGw7XCI7XG4gICAgICAgIHZhciBjYW5jZWxsYXRpb25Db2RlPSBcInZhciBwcm9taXNlO1xcblwiICsgcHJvcHMubWFwKGZ1bmN0aW9uKHByb3ApIHtcbiAgICAgICAgICAgIHJldHVybiBcIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcblxcXG4gICAgICAgICAgICAgICAgcHJvbWlzZSA9IFwiICsgcHJvcCArIFwiOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBpZiAocHJvbWlzZSBpbnN0YW5jZW9mIFByb21pc2UpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgcHJvbWlzZS5jYW5jZWwoKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIFwiO1xuICAgICAgICB9KS5qb2luKFwiXFxuXCIpO1xuICAgICAgICB2YXIgcGFzc2VkQXJndW1lbnRzID0gcHJvcHMuam9pbihcIiwgXCIpO1xuICAgICAgICB2YXIgbmFtZSA9IFwiSG9sZGVyJFwiICsgdG90YWw7XG5cblxuICAgICAgICB2YXIgY29kZSA9IFwicmV0dXJuIGZ1bmN0aW9uKHRyeUNhdGNoLCBlcnJvck9iaiwgUHJvbWlzZSwgYXN5bmMpIHsgICAgXFxuXFxcbiAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIGZ1bmN0aW9uIFtUaGVOYW1lXShmbikgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBbVGhlUHJvcGVydGllc10gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICB0aGlzLmZuID0gZm47ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICB0aGlzLmFzeW5jTmVlZGVkID0gdHJ1ZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICB0aGlzLm5vdyA9IDA7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIFtUaGVOYW1lXS5wcm90b3R5cGUuX2NhbGxGdW5jdGlvbiA9IGZ1bmN0aW9uKHByb21pc2UpIHsgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBwcm9taXNlLl9wdXNoQ29udGV4dCgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICB2YXIgcmV0ID0gdHJ5Q2F0Y2godGhpcy5mbikoW1RoZVBhc3NlZEFyZ3VtZW50c10pOyAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBwcm9taXNlLl9wb3BDb250ZXh0KCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBpZiAocmV0ID09PSBlcnJvck9iaikgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgcHJvbWlzZS5fcmVqZWN0Q2FsbGJhY2socmV0LmUsIGZhbHNlKTsgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICB9IGVsc2UgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgcHJvbWlzZS5fcmVzb2x2ZUNhbGxiYWNrKHJldCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIH07ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIFtUaGVOYW1lXS5wcm90b3R5cGUuY2hlY2tGdWxmaWxsbWVudCA9IGZ1bmN0aW9uKHByb21pc2UpIHsgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICB2YXIgbm93ID0gKyt0aGlzLm5vdzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBpZiAobm93ID09PSBbVGhlVG90YWxdKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuYXN5bmNOZWVkZWQpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGFzeW5jLmludm9rZSh0aGlzLl9jYWxsRnVuY3Rpb24sIHRoaXMsIHByb21pc2UpOyAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2NhbGxGdW5jdGlvbihwcm9taXNlKTsgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIH07ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIFtUaGVOYW1lXS5wcm90b3R5cGUuX3Jlc3VsdENhbmNlbGxlZCA9IGZ1bmN0aW9uKCkgeyAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBbQ2FuY2VsbGF0aW9uQ29kZV0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIH07ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIHJldHVybiBbVGhlTmFtZV07ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgfSh0cnlDYXRjaCwgZXJyb3JPYmosIFByb21pc2UsIGFzeW5jKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgXCI7XG5cbiAgICAgICAgY29kZSA9IGNvZGUucmVwbGFjZSgvXFxbVGhlTmFtZVxcXS9nLCBuYW1lKVxuICAgICAgICAgICAgLnJlcGxhY2UoL1xcW1RoZVRvdGFsXFxdL2csIHRvdGFsKVxuICAgICAgICAgICAgLnJlcGxhY2UoL1xcW1RoZVBhc3NlZEFyZ3VtZW50c1xcXS9nLCBwYXNzZWRBcmd1bWVudHMpXG4gICAgICAgICAgICAucmVwbGFjZSgvXFxbVGhlUHJvcGVydGllc1xcXS9nLCBhc3NpZ25tZW50KVxuICAgICAgICAgICAgLnJlcGxhY2UoL1xcW0NhbmNlbGxhdGlvbkNvZGVcXF0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IG5ldyBQcm9taXNlKElOVEVSTkFMKTtcbiAgICAgICAgICAgICAgICByZXQuX2NhcHR1cmVTdGFja1RyYWNlKCk7XG4gICAgICAgICAgICAgICAgdmFyIEhvbGRlckNsYXNzID0gaG9sZGVyQ2xhc3Nlc1tsYXN0IC0gMV07XG4gICAgICAgICAgICAgICAgdmFyIGhvbGRlciA9IG5ldyBIb2xkZXJDbGFzcyhmbik7XG4gICAgICAgICAgICAgICAgdmFyIGNhbGxiYWNrcyA9IHRoZW5DYWxsYmFja3M7XG5cbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxhc3Q7ICsraSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgbWF5YmVQcm9taXNlID0gdHJ5Q29udmVydFRvUHJvbWlzZShhcmd1bWVudHNbaV0sIHJldCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChtYXliZVByb21pc2UgaW5zdGFuY2VvZiBQcm9taXNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtYXliZVByb21pc2UgPSBtYXliZVByb21pc2UuX3RhcmdldCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGJpdEZpZWxkID0gbWF5YmVQcm9taXNlLl9iaXRGaWVsZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoKGJpdEZpZWxkICYgNTAzOTcxODQpID09PSAwKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heWJlUHJvbWlzZS5fdGhlbihjYWxsYmFja3NbaV0sIHJlamVjdCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5kZWZpbmVkLCByZXQsIGhvbGRlcik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvbWlzZVNldHRlcnNbaV0obWF5YmVQcm9taXNlLCBob2xkZXIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhvbGRlci5hc3luY05lZWRlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgoKGJpdEZpZWxkICYgMzM1NTQ0MzIpICE9PSAwKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrc1tpXS5jYWxsKHJldCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXliZVByb21pc2UuX3ZhbHVlKCksIGhvbGRlcik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCgoYml0RmllbGQgJiAxNjc3NzIxNikgIT09IDApKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0Ll9yZWplY3QobWF5YmVQcm9taXNlLl9yZWFzb24oKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldC5fY2FuY2VsKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFja3NbaV0uY2FsbChyZXQsIG1heWJlUHJvbWlzZSwgaG9sZGVyKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmICghcmV0Ll9pc0ZhdGVTZWFsZWQoKSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoaG9sZGVyLmFzeW5jTmVlZGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgZG9tYWluID0gZ2V0RG9tYWluKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9tYWluICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaG9sZGVyLmZuID0gdXRpbC5kb21haW5CaW5kKGRvbWFpbiwgaG9sZGVyLmZuKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXQuX3NldEFzeW5jR3VhcmFudGVlZCgpO1xuICAgICAgICAgICAgICAgICAgICByZXQuX3NldE9uQ2FuY2VsKGhvbGRlcik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiByZXQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgdmFyIGFyZ3MgPSBbXS5zbGljZS5jYWxsKGFyZ3VtZW50cyk7O1xuICAgIGlmIChmbikgYXJncy5wb3AoKTtcbiAgICB2YXIgcmV0ID0gbmV3IFByb21pc2VBcnJheShhcmdzKS5wcm9taXNlKCk7XG4gICAgcmV0dXJuIGZuICE9PSB1bmRlZmluZWQgPyByZXQuc3ByZWFkKGZuKSA6IHJldDtcbn07XG5cbn07XG5cbn0se1wiLi91dGlsXCI6MzZ9XSwxODpbZnVuY3Rpb24oX2RlcmVxXyxtb2R1bGUsZXhwb3J0cyl7XG5cInVzZSBzdHJpY3RcIjtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24oUHJvbWlzZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgUHJvbWlzZUFycmF5LFxuICAgICAgICAgICAgICAgICAgICAgICAgICBhcGlSZWplY3Rpb24sXG4gICAgICAgICAgICAgICAgICAgICAgICAgIHRyeUNvbnZlcnRUb1Byb21pc2UsXG4gICAgICAgICAgICAgICAgICAgICAgICAgIElOVEVSTkFMLFxuICAgICAgICAgICAgICAgICAgICAgICAgICBkZWJ1Zykge1xudmFyIGdldERvbWFpbiA9IFByb21pc2UuX2dldERvbWFpbjtcbnZhciB1dGlsID0gX2RlcmVxXyhcIi4vdXRpbFwiKTtcbnZhciB0cnlDYXRjaCA9IHV0aWwudHJ5Q2F0Y2g7XG52YXIgZXJyb3JPYmogPSB1dGlsLmVycm9yT2JqO1xudmFyIGFzeW5jID0gUHJvbWlzZS5fYXN5bmM7XG5cbmZ1bm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21pc2UuX3BvcENvbnRleHQoKTtcbiAgICAgICAgZGVidWcuY2hlY2tGb3Jnb3R0ZW5SZXR1cm5zKFxuICAgICAgICAgICAgcmV0LFxuICAgICAgICAgICAgcHJvbWlzZUNyZWF0ZWQsXG4gICAgICAgICAgICBwcmVzZXJ2ZWRWYWx1ZXMgIT09IG51bGwgPyBcIlByb21pc2UuZmlsdGVyXCIgOiBcIlByb21pc2UubWFwXCIsXG4gICAgICAgICAgICBwcm9taXNlXG4gICAgICAgICk7XG4gICAgICAgIGlmIChyZXQgPT09IGVycm9yT2JqKSB7XG4gICAgICAgICAgICB0aGlzLl9yZWplY3QocmV0LmUpO1xuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgbWF5YmVQcm9taXNlID0gdHJ5Q29udmVydFRvUHJvbWlzZShyZXQsIHRoaXMuX3Byb21pc2UpO1xuICAgICAgICBpZiAobWF5YmVQcm9taXNlIGluc3RhbmNlb2YgUHJvbWlzZSkge1xuICAgICAgICAgICAgbWF5YmVQcm9taXNlID0gbWF5YmVQcm9taXNlLl90YXJnZXQoKTtcbiAgICAgICAgICAgIHZhciBiaXRGaWVsZCA9IG1heWJlUHJvbWlzZS5fYml0RmllbGQ7XG4gICAgICAgICAgICA7XG4gICAgICAgICAgICBpZiAoKChiaXRGaWVsZCAmIDUwMzk3MTg0KSA9PT0gMCkpIHtcbiAgICAgICAgICAgICAgICBpZiAobGltaXQgPj0gMSkgdGhpcy5faW5GbGlnaHQrKztcbiAgICAgICAgICAgICAgICB2YWx1ZXNbaW5kZXhdID0gbWF5YmVQcm9taXNlO1xuICAgICAgICAgICAgICAgIG1heWJlUHJvbWlzZS5fcHJveHkodGhpcywgKGluZGV4ICsgMSkgKiAtMSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfSBlbHNlIGlmICgoKGJpdEZpZWxkICYgMzM1NTQ0MzIpICE9PSAwKSkge1xuICA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T09IG51bGwpIHtcbiAgICAgICAgICAgIGlmICh0eXBlb2Ygb3B0aW9ucy5jb25jdXJyZW5jeSAhPT0gXCJudW1iZXJcIikge1xuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChcbiAgICAgICAgICAgICAgICAgICAgbmV3IFR5cGVFcnJvcihcIidjb25jdXJyZW5jeScgbXVzdCBiZSBhIG51bWJlciBidXQgaXQgaXMgXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXRpbC5jbGFzc1N0cmluZyhvcHRpb25zLmNvbmN1cnJlbmN5KSkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbGltaXQgPSBvcHRpb25zLmNvbmN1cnJlbmN5O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KG5ldyBUeXBlRXJyb3IoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJvcHRpb25zIGFyZ3VtZW50IG11c3QgYmUgYW4gb2JqZWN0IGJ1dCBpdCBpcyBcIiArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV0aWwuY2xhc3NTdHJpbmcob3B0aW9ucykpKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBsaW1pdCA9IHR5cGVvZiBsaW1pdCA9PT0gXCJudW1iZXJcIiAmJlxuICAgICAgICBpc0Zpbml0ZShsaW1pdCkgJiYgbGltaXQgPj0gMSA/IGxpbWl0IDogMDtcbiAgICByZXR1cm4gbmV3IE1hcHBpbmdQcm9taXNlQXJyYXkocHJvbWlzZXMsIGZuLCBsaW1pdCwgX2ZpbHRlcikucHJvbWlzZSgpO1xufVxuXG5Qcm9taXNlLnByb3RvdHlwZS5tYXAgPSBmdW5jdGlvbiAoZm4sIG9wdGlvbnMpIHtcbiAgICByZXR1cm4gbWFwKHRoaXMsIGZuLCBvcHRpb25zLCBudWxsKTtcbn07XG5cblByb21pc2UubWFwID0gZnVuY3R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nVuY3Rpb24gd3JhcEFzT3BlcmF0aW9uYWxFcnJvcihvYmopIHtcbiAgICB2YXIgcmV0O1xuICAgIGlmIChpc1VudHlwZWRFcnJvcihvYmopKSB7XG4gICAgICAgIHJldCA9IG5ldyBPcGVyYXRpb25hbEVycm9yKG9iaik7XG4gICAgICAgIHJldC5uYW1lID0gb2JqLm5hbWU7XG4gICAgICAgIHJldC5tZXNzYWdlID0gb2JqLm1lc3NhZ2U7XG4gICAgICAgIHJldC5zdGFjayA9IG9iai5zdGFjaztcbiAgICAgICAgdmFyIGtleXMgPSBlczUua2V5cyhvYmopO1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGtleXMubGVuZ3RoOyArK2kpIHtcbiAgICAgICAgICAgIHZhciBrZXkgPSBrZXlzW2ldO1xuICAgICAgICAgICAgaWYgKCFyRXJyb3JLZXkudGVzdChrZXkpKSB7XG4gICAgICAgICAgICAgICAgcmV0W2tleV0gPSBvYmpba2V5XTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmV0O1xuICAgIH1cbiAgICB1dGlsLm1hcmtBc09yaWdpbmF0aW5nRnJvbVJlamVjdGlvbihvYmopO1xuICAgIHJldHVybiBvYmo7XG59XG5cbmZ1bmN0aW9uIG5vZGViYWNrRm9yUHJvbWlzZShwcm9taXNlLCBtdWx0aUFyZ3MpIHtcbiAgICByZXR1cm4gZnVuY3Rpb24oZXJyLCB2YWx1ZSkge1xuICAgICAgICBpZiAocHJvbWlzZSA9PT0gbnVsbCkgcmV0dXJuO1xuICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgICB2YXIgd3JhcHBlZCA9IHdyYXBBc09wZXJhdGlvbmFsRXJyb3IobWF5YmVXcmFwQXNFcnJvcihlcnIpKTtcbiAgICAgICAgICAgIHByb21pc2UuX2F0dGFjaEV4dHJhVHJhY2Uod3JhcHBlZCk7XG4gICAgICAgICAgICBwcm9taXNlLl9yZWplY3Qod3JhcHBlZ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vbWlzZTtcbiAgICAgICAgdGhpcy5fcmVjZWl2ZXIwID0gcmVjZWl2ZXI7XG4gICAgICAgIGlmICh0eXBlb2YgZnVsZmlsbCA9PT0gXCJmdW5jdGlvblwiKSB7XG4gICAgICAgICAgICB0aGlzLl9mdWxmaWxsbWVudEhhbmRsZXIwID1cbiAgICAgICAgICAgICAgICBkb21haW4gPT09IG51bGwgPyBmdWxmaWxsIDogdXRpbC5kb21haW5CaW5kKGRvbWFpbiwgZnVsZmlsbCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHR5cGVvZiByZWplY3QgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgdGhpcy5fcmVqZWN0aW9uSGFuZGxlcjAgPVxuICAgICAgICAgICAgICAgIGRvbWFpbiA9PT0gbnVsbCA/IHJlamVjdCA6IHV0aWwuZG9tYWluQmluZChkb21haW4sIHJlamVjdCk7XG4gICAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgICB2YXIgYmFzZSA9IGluZGV4ICogNCAtIDQ7XG4gICAgICAgIHRoaXNbYmFzZSArIDJdID0gcHJvbWlzZTtcbiAgICAgICAgdGhpc1tiYXNlICsgM10gPSByZWNlaXZlcjtcbiAgICAgICAgaWYgKHR5cGVvZiBmdWxmaWxsID09PSBcImZ1bmN0aW9uXCIpIHtcbiAgICAgICAgICAgIHRoaXNbYmFzZSArIDBdID1cbiAgICAgICAgICAgICAgICBkb21haW4gPT09IG51bGwgPyBmdWxmaWxsIDogdXRpbC5kb21haW5CaW5kKGRvbWFpbiwgZnVsZmlsbCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHR5cGVvZiByZWplY3QgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgdGhpc1tiYXNlICsgMV0gPVxuICAgICAgICAgICAgICAgIGRvbWFpbiA9PT0gbnVsbCA/IHJlamVjdCA6IHV0aWwuZG9tYWluQmluZChkb21haW4sIHJlamVjdCk7XG4gICAgICAgIH1cbiAg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ZWxkICYgMTM0MjE3NzI4KSAhPT0gMCk7XG4gICAgaWYgKCgoYml0RmllbGQgJiA2NTUzNikgIT09IDApKSB7XG4gICAgICAgIGlmIChpc1Byb21pc2UpIHByb21pc2UuX2ludm9rZUludGVybmFsT25DYW5jZWwoKTtcblxuICAgICAgICBpZiAocmVjZWl2ZXIgaW5zdGFuY2VvZiBQYXNzVGhyb3VnaEhhbmRsZXJDb250ZXh0ICYmXG4gICAgICAgICAgICByZWNlaXZlci5pc0ZpbmFsbHlIYW5kbGVyKCkpIHtcbiAgICAgICAgICAgIHJlY2VpdmVyLmNhbmNlbFByb21pc2UgPSBwcm9taXNlO1xuICAgICAgICAgICAgaWYgKHRyeUNhdGNoKGhhbmRsZXIpLmNhbGwocmVjZWl2ZXIsIHZhbHVlKSA9PT0gZXJyb3JPYmopIHtcbiAgICAgICAgICAgICAgICBwcm9taXNlLl9yZWplY3QoZXJyb3JPYmouZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAoaGFuZGxlciA9PT0gcmVmbGVjdEhhbmRsZXIpIHtcbiAgICAgICAgICAgIHByb21pc2UuX2Z1bGZpbGwocmVmbGVjdEhhbmRsZXIuY2FsbChyZWNlaXZlcikpO1xuICAgICAgICB9IGVsc2UgaWYgKHJlY2VpdmVyIGluc3RhbmNlb2YgUHJveHlhYmxlKSB7XG4gICAgICAgICAgICByZWNlaXZlci5fcHJvbWlzZUNhbmNlbGxlZChwcm9taXNlKTtcbiAgICAgICAgfSBlbHNlIGlmIChpc1Byb21pc2UgfHwgcHJvbWlzZSBpbnN0YW5jZW9mIFByb21pc2VBcnJheSkge1xuICAgICAgICAgICAgcHJvbWlzZS5fY2FuY2VsKCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZWNlaXZlci5jYW5jZWwoKTtcbiAgICAgICAgfVxuICAgIH0gZWxzZSBpZiAodHlwZW9mIGhhbmRsZXIgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICA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VxXygnLi90aW1lcnMuanMnKShQcm9taXNlLCBJTlRFUk5BTCwgZGVidWcpO1xuX2RlcmVxXygnLi91c2luZy5qcycpKFByb21pc2UsIGFwaVJlamVjdGlvbiwgdHJ5Q29udmVydFRvUHJvbWlzZSwgY3JlYXRlQ29udGV4dCwgSU5URVJOQUwsIGRlYnVnKTtcbl9kZXJlcV8oJy4vYW55LmpzJykoUHJvbWlzZSk7XG5fZGVyZXFfKCcuL2VhY2guanMnKShQcm9taXNlLCBJTlRFUk5BTCk7XG5fZGVyZXFfKCcuL2ZpbHRlci5qcycpKFByb21pc2UsIElOVEVSTkFMKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICAgIHV0aWwudG9GYXN0UHJvcGVydGllcyhQcm9taXNlKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbiAgICB1dGlsLnRvRmFzdFByb3BlcnRpZXMoUHJvbWlzZS5wcm90b3R5cGUpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gICAgZnVuY3Rpb24gZmlsbFR5cGVzKHZhbHVlKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICAgICAgICB2YXIgcCA9IG5ldyBQcm9taXNlKElOVEVSTkFMKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbiAgICAgICAgcC5fZnVsZmlsbG1lbnRIYW5kbGVyMCA9IHZhbHVlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gICAgICAgIHAuX3JlamVjdGlvbkhhbmRsZXIwID0gdmFsdWU7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICAgICAgICBwLl9wcm9taXNlMCA9IHZhbHVlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbiAgICAgICAgcC5fcmVjZWl2ZXIwID0gdmFsdWU7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICAgIC8vIENvbXBsZXRlIHNsYWNrIHRyYWNraW5nLCBvcHQgb3V0IG9mIGZpZWxkLXR5cGUgdHJhY2tpbmcgYW5kICAgICAgICAgICBcbiAgICAvLyBzdGFiaWxpemUgbWFwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gICAgZmlsbFR5cGVzKHthOiAxfSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICAgIGZpbGxUeXBlcyh7YjogMn0pOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbiAgICBmaWxsVHlwZXMoe2M6IDN9KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gICAgZmlsbFR5cGVzKDEpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICAgIGZpbGxUeXBlcyhmdW5jdGlvbigpe30pOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbiAgICBmaWxsVHlwZXModW5kZWZpbmVkKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gICAgZmlsbFR5cGVzKGZhbHNlKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICAgIGZpbGxUeXBlcyhuZXcgUHJvbWlzZShJTlRFUk5BTCkpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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ByZXR1cm4gdGhpcy5fcHJvbWlzZTtcbn07XG5cblByb21pc2VBcnJheS5wcm90b3R5cGUuX2luaXQgPSBmdW5jdGlvbiBpbml0KF8sIHJlc29sdmVWYWx1ZUlmRW1wdHkpIHtcbiAgICB2YXIgdmFsdWVzID0gdHJ5Q29udmVydFRvUHJvbWlzZSh0aGlzLl92YWx1ZXMsIHRoaXMuX3Byb21pc2UpO1xuICAgIGlmICh2YWx1ZXMgaW5zdGFuY2VvZiBQcm9taXNlKSB7XG4gICAgICAgIHZhbHVlcyA9IHZhbHVlcy5fdGFyZ2V0KCk7XG4gICAgICAgIHZhciBiaXRGaWVsZCA9IHZhbHVlcy5fYml0RmllbGQ7XG4gICAgICAgIDtcbiAgICAgICAgdGhpcy5fdmFsdWVzID0gdmFsdWVzO1xuXG4gICAgICAgIGlmICgoKGJpdEZpZWxkICYgNTAzOTcxODQpID09PSAwKSkge1xuICAgICAgICAgICAgdGhpcy5fcHJvbWlzZS5fc2V0QXN5bmNHdWFyYW50ZWVkKCk7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWVzLl90aGVuKFxuICAgICAgICAgICAgICAgIGluaXQsXG4gICAgICAgICAgICAgICAgdGhpcy5fcmVqZWN0LFxuICAgICAgICAgICAgICAgIHVuZGVmaW5lZCxcbiAgICAgICAgICAgICAgICB0aGlzLFxuICAgICAgICAgICAgICAgIHJlc29sdmVWYWx1ZUlmRW1wdHlcbiAgICAgICAgICAgKTtcbiAgICAgICAgfSBlbHNlIGlmICgoKGJpdEZpZWxkICYgMzM1NTQ0MzIpICE9PSAwKSkge1xuICAgICAgICAgICAgdmFsdWVzID0gdmFsdWVzLl92YWx1ZSgpO1xuICAgICAgICB9IGVsc2UgaWYgKCgoYml0RmllbGQgJiAxNjc3NzIxNikgIT09IDApKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5fcmVqZWN0KHZhbHVlcy5fcmVhc29uKCkpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgc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dCA9IHRoaXMuX3Byb21pc2U7XG4gICAgdmFyIGlzUmVzb2x2ZWQgPSBmYWxzZTtcbiAgICB2YXIgYml0RmllbGQgPSBudWxsO1xuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuOyArK2kpIHtcbiAgICAgICAgdmFyIG1heWJlUHJvbWlzZSA9IHRyeUNvbnZlcnRUb1Byb21pc2UodmFsdWVzW2ldLCByZXN1bHQpO1xuXG4gICAgICAgIGlmIChtYXliZVByb21pc2UgaW5zdGFuY2VvZiBQcm9taXNlKSB7XG4gICAgICAgICAgICBtYXliZVByb21pc2UgPSBtYXliZVByb21pc2UuX3RhcmdldCgpO1xuICAgICAgICAgICAgYml0RmllbGQgPSBtYXliZVByb21pc2UuX2JpdEZpZWxkO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgYml0RmllbGQgPSBudWxsO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzUmVzb2x2ZWQpIHtcbiAgICAgICAgICAgIGlmIChiaXRGaWVsZCAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG1heWJlUHJvbWlzZS5zdXBwcmVzc1VuaGFuZGxlZFJlamVjdGlvbnMoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChiaXRGaWVsZCAhPT0gbnVsbCkge1xuICAgICAgICAgICAgaWYgKCgoYml0RmllbGQgJiA1MDM5NzE4NCkgPT09IDApKSB7XG4gICAgICAgICAgICAgICAgbWF5YmVQcm9taXNlLl9wcm94eSh0aGlzLCBpKTtcbiAgICAgICAgICAgICAgICB0aGlzLl92YWx1ZXNbaV0gPSBtYXliZVByb21pc2U7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKCgoYml0RmllbGQgJiAzMzU1NDQzMikgIT09IDApKSB7XG4gICAgICAgICAgICAgICAgaXNSZXNvbHZlZCA9IHRoaXMuX3Byb21pc2VGdWxmaWxsZWQobWF5YmVQcm9taXNlLl92YWx1ZSgpLCBpKTt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2FzZUFyZ3VtZW50T3JkZXIobmV3UGFyYW1ldGVyQ291bnQpO1xuICAgIHZhciBzaG91bGRQcm94eVRoaXMgPSB0eXBlb2YgY2FsbGJhY2sgPT09IFwic3RyaW5nXCIgfHwgcmVjZWl2ZXIgPT09IFRISVM7XG5cbiAgICBmdW5jdGlvbiBnZW5lcmF0ZUNhbGxGb3JBcmd1bWVudENvdW50KGNvdW50KSB7XG4gICAgICAgIHZhciBhcmdzID0gYXJndW1lbnRTZXF1ZW5jZShjb3VudCkuam9pbihcIiwgXCIpO1xuICAgICAgICB2YXIgY29tbWEgPSBjb3VudCA+IDAgPyBcIiwgXCIgOiBcIlwiO1xuICAgICAgICB2YXIgcmV0O1xuICAgICAgICBpZiAoc2hvdWxkUHJveHlUaGlzKSB7XG4gICAgICAgICAgICByZXQgPSBcInJldCA9IGNhbGxiYWNrLmNhbGwodGhpcywge3thcmdzfX0sIG5vZGViYWNrKTsgYnJlYWs7XFxuXCI7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXQgPSByZWNlaXZlciA9PT0gdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgPyBcInJldCA9IGNhbGxiYWNrKHt7YXJnc319LCBub2RlYmFjayk7IGJyZWFrO1xcblwiXG4gICAgICAgICAgICAgICAgOiBcInJldCA9IGNhbGxiYWNrLmNhbGwocmVjZWl2ZXIsIHt7YXJnc319LCBub2RlYmFjayk7IGJyZWFrO1xcblwiO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXQucmVwbGFjZShcInt7YXJnc319XCIsIGFyZ3MpLnJlcGxhY2UoXCIsIFwiLCBjb21tYSk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gZ2VuZXJhdGVBcmd1bWVudFN3aXRjaENhc2UoKSB7XG4gICAgICAgIHZhciByZXQgPSBcIlwiO1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGFyZ3VtZW50T3JkZXIubGVuZ3RoOyArK2kpIHtcbiAgICAgICAgICAgIHJldCArPSBcImNhc2UgXCIgKyBhcmd1bWVudE9yZGVyW2ldICtcIjpcIiArXG4gICAgICAgICAgICAgICAgZ2VuZXJhdGVDYWxsRm9yQXJndW1lbnRDb3VudChhcmd1bWVudE9yZGVyW2ldKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldCArPSBcIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICBkZWZhdWx0OiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICAgICAgdmFyIGFyZ3MgPSBuZXcgQXJyYXkobGVuICsgMSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICAgICAgdmFyIGkgPSAwOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47ICsraSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICAgICAgICAgYXJnc1tpXSA9IGFyZ3VtZW50c1tpXTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICAgICAgYXJnc1tpXSA9IG5vZGViYWNrOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICAgICAgW0NvZGVGb3JDYWxsXSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICAgICAgYnJlYWs7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG5cXFxuICAgICAgICBcIi5yZXBsYWNlKFwiW0NvZGVGb3JDYWxsXVwiLCAoc2hvdWxkUHJveHlUaGlzXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gXCJyZXQgPSBjYWxsYmFjay5hcHBseSh0aGlzLCBhcmdzKTtcXG5cIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IFwicmV0ID0gY2FsbGJhY2suYXBwbHkocmVjZWl2ZXIsIGFyZ3MpO1xcblwiKSk7XG4gICAgICAgIHJldHVybiByZXQ7XG4gICAgfVxuXG4gICAgdmFyIGdldEZ1bmN0aW9uQ29kZSA9IHR5cGVvZiBjYWxsYmFjayA9PT0gXCJzdHJpbmdcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IChcInRoaXMgIT0gbnVsbCA/IHRoaXNbJ1wiK2NhbGxiYWNrK1wiJ10gOiBmblwiKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IFwiZm5cIjtcbiAgICB2YXIgYm9keSA9IFwiJ3VzZSBzdHJpY3QnOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcblxcXG4gICAgICAgIHZhciByZXQgPSBmdW5jdGlvbiAoUGFyYW1ldGVycykgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcblxcXG4gICAgICAgICAgICAndXNlIHN0cmljdCc7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcblxcXG4gICAgICAgICAgICB2YXIgbGVuID0gYXJndW1lbnRzLmxlbmd0aDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcblxcXG4gICAgICAgICAgICB2YXIgcHJvbWlzZSA9IG5ldyBQcm9taXNlKElOVEVSTkFMKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcblxcXG4gICAgICAgICAgICBwcm9taXNlLl9jYXB0dXJlU3RhY2tUcmFjZSgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcblxcXG4gICAgICAgICAgICB2YXIgbm9kZWJhY2sgPSBub2RlYmFja0ZvclByb21pc2UocHJvbWlzZSwgXCIgKyBtdWx0aUFyZ3MgKyBcIik7ICAgXFxuXFxcbiAgICAgICAgICAgIHZhciByZXQ7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIHZhciBjYWxsYmFjayA9IHRyeUNhdGNoKFtHZXRGdW5jdGlvbkNvZGVdKTsgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIHN3aXRjaChsZW4pIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBbQ29kZUZvclN3aXRjaENhc2VdICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIGlmIChyZXQgPT09IGVycm9yT2JqKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgICAgICBwcm9taXNlLl9yZWplY3RDYWxsYmFjayhtYXliZVdyYXBBc0Vycm9yKHJldC5lKSwgdHJ1ZSwgdHJ1ZSk7XFxuXFxcbiAgICAgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgICAgIGlmICghcHJvbWlzZS5faXNGYXRlU2VhbGVkKCkpIHByb21pc2UuX3NldEFzeW5jR3VhcmFudGVlZCgpOyAgICAgXFxuXFxcbiAgICAgICAgICAgIHJldHVybiBwcm9taXNlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgfTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgbm90RW51bWVyYWJsZVByb3AocmV0LCAnX19pc1Byb21pc2lmaWVkX18nLCB0cnVlKTsgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICAgICAgcmV0dXJuIHJldDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuXFxcbiAgICBcIi5yZXBsYWNlKFwiW0NvZGVGb3JTd2l0Y2hDYXNlXVwiLCBnZW5lcmF0ZUFyZ3VtZW50U3dpdGNoQ2FzZSgpKVxuICAgICAgICAucmVwbGFjZShcIltHZXRGdW5jdGlvbkNvZGVdXCIsIGdldEZ1bmN0aW9uQ29kZSk7XG4gICAgYm9keSA9IGJvZHkucmVwbGFjZShcIlBhcmFtZXRlcnNcIiwgcGFyYW1ldGVyRGVjbGFyYXRpb24obmV3UGFyYW1ldGVyQ291bnQpKTtcbiAgICByZXR1cm4gbmV3IEZ1bmN0aW9uKFwiUHJvbWlzZVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJmblwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJyZWNlaXZlclwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJ3aXRoQXBwZW5kZWRcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIFwibWF5YmVXcmFwQXNFcnJvclwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJub2RlYmFja0ZvclByb21pc2VcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidHJ5Q2F0Y2hcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiZXJyb3JPYmpcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIFwibm90RW51bWVyYWJsZVByb3BcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiSU5URVJOQUxcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHkpKFxuICAgICAgICAgICAgICAgICAgICBQcm9taXNlLFxuICAgICAgICAgICAgICAgICAgICBmbixcbiAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZXIsXG4gICAgICAgICAgICAgICAgICAgIHdpdGhBcHBlbmRlZCxcbiAgICAgICAgICAgICAgICAgICAgbWF5YmVXcmFwQXNFcnJvcixcbiAgICAgICAgICAgICAgICAgICAgbm9kZWJhY2tGb3JQcm9taXNlLFxuICAgICAgICAgICAgICAgICAgICB1dGlsLnRyeUNhdGNoLFxuICAgICAgICAgICAgICAgICAgICB1dGlsLmVycm9yT2JqLFxuICAgICAgICAgICAgICAgICAgICB1dGlsLm5vdEVudW1lcmFibGVQcm9wLFxuICAgICAgICAgICAgICAgICAgICBJTlRFUk5BTCk7XG59O1xufVxuXG5mdW5jdGlvbiBtYWtlTm9kZVByb21pc2lmaWVkQ2xvc3VyZShjYWxsYmFjaywgcmVjZWl2ZXIsIF8sIGZuLCBfXywgbXVsdGlBcmdzKSB7XG4gICAgdmFyIGRlZmF1bHRUaGlzID0gKGZ1bmN0aW9uKCkge3JldHVybiB0aGlzO30pKCk7XG4gICAgdmFyIG1ldGhvZCA9IGNhbGxiYWNrO1xuICAgIGlmICh0eXBlb2YgbWV0aG9kID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgIGNhbGxiYWNrID0gZm47XG4gICAgfVxuICAgIGZ1bmN0aW9uIHByb21pc2lmaWVkKCkge1xuICAgICAgICB2YXIgX3JlY2VpdmVyID0gcmVjZWl2ZXI7XG4gICAgICAgIGlmIChyZWNlaXZlciA9PT0gVEhJUykgX3JlY2VpdmVyID0gdGhpcztcbiAgICAgICAgdmFyIHByb21pc2UgPSBuZXcgUHJvbWlz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JlZ2V4KHN1ZmZpeCkgKyBcIiRcIik7XG4gICAgdmFyIG1ldGhvZHMgPVxuICAgICAgICBwcm9taXNpZmlhYmxlTWV0aG9kcyhvYmosIHN1ZmZpeCwgc3VmZml4UmVnZXhwLCBmaWx0ZXIpO1xuXG4gICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IG1ldGhvZHMubGVuZ3RoOyBpIDwgbGVuOyBpKz0gMikge1xuICAgICAgICB2YXIga2V5ID0gbWV0aG9kc1tpXTtcbiAgICAgICAgdmFyIGZuID0gbWV0aG9kc1tpKzFdO1xuICAgICAgICB2YXIgcHJvbWlzaWZpZWRLZXkgPSBrZXkgKyBzdWZmaXg7XG4gICAgICAgIGlmIChwcm9taXNpZmllciA9PT0gbWFrZU5vZGVQcm9taXNpZmllZCkge1xuICAgICAgICAgICAgb2JqW3Byb21pc2lmaWVkS2V5XSA9XG4gICAgICAgICAgICAgICAgbWFrZU5vZGVQcm9taXNpZmllZChrZXksIFRISVMsIGtleSwgZm4sIHN1ZmZpeCwgbXVsdGlBcmdzKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHZhciBwcm9taXNpZmllZCA9IHByb21pc2lmaWVyKGZuLCBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbWFrZU5vZGVQcm9taXNpZmllZChrZXksIFRISVMsIGtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbiwgc3VmZml4LCBtdWx0aUFyZ3MpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB1dGlsLm5vdEVudW1lcmFibGVQcm9wKHByb21pc2lmaWVkLCBcIl9faXNQcm9taXNpZmllZF9fXCIsIHRydWUpO1xuICAgICAgICAgICAgb2JqW3Byb21pc2lmaWVkS2V5XSA9IHByb21pc2lmaWVkO1xuICAgICAgICB9XG4gICAgfVxuICAgIHV0aWwudG9GYXN0UHJvcGVydGllcyhvYmopO1xuICAgIHJldHV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AgICAgICAgdmFyIGtleXMgPSBlczUua2V5cyhvYmopO1xuICAgICAgICB2YXIgbGVuID0ga2V5cy5sZW5ndGg7XG4gICAgICAgIGVudHJpZXMgPSBuZXcgQXJyYXkobGVuICogMik7XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuOyArK2kpIHtcbiAgICAgICAgICAgIHZhciBrZXkgPSBrZXlzW2ldO1xuICAgICAgICAgICAgZW50cmllc1tpXSA9IG9ialtrZXldO1xuICAgICAgICAgICAgZW50cmllc1tpICsgbGVuXSA9IGtleTtcbiAgICAgICAgfVxuICAgIH1cbiAgICB0aGlzLmNvbnN0cnVjdG9yJChlbnRyaWVzKTtcbiAgICB0aGlzLl9pc01hcCA9IGlzTWFwO1xuICAgIHRoaXMuX2luaXQkKHVuZGVmaW5lZCwgaXNNYXAgPyAtNiA6IC0zKTtcbn1cbnV0aWwuaW5oZXJpdHMoUHJvcGVydGllc1Byb21pc2VBcnJheSwgUHJvbWlzZUFycmF5KTtcblxuUHJvcGVydGllc1Byb21pc2VBcnJheS5wcm90b3R5cGUuX2luaXQgPSBmdW5jdGlvbiAoKSB7fTtcblxuUHJvcGVydGllc1Byb21pc2VBcnJheS5wcm90b3R5cGUuX3Byb21pc2VGdWxmaWxsZWQgPSBmdW5jdGlvbiAodmFsdWUsIGluZGV4KSB7XG4gICAgdGhpcy5fdmFsdWVzW2luZGV4XSA9IHZhbHVlO1xuICAgIHZhciB0b3RhbFJlc29sdmVkID0gKyt0aGlzLl90b3RhbFJlc29sdmVkO1xuICAgIGlmICh0b3RhbFJlc29sdmVkID49IHRoaXMuX2xlbmd0aCkge1xuICAgICAgICB2YXIgdmFsO1xuICAgICAgICBpZiAodGhpcy5faXNNYXApIHtcbiAgICAgICAgICAgIHZhbCA9IGVudHJpZXNUb01hcCh0aGlzLl92YWx1ZXMpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdmFsID0ge307XG4gICAgICAgICAgICB2YXIga2V5T2Zm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9IHJldC5fcmVqZWN0O1xuICAgIGZvciAodmFyIGkgPSAwLCBsZW4gPSBwcm9taXNlcy5sZW5ndGg7IGkgPCBsZW47ICsraSkge1xuICAgICAgICB2YXIgdmFsID0gcHJvbWlzZXNbaV07XG5cbiAgICAgICAgaWYgKHZhbCA9PT0gdW5kZWZpbmVkICYmICEoaSBpbiBwcm9taXNlcykpIHtcbiAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICB9XG5cbiAgICAgICAgUHJvbWlzZS5jYXN0KHZhbCkuX3RoZW4oZnVsZmlsbCwgcmVqZWN0LCB1bmRlZmluZWQsIHJldCwgbnVsbCk7XG4gICAgfVxuICAgIHJldHVybiByZXQ7XG59XG5cblByb21pc2UucmFjZSA9IGZ1bmN0aW9uIChwcm9taXNlcykge1xuICAgIHJldHVybiByYWNlKHByb21pc2VzLCB1bmRlZmluZWQpO1xufTtcblxuUHJvbWlzZS5wcm90b3R5cGUucmFjZSA9IGZ1bmN0aW9uICgpIHtcbiAgICByZXR1cm4gcmFjZSh0aGlzLCB1bmRlZmluZWQpO1xufTtcblxufTtcblxufSx7XCIuL3V0aWxcIjozNn1dLDI4OltmdW5jdGlvbihfZGVyZXFfLG1vZHVsZSxleHBvcnRzKXtcblwidXNlIHN0cmljdFwiO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbihQcm9taXNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICBQcm9taXNlQXJyYXksXG4gICAgICAgICAgICAgICAgICAgICAgICAgIGFwaVJlamVjdGlvbixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5Q29udmVydFRvUHJvbWlzZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJOQUwsXG4gICAgICAgICAgICAgICAgICAgICAgICAgIGRlYnVnKSB7XG52YXIgZ2V0RG9tYWluID0gUHJvbWlzZS5fZ2V0RG9tYWluO1xudmFyIHV0aWwgPSBfZGVyZXFfKFwiLi91dGlsXCIpO1xudmFyI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iAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdGhlbiA9PT0gXCJmdW5jdGlvblwiKSB7XG4gICAgICAgICAgICBpZiAoaXNBbnlCbHVlYmlyZFByb21pc2Uob2JqKSkge1xuICAgICAgICAgICAgICAgIHZhciByZXQgPSBuZXcgUHJvbWlzZShJTlRFUk5BTCk7XG4gICAgICAgICAgICAgICAgb2JqLl90aGVuKFxuICAgICAgICAgICAgICAgICAgICByZXQuX2Z1bGZpbGwsXG4gICAgICAgICAgICAgICAgICAgIHJldC5fcmVqZWN0LFxuICAgICAgICAgICAgICAgICAgICB1bmRlZmluZWQsXG4gICAgICAgICAgICAgICAgICAgIHJldCxcbiAgICAgICAgICAgICAgICAgICAgbnVsbFxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBkb1RoZW5hYmxlKG9iaiwgdGhlbiwgY29udGV4dCk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIG9iajtcbn1cblxuZnVuY3Rpb24gZG9HZXRUaGVuKG9iaikge1xuICAgIHJldHVybiBvYmoudGhlbjtcbn1cblxuZnVuY3Rpb24gZ2V0VGhlbihvYmopIHtcbiAgICB0cnkge1xuICAgICAgICByZXR1cm4gZG9HZXRUaGVuKG9iaik7XG4gICAgfSBjYXRjaCAoZSkge1xuICAgICAgICBlcnJvck9iai5lID0gZTtcbiAgICAgICAgcmV0dXJuIGVycm9yT2JqO1xuICAgIH1cbn1cblxudmFyIGhhc1Byb3AgPSB7fS5oYXNPd25Qcm9wZXJ0eTtcbmZ1bmN0aW9uIGlzQW55Qmx1ZWJpcmRQcm9taXNlKG9iaikge1xuICAgIHRyeSB7XG4gICAgICAgIHJldHVybiBoYXNQcm9wLmNhbGwob2JqLCBcIl9wcm9taXNlMFwiKTtcbiAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiA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GVvZiB0aGVuYWJsZS5fZ2V0RGlzcG9zZXIgPT09IFwiZnVuY3Rpb25cIiAmJlxuICAgICAgICAgICAgdGhlbmFibGUuX2lzRGlzcG9zYWJsZSgpKSB7XG4gICAgICAgICAgICBtYXliZVByb21pc2UuX3NldERpc3Bvc2FibGUodGhlbmFibGUuX2dldERpc3Bvc2VyKCkpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtYXliZVByb21pc2U7XG4gICAgfVxuICAgIGZ1bmN0aW9uIGRpc3Bvc2UocmVzb3VyY2VzLCBpbnNwZWN0aW9uKSB7XG4gICAgICAgIHZhciBpID0gMDtcbiAgICAgICAgdmFyIGxlbiA9IHJlc291cmNlcy5sZW5ndGg7XG4gICAgICAgIHZhciByZXQgPSBuZXcgUHJvbWlzZShJTlRFUk5BTCk7XG4gICAgICAgIGZ1bmN0aW9uIGl0ZXJhdG9yKCkge1xuICAgICAgICAgICAgaWYgKGkgPj0gbGVuKSByZXR1cm4gcmV0Ll9mdWxmaWxsKCk7XG4gICAgICAgICAgICB2YXIgbWF5YmVQcm9taXNlID0gY2FzdFByZXNlcnZpbmdEaXNwb3NhYmxlKHJlc291cmNlc1tpKytdKTtcbiAgICAgICAgICAgIGlmIChtYXliZVByb21pc2UgaW5zdGFuY2VvZiBQcm9taXNlICYmXG4gICAgICAgICAgICAgICAgbWF5YmVQcm9taXNlLl9pc0Rpc3Bvc2FibGUoKSkge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIG1heWJlUHJvbWlzZSA9IHRyeUNvbnZlcnRUb1Byb21pc2UoXG4gICAgICAgICAgICAgICAgICAgICAgICBtYXliZVByb21pc2UuX2dldERpc3Bvc2VyKCkudHJ5RGlzcG9zZShpbnNwZWN0aW9uKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlcy5wcm9taXNlKTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aHJvd2VyKGUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAobWF5YmVQcm9taXNlIGluc3RhbmNlb2YgUHJvbWlzZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWF5YmVQcm9taXNlLl90aGVuKGl0ZXJhdG9yLCB0aHJvd2VyLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsIG51bGwsIG51bGwpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGl0ZXJhdG9yKCk7XG4gICAgICAgIH1cbiAgICAgICAgaXRlcmF0b3IoKTtcbiAgICAgICAgcmV0dXJuIHJldDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBEaXNwb3NlcihkYXRhLCBwcm9taXNlLCBjb250ZXh0KSB7XG4gICAgICAgIHRoaXMuX2RhdGEgPSBkYXRhO1xuICAgICAgICB0aGlzLl9wcm9taXNlID0gcHJvbWlzZTtcbiAgICAgICAgdGhpcy5fY29udGV4dCA9IGNvbnRleHQ7XG4gICAgfVxuXG4gICAgRGlzcG9zZXIucHJvdG90eXBlLmRhdGEgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLl9kYXRhO1xuICAgIH07XG5cbiAgICBEaXNwb3Nlci5wcm90b3R5cGUucHJvbWlzZSA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuX3Byb21pc2U7XG4gICAgfTtcblxuICAgIERpc3Bvc2VyLnByb3RvdHlwZS5yZXNvdXJjZSA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgaWYgKHRoaXMucHJvbWlzZSgpLmlzRnVsZmlsbGVkKCkpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLnByb21pc2UoKS52YWx1ZSgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBOVUxMO1xuICAgIH07XG5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Ckge1xuICAgICAgICB2YXIgbGVuID0gYXJndW1lbnRzLmxlbmd0aDtcbiAgICAgICAgaWYgKGxlbiA8IDIpIHJldHVybiBhcGlSZWplY3Rpb24oXG4gICAgICAgICAgICAgICAgICAgICAgICBcInlvdSBtdXN0IHBhc3MgYXQgbGVhc3QgMiBhcmd1bWVudHMgdG8gUHJvbWlzZS51c2luZ1wiKTtcbiAgICAgICAgdmFyIGZuID0gYXJndW1lbnRzW2xlbiAtIDFdO1xuICAgICAgICBpZiAodHlwZW9mIGZuICE9PSBcImZ1bmN0aW9uXCIpIHtcbiAgICAgICAgICAgIHJldHVybiBhcGlSZWplY3Rpb24oXCJleHBlY3RpbmcgYSBmdW5jdGlvbiBidXQgZ290IFwiICsgdXRpbC5jbGFzc1N0cmluZyhmbikpO1xuICAgICAgICB9XG4gICAgICAgIHZhciBpbnB1dDtcbiAgICAgICAgdmFyIHNwcmVhZEFyZ3MgPSB0cnVlO1xuICAgICAgICBpZiAobGVuID09PSAyICYmIEFycmF5LmlzQXJyYXkoYXJndW1lbnRzWzBdKSkge1xuICAgICAgICAgICAgaW5wdXQgPSBhcmd1bWVudHNbMF07XG4gICAgICAgICAgICBsZW4gPSBpbnB1dC5sZW5ndGg7XG4gICAgICAgICAgICBzcHJlYWRBcmdzID0gZmFsc2U7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpbnB1dCA9IGFyZ3VtZW50cztcbiAgICAgICAgICAgIGxlbi0tO1xuICAgICAgICB9XG4gICAgICAgIHZhciByZXNvdXJjZXMgPSBuZXcgUmVzb3VyY2VMaXN0KGxlbik7XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuOyArK2kpIHtcbiAgICAgICAgICAgIHZhciByZXNvdXJjZSA9IGlucHV0W2ldO1xuICAgICAgICAgICAgaWYgKERpc3Bvc2VyLmlzRGlzcG9zZXIocmVzb3VyY2UpKSB7XG4gICAgICAgICAgICAgICAgdmFyIGRpc3Bvc2VyID0gcmVzb3VyY2U7XG4gICAgICAgICAgICAgICAgcmVzb3VyY2UgPSByZXNvdXJjZS5wcm9taXNlKCk7XG4gICAgICAgICAgICAgICAgcmVzb3VyY2UuX3NldERpc3Bvc2FibGUoZGlzcG9zZXIpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YXIgbWF5YmVQcm9taXNlID0gdHJ5Q29udmVydFRvUHJvbWlzZShyZXNvdXJjZSk7XG4gICAgICAgICAgICAgICAgaWYgKG1heWJlUHJvbWlzZSBpbnN0YW5jZW9mIFByb21pc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzb3VyY2UgPVxuICAgICAgICAgICAgICAgICAgICAgICAgbWF5YmVQcm9taXNlLl90aGVuKG1heWJlVW53cmFwRGlzcG9zZXIsIG51bGwsIG51bGwsIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZXM6IHJlc291cmNlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleDogaVxuICAgICAgICAgICAgICAgICAgICB9LCB1bmRlZmluZWQpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc291cmNlc1tpXSA9IHJlc291cmNlO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHJlZmxlY3RlZFJlc291cmNlcyA9IG5ldyBBcnJheShyZXNvdXJjZXMubGVuZ3RoKTtcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCByZWZsZWN0ZWRSZXNvdXJjZXMubGVuZ3RoOyArK2kpIHtcbiAgICAgICAgICAgIHJlZmxlY3RlZFJlc291cmNlc1tpXSA9IFByb21pc2UucmVzb2x2ZShyZXNvdXJjZXNbaV0pLnJlZmxlY3QoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciByZXN1bHRQcm9taXNlID0gUHJvbWlzZS5hbGwocmVmbGVjdGVkUmVzb3VyY2VzKVxuICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24oaW5zcGVjdGlvbnMpIHtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGluc3BlY3Rpb25zLmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBpbnNwZWN0aW9uID0gaW5zcGVjdGlvbnNbaV07XG4gICAgICAgICAgICAgICAgICAgIGlmIChpbnNwZWN0aW9uLmlzUmVqZWN0ZWQoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JPYmouZSA9IGluc3BlY3Rpb24uZXJyb3IoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlcnJvck9iajtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICghaW5zcGVjdGlvbi5pc0Z1bGZpbGxlZCgpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRQcm9taXNlLmNhbmNlbCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGluc3BlY3Rpb25zW2ldID0gaW5zcGVjdGlvbi52YWx1ZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwcm9taXNlLl9wdXNoQ29udGV4dCgpO1xuXG4gICAgICAgICAgICAgICAgZm4gPSB0cnlDYXRjaChmbik7XG4gICAgICAgICAgICAgICAgdmFyIHJldCA9IHNwcmVhZEFyZ3NcbiAgICAgICAgICAgICAgICAgICAgPyBmbi5hcHBseSh1bmRlZmluZWQsIGluc3BlY3Rpb25zKSA6IGZuKGluc3BlY3Rpb25zKTtcbiAgICAgICAgICAgICAgICB2YXIgcHJvbWlzZUNyZWF0ZWQgPSBwcm9taXNlLl9wb3BDb250ZXh0KCk7XG4gICAgICAgICAgICAgICAgZGVidWcuY2hlY2tGb3Jnb3R0ZW5SZXR1cm5zKFxuICAgICAgICAgICAgICAgICAgICByZXQsIHByb21pc2VDcm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3RoOyArK2kpIHtcbiAgICAgICAgICAgIGlmIChleGNsdWRlZFByb3RvdHlwZXNbaV0gPT09IHZhbCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9O1xuXG4gICAgaWYgKGVzNS5pc0VTNSkge1xuICAgICAgICB2YXIgZ2V0S2V5cyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzO1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24ob2JqKSB7XG4gICAgICAgICAgICB2YXIgcmV0ID0gW107XG4gICAgICAgICAgICB2YXIgdmlzaXRlZEtleXMgPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuICAgICAgICAgICAgd2hpbGUgKG9iaiAhPSBudWxsICYmICFpc0V4Y2x1ZGVkUHJvdG8ob2JqKSkge1xuICAgICAgICAgICAgICAgIHZhciBrZXlzO1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGtleXMgPSBnZXRLZXlzKG9iaik7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmV0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGtleXMubGVuZ3RoOyArK2kpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGtleSA9IGtleXNbaV07XG4gICAgICAgICAgICAgICAgICAgIGlmICh2aXNpdGVkS2V5c1trZXldKSBjb250aW51ZTtcbiAgICAgICAgICAgICAgICAgICAgdmlzaXRlZEtleXNba2V5XSA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIHZhciBkZXNjID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihvYmosIGtleSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChkZXNjICE9IG51bGwgJiYgZGVzYy5nZXQgPT0gbnVsbCAmJiBkZXNjLnNldCA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXQucHVzaChrZXkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG9iaiA9IGVzNS5nZXRQcm90b3R5cGVPZihvYmopO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJldDtcbiAgICAgICAgfTtcbiAgICB9IGVsc2Uge1xuICAgICAgICB2YXIgaGFzUHJvcCA9IHt9Lmhhc093blByb3BlcnR5O1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24ob2JqKSB7XG4gICAgICAgICAgICBpZiAoaXNFeGNsdWRlZFByb3RvKG9iaikpIHJldHVybiBbXTtcbiAgICAgICAgICAgIHZhciByZXQgPSBbXTtcblxuICAgICAgICAgICAgLypqc2hpbnQgZm9yaW46ZmFsc2UgKi9cbiAgICAgICAgICAgIGVudW1lcmF0aW9uOiBmb3IgKHZhciBrZXkgaW4gb2JqKSB7XG4gICAgICAgICAgICAgICAgaWYgKGhhc1Byb3AuY2FsbChvYmosIGtleSkpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0LnB1c2goa2V5KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGV4Y2x1ZGVkUHJvdG90eXBlcy5sZW5ndGg7ICsraSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhhc1Byb3AuY2FsbChleGNsdWRlZFByb3RvdHlwZXNbaV0sIGtleSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZSBlbnVtZXJhdGlvbjtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXQucHVzaChrZXkpO1xuICAgICAgICAgICAgICAgIH1cbiAg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biAgICB2YXIgcmV2ZXJzZSA9IHkgPCB4O1xuICAgIGlmIChyZXZlcnNlKSB7XG4gICAgICBpbmNyICo9IC0xO1xuICAgICAgdGVzdCA9IGd0ZTtcbiAgICB9XG4gICAgdmFyIHBhZCA9IG4uc29tZShpc1BhZGRlZCk7XG5cbiAgICBOID0gW107XG5cbiAgICBmb3IgKHZhciBpID0geDsgdGVzdChpLCB5KTsgaSArPSBpbmNyKSB7XG4gICAgICB2YXIgYztcbiAgICAgIGlmIChpc0FscGhhU2VxdWVuY2UpIHtcbiAgICAgICAgYyA9IFN0cmluZy5mcm9tQ2hhckNvZGUoaSk7XG4gICAgICAgIGlmIChjID09PSAnXFxcXCcpXG4gICAgICAgICAgYyA9ICcnO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgYyA9IFN0cmluZyhpKTtcbiAgICAgICAgaWYgKHBhZCkge1xuICAgICAgICAgIHZhciBuZWVkID0gd2lkdGggLSBjLmxlbmd0aDtcbiAgICAgICAgICBpZiAobmVlZCA+IDApIHtcbiAgICAgICAgICAgIHZhciB6ID0gbmV3IEFycmF5KG5lZWQgKyAxKS5qb2luKCcwJyk7XG4gICAgICAgICAgICBpZiAoaSA8IDApXG4gICAgICAgICAgICAgIGMgPSAnLScgKyB6ICsgYy5zbGljZSgxKTtcbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgYyA9IHogKyBjO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgTi5wdXNoKGMpO1xuICAgIH1cbiAgfSBlbHNlIHtcbiAgICBOID0gY29uY2F0TWFwKG4sIGZ1bmN0aW9uKGVsKSB7IHJldHVybiBleHBhbmQoZWwsIGZhbHNlKSB9KTtcbiAgfVxuXG4gIGZvciAodmFyIGogPSAwOyBqIDwgTi5sZW5ndGg7IGorKykge1xuICAgIGZvciAodmFyIGsgPSAwOyBrIDwgcG9zdC5sZW5ndGg7IGsrKykge1xuICAgICAgdmFyIGV4cGFuc2lvb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3BhbjogMSB9O1xuICAgICAgICAgIHgrKztcbiAgICAgICAgICB3aGlsZSAoeCA8IHdfbWF4ICYmICFjb25mbGljdEV4aXN0cyh0YWJsZSwgeCwgeSkpIHtcbiAgICAgICAgICAgIG9wdHMuY29sU3BhbisrO1xuICAgICAgICAgICAgeCsrO1xuICAgICAgICAgIH1cbiAgICAgICAgICBsZXQgeTIgPSB5ICsgMTtcbiAgICAgICAgICB3aGlsZSAoeTIgPCBoX21heCAmJiBhbGxCbGFuayh0YWJsZSwgeTIsIG9wdHMueCwgb3B0cy54ICsgb3B0cy5jb2xTcGFuKSkge1xuICAgICAgICAgICAgb3B0cy5yb3dTcGFuKys7XG4gICAgICAgICAgICB5MisrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGxldCBjZWxsID0gbmV3IENlbGwob3B0cyk7XG4gICAgICAgICAgY2VsbC54ID0gb3B0cy54O1xuICAgICAgICAgIGNlbGwueSA9IG9wdHMueTtcbiAgICAgICAgICBpbnNlcnRDZWxsKGNlbGwsIHRhYmxlW3ldKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIGZ1bmN0aW9uIGdlbmVyYXRlQ2VsbHMocm93cykge1xuICAgIHJldHVybiByb3dzLm1hcChmdW5jdGlvbihyb3cpIHtcbiAgICAgIGlmICghQXJyYXkuaXNBcnJheShyb3cpKSB7XG4gICAgICAgIGxldCBrZXkgPSBPYmplY3Qua2V5cyhyb3cpWzBdO1xuICAgICAgICByb3cgPSByb3dba2V5XTtcbiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkocm93KSkge1xuICAgICAgICAgIHJvdyA9IHJvdy5zbGljZSgpO1xuICAgICAgICAgIHJvdy51bnNoaWZ0KGtleSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcm93ID0gW2tleSwgcm93XTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIHJvdy5tYXAoZnVuY3Rpb24oY2VsbCkge1x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ICfMkCcsXG4gICAgICAnzZInLCAnzZcnLCAnzZEnLCAnzIcnLFxuICAgICAgJ8yIJywgJ8yKJywgJ82CJywgJ8yTJyxcbiAgICAgICfMiCcsICfNiicsICfNiycsICfNjCcsXG4gICAgICAnzIMnLCAnzIInLCAnzIwnLCAnzZAnLFxuICAgICAgJ8yAJywgJ8yBJywgJ8yLJywgJ8yPJyxcbiAgICAgICfMkicsICfMkycsICfMlCcsICfMvScsXG4gICAgICAnzIknLCAnzaMnLCAnzaQnLCAnzaUnLFxuICAgICAgJ82mJywgJ82nJywgJ82oJywgJ82pJyxcbiAgICAgICfNqicsICfNqycsICfNrCcsICfNrScsXG4gICAgICAnza4nLCAnza8nLCAnzL4nLCAnzZsnLFxuICAgICAgJ82GJywgJ8yaJyxcbiAgICBdLFxuICAgICdkb3duJzogW1xuICAgICAgJ8yWJywgJ8yXJywgJ8yYJywgJ8yZJyxcbiAgICAgICfMnCcsICfMnScsICfMnicsICfMnycsXG4gICAgICAnzKAnLCAnzKQnLCAnzKUnLCAnzKYnLFxuICAgICAgJ8ypJywgJ8yqJywgJ8yrJywgJ8ysJyxcbiAgICAgICfMrScsICfMricsICfMrycsICfMsCcsXG4gICAgICAnzLEnLCAnzLInLCAnzLMnLCAnzLknLFxuICAgICAgJ8y6JywgJ8y7JywgJ8y8JywgJ82FJyxcbiAgICAgICfNhycsICfNiCcsICfNiScsICfNjScsXG4gICAgICAnzY4nLCAnzZMnLCAnzZQnLCAnzZUnLFxuICAgICAgJ82WJywgJ82ZJywgJ82aJywgJ8yjJyxcbiAgICBdLFxuICAgICdtaWQnOiBbXG4gICAgICAnzJUnLCAnzJsnLCAnzIAnLCAnzIEnLFxuICAgICAgJ82YJywgJ8yhJywgJ8yiJywgJ8ynJyxcbiAgICAgICfMqCcsICfMtCcsICfMtScsICfMticsXG4gICAgICAnzZwnLCAnzZ0nLCAnzZ4nLFxuICAgICAgJ82fJywgJ82gJywgJ82iJywgJ8y4JyxcbiAgICAgICfMtycsICf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ZSddIDogJ21heGknO1xuICAgIHRleHQgPSB0ZXh0LnNwbGl0KCcnKTtcbiAgICBmb3IgKGwgaW4gdGV4dCkge1xuICAgICAgaWYgKGlzQ2hhcihsKSkge1xuICAgICAgICBjb250aW51ZTtcbiAgICAgIH1cbiAgICAgIHJlc3VsdCA9IHJlc3VsdCArIHRleHRbbF07XG4gICAgICBjb3VudHMgPSB7J3VwJzogMCwgJ2Rvd24nOiAwLCAnbWlkJzogMH07XG4gICAgICBzd2l0Y2ggKG9wdGlvbnMuc2l6ZSkge1xuICAgICAgICBjYXNlICdtaW5pJzpcbiAgICAgICAgICBjb3VudHMudXAgPSByYW5kb21OdW1iZXIoOCk7XG4gICAgICAgICAgY291bnRzLm1pZCA9IHJhbmRvbU51bWJlcigyKTtcbiAgICAgICAgICBjb3VudHMuZG93biA9IHJhbmRvbU51bWJlcig4KTtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAnbWF4aSc6XG4gICAgICAgICAgY291bnRzLnVwID0gcmFuZG9tTnVtYmVyKDE2KSArIDM7XG4gICAgICAgICAgY291bnRzLm1pZCA9IHJhbmRvbU51bWJlcig0KSArIDE7XG4gICAgICAgICAgY291bnRzLmRvd24gPSByYW5kb21OdW1iZXIoNjQpICsgMztcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICBjb3VudHMudXAgPSByYW5kb21OdW1iZXIoOCkgKyAxO1xuICAgICAgICAgIGNvdW50cy5taWQgPSByYW5kb21OdW1iZXIoNikgLyAyO1xuICAgICAgICAgIGNvdW50cy5kb3duID0gcmFuZG9tTnVtYmVyKDgpICsgMTtcbiAgICAgICAgICBicmVhaztcbiAgICAgIH1cblxuICAgICAgdmFyIGFyciA9IFsndXAnLCAnbWlkJywgJ2Rvd24nXTtcbiAgICAgIGZvciAodmFyIGQgaW4gYXJyKSB7XG4gICAgICAgIHZhciBpbmRleCA9IGFycltkXTtcbiAgICAgICAgZm9yICh2YXIgaSA9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ZT1InLCAnR0lUTEFCX0NJJ10uc29tZShmdW5jdGlvbihzaWduKSB7XG4gICAgICByZXR1cm4gc2lnbiBpbiBlbnY7XG4gICAgfSkgfHwgZW52LkNJX05BTUUgPT09ICdjb2Rlc2hpcCcpIHtcbiAgICAgIHJldHVybiAxO1xuICAgIH1cblxuICAgIHJldHVybiBtaW47XG4gIH1cblxuICBpZiAoJ1RFQU1DSVRZX1ZFUlNJT04nIGluIGVudikge1xuICAgIHJldHVybiAoL14oOVxcLigwKlsxLTldXFxkKilcXC58XFxkezIsfVxcLikvLnRlc3QoZW52LlRFQU1DSVRZX1ZFUlNJT04pID8gMSA6IDBcbiAgICApO1xuICB9XG5cbiAgaWYgKCdURVJNX1BST0dSQU0nIGluIGVudikge1xuICAgIHZhciB2ZXJzaW9uID0gcGFyc2VJbnQoKGVudi5URVJNX1BST0dSQU1fVkVSU0lPTiB8fCAnJykuc3BsaXQoJy4nKVswXSwgMTApO1xuXG4gICAgc3dpdGNoIChlbnYuVEVSTV9QUk9HUkFNKSB7XG4gICAgICBjYXNlICdpVGVybS5hcHAnOlxuICAgICAgICByZXR1cm4gdmVyc2lvbiA+PSAzID8gMyA6IDI7XG4gICAgICBjYXNlICdIeXBlcic6XG4gICAgICAgIHJldHVybiAzO1xuICAgICAgY2FzZSAnQXBwbGVfVGVybWluYWwnOlxuICAgICAgICByZXR1cm4gMjtcbiAgICAgIC8vIE5vIGRlZmF1bHRcbiAgICB9XG4gIH1cblxuICBpZiAoLy0yNTYoY29sb3IpPyQvaS50ZXN0KGVudi5URVJNKSkge1xuICAgIHJldHVybiAyO1xuICB9XG5cbiAgaWYgKC9ec2NyZWVufF54dGVybXxednQxMDB8XnJ4dnR8Y29sb3J8YW5zaXxjeWd3aW58bGludXgvaS50ZXN0KGVudi5URVJNKSkge1xuICAgIHJldHVybiAxO1xuICB9XG5cbiAgaWYgKCdDT0xPUlRFUk0nIGluIGVudikge1xuICAgIHJldHVybiAxO1xuICB9XG5cbiAgaWYgKG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B0aW9uKSB7XG4gICAgICAvLyByZXF1aXJlcyBhcmdcbiAgICAgIGlmIChvcHRpb24ucmVxdWlyZWQpIHtcbiAgICAgICAgYXJnID0gYXJndlsrK2ldO1xuICAgICAgICBpZiAoYXJnID09IG51bGwpIHJldHVybiB0aGlzLm9wdGlvbk1pc3NpbmdBcmd1bWVudChvcHRpb24pO1xuICAgICAgICB0aGlzLmVtaXQoJ29wdGlvbjonICsgb3B0aW9uLm5hbWUoKSwgYXJnKTtcbiAgICAgIC8vIG9wdGlvbmFsIGFyZ1xuICAgICAgfSBlbHNlIGlmIChvcHRpb24ub3B0aW9uYWwpIHtcbiAgICAgICAgYXJnID0gYXJndltpICsgMV07XG4gICAgICAgIGlmIChhcmcgPT0gbnVsbCB8fCAoYXJnWzBdID09PSAnLScgJiYgYXJnICE9PSAnLScpKSB7XG4gICAgICAgICAgYXJnID0gbnVsbDtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICArK2k7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5lbWl0KCdvcHRpb246JyArIG9wdGlvbi5uYW1lKCksIGFyZyk7XG4gICAgICAvLyBmbGFnXG4gICAgICB9IGVsc2Uge1xuICAgICAgICB0aGlzLmVtaXQoJ29wdGlvbjonICsgb3B0aW9uLm5hbWUoKSk7XG4gICAgICB9XG4gICAgICBjb250aW51ZTtcbiAgICB9XG5cbiAgICAvLyBsb29rcyBsaWtlIGFuIG9wdGlvblxuICAgIGlmIChhcmcubGVuZ3RoID4gMSAmJiBhcmdbMF0gPT09ICctJykge1xuICAgICAgdW5rbm93bk9wdGlvbnMucHVzaChhcmcpO1xuXG4gICAgICAvLyBJZiB0aGUgbmV4dCBhcmd1bWVudCBsb29rcyBsaWtlIGl0IG1pZ2h0IGJlXG4gICAgICAvLyBhbiBhcmd1bWVudCBmb3IgdGhpcyBvcHRpb24sIHdlIHBhc3MgaXQgb24uXG4gICAgICAvLyBJZiBpdCBpc24ndCwgdGhlbiBpdCdsbCBzaW1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2l0cycpO1xuICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1zZWxmLWNvbXBhcmVcbiAgICBpZiAobnVtYmVyICE9IG51bWJlcikgcmV0dXJuICdOYU4nO1xuICAgIGlmIChudW1iZXIgPD0gLTFlMjEgfHwgbnVtYmVyID49IDFlMjEpIHJldHVybiBTdHJpbmcobnVtYmVyKTtcbiAgICBpZiAobnVtYmVyIDwgMCkge1xuICAgICAgc2lnbiA9ICctJztcbiAgICAgIG51bWJlciA9IC1udW1iZXI7XG4gICAgfVxuICAgIGlmIChudW1iZXIgPiAxZS0yMSkge1xuICAgICAgZSA9IGxvZyhudW1iZXIgKiBwb3coMiwgNjksIDEpKSAtIDY5O1xuICAgICAgeiA9IGUgPCAwID8gbnVtYmVyICogcG93KDIsIC1lLCAxKSA6IG51bWJlciAvIHBvdygyLCBlLCAxKTtcbiAgICAgIHogKj0gMHgxMDAwMDAwMDAwMDAwMDtcbiAgICAgIGUgPSA1MiAtIGU7XG4gICAgICBpZiAoZSA+IDApIHtcbiAgICAgICAgbXVsdGlwbHkoMCwgeik7XG4gICAgICAgIGogPSBmcmFjdERpZ2l0cztcbiAgICAgICAgd2hpbGUgKGogPj0gNykge1xuICAgICAgICAgIG11bHRpcGx5KDFlNywgMCk7XG4gICAgICAgICAgaiAtPSA3O1xuICAgICAgICB9XG4gICAgICAgIG11bHRpcGx5KHBvdygxMCwgaiwgMSksIDApO1xuICAgICAgICBqID0gZSAtIDE7XG4gICAgICAgIHdoaWxlIChqID49IDIzKSB7XG4gICAgICAgICAgZGl2aWRlKDEgPDwgMjMpO1xuICAgICAgICAgIGogLT0gMjM7XG4gICAgICAgIH1cbiAgICAgICAgZGl2aWRlKDEgPDwgaik7XG4gICAgICAgIG11bHRpcGx5KDEsIDEpO1xuICAgICAgICBkaXZpZGUoMik7XG4gICAgICAgIHJlc3VsdCA9IGRhdGFUb1N0cmluZygpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgbXVsdGl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G4gICAgICB2YXIgcmVzdWx0LCB0aGVuLCBleGl0ZWQ7XG4gICAgICB0cnkge1xuICAgICAgICBpZiAoaGFuZGxlcikge1xuICAgICAgICAgIGlmICghb2spIHtcbiAgICAgICAgICAgIGlmIChzdGF0ZS5yZWplY3Rpb24gPT09IFVOSEFORExFRCkgb25IYW5kbGVVbmhhbmRsZWQocHJvbWlzZSwgc3RhdGUpO1xuICAgICAgICAgICAgc3RhdGUucmVqZWN0aW9uID0gSEFORExFRDtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKGhhbmRsZXIgPT09IHRydWUpIHJlc3VsdCA9IHZhbHVlO1xuICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgaWYgKGRvbWFpbikgZG9tYWluLmVudGVyKCk7XG4gICAgICAgICAgICByZXN1bHQgPSBoYW5kbGVyKHZhbHVlKTsgLy8gY2FuIHRocm93XG4gICAgICAgICAgICBpZiAoZG9tYWluKSB7XG4gICAgICAgICAgICAgIGRvbWFpbi5leGl0KCk7XG4gICAgICAgICAgICAgIGV4aXRlZCA9IHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChyZXN1bHQgPT09IHJlYWN0aW9uLnByb21pc2UpIHtcbiAgICAgICAgICAgIHJlamVjdChUeXBlRXJyb3IoJ1Byb21pc2UtY2hhaW4gY3ljbGUnKSk7XG4gICAgICAgICAgfSBlbHNlIGlmICh0aGVuID0gaXNUaGVuYWJsZShyZXN1bHQpKSB7XG4gICAgICAgICAgICB0aGVuLmNhbGwocmVzdWx0LCByZXNvbHZlLCByZWplY3QpO1xuICAgICAgICAgIH0gZWxzZSByZXNvbHZlKHJlc3VsdCk7XG4gICAgICAgIH0gZWxzZSByZWplY3QodmFsdWUpO1xuICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgaWYgKGRvbWFpbiAmJiAhZXhpdGVkKSBkb21haW4uZXhpdCgpO1xuICAgICAgICByZWplY3QoZXJyb3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Z3MpO1xuICAgICAgdmFyIGxpbSA9IGxpbWl0ID09PSB1bmRlZmluZWQgPyBNQVhfVUlOVDMyIDogbGltaXQgPj4+IDA7XG4gICAgICBpZiAobGltID09PSAwKSByZXR1cm4gW107XG4gICAgICBpZiAoUy5sZW5ndGggPT09IDApIHJldHVybiBjYWxsUmVnRXhwRXhlYyhzcGxpdHRlciwgUykgPT09IG51bGwgPyBbU10gOiBbXTtcbiAgICAgIHZhciBwID0gMDtcbiAgICAgIHZhciBxID0gMDtcbiAgICAgIHZhciBBID0gW107XG4gICAgICB3aGlsZSAocSA8IFMubGVuZ3RoKSB7XG4gICAgICAgIHNwbGl0dGVyLmxhc3RJbmRleCA9IFNVUFBPUlRTX1kgPyBxIDogMDtcbiAgICAgICAgdmFyIHogPSBjYWxsUmVnRXhwRXhlYyhzcGxpdHRlciwgU1VQUE9SVFNfWSA/IFMgOiBTLnNsaWNlKHEpKTtcbiAgICAgICAgdmFyIGU7XG4gICAgICAgIGlmIChcbiAgICAgICAgICB6ID09PSBudWxsIHx8XG4gICAgICAgICAgKGUgPSBtaW4odG9MZW5ndGgoc3BsaXR0ZXIubGFzdEluZGV4ICsgKFNVUFBPUlRTX1kgPyAwIDogcSkpLCBTLmxlbmd0aCkpID09PSBwXG4gICAgICAgICkge1xuICAgICAgICAgIHEgPSBhZHZhbmNlU3RyaW5nSW5kZXgoUywgcSwgdW5pY29kZU1hdGNoaW5nKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBBLnB1c2goUy5zbGljZShwLCBxKSk7XG4gICAgICAgICAgaWYgKEEubGVuZ3RoID09PSBsaW0pIHJldHVybiBBO1xuICAgICAgICAgIGZvciAodmFyIGkgPSAxOyBpIDw9IHoubGVuZ3RoIC0gMTsgaSsrKSB7XG4gICAgICAgICAgICBBLnB1c2goeltpXSk7XG4gICAgICAgICAgICBpZiAoQS5sZW5ndGggPT09IGxpbSkgcmV0dXJuIEE7XG4gICAgICAgICAgfVxuICAgICAgICAgI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SByZXR1cm47XG4gICAgaWYgKGNoYXIoKSA9PSAnOicpIHtcbiAgICAgIGlmIChjb21wcmVzcyAhPT0gbnVsbCkgcmV0dXJuO1xuICAgICAgcG9pbnRlcisrO1xuICAgICAgcGllY2VJbmRleCsrO1xuICAgICAgY29tcHJlc3MgPSBwaWVjZUluZGV4O1xuICAgICAgY29udGludWU7XG4gICAgfVxuICAgIHZhbHVlID0gbGVuZ3RoID0gMDtcbiAgICB3aGlsZSAobGVuZ3RoIDwgNCAmJiBIRVgudGVzdChjaGFyKCkpKSB7XG4gICAgICB2YWx1ZSA9IHZhbHVlICogMTYgKyBwYXJzZUludChjaGFyKCksIDE2KTtcbiAgICAgIHBvaW50ZXIrKztcbiAgICAgIGxlbmd0aCsrO1xuICAgIH1cbiAgICBpZiAoY2hhcigpID09ICcuJykge1xuICAgICAgaWYgKGxlbmd0aCA9PSAwKSByZXR1cm47XG4gICAgICBwb2ludGVyIC09IGxlbmd0aDtcbiAgICAgIGlmIChwaWVjZUluZGV4ID4gNikgcmV0dXJuO1xuICAgICAgbnVtYmVyc1NlZW4gPSAwO1xuICAgICAgd2hpbGUgKGNoYXIoKSkge1xuICAgICAgICBpcHY0UGllY2UgPSBudWxsO1xuICAgICAgICBpZiAobnVtYmVyc1NlZW4gPiAwKSB7XG4gICAgICAgICAgaWYgKGNoYXIoKSA9PSAnLicgJiYgbnVtYmVyc1NlZW4gPCA0KSBwb2ludGVyKys7XG4gICAgICAgICAgZWxzZSByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFESUdJVC50ZXN0KGNoYXIoKSkpIHJldHVybjtcbiAgICAgICAgd2hpbGUgKERJR0lULnRlc3QoY2hhcigpKSkge1xuICAgICAgICAgIG51bWJlciA9IHBhcnNlSW50KGNoYXIoKSwgMTApO1xuICAgICAgICAgIGlmIChpcHY0UGllY2UgPT09IG51bGwpIGlwdjRQaWVjZSA9IG51bWJlcjtcbiAgICAgICAgICBlbHNlIGlmIChpcHY0UGllY2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yICE9ICcjJykpIHJldHVybiBJTlZBTElEX1NDSEVNRTtcbiAgICAgICAgaWYgKGJhc2UuY2Fubm90QmVBQmFzZVVSTCAmJiBjaGFyID09ICcjJykge1xuICAgICAgICAgIHVybC5zY2hlbWUgPSBiYXNlLnNjaGVtZTtcbiAgICAgICAgICB1cmwucGF0aCA9IGJhc2UucGF0aC5zbGljZSgpO1xuICAgICAgICAgIHVybC5xdWVyeSA9IGJhc2UucXVlcnk7XG4gICAgICAgICAgdXJsLmZyYWdtZW50ID0gJyc7XG4gICAgICAgICAgdXJsLmNhbm5vdEJlQUJhc2VVUkwgPSB0cnVlO1xuICAgICAgICAgIHN0YXRlID0gRlJBR01FTlQ7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgc3RhdGUgPSBiYXNlLnNjaGVtZSA9PSAnZmlsZScgPyBGSUxFIDogUkVMQVRJVkU7XG4gICAgICAgIGNvbnRpbnVlO1xuXG4gICAgICBjYXNlIFNQRUNJQUxfUkVMQVRJVkVfT1JfQVVUSE9SSVRZOlxuICAgICAgICBpZiAoY2hhciA9PSAnLycgJiYgY29kZVBvaW50c1twb2ludGVyICsgMV0gPT0gJy8nKSB7XG4gICAgICAgICAgc3RhdGUgPSBTUEVDSUFMX0FVVEhPUklUWV9JR05PUkVfU0xBU0hFUztcbiAgICAgICAgICBwb2ludGVyKys7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgc3RhdGUgPSBSRUxBVElWRTtcbiAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgfSBicmVhaztcblxuICAgICAgY2FzZSBQQVRIX09SX0FVVEhPUklUWTpcbiAgICAgICAgaWYgKGNoYXIgPT0gJy8nKSB7XG4gICAgICAgICAgc3RhdGUgPSBBVVRIT1JJVFk7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgc3RhdGUgPSBQQVRIO1xuICAgICAgICAgIGNvbnRpbnVlO1xuICAg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AgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBlbmNvZGVkQ29kZVBvaW50cyA9IHBlcmNlbnRFbmNvZGUoY29kZVBvaW50LCB1c2VyaW5mb1BlcmNlbnRFbmNvZGVTZXQpO1xuICAgICAgICAgICAgaWYgKHNlZW5QYXNzd29yZFRva2VuKSB1cmwucGFzc3dvcmQgKz0gZW5jb2RlZENvZGVQb2ludHM7XG4gICAgICAgICAgICBlbHNlIHVybC51c2VybmFtZSArPSBlbmNvZGVkQ29kZVBvaW50cztcbiAgICAgICAgICB9XG4gICAgICAgICAgYnVmZmVyID0gJyc7XG4gICAgICAgIH0gZWxzZSBpZiAoXG4gICAgICAgICAgY2hhciA9PSBFT0YgfHwgY2hhciA9PSAnLycgfHwgY2hhciA9PSAnPycgfHwgY2hhciA9PSAnIycgfHxcbiAgICAgICAgICAoY2hhciA9PSAnXFxcXCcgJiYgaXNTcGVjaWFsKHVybCkpXG4gICAgICAgICkge1xuICAgICAgICAgIGlmIChzZWVuQXQgJiYgYnVmZmVyID09ICcnKSByZXR1cm4gSU5WQUxJRF9BVVRIT1JJVFk7XG4gICAgICAgICAgcG9pbnRlciAtPSBhcnJheUZyb20oYnVmZmVyKS5sZW5ndGggKyAxO1xuICAgICAgICAgIGJ1ZmZlciA9ICcnO1xuICAgICAgICAgIHN0YXRlID0gSE9TVDtcbiAgICAgICAgfSBlbHNlIGJ1ZmZlciArPSBjaGFyO1xuICAgICAgICBicmVhaztcblxuICAgICAgY2FzZSBIT1NUOlxuICAgICAgY2FzZSBIT1NUTkFNRTpcbiAgICAgICAgaWYgKHN0YXRlT3ZlcnJpZGUgJiYgdXJsLnNjaGVtZSA9PSAnZmlsZScpIHtcbiAgICAgICAgICBzdGF0ZSA9IEZJTEVfSE9TVDtcbiAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgfSBlbHNlIGlmIChjaGFyID09ICc6JyAmJiAhc2VlbkJyYWNrZXQpIHtcbiAgICAgICAgICBpZiAoYnVmZmVyID09ICcnKSByZXR1cm4gSU5WQUxJRF9IT1NUO1xuICAgICAgICAgIGZhaWx1cmUgPSBwYXJzZUhvc3QodXJsLCBidWZmZXIpO1xuICAgICAgICAgIGlmIChmYWlsdXJlKSByZXR1cm4gZmFpbHVyZTtcbiAgICAgICAgICBidWZmZXIgPSAnJztcbiAgICAgICAgICBzdGF0ZSA9IFBPUlQ7XG4gICAgICAgICAgaWYgKHN0YXRlT3ZlcnJpZGUgPT0gSE9TVE5BTUUpIHJldHVybjtcbiAgICAgICAgfSBlbHNlIGlmIChcbiAgICAgICAgICBjaGFyID09IEVPRiB8fCBjaGFyID09ICcvJyB8fCBjaGFyID09ICc/JyB8fCBjaGFyID09ICcjJyB8fFxuICAgICAgICAgIChjaGFyID09ICdcXFxcJyAmJiBpc1NwZWNpYWwodXJsKSlcbiAgICAgICAgKSB7XG4gICAgICAgICAgaWYgKGlzU3BlY2lhbCh1cmwpICYmIGJ1ZmZlciA9PSAnJykgcmV0dXJuIElOVkFMSURfSE9TVDtcbiAgICAgICAgICBpZiAoc3RhdGVPdmVycmlkZSAmJiBidWZmZXIgPT0gJycgJiYgKGluY2x1ZGVzQ3JlZGVudGlhbHModXJsKSB8fCB1cmwucG9ydCAhPT0gbnVsbCkpIHJldHVybjtcbiAgICAgICAgICBmYWlsdXJlID0gcGFyc2VIb3N0KHVybCwgYnVmZmVyKTtcbiAgICAgICAgICBpZiAoZmFpbHVyZSkgcmV0dXJuIGZhaWx1cmU7XG4gICAgICAgICAgYnVmZmVyID0gJyc7XG4gICAgICAgICAgc3RhdGUgPSBQQVRIX1NUQVJUO1xuICAgICAgICAgIGlmIChzdGF0ZU92ZXJyaWRlKSByZXR1cm47XG4gICAgICAgICAgY29udGludWU7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgaWYgKGNoYXIgPT0gJ1snKSBzZWVuQnJhY2tldCA9IHRydWU7XG4gICAgICAgICAgZWxzZSBpZiAoY2hhciA9PSAnXScpIHNlZW5CcmFja2V0ID0gZmFsc2U7XG4gICAgICAgICAgYnVmZmVyICs9IGNoYXI7XG4gICAgICAgIH0gYnJlYWs7XG5cbiAgICAgIGNhc2UgUE9SVDpcbiAgICAgICAgaWYgKERJR0lULnRlc3QoY2hhcikpIHtcbiAgICAgICAgICBidWZmZXIgKz0gY2hhcjtcbiAgICAgICAgfSBlbHNlIGlmIChcbiAgICAgICAgICBjaGFyID09IEVPRiB8fCBjaGFyID09ICcvJyB8fCBjaGFyID09ICc/JyB8fCBjaGFyID09ICcjJyB8fFxuICAgICAgICAgIChjaGFyID09ICdcXFxcJyAmJiBpc1NwZWNpYWwodXJsKSkgfHxcbiAgICAgICAgICBzdGF0ZU92ZXJyaWRlXG4gICAgICAgICkge1xuICAgICAgICAgIGlmIChidWZmZXIgIT0gJycpIHtcbiAgICAgICAgICAgIHZhciBwb3J0ID0gcGFyc2VJbnQoYnVmZmVyLCAxMCk7XG4gICAgICAgICAgICBpZiAocG9ydCA+IDB4RkZGRikgcmV0dXJuIElOVkFMSURfUE9SVDtcbiAgICAgICAgICAgIHVybC5wb3J0ID0gKGlzU3BlY2lhbCh1cmwpICYmIHBvcnQgPT09IHNwZWNpYWxTY2hlbWVzW3VybC5zY2hlbWVdKSA/IG51bGwgOiBwb3J0O1xuICAgICAgICAgICAgYnVmZmVyID0gJyc7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzdGF0ZU92ZXJyaWRlKSByZXR1cm47XG4gICAgICAgICAgc3RhdGUgPSBQQVRIX1NUQVJUO1xuICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICB9IGVsc2UgcmV0dXJuIElOVkFMSURfUE9SVDtcbiAgICAgICAgYnJlYWs7XG5cbiAgICAgIGNhc2UgRklMRTpcbiAgICAgICAgdXJsLnNjaGVtZSA9ICdmaWxlJztcbiAgICAgICAgaWYgKGNoYXIgPT0gJy8nIHx8IGNoYXIgPT0gJ1xcXFwnKSBzdGF0ZSA9I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xuICAgICAgICAgICAgc3RhdGUgPSBQQVRIO1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHN0YXRlID0gUEFUSDtcbiAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgfSBicmVhaztcblxuICAgICAgY2FzZSBGSUxFX1NMQVNIOlxuICAgICAgICBpZiAoY2hhciA9PSAnLycgfHwgY2hhciA9PSAnXFxcXCcpIHtcbiAgICAgICAgICBzdGF0ZSA9IEZJTEVfSE9TVDtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICBpZiAoYmFzZSAmJiBiYXNlLnNjaGVtZSA9PSAnZmlsZScgJiYgIXN0YXJ0c1dpdGhXaW5kb3dzRHJpdmVMZXR0ZXIoY29kZVBvaW50cy5zbGljZShwb2ludGVyKS5qb2luKCcnKSkpIHtcbiAgICAgICAgICBpZiAoaXNXaW5kb3dzRHJpdmVMZXR0ZXIoYmFzZS5wYXRoWzBdLCB0cnVlKSkgdXJsLnBhdGgucHVzaChiYXNlLnBhdGhbMF0pO1xuICAgICAgICAgIGVsc2UgdXJsLmhvc3QgPSBiYXNlLmhvc3Q7XG4gICAgICAgIH1cbiAgICAgICAgc3RhdGUgPSBQQVRIO1xuICAgICAgICBjb250aW51ZTtcblxuICAgICAgY2FzZSBGSUxFX0hPU1Q6XG4gICAgICAgIGlmIChjaGFyID09IEVPRiB8fCBjaGFyID09ICcvJyB8fCBjaGFyID09ICdcXFxcJyB8fCBjaGFyID09ICc/JyB8fCBjaGFyID09ICcjJykge1xuICAgICAgICAgIGlmICghc3RhdGVPdmVycmlkZSAmJiBpc1dpbmRvd3NEcml2ZUxldHRlcihidWZmZXIpKSB7XG4gICAgICAgICAgICBzdGF0ZSA9IFBBVEg7XG4gICAgICAgICAgfSBlbHNlIGlmIChidWZmZXIgPT0gJycpIHtcbiAgICAgICAgICAgIHVybC5ob3N0ID0gJyc7XG4gICAgICAgICAg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b250aW51ZTtcbiAgICAgICAgfSBicmVhaztcblxuICAgICAgY2FzZSBQQVRIOlxuICAgICAgICBpZiAoXG4gICAgICAgICAgY2hhciA9PSBFT0YgfHwgY2hhciA9PSAnLycgfHxcbiAgICAgICAgICAoY2hhciA9PSAnXFxcXCcgJiYgaXNTcGVjaWFsKHVybCkpIHx8XG4gICAgICAgICAgKCFzdGF0ZU92ZXJyaWRlICYmIChjaGFyID09ICc/JyB8fCBjaGFyID09ICcjJykpXG4gICAgICAgICkge1xuICAgICAgICAgIGlmIChpc0RvdWJsZURvdChidWZmZXIpKSB7XG4gICAgICAgICAgICBzaG9ydGVuVVJMc1BhdGgodXJsKTtcbiAgICAgICAgICAgIGlmIChjaGFyICE9ICcvJyAmJiAhKGNoYXIgPT0gJ1xcXFwnICYmIGlzU3BlY2lhbCh1cmwpKSkge1xuICAgICAgICAgICAgICB1cmwucGF0aC5wdXNoKCcnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGVsc2UgaWYgKGlzU2luZ2xlRG90KGJ1ZmZlcikpIHtcbiAgICAgICAgICAgIGlmIChjaGFyICE9ICcvJyAmJiAhKGNoYXIgPT0gJ1xcXFwnICYmIGlzU3BlY2lhbCh1cmwpKSkge1xuICAgICAgICAgICAgICB1cmwucGF0aC5wdXNoKCcnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgaWYgKHVybC5zY2hlbWUgPT0gJ2ZpbGUnICYmICF1cmwucGF0aC5sZW5ndGggJiYgaXNXaW5kb3dzRHJpdmVMZXR0ZXIoYnVmZmVyKSkge1xuICAgICAgICAgICAgICBpZiAodXJsLmhvc3QpIHVybC5ob3N0ID0gJyc7XG4gICAgICAgICAgICAgIGJ1ZmZlciA9IGJ1ZmZlci5jaGFyQXQoMCkgKyAnOic7IC8vIG5vcm1hbGl6ZSB3aW5kb3dzIGRyaXZlIGxldHRlclxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdXJsLnBhdGgucHVzaChidWZmZXIpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBidWZmZXIgPSAnJztcbiAgICAgICAgICBpZiAodXJsLnNjaGVtZSA9PSAnZmlsZScgJiYgKGNoYXIgPT0gRU9GIHx8IGNoYXIgPT0gJz8nIHx8IGNoYXIgPT0gJyMnKSkge1xuICAgICAgICAgICAgd2hpbGUgKHVybC5wYXRoLmxlbmd0aCA+IDEgJiYgdXJsLnBhdGhbMF0gPT09ICcnKSB7XG4gICAgICAgICAgICAgIHVybC5wYXRoLnNoaWZ0KCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChjaGFyID09ICc/Jykge1xuICAgICAgICAgICAgdXJsLnF1ZXJ5ID0gJyc7XG4gICAgICAgICAgICBzdGF0ZSA9IFFVRVJZO1xuICAgICAgICAgIH0gZWxzZSBpZiAoY2hhciA9PSAnIycpIHtcbiAgICAgICAgICAgIHVybC5mcmFnbWVudCA9ICcnO1xuICAgICAgICAgICAgc3RhdGUgPSBGUkFHTUVOVDtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgYnVmZmVyICs9IHBlcmNlbnRFbmNvZGUoY2hhciwgcGF0aFBlcmNlbnRFbmNvZGVTZXQpO1xuICAgICAgICB9IGJyZWFrO1xuXG4gICAgICBjYXNlIENBTk5PVF9CRV9BX0JBU0VfVVJMX1BBVEg6XG4gICAgICAgIGlmIChjaGFyID09ICc/Jykge1xuICAgICAgICAgIHVybC5xdWVyeSA9ICcnO1xuICAgICAgICAgIHN0YXRlID0gUVVFUlk7XG4gICAgICAgIH0gZWxzZSBpZiAoY2hhciA9PSAnIycpIHtcbiAgICAgICAgICB1cmwuZnJhZ21lbnQgPSAnJztcbiAgICAgICAgICBzdGF0ZSA9IEZSQUdNRU5UO1xuICAgICAgICB9IGVsc2UgaWYgKGNoYXIgIT0gRU9GKSB7XG4gICAgICAgICAgdXJsLnBhdGhbMF0gKz0g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hPZignfCcpICE9PSAtMSkge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGZvciAodmFyIF9iID0gX192YWx1ZXMocmVwbGFjZW1lbnQuc3BsaXQoL1xcfC8pKSwgX2MgPSBfYi5uZXh0KCk7ICFfYy5kb25lOyBfYyA9IF9iLm5leHQoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHBhcnQgPSBfYy52YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIF90aGlzLl9jaGVja05vUGFyYW1ldGVyVHlwZShwYXJ0LCBQQVJBTUVURVJfVFlQRVNfQ0FOTk9UX0JFX0FMVEVSTkFUSVZFKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjYXRjaCAoZV8xXzEpIHsgZV8xID0geyBlcnJvcjogZV8xXzEgfTsgfVxuICAgICAgICAgICAgICAgIGZpbmFsbHkge1xuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF9jICYmICFfYy5kb25lICYmIChfYSA9IF9iLnJldHVybikpIF9hLmNhbGwoX2IpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGZpbmFsbHkgeyBpZiAoZV8xKSB0aHJvdyBlXzEuZXJyb3I7IH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIFwiKD86XCIgKyByZXBsYWNlbWVudCArIFwiKVwiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlcGxhY2VtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9O1xuICAgIEN1Y3VtYmVyRXhwcmVzc2lvbi5wcm90b3R5cGUucHJvY2Vzc1BhcmFtZXRlcnMgPSBmdW5jdGlvbiAoZXhwcmVzc2lvbi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JUeXBlcyA9IHBhcmFtZXRlclR5cGVzLnNvcnQoUGFyYW1ldGVyVHlwZV8xLmRlZmF1bHQuY29tcGFyZSk7XG4gICAgICAgICAgICAgICAgcGFyYW1ldGVyVHlwZUNvbWJpbmF0aW9ucy5wdXNoKHBhcmFtZXRlclR5cGVzKTtcbiAgICAgICAgICAgICAgICBleHByZXNzaW9uVGVtcGxhdGUgKz0gZXNjYXBlKHRleHQuc2xpY2UocG9zLCBiZXN0UGFyYW1ldGVyVHlwZU1hdGNoZXJfMS5zdGFydCkpO1xuICAgICAgICAgICAgICAgIGV4cHJlc3Npb25UZW1wbGF0ZSArPSAneyVzfSc7XG4gICAgICAgICAgICAgICAgcG9zID1cbiAgICAgICAgICAgICAgICAgICAgYmVzdFBhcmFtZXRlclR5cGVNYXRjaGVyXzEuc3RhcnQgKyBiZXN0UGFyYW1ldGVyVHlwZU1hdGNoZXJfMS5ncm91cC5sZW5ndGg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gXCJicmVha1wiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHBvcyA+PSB0ZXh0Lmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBcImJyZWFrXCI7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zdGFudC1jb25kaXRpb25cbiAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgIHZhciBzdGF0ZV8xID0gX2xvb3BfMSgpO1xuICAgICAgICAgICAgaWYgKHN0YXRlXzEgPT09IFwiYnJlYWtcIilcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICBleHByZXNzaW9uVGVtcGxhdGUgKz0gZXNjYXBlKHRleHQuc2xpY2UocG9zKSk7XG4gICAgICAgIHJldHVybiBuZXcgQ29tYmluYXRv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X2MudmFsdWU7XG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtZXRlclR5cGUudXNlRm9yU25pcHBldHMpIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTWF0Y2hlcnMgPSBwYXJhbWV0ZXJNYXRjaGVycy5jb25jYXQoQ3VjdW1iZXJFeHByZXNzaW9uR2VuZXJhdG9yLmNyZWF0ZVBhcmFtZXRlclR5cGVNYXRjaGVyczIocGFyYW1ldGVyVHlwZSwgdGV4dCkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBjYXRjaCAoZV8zXzEpIHsgZV8zID0geyBlcnJvcjogZV8zXzEgfTsgfVxuICAgICAgICBmaW5hbGx5IHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgaWYgKF9jICYmICFfYy5kb25lICYmIChfYSA9IF9iLnJldHVybikpIF9hLmNhbGwoX2IpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZmluYWxseSB7IGlmIChlXzMpIHRocm93IGVfMy5lcnJvcjsgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBwYXJhbWV0ZXJNYXRjaGVycztcbiAgICB9O1xuICAgIEN1Y3VtYmVyRXhwcmVzc2lvbkdlbmVyYXRvci5jcmVhdGVQYXJhbWV0ZXJUeXBlTWF0Y2hlcnMyID0gZnVuY3Rpb24gKHBhcmFtZXRlclR5cGUsIHRleHQpIHtcbiAgICAgICAgdmFyIGVfNCwgX2E7XG4gICAgICAgIC8vIFRPRE86IFtdLm1hcFxuICAgICAgICB2YXIgcmVzdWx0ID0gW107XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBmb3IgKHZhciBfYiA9IF9fdmFsdWVzKHBhcmFtZXRlclR5cGUucmVnZXhwU3RyaW5ncyksIF9jID0gX2IubmV4dCgpOyAhX2MuZG9uZTsgX2MgPSBfYi5uZXh0KCkpIHtcbiAgICAgICAgICAgICAgICB2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lbHNlIGlmIChjID09PSAnXScgJiYgIWVzY2FwaW5nKSB7XG4gICAgICAgICAgICAgICAgY2hhckNsYXNzID0gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmIChjID09PSAnKCcgJiYgIWVzY2FwaW5nICYmICFjaGFyQ2xhc3MpIHtcbiAgICAgICAgICAgICAgICBzdGFjay5wdXNoKG5ldyBHcm91cEJ1aWxkZXJfMS5kZWZhdWx0KCkpO1xuICAgICAgICAgICAgICAgIGdyb3VwU3RhcnRTdGFjay5wdXNoKG4gKyAxKTtcbiAgICAgICAgICAgICAgICBub25DYXB0dXJpbmdNYXliZSA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoYyA9PT0gJyknICYmICFlc2NhcGluZyAmJiAhY2hhckNsYXNzKSB7XG4gICAgICAgICAgICAgICAgdmFyIGdiID0gc3RhY2sucG9wKCk7XG4gICAgICAgICAgICAgICAgdmFyIGdyb3VwU3RhcnQgPSBncm91cFN0YXJ0U3RhY2sucG9wKCk7XG4gICAgICAgICAgICAgICAgaWYgKGdiLmNhcHR1cmluZykge1xuICAgICAgICAgICAgICAgICAgICBnYi5zb3VyY2UgPSBfdGhpcy5yZWdleHAuc291cmNlLnN1YnN0cmluZyhncm91cFN0YXJ0LCBuKTtcbiAgICAgICAgICAgICAgICAgICAgc3RhY2tbc3RhY2subGVuZ3RoIC0gMV0uYWRkKGdiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGdiLm1vdmVDaGlsZHJlblRvKHN0YWNrW3N0YWNrLmxlbmd0aCAtIDFdKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbm9uQ2FwdHVyaW5nTWF5YmUgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKGMgPT09ICc/JyAmJiBsYXN0ID09PSAnKCcpIHtcbiAgICAgICAgICAgICAgICBub25DYXB0dXJpbmdNYXliZSA9IHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmIChjID09PSAnOicgJiYgbm9uQ2FwdHVyaW5nTWF5YmUpIHtcbiAgICAgICAgICAgICAgICBzdGFja1tzdGFjay5sZW5ndGggLSAxXS5zZXROb25DYXB0dXJpbmcoKTtcbiAgICAgICAgICAgICAgICBub25DYXB0dXJpbmdNYXliZSA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZXNjYXBpbmcgPSBjID09PSAnXFxcXCcgJiYgIWVzY2FwaW5nO1xuICAgICAgICAgICAgbGFzdCA9IGM7XG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmdyb3VwQnVpbGRlciA9IHN0YWNrLnBvcCgpO1xuICAgIH1cbiAgICBUcmVlUmVnZXhwLnByb3RvdHlwZS5tYXRjaCA9IGZ1bmN0aW9uIChzKSB7XG4gICAgICAgIHZhciBtYXRjaCA9IHRoaXMucmVnZXguZXhlYyhzKTtcbiAgICAgICAgaWYgKCFtYXRjaCkge1xuICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGdyb3VwSW5kZXggPSAwO1xuICAgICAgICB2YXIgbmV4dEdyb3VwSW5kZXggPSBmdW5jdGlvbiAoKSB7IHJldHVybiBncm91cEluZGV4Kys7IH07XG4gICAgICAgIHJldHVybiB0aGlzLmdyb3VwQnVpbGRlci5idWlsZChtYXRjaCwgbmV4dEdyb3VwSW5kZXgpO1xuICAgIH07XG4gICAgcmV0dXJuIFRyZWVSZWdleHA7XG59KCkpO1xuZXhwb3J0cy5kZWZhdWx0ID0gVHJlZVJlZ2V4cDtcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPVRyZWVSZWdleHAuanMubWFwIiwiXCJ1c2Ugc3RyaWN0XCI7XG52YXIgX19pbXBvcnREZWZhdWx0ID0gKHRoaX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tcbiAgICAgICAgICAgIG9wZXJhdG9ycy5wdXNoKHRva2VuKTtcbiAgICAgICAgICAgIGV4cGVjdGVkVG9rZW5UeXBlID0gT1BFUkFORDtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmICgnKScgPT09IHRva2VuKSB7XG4gICAgICAgICAgICBjaGVjayhleHBlY3RlZFRva2VuVHlwZSwgT1BFUkFUT1IpO1xuICAgICAgICAgICAgd2hpbGUgKG9wZXJhdG9ycy5sZW5ndGggPiAwICYmIHBlZWsob3BlcmF0b3JzKSAhPT0gJygnKSB7XG4gICAgICAgICAgICAgICAgcHVzaEV4cHIocG9wKG9wZXJhdG9ycyksIGV4cHJlc3Npb25zKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChvcGVyYXRvcnMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1N5bnRheCBlcnJvci4gVW5tYXRjaGVkICknKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwZWVrKG9wZXJhdG9ycykgPT09ICcoJykge1xuICAgICAgICAgICAgICAgIHBvcChvcGVyYXRvcnMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZXhwZWN0ZWRUb2tlblR5cGUgPSBPUEVSQVRPUjtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIGNoZWNrKGV4cGVjdGVkVG9rZW5UeXBlLCBPUEVSQU5EKTtcbiAgICAgICAgICAgIHB1c2hFeHByKHRva2VuLCBleHByZXNzaW9ucyk7XG4gICAgICAgICAgICBleHBlY3RlZFRva2VuVHlwZSA9IE9QRVJBVE9SO1xuICAgICAgICB9XG4gICAgfSk7XG4gICAgd2hpbGUgKG9wZXJhdG9ycy5sZW5ndGggPiAwKSB7XG4gICAgICAgIGlmIChwZWVrKG9wZXJhdG9ycykgPT09ICcoJykge1xuICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1N5bnRheCBlcnJvci4gVW5tYXRjaGVkICgnKTtcbiAgICAgICAgfVxuICAgICAgICBwdXNoRXhwcihwb3Aob3BlcmF0b3JzKSwgZXhwcmVzc2lvbnMpO1xuICAgIH1cbiAgICByZXR1cm4gcG9wKGV4cHJlc3Npb25zKTtcbn1cbmV4cG9ydHMuZGVmYXVsdCA9IHBhcnNlO1xuZnVuY3Rpb24gdG9rZW5pemUoZXhwcikge1xuICAgIHZhciB0b2tlbnMgPSBbXTtcbiAgICB2YXIgaXNFc2NhcGVkID0gZmFsc2U7XG4gICAgdmFyIHRva2VuO1xuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgZXhwci5sZW5ndGg7IGkrKykge1xuICAgICAgICB2YXIgYyA9IGV4cHIuY2hhckF0KGkpO1xuICAgICAgICBpZiAoJ1xcXFwnID09PSBjKSB7XG4gICAgICAgICAgICBpc0VzY2FwZWQgPSB0cnVlO1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgaWYgKC9cXHMvLnRlc3QoYykpIHtcbiAgICAgICAgICAgICAgICAvLyBza2lwXG4gICAgICAgICAgICAgICAgaWYgKHRva2VuKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGVuZCBvZiB0b2tlblxuICAgICAgICAgICAgICAgICAgICB0b2tlbnMucHVzaCh0b2tlbi5qb2luKCcnKSk7XG4gICAgICAgICAgICAgICAgICAgIHRva2VuID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICgoYyA9PT0gJygnIHx8IGMgPT09ICcpJykgJiYgIWlzRXNjYXBlZCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAodG9rZW4pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGVuZCBvZiB0b2tlblxuICAgICAgICAgICAgICAgICAgICAgICAgdG9rZW5zLnB1c2godG9rZW4uam9pbignJykpO1xuICAg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ICAgICAgICAgICAgICB2YXIgZmlsZU5hbWUgPSBbJ2V2YWwnLCAnPGFub255bW91cz4nXS5pbmRleE9mKGxvY2F0aW9uUGFydHNbMF0pID4gLTEgPyB1bmRlZmluZWQgOiBsb2NhdGlvblBhcnRzWzBdO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBTdGFja0ZyYW1lKHtcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb25OYW1lOiBmdW5jdGlvbk5hbWUsXG4gICAgICAgICAgICAgICAgICAgIGZpbGVOYW1lOiBmaWxlTmFtZSxcbiAgICAgICAgICAgICAgICAgICAgbGluZU51bWJlcjogbG9jYXRpb25QYXJ0c1sxXSxcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uTnVtYmVyOiBsb2NhdGlvblBhcnRzWzJdLFxuICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGxpbmVcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0sIHRoaXMpO1xuICAgICAgICB9LFxuXG4gICAgICAgIHBhcnNlRkZPclNhZmFyaTogZnVuY3Rpb24gRXJyb3JTdGFja1BhcnNlciQkcGFyc2VGRk9yU2FmYXJpKGVycm9yKSB7XG4gICAgICAgICAgICB2YXIgZmlsdGVyZWQgPSBlcnJvci5zdGFjay5zcGxpdCgnXFxuJykuZmlsdGVyKGZ1bmN0aW9uKGxpbmUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gIWxpbmUubWF0Y2goU0FGQVJJX05BVElWRV9DT0RFX1JFR0VYUCk7XG4gICAgICAgICAgICB9LCB0aGlzKTtcblxuICAgICAgICAgICAgcmV0dXJuIGZpbHRlcmVkLm1hcChmdW5jdGlvbihsaW5lKSB7XG4gICAgICAgICAgICAgICAgLy8gVGhyb3cgYXdheSBldmFsIGluZm9ybWF0aW9uIHVudGlsIHdlIGltcGxlbWVudCBzdGFja3RyYWNlLmpzL3N0YWNrZnJhbWUjOFxuICAgICAgICAgICAgICAgIGlmIChsaW5lLmluZGV4T2YoJyA+IGV2YWwnKSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgICAgIGxpbmUgPSBsaW5lLnJlcGxhY2UoLyBsaW5lIChcXGQrKSg/OiA+IGV2YWwgbGluZSBcXGQrKSogPiBldmFsXFw6XFxkK1xcOlxcZCsvZywgJzokMScpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChsaW5lLmluZGV4T2YoJ0AnKSA9PT0gLTEgJiYgbGluZS5pbmRleE9mKCc6JykgPT09IC0xKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFNhZmFyaSBldmFsIGZyYW1lcyBvbmx5IGhhdmUgZnVuY3Rpb24gbmFtZXMgYW5kIG5vdGhpbmcgZWxzZVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFN0YWNrRnJhbWUoe1xuICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb25OYW1lOiBsaW5lXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBmdW5jdGlvbk5hbWVSZWdleCA9IC8oKC4qXCIuK1wiW15AXSopP1teQF0qKSg/OkApLztcbiAgICAgICAgICAgICAgICAgICAgdmFyIG1hdGNoZXMgPSBsaW5lLm1hdGNoKGZ1bmN0aW9uTmFtZVJlZ2V4KTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZ1bmN0aW9uTmFtZSA9IG1hdGNoZXMgJiYgbWF0Y2hlc1sxXSA/IG1hdGNoZXNbMV0gOiB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgIHZhciBsb2NhdGlvblBhcnRzID0gdGhpcy5leHRyYWN0TG9jYXRpb24obGluZS5yZXBsYWNlKGZ1bmN0aW9uTmFtZVJlZ2V4LCAnJykpO1xuXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgU3RhY2tGcmFtZSh7XG4gICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbk5hbWU6IGZ1bmN0aW9uTmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVOYW1lOiBsb2NhdGlvblBhcnRzWzBdLFxuICAgICAgICAgICAgICAgICAgICAgICAgbGluZU51bWJlcjogbG9jYXRpb25QYXJ0c1sxXSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbk51bWJlcjogbG9jYXRpb25QYXJ0c1syXSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogbGluZVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LCB0aGlzKTtcbiAgICAgICAgfSxcblxuICAgICAgICBwYXJzZU9wZXJhOiBmdW5jdGlvbiBFcnJvclN0YWNrUGFyc2VyJCRwYXJzZU9wZXJhKGUpIHtcbiAgICAgICAgICAgIGlmICghZS5zdGFja3RyYWNlIHx8IChlLm1lc3NhZ2UuaW5kZXhPZignXFxuJykgPiAtMSAmJlxuICAgICAgICAgICAgICAgIGUubWVzc2FnZS5zcGxpdCgnXFxuJykubGVuZ3RoID4gZS5zdGFja3RyYWNlLnNwbGl0KCdcXG4nKS5sZW5ndGgpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucGFyc2VPcGVyYTkoZSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKCFlLnN0YWNrKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucGFyc2VPcGVyYTEwKGUpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wYXJzZU9wZXJhMTEoZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG5cbiAgICAgICAgcGFyc2VPcGVyYTk6IGZ1bmN0aW9uIEVycm9yU3RhY2tQYXJzZXIkJHBhcnNlT3BlcmE5KGUpIHtcbiAgICAgICAgICAgIHZhciBsaW5lUkUgPSAvTGluZSAoXFxkKykuKnNjcmlwdCAoPzppbiApPyhcXFMrKS9pO1xuICAgICAgICAgICAgdmFyIGxpbmVzID0gZS5tZXNzYWdlLnNwbGl0KCdcXG4nKTtcbiAgICAgICAgICAgIHZhciByZXN1bHQgPSBbXTtcblxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDIsIGxlbiA9IGxpbmVzLmxlbmd0aDsgaSA8IGxlbjsgaSArPSAyKSB7XG4gICAgICAgICAgICAgICAgdmFyIG1hdGNoID0gbGluZVJFLmV4ZWMobGluZXNbaV0pO1xuICAgICAgICAgICAgICAgIGlmIChtYXRjaCkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChuZXcgU3RhY2tGcmFtZSh7XG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTogbWF0Y2hbMl0sXG4gICAgICAgICAgICAgICAgICAgICAgICBsaW5lTnVtYmVyOiBtYXRjaFsxXSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogbGluZXNbaV1cbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgICAgfSxcblxuICAgICAgICBwYXJzZU9wZXJhMTA6IGZ1bmN0aW9uIEVycm9yU3RhY2tQYXJzZXIkJHBhcnNlT3BlcmExMChlKSB7XG4gICAgICAgICAgICB2YXIgbGluZVJFID0gL0xpbmUgKFxcZCspLipzY3JpcHQgKD86aW4gKT8oXFxTKykoPzo6IEluIGZ1bmN0aW9uIChcXFMrKSk/JC9pO1xuICAgICAgICAgICAgdmFyIGxpbmVzID0gZS5zdGFja3RyYWNlLnNwbGl0KCdcXG4nKTtcbiAgICAgICAgICAgIHZhciByZXN1bHQgPSBbXTtcblxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IGxpbmVzLmxlbmd0aDsgaSA8IGxlbjsgaSArPSAyKSB7XG4gICAgICAgICAgICAgICAgdmFyIG1hdGNoID0gbGluZVJFLmV4ZWMobGluZXNbaV0pO1xuICAgICAgICAgICAgICAgIGlmIChtYXRjaCkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaChcbiAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBTdGFja0ZyYW1lKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbk5hbWU6IG1hdGNoWzNdIHx8IHVuZGVmaW5lZCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTogbWF0Y2hbMl0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZU51bWJlcjogbWF0Y2hbMV0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBsaW5lc1tpXVxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgIH0sXG5cbiAgICAgICAgLy8gT3BlcmEgMTAuNjUrIEVycm9yLnN0YWNrIHZlcnkgc2ltaWxhciB0byBGRi9TYWZhcmlcbiAgICAgICAgcGFyc2VPcGVyYTExOiBmdW5jdGlvbiBFcnJvclN0YWNrUGFyc2VyJCRwYXJzZU9wZXJhMTEoZXJyb3IpIHtcbiAgICAgICAgICAgIHZhciBmaWx0ZXJlZCA9IGVycm9yLnN0YWNrLnNwbGl0KCdcXG4nKS5maWx0ZXIoZnVuY3Rpb24obGluZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiAhIWxpbmUubWF0Y2goRklSRUZPWF9TQUZBUklfU1RBQ0tfUkVHRVhQKSAmJiAhbGluZS5tYXRjaCgvXkVycm9yIGNyZWF0ZWQgYXQvKTtcbiAgICAgICAgICAgIH0sIHRoaXMpO1xuXG4gICAgICAgICAgICByZXR1cm4gZmlsdGVyZWQubWFwKGZ1bmN0aW9uKGxpbmUpIHtcbiAgICAgICAgICAgICAgICB2YXIgdG9rZW5zID0gbGluZS5zcGxpdCgnQCcpO1xuICAgICAgICAgICAgICAgIHZhciBsb2NhdGlvblBhcnRzID0gdGhpcy5leHRyYWN0TG9jYXRpb24odG9rZW5zLnBvcCgpKTtcbiAgICAgICAgICAgICAgICB2YXIgZnVuY3Rpb25DYWxsID0gKHRva2Vucy5zaGlmdCgpIHx8ICcnKTtcbiAgICAgICAgICAgICAgICB2YXIgZnVuY3Rpb25OYW1lID0gZnVuY3Rpb25DYWxsXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvPGFub255bW91cyBmdW5jdGlvbig6IChcXHcrKSk/Pi8sICckMicpXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFwoW15cXCldKlxcKS9nLCAnJykgfHwgdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIHZhciBhcmdzUmF3O1xuICAgICAgICAgICAgICAgIGlmIChmdW5jdGlvbkNhbGwubWF0Y2goL1xcKChbXlxcKV0qKVxcKS8pKSB7XG4gICAgICAgICAgICAgICAgICAgIGFyZ3NSYXcgPSBmdW5jdGlvbkNhbGwucmVwbGFjZSgvXlteXFwoXStcXCgoW15cXCldKilcXCkkLywgJyQxJyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHZhciBhcmdzID0gKGFyZ3NSYXcgPT09IHVuZGVmaW5lZCB8fCBhcmdzUmF3ID09PSAnW2FyZ3VtZW50cyBub3QgYXZhaWxhYmxlXScpID9cbiAgICAgICAgICAgICAgICAgICAgdW5kZWZpbmVkIDogYXJnc1Jhdy5zcGxpdCgnLCcpO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBTdGFja0ZyYW1lKHtcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb25OYW1lOiBmdW5jdGlvbk5hbWUsXG4gICAgICAgICAgICAgICAg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oIWV2ZW50cylcbiAgICAgICAgcmV0dXJuIHRoaXM7XG5cbiAgICAgIC8vIG5vdCBsaXN0ZW5pbmcgZm9yIHJlbW92ZUxpc3RlbmVyLCBubyBuZWVkIHRvIGVtaXRcbiAgICAgIGlmICghZXZlbnRzLnJlbW92ZUxpc3RlbmVyKSB7XG4gICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgdGhpcy5fZXZlbnRzID0gb2JqZWN0Q3JlYXRlKG51bGwpO1xuICAgICAgICAgIHRoaXMuX2V2ZW50c0NvdW50ID0gMDtcbiAgICAgICAgfSBlbHNlIGlmIChldmVudHNbdHlwZV0pIHtcbiAgICAgICAgICBpZiAoLS10aGlzLl9ldmVudHNDb3VudCA9PT0gMClcbiAgICAgICAgICAgIHRoaXMuX2V2ZW50cyA9IG9iamVjdENyZWF0ZShudWxsKTtcbiAgICAgICAgICBlbHNlXG4gICAgICAgICAgICBkZWxldGUgZXZlbnRzW3R5cGVdO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuXG4gICAgICAvLyBlbWl0IHJlbW92ZUxpc3RlbmVyIGZvciBhbGwgbGlzdGVuZXJzIG9uIGFsbCBldmVudHNcbiAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgIHZhciBrZXlzID0gb2JqZWN0S2V5cyhldmVudHMpO1xuICAgICAgICB2YXIga2V5O1xuICAgICAgICBmb3IgKGkgPSAwOyBpIDwga2V5cy5sZW5ndGg7ICsraSkge1xuICAgICAgICAgIGtleSA9IGtleXNbaV07XG4gICAgICAgICAgaWYgKGtleSA9PT0gJ3JlbW92ZUxpc3RlbmVyJykgY29udGludWU7XG4gICAgICAgICAgdGhpcy5yZW1vdmVBbGxMaXN0ZW5lcnMoa2V5KTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnJlbW92ZUFsbExpc3RlbmVycygncmVtb3ZlTGlzdGVuZ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VudCc6IHRydWUsXG4gICAgJ3BpY2tsZSc6IHRydWVcbiAgfSwgdHlwZXMgfHwge30pXG5cbiAgcmVzdWx0ID0gW11cblxuICB0cnkge1xuICAgIGlmICh0eXBlc1snc291cmNlJ10pIHtcbiAgICAgIHJlc3VsdC5wdXNoKHtcbiAgICAgICAgdHlwZTogJ3NvdXJjZScsXG4gICAgICAgIHVyaTogdXJpLFxuICAgICAgICBkYXRhOiBkYXRhLFxuICAgICAgICBtZWRpYToge1xuICAgICAgICAgIGVuY29kaW5nOiAndXRmLTgnLFxuICAgICAgICAgIHR5cGU6ICd0ZXh0L3guY3VjdW1iZXIuZ2hlcmtpbitwbGFpbidcbiAgICAgICAgfVxuICAgICAgfSlcbiAgICB9XG5cbiAgICBpZiAoIXR5cGVzWydnaGVya2luLWRvY3VtZW50J10gJiYgIXR5cGVzWydwaWNrbGUnXSlcbiAgICAgIHJldHVybiByZXN1bHRcblxuICAgIHZhciBnaGVya2luRG9jdW1lbnQgPSBwYXJzZXIucGFyc2UoZGF0YSwgbGFuZ3VhZ2UpXG5cbiAgICBpZiAodHlwZXNbJ2doZXJraW4tZG9jdW1lbnQnXSkge1xuICAgICAgcmVzdWx0LnB1c2goe1xuICAgICAgICB0eXBlOiAnZ2hlcmtpbi1kb2N1bWVudCcsXG4gICAgICAgIHVyaTogdXJpLFxuICAgICAgICBkb2N1bWVudDogZ2hlcmtpbkRvY3VtZW50XG4gICAgICB9KVxuICAgIH1cblxuICAgIGlmICh0eXBlc1sncGlja2xlJ10pIHtcbiAgICAgIHZhciBwaWNrbGVzID0gY29tcGlsZXIuY29tcGlsZShnaGVya2luRG9jdW1lbnQpXG4gICAgICBmb3IgKHZhciBwIGluIHBpY2tsZXMpIHtcbiAgICAgICAgcmVzdWx0LnB1c2goe1xuICAgICAgICAgIHR5cGU6ICdwaWNrbGUnLFxuICAgICAgICAgIHVyaTogdXJpLFxuICAgICAgICAgIHBpY2tsZTogcGlja2xlc1twXVxuICAgICAgICB9KVxuIC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IlNpaXMgXCJcbiAgICBdLFxuICAgIFwid2hlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIkt1aSBcIlxuICAgIF1cbiAgfSxcbiAgXCJmYVwiOiB7XG4gICAgXCJhbmRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLZiCBcIlxuICAgIF0sXG4gICAgXCJiYWNrZ3JvdW5kXCI6IFtcbiAgICAgIFwi2LLZhduM2YbZh1wiXG4gICAgXSxcbiAgICBcImJ1dFwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcItin2YXYpyBcIlxuICAgIF0sXG4gICAgXCJleGFtcGxlc1wiOiBbXG4gICAgICBcItmG2YXZiNmG2Ycg2YfYp1wiXG4gICAgXSxcbiAgICBcImZlYXR1cmVcIjogW1xuICAgICAgXCLZiNmQ24zamNqv24xcIlxuICAgIF0sXG4gICAgXCJnaXZlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcItio2Kcg2YHYsdi2IFwiXG4gICAgXSxcbiAgICBcIm5hbWVcIjogXCJQZXJzaWFuXCIsXG4gICAgXCJuYXRpdmVcIjogXCLZgdin2LHYs9uMXCIsXG4gICAgXCJzY2VuYXJpb1wiOiBbXG4gICAgICBcItiz2YbYp9ix24zZiFwiXG4gICAgXSxcbiAgICBcInNjZW5hcmlvT3V0bGluZVwiOiBbXG4gICAgICBcItin2YTar9mI24wg2LPZhtin2LHbjNmIXCJcbiAgICBdLFxuICAgIFwidGhlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcItii2Ybar9in2YcgXCJcbiAgICBdLFxuICAgIFwid2hlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcItmH2Ybar9in2YXbjCBcIlxuICAgIF1cbiAgfSxcbiAgXCJmaVwiOiB7XG4gICAgXCJhbmRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCJKYSBcIlxuICAgIF0sXG4gICAgXCJiYWNrZ3JvdW5kXCI6IFtcbiAgICAgIFwi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cbiAgICBcImJ1dFwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIteQ15HXnCBcIlxuICAgIF0sXG4gICAgXCJleGFtcGxlc1wiOiBbXG4gICAgICBcIteT15XXktee15DXldeqXCJcbiAgICBdLFxuICAgIFwiZmVhdHVyZVwiOiBbXG4gICAgICBcIteq15vXldeg15RcIlxuICAgIF0sXG4gICAgXCJnaXZlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIteR15TXmdeg16rXnyBcIlxuICAgIF0sXG4gICAgXCJuYW1lXCI6IFwiSGVicmV3XCIsXG4gICAgXCJuYXRpdmVcIjogXCLXoteR16jXmdeqXCIsXG4gICAgXCJzY2VuYXJpb1wiOiBbXG4gICAgICBcIteq16jXl9eZ16lcIlxuICAgIF0sXG4gICAgXCJzY2VuYXJpb091dGxpbmVcIjogW1xuICAgICAgXCLXqteR16DXmdeqINeq16jXl9eZ16lcIlxuICAgIF0sXG4gICAgXCJ0aGVuXCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwi15DXliBcIixcbiAgICAgIFwi15DXlteZIFwiXG4gICAgXSxcbiAgICBcIndoZW5cIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLXm9eQ16nXqCBcIlxuICAgIF1cbiAgfSxcbiAgXCJoaVwiOiB7XG4gICAgXCJhbmRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLgpJTgpLAgXCIsXG4gICAgICBcIuCkpOCkpeCkviBcIlxuICAgIF0sXG4gICAgXCJiYWNrZ3JvdW5kXCI6IFtcbiAgICAgIFwi4KSq4KWD4KS34KWN4KSg4KSt4KWC4KSu4KS/XCJcbiAgICBdLFxuICAgIFwiYnV0XCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwi4KSq4KSwIFwiLFxuICAgICAgXCLgpKrgpLDgpKjgpY3gpKTgpYEgXCIsXG4gICAgICBcIuCkleCkv+CkqOCljeCkpOClgSBcIlxuICAgIF0sXG4gICAgXCJle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BcImFuZFwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIuOBi+OBpFwiXG4gICAgXSxcbiAgICBcImJhY2tncm91bmRcIjogW1xuICAgICAgXCLog4zmma9cIlxuICAgIF0sXG4gICAgXCJidXRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLjgZfjgYvjgZdcIixcbiAgICAgIFwi5L2G44GXXCIsXG4gICAgICBcIuOBn+OBoOOBl1wiXG4gICAgXSxcbiAgICBcImV4YW1wbGVzXCI6IFtcbiAgICAgIFwi5L6LXCIsXG4gICAgICBcIuOCteODs+ODl+ODq1wiXG4gICAgXSxcbiAgICBcImZlYXR1cmVcIjogW1xuICAgICAgXCLjg5XjgqPjg7zjg4Hjg6NcIixcbiAgICAgIFwi5qmf6IO9XCJcbiAgICBdLFxuICAgIFwiZ2l2ZW5cIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLliY3mj5BcIlxuICAgIF0sXG4gICAgXCJuYW1lXCI6IFwiSmFwYW5lc2VcIixcbiAgICBcIm5hdGl2ZVwiOiBcIuaXpeacrOiqnlwiLFxuICAgIFwic2NlbmFyaW9cIjogW1xuICAgICAgXCLjgrfjg4rjg6rjgqpcIlxuICAgIF0sXG4gICAgXCJzY2VuYXJpb091dGxpbmVcIjogW1xuICAgICAgXCLjgrfjg4rjg6rjgqrjgqLjgqbjg4jjg6njgqTjg7NcIixcbiAgICAgIFwi44K344OK44Oq44Kq44OG44Oz44OX44Os44O844OIXCIsXG4gICAgICBcIuODhuODs+ODl+ODrFwiLFxuICAgICAgXCLjgrfjg4rjg6rjgqrjg4bjg7Pjg5fjg6xcIlxuICAgIF0sXG4gICAgXCJ0aGVuXCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwi44Gq44KJ44GwXCJcbiAgICBdLFxuICAgIFwid2hlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIuOCguOBl1wiXG4gICAgXVxuICB9LFxuICBcImp2XCI6IHtcbiAgICBcIm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4gICAgXCJleGFtcGxlc1wiOiBbXG4gICAgICBcIuyYiFwiXG4gICAgXSxcbiAgICBcImZlYXR1cmVcIjogW1xuICAgICAgXCLquLDriqVcIlxuICAgIF0sXG4gICAgXCJnaXZlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIuyhsOqxtFwiLFxuICAgICAgXCLrqLzsoIBcIlxuICAgIF0sXG4gICAgXCJuYW1lXCI6IFwiS29yZWFuXCIsXG4gICAgXCJuYXRpdmVcIjogXCLtlZzqta3slrRcIixcbiAgICBcInNjZW5hcmlvXCI6IFtcbiAgICAgIFwi7Iuc64KY66as7JikXCJcbiAgICBdLFxuICAgIFwic2NlbmFyaW9PdXRsaW5lXCI6IFtcbiAgICAgIFwi7Iuc64KY66as7JikIOqwnOyalFwiXG4gICAgXSxcbiAgICBcInRoZW5cIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLqt7jrn6zrqbRcIlxuICAgIF0sXG4gICAgXCJ3aGVuXCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwi66eM7J28XCIsXG4gICAgICBcIuunjOyVvVwiXG4gICAgXVxuICB9LFxuICBcImx0XCI6IHtcbiAgICBcImFuZFwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIklyIFwiXG4gICAgXSxcbiAgICBcImJhY2tncm91bmRcIjogW1xuICAgICAgXCJLb250ZWtzdGFzXCJcbiAgICBdLFxuICAgIFwiYnV0XCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwiQmV0IFwiXG4gICAgXSxcbiAgICBcImV4YW1wbGVzXCI6IFtcbiAgICAgIFwiUGF2eXpkxb5pYWlcIixcbiAgICAgIFwiU2NlbmFyaWphaVwiLFxuICAgICAgXCJWYXJpYW50YWlcIlxuICAgIF0sXG4gICAgXCJmZWF0dXJlXCI6IFtcbiAgICAgIFwiU2F2eWLEl1wiXG4gICAgXSxcbiAgICBcImdpdmVuXCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAg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dHVuY2kgXCJcbiAgICBdLFxuICAgIFwid2hlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIkNhbmQgXCIsXG4gICAgICBcIkPDom5kIFwiXG4gICAgXVxuICB9LFxuICBcInJ1XCI6IHtcbiAgICBcImFuZFwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcItCYIFwiLFxuICAgICAgXCLQmiDRgtC+0LzRgyDQttC1IFwiLFxuICAgICAgXCLQotCw0LrQttC1IFwiXG4gICAgXSxcbiAgICBcImJhY2tncm91bmRcIjogW1xuICAgICAgXCLQn9GA0LXQtNGL0YHRgtC+0YDQuNGPXCIsXG4gICAgICBcItCa0L7QvdGC0LXQutGB0YJcIlxuICAgIF0sXG4gICAgXCJidXRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLQndC+IFwiLFxuICAgICAgXCLQkCBcIlxuICAgIF0sXG4gICAgXCJleGFtcGxlc1wiOiBbXG4gICAgICBcItCf0YDQuNC80LXRgNGLXCJcbiAgICBdLFxuICAgIFwiZmVhdHVyZVwiOiBbXG4gICAgICBcItCk0YPQvdC60YbQuNGPXCIsXG4gICAgICBcItCk0YPQvdC60YbQuNC+0L3QsNC70YzQvdC+0YHRgtGMXCIsXG4gICAgICBcItCk0YPQvdC60YbQuNC+0L3QsNC7XCIsXG4gICAgICBcItCh0LLQvtC50YHRgtCy0L5cIlxuICAgIF0sXG4gICAgXCJnaXZlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcItCU0L7Qv9GD0YHRgtC40LwgXCIsXG4gICAgICBcItCU0LDQvdC+IFwiLFxuICAgICAgXCLQn9GD0YHRgtGMIFwiLFxuICAgICAgXCLQldGB0LvQuCBcIlxuICAgIF0sXG4gICAgXCJuYW1lXCI6IFwiUnVzc2lhblwiLFxuICAgIFwibmF0aXZlXCI6IFwi0YDRg9GB0YHQutC40LlcIixcbiAgICBcInNjZW5hcmlvXCI6IFtcbiAgICAgIFwi0KHRhtC10L3QsNGA0LjQ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+CvgeCuleCus+CvjVwiLFxuICAgICAgXCLgrpXgrr7grp/gr43grprgrr/grpXgrrPgr41cIixcbiAgICAgIFwiIOCuqOCuv+CusuCviOCuruCviOCuleCus+Cuv+CusuCvjVwiXG4gICAgXSxcbiAgICBcImZlYXR1cmVcIjogW1xuICAgICAgXCLgroXgrq7gr43grprgrq7gr41cIixcbiAgICAgIFwi4K614K6j4K6/4K6VIOCupOCvh+CuteCviFwiLFxuICAgICAgXCLgrqTgrr/grrHgrqngr41cIlxuICAgIF0sXG4gICAgXCJnaXZlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIuCuleCvhuCuvuCun+CvgeCuleCvjeCuleCuquCvjeCuquCun+CvjeCunyBcIlxuICAgIF0sXG4gICAgXCJuYW1lXCI6IFwiVGFtaWxcIixcbiAgICBcIm5hdGl2ZVwiOiBcIuCupOCuruCuv+CutOCvjVwiLFxuICAgIFwic2NlbmFyaW9cIjogW1xuICAgICAgXCLgrpXgrr7grp/gr43grprgrr9cIlxuICAgIF0sXG4gICAgXCJzY2VuYXJpb091dGxpbmVcIjogW1xuICAgICAgXCLgrpXgrr7grp/gr43grprgrr8g4K6a4K+B4K6w4K+B4K6V4K+N4K6V4K6u4K+NXCIsXG4gICAgICBcIuCuleCuvuCun+CvjeCumuCuvyDgrrXgrr7grrDgr43grqrgr43grqrgr4HgrrDgr4FcIlxuICAgIF0sXG4gICAgXCJ0aGVuXCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwi4K6F4K6q4K+N4K6q4K+G4K6+4K604K+B4K6k4K+BIFwiXG4gICAgXSxcbiAgICBcIndoZW5cIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLgro7grqrgr43grqrgr4fgrr7grqTgr4EgXCJcbiAgICBdXG4gIH0sXG4gIFwidGhcIjoge1xuICAgIFwiYW5kXCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwi4LmB4Lil4LiwIFwiXG4gICAgXSxcbiAgICBcImJhY2tncm91bmRcIjogW1xuICAgICAgXCLguYHguJnguKfguITguLTguJRcIlxuICAgIF0sXG4gICAgXCJidXRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLguYHguJXguYggXCJcbiAgICBdLFxuICAgIFwiZXhhbXBsZXNcIjogW1xuICAgICAgXCLguIrguLjguJTguILguK3guIfguJXguLHguKfguK3guKLguYjguLLguIdcIixcbiAgICAgIFwi4LiK4Li44LiU4LiC4Lit4LiH4LmA4Lir4LiV4Li44LiB4Liy4Lij4LiT4LmMXCJcbiAgICBdLFxuICAgIFwiZmVhdHVyZVwiOiBbXG4gICAgICBcIuC5guC4hOC4o+C4h+C4q+C4peC4seC4gVwiLFxuICAgICAgXCLguITguKfguLLguKHguJXguYnguK3guIfguIHguLLguKPguJfguLLguIfguJjguLjguKPguIHguLTguIhcIixcbiAgICAgIFwi4LiE4Lin4Liy4Lih4Liq4Liy4Lih4Liy4Lij4LiWXCJcbiAgICBdLFxuICAgIFwiZ2l2ZW5cIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLguIHguLPguKvguJnguJTguYPguKvguYkgXCJcbiAgICBdLFxuICAgIFwibmFtZVwiOiBcIlRoYWlcIixcbiAgICBcIm5hdGl2ZVwiOiBcIuC5hOC4l+C4olwiLFxuICAgIFwic2NlbmFyaW9cIjogW1xuICAgICAgXCLguYDguKvguJXguLjguIHguLLguKPguJPguYxcIlxuICAgIF0sXG4gICAgXCJzY2VuYXJpb091dGxpbmVcIjogW1xuICAgICAgXCLguKrguKPguLjguJvguYDguKvguJXguLjguIHguLLguKPguJPguYxcIixcbiAgICAgIFwi4LmC4LiE4Lij4LiH4Liq4Lij4LmJ4Liy4LiH4LiC4Lit4LiH4LmA4Lir4LiV4Li44LiB4Liy4Lij4LiT4LmMXCJcbiAgICBdLFxuICAgIFwidGhlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIuC4lOC4seC4h+C4meC4seC5ieC4mSBcIlxuICAgIF0sXG4gICAgXCJ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4LCk4LC/4LCy4LGLIFwiXG4gICAgXVxuICB9LFxuICBcInRsaFwiOiB7XG4gICAgXCJhbmRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCInZWogXCIsXG4gICAgICBcImxhdGxoIFwiXG4gICAgXSxcbiAgICBcImJhY2tncm91bmRcIjogW1xuICAgICAgXCJtbydcIlxuICAgIF0sXG4gICAgXCJidXRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCInYWNoIFwiLFxuICAgICAgXCInYSBcIlxuICAgIF0sXG4gICAgXCJleGFtcGxlc1wiOiBbXG4gICAgICBcImdoYW50b0hcIixcbiAgICAgIFwibHV0bWV5XCJcbiAgICBdLFxuICAgIFwiZmVhdHVyZVwiOiBbXG4gICAgICBcIlFhcFwiLFxuICAgICAgXCJRdSdtZUggJ3V0XCIsXG4gICAgICBcInBlcmJvZ2hcIixcbiAgICAgIFwicG9RYm9naCBtYWxqYSdcIixcbiAgICAgIFwibGFIXCJcbiAgICBdLFxuICAgIFwiZ2l2ZW5cIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCJnaHUnIG5vYmx1JyBcIixcbiAgICAgIFwiRGFIIGdodScgYmVqbHUnIFwiXG4gICAgXSxcbiAgICBcIm5hbWVcIjogXCJLbGluZ29uXCIsXG4gICAgXCJuYXRpdmVcIjogXCJ0bGhJbmdhblwiLFxuICAgIFwic2NlbmFyaW9cIjogW1xuICAgICAgXCJsdXRcIlxuICAgIF0sXG4gICAgXCJzY2VuYXJpb091dGxpbmVcIjogW1xuICAgICAgXCJsdXQgY2hvdm5hdGxoXCJcbiAgICBdLFxuICAgIFwidGhlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcInZhaiBcIlxuICAgIF0sXG4gICAgXCJ3aGVuXCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwicWFTREknIFwiXG4gICAgXVxuICB9LFxuICBcInRyXCI6IHtcbiAgICBcImFuZFwiOiBbXG4gICAgICBcIiogXCIsXG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AgXCJleGFtcGxlc1wiOiBbXG4gICAgICBcItmF2KvYp9mE24zaulwiXG4gICAgXSxcbiAgICBcImZlYXR1cmVcIjogW1xuICAgICAgXCLYtdmE2KfYrduM2KpcIixcbiAgICAgIFwi2qnYp9ix2YjYqNin2LEg2qnbjCDYttix2YjYsdiqXCIsXG4gICAgICBcItiu2LXZiNi124zYqlwiXG4gICAgXSxcbiAgICBcImdpdmVuXCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwi2Kfar9ixIFwiLFxuICAgICAgXCLYqNin2YTZgdix2LYgXCIsXG4gICAgICBcItmB2LHYtiDaqduM2KcgXCJcbiAgICBdLFxuICAgIFwibmFtZVwiOiBcIlVyZHVcIixcbiAgICBcIm5hdGl2ZVwiOiBcItin2LHYr9mIXCIsXG4gICAgXCJzY2VuYXJpb1wiOiBbXG4gICAgICBcItmF2YbYuNix2YbYp9mF24FcIlxuICAgIF0sXG4gICAgXCJzY2VuYXJpb091dGxpbmVcIjogW1xuICAgICAgXCLZhdmG2LjYsSDZhtin2YXbkiDaqdinINiu2KfaqduBXCJcbiAgICBdLFxuICAgIFwidGhlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcItm+2r7YsSBcIixcbiAgICAgIFwi2KrYqCBcIlxuICAgIF0sXG4gICAgXCJ3aGVuXCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwi2KzYqCBcIlxuICAgIF1cbiAgfSxcbiAgXCJ1elwiOiB7XG4gICAgXCJhbmRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLQktCwIFwiXG4gICAgXSxcbiAgICBcImJhY2tncm91bmRcIjogW1xuICAgICAgXCLQotCw0YDQuNGFXCJcbiAgICBdLFxuICAgIFwiYnV0XCI6IFtcbiAgICAgIFwiKiBcIixcbiAgICAgIFwi0JvQtdC60LjQvSBcIixcbiAgICAgIFwi0JHQuNGA0L7QuiBcIixcbiAgICAgIFwi0JDQvNC80L4gXCJcbiAgICBdLFxuICAg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BcIkJp4bq/dCBcIixcbiAgICAgIFwiQ2hvIFwiXG4gICAgXSxcbiAgICBcIm5hbWVcIjogXCJWaWV0bmFtZXNlXCIsXG4gICAgXCJuYXRpdmVcIjogXCJUaeG6v25nIFZp4buHdFwiLFxuICAgIFwic2NlbmFyaW9cIjogW1xuICAgICAgXCJUw6xuaCBodeG7kW5nXCIsXG4gICAgICBcIkvhu4tjaCBi4bqjblwiXG4gICAgXSxcbiAgICBcInNjZW5hcmlvT3V0bGluZVwiOiBbXG4gICAgICBcIktodW5nIHTDrG5oIGh14buRbmdcIixcbiAgICAgIFwiS2h1bmcga+G7i2NoIGLhuqNuXCJcbiAgICBdLFxuICAgIFwidGhlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIlRow6wgXCJcbiAgICBdLFxuICAgIFwid2hlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIktoaSBcIlxuICAgIF1cbiAgfSxcbiAgXCJ6aC1DTlwiOiB7XG4gICAgXCJhbmRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLogIzkuJRcIixcbiAgICAgIFwi5bm25LiUXCIsXG4gICAgICBcIuWQjOaXtlwiXG4gICAgXSxcbiAgICBcImJhY2tncm91bmRcIjogW1xuICAgICAgXCLog4zmma9cIlxuICAgIF0sXG4gICAgXCJidXRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLkvYbmmK9cIlxuICAgIF0sXG4gICAgXCJleGFtcGxlc1wiOiBbXG4gICAgICBcIuS+i+WtkFwiXG4gICAgXSxcbiAgICBcImZlYXR1cmVcIjogW1xuICAgICAgXCLlip/og71cIlxuICAgIF0sXG4gICAgXCJnaXZlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIuWBh+WmglwiLFxuICAgICAgXCLlgYforr5cIixcbiAgICAgIFwi5YGH5a6aXCJcbiAgICBdLFxuICAgIFwibmFtZVwiOiBcIkNoaW5lc2Ugc2ltcGxpZmllZFwiLFxuICAgIFwibmF0aXZlXCI6IFwi566A5L2T5Lit5paHXCIsXG4gICAgXCJzY2VuYXJpb1wiOiBbXG4gICAgICBcIuWcuuaZr1wiLFxuICAgICAgXCLliafmnKxcIlxuICAgIF0sXG4gICAgXCJzY2VuYXJpb091dGxpbmVcIjogW1xuICAgICAgXCLlnLrmma/lpKfnurJcIixcbiAgICAgIFwi5Ymn5pys5aSn57qyXCJcbiAgICBdLFxuICAgIFwidGhlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIumCo+S5iFwiXG4gICAgXSxcbiAgICBcIndoZW5cIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLlvZNcIlxuICAgIF1cbiAgfSxcbiAgXCJ6aC1UV1wiOiB7XG4gICAgXCJhbmRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLogIzkuJRcIixcbiAgICAgIFwi5Lim5LiUXCIsXG4gICAgICBcIuWQjOaZglwiXG4gICAgXSxcbiAgICBcImJhY2tncm91bmRcIjogW1xuICAgICAgXCLog4zmma9cIlxuICAgIF0sXG4gICAgXCJidXRcIjogW1xuICAgICAgXCIqIFwiLFxuICAgICAgXCLkvYbmmK9cIlxuICAgIF0sXG4gICAgXCJleGFtcGxlc1wiOiBbXG4gICAgICBcIuS+i+WtkFwiXG4gICAgXSxcbiAgICBcImZlYXR1cmVcIjogW1xuICAgICAgXCLlip/og71cIlxuICAgIF0sXG4gICAgXCJnaXZlblwiOiBbXG4gICAgICBcIiogXCIsXG4gICAgICBcIuWBh+WmglwiLFxuICAgICAgXCLlgYfoqK1cIixcbiAgICAgIFwi5YGH5a6aXCJcbiAgICBdLFxuICAgIFwibmFtZVwiOiBcIkNoaW5lc2UgdHJhZGl0aW9uYWxcIixcbiAgICBcIm5hdGl2ZVwiOiBcIue5gemrlOS4reaWh1wiLFxuICAgIFwic2NlbmFyaW9cIjogW1xuICAgICAgXCLloLTmma9cIixcbiAgICAgIFwi5YqH5pysXCJcbiAgICBdLFxuICAgIFwic2Nlb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b2NhdGlvbihzY2VuYXJpb091dGxpbmUubG9jYXRpb24pXG4gICAgICAgICAgXVxuICAgICAgICB9O1xuICAgICAgICBwaWNrbGVzLnB1c2gocGlja2xlKTtcblxuICAgICAgfSk7XG4gICAgfSk7XG4gIH1cblxuICBmdW5jdGlvbiBjcmVhdGVQaWNrbGVBcmd1bWVudHMoYXJndW1lbnQsIHZhcmlhYmxlQ2VsbHMsIHZhbHVlQ2VsbHMpIHtcbiAgICB2YXIgcmVzdWx0ID0gW107XG4gICAgaWYgKCFhcmd1bWVudCkgcmV0dXJuIHJlc3VsdDtcbiAgICBpZiAoYXJndW1lbnQudHlwZSA9PT0gJ0RhdGFUYWJsZScpIHtcbiAgICAgIHZhciB0YWJsZSA9IHtcbiAgICAgICAgcm93czogYXJndW1lbnQucm93cy5tYXAoZnVuY3Rpb24gKHJvdykge1xuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBjZWxsczogcm93LmNlbGxzLm1hcChmdW5jdGlvbiAoY2VsbCkge1xuICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIGxvY2F0aW9uOiBwaWNrbGVMb2NhdGlvbihjZWxsLmxvY2F0aW9uKSxcbiAgICAgICAgICAgICAgICB2YWx1ZTogaW50ZXJwb2xhdGUoY2VsbC52YWx1ZSwgdmFyaWFibGVDZWxscywgdmFsdWVDZWxscylcbiAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgfTtcbiAgICAgICAgfSlcbiAgICAgIH07XG4gICAgICByZXN1bHQucHVzaCh0YWJsZSk7XG4gICAgfSBlbHNlIGlmIChhcmd1bWVudC50eXBlID09PSAnRG9jU3RyaW5nJykge1xuICAgICAgdmFyIGRvY1N0cmluZyA9IHtcbiAgICAgICAgbG9jYXRpb246IHBpY2tsZUxvY2F0aW9uKGFyZ3VtZW50LmxvY2F0aW9uKSxcbiAgICAgICAgY29udGVudDogaW50ZXJwb2xhdGUoYXJndW1lbnQuY29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W4ocGF0aCwgY29uc3RhbnRzLk9fU1lNTElOSywgZnVuY3Rpb24gKGVyLCBmZCkge1xuICAgICAgICAgIGlmIChlcikge1xuICAgICAgICAgICAgaWYgKGNiKSBjYihlcilcbiAgICAgICAgICAgIHJldHVyblxuICAgICAgICAgIH1cbiAgICAgICAgICBmcy5mdXRpbWVzKGZkLCBhdCwgbXQsIGZ1bmN0aW9uIChlcikge1xuICAgICAgICAgICAgZnMuY2xvc2UoZmQsIGZ1bmN0aW9uIChlcjIpIHtcbiAgICAgICAgICAgICAgaWYgKGNiKSBjYihlciB8fCBlcjIpXG4gICAgICAgICAgICB9KVxuICAgICAgICAgIH0pXG4gICAgICAgIH0pXG4gICAgICB9XG5cbiAgICAgIGZzLmx1dGltZXNTeW5jID0gZnVuY3Rpb24gKHBhdGgsIGF0LCBtdCkge1xuICAgICAgICB2YXIgZmQgPSBmcy5vcGVuU3luYyhwYXRoLCBjb25zdGFudHMuT19TWU1MSU5LKVxuICAgICAgICB2YXIgcmV0XG4gICAgICAgIHZhciB0aHJldyA9IHRydWVcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICByZXQgPSBmcy5mdXRpbWVzU3luYyhmZCwgYXQsIG10KVxuICAgICAgICAgIHRocmV3ID0gZmFsc2VcbiAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICBpZiAodGhyZXcpIHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgIGZzLmNsb3NlU3luYyhmZClcbiAgICAgICAgICAgIH0gY2F0Y2ggKGVyKSB7fVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBmcy5jbG9zZVN5bmMoZmQpXG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXRcbiAgICAgIH1cblxuICAgIH0gZWxzZSB7XG4gICAgICBmcy5sdXRpbWVzID0gZnVuY3Rpb24gKF9hLCBfYiwgX2MsIGNiKSB7IGlmIChjYikgcHJvY2Vzcy5uZXh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VBcG9zID0gUmVnRXhwKHJzQXBvcywgJ2cnKTtcblxuICAvKipcbiAgICogVXNlZCB0byBtYXRjaCBbY29tYmluaW5nIGRpYWNyaXRpY2FsIG1hcmtzXShodHRwczovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9Db21iaW5pbmdfRGlhY3JpdGljYWxfTWFya3MpIGFuZFxuICAgKiBbY29tYmluaW5nIGRpYWNyaXRpY2FsIG1hcmtzIGZvciBzeW1ib2xzXShodHRwczovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9Db21iaW5pbmdfRGlhY3JpdGljYWxfTWFya3NfZm9yX1N5bWJvbHMpLlxuICAgKi9cbiAgdmFyIHJlQ29tYm9NYXJrID0gUmVnRXhwKHJzQ29tYm8sICdnJyk7XG5cbiAgLyoqIFVzZWQgdG8gbWF0Y2ggW3N0cmluZyBzeW1ib2xzXShodHRwczovL21hdGhpYXNieW5lbnMuYmUvbm90ZXMvamF2YXNjcmlwdC11bmljb2RlKS4gKi9cbiAgdmFyIHJlVW5pY29kZSA9IFJlZ0V4cChyc0ZpdHogKyAnKD89JyArIHJzRml0eiArICcpfCcgKyByc1N5bWJvbCArIHJzU2VxLCAnZycpO1xuXG4gIC8qKiBVc2VkIHRvIG1hdGNoIGNvbXBsZXggb3IgY29tcG91bmQgd29yZHMuICovXG4gIHZhciByZVVuaWNvZGVXb3JkID0gUmVnRXhwKFtcbiAgICByc1VwcGVyICsgJz8nICsgcnNMb3dlciArICcrJyArIHJzT3B0Q29udHJMb3dlciArICcoPz0nICsgW3JzQnJlYWssIHJzVXBwZXIsICckJ10uam9pbignfCcpICsgJyknLFxuICAgIHJzTWlzY1VwcGVyICsgJysnICsgcnNPcHRDb250clVwcGVyICsgJyg/PScgKyBbcnNCcmVhaywgcnNVcHBlciArIHJzTWlzY0xvd2VyLCAnJCddLmpvaW4oJ3wnKSArICcpJyxcbiAgICByc1VwcGVyICsgJz8nICsgcnNNaXNjTG93ZXIgKyAnKycgKyByc09wdENvbnRyTG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xuICAgICAgICAgIHJlc3VsdCA9IHNraXBJbmRleGVzID8gYmFzZVRpbWVzKHZhbHVlLmxlbmd0aCwgU3RyaW5nKSA6IFtdLFxuICAgICAgICAgIGxlbmd0aCA9IHJlc3VsdC5sZW5ndGg7XG5cbiAgICAgIGZvciAodmFyIGtleSBpbiB2YWx1ZSkge1xuICAgICAgICBpZiAoKGluaGVyaXRlZCB8fCBoYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrZXkpKSAmJlxuICAgICAgICAgICAgIShza2lwSW5kZXhlcyAmJiAoXG4gICAgICAgICAgICAgICAvLyBTYWZhcmkgOSBoYXMgZW51bWVyYWJsZSBgYXJndW1lbnRzLmxlbmd0aGAgaW4gc3RyaWN0IG1vZGUuXG4gICAgICAgICAgICAgICBrZXkgPT0gJ2xlbmd0aCcgfHxcbiAgICAgICAgICAgICAgIC8vIE5vZGUuanMgMC4xMCBoYXMgZW51bWVyYWJsZSBub24taW5kZXggcHJvcGVydGllcyBvbiBidWZmZXJzLlxuICAgICAgICAgICAgICAgKGlzQnVmZiAmJiAoa2V5ID09ICdvZmZzZXQnIHx8IGtleSA9PSAncGFyZW50JykpIHx8XG4gICAgICAgICAgICAgICAvLyBQaGFudG9tSlMgMiBoYXMgZW51bWVyYWJsZSBub24taW5kZXggcHJvcGVydGllcyBvbiB0eXBlZCBhcnJheXMuXG4gICAgICAgICAgICAgICAoaXNUeXBlICYmIChrZXkgPT0gJ2J1ZmZlcicgfHwga2V5ID09ICdieXRlTGVuZ3RoJyB8fCBrZXkgPT0gJ2J5dGVPZmZzZXQnKSkgfHxcbiAgICAgICAgICAgICAgIC8vIFNraXAgaW5kZXggcHJvcGVydGllcy5cbiAgICAgICAgICAgICAgIGlzSW5kZXgoa2V5LCBsZW5ndGgpXG4gICAgICAgICAgICApKSkge1xuICAgICAgICAgIHJlc3VsdC5wdXNoKGtleSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQ7XG4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4XSxcbiAgICAgICAgICAgIGNvbXB1dGVkID0gaXRlcmF0ZWUgPyBpdGVyYXRlZSh2YWx1ZSkgOiB2YWx1ZTtcblxuICAgICAgICB2YWx1ZSA9IChjb21wYXJhdG9yIHx8IHZhbHVlICE9PSAwKSA/IHZhbHVlIDogMDtcbiAgICAgICAgaWYgKCEoc2VlblxuICAgICAgICAgICAgICA/IGNhY2hlSGFzKHNlZW4sIGNvbXB1dGVkKVxuICAgICAgICAgICAgICA6IGluY2x1ZGVzKHJlc3VsdCwgY29tcHV0ZWQsIGNvbXBhcmF0b3IpXG4gICAgICAgICAgICApKSB7XG4gICAgICAgICAgb3RoSW5kZXggPSBvdGhMZW5ndGg7XG4gICAgICAgICAgd2hpbGUgKC0tb3RoSW5kZXgpIHtcbiAgICAgICAgICAgIHZhciBjYWNoZSA9IGNhY2hlc1tvdGhJbmRleF07XG4gICAgICAgICAgICBpZiAoIShjYWNoZVxuICAgICAgICAgICAgICAgICAgPyBjYWNoZUhhcyhjYWNoZSwgY29tcHV0ZWQpXG4gICAgICAgICAgICAgICAgICA6IGluY2x1ZGVzKGFycmF5c1tvdGhJbmRleF0sIGNvbXB1dGVkLCBjb21wYXJhdG9yKSlcbiAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgY29udGludWUgb3V0ZXI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzZWVuKSB7XG4gICAgICAgICAgICBzZWVuLnB1c2goY29tcHV0ZWQpO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXN1bHQucHVzaCh2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8uaW52ZXJ0YCBhbmQgYF8uaW52ZXJ0QnlgIHdoaWNoIGludmVydHNcbiAgICAgKiBgb2JqZWN0YCB3aXRoI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GUgZnVuY3Rpb24gdG8gY3VzdG9taXplIGNvbXBhcmlzb25zLlxuICAgICAqIEByZXR1cm5zIHtib29sZWFufSBSZXR1cm5zIGB0cnVlYCBpZiBgb2JqZWN0YCBpcyBhIG1hdGNoLCBlbHNlIGBmYWxzZWAuXG4gICAgICovXG4gICAgZnVuY3Rpb24gYmFzZUlzTWF0Y2gob2JqZWN0LCBzb3VyY2UsIG1hdGNoRGF0YSwgY3VzdG9taXplcikge1xuICAgICAgdmFyIGluZGV4ID0gbWF0Y2hEYXRhLmxlbmd0aCxcbiAgICAgICAgICBsZW5ndGggPSBpbmRleCxcbiAgICAgICAgICBub0N1c3RvbWl6ZXIgPSAhY3VzdG9taXplcjtcblxuICAgICAgaWYgKG9iamVjdCA9PSBudWxsKSB7XG4gICAgICAgIHJldHVybiAhbGVuZ3RoO1xuICAgICAgfVxuICAgICAgb2JqZWN0ID0gT2JqZWN0KG9iamVjdCk7XG4gICAgICB3aGlsZSAoaW5kZXgtLSkge1xuICAgICAgICB2YXIgZGF0YSA9IG1hdGNoRGF0YVtpbmRleF07XG4gICAgICAgIGlmICgobm9DdXN0b21pemVyICYmIGRhdGFbMl0pXG4gICAgICAgICAgICAgID8gZGF0YVsxXSAhPT0gb2JqZWN0W2RhdGFbMF1dXG4gICAgICAgICAgICAgIDogIShkYXRhWzBdIGluIG9iamVjdClcbiAgICAgICAgICAgICkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgZGF0YSA9IG1hdGNoRGF0YVtpbmRleF07XG4gICAgICAgIHZhciBrZXkgPSBkYXRhWzBdLFxuICAgICAgICAgICAgb2JqVmFsdWUgPSBvYmplY3Rba2V5XSxcbiAgICAgICAgICAgIHNyY1ZhbHVlID0gZGF0YVsxXTtcblxuICAgICAgICBpZiAobm9DdXN0b21pemVyICYmIGRhdGFbMl0pIHtcbiAgICAgICAgICBpZiAob2JqVmFsdWUgPT09IHVuZGVmaW5lZCAmJiAhKGtleSBpbiBvYmplY3QpKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHZhciBzdGFjayA9IG5ldyBTdGFjaztcbiAgICAgICAgICBpZiAoY3VzdG9taXplcikge1xuICAgICAgICAgICAgdmFyIHJlc3VsdCA9IGN1c3RvbWl6ZXIob2JqVmFsdWUsIHNyY1ZhbHVlLCBrZXksIG9iamVjdCwgc291cmNlLCBzdGFjayk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmICghKHJlc3VsdCA9PT0gdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgPyBiYXNlSXNFcXVhbChzcmNWYWx1ZSwgb2JqVmFsdWUsIENPTVBBUkVfUEFSVElBTF9GTEFHIHwgQ09NUEFSRV9VTk9SREVSRURfRkxBRywgY3VzdG9taXplciwgc3RhY2spXG4gICAgICAgICAgICAgICAgOiByZXN1bHRcbiAgICAgICAgICAgICAgKSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIHRydWU7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8uaXNOYXRpdmVgIHdpdGhvdXQgYmFkIHNoaW0gY2hlY2tzLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0geyp9IHZhbHVlIFRoZSB2YWx1ZSB0byBjaGVjay5cbiAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn0gUmV0dXJucyBgdHJ1ZWAgaWYgYHZhbHVlYCBpcyBhIG5hdGl2ZSBmdW5jdGlvbixcbiAgICAgKiAgZWxzZSBgZmFsc2VgLlxuICAgICAqL1xuICAgIGZ1bmN0aW9uIGJhc2VJc05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gICAgIHZhciByZXN1bHQgPSBbXTtcbiAgICAgIGZvciAodmFyIGtleSBpbiBPYmplY3Qob2JqZWN0KSkge1xuICAgICAgICBpZiAoaGFzT3duUHJvcGVydHkuY2FsbChvYmplY3QsIGtleSkgJiYga2V5ICE9ICdjb25zdHJ1Y3RvcicpIHtcbiAgICAgICAgICByZXN1bHQucHVzaChrZXkpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoZSBiYXNlIGltcGxlbWVudGF0aW9uIG9mIGBfLmtleXNJbmAgd2hpY2ggZG9lc24ndCB0cmVhdCBzcGFyc2UgYXJyYXlzIGFzIGRlbnNlLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8gcXVlcnkuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIHRoZSBhcnJheSBvZiBwcm9wZXJ0eSBuYW1lcy5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBiYXNlS2V5c0luKG9iamVjdCkge1xuICAgICAgaWYgKCFpc09iamVjdChvYmplY3QpKSB7XG4gICAgICAgIHJldHVybiBuYXRpdmVLZXlzSW4ob2JqZWN0KTtcbiAgICAgIH1cbiAgICAgIHZhciBpc1Byb3RvID0gaXNQcm90b3R5cGUob2JqZWN0KSxcbiAgICAgICAgICByZXN1bHQgPSBbXTtcblxuICAgICAgZm9yICh2YXIga2V5IGluIG9iamVjdCkge1xuICAgICAgICBpZiAoIShrZXkgPT0gJ2NvbnN0cnVjdG9yJyAmJiAoaXNQcm90byB8fCAhaGFzT3duUHJvcGVydHkuY2FsbChvYmplY3QsIGtleSkpKSkge1xuICAgICAgICAgIHJlc3VsdC5wdXNoKGtleSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxuXG4gICAgL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ZiAmJiBpc1R5cGVkQXJyYXkoc3JjVmFsdWUpO1xuXG4gICAgICAgIG5ld1ZhbHVlID0gc3JjVmFsdWU7XG4gICAgICAgIGlmIChpc0FyciB8fCBpc0J1ZmYgfHwgaXNUeXBlZCkge1xuICAgICAgICAgIGlmIChpc0FycmF5KG9ialZhbHVlKSkge1xuICAgICAgICAgICAgbmV3VmFsdWUgPSBvYmpWYWx1ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSBpZiAoaXNBcnJheUxpa2VPYmplY3Qob2JqVmFsdWUpKSB7XG4gICAgICAgICAgICBuZXdWYWx1ZSA9IGNvcHlBcnJheShvYmpWYWx1ZSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgaWYgKGlzQnVmZikge1xuICAgICAgICAgICAgaXNDb21tb24gPSBmYWxzZTtcbiAgICAgICAgICAgIG5ld1ZhbHVlID0gY2xvbmVCdWZmZXIoc3JjVmFsdWUsIHRydWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBlbHNlIGlmIChpc1R5cGVkKSB7XG4gICAgICAgICAgICBpc0NvbW1vbiA9IGZhbHNlO1xuICAgICAgICAgICAgbmV3VmFsdWUgPSBjbG9uZVR5cGVkQXJyYXkoc3JjVmFsdWUsIHRydWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIG5ld1ZhbHVlID0gW107XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKGlzUGxhaW5PYmplY3Qoc3JjVmFsdWUpIHx8IGlzQXJndW1lbnRzKHNyY1ZhbHVlKSkge1xuICAgICAgICAgIG5ld1ZhbHVlID0gb2JqVmFsdWU7XG4gICAgICAgICAgaWYgKGlzQXJndW1lbnRzKG9ialZhbHVlKSkge1xuICAgICAgICAgICAgbmV3VmFsdWUgPSB0b1BsYWluT2JqZWN0KG9ialZhbHVlKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSB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gICAgICAgIGFyZ3MgPSBBcnJheShsZW5ndGgpLFxuICAgICAgICAgICAgaW5kZXggPSBsZW5ndGgsXG4gICAgICAgICAgICBwbGFjZWhvbGRlciA9IGdldEhvbGRlcih3cmFwcGVyKTtcblxuICAgICAgICB3aGlsZSAoaW5kZXgtLSkge1xuICAgICAgICAgIGFyZ3NbaW5kZXhdID0gYXJndW1lbnRzW2luZGV4XTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgaG9sZGVycyA9IChsZW5ndGggPCAzICYmIGFyZ3NbMF0gIT09IHBsYWNlaG9sZGVyICYmIGFyZ3NbbGVuZ3RoIC0gMV0gIT09IHBsYWNlaG9sZGVyKVxuICAgICAgICAgID8gW11cbiAgICAgICAgICA6IHJlcGxhY2VIb2xkZXJzKGFyZ3MsIHBsYWNlaG9sZGVyKTtcblxuICAgICAgICBsZW5ndGggLT0gaG9sZGVycy5sZW5ndGg7XG4gICAgICAgIGlmIChsZW5ndGggPCBhcml0eSkge1xuICAgICAgICAgIHJldHVybiBjcmVhdGVSZWN1cnJ5KFxuICAgICAgICAgICAgZnVuYywgYml0bWFzaywgY3JlYXRlSHlicmlkLCB3cmFwcGVyLnBsYWNlaG9sZGVyLCB1bmRlZmluZWQsXG4gICAgICAgICAgICBhcmdzLCBob2xkZXJzLCB1bmRlZmluZWQsIHVuZGVmaW5lZCwgYXJpdHkgLSBsZW5ndGgpO1xuICAgICAgICB9XG4gICAgICAgIHZhciBmbiA9ICh0aGlzICYmIHRoaXMgIT09IHJvb3QgJiYgdGhpcyBpbnN0YW5jZW9mIHdyYXBwZXIpID8gQ3RvciA6IGZ1bmM7XG4gICAgICAgIHJldHVybiBhcHBseShmbiwgdGhpcywgYXJncyk7XG4gICAgICB9XG4gICAgICByZXR1cm4gd3JhcHBlcjtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDcmVhdGVzIGEgYF8uZmluZGAgb3IgYF8uZmluZExhc3RgIGZ1bmN0aW9uLlxuICAgICAqXG4gICAgIC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mctcG9pbnQgaXNzdWVzLlxuICAgICAgICAgIC8vIFNlZSBbTUROXShodHRwczovL21kbi5pby9yb3VuZCNFeGFtcGxlcykgZm9yIG1vcmUgZGV0YWlscy5cbiAgICAgICAgICB2YXIgcGFpciA9ICh0b1N0cmluZyhudW1iZXIpICsgJ2UnKS5zcGxpdCgnZScpLFxuICAgICAgICAgICAgICB2YWx1ZSA9IGZ1bmMocGFpclswXSArICdlJyArICgrcGFpclsxXSArIHByZWNpc2lvbikpO1xuXG4gICAgICAgICAgcGFpciA9ICh0b1N0cmluZyh2YWx1ZSkgKyAnZScpLnNwbGl0KCdlJyk7XG4gICAgICAgICAgcmV0dXJuICsocGFpclswXSArICdlJyArICgrcGFpclsxXSAtIHByZWNpc2lvbikpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmdW5jKG51bWJlcik7XG4gICAgICB9O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENyZWF0ZXMgYSBzZXQgb2JqZWN0IG9mIGB2YWx1ZXNgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge0FycmF5fSB2YWx1ZXMgVGhlIHZhbHVlcyB0byBhZGQgdG8gdGhlIHNldC5cbiAgICAgKiBAcmV0dXJucyB7T2JqZWN0fSBSZXR1cm5zIHRoZSBuZXcgc2V0LlxuICAgICAqL1xuICAgIHZhciBjcmVhdGVTZXQgPSAhKFNldCAmJiAoMSAvIHNldFRvQXJyYXkobmV3IFNldChbLC0wXSkpWzFdKSA9PSBJTkZJTklUWSkgPyBub29wIDogZnVuY3Rpb24odmFsdWVzKSB7XG4gICAgICByZXR1cm4gbmV3IFNldCh2YWx1ZXMpO1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBDcmVhdGVzIGEgYF8udG9QYWlyc2Agb3IgYF8udG9QYWlyc0luYCBmdW5jdGlvbi5cbiAgICAgKlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBhcmFtIHtGdW5jdGlvbn0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ndGgpIHtcbiAgICAgICAgdmFyIGFyclZhbHVlID0gYXJyYXlbaW5kZXhdLFxuICAgICAgICAgICAgb3RoVmFsdWUgPSBvdGhlcltpbmRleF07XG5cbiAgICAgICAgaWYgKGN1c3RvbWl6ZXIpIHtcbiAgICAgICAgICB2YXIgY29tcGFyZWQgPSBpc1BhcnRpYWxcbiAgICAgICAgICAgID8gY3VzdG9taXplcihvdGhWYWx1ZSwgYXJyVmFsdWUsIGluZGV4LCBvdGhlciwgYXJyYXksIHN0YWNrKVxuICAgICAgICAgICAgOiBjdXN0b21pemVyKGFyclZhbHVlLCBvdGhWYWx1ZSwgaW5kZXgsIGFycmF5LCBvdGhlciwgc3RhY2spO1xuICAgICAgICB9XG4gICAgICAgIGlmIChjb21wYXJlZCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgaWYgKGNvbXBhcmVkKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgLy8gUmVjdXJzaXZlbHkgY29tcGFyZSBhcnJheXMgKHN1c2NlcHRpYmxlIHRvIGNhbGwgc3RhY2sgbGltaXRzKS5cbiAgICAgICAgaWYgKHNlZW4pIHtcbiAgICAgICAgICBpZiAoIWFycmF5U29tZShvdGhlciwgZnVuY3Rpb24ob3RoVmFsdWUsIG90aEluZGV4KSB7XG4gICAgICAgICAgICAgICAgaWYgKCFjYWNoZUhhcyhzZWVuLCBvdGhJbmRleCkgJiZcbiAgICAgICAgICAgICAgICAgICAgKGFyclZhbHVlID09PSBvdGhWYWx1ZSB8fCBlcXVhbEZ1bmMoYXJyVmFsdWUsIG90aFZhbHVlLCBiaXRtYXNrLCBjdXN0b21pemVyLCBzdGFjaykpKSB7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gc2Vlbi5wdXNoKG90aEluZGV4KTtcbiAgICAgICAgICAgICAgICB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zLlxuICAgICAgICAgIHJldHVybiBvYmplY3QgPT0gKG90aGVyICsgJycpO1xuXG4gICAgICAgIGNhc2UgbWFwVGFnOlxuICAgICAgICAgIHZhciBjb252ZXJ0ID0gbWFwVG9BcnJheTtcblxuICAgICAgICBjYXNlIHNldFRhZzpcbiAgICAgICAgICB2YXIgaXNQYXJ0aWFsID0gYml0bWFzayAmIENPTVBBUkVfUEFSVElBTF9GTEFHO1xuICAgICAgICAgIGNvbnZlcnQgfHwgKGNvbnZlcnQgPSBzZXRUb0FycmF5KTtcblxuICAgICAgICAgIGlmIChvYmplY3Quc2l6ZSAhPSBvdGhlci5zaXplICYmICFpc1BhcnRpYWwpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgLy8gQXNzdW1lIGN5Y2xpYyB2YWx1ZXMgYXJlIGVxdWFsLlxuICAgICAgICAgIHZhciBzdGFja2VkID0gc3RhY2suZ2V0KG9iamVjdCk7XG4gICAgICAgICAgaWYgKHN0YWNrZWQpIHtcbiAgICAgICAgICAgIHJldHVybiBzdGFja2VkID09IG90aGVyO1xuICAgICAgICAgIH1cbiAgICAgICAgICBiaXRtYXNrIHw9IENPTVBBUkVfVU5PUkRFUkVEX0ZMQUc7XG5cbiAgICAgICAgICAvLyBSZWN1cnNpdmVseSBjb21wYXJlIG9iamVjdHMgKHN1c2NlcHRpYmxlIHRvIGNhbGwgc3RhY2sgbGltaXRzKS5cbiAgICAgICAgICBzdGFjay5zZXQob2JqZWN0LCBvdGhlcik7XG4gICAgICAgICAgdmFyIHJlc3VsdCA9IGVxdWFsQXJyYXlzKGNvbnZlcnQob2JqZWN0KSwgY29udmVydChvdGhlciksIGJpdG1hc2ssIGN1c3RvbWl6ZXIsIGVxdWFsRnVuYywgc3RhY2spO1xuICAgICAgICAgIHN0YWNrWydkZWxldGUnXShvYmplY3QpO1xuICAgICAgICAgIHJldHVybiByZXN1bHQ7XG5cbiAgICAgICAgY2FzZSBz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VjdCwgb3RoZXIpO1xuICAgICAgc3RhY2suc2V0KG90aGVyLCBvYmplY3QpO1xuXG4gICAgICB2YXIgc2tpcEN0b3IgPSBpc1BhcnRpYWw7XG4gICAgICB3aGlsZSAoKytpbmRleCA8IG9iakxlbmd0aCkge1xuICAgICAgICBrZXkgPSBvYmpQcm9wc1tpbmRleF07XG4gICAgICAgIHZhciBvYmpWYWx1ZSA9IG9iamVjdFtrZXldLFxuICAgICAgICAgICAgb3RoVmFsdWUgPSBvdGhlcltrZXldO1xuXG4gICAgICAgIGlmIChjdXN0b21pemVyKSB7XG4gICAgICAgICAgdmFyIGNvbXBhcmVkID0gaXNQYXJ0aWFsXG4gICAgICAgICAgICA/IGN1c3RvbWl6ZXIob3RoVmFsdWUsIG9ialZhbHVlLCBrZXksIG90aGVyLCBvYmplY3QsIHN0YWNrKVxuICAgICAgICAgICAgOiBjdXN0b21pemVyKG9ialZhbHVlLCBvdGhWYWx1ZSwga2V5LCBvYmplY3QsIG90aGVyLCBzdGFjayk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gUmVjdXJzaXZlbHkgY29tcGFyZSBvYmplY3RzIChzdXNjZXB0aWJsZSB0byBjYWxsIHN0YWNrIGxpbWl0cykuXG4gICAgICAgIGlmICghKGNvbXBhcmVkID09PSB1bmRlZmluZWRcbiAgICAgICAgICAgICAgPyAob2JqVmFsdWUgPT09IG90aFZhbHVlIHx8IGVxdWFsRnVuYyhvYmpWYWx1ZSwgb3RoVmFsdWUsIGJpdG1hc2ssIGN1c3RvbWl6ZXIsIHN0YWNrKSlcbiAgICAgICAgICAgICAgOiBjb21wYXJlZFxuICAgICAgICAgICAgKSkge1xuICAgICAgICAgIHJlc3VsdCA9IGZhbHNlO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICAgIHNraXBDdG9yIHx8IChza2lwQ3RvciA9IGtleSA9PSAnY29uc3RydWN0b3InKTtcbiAgICAgIH1cbiAgICAgIGlmIChyZXN1bHQgJiYg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AuMFxuICAgICAqIEBjYXRlZ29yeSBBcnJheVxuICAgICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5IFRoZSBhcnJheSB0byBjb25jYXRlbmF0ZS5cbiAgICAgKiBAcGFyYW0gey4uLip9IFt2YWx1ZXNdIFRoZSB2YWx1ZXMgdG8gY29uY2F0ZW5hdGUuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIHRoZSBuZXcgY29uY2F0ZW5hdGVkIGFycmF5LlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiB2YXIgYXJyYXkgPSBbMV07XG4gICAgICogdmFyIG90aGVyID0gXy5jb25jYXQoYXJyYXksIDIsIFszXSwgW1s0XV0pO1xuICAgICAqXG4gICAgICogY29uc29sZS5sb2cob3RoZXIpO1xuICAgICAqIC8vID0+IFsxLCAyLCAzLCBbNF1dXG4gICAgICpcbiAgICAgKiBjb25zb2xlLmxvZyhhcnJheSk7XG4gICAgICogLy8gPT4gWzFdXG4gICAgICovXG4gICAgZnVuY3Rpb24gY29uY2F0KCkge1xuICAgICAgdmFyIGxlbmd0aCA9IGFyZ3VtZW50cy5sZW5ndGg7XG4gICAgICBpZiAoIWxlbmd0aCkge1xuICAgICAgICByZXR1cm4gW107XG4gICAgICB9XG4gICAgICB2YXIgYXJncyA9IEFycmF5KGxlbmd0aCAtIDEpLFxuICAgICAgICAgIGFycmF5ID0gYXJndW1lbnRzWzBdLFxuICAgICAgICAgIGluZGV4ID0gbGVuZ3RoO1xuXG4gICAgICB3aGlsZSAoaW5kZXgtLSkge1xuICAgICAgICBhcmdzW2luZGV4IC0gMV0gPSBhcmd1bWVudHNbaW5kZXhdO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGFycmF5UHVzaChpc0FycmF5KGFycmF5KSA/IGNvcHlBcnJheShhcnJheSkgOiBbYXJyYXldLCBiYXNlRmxhdHRlbihhcmdzLCAxKSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ3JlYXRlc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GV4YW1wbGVcbiAgICAgKlxuICAgICAqIGZ1bmN0aW9uIHNxdWFyZShuKSB7XG4gICAgICogICByZXR1cm4gbiAqIG47XG4gICAgICogfVxuICAgICAqXG4gICAgICogdmFyIHdyYXBwZWQgPSBfKFsxLCAyXSkubWFwKHNxdWFyZSk7XG4gICAgICogdmFyIG90aGVyID0gd3JhcHBlZC5wbGFudChbMywgNF0pO1xuICAgICAqXG4gICAgICogb3RoZXIudmFsdWUoKTtcbiAgICAgKiAvLyA9PiBbOSwgMTZdXG4gICAgICpcbiAgICAgKiB3cmFwcGVkLnZhbHVlKCk7XG4gICAgICogLy8gPT4gWzEsIDRdXG4gICAgICovXG4gICAgZnVuY3Rpb24gd3JhcHBlclBsYW50KHZhbHVlKSB7XG4gICAgICB2YXIgcmVzdWx0LFxuICAgICAgICAgIHBhcmVudCA9IHRoaXM7XG5cbiAgICAgIHdoaWxlIChwYXJlbnQgaW5zdGFuY2VvZiBiYXNlTG9kYXNoKSB7XG4gICAgICAgIHZhciBjbG9uZSA9IHdyYXBwZXJDbG9uZShwYXJlbnQpO1xuICAgICAgICBjbG9uZS5fX2luZGV4X18gPSAwO1xuICAgICAgICBjbG9uZS5fX3ZhbHVlc19fID0gdW5kZWZpbmVkO1xuICAgICAgICBpZiAocmVzdWx0KSB7XG4gICAgICAgICAgcHJldmlvdXMuX193cmFwcGVkX18gPSBjbG9uZTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICByZXN1bHQgPSBjbG9uZTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgcHJldmlvdXMgPSBjbG9uZTtcbiAgICAgICAgcGFyZW50ID0gcGFyZW50Ll9fd3JhcHBlZF9fO1xuICAgICAgfVxuICAgICAgcHJldmlvdXMuX193cmFwcGVkX18gPSB2YWx1ZTtcbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhpcyBtZXRob2QgaXMgdGhlIHdyYXBwZXIgdmVyc2lvbiBvZiBgXy5yZXZlcnNlYC5cbiAgICAgKlxuICAgICAqICoqTm90ZToqKiBUaGlzIG1ldGhvZCBtdXRhdGVzIHRoZSB3cmFwcGVkIGFycmF5LlxuICAgICAqXG4gICAgICogQG5hbWUgcmV2ZXJzZVxuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDAuMS4wXG4gICAgICogQGNhdGVnb3J5IFNlcVxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgdGhlIG5ldyBgbG9kYXNoYCB3cmFwcGVyIGluc3RhbmNlLlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiB2YXIgYXJyYXkgPSBbMSwgMiwgM107XG4gICAgICpcbiAgICAgKiBfKGFycmF5KS5yZXZlcnNlKCkudmFsdWUoKVxuICAgICAqIC8vID0+IFszLCAyLCAxXVxuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXkpO1xuICAgICAqIC8vID0+IFszLCAyLCAxXVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIHdyYXBwZXJSZXZlcnNlKCkge1xuICAgICAgdmFyIHZhbHVlID0gdGhpcy5fX3dyYXBwZWRfXztcbiAgICAgIGlmICh2YWx1ZSBpbnN0YW5jZW9mIExhenlXcmFwcGVyKSB7XG4gICAgICAgIHZhciB3cmFwcGVkID0gdmFsdWU7XG4gICAgICAgIGlmICh0aGlzLl9fYWN0aW9uc19fLmxlbmd0aCkge1xuICAgICAgICAgIHdyYXBwZWQgPSBuZXcgTGF6eVdyYXBwZXIodGhpcyk7XG4gICAgICAgIH1cbiAgICAgICAgd3JhcHBlZCA9IHdyYXBwZWQucmV2ZXJzZSgpO1xuICAgICAgICB3cmFwcGVkLl9fYWN0aW9uc19fLnB1c2goe1xuICAgICAgICAgICdmdW5jJzogdGhydSxcbiAgICAgICAgICAnYXJncyc6IFtyZXZlcnNlXSxcbiAgICAgICAgICAndGhpc0FyZyc6IHVuZGVmaW5lZFxuICAgICAgICB9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ZVxuICAgICAqXG4gICAgICogXy5sdGUoMywgMyk7XG4gICAgICogLy8gPT4gdHJ1ZVxuICAgICAqXG4gICAgICogXy5sdGUoMywgMSk7XG4gICAgICogLy8gPT4gZmFsc2VcbiAgICAgKi9cbiAgICB2YXIgbHRlID0gY3JlYXRlUmVsYXRpb25hbE9wZXJhdGlvbihmdW5jdGlvbih2YWx1ZSwgb3RoZXIpIHtcbiAgICAgIHJldHVybiB2YWx1ZSA8PSBvdGhlcjtcbiAgICB9KTtcblxuICAgIC8qKlxuICAgICAqIENvbnZlcnRzIGB2YWx1ZWAgdG8gYW4gYXJyYXkuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQHNpbmNlIDAuMS4wXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAY2F0ZWdvcnkgTGFuZ1xuICAgICAqIEBwYXJhbSB7Kn0gdmFsdWUgVGhlIHZhbHVlIHRvIGNvbnZlcnQuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIHRoZSBjb252ZXJ0ZWQgYXJyYXkuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8udG9BcnJheSh7ICdhJzogMSwgJ2InOiAyIH0pO1xuICAgICAqIC8vID0+IFsxLCAyXVxuICAgICAqXG4gICAgICogXy50b0FycmF5KCdhYmMnKTtcbiAgICAgKiAvLyA9PiBbJ2EnLCAnYicsICdjJ11cbiAgICAgKlxuICAgICAqIF8udG9BcnJheSgxKTtcbiAgICAgKiAvLyA9PiBbXVxuICAgICAqXG4gICAgICogXy50b0FycmF5KG51bGwpO1xuICAgICAqIC8vID0+IFtdXG4gICAgICovXG4gICAgZnVuY3Rpb24gdG9BcnJheSh2YWx1ZSkge1xuICAgICAgaWYgKCF2YWx1ZSkge1xuICAgICAgICByZXR1cm4gW107XG4gICAgICB9XG4gICAgICBpZiAoaXNBcnJheUxpa2UodmFsdWUpKSB7XG4gICAgICAgIHJldHVybiBpc1N0cmluZyh2YW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5nID0gdW5kZWZpbmVkO1xuICAgICAgfVxuICAgICAgaWYgKGZsb2F0aW5nID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgaWYgKHR5cGVvZiB1cHBlciA9PSAnYm9vbGVhbicpIHtcbiAgICAgICAgICBmbG9hdGluZyA9IHVwcGVyO1xuICAgICAgICAgIHVwcGVyID0gdW5kZWZpbmVkO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKHR5cGVvZiBsb3dlciA9PSAnYm9vbGVhbicpIHtcbiAgICAgICAgICBmbG9hdGluZyA9IGxvd2VyO1xuICAgICAgICAgIGxvd2VyID0gdW5kZWZpbmVkO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBpZiAobG93ZXIgPT09IHVuZGVmaW5lZCAmJiB1cHBlciA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGxvd2VyID0gMDtcbiAgICAgICAgdXBwZXIgPSAxO1xuICAgICAgfVxuICAgICAgZWxzZSB7XG4gICAgICAgIGxvd2VyID0gdG9GaW5pdGUobG93ZXIpO1xuICAgICAgICBpZiAodXBwZXIgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgIHVwcGVyID0gbG93ZXI7XG4gICAgICAgICAgbG93ZXIgPSAwO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHVwcGVyID0gdG9GaW5pdGUodXBwZXIpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBpZiAobG93ZXIgPiB1cHBlcikge1xuICAgICAgICB2YXIgdGVtcCA9IGxvd2VyO1xuICAgICAgICBsb3dlciA9IHVwcGVyO1xuICAgICAgICB1cHBlciA9IHRlbXA7XG4gICAgICB9XG4gICAgICBpZiAoZmxvYXRpbmcgfHwgbG93ZXIgJSAxIHx8IHVwcGVyICUgMSkge1xuICAgICAgICB2YXIgcmFuZCA9IG5hdGl2ZVJhbmRvbSgpO1xuICAgICAgICByZXR1cm4gbmF0aXZlTWluKGxvd2VyICsgKHJhbmQgKiAodXBwZ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zZXQgdGhlIFwibGVuZ3RoXCIgcHJvcGVydHkgb2YgYm91bmQgZnVuY3Rpb25zLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBzaW5jZSAwLjEuMFxuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQGNhdGVnb3J5IFV0aWxcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8gYmluZCBhbmQgYXNzaWduIHRoZSBib3VuZCBtZXRob2RzIHRvLlxuICAgICAqIEBwYXJhbSB7Li4uKHN0cmluZ3xzdHJpbmdbXSl9IG1ldGhvZE5hbWVzIFRoZSBvYmplY3QgbWV0aG9kIG5hbWVzIHRvIGJpbmQuXG4gICAgICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyBgb2JqZWN0YC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogdmFyIHZpZXcgPSB7XG4gICAgICogICAnbGFiZWwnOiAnZG9jcycsXG4gICAgICogICAnY2xpY2snOiBmdW5jdGlvbigpIHtcbiAgICAgKiAgICAgY29uc29sZS5sb2coJ2NsaWNrZWQgJyArIHRoaXMubGFiZWwpO1xuICAgICAqICAgfVxuICAgICAqIH07XG4gICAgICpcbiAgICAgKiBfLmJpbmRBbGwodmlldywgWydjbGljayddKTtcbiAgICAgKiBqUXVlcnkoZWxlbWVudCkub24oJ2NsaWNrJywgdmlldy5jbGljayk7XG4gICAgICogLy8gPT4gTG9ncyAnY2xpY2tlZCBkb2NzJyB3aGVuIGNsaWNrZWQuXG4gICAgICovXG4gICAgdmFyIGJpbmRBbGwgPSBmbGF0UmVzdChmdW5jdGlvbihvYmplY3QsIG1ldGhvZE5hbWVzKSB7XG4gICAgICBhcnJheUVhY2gobWV0aG9kTmFtZXMsIGZ1bmN0aW9uKGtleSkge1xuICAgICAgICBrZXkgPSB0b0tleShrZXkpO1xuICAgICAgICBiYXNlQXNzaWduVmFsdWUob2JqZWN0LCBrZXksIGJpb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F5c1sxXSk7XG4gICAgICogLy8gPT4gZmFsc2VcbiAgICAgKi9cbiAgICBmdW5jdGlvbiBzdHViQXJyYXkoKSB7XG4gICAgICByZXR1cm4gW107XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhpcyBtZXRob2QgcmV0dXJucyBgZmFsc2VgLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMTMuMFxuICAgICAqIEBjYXRlZ29yeSBVdGlsXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59IFJldHVybnMgYGZhbHNlYC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogXy50aW1lcygyLCBfLnN0dWJGYWxzZSk7XG4gICAgICogLy8gPT4gW2ZhbHNlLCBmYWxzZV1cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBzdHViRmFsc2UoKSB7XG4gICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhpcyBtZXRob2QgcmV0dXJucyBhIG5ldyBlbXB0eSBvYmplY3QuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAc2luY2UgNC4xMy4wXG4gICAgICogQGNhdGVnb3J5IFV0aWxcbiAgICAgKiBAcmV0dXJucyB7T2JqZWN0fSBSZXR1cm5zIHRoZSBuZXcgZW1wdHkgb2JqZWN0LlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiB2YXIgb2JqZWN0cyA9IF8udGltZXMoMiwgXy5zdHViT2JqZWN0KTtcbiAgICAgKlxuICAgICAqIGNvbnNvbGUubG9nKG9iamVjdHMpO1xuICAgICAqIC8vID0+IFt7fSwge31dXG4gICAgICpcbiAgICAgKiBjb25zb2xlLmxvZyhvYmplY3RzWzBdID09PSBvYmplY3RzWzFdKTtcbiAgICAgKiAvLyA9PiBmYWxzZVxuICAgICAqL1xuIC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mN0aW9uKG11bHRpcGxpZXIsIG11bHRpcGxpY2FuZCkge1xuICAgICAgcmV0dXJuIG11bHRpcGxpZXIgKiBtdWx0aXBsaWNhbmQ7XG4gICAgfSwgMSk7XG5cbiAgICAvKipcbiAgICAgKiBDb21wdXRlcyBgbnVtYmVyYCByb3VuZGVkIHRvIGBwcmVjaXNpb25gLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDMuMTAuMFxuICAgICAqIEBjYXRlZ29yeSBNYXRoXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IG51bWJlciBUaGUgbnVtYmVyIHRvIHJvdW5kLlxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBbcHJlY2lzaW9uPTBdIFRoZSBwcmVjaXNpb24gdG8gcm91bmQgdG8uXG4gICAgICogQHJldHVybnMge251bWJlcn0gUmV0dXJucyB0aGUgcm91bmRlZCBudW1iZXIuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8ucm91bmQoNC4wMDYpO1xuICAgICAqIC8vID0+IDRcbiAgICAgKlxuICAgICAqIF8ucm91bmQoNC4wMDYsIDIpO1xuICAgICAqIC8vID0+IDQuMDFcbiAgICAgKlxuICAgICAqIF8ucm91bmQoNDA2MCwgLTIpO1xuICAgICAqIC8vID0+IDQxMDBcbiAgICAgKi9cbiAgICB2YXIgcm91bmQgPSBjcmVhdGVSb3VuZCgncm91bmQnKTtcblxuICAgIC8qKlxuICAgICAqIFN1YnRyYWN0IHR3byBudW1iZXJzLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMC4wXG4gICAgICogQGNhdGVnb3J5IE1hdGhcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gbWludWVuZCBUaGUgZmlyc3QgbnVtYmVyIGluIGEgc3VidHJhY3Rpb24uXG4gICAgICogQHBhcmFtIHtudW1i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GFjay5wdXNoKHtcbiAgICAgICAgICB0eXBlOiBzdGF0ZUNoYXIsXG4gICAgICAgICAgc3RhcnQ6IGkgLSAxLFxuICAgICAgICAgIHJlU3RhcnQ6IHJlLmxlbmd0aCxcbiAgICAgICAgICBvcGVuOiBwbFR5cGVzW3N0YXRlQ2hhcl0ub3BlbixcbiAgICAgICAgICBjbG9zZTogcGxUeXBlc1tzdGF0ZUNoYXJdLmNsb3NlXG4gICAgICAgIH0pXG4gICAgICAgIC8vIG5lZ2F0aW9uIGlzICg/Oig/IWpzKVteL10qKVxuICAgICAgICByZSArPSBzdGF0ZUNoYXIgPT09ICchJyA/ICcoPzooPyEoPzonIDogJyg/OidcbiAgICAgICAgdGhpcy5kZWJ1ZygncGxUeXBlICVqICVqJywgc3RhdGVDaGFyLCByZSlcbiAgICAgICAgc3RhdGVDaGFyID0gZmFsc2VcbiAgICAgIGNvbnRpbnVlXG5cbiAgICAgIGNhc2UgJyknOlxuICAgICAgICBpZiAoaW5DbGFzcyB8fCAhcGF0dGVybkxpc3RTdGFjay5sZW5ndGgpIHtcbiAgICAgICAgICByZSArPSAnXFxcXCknXG4gICAgICAgICAgY29udGludWVcbiAgICAgICAgfVxuXG4gICAgICAgIGNsZWFyU3RhdGVDaGFyKClcbiAgICAgICAgaGFzTWFnaWMgPSB0cnVlXG4gICAgICAgIHZhciBwbCA9IHBhdHRlcm5MaXN0U3RhY2sucG9wKClcbiAgICAgICAgLy8gbmVnYXRpb24gaXMgKD86KD8hanMpW14vXSopXG4gICAgICAgIC8vIFRoZSBvdGhlcnMgYXJlICg/OjxwYXR0ZXJuPik8dHlwZT5cbiAgICAgICAgcmUgKz0gcGwuY2xvc2VcbiAgICAgICAgaWYgKHBsLnR5cGUgPT09ICchJykge1xuICAgICAgICAgIG5lZ2F0aXZlTGlzdHMucHVzaChwbClcbiAgICAgICAgfVxuICAgICAgICBwbC5yZUVuZCA9IHJlLmxlbmd0aFxuICAgICAgY29udGludWVcblxuICAgICAgY2FzZ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5cGUgPT09IFwibm9ybWFsXCIpIHtcbiAgICAgICAgICAvLyBJZiBhbiBleGNlcHRpb24gaXMgdGhyb3duIGZyb20gaW5uZXJGbiwgd2UgbGVhdmUgc3RhdGUgPT09XG4gICAgICAgICAgLy8gR2VuU3RhdGVFeGVjdXRpbmcgYW5kIGxvb3AgYmFjayBmb3IgYW5vdGhlciBpbnZvY2F0aW9uLlxuICAgICAgICAgIHN0YXRlID0gY29udGV4dC5kb25lXG4gICAgICAgICAgICA/IEdlblN0YXRlQ29tcGxldGVkXG4gICAgICAgICAgICA6IEdlblN0YXRlU3VzcGVuZGVkWWllbGQ7XG5cbiAgICAgICAgICBpZiAocmVjb3JkLmFyZyA9PT0gQ29udGludWVTZW50aW5lbCkge1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHZhbHVlOiByZWNvcmQuYXJnLFxuICAgICAgICAgICAgZG9uZTogY29udGV4dC5kb25lXG4gICAgICAgICAgfTtcblxuICAgICAgICB9IGVsc2UgaWYgKHJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgICBzdGF0ZSA9IEdlblN0YXRlQ29tcGxldGVkO1xuICAgICAgICAgIC8vIERpc3BhdGNoIHRoZSBleGNlcHRpb24gYnkgbG9vcGluZyBiYWNrIGFyb3VuZCB0byB0aGVcbiAgICAgICAgICAvLyBjb250ZXh0LmRpc3BhdGNoRXhjZXB0aW9uKGNvbnRleHQuYXJnKSBjYWxsIGFib3ZlLlxuICAgICAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgICAgIGNvbnRleHQuYXJnID0gcmVjb3JkLmFyZztcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH07XG4gIH1cblxuICAvLyBDYWxsIGRlbGVnYXRlLml0ZXJhdG9yW2NvbnRleHQubWV0aG9kXShjb250ZXh0LmFyZykgYW5kIGhhbmRsZSB0aG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InJldHVyblwiO1xuICAgICAgICAgIGNvbnRleHQuYXJnID0gdW5kZWZpbmVkO1xuICAgICAgICAgIG1heWJlSW52b2tlRGVsZWdhdGUoZGVsZWdhdGUsIGNvbnRleHQpO1xuXG4gICAgICAgICAgaWYgKGNvbnRleHQubWV0aG9kID09PSBcInRocm93XCIpIHtcbiAgICAgICAgICAgIC8vIElmIG1heWJlSW52b2tlRGVsZWdhdGUoY29udGV4dCkgY2hhbmdlZCBjb250ZXh0Lm1ldGhvZCBmcm9tXG4gICAgICAgICAgICAvLyBcInJldHVyblwiIHRvIFwidGhyb3dcIiwgbGV0IHRoYXQgb3ZlcnJpZGUgdGhlIFR5cGVFcnJvciBiZWxvdy5cbiAgICAgICAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgICBjb250ZXh0LmFyZyA9IG5ldyBUeXBlRXJyb3IoXG4gICAgICAgICAgXCJUaGUgaXRlcmF0b3IgZG9lcyBub3QgcHJvdmlkZSBhICd0aHJvdycgbWV0aG9kXCIpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gQ29udGludWVTZW50aW5lbDtcbiAgICB9XG5cbiAgICB2YXIgcmVjb3JkID0gdHJ5Q2F0Y2gobWV0aG9kLCBkZWxlZ2F0ZS5pdGVyYXRvciwgY29udGV4dC5hcmcpO1xuXG4gICAgaWYgKHJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgY29udGV4dC5hcmcgPSByZWNvcmQuYXJnO1xuICAgICAgY29udGV4dC5kZWxlZ2F0ZSA9IG51bGw7XG4gICAgICByZXR1cm4gQ29udGludWVTZW50aW5lbDtcbiAgICB9XG5cbiAgICB2YXIgaW5mbyA9IHJlY29yZC5hcmc7XG5cbiAgICBpZiAoISBp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xuXG4gICAgICB0aGlzLm1ldGhvZCA9IFwibmV4dFwiO1xuICAgICAgdGhpcy5hcmcgPSB1bmRlZmluZWQ7XG5cbiAgICAgIHRoaXMudHJ5RW50cmllcy5mb3JFYWNoKHJlc2V0VHJ5RW50cnkpO1xuXG4gICAgICBpZiAoIXNraXBUZW1wUmVzZXQpIHtcbiAgICAgICAgZm9yICh2YXIgbmFtZSBpbiB0aGlzKSB7XG4gICAgICAgICAgLy8gTm90IHN1cmUgYWJvdXQgdGhlIG9wdGltYWwgb3JkZXIgb2YgdGhlc2UgY29uZGl0aW9uczpcbiAgICAgICAgICBpZiAobmFtZS5jaGFyQXQoMCkgPT09IFwidFwiICYmXG4gICAgICAgICAgICAgIGhhc093bi5jYWxsKHRoaXMsIG5hbWUpICYmXG4gICAgICAgICAgICAgICFpc05hTigrbmFtZS5zbGljZSgxKSkpIHtcbiAgICAgICAgICAgIHRoaXNbbmFtZV0gPSB1bmRlZmluZWQ7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIHN0b3A6IGZ1bmN0aW9uKCkge1xuICAgICAgdGhpcy5kb25lID0gdHJ1ZTtcblxuICAgICAgdmFyIHJvb3RFbnRyeSA9IHRoaXMudHJ5RW50cmllc1swXTtcbiAgICAgIHZhciByb290UmVjb3JkID0gcm9vdEVudHJ5LmNvbXBsZXRpb247XG4gICAgICBpZiAocm9vdFJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcm9vdFJlY29yZC5hcmc7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB0aGlzLnJ2YWw7XG4gICAgfSxcblxuICAgIGRpc3BhdGNoRXhjZXB0aW9uOiBmdW5jdGlvbihleGNlcHRpb24pIHtcbiAgICAgIGlmICh0aGlzLmRvbmUpIHtcbiAgICAgICAgdGhyb3cgZXhjZXB0aW9uO1xuICAgICAgfVxuXG4gICAgICB2YXIgY29udGV4dCA9IHRoaXM7XG4g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4gICAgICAgIGlmIChlbnRyeS50cnlMb2MgPD0gdGhpcy5wcmV2KSB7XG4gICAgICAgICAgdmFyIGhhc0NhdGNoID0gaGFzT3duLmNhbGwoZW50cnksIFwiY2F0Y2hMb2NcIik7XG4gICAgICAgICAgdmFyIGhhc0ZpbmFsbHkgPSBoYXNPd24uY2FsbChlbnRyeSwgXCJmaW5hbGx5TG9jXCIpO1xuXG4gICAgICAgICAgaWYgKGhhc0NhdGNoICYmIGhhc0ZpbmFsbHkpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5jYXRjaExvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmNhdGNoTG9jLCB0cnVlKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmZpbmFsbHlMb2MpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIGlmIChoYXNDYXRjaCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGVudHJ5LmNhdGNoTG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuY2F0Y2hMb2MsIHRydWUpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIGlmIChoYXNGaW5hbGx5KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmZpbmFsbHlMb2MpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcInRyeSBzdGF0ZW1lbnQgd2l0aG91dCBjYXRjaCBvciBmaW5hbGx5XCIpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG5cbiAgICBhYnJ1cHQ6IGZ1bmN0aW9uKHR5cGUsIGFyZykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS50cnlMb2MgPD0gdGhpcy5wcmV2ICYmXG4gICAgICAgICAgICBoYXNPd24uY2FsbChlbnRyeSwgXCJmaW5hbGx5TG9jXCIpICYmXG4gICAgICAgICAgICB0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgdmFyIGZpbmFsbHlFbnRyeSA9IGVudHJ5O1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGlmIChmaW5hbGx5RW50cnkgJiZcbiAgICAgICAgICAodHlwZSA9PT0gXCJicmVha1wiIHx8XG4gICAgICAgICAgIHR5cGUgPT09IFwiY29udGludWVcIikgJiZcbiAgICAgICAgICBmaW5hbGx5RW50cnkudHJ5TG9jIDw9IGFyZyAmJlxuICAgICAgICAgIGFyZyA8PSBmaW5hbGx5RW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAvLyBJZ25vcmUgdGhlIGZpbmFsbHkgZW50cnkgaWYgY29udHJvbCBpcyBub3QganVtcGluZyB0byBhXG4gICAgICAgIC8vIGxvY2F0aW9uIG91dHNpZGUgdGhlIHRyeS9jYXRjaCBibG9jay5cbiAgICAgICAgZmluYWxseUVudHJ5ID0gbnVsbDtcbiAgICAgIH1cblxuICAgICAgdmFyIHJlY29yZCA9IGZpbmFsbHlFbnRyeSA/IGZpbmFsbHlFbnRyeS5jb21wbGV0aW9uIDoge307XG4gICAgICByZWNvcmQudHlwZSA9IHR5cGU7XG4gICAgICByZWNvcmQuYXJnID0gYXJnO1xuXG4gICAgICBpZiAoZmluYWxseUVudHJ5KSB7X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hpcy50cnlFbnRyaWVzW2ldO1xuICAgICAgICBpZiAoZW50cnkuZmluYWxseUxvYyA9PT0gZmluYWxseUxvYykge1xuICAgICAgICAgIHRoaXMuY29tcGxldGUoZW50cnkuY29tcGxldGlvbiwgZW50cnkuYWZ0ZXJMb2MpO1xuICAgICAgICAgIHJlc2V0VHJ5RW50cnkoZW50cnkpO1xuICAgICAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIFwiY2F0Y2hcIjogZnVuY3Rpb24odHJ5TG9jKSB7XG4gICAgICBmb3IgKHZhciBpID0gdGhpcy50cnlFbnRyaWVzLmxlbmd0aCAtIDE7IGkgPj0gMDsgLS1pKSB7XG4gICAgICAgIHZhciBlbnRyeSA9IHRoaXMudHJ5RW50cmllc1tpXTtcbiAgICAgICAgaWYgKGVudHJ5LnRyeUxvYyA9PT0gdHJ5TG9jKSB7XG4gICAgICAgICAgdmFyIHJlY29yZCA9IGVudHJ5LmNvbXBsZXRpb247XG4gICAgICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgICAgIHZhciB0aHJvd24gPSByZWNvcmQuYXJnO1xuICAgICAgICAgICAgcmVzZXRUcnlFbnRyeShlbnRyeSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJldHVybiB0aHJvd247XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgLy8gVGhlIGNvbnRleHQuY2F0Y2ggbWV0aG9kIG11c3Qgb25seSBiZSBjYWxsZWQgd2l0aCBhIGxvY2F0aW9uXG4gICAgICAvLyBhcmd1bWVudCB0aGF0IGNvcnJlc3BvbmRzIHRvIGEga25vd24gY2F0Y2ggYmxvY2suXG4gICAgICB0aHJvdyBuZXcgRXJyb3IoXCJpbGxlZ2FsIGNhdGNoIGF0dGVtcHRcIik7XG4gICAgfSxcblxuICAgIGRlbGVnYXRlWWllbGQ6IGZ1bmN0aW9uK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VycikgY2IoZXJyKTtcbiAgICAgICAgICAgIGVsc2UgaW5pdChyZWFsU3RhcnQpO1xuICAgICAgICB9XG4gICAgKTtcblxuICAgIHZhciByZXM7XG4gICAgZnVuY3Rpb24gaW5pdChiYXNlZGlyKSB7XG4gICAgICAgIGlmICgoL14oPzpcXC5cXC4/KD86XFwvfCQpfFxcL3woW0EtWmEtel06KT9bL1xcXFxdKS8pLnRlc3QoeCkpIHtcbiAgICAgICAgICAgIHJlcyA9IHBhdGgucmVzb2x2ZShiYXNlZGlyLCB4KTtcbiAgICAgICAgICAgIGlmICh4ID09PSAnLi4nIHx8IHguc2xpY2UoLTEpID09PSAnLycpIHJlcyArPSAnLyc7XG4gICAgICAgICAgICBpZiAoKC9cXC8kLykudGVzdCh4KSAmJiByZXMgPT09IGJhc2VkaXIpIHtcbiAgICAgICAgICAgICAgICBsb2FkQXNEaXJlY3RvcnkocmVzLCBvcHRzLnBhY2thZ2UsIG9uZmlsZSk7XG4gICAgICAgICAgICB9IGVsc2UgbG9hZEFzRmlsZShyZXMsIG9wdHMucGFja2FnZSwgb25maWxlKTtcbiAgICAgICAgfSBlbHNlIGxvYWROb2RlTW9kdWxlcyh4LCBiYXNlZGlyLCBmdW5jdGlvbiAoZXJyLCBuLCBwa2cpIHtcbiAgICAgICAgICAgIGlmIChlcnIpIGNiKGVycik7XG4gICAgICAgICAgICBlbHNlIGlmIChjb3JlW3hdKSByZXR1cm4gY2IobnVsbCwgeCk7XG4gICAgICAgICAgICBlbHNlIGlmIChuKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG1heWJlVW53cmFwU3ltbGluayhuLCBvcHRzLCBmdW5jdGlvbiAoZXJyLCByZWFsTikge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjYihlcnIpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2IobnVsbCwgcmVhbE4sIHBrZyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdmFyIG1vZHVsZUVycm9yID0gbmV3IEVycm9yKFwiQ2Fubm90IGZpbmQgbW9kdWxlICdcIiArIHggKyBcIicgZnJvbSAnXCIgKyBwYXJlbnQgKyBcIidcIik7XG4gICAgICAgICAgICAgICAgbW9kdWxlRXJyb3IuY29kZSA9ICdNT0RVTEVfTk9UX0ZPVU5EJztcbiAgICAgICAgICAgICAgICBjYihtb2R1bGVFcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIG9uZmlsZShlcnIsIG0sIHBrZykge1xuICAgICAgICBpZiAoZXJyKSBjYihlcnIpO1xuICAgICAgICBlbHNlIGlmIChtKSBjYihudWxsLCBtLCBwa2cpO1xuICAgICAgICBlbHNlIGxvYWRBc0RpcmVjdG9yeShyZXMsIGZ1bmN0aW9uIChlcnIsIGQsIHBrZykge1xuICAgICAgICAgICAgaWYgKGVycikgY2IoZXJyKTtcbiAgICAgICAgICAgIGVsc2UgaWYgKGQpIHtcbiAgICAgICAgICAgICAgICBtYXliZVVud3JhcFN5bWxpbmsoZCwgb3B0cywgZnVuY3Rpb24gKGVyciwgcmVhbEQpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2IoZXJyKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNiKG51bGwsIHJlYWxELCBwa2cpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHZhciBtb2R1bGVFcnJvciA9IG5ldyBFcnJvcihcIkNhbm5vdCBmaW5kIG1vZHVsZSAnXC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1bmN0aW9uIG9ucGtnKGVyciwgcGtnXywgZGlyKSB7XG4gICAgICAgICAgICAgICAgcGtnID0gcGtnXztcbiAgICAgICAgICAgICAgICBpZiAoZXJyKSByZXR1cm4gY2IoZXJyKTtcbiAgICAgICAgICAgICAgICBpZiAoZGlyICYmIHBrZyAmJiBvcHRzLnBhdGhGaWx0ZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJmaWxlID0gcGF0aC5yZWxhdGl2ZShkaXIsIGZpbGUpO1xuICAgICAgICAgICAgICAgICAgICB2YXIgcmVsID0gcmZpbGUuc2xpY2UoMCwgcmZpbGUubGVuZ3RoIC0gZXh0c1swXS5sZW5ndGgpO1xuICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG9wdHMucGF0aEZpbHRlcihwa2csIHgsIHJlbCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChyKSByZXR1cm4gbG9hZChcbiAgICAgICAgICAgICAgICAgICAgICAgIFsnJ10uY29uY2F0KGV4dGVuc2lvbnMuc2xpY2UoKSksXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoLnJlc29sdmUoZGlyLCByKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBrZ1xuICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpc0ZpbGUoZmlsZSwgb25leCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBmdW5jdGlvbiBvbmV4KGVyciwgZXgpIHtcbiAgICAgICAgICAgICAgICBpZiAoZXJyKSByZXR1cm4gY2IoZXJyKTtcbiAgICAgICAgICAgICAgICBpZiAoZXgpIHJldHVybiBjYihudWxsLCBmaWxlLCBwa2cpO1xuICAgICAgICAgICAgICAgIGxvYWQoZXh0cy5zbGljZSgxKSwgeCwgcGtnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIGxvYWRwa2coZGlyLCBjYikge1xuICA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RvcnkoeCwgbG9hZEFzRGlyZWN0b3J5UGFja2FnZSwgY2FsbGJhY2spIHtcbiAgICAgICAgdmFyIGNiID0gY2FsbGJhY2s7XG4gICAgICAgIHZhciBmcGtnID0gbG9hZEFzRGlyZWN0b3J5UGFja2FnZTtcbiAgICAgICAgaWYgKHR5cGVvZiBmcGtnID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICBjYiA9IGZwa2c7XG4gICAgICAgICAgICBmcGtnID0gb3B0cy5wYWNrYWdlO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHBrZ2ZpbGUgPSBwYXRoLmpvaW4oeCwgJ3BhY2thZ2UuanNvbicpO1xuICAgICAgICBpc0ZpbGUocGtnZmlsZSwgZnVuY3Rpb24gKGVyciwgZXgpIHtcbiAgICAgICAgICAgIGlmIChlcnIpIHJldHVybiBjYihlcnIpO1xuICAgICAgICAgICAgaWYgKCFleCkgcmV0dXJuIGxvYWRBc0ZpbGUocGF0aC5qb2luKHgsICdpbmRleCcpLCBmcGtnLCBjYik7XG5cbiAgICAgICAgICAgIHJlYWRGaWxlKHBrZ2ZpbGUsIGZ1bmN0aW9uIChlcnIsIGJvZHkpIHtcbiAgICAgICAgICAgICAgICBpZiAoZXJyKSByZXR1cm4gY2IoZXJyKTtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgcGtnID0gSlNPTi5wYXJzZShib2R5KTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChqc29uRXJyKSB7fVxuXG4gICAgICAgICAgICAgICAgaWYgKG9wdHMucGFja2FnZUZpbHRlcikge1xuICAgICAgICAgICAgICAgICAgICBwa2cgPSBvcHRzLnBhY2thZ2VGaWx0ZXIocGtnLCBwa2dmaWxlKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAocGtnLm1haW4pIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBwa2cubWFpbiAhPT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtYWluRXJyb3IgPSBuZXcgVHlwZUVycm9yKCdwYWNrYWdlIOKAnCcgKyBwa2cubmFtZSArICfigJ0gYG1haW5gIG11c3QgYmUgYSBzdHJpbmcnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1haW5FcnJvci5jb2RlID0gJ0lOVkFMSURfUEFDS0FHRV9NQUlOJztcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjYihtYWluRXJyb3IpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmIChwa2cubWFpbiA9PT0gJy4nIHx8IHBrZy5tYWluID09PSAnLi8nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwa2cubWFpbiA9ICdpbmRleCc7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbG9hZEFzRmlsZShwYXRoLnJlc29sdmUoeCwgcGtnLm1haW4pLCBwa2csIGZ1bmN0aW9uIChlcnIsIG0sIHBrZykge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVycikgcmV0dXJuIGNiKGVycik7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobSkgcmV0dXJuIGNiKG51bGwsIG0sIHBrZyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXBrZykgcmV0dXJuIGxvYWRBc0ZpbGUocGF0aC5qb2luKHgsICdpbmRleCcpLCBwa2csIGNiKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGRpciA9IHBhdGgucmVzb2x2ZSh4LCBwa2cubWFpbik7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2FkQXNEaXJlY3RvcnkoZGlyLCBwa2csIGZ1bmN0aW9uIChlcnIsIG4sIHBrZykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlcnIpIHJldHVybiBjYihlcnIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSByZXR1cm4gY2IobnVsbCwgbiwgcGtnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2FkQXNGaWxlKHBhdGguam9pbih4LCAnaW5kZXgnKSwgcGtnLCBjYik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBsb2FkQXNGaWxlKHBhdGguam9pbih4LCAnL2luZGV4JyksIHBrZywgY2IpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHByb2Nlc3NEaXJzKGNiLCBkaXJzKSB7XG4gICAgICAgIGlmIChkaXJzLmxlbmd0aCA9PT0gMCkgcmV0dXJuIGNiKG51bGwsIHVuZGVmaW5lZCk7XG4gICAgICAgIHZhciBkaXIgPSBkaXJzWzBdO1xuXG4gICAgICAgIGlzRGlyZWN0b3J5KGRpciwgaXNkaXIpO1xuXG4gICAgICAgIGZ1bmN0aW9uIGlzZGlyKGVyciwgaXNkaXIpIHtcbiAgICAgICAgICAgIGlmIChlcnIpIHJldHVybiBjYihlcnIpO1xuICAgICAgICAgICAgaWYgKCFpc2RpcikgcmV0dXJuIHByb2Nlc3NEaXJzKGNiLCBkaXJzLnNsaWNlKDEpKTtcbiAgICAgICAgICAgIHZhciBmaWxlID0gcGF0aC5qb2luKGRpciwgeCk7XG4gICAgICAgICAgICBsb2FkQXNGaWxlKGZpbGUsIG9wdHMucGFja2FnZSwgb25maWxlKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1bmN0aW9uIG9uZmlsZShlcnIsIG0sIHBrZykge1xuICAgICAgICAgICAgaWYgKGVycikgcmV0dXJuIGNiKGVycik7XG4gICAgICAgICAgICBpZiAobSkgcmV0dXJuIGNiKG51bGwsIG0sIHBrZyk7XG4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gICAgICAgIGlmIChkaXIgPT09ICcnIHx8IGRpciA9PT0gJy8nKSByZXR1cm47XG4gICAgICAgIGlmIChwcm9jZXNzLnBsYXRmb3JtID09PSAnd2luMzInICYmICgvXlxcdzpbL1xcXFxdKiQvKS50ZXN0KGRpcikpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAoKC9bL1xcXFxdbm9kZV9tb2R1bGVzWy9cXFxcXSokLykudGVzdChkaXIpKSByZXR1cm47XG5cbiAgICAgICAgdmFyIHBrZ2ZpbGUgPSBwYXRoLmpvaW4oZGlyLCAncGFja2FnZS5qc29uJyk7XG5cbiAgICAgICAgaWYgKCFpc0ZpbGUocGtnZmlsZSkpIHtcbiAgICAgICAgICAgIHJldHVybiBsb2FkcGtnKHBhdGguZGlybmFtZShkaXIpKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBib2R5ID0gcmVhZEZpbGVTeW5jKHBrZ2ZpbGUpO1xuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICB2YXIgcGtnID0gSlNPTi5wYXJzZShib2R5KTtcbiAgICAgICAgfSBjYXRjaCAoanNvbkVycikge31cblxuICAgICAgICBpZiAocGtnICYmIG9wdHMucGFja2FnZUZpbHRlcikge1xuICAgICAgICAgICAgcGtnID0gb3B0cy5wYWNrYWdlRmlsdGVyKHBrZywgZGlyKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB7IHBrZzogcGtnLCBkaXI6IGRpciB9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGxvYWRBc0RpcmVjdG9yeVN5bmMoeCkge1xuICAgICAgICB2YXIgcGtnZmlsZSA9IHBhdGguam9pbih4LCAnL3BhY2thZ2UuanNvbicpO1xuICAgICAgICBpZiAoaXNGaWxlKHBrZ2ZpbGUpKSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIHZhciBib2R5ID0gcmVhZEZpbGVTeW5jKHBrZ2ZpbGUsICdVVEY4Jyk7XG4gICAgICAgICAgICAgICAgdmFyIHBrZyA9IEpTT04ucGFyc2UoYm9keSk7XG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxuXG4gICAgICAgICAgICBpZiAob3B0cy5wYWNrYWdlRmlsdGVyKSB7XG4gICAgICAgICAgICAgICAgcGtnID0gb3B0cy5wYWNrYWdlRmlsdGVyKHBrZywgeCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChwa2cubWFpbikge1xuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcGtnLm1haW4gIT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBtYWluRXJyb3IgPSBuZXcgVHlwZUVycm9yKCdwYWNrYWdlIOKAnCcgKyBwa2cubmFtZSArICfigJ0gYG1haW5gIG11c3QgYmUgYSBzdHJpbmcnKTtcbiAgICAgICAgICAgICAgICAgICAgbWFpbkVycm9yLmNvZGUgPSAnSU5WQUxJRF9QQUNLQUdFX01BSU4nO1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBtYWluRXJyb3I7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwa2cubWFpbiA9PT0gJy4nIHx8IHBrZy5tYWluID09PSAnLi8nKSB7XG4gICAgICAgICAgICAgICAgICAgIHBrZy5tYWluID0gJ2luZGV4JztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSBsb2FkQXNGaWxlU3luYyhwYXRoLnJlc29sdmUoeCwgcGtnLm1haW4pKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG0pIHJldHVybiBtO1xuICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGxvYWRBc0RpcmVjdG9yeVN5bmMocGF0aC5yZXNvbHZlKHgsIHBrZy5tYWluKSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChuKSByZXR1cm4gbjt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gICAgICAgICAgaWYgKC9mdW5jdGlvbig/OlxccysoW1xcdyRdKykpK1xccypcXCgvLnRlc3QoY3Vyci50b1N0cmluZygpKSkge1xuICAgICAgICAgICAgICAgICAgICBzdGFjay5wdXNoKG5ldyBTdGFja0ZyYW1lKHtmdW5jdGlvbk5hbWU6IFJlZ0V4cC4kMSB8fCB1bmRlZmluZWQsIGFyZ3M6IGFyZ3N9KSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc3RhY2sucHVzaChuZXcgU3RhY2tGcmFtZSh7YXJnczogYXJnc30pKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBjdXJyID0gY3Vyci5jYWxsZXI7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gc3RhY2s7XG4gICAgICAgIH1cbiAgICB9O1xufSkpO1xuIiwiKGZ1bmN0aW9uKHJvb3QsIGZhY3RvcnkpIHtcbiAgICAndXNlIHN0cmljdCc7XG4gICAgLy8gVW5pdmVyc2FsIE1vZHVsZSBEZWZpbml0aW9uIChVTUQpIHRvIHN1cHBvcnQgQU1ELCBDb21tb25KUy9Ob2RlLmpzLCBSaGlubywgYW5kIGJyb3dzZXJzLlxuXG4gICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICBpZiAodHlwZW9mIGRlZmluZSA9PT0gJ2Z1bmN0aW9uJyAmJiBkZWZpbmUuYW1kKSB7XG4gICAgICAgIGRlZmluZSgnc3RhY2tmcmFtZScsIFtdLCBmYWN0b3J5KTtcbiAgICB9IGVsc2UgaWYgKHR5cGVvZiBleHBvcnRzID09PSAnb2JqZWN0Jykge1xuICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IGZhY3Rv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5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGlmIChvYmouaGFzT3duUHJvcGVydHkocHJvcHNbaV0pICYmIG9ialtwcm9wc1tpXV0gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzWydzZXQnICsgX2NhcGl0YWxpemUocHJvcHNbaV0pXShvYmpbcHJvcHNbaV1dKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBTdGFja0ZyYW1lLnByb3RvdHlwZSA9IHtcbiAgICAgICAgZ2V0QXJnczogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5hcmdzO1xuICAgICAgICB9LFxuICAgICAgICBzZXRBcmdzOiBmdW5jdGlvbih2KSB7XG4gICAgICAgICAgICBpZiAoT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKHYpICE9PSAnW29iamVjdCBBcnJheV0nKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQXJncyBtdXN0IGJlIGFuIEFycmF5Jyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLmFyZ3MgPSB2O1xuICAgICAgICB9LFxuXG4gICAgICAgIGdldEV2YWxPcmlnaW46IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZXZhbE9yaWdpbjtcbiAgICAgICAgfSxcbiAgICAgICAgc2V0RXZhbE9yaWdpbjogZnVuY3Rpb24odikge1xuICAgICAgICAgICAgaWYgKHYgaW5zdGFuY2VvZiBTdGFja0ZyYW1lKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5ldmFsT3JpZ2luID0gdjtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodiBpbnN0YW5jZW9mIE9iamVjdCkge1xuICAgICAgICAgICAgICAgIHRoaXMuZXZhbE9yaWdpbiA9IG5ldyBTdGFja0ZyYW1lKHYpO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IoYm9vbGVhblByb3BzW2ldKTtcbiAgICAgICAgU3RhY2tGcmFtZS5wcm90b3R5cGVbJ3NldCcgKyBfY2FwaXRhbGl6ZShib29sZWFuUHJvcHNbaV0pXSA9IChmdW5jdGlvbihwKSB7XG4gICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24odikge1xuICAgICAgICAgICAgICAgIHRoaXNbcF0gPSBCb29sZWFuKHYpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSkoYm9vbGVhblByb3BzW2ldKTtcbiAgICB9XG5cbiAgICBmb3IgKHZhciBqID0gMDsgaiA8IG51bWVyaWNQcm9wcy5sZW5ndGg7IGorKykge1xuICAgICAgICBTdGFja0ZyYW1lLnByb3RvdHlwZVsnZ2V0JyArIF9jYXBpdGFsaXplKG51bWVyaWNQcm9wc1tqXSldID0gX2dldHRlcihudW1lcmljUHJvcHNbal0pO1xuICAgICAgICBTdGFja0ZyYW1lLnByb3RvdHlwZVsnc2V0JyArIF9jYXBpdGFsaXplKG51bWVyaWNQcm9wc1tqXSldID0gKGZ1bmN0aW9uKHApIHtcbiAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbih2KSB7XG4gICAgICAgICAgICAgICAgaWYgKCFfaXNOdW1iZXIodikpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihwICsgJyBtdXN0IGJlIGEgTnVtYmVyJyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXNbcF0gPSBOdW1iZXIodik7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9KShudW1lcmljUHJvcHNbal0pO1xuICAgIH1cblxuICAgIGZvciAodmFyIGsgPSAwOyBrIDwgc3RyaW5nUHJvcHMubGVuZ3RoOyBrKyspIHtcbiAgICAgICAgU3RhY2tGcmFtZS5wcm90b3R5cGVbJ2dldCcgKyBfY2FwaXRhbGl6ZShzdHJpbmdQcm9wc1trXSldID0gX2dldHRlcihzdHJpbmdQcm9wc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RpdmUodGhpcy5zb3VyY2VSb290LCBuZWVkbGUuc291cmNlKTtcbiAgICB9XG4gICAgaWYgKCF0aGlzLl9zb3VyY2VzLmhhcyhuZWVkbGUuc291cmNlKSkge1xuICAgICAgcmV0dXJuIFtdO1xuICAgIH1cbiAgICBuZWVkbGUuc291cmNlID0gdGhpcy5fc291cmNlcy5pbmRleE9mKG5lZWRsZS5zb3VyY2UpO1xuXG4gICAgdmFyIG1hcHBpbmdzID0gW107XG5cbiAgICB2YXIgaW5kZXggPSB0aGlzLl9maW5kTWFwcGluZyhuZWVkbGUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fb3JpZ2luYWxNYXBwaW5ncyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm9yaWdpbmFsTGluZVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwib3JpZ2luYWxDb2x1bW5cIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1dGlsLmNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpbmFyeVNlYXJjaC5MRUFTVF9VUFBFUl9CT1VORCk7XG4gICAgaWYgKGluZGV4ID49IDApIHtcbiAgICAgIHZhciBtYXBwaW5nID0gdGhpcy5fb3JpZ2luYWxNYXBwaW5nc1tpbmRleF07XG5cbiAgICAgIGlmIChhQXJncy5jb2x1bW4gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICB2YXIgb3JpZ2luYWxMaW5lID0gbWFwcGluZy5vcmlnaW5hbExpbmU7XG5cbiAgICAgICAgLy8gSXRlcmF0ZSB1bnRpbCBlaXRoZXIgd2UgcnVuIG91dCBvZiBtYXBwaW5ncywgb3Igd2UgcnVuIGludG9cbiAgICAgICAgLy8gYSBtYXBwaW5nIGZvciBhIGRpZmZlcmVudCBsaW5lIHRoYW4gdGhlIG9uZSB3ZSBmb3VuZC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3IFhNTEh0dHBSZXF1ZXN0KCk7XG4gICAgICAgICAgICByZXEub3BlbignZ2V0JywgdXJsKTtcbiAgICAgICAgICAgIHJlcS5vbmVycm9yID0gcmVqZWN0O1xuICAgICAgICAgICAgcmVxLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uIG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHtcbiAgICAgICAgICAgICAgICBpZiAocmVxLnJlYWR5U3RhdGUgPT09IDQpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKChyZXEuc3RhdHVzID49IDIwMCAmJiByZXEuc3RhdHVzIDwgMzAwKSB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgKHVybC5zdWJzdHIoMCwgNykgPT09ICdmaWxlOi8vJyAmJiByZXEucmVzcG9uc2VUZXh0KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZShyZXEucmVzcG9uc2VUZXh0KTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdChuZXcgRXJyb3IoJ0hUVFAgc3RhdHVzOiAnICsgcmVxLnN0YXR1cyArICcgcmV0cmlldmluZyAnICsgdXJsKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgcmVxLnNlbmQoKTtcbiAgICAgICAgfSk7XG5cbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDb252ZXJ0IGEgQmFzZTY0LWVuY29kZWQgc3RyaW5nIGludG8gaXRzIG9yaWdpbmFsIHJlcHJlc2VudGF0aW9uLlxuICAgICAqIFVzZWQgZm9yIGlubGluZSBzb3VyY2VtYXBzLlxuICAgICAqXG4gICAgICogQHBhcmFtIHtTdHJpbmd9IGI2NHN0ciBCYXNlLTY0IGVuY29kZWQgc3RyaW5nXG4gICAgICogQHJldHVybnMge1N0cmluZ30gb3JpZ2luYWwgcm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0gbGluZXNbbGluZU51bWJlciAtIGkgLSAxXTtcbiAgICAgICAgICAgIHZhciBjb21tZW50UG9zID0gbGluZS5pbmRleE9mKCcvLycpO1xuICAgICAgICAgICAgaWYgKGNvbW1lbnRQb3MgPj0gMCkge1xuICAgICAgICAgICAgICAgIGxpbmUgPSBsaW5lLnN1YnN0cigwLCBjb21tZW50UG9zKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGxpbmUpIHtcbiAgICAgICAgICAgICAgICBjb2RlID0gbGluZSArIGNvZGU7XG4gICAgICAgICAgICAgICAgdmFyIGxlbiA9IHN5bnRheGVzLmxlbmd0aDtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpbmRleCA9IDA7IGluZGV4IDwgbGVuOyBpbmRleCsrKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBtID0gc3ludGF4ZXNbaW5kZXhdLmV4ZWMoY29kZSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChtICYmIG1bMV0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtWzFdO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gX2Vuc3VyZVN1cHBvcnRlZEVudmlyb25tZW50KCkge1xuICAgICAgICBpZiAodHlwZW9mIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSAhPT0gJ2Z1bmN0aW9uJyB8fCB0eXBlb2YgT2JqZWN0LmNyZWF0ZSAhPT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdVbmFibGUgdG8gY29uc3VtZSBzb3VyY2UgbWFwcyBpbiBvbGRlciBicm93c2VycycpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gX2Vuc3VyZVN0YWNrRnJhbW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mFtZS5jb2x1bW5OdW1iZXJcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBpZiAobG9jLnNvdXJjZSkge1xuICAgICAgICAgICAgICAgIC8vIGNhY2hlIG1hcHBlZCBzb3VyY2VzXG4gICAgICAgICAgICAgICAgdmFyIG1hcHBlZFNvdXJjZSA9IHNvdXJjZU1hcENvbnN1bWVyLnNvdXJjZUNvbnRlbnRGb3IobG9jLnNvdXJjZSk7XG4gICAgICAgICAgICAgICAgaWYgKG1hcHBlZFNvdXJjZSkge1xuICAgICAgICAgICAgICAgICAgICBzb3VyY2VDYWNoZVtsb2Muc291cmNlXSA9IG1hcHBlZFNvdXJjZTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZXNvbHZlKFxuICAgICAgICAgICAgICAgICAgICAvLyBnaXZlbiBzdGFja2ZyYW1lIGFuZCBzb3VyY2UgbG9jYXRpb24sIHVwZGF0ZSBzdGFja2ZyYW1lXG4gICAgICAgICAgICAgICAgICAgIG5ldyBTdGFja0ZyYW1lKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uTmFtZTogbG9jLm5hbWUgfHwgc3RhY2tmcmFtZS5mdW5jdGlvbk5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICBhcmdzOiBzdGFja2ZyYW1lLmFyZ3MsXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTogbG9jLnNvdXJjZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVOdW1iZXI6IGxvYy5saW5lLFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sdW1uTnVtYmVyOiBsb2MuY29sdW1uXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmVqZWN0KG5ldyBFcnJvcignQ291bGQgbm90IGdldCBvcmlnaW5hbCBzb3VyY2UgZm9yIGdpdmVuIHN0YWNrZnJhbWUgY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Hx8IF94ZHI7XG5cbiAgICAgICAgdGhpcy5fYXRvYiA9IG9wdHMuYXRvYiB8fCBfYXRvYjtcblxuICAgICAgICB0aGlzLl9nZXQgPSBmdW5jdGlvbiBfZ2V0KGxvY2F0aW9uKSB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoZnVuY3Rpb24ocmVzb2x2ZSwgcmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgdmFyIGlzRGF0YVVybCA9IGxvY2F0aW9uLnN1YnN0cigwLCA1KSA9PT0gJ2RhdGE6JztcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5zb3VyY2VDYWNoZVtsb2NhdGlvbl0pIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSh0aGlzLnNvdXJjZUNhY2hlW2xvY2F0aW9uXSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChvcHRzLm9mZmxpbmUgJiYgIWlzRGF0YVVybCkge1xuICAgICAgICAgICAgICAgICAgICByZWplY3QobmV3IEVycm9yKCdDYW5ub3QgbWFrZSBuZXR3b3JrIHJlcXVlc3RzIGluIG9mZmxpbmUgbW9kZScpKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAoaXNEYXRhVXJsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBkYXRhIFVSTHMgY2FuIGhhdmUgcGFyYW1ldGVycy5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNlZSBodHRwOi8vdG9vbHMuaWV0Zi5vcmcvaHRtbC9yZmMyMzk3XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgc3VwcG9ydGVkRW5jb2RpbmdSZWdleHAgPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9eZGF0YTphcHBsaWNhdGlvblxcL2pzb247KFtcXHc9OlwiLV0rOykqYmFzZTY0LC87XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgbWF0Y2ggPSBsb2NhdGlvbi5tYXRjaChzdXBwb3J0ZWRFbmNvZGluZ1JlZ2V4cCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobWF0Y2gpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgc291cmNlTWFwU3RhcnQgPSBtYXRjaFswXS5sZW5ndGg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGVuY29kZWRTb3VyY2UgPSBsb2NhdGlvbi5zdWJzdHIoc291cmNlTWFwU3RhcnQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzb3VyY2UgPSB0aGlzLl9hdG9iKGVuY29kZWRTb3VyY2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc291cmNlQ2FjaGVbbG9jYXRpb25dID0gc291cmNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoc291cmNlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVqZWN0KG5ldyBFcnJvcignVGhlIGVuY29kaW5nIG9mIHRoZSBpbmxpbmUgc291cmNlbWFwIGlzIG5vdCBzdXBwb3J0ZWQnKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgeGhyUHJvbWlzZSA9IHRoaXMuYWpheChsb2NhdGlvbiwge21ldGhvZDogJ2dldCd9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIENhY2hlIHRoZSBQcm9taXNlIHRvIHByZXZlbnQgZHVwbGljYXRlIGluLWZsaWdodCByZXF1ZXN0c1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zb3VyY2VDYWNoZVtsb2NhdGlvbl0gPSB4aHJQcm9taXNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgeGhyUHJvbWlzZS50aGVuKHJlc29sdmUsIHJlamVjdCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LmJpbmQodGhpcykpO1xuICAgICAgICB9O1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBDcmVhdGluZyBTb3VyY2VNYXBDb25zdW1lcnMgaXMgZXhwZW5zaXZlLCBzbyB0aGlzIHdyYXBzIHRoZSBjcmVhdGlvbiBvZiBhXG4gICAgICAgICAqIFNvdXJjZU1hcENvbnN1bWVyIGluIGEgcGVyLWluc3RhbmNlIGNhY2hlLlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0ge1N0cmluZ30gc291cmNlTWFwcGluZ1VSTCA9IFVSTCB0byBmZXRjaCBzb3VyY2UgbWFwIGZyb21cbiAgICAgICAgICogQHBhcmFtIHtTdHJpbmd9IGRlZmF1bHRTb3VyY2VSb290ID0gRGVmYXVsdCBzb3VyY2Ugcm9vdCBmb3Igc291cmNlIG1hcCBpZiB1bmRlZmluZWRcbiAgICAgICAgICogQHJldHVybnMge1Byb21pc2V9IHRoYXQgcmVzb2x2ZXMgYSBTb3VyY2VNYXBDb25zdW1lclxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5fZ2V0U291cmNlTWFwQ29uc3VtZXIgPSBmdW5jdGlvbiBfZ2V0U291cmNlTWFwQ29uc3VtZXIoc291cmNlTWFwcGluZ1VSTCwgZGVmYXVsdFNvdXJjZVJvb3QpIHtcbiAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5zb3VyY2VNYXBDb25zdW1lckNhY2hlW3NvdXJjZU1hcHBpbmdVUkxdKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmUodGhpcy5zb3VyY2VNYXBDb25zdW1lckNhY2hlW3NvdXJjZU1hcHBpbmdVUkxdKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB2YXIgc291cmNlTWFwQ29uc3VtZXJQcm9taXNlID0gbmV3IFByb21pc2UoZnVuY3Rpb24ocmVzb2x2ZSwgcmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZ2V0KHNvdXJjZU1hcHBpbmdVUkwpLnRoZW4oZnVuY3Rpb24oc291cmNlTWFwU291cmNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBzb3VyY2VNYXBTb3VyY2UgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZU1hcFNvdXJjZSA9IF9wYXJzZUpzb24oc291cmNlTWFwU291cmNlLnJlcGxhY2UoL15cXClcXF1cXH0nLywgJycpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBzb3VyY2VNYXBTb3VyY2Uuc291cmNlUm9vdCA9PT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlTWFwU291cmNlLnNvdXJjZVJvb3QgPSBkZWZhdWx0U291cmNlUm9vdDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKG5ldyBTb3VyY2VNYXAuU291cmNlTWFwQ29uc3VtZXIoc291cmNlTWFwU291cmNlKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9LCByZWplY3QpO1xuICAgICAgICAgICAgICAgICAgICB9LmJpbmQodGhpcykpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnNvdXJjZU1hcENvbnN1bWVyQ2FjaGVbc291cmNlTWFwcGluZ1VSTF0gPSBzb3VyY2VNYXBDb25zdW1lclByb21pc2U7XG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmUoc291cmNlTWFwQ29uc3VtZXJQcm9taXNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LmJpbmQodGhpcykpO1xuICAgICAgICB9O1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBHaXZlbiBhIFN0YWNrRnJhbWUsIGVuaGFuY2UgZnVuY3Rpb24gbmFtZSBhbmQgdXNlIHNvdXJjZSBtYXBzIGZvciBhXG4gICAgICAgICAqIGJldHRlciBTdGFja0ZyYW1lLlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0ge1N0YWNrRnJhbWV9IHN0YWNrZnJhbWUgb2JqZWN0XG4gICAgICAgICAqIEByZXR1cm5zIHtQcm9taXNlfSB0aGF0IHJlc29sdmVzIHdpdGggd2l0aCBzb3VyY2UtbWFwcGVkIFN0YWNrRnJhbWVcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMucGlucG9pbnQgPSBmdW5jdGlvbiBTdGFja1RyYWNlR1BTJCRwaW5wb2ludChzdGFja2ZyYW1lKSB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoZnVuY3Rpb24ocmVzb2x2ZSwgcmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5nZXRNYXBwZWRMb2NhdGlvbihzdGFja2ZyYW1lKS50aGVuKGZ1bmN0aW9uKG1hcHBlZFN0YWNrRnJhbWUpIHtcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcmVzb2x2ZU1hcHBlZFN0YWNrRnJhbWUoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKG1hcHBlZFN0YWNrRnJhbWUpO1xuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5maW5kRnVuY3Rpb25OYW1lKG1hcHBlZFN0YWNrRnJhbWUpXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbihyZXNvbHZlLCByZXNvbHZlTWFwcGVkU3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rpb25OYW1lID0gX2ZpbmRGdW5jdGlvbk5hbWUoc291cmNlLCBsaW5lTnVtYmVyLCBjb2x1bW5OdW1iZXIpO1xuICAgICAgICAgICAgICAgICAgICAvLyBPbmx5IHJlcGxhY2UgZnVuY3Rpb25OYW1lIGlmIHdlIGZvdW5kIHNvbWV0aGluZ1xuICAgICAgICAgICAgICAgICAgICBpZiAoZ3Vlc3NlZEZ1bmN0aW9uTmFtZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZShuZXcgU3RhY2tGcmFtZSh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb25OYW1lOiBndWVzc2VkRnVuY3Rpb25OYW1lLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3M6IHN0YWNrZnJhbWUuYXJncyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTogc3RhY2tmcmFtZS5maWxlTmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lTnVtYmVyOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbk51bWJlcjogY29sdW1uTnVtYmVyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHN0YWNrZnJhbWUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgcmVqZWN0KVsnY2F0Y2gnXShyZWplY3QpO1xuICAgICAgICAgICAgfS5iaW5kKHRoaXMpKTtcbiAgICAgICAgfTtcblxuICAgICAgICAvKipcbiAgICAgICAgICogR2l2ZW4gYSBTdGFja0ZyYW1lLCBzZWVrIHNvdXJjZS1tYXBwZWQgbG9jYXRpb24gYW5kIHJldHVybiBuZXcgZW5oYW5jZWQgU3RhY2tGcmFtZS5cbiAgICAgICAgICpcbiAgICAgICAgICog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WzBdICE9PSAnLycgJiYgIWlzRGF0YVVybCAmJiAhKC9eaHR0cHM/OlxcL1xcL3xeXFwvXFwvL2kpLnRlc3Qoc291cmNlTWFwcGluZ1VSTCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZU1hcHBpbmdVUkwgPSBkZWZhdWx0U291cmNlUm9vdCArIHNvdXJjZU1hcHBpbmdVUkw7XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZ2V0U291cmNlTWFwQ29uc3VtZXIoc291cmNlTWFwcGluZ1VSTCwgZGVmYXVsdFNvdXJjZVJvb3QpXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbihzb3VyY2VNYXBDb25zdW1lcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfZXh0cmFjdExvY2F0aW9uSW5mb0Zyb21Tb3VyY2VNYXBTb3VyY2Uoc3RhY2tmcmFtZSwgc291cmNlTWFwQ29uc3VtZXIsIHNvdXJjZUNhY2hlKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAudGhlbihyZXNvbHZlKVsnY2F0Y2gnXShmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZShzdGFja2ZyYW1lKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH0uYmluZCh0aGlzKSwgcmVqZWN0KVsnY2F0Y2gnXShyZWplY3QpO1xuICAgICAgICAgICAgfS5iaW5kKHRoaXMpKTtcbiAgICAgICAgfTtcbiAgICB9O1xufSkpO1xuIiwiKGZ1bmN0aW9uKHJvb3QsIGZhY3RvcnkpIHtcbiAgICAndXNlIHN0cmljdCc7XG4gICAgLy8gVW5pdmVyc2FsIE1vZHVsZSBEZWZpbml0aW9uIChVTUQpIHRvIH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F0ZVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIF9tZXJnZShmaXJzdCwgc2Vjb25kKSB7XG4gICAgICAgIHZhciB0YXJnZXQgPSB7fTtcblxuICAgICAgICBbZmlyc3QsIHNlY29uZF0uZm9yRWFjaChmdW5jdGlvbihvYmopIHtcbiAgICAgICAgICAgIGZvciAodmFyIHByb3AgaW4gb2JqKSB7XG4gICAgICAgICAgICAgICAgaWYgKG9iai5oYXNPd25Qcm9wZXJ0eShwcm9wKSkge1xuICAgICAgICAgICAgICAgICAgICB0YXJnZXRbcHJvcF0gPSBvYmpbcHJvcF07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRhcmdldDtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgcmV0dXJuIHRhcmdldDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBfaXNTaGFwZWRMaWtlUGFyc2FibGVFcnJvcihlcnIpIHtcbiAgICAgICAgcmV0dXJuIGVyci5zdGFjayB8fCBlcnJbJ29wZXJhI3NvdXJjZWxvYyddO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIF9maWx0ZXJlZChzdGFja2ZyYW1lcywgZmlsdGVyKSB7XG4gICAgICAgIGlmICh0eXBlb2YgZmlsdGVyID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICByZXR1cm4gc3RhY2tmcmFtZXMuZmlsdGVyKGZpbHRlcik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHN0YWNrZnJhbWVzO1xuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICAgIC8qKlxuICAgICAgICAgKiBHZXQgYSBiYWNrdHJhY2UgZnJvbSBpbnZvY2F0aW9uIHBvaW50LlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0ge09iamVjdH0gb3B0c1xuICAgICAgICAgKiBAcmV0dXJucyB7QXJyYXl9IG9mIFN0YWNrRnJhbWVcbiAgICAgICAgICovXG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ZSBpdC5cbiAgICAgICAgICpcbiAgICAgICAgICogQHBhcmFtIHtFcnJvcn0gZXJyb3Igb2JqZWN0XG4gICAgICAgICAqIEBwYXJhbSB7T2JqZWN0fSBvcHRzXG4gICAgICAgICAqIEByZXR1cm5zIHtQcm9taXNlfSBmb3IgQXJyYXlbU3RhY2tGcmFtZX1cbiAgICAgICAgICovXG4gICAgICAgIGZyb21FcnJvcjogZnVuY3Rpb24gU3RhY2tUcmFjZSQkZnJvbUVycm9yKGVycm9yLCBvcHRzKSB7XG4gICAgICAgICAgICBvcHRzID0gX21lcmdlKF9vcHRpb25zLCBvcHRzKTtcbiAgICAgICAgICAgIHZhciBncHMgPSBuZXcgU3RhY2tUcmFjZUdQUyhvcHRzKTtcbiAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbihyZXNvbHZlKSB7XG4gICAgICAgICAgICAgICAgdmFyIHN0YWNrZnJhbWVzID0gX2ZpbHRlcmVkKEVycm9yU3RhY2tQYXJzZXIucGFyc2UoZXJyb3IpLCBvcHRzLmZpbHRlcik7XG4gICAgICAgICAgICAgICAgcmVzb2x2ZShQcm9taXNlLmFsbChzdGFja2ZyYW1lcy5tYXAoZnVuY3Rpb24oc2YpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKGZ1bmN0aW9uKHJlc29sdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJlc29sdmVPcmlnaW5hbCgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHNmKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgZ3BzLnBpbnBvaW50KHNmKS50aGVuKHJlc29sdmUsIHJlc29sdmVPcmlnaW5hbClbJ2NhdGNoJ10ocmVzb2x2ZU9yaWdpbmFsKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAg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YXBwbHkodGhpc0FyZyB8fCB0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKF9pc1NoYXBlZExpa2VQYXJzYWJsZUVycm9yKGUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZyb21FcnJvcihlKS50aGVuKGNhbGxiYWNrLCBlcnJiYWNrKVsnY2F0Y2gnXShlcnJiYWNrKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0uYmluZCh0aGlzKTtcbiAgICAgICAgICAgIGluc3RydW1lbnRlZC5fX3N0YWNrdHJhY2VPcmlnaW5hbEZuID0gZm47XG5cbiAgICAgICAgICAgIHJldHVybiBpbnN0cnVtZW50ZWQ7XG4gICAgICAgIH0sXG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEdpdmVuIGEgZnVuY3Rpb24gdGhhdCBoYXMgYmVlbiBpbnN0cnVtZW50ZWQsXG4gICAgICAgICAqIHJldmVydCB0aGUgZnVuY3Rpb24gdG8gaXQncyBvcmlnaW5hbCAobm9uLWluc3RydW1lbnRlZCkgc3RhdGUuXG4gICAgICAgICAqXG4gICAgICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IGZuIHRvIGRlLWluc3RydW1lbnRcbiAgICAgICAgICovXG4gICAgICAgIGRlaW5zdHJ1bWVudDogZnVuY3Rpb24gU3RhY2tUcmFjZSQkZGVpbnN0cnVtZW50KGZuKSB7XG4gICAgICAgICAgICBpZiAodHlwZW9mIGZuICE9PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdDYW5ub3QgZGUtaW5zdHJ1bWVudCBub24tZnVuY3Rpb24gb2JqZWN0Jyk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVv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SB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXEucmVhZHlTdGF0ZSA9PT0gNCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlcS5zdGF0dXMgPj0gMjAwICYmIHJlcS5zdGF0dXMgPCA0MDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHJlcS5yZXNwb25zZVRleHQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWplY3QobmV3IEVycm9yKCdQT1NUIHRvICcgKyB1cmwgKyAnIGZhaWxlZCB3aXRoIHN0YXR1czogJyArIHJlcS5zdGF0dXMpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcmVxLm9wZW4oJ3Bvc3QnLCB1cmwpO1xuXG4gICAgICAgICAgICAgICAgLy8gU2V0IHJlcXVlc3QgaGVhZGVyc1xuICAgICAgICAgICAgICAgIHJlcS5zZXRSZXF1ZXN0SGVhZGVyKCdDb250ZW50LVR5cGUnLCAnYXBwbGljYXRpb24vanNvbicpO1xuICAgICAgICAgICAgICAgIGlmIChyZXF1ZXN0T3B0aW9ucyAmJiB0eXBlb2YgcmVxdWVzdE9wdGlvbnMuaGVhZGVycyA9PT0gJ29iamVjdCcpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGhlYWRlcnMgPSByZXF1ZXN0T3B0aW9ucy5oZWFkZXJzO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBoZWFkZXIgaW4gaGVhZGVycykge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhlYWRlcnMuaGFzT3duUHJvcGVydHkoaGVhZGVyKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcS5zZXRSZXF1ZXN0SGVhZGVyKGhlYWRlciwgaGVhZGVyc1toZW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FxuICAgICAgICAgICAgKVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjb2wyLnB1c2goJy0nKVxuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBjb2wyLnB1c2goJ1VOVVNFRCcpXG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgY29sMyA9IFtmb3JtYXRMb2NhdGlvbih7IGxpbmUsIHVyaSB9KV1cbiAgICAgICAgXy50YWtlKG1hdGNoZXMsIDUpLmZvckVhY2gobWF0Y2ggPT4ge1xuICAgICAgICAgIGNvbDEucHVzaChgICAke21hdGNoLnRleHR9YClcbiAgICAgICAgICBpZiAoaXNGaW5pdGUobWF0Y2guZHVyYXRpb24pKSB7XG4gICAgICAgICAgICBjb2wyLnB1c2goYCR7bWF0Y2guZHVyYXRpb24gLyBNSUxMSVNFQ09ORFNfSU5fTkFOT1NFQ09ORH1tc2ApXG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGNvbDIucHVzaCgnLScpXG4gICAgICAgICAgfVxuICAgICAgICAgIGNvbDMucHVzaChmb3JtYXRMb2NhdGlvbihtYXRjaCkpXG4gICAgICAgIH0pXG4gICAgICAgIGlmIChtYXRjaGVzLmxlbmd0aCA+IDUpIHtcbiAgICAgICAgICBjb2wxLnB1c2goYCAgJHttYXRjaGVzLmxlbmd0aCAtIDV9IG1vcmVgKVxuICAgICAgICB9XG4gICAgICAgIHRhYmxlLnB1c2goW2NvbDEuam9pbignXFxuJyksIGNvbDIuam9pbignXFxuJyksIGNvbDMuam9pbignXFxuJyldKVxuICAgICAgfVxuICAgIClcbiAgICB0aGlzLmxvZyhgJHt0YWJsZS50b1N0cmluZygpfVxcbmApXG4gIH1cbn1cbiIsImltcG9ydCB7IGdldFVzYWdlIH0gZnJvbSAnLi9oZWxwZXJzJ1xuaW1wb3J0IEZvcm1hdHRlciBmcm9tICcuLydcblxuZXhwb3J0IGRlZmF1bHQgY2xhc3MgVXNhZ2VK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UgcmVqZWN0ZWQgd2l0aG91dCBhIHJlYXNvbicpXG4gICAgICB9XG4gICAgfVxuXG4gICAgVGltZS5jbGVhclRpbWVvdXQodGltZW91dElkKVxuICAgIFVuY2F1Z2h0RXhjZXB0aW9uTWFuYWdlci51bnJlZ2lzdGVySGFuZGxlcihleGNlcHRpb25IYW5kbGVyKVxuXG4gICAgcmV0dXJuIHsgZXJyb3IsIHJlc3VsdCB9XG4gIH1cbn1cbiJdfQ== diff --git a/package.json b/package.json index 3803b48d4..2d9451f03 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "gherkin", "tests" ], - "version": "5.1.0", + "version": "6.0.0", "homepage": "http://github.com/cucumber/cucumber-js", "author": "Julien Biezemans (http://jbpros.net)", "contributors": [ @@ -128,7 +128,14 @@ "David H. Gutteridge ", "lopesc ", "Honza Javorek ", - "Josh Chisholm " + "Josh Chisholm ", + "Izhaki ", + "Niyaz Akhmetov ", + "Sérgio Junior ", + "mgonnet ", + "Joey Jan ", + "David Goss ", + "Artur Neumann " ], "repository": { "type": "git", @@ -143,7 +150,7 @@ }, "main": "./lib/index", "engines": { - "node": ">=0.10" + "node": ">=8" }, "dependencies": { "assertion-error-formatter": "^3.0.0",