You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2019/03/20 16:50:12 UTC
[camel-website] branch master updated: change
antora-ui-camel/.yarnrc and add the new yarn version to
antora-ui-camel/.yarn/releases/
This is an automated email from the ASF dual-hosted git repository.
zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-website.git
The following commit(s) were added to refs/heads/master by this push:
new c520f9f change antora-ui-camel/.yarnrc and add the new yarn version to antora-ui-camel/.yarn/releases/
c520f9f is described below
commit c520f9f6d108f64c0581a8973c2c24381e8d086f
Author: nayananga@acerubuntu18.04 <na...@gmail.com>
AuthorDate: Wed Mar 20 21:32:41 2019 +0530
change antora-ui-camel/.yarnrc and add the new yarn version to antora-ui-camel/.yarn/releases/
---
antora-ui-camel/.yarn/releases/yarn-1.15.2.js | 136204 +++++++++++++++++++++++
antora-ui-camel/.yarnrc | 4 +-
2 files changed, 136206 insertions(+), 2 deletions(-)
diff --git a/antora-ui-camel/.yarn/releases/yarn-1.15.2.js b/antora-ui-camel/.yarn/releases/yarn-1.15.2.js
new file mode 100755
index 0000000..d093767
--- /dev/null
+++ b/antora-ui-camel/.yarn/releases/yarn-1.15.2.js
@@ -0,0 +1,136204 @@
+#!/usr/bin/env node
+module.exports =
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId]) {
+/******/ return installedModules[moduleId].exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ i: moduleId,
+/******/ l: false,
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ // Flag the module as loaded
+/******/ module.l = true;
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+/******/
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+/******/
+/******/ // identity function for calling harmony imports with the correct context
+/******/ __webpack_require__.i = function(value) { return value; };
+/******/
+/******/ // define getter function for harmony exports
+/******/ __webpack_require__.d = function(exports, name, getter) {
+/******/ if(!__webpack_require__.o(exports, name)) {
+/******/ Object.defineProperty(exports, name, {
+/******/ configurable: false,
+/******/ enumerable: true,
+/******/ get: getter
+/******/ });
+/******/ }
+/******/ };
+/******/
+/******/ // getDefaultExport function for compatibility with non-harmony modules
+/******/ __webpack_require__.n = function(module) {
+/******/ var getter = module && module.__esModule ?
+/******/ function getDefault() { return module['default']; } :
+/******/ function getModuleExports() { return module; };
+/******/ __webpack_require__.d(getter, 'a', getter);
+/******/ return getter;
+/******/ };
+/******/
+/******/ // Object.prototype.hasOwnProperty.call
+/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
+/******/
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+/******/
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(__webpack_require__.s = 517);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ (function(module, exports) {
+
+module.exports = require("path");
+
+/***/ }),
+/* 1 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (immutable) */ __webpack_exports__["a"] = __extends;
+/* unused harmony export __assign */
+/* unused harmony export __rest */
+/* unused harmony export __decorate */
+/* unused harmony export __param */
+/* unused harmony export __metadata */
+/* unused harmony export __awaiter */
+/* unused harmony export __generator */
+/* unused harmony export __exportStar */
+/* unused harmony export __values */
+/* unused harmony export __read */
+/* unused harmony export __spread */
+/* unused harmony export __await */
+/* unused harmony export __asyncGenerator */
+/* unused harmony export __asyncDelegator */
+/* unused harmony export __asyncValues */
+/* unused harmony export __makeTemplateObject */
+/* unused harmony export __importStar */
+/* unused harmony export __importDefault */
+/*! *****************************************************************************
+Copyright (c) Microsoft Corporation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+
+THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
+WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
+MERCHANTABLITY OR NON-INFRINGEMENT.
+
+See the Apache Version 2.0 License for specific language governing permissions
+and limitations under the License.
+***************************************************************************** */
+/* global Reflect, Promise */
+
+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);
+};
+
+function __extends(d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+}
+
+var __assign = function() {
+ __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ }
+ return __assign.apply(this, arguments);
+}
+
+function __rest(s, e) {
+ var t = {};
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
+ t[p] = s[p];
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
+ t[p[i]] = s[p[i]];
+ return t;
+}
+
+function __decorate(decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+}
+
+function __param(paramIndex, decorator) {
+ return function (target, key) { decorator(target, key, paramIndex); }
+}
+
+function __metadata(metadataKey, metadataValue) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
+}
+
+function __awaiter(thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+}
+
+function __generator(thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+}
+
+function __exportStar(m, exports) {
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
+}
+
+function __values(o) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
+ if (m) return m.call(o);
+ return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+}
+
+function __read(o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+}
+
+function __spread() {
+ for (var ar = [], i = 0; i < arguments.length; i++)
+ ar = ar.concat(__read(arguments[i]));
+ return ar;
+}
+
+function __await(v) {
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
+}
+
+function __asyncGenerator(thisArg, _arguments, generator) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
+ function fulfill(value) { resume("next", value); }
+ function reject(value) { resume("throw", value); }
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
+}
+
+function __asyncDelegator(o) {
+ var i, p;
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
+}
+
+function __asyncValues(o) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var m = o[Symbol.asyncIterator], i;
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
+}
+
+function __makeTemplateObject(cooked, raw) {
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
+ return cooked;
+};
+
+function __importStar(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+ result.default = mod;
+ return result;
+}
+
+function __importDefault(mod) {
+ return (mod && mod.__esModule) ? mod : { default: mod };
+}
+
+
+/***/ }),
+/* 2 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+exports.__esModule = true;
+
+var _promise = __webpack_require__(217);
+
+var _promise2 = _interopRequireDefault(_promise);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+exports.default = function (fn) {
+ return function () {
+ var gen = fn.apply(this, arguments);
+ return new _promise2.default(function (resolve, reject) {
+ function step(key, arg) {
+ try {
+ var info = gen[key](arg);
+ var value = info.value;
+ } catch (error) {
+ reject(error);
+ return;
+ }
+
+ if (info.done) {
+ resolve(value);
+ } else {
+ return _promise2.default.resolve(value).then(function (value) {
+ step("next", value);
+ }, function (err) {
+ step("throw", err);
+ });
+ }
+ }
+
+ return step("next");
+ });
+ };
+};
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports) {
+
+module.exports = require("util");
+
+/***/ }),
+/* 4 */
+/***/ (function(module, exports) {
+
+module.exports = require("fs");
+
+/***/ }),
+/* 5 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+class MessageError extends Error {
+ constructor(msg, code) {
+ super(msg);
+ this.code = code;
+ }
+
+}
+
+exports.MessageError = MessageError;
+class ProcessSpawnError extends MessageError {
+ constructor(msg, code, process) {
+ super(msg, code);
+ this.process = process;
+ }
+
+}
+
+exports.ProcessSpawnError = ProcessSpawnError;
+class SecurityError extends MessageError {}
+
+exports.SecurityError = SecurityError;
+class ProcessTermError extends MessageError {}
+
+exports.ProcessTermError = ProcessTermError;
+class ResponseError extends Error {
+ constructor(msg, responseCode) {
+ super(msg);
+ this.responseCode = responseCode;
+ }
+
+}
+
+exports.ResponseError = ResponseError;
+class OneTimePasswordError extends Error {}
+exports.OneTimePasswordError = OneTimePasswordError;
+
+/***/ }),
+/* 6 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.getFirstSuitableFolder = exports.readFirstAvailableStream = exports.makeTempDir = exports.hardlinksWork = exports.writeFilePreservingEol = exports.getFileSizeOnDisk = exports.walk = exports.symlink = exports.find = exports.readJsonAndFile = exports.readJson = exports.readFileAny = exports.hardlinkBulk = exports.copyBulk = exports.unlink = exports.glob = exports.link = exports.chmod = exports.lstat = exports.exists = exports.mkdirp = exports.stat = exports.access = exports.rename [...]
+
+var _asyncToGenerator2;
+
+function _load_asyncToGenerator() {
+ return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2));
+}
+
+let buildActionsForCopy = (() => {
+ var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, events, possibleExtraneous, reporter) {
+
+ //
+ let build = (() => {
+ var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) {
+ const src = data.src,
+ dest = data.dest,
+ type = data.type;
+
+ const onFresh = data.onFresh || noop;
+ const onDone = data.onDone || noop;
+
+ // TODO https://github.com/yarnpkg/yarn/issues/3751
+ // related to bundled dependencies handling
+ if (files.has(dest.toLowerCase())) {
+ reporter.verbose(`The case-insensitive file ${dest} shouldn't be copied twice in one bulk copy`);
+ } else {
+ files.add(dest.toLowerCase());
+ }
+
+ if (type === 'symlink') {
+ yield mkdirp((_path || _load_path()).default.dirname(dest));
+ onFresh();
+ actions.symlink.push({
+ dest,
+ linkname: src
+ });
+ onDone();
+ return;
+ }
+
+ if (events.ignoreBasenames.indexOf((_path || _load_path()).default.basename(src)) >= 0) {
+ // ignored file
+ return;
+ }
+
+ const srcStat = yield lstat(src);
+ let srcFiles;
+
+ if (srcStat.isDirectory()) {
+ srcFiles = yield readdir(src);
+ }
+
+ let destStat;
+ try {
+ // try accessing the destination
+ destStat = yield lstat(dest);
+ } catch (e) {
+ // proceed if destination doesn't exist, otherwise error
+ if (e.code !== 'ENOENT') {
+ throw e;
+ }
+ }
+
+ // if destination exists
+ if (destStat) {
+ const bothSymlinks = srcStat.isSymbolicLink() && destStat.isSymbolicLink();
+ const bothFolders = srcStat.isDirectory() && destStat.isDirectory();
+ const bothFiles = srcStat.isFile() && destStat.isFile();
+
+ // EINVAL access errors sometimes happen which shouldn't because node shouldn't be giving
+ // us modes that aren't valid. investigate this, it's generally safe to proceed.
+
+ /* if (srcStat.mode !== destStat.mode) {
+ try {
+ await access(dest, srcStat.mode);
+ } catch (err) {}
+ } */
+
+ if (bothFiles && artifactFiles.has(dest)) {
+ // this file gets changed during build, likely by a custom install script. Don't bother checking it.
+ onDone();
+ reporter.verbose(reporter.lang('verboseFileSkipArtifact', src));
+ return;
+ }
+
+ if (bothFiles && srcStat.size === destStat.size && (0, (_fsNormalized || _load_fsNormalized()).fileDatesEqual)(srcStat.mtime, destStat.mtime)) {
+ // we can safely assume this is the same file
+ onDone();
+ reporter.verbose(reporter.lang('verboseFileSkip', src, dest, srcStat.size, +srcStat.mtime));
+ return;
+ }
+
+ if (bothSymlinks) {
+ const srcReallink = yield readlink(src);
+ if (srcReallink === (yield readlink(dest))) {
+ // if both symlinks are the same then we can continue on
+ onDone();
+ reporter.verbose(reporter.lang('verboseFileSkipSymlink', src, dest, srcReallink));
+ return;
+ }
+ }
+
+ if (bothFolders) {
+ // mark files that aren't in this folder as possibly extraneous
+ const destFiles = yield readdir(dest);
+ invariant(srcFiles, 'src files not initialised');
+
+ for (var _iterator4 = destFiles, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
+ var _ref6;
+
+ if (_isArray4) {
+ if (_i4 >= _iterator4.length) break;
+ _ref6 = _iterator4[_i4++];
+ } else {
+ _i4 = _iterator4.next();
+ if (_i4.done) break;
+ _ref6 = _i4.value;
+ }
+
+ const file = _ref6;
+
+ if (srcFiles.indexOf(file) < 0) {
+ const loc = (_path || _load_path()).default.join(dest, file);
+ possibleExtraneous.add(loc);
+
+ if ((yield lstat(loc)).isDirectory()) {
+ for (var _iterator5 = yield readdir(loc), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
+ var _ref7;
+
+ if (_isArray5) {
+ if (_i5 >= _iterator5.length) break;
+ _ref7 = _iterator5[_i5++];
+ } else {
+ _i5 = _iterator5.next();
+ if (_i5.done) break;
+ _ref7 = _i5.value;
+ }
+
+ const file = _ref7;
+
+ possibleExtraneous.add((_path || _load_path()).default.join(loc, file));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (destStat && destStat.isSymbolicLink()) {
+ yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dest);
+ destStat = null;
+ }
+
+ if (srcStat.isSymbolicLink()) {
+ onFresh();
+ const linkname = yield readlink(src);
+ actions.symlink.push({
+ dest,
+ linkname
+ });
+ onDone();
+ } else if (srcStat.isDirectory()) {
+ if (!destStat) {
+ reporter.verbose(reporter.lang('verboseFileFolder', dest));
+ yield mkdirp(dest);
+ }
+
+ const destParts = dest.split((_path || _load_path()).default.sep);
+ while (destParts.length) {
+ files.add(destParts.join((_path || _load_path()).default.sep).toLowerCase());
+ destParts.pop();
+ }
+
+ // push all files to queue
+ invariant(srcFiles, 'src files not initialised');
+ let remaining = srcFiles.length;
+ if (!remaining) {
+ onDone();
+ }
+ for (var _iterator6 = srcFiles, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
+ var _ref8;
+
+ if (_isArray6) {
+ if (_i6 >= _iterator6.length) break;
+ _ref8 = _iterator6[_i6++];
+ } else {
+ _i6 = _iterator6.next();
+ if (_i6.done) break;
+ _ref8 = _i6.value;
+ }
+
+ const file = _ref8;
+
+ queue.push({
+ dest: (_path || _load_path()).default.join(dest, file),
+ onFresh,
+ onDone: function (_onDone) {
+ function onDone() {
+ return _onDone.apply(this, arguments);
+ }
+
+ onDone.toString = function () {
+ return _onDone.toString();
+ };
+
+ return onDone;
+ }(function () {
+ if (--remaining === 0) {
+ onDone();
+ }
+ }),
+ src: (_path || _load_path()).default.join(src, file)
+ });
+ }
+ } else if (srcStat.isFile()) {
+ onFresh();
+ actions.file.push({
+ src,
+ dest,
+ atime: srcStat.atime,
+ mtime: srcStat.mtime,
+ mode: srcStat.mode
+ });
+ onDone();
+ } else {
+ throw new Error(`unsure how to copy this: ${src}`);
+ }
+ });
+
+ return function build(_x5) {
+ return _ref5.apply(this, arguments);
+ };
+ })();
+
+ const artifactFiles = new Set(events.artifactFiles || []);
+ const files = new Set();
+
+ // initialise events
+ for (var _iterator = queue, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+ var _ref2;
+
+ if (_isArray) {
+ if (_i >= _iterator.length) break;
+ _ref2 = _iterator[_i++];
+ } else {
+ _i = _iterator.next();
+ if (_i.done) break;
+ _ref2 = _i.value;
+ }
+
+ const item = _ref2;
+
+ const onDone = item.onDone;
+ item.onDone = function () {
+ events.onProgress(item.dest);
+ if (onDone) {
+ onDone();
+ }
+ };
+ }
+ events.onStart(queue.length);
+
+ // start building actions
+ const actions = {
+ file: [],
+ symlink: [],
+ link: []
+ };
+
+ // custom concurrency logic as we're always executing stacks of CONCURRENT_QUEUE_ITEMS queue items
+ // at a time due to the requirement to push items onto the queue
+ while (queue.length) {
+ const items = queue.splice(0, CONCURRENT_QUEUE_ITEMS);
+ yield Promise.all(items.map(build));
+ }
+
+ // simulate the existence of some files to prevent considering them extraneous
+ for (var _iterator2 = artifactFiles, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
+ var _ref3;
+
+ if (_isArray2) {
+ if (_i2 >= _iterator2.length) break;
+ _ref3 = _iterator2[_i2++];
+ } else {
+ _i2 = _iterator2.next();
+ if (_i2.done) break;
+ _ref3 = _i2.value;
+ }
+
+ const file = _ref3;
+
+ if (possibleExtraneous.has(file)) {
+ reporter.verbose(reporter.lang('verboseFilePhantomExtraneous', file));
+ possibleExtraneous.delete(file);
+ }
+ }
+
+ for (var _iterator3 = possibleExtraneous, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
+ var _ref4;
+
+ if (_isArray3) {
+ if (_i3 >= _iterator3.length) break;
+ _ref4 = _iterator3[_i3++];
+ } else {
+ _i3 = _iterator3.next();
+ if (_i3.done) break;
+ _ref4 = _i3.value;
+ }
+
+ const loc = _ref4;
+
+ if (files.has(loc.toLowerCase())) {
+ possibleExtraneous.delete(loc);
+ }
+ }
+
+ return actions;
+ });
+
+ return function buildActionsForCopy(_x, _x2, _x3, _x4) {
+ return _ref.apply(this, arguments);
+ };
+})();
+
+let buildActionsForHardlink = (() => {
+ var _ref9 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, events, possibleExtraneous, reporter) {
+
+ //
+ let build = (() => {
+ var _ref13 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) {
+ const src = data.src,
+ dest = data.dest;
+
+ const onFresh = data.onFresh || noop;
+ const onDone = data.onDone || noop;
+ if (files.has(dest.toLowerCase())) {
+ // Fixes issue https://github.com/yarnpkg/yarn/issues/2734
+ // When bulk hardlinking we have A -> B structure that we want to hardlink to A1 -> B1,
+ // package-linker passes that modules A1 and B1 need to be hardlinked,
+ // the recursive linking algorithm of A1 ends up scheduling files in B1 to be linked twice which will case
+ // an exception.
+ onDone();
+ return;
+ }
+ files.add(dest.toLowerCase());
+
+ if (events.ignoreBasenames.indexOf((_path || _load_path()).default.basename(src)) >= 0) {
+ // ignored file
+ return;
+ }
+
+ const srcStat = yield lstat(src);
+ let srcFiles;
+
+ if (srcStat.isDirectory()) {
+ srcFiles = yield readdir(src);
+ }
+
+ const destExists = yield exists(dest);
+ if (destExists) {
+ const destStat = yield lstat(dest);
+
+ const bothSymlinks = srcStat.isSymbolicLink() && destStat.isSymbolicLink();
+ const bothFolders = srcStat.isDirectory() && destStat.isDirectory();
+ const bothFiles = srcStat.isFile() && destStat.isFile();
+
+ if (srcStat.mode !== destStat.mode) {
+ try {
+ yield access(dest, srcStat.mode);
+ } catch (err) {
+ // EINVAL access errors sometimes happen which shouldn't because node shouldn't be giving
+ // us modes that aren't valid. investigate this, it's generally safe to proceed.
+ reporter.verbose(err);
+ }
+ }
+
+ if (bothFiles && artifactFiles.has(dest)) {
+ // this file gets changed during build, likely by a custom install script. Don't bother checking it.
+ onDone();
+ reporter.verbose(reporter.lang('verboseFileSkipArtifact', src));
+ return;
+ }
+
+ // correct hardlink
+ if (bothFiles && srcStat.ino !== null && srcStat.ino === destStat.ino) {
+ onDone();
+ reporter.verbose(reporter.lang('verboseFileSkip', src, dest, srcStat.ino));
+ return;
+ }
+
+ if (bothSymlinks) {
+ const srcReallink = yield readlink(src);
+ if (srcReallink === (yield readlink(dest))) {
+ // if both symlinks are the same then we can continue on
+ onDone();
+ reporter.verbose(reporter.lang('verboseFileSkipSymlink', src, dest, srcReallink));
+ return;
+ }
+ }
+
+ if (bothFolders) {
+ // mark files that aren't in this folder as possibly extraneous
+ const destFiles = yield readdir(dest);
+ invariant(srcFiles, 'src files not initialised');
+
+ for (var _iterator10 = destFiles, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) {
+ var _ref14;
+
+ if (_isArray10) {
+ if (_i10 >= _iterator10.length) break;
+ _ref14 = _iterator10[_i10++];
+ } else {
+ _i10 = _iterator10.next();
+ if (_i10.done) break;
+ _ref14 = _i10.value;
+ }
+
+ const file = _ref14;
+
+ if (srcFiles.indexOf(file) < 0) {
+ const loc = (_path || _load_path()).default.join(dest, file);
+ possibleExtraneous.add(loc);
+
+ if ((yield lstat(loc)).isDirectory()) {
+ for (var _iterator11 = yield readdir(loc), _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : _iterator11[Symbol.iterator]();;) {
+ var _ref15;
+
+ if (_isArray11) {
+ if (_i11 >= _iterator11.length) break;
+ _ref15 = _iterator11[_i11++];
+ } else {
+ _i11 = _iterator11.next();
+ if (_i11.done) break;
+ _ref15 = _i11.value;
+ }
+
+ const file = _ref15;
+
+ possibleExtraneous.add((_path || _load_path()).default.join(loc, file));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (srcStat.isSymbolicLink()) {
+ onFresh();
+ const linkname = yield readlink(src);
+ actions.symlink.push({
+ dest,
+ linkname
+ });
+ onDone();
+ } else if (srcStat.isDirectory()) {
+ reporter.verbose(reporter.lang('verboseFileFolder', dest));
+ yield mkdirp(dest);
+
+ const destParts = dest.split((_path || _load_path()).default.sep);
+ while (destParts.length) {
+ files.add(destParts.join((_path || _load_path()).default.sep).toLowerCase());
+ destParts.pop();
+ }
+
+ // push all files to queue
+ invariant(srcFiles, 'src files not initialised');
+ let remaining = srcFiles.length;
+ if (!remaining) {
+ onDone();
+ }
+ for (var _iterator12 = srcFiles, _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : _iterator12[Symbol.iterator]();;) {
+ var _ref16;
+
+ if (_isArray12) {
+ if (_i12 >= _iterator12.length) break;
+ _ref16 = _iterator12[_i12++];
+ } else {
+ _i12 = _iterator12.next();
+ if (_i12.done) break;
+ _ref16 = _i12.value;
+ }
+
+ const file = _ref16;
+
+ queue.push({
+ onFresh,
+ src: (_path || _load_path()).default.join(src, file),
+ dest: (_path || _load_path()).default.join(dest, file),
+ onDone: function (_onDone2) {
+ function onDone() {
+ return _onDone2.apply(this, arguments);
+ }
+
+ onDone.toString = function () {
+ return _onDone2.toString();
+ };
+
+ return onDone;
+ }(function () {
+ if (--remaining === 0) {
+ onDone();
+ }
+ })
+ });
+ }
+ } else if (srcStat.isFile()) {
+ onFresh();
+ actions.link.push({
+ src,
+ dest,
+ removeDest: destExists
+ });
+ onDone();
+ } else {
+ throw new Error(`unsure how to copy this: ${src}`);
+ }
+ });
+
+ return function build(_x10) {
+ return _ref13.apply(this, arguments);
+ };
+ })();
+
+ const artifactFiles = new Set(events.artifactFiles || []);
+ const files = new Set();
+
+ // initialise events
+ for (var _iterator7 = queue, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
+ var _ref10;
+
+ if (_isArray7) {
+ if (_i7 >= _iterator7.length) break;
+ _ref10 = _iterator7[_i7++];
+ } else {
+ _i7 = _iterator7.next();
+ if (_i7.done) break;
+ _ref10 = _i7.value;
+ }
+
+ const item = _ref10;
+
+ const onDone = item.onDone || noop;
+ item.onDone = function () {
+ events.onProgress(item.dest);
+ onDone();
+ };
+ }
+ events.onStart(queue.length);
+
+ // start building actions
+ const actions = {
+ file: [],
+ symlink: [],
+ link: []
+ };
+
+ // custom concurrency logic as we're always executing stacks of CONCURRENT_QUEUE_ITEMS queue items
+ // at a time due to the requirement to push items onto the queue
+ while (queue.length) {
+ const items = queue.splice(0, CONCURRENT_QUEUE_ITEMS);
+ yield Promise.all(items.map(build));
+ }
+
+ // simulate the existence of some files to prevent considering them extraneous
+ for (var _iterator8 = artifactFiles, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) {
+ var _ref11;
+
+ if (_isArray8) {
+ if (_i8 >= _iterator8.length) break;
+ _ref11 = _iterator8[_i8++];
+ } else {
+ _i8 = _iterator8.next();
+ if (_i8.done) break;
+ _ref11 = _i8.value;
+ }
+
+ const file = _ref11;
+
+ if (possibleExtraneous.has(file)) {
+ reporter.verbose(reporter.lang('verboseFilePhantomExtraneous', file));
+ possibleExtraneous.delete(file);
+ }
+ }
+
+ for (var _iterator9 = possibleExtraneous, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) {
+ var _ref12;
+
+ if (_isArray9) {
+ if (_i9 >= _iterator9.length) break;
+ _ref12 = _iterator9[_i9++];
+ } else {
+ _i9 = _iterator9.next();
+ if (_i9.done) break;
+ _ref12 = _i9.value;
+ }
+
+ const loc = _ref12;
+
+ if (files.has(loc.toLowerCase())) {
+ possibleExtraneous.delete(loc);
+ }
+ }
+
+ return actions;
+ });
+
+ return function buildActionsForHardlink(_x6, _x7, _x8, _x9) {
+ return _ref9.apply(this, arguments);
+ };
+})();
+
+let copyBulk = exports.copyBulk = (() => {
+ var _ref17 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, reporter, _events) {
+ const events = {
+ onStart: _events && _events.onStart || noop,
+ onProgress: _events && _events.onProgress || noop,
+ possibleExtraneous: _events ? _events.possibleExtraneous : new Set(),
+ ignoreBasenames: _events && _events.ignoreBasenames || [],
+ artifactFiles: _events && _events.artifactFiles || []
+ };
+
+ const actions = yield buildActionsForCopy(queue, events, events.possibleExtraneous, reporter);
+ events.onStart(actions.file.length + actions.symlink.length + actions.link.length);
+
+ const fileActions = actions.file;
+
+ const currentlyWriting = new Map();
+
+ yield (_promise || _load_promise()).queue(fileActions, (() => {
+ var _ref18 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) {
+ let writePromise;
+ while (writePromise = currentlyWriting.get(data.dest)) {
+ yield writePromise;
+ }
+
+ reporter.verbose(reporter.lang('verboseFileCopy', data.src, data.dest));
+ const copier = (0, (_fsNormalized || _load_fsNormalized()).copyFile)(data, function () {
+ return currentlyWriting.delete(data.dest);
+ });
+ currentlyWriting.set(data.dest, copier);
+ events.onProgress(data.dest);
+ return copier;
+ });
+
+ return function (_x14) {
+ return _ref18.apply(this, arguments);
+ };
+ })(), CONCURRENT_QUEUE_ITEMS);
+
+ // we need to copy symlinks last as they could reference files we were copying
+ const symlinkActions = actions.symlink;
+ yield (_promise || _load_promise()).queue(symlinkActions, function (data) {
+ const linkname = (_path || _load_path()).default.resolve((_path || _load_path()).default.dirname(data.dest), data.linkname);
+ reporter.verbose(reporter.lang('verboseFileSymlink', data.dest, linkname));
+ return symlink(linkname, data.dest);
+ });
+ });
+
+ return function copyBulk(_x11, _x12, _x13) {
+ return _ref17.apply(this, arguments);
+ };
+})();
+
+let hardlinkBulk = exports.hardlinkBulk = (() => {
+ var _ref19 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, reporter, _events) {
+ const events = {
+ onStart: _events && _events.onStart || noop,
+ onProgress: _events && _events.onProgress || noop,
+ possibleExtraneous: _events ? _events.possibleExtraneous : new Set(),
+ artifactFiles: _events && _events.artifactFiles || [],
+ ignoreBasenames: []
+ };
+
+ const actions = yield buildActionsForHardlink(queue, events, events.possibleExtraneous, reporter);
+ events.onStart(actions.file.length + actions.symlink.length + actions.link.length);
+
+ const fileActions = actions.link;
+
+ yield (_promise || _load_promise()).queue(fileActions, (() => {
+ var _ref20 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) {
+ reporter.verbose(reporter.lang('verboseFileLink', data.src, data.dest));
+ if (data.removeDest) {
+ yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(data.dest);
+ }
+ yield link(data.src, data.dest);
+ });
+
+ return function (_x18) {
+ return _ref20.apply(this, arguments);
+ };
+ })(), CONCURRENT_QUEUE_ITEMS);
+
+ // we need to copy symlinks last as they could reference files we were copying
+ const symlinkActions = actions.symlink;
+ yield (_promise || _load_promise()).queue(symlinkActions, function (data) {
+ const linkname = (_path || _load_path()).default.resolve((_path || _load_path()).default.dirname(data.dest), data.linkname);
+ reporter.verbose(reporter.lang('verboseFileSymlink', data.dest, linkname));
+ return symlink(linkname, data.dest);
+ });
+ });
+
+ return function hardlinkBulk(_x15, _x16, _x17) {
+ return _ref19.apply(this, arguments);
+ };
+})();
+
+let readFileAny = exports.readFileAny = (() => {
+ var _ref21 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (files) {
+ for (var _iterator13 = files, _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : _iterator13[Symbol.iterator]();;) {
+ var _ref22;
+
+ if (_isArray13) {
+ if (_i13 >= _iterator13.length) break;
+ _ref22 = _iterator13[_i13++];
+ } else {
+ _i13 = _iterator13.next();
+ if (_i13.done) break;
+ _ref22 = _i13.value;
+ }
+
+ const file = _ref22;
+
+ if (yield exists(file)) {
+ return readFile(file);
+ }
+ }
+ return null;
+ });
+
+ return function readFileAny(_x19) {
+ return _ref21.apply(this, arguments);
+ };
+})();
+
+let readJson = exports.readJson = (() => {
+ var _ref23 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) {
+ return (yield readJsonAndFile(loc)).object;
+ });
+
+ return function readJson(_x20) {
+ return _ref23.apply(this, arguments);
+ };
+})();
+
+let readJsonAndFile = exports.readJsonAndFile = (() => {
+ var _ref24 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) {
+ const file = yield readFile(loc);
+ try {
+ return {
+ object: (0, (_map || _load_map()).default)(JSON.parse(stripBOM(file))),
+ content: file
+ };
+ } catch (err) {
+ err.message = `${loc}: ${err.message}`;
+ throw err;
+ }
+ });
+
+ return function readJsonAndFile(_x21) {
+ return _ref24.apply(this, arguments);
+ };
+})();
+
+let find = exports.find = (() => {
+ var _ref25 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (filename, dir) {
+ const parts = dir.split((_path || _load_path()).default.sep);
+
+ while (parts.length) {
+ const loc = parts.concat(filename).join((_path || _load_path()).default.sep);
+
+ if (yield exists(loc)) {
+ return loc;
+ } else {
+ parts.pop();
+ }
+ }
+
+ return false;
+ });
+
+ return function find(_x22, _x23) {
+ return _ref25.apply(this, arguments);
+ };
+})();
+
+let symlink = exports.symlink = (() => {
+ var _ref26 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (src, dest) {
+ if (process.platform !== 'win32') {
+ // use relative paths otherwise which will be retained if the directory is moved
+ src = (_path || _load_path()).default.relative((_path || _load_path()).default.dirname(dest), src);
+ // When path.relative returns an empty string for the current directory, we should instead use
+ // '.', which is a valid fs.symlink target.
+ src = src || '.';
+ }
+
+ try {
+ const stats = yield lstat(dest);
+ if (stats.isSymbolicLink()) {
+ const resolved = dest;
+ if (resolved === src) {
+ return;
+ }
+ }
+ } catch (err) {
+ if (err.code !== 'ENOENT') {
+ throw err;
+ }
+ }
+
+ // We use rimraf for unlink which never throws an ENOENT on missing target
+ yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dest);
+
+ if (process.platform === 'win32') {
+ // use directory junctions if possible on win32, this requires absolute paths
+ yield fsSymlink(src, dest, 'junction');
+ } else {
+ yield fsSymlink(src, dest);
+ }
+ });
+
+ return function symlink(_x24, _x25) {
+ return _ref26.apply(this, arguments);
+ };
+})();
+
+let walk = exports.walk = (() => {
+ var _ref27 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (dir, relativeDir, ignoreBasenames = new Set()) {
+ let files = [];
+
+ let filenames = yield readdir(dir);
+ if (ignoreBasenames.size) {
+ filenames = filenames.filter(function (name) {
+ return !ignoreBasenames.has(name);
+ });
+ }
+
+ for (var _iterator14 = filenames, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : _iterator14[Symbol.iterator]();;) {
+ var _ref28;
+
+ if (_isArray14) {
+ if (_i14 >= _iterator14.length) break;
+ _ref28 = _iterator14[_i14++];
+ } else {
+ _i14 = _iterator14.next();
+ if (_i14.done) break;
+ _ref28 = _i14.value;
+ }
+
+ const name = _ref28;
+
+ const relative = relativeDir ? (_path || _load_path()).default.join(relativeDir, name) : name;
+ const loc = (_path || _load_path()).default.join(dir, name);
+ const stat = yield lstat(loc);
+
+ files.push({
+ relative,
+ basename: name,
+ absolute: loc,
+ mtime: +stat.mtime
+ });
+
+ if (stat.isDirectory()) {
+ files = files.concat((yield walk(loc, relative, ignoreBasenames)));
+ }
+ }
+
+ return files;
+ });
+
+ return function walk(_x26, _x27) {
+ return _ref27.apply(this, arguments);
+ };
+})();
+
+let getFileSizeOnDisk = exports.getFileSizeOnDisk = (() => {
+ var _ref29 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) {
+ const stat = yield lstat(loc);
+ const size = stat.size,
+ blockSize = stat.blksize;
+
+
+ return Math.ceil(size / blockSize) * blockSize;
+ });
+
+ return function getFileSizeOnDisk(_x28) {
+ return _ref29.apply(this, arguments);
+ };
+})();
+
+let getEolFromFile = (() => {
+ var _ref30 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (path) {
+ if (!(yield exists(path))) {
+ return undefined;
+ }
+
+ const buffer = yield readFileBuffer(path);
+
+ for (let i = 0; i < buffer.length; ++i) {
+ if (buffer[i] === cr) {
+ return '\r\n';
+ }
+ if (buffer[i] === lf) {
+ return '\n';
+ }
+ }
+ return undefined;
+ });
+
+ return function getEolFromFile(_x29) {
+ return _ref30.apply(this, arguments);
+ };
+})();
+
+let writeFilePreservingEol = exports.writeFilePreservingEol = (() => {
+ var _ref31 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (path, data) {
+ const eol = (yield getEolFromFile(path)) || (_os || _load_os()).default.EOL;
+ if (eol !== '\n') {
+ data = data.replace(/\n/g, eol);
+ }
+ yield writeFile(path, data);
+ });
+
+ return function writeFilePreservingEol(_x30, _x31) {
+ return _ref31.apply(this, arguments);
+ };
+})();
+
+let hardlinksWork = exports.hardlinksWork = (() => {
+ var _ref32 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (dir) {
+ const filename = 'test-file' + Math.random();
+ const file = (_path || _load_path()).default.join(dir, filename);
+ const fileLink = (_path || _load_path()).default.join(dir, filename + '-link');
+ try {
+ yield writeFile(file, 'test');
+ yield link(file, fileLink);
+ } catch (err) {
+ return false;
+ } finally {
+ yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(file);
+ yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(fileLink);
+ }
+ return true;
+ });
+
+ return function hardlinksWork(_x32) {
+ return _ref32.apply(this, arguments);
+ };
+})();
+
+// not a strict polyfill for Node's fs.mkdtemp
+
+
+let makeTempDir = exports.makeTempDir = (() => {
+ var _ref33 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (prefix) {
+ const dir = (_path || _load_path()).default.join((_os || _load_os()).default.tmpdir(), `yarn-${prefix || ''}-${Date.now()}-${Math.random()}`);
+ yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dir);
+ yield mkdirp(dir);
+ return dir;
+ });
+
+ return function makeTempDir(_x33) {
+ return _ref33.apply(this, arguments);
+ };
+})();
+
+let readFirstAvailableStream = exports.readFirstAvailableStream = (() => {
+ var _ref34 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (paths) {
+ for (var _iterator15 = paths, _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : _iterator15[Symbol.iterator]();;) {
+ var _ref35;
+
+ if (_isArray15) {
+ if (_i15 >= _iterator15.length) break;
+ _ref35 = _iterator15[_i15++];
+ } else {
+ _i15 = _iterator15.next();
+ if (_i15.done) break;
+ _ref35 = _i15.value;
+ }
+
+ const path = _ref35;
+
+ try {
+ const fd = yield open(path, 'r');
+ return (_fs || _load_fs()).default.createReadStream(path, { fd });
+ } catch (err) {
+ // Try the next one
+ }
+ }
+ return null;
+ });
+
+ return function readFirstAvailableStream(_x34) {
+ return _ref34.apply(this, arguments);
+ };
+})();
+
+let getFirstSuitableFolder = exports.getFirstSuitableFolder = (() => {
+ var _ref36 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (paths, mode = constants.W_OK | constants.X_OK) {
+ const result = {
+ skipped: [],
+ folder: null
+ };
+
+ for (var _iterator16 = paths, _isArray16 = Array.isArray(_iterator16), _i16 = 0, _iterator16 = _isArray16 ? _iterator16 : _iterator16[Symbol.iterator]();;) {
+ var _ref37;
+
+ if (_isArray16) {
+ if (_i16 >= _iterator16.length) break;
+ _ref37 = _iterator16[_i16++];
+ } else {
+ _i16 = _iterator16.next();
+ if (_i16.done) break;
+ _ref37 = _i16.value;
+ }
+
+ const folder = _ref37;
+
+ try {
+ yield mkdirp(folder);
+ yield access(folder, mode);
+
+ result.folder = folder;
+
+ return result;
+ } catch (error) {
+ result.skipped.push({
+ error,
+ folder
+ });
+ }
+ }
+ return result;
+ });
+
+ return function getFirstSuitableFolder(_x35) {
+ return _ref36.apply(this, arguments);
+ };
+})();
+
+exports.copy = copy;
+exports.readFile = readFile;
+exports.readFileRaw = readFileRaw;
+exports.normalizeOS = normalizeOS;
+
+var _fs;
+
+function _load_fs() {
+ return _fs = _interopRequireDefault(__webpack_require__(4));
+}
+
+var _glob;
+
+function _load_glob() {
+ return _glob = _interopRequireDefault(__webpack_require__(93));
+}
+
+var _os;
+
+function _load_os() {
+ return _os = _interopRequireDefault(__webpack_require__(46));
+}
+
+var _path;
+
+function _load_path() {
+ return _path = _interopRequireDefault(__webpack_require__(0));
+}
+
+var _blockingQueue;
+
+function _load_blockingQueue() {
+ return _blockingQueue = _interopRequireDefault(__webpack_require__(103));
+}
+
+var _promise;
+
+function _load_promise() {
+ return _promise = _interopRequireWildcard(__webpack_require__(47));
+}
+
+var _promise2;
+
+function _load_promise2() {
+ return _promise2 = __webpack_require__(47);
+}
+
+var _map;
+
+function _load_map() {
+ return _map = _interopRequireDefault(__webpack_require__(28));
+}
+
+var _fsNormalized;
+
+function _load_fsNormalized() {
+ return _fsNormalized = __webpack_require__(208);
+}
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const constants = exports.constants = typeof (_fs || _load_fs()).default.constants !== 'undefined' ? (_fs || _load_fs()).default.constants : {
+ R_OK: (_fs || _load_fs()).default.R_OK,
+ W_OK: (_fs || _load_fs()).default.W_OK,
+ X_OK: (_fs || _load_fs()).default.X_OK
+};
+
+const lockQueue = exports.lockQueue = new (_blockingQueue || _load_blockingQueue()).default('fs lock');
+
+const readFileBuffer = exports.readFileBuffer = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readFile);
+const open = exports.open = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.open);
+const writeFile = exports.writeFile = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.writeFile);
+const readlink = exports.readlink = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readlink);
+const realpath = exports.realpath = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.realpath);
+const readdir = exports.readdir = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readdir);
+const rename = exports.rename = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.rename);
+const access = exports.access = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.access);
+const stat = exports.stat = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.stat);
+const mkdirp = exports.mkdirp = (0, (_promise2 || _load_promise2()).promisify)(__webpack_require__(136));
+const exists = exports.exists = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.exists, true);
+const lstat = exports.lstat = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.lstat);
+const chmod = exports.chmod = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.chmod);
+const link = exports.link = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.link);
+const glob = exports.glob = (0, (_promise2 || _load_promise2()).promisify)((_glob || _load_glob()).default);
+exports.unlink = (_fsNormalized || _load_fsNormalized()).unlink;
+
+// fs.copyFile uses the native file copying instructions on the system, performing much better
+// than any JS-based solution and consumes fewer resources. Repeated testing to fine tune the
+// concurrency level revealed 128 as the sweet spot on a quad-core, 16 CPU Intel system with SSD.
+
+const CONCURRENT_QUEUE_ITEMS = (_fs || _load_fs()).default.copyFile ? 128 : 4;
+
+const fsSymlink = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.symlink);
+const invariant = __webpack_require__(8);
+const stripBOM = __webpack_require__(151);
+
+const noop = () => {};
+
+function copy(src, dest, reporter) {
+ return copyBulk([{ src, dest }], reporter);
+}
+
+function _readFile(loc, encoding) {
+ return new Promise((resolve, reject) => {
+ (_fs || _load_fs()).default.readFile(loc, encoding, function (err, content) {
+ if (err) {
+ reject(err);
+ } else {
+ resolve(content);
+ }
+ });
+ });
+}
+
+function readFile(loc) {
+ return _readFile(loc, 'utf8').then(normalizeOS);
+}
+
+function readFileRaw(loc) {
+ return _readFile(loc, 'binary');
+}
+
+function normalizeOS(body) {
+ return body.replace(/\r\n/g, '\n');
+}
+
+const cr = '\r'.charCodeAt(0);
+const lf = '\n'.charCodeAt(0);
+
+/***/ }),
+/* 7 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscriber; });
+/* unused harmony export SafeSubscriber */
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isFunction__ = __webpack_require__(145);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Observer__ = __webpack_require__(388);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Subscription__ = __webpack_require__(24);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__internal_symbol_rxSubscriber__ = __webpack_require__(288);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__config__ = __webpack_require__(176);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__util_hostReportError__ = __webpack_require__(290);
+/** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */
+
+
+
+
+
+
+
+var Subscriber = /*@__PURE__*/ (function (_super) {
+ __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](Subscriber, _super);
+ function Subscriber(destinationOrNext, error, complete) {
+ var _this = _super.call(this) || this;
+ _this.syncErrorValue = null;
+ _this.syncErrorThrown = false;
+ _this.syncErrorThrowable = false;
+ _this.isStopped = false;
+ _this._parentSubscription = null;
+ switch (arguments.length) {
+ case 0:
+ _this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */];
+ break;
+ case 1:
+ if (!destinationOrNext) {
+ _this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */];
+ break;
+ }
+ if (typeof destinationOrNext === 'object') {
+ if (destinationOrNext instanceof Subscriber) {
+ _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
+ _this.destination = destinationOrNext;
+ destinationOrNext.add(_this);
+ }
+ else {
+ _this.syncErrorThrowable = true;
+ _this.destination = new SafeSubscriber(_this, destinationOrNext);
+ }
+ break;
+ }
+ default:
+ _this.syncErrorThrowable = true;
+ _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
+ break;
+ }
+ return _this;
+ }
+ Subscriber.prototype[__WEBPACK_IMPORTED_MODULE_4__internal_symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () { return this; };
+ Subscriber.create = function (next, error, complete) {
+ var subscriber = new Subscriber(next, error, complete);
+ subscriber.syncErrorThrowable = false;
+ return subscriber;
+ };
+ Subscriber.prototype.next = function (value) {
+ if (!this.isStopped) {
+ this._next(value);
+ }
+ };
+ Subscriber.prototype.error = function (err) {
+ if (!this.isStopped) {
+ this.isStopped = true;
+ this._error(err);
+ }
+ };
+ Subscriber.prototype.complete = function () {
+ if (!this.isStopped) {
+ this.isStopped = true;
+ this._complete();
+ }
+ };
+ Subscriber.prototype.unsubscribe = function () {
+ if (this.closed) {
+ return;
+ }
+ this.isStopped = true;
+ _super.prototype.unsubscribe.call(this);
+ };
+ Subscriber.prototype._next = function (value) {
+ this.destination.next(value);
+ };
+ Subscriber.prototype._error = function (err) {
+ this.destination.error(err);
+ this.unsubscribe();
+ };
+ Subscriber.prototype._complete = function () {
+ this.destination.complete();
+ this.unsubscribe();
+ };
+ Subscriber.prototype._unsubscribeAndRecycle = function () {
+ var _a = this, _parent = _a._parent, _parents = _a._parents;
+ this._parent = null;
+ this._parents = null;
+ this.unsubscribe();
+ this.closed = false;
+ this.isStopped = false;
+ this._parent = _parent;
+ this._parents = _parents;
+ this._parentSubscription = null;
+ return this;
+ };
+ return Subscriber;
+}(__WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */]));
+
+var SafeSubscriber = /*@__PURE__*/ (function (_super) {
+ __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](SafeSubscriber, _super);
+ function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
+ var _this = _super.call(this) || this;
+ _this._parentSubscriber = _parentSubscriber;
+ var next;
+ var context = _this;
+ if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_isFunction__["a" /* isFunction */])(observerOrNext)) {
+ next = observerOrNext;
+ }
+ else if (observerOrNext) {
+ next = observerOrNext.next;
+ error = observerOrNext.error;
+ complete = observerOrNext.complete;
+ if (observerOrNext !== __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]) {
+ context = Object.create(observerOrNext);
+ if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_isFunction__["a" /* isFunction */])(context.unsubscribe)) {
+ _this.add(context.unsubscribe.bind(context));
+ }
+ context.unsubscribe = _this.unsubscribe.bind(_this);
+ }
+ }
+ _this._context = context;
+ _this._next = next;
+ _this._error = error;
+ _this._complete = complete;
+ return _this;
+ }
+ SafeSubscriber.prototype.next = function (value) {
+ if (!this.isStopped && this._next) {
+ var _parentSubscriber = this._parentSubscriber;
+ if (!__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
+ this.__tryOrUnsub(this._next, value);
+ }
+ else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
+ this.unsubscribe();
+ }
+ }
+ };
+ SafeSubscriber.prototype.error = function (err) {
+ if (!this.isStopped) {
+ var _parentSubscriber = this._parentSubscriber;
+ var useDeprecatedSynchronousErrorHandling = __WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling;
+ if (this._error) {
+ if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
+ this.__tryOrUnsub(this._error, err);
+ this.unsubscribe();
+ }
+ else {
+ this.__tryOrSetError(_parentSubscriber, this._error, err);
+ this.unsubscribe();
+ }
+ }
+ else if (!_parentSubscriber.syncErrorThrowable) {
+ this.unsubscribe();
+ if (useDeprecatedSynchronousErrorHandling) {
+ throw err;
+ }
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err);
+ }
+ else {
+ if (useDeprecatedSynchronousErrorHandling) {
+ _parentSubscriber.syncErrorValue = err;
+ _parentSubscriber.syncErrorThrown = true;
+ }
+ else {
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err);
+ }
+ this.unsubscribe();
+ }
+ }
+ };
+ SafeSubscriber.prototype.complete = function () {
+ var _this = this;
+ if (!this.isStopped) {
+ var _parentSubscriber = this._parentSubscriber;
+ if (this._complete) {
+ var wrappedComplete = function () { return _this._complete.call(_this._context); };
+ if (!__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
+ this.__tryOrUnsub(wrappedComplete);
+ this.unsubscribe();
+ }
+ else {
+ this.__tryOrSetError(_parentSubscriber, wrappedComplete);
+ this.unsubscribe();
+ }
+ }
+ else {
+ this.unsubscribe();
+ }
+ }
+ };
+ SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
+ try {
+ fn.call(this._context, value);
+ }
+ catch (err) {
+ this.unsubscribe();
+ if (__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) {
+ throw err;
+ }
+ else {
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err);
+ }
+ }
+ };
+ SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
+ if (!__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) {
+ throw new Error('bad call');
+ }
+ try {
+ fn.call(this._context, value);
+ }
+ catch (err) {
+ if (__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) {
+ parent.syncErrorValue = err;
+ parent.syncErrorThrown = true;
+ return true;
+ }
+ else {
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err);
+ return true;
+ }
+ }
+ return false;
+ };
+ SafeSubscriber.prototype._unsubscribe = function () {
+ var _parentSubscriber = this._parentSubscriber;
+ this._context = null;
+ this._parentSubscriber = null;
+ _parentSubscriber.unsubscribe();
+ };
+ return SafeSubscriber;
+}(Subscriber));
+
+//# sourceMappingURL=Subscriber.js.map
+
+
+/***/ }),
+/* 8 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+
+
+/**
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
+ */
+
+var NODE_ENV = process.env.NODE_ENV;
+
+var invariant = function(condition, format, a, b, c, d, e, f) {
+ if (NODE_ENV !== 'production') {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ }
+
+ if (!condition) {
+ var error;
+ if (format === undefined) {
+ error = new Error(
+ 'Minified exception occurred; use the non-minified dev environment ' +
+ 'for the full error message and additional helpful warnings.'
+ );
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(
+ format.replace(/%s/g, function() { return args[argIndex++]; })
+ );
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+};
+
+module.exports = invariant;
+
+
+/***/ }),
+/* 9 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.getPathKey = getPathKey;
+const os = __webpack_require__(46);
+const path = __webpack_require__(0);
+const userHome = __webpack_require__(60).default;
+
+var _require = __webpack_require__(215);
+
+const getCacheDir = _require.getCacheDir,
+ getConfigDir = _require.getConfigDir,
+ getDataDir = _require.getDataDir;
+
+const isWebpackBundle = __webpack_require__(267);
+
+const DEPENDENCY_TYPES = exports.DEPENDENCY_TYPES = ['devDependencies', 'dependencies', 'optionalDependencies', 'peerDependencies'];
+const OWNED_DEPENDENCY_TYPES = exports.OWNED_DEPENDENCY_TYPES = ['devDependencies', 'dependencies', 'optionalDependencies'];
+
+const RESOLUTIONS = exports.RESOLUTIONS = 'resolutions';
+const MANIFEST_FIELDS = exports.MANIFEST_FIELDS = [RESOLUTIONS, ...DEPENDENCY_TYPES];
+
+const SUPPORTED_NODE_VERSIONS = exports.SUPPORTED_NODE_VERSIONS = '^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0';
+
+const YARN_REGISTRY = exports.YARN_REGISTRY = 'https://registry.yarnpkg.com';
+const NPM_REGISTRY_RE = exports.NPM_REGISTRY_RE = /https?:\/\/registry\.npmjs\.org/g;
+
+const YARN_DOCS = exports.YARN_DOCS = 'https://yarnpkg.com/en/docs/cli/';
+const YARN_INSTALLER_SH = exports.YARN_INSTALLER_SH = 'https://yarnpkg.com/install.sh';
+const YARN_INSTALLER_MSI = exports.YARN_INSTALLER_MSI = 'https://yarnpkg.com/latest.msi';
+
+const SELF_UPDATE_VERSION_URL = exports.SELF_UPDATE_VERSION_URL = 'https://yarnpkg.com/latest-version';
+
+// cache version, bump whenever we make backwards incompatible changes
+const CACHE_VERSION = exports.CACHE_VERSION = 4;
+
+// lockfile version, bump whenever we make backwards incompatible changes
+const LOCKFILE_VERSION = exports.LOCKFILE_VERSION = 1;
+
+// max amount of network requests to perform concurrently
+const NETWORK_CONCURRENCY = exports.NETWORK_CONCURRENCY = 8;
+
+// HTTP timeout used when downloading packages
+const NETWORK_TIMEOUT = exports.NETWORK_TIMEOUT = 30 * 1000; // in milliseconds
+
+// max amount of child processes to execute concurrently
+const CHILD_CONCURRENCY = exports.CHILD_CONCURRENCY = 5;
+
+const REQUIRED_PACKAGE_KEYS = exports.REQUIRED_PACKAGE_KEYS = ['name', 'version', '_uid'];
+
+function getPreferredCacheDirectories() {
+ const preferredCacheDirectories = [getCacheDir()];
+
+ if (process.getuid) {
+ // $FlowFixMe: process.getuid exists, dammit
+ preferredCacheDirectories.push(path.join(os.tmpdir(), `.yarn-cache-${process.getuid()}`));
+ }
+
+ preferredCacheDirectories.push(path.join(os.tmpdir(), `.yarn-cache`));
+
+ return preferredCacheDirectories;
+}
+
+const PREFERRED_MODULE_CACHE_DIRECTORIES = exports.PREFERRED_MODULE_CACHE_DIRECTORIES = getPreferredCacheDirectories();
+const CONFIG_DIRECTORY = exports.CONFIG_DIRECTORY = getConfigDir();
+const DATA_DIRECTORY = exports.DATA_DIRECTORY = getDataDir();
+const LINK_REGISTRY_DIRECTORY = exports.LINK_REGISTRY_DIRECTORY = path.join(DATA_DIRECTORY, 'link');
+const GLOBAL_MODULE_DIRECTORY = exports.GLOBAL_MODULE_DIRECTORY = path.join(DATA_DIRECTORY, 'global');
+
+const NODE_BIN_PATH = exports.NODE_BIN_PATH = process.execPath;
+const YARN_BIN_PATH = exports.YARN_BIN_PATH = getYarnBinPath();
+
+// Webpack needs to be configured with node.__dirname/__filename = false
+function getYarnBinPath() {
+ if (isWebpackBundle) {
+ return __filename;
+ } else {
+ return path.join(__dirname, '..', 'bin', 'yarn.js');
+ }
+}
+
+const NODE_MODULES_FOLDER = exports.NODE_MODULES_FOLDER = 'node_modules';
+const NODE_PACKAGE_JSON = exports.NODE_PACKAGE_JSON = 'package.json';
+
+const PNP_FILENAME = exports.PNP_FILENAME = '.pnp.js';
+
+const POSIX_GLOBAL_PREFIX = exports.POSIX_GLOBAL_PREFIX = `${process.env.DESTDIR || ''}/usr/local`;
+const FALLBACK_GLOBAL_PREFIX = exports.FALLBACK_GLOBAL_PREFIX = path.join(userHome, '.yarn');
+
+const META_FOLDER = exports.META_FOLDER = '.yarn-meta';
+const INTEGRITY_FILENAME = exports.INTEGRITY_FILENAME = '.yarn-integrity';
+const LOCKFILE_FILENAME = exports.LOCKFILE_FILENAME = 'yarn.lock';
+const METADATA_FILENAME = exports.METADATA_FILENAME = '.yarn-metadata.json';
+const TARBALL_FILENAME = exports.TARBALL_FILENAME = '.yarn-tarball.tgz';
+const CLEAN_FILENAME = exports.CLEAN_FILENAME = '.yarnclean';
+
+const NPM_LOCK_FILENAME = exports.NPM_LOCK_FILENAME = 'package-lock.json';
+const NPM_SHRINKWRAP_FILENAME = exports.NPM_SHRINKWRAP_FILENAME = 'npm-shrinkwrap.json';
+
+const DEFAULT_INDENT = exports.DEFAULT_INDENT = ' ';
+const SINGLE_INSTANCE_PORT = exports.SINGLE_INSTANCE_PORT = 31997;
+const SINGLE_INSTANCE_FILENAME = exports.SINGLE_INSTANCE_FILENAME = '.yarn-single-instance';
+
+const ENV_PATH_KEY = exports.ENV_PATH_KEY = getPathKey(process.platform, process.env);
+
+function getPathKey(platform, env) {
+ let pathKey = 'PATH';
+
+ // windows calls its path "Path" usually, but this is not guaranteed.
+ if (platform === 'win32') {
+ pathKey = 'Path';
+
+ for (const key in env) {
+ if (key.toLowerCase() === 'path') {
+ pathKey = key;
+ }
+ }
+ }
+
+ return pathKey;
+}
+
+const VERSION_COLOR_SCHEME = exports.VERSION_COLOR_SCHEME = {
+ major: 'red',
+ premajor: 'red',
+ minor: 'yellow',
+ preminor: 'yellow',
+ patch: 'green',
+ prepatch: 'green',
+ prerelease: 'red',
+ unchanged: 'white',
+ unknown: 'red'
+};
+
+/***/ }),
+/* 10 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Observable; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_canReportError__ = __webpack_require__(289);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__ = __webpack_require__(901);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__internal_symbol_observable__ = __webpack_require__(109);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_pipe__ = __webpack_require__(291);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__config__ = __webpack_require__(176);
+/** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_internal_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */
+
+
+
+
+
+var Observable = /*@__PURE__*/ (function () {
+ function Observable(subscribe) {
+ this._isScalar = false;
+ if (subscribe) {
+ this._subscribe = subscribe;
+ }
+ }
+ Observable.prototype.lift = function (operator) {
+ var observable = new Observable();
+ observable.source = this;
+ observable.operator = operator;
+ return observable;
+ };
+ Observable.prototype.subscribe = function (observerOrNext, error, complete) {
+ var operator = this.operator;
+ var sink = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__["a" /* toSubscriber */])(observerOrNext, error, complete);
+ if (operator) {
+ operator.call(sink, this.source);
+ }
+ else {
+ sink.add(this.source || (__WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
+ this._subscribe(sink) :
+ this._trySubscribe(sink));
+ }
+ if (__WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) {
+ if (sink.syncErrorThrowable) {
+ sink.syncErrorThrowable = false;
+ if (sink.syncErrorThrown) {
+ throw sink.syncErrorValue;
+ }
+ }
+ }
+ return sink;
+ };
+ Observable.prototype._trySubscribe = function (sink) {
+ try {
+ return this._subscribe(sink);
+ }
+ catch (err) {
+ if (__WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) {
+ sink.syncErrorThrown = true;
+ sink.syncErrorValue = err;
+ }
+ if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__util_canReportError__["a" /* canReportError */])(sink)) {
+ sink.error(err);
+ }
+ else {
+ console.warn(err);
+ }
+ }
+ };
+ Observable.prototype.forEach = function (next, promiseCtor) {
+ var _this = this;
+ promiseCtor = getPromiseCtor(promiseCtor);
+ return new promiseCtor(function (resolve, reject) {
+ var subscription;
+ subscription = _this.subscribe(function (value) {
+ try {
+ next(value);
+ }
+ catch (err) {
+ reject(err);
+ if (subscription) {
+ subscription.unsubscribe();
+ }
+ }
+ }, reject, resolve);
+ });
+ };
+ Observable.prototype._subscribe = function (subscriber) {
+ var source = this.source;
+ return source && source.subscribe(subscriber);
+ };
+ Observable.prototype[__WEBPACK_IMPORTED_MODULE_2__internal_symbol_observable__["a" /* observable */]] = function () {
+ return this;
+ };
+ Observable.prototype.pipe = function () {
+ var operations = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ operations[_i] = arguments[_i];
+ }
+ if (operations.length === 0) {
+ return this;
+ }
+ return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__util_pipe__["b" /* pipeFromArray */])(operations)(this);
+ };
+ Observable.prototype.toPromise = function (promiseCtor) {
+ var _this = this;
+ promiseCtor = getPromiseCtor(promiseCtor);
+ return new promiseCtor(function (resolve, reject) {
+ var value;
+ _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
+ });
+ };
+ Observable.create = function (subscribe) {
+ return new Observable(subscribe);
+ };
+ return Observable;
+}());
+
+function getPromiseCtor(promiseCtor) {
+ if (!promiseCtor) {
+ promiseCtor = __WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].Promise || Promise;
+ }
+ if (!promiseCtor) {
+ throw new Error('no Promise impl found');
+ }
+ return promiseCtor;
+}
+//# sourceMappingURL=Observable.js.map
+
+
+/***/ }),
+/* 11 */
+/***/ (function(module, exports) {
+
+module.exports = require("crypto");
+
+/***/ }),
+/* 12 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OuterSubscriber; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscriber__ = __webpack_require__(7);
+/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
+
+
+var OuterSubscriber = /*@__PURE__*/ (function (_super) {
+ __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](OuterSubscriber, _super);
+ function OuterSubscriber() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.destination.next(innerValue);
+ };
+ OuterSubscriber.prototype.notifyError = function (error, innerSub) {
+ this.destination.error(error);
+ };
+ OuterSubscriber.prototype.notifyComplete = function (innerSub) {
+ this.destination.complete();
+ };
+ return OuterSubscriber;
+}(__WEBPACK_IMPORTED_MODULE_1__Subscriber__["a" /* Subscriber */]));
+
+//# sourceMappingURL=OuterSubscriber.js.map
+
+
+/***/ }),
+/* 13 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (immutable) */ __webpack_exports__["a"] = subscribeToResult;
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__InnerSubscriber__ = __webpack_require__(77);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__subscribeTo__ = __webpack_require__(414);
+/** PURE_IMPORTS_START _InnerSubscriber,_subscribeTo PURE_IMPORTS_END */
+
+
+function subscribeToResult(outerSubscriber, result, outerValue, outerIndex, destination) {
+ if (destination === void 0) {
+ destination = new __WEBPACK_IMPORTED_MODULE_0__InnerSubscriber__["a" /* InnerSubscriber */](outerSubscriber, outerValue, outerIndex);
+ }
+ if (destination.closed) {
+ return;
+ }
+ return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__subscribeTo__["a" /* subscribeTo */])(result)(destination);
+}
+//# sourceMappingURL=subscribeToResult.js.map
+
+
+/***/ }),
+/* 14 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* eslint-disable node/no-deprecated-api */
+
+
+
+var buffer = __webpack_require__(80)
+var Buffer = buffer.Buffer
+
+var safer = {}
+
+var key
+
+for (key in buffer) {
+ if (!buffer.hasOwnProperty(key)) continue
+ if (key === 'SlowBuffer' || key === 'Buffer') continue
+ safer[key] = buffer[key]
+}
+
+var Safer = safer.Buffer = {}
+for (key in Buffer) {
+ if (!Buffer.hasOwnProperty(key)) continue
+ if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue
+ Safer[key] = Buffer[key]
+}
+
+safer.Buffer.prototype = Buffer.prototype
+
+if (!Safer.from || Safer.from === Uint8Array.from) {
+ Safer.from = function (value, encodingOrOffset, length) {
+ if (typeof value === 'number') {
+ throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value)
+ }
+ if (value && typeof value.length === 'undefined') {
+ throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value)
+ }
+ return Buffer(value, encodingOrOffset, length)
+ }
+}
+
+if (!Safer.alloc) {
+ Safer.alloc = function (size, fill, encoding) {
+ if (typeof size !== 'number') {
+ throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
+ }
+ if (size < 0 || size >= 2 * (1 << 30)) {
+ throw new RangeError('The value "' + size + '" is invalid for option "size"')
+ }
+ var buf = Buffer(size)
+ if (!fill || fill.length === 0) {
+ buf.fill(0)
+ } else if (typeof encoding === 'string') {
+ buf.fill(fill, encoding)
+ } else {
+ buf.fill(fill)
+ }
+ return buf
+ }
+}
+
+if (!safer.kStringMaxLength) {
+ try {
+ safer.kStringMaxLength = process.binding('buffer').kStringMaxLength
+ } catch (e) {
+ // we can't determine kStringMaxLength in environments where process.binding
+ // is unsupported, so let's not set it
+ }
+}
+
+if (!safer.constants) {
+ safer.constants = {
+ MAX_LENGTH: safer.kMaxLength
+ }
+ if (safer.kStringMaxLength) {
+ safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength
+ }
+}
+
+module.exports = safer
+
+
+/***/ }),
+/* 15 */
+/***/ (function(module, exports, __webpack_require__) {
+
+// Copyright (c) 2012, Mark Cavage. All rights reserved.
+// Copyright 2015 Joyent, Inc.
+
+var assert = __webpack_require__(27);
+var Stream = __webpack_require__(22).Stream;
+var util = __webpack_require__(3);
+
+
+///--- Globals
+
+/* JSSTYLED */
+var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
+
+
+///--- Internal
+
+function _capitalize(str) {
+ return (str.charAt(0).toUpperCase() + str.slice(1));
+}
+
+function _toss(name, expected, oper, arg, actual) {
+ throw new assert.AssertionError({
+ message: util.format('%s (%s) is required', name, expected),
+ actual: (actual === undefined) ? typeof (arg) : actual(arg),
+ expected: expected,
+ operator: oper || '===',
+ stackStartFunction: _toss.caller
+ });
+}
+
+function _getClass(arg) {
+ return (Object.prototype.toString.call(arg).slice(8, -1));
+}
+
+function noop() {
+ // Why even bother with asserts?
+}
+
+
+///--- Exports
+
+var types = {
+ bool: {
+ check: function (arg) { return typeof (arg) === 'boolean'; }
+ },
+ func: {
+ check: function (arg) { return typeof (arg) === 'function'; }
+ },
+ string: {
+ check: function (arg) { return typeof (arg) === 'string'; }
+ },
+ object: {
+ check: function (arg) {
+ return typeof (arg) === 'object' && arg !== null;
+ }
+ },
+ number: {
+ check: function (arg) {
+ return typeof (arg) === 'number' && !isNaN(arg);
+ }
+ },
+ finite: {
+ check: function (arg) {
+ return typeof (arg) === 'number' && !isNaN(arg) && isFinite(arg);
+ }
+ },
+ buffer: {
+ check: function (arg) { return Buffer.isBuffer(arg); },
+ operator: 'Buffer.isBuffer'
+ },
+ array: {
+ check: function (arg) { return Array.isArray(arg); },
+ operator: 'Array.isArray'
+ },
+ stream: {
+ check: function (arg) { return arg instanceof Stream; },
+ operator: 'instanceof',
+ actual: _getClass
+ },
+ date: {
+ check: function (arg) { return arg instanceof Date; },
+ operator: 'instanceof',
+ actual: _getClass
+ },
+ regexp: {
+ check: function (arg) { return arg instanceof RegExp; },
+ operator: 'instanceof',
+ actual: _getClass
+ },
+ uuid: {
+ check: function (arg) {
+ return typeof (arg) === 'string' && UUID_REGEXP.test(arg);
+ },
+ operator: 'isUUID'
+ }
+};
+
+function _setExports(ndebug) {
+ var keys = Object.keys(types);
+ var out;
+
+ /* re-export standard assert */
+ if (process.env.NODE_NDEBUG) {
+ out = noop;
+ } else {
+ out = function (arg, msg) {
+ if (!arg) {
+ _toss(msg, 'true', arg);
+ }
+ };
+ }
+
+ /* standard checks */
+ keys.forEach(function (k) {
+ if (ndebug) {
+ out[k] = noop;
+ return;
+ }
+ var type = types[k];
+ out[k] = function (arg, msg) {
+ if (!type.check(arg)) {
+ _toss(msg, k, type.operator, arg, type.actual);
+ }
+ };
+ });
+
+ /* optional checks */
+ keys.forEach(function (k) {
+ var name = 'optional' + _capitalize(k);
+ if (ndebug) {
+ out[name] = noop;
+ return;
+ }
+ var type = types[k];
+ out[name] = function (arg, msg) {
+ if (arg === undefined || arg === null) {
+ return;
+ }
+ if (!type.check(arg)) {
+ _toss(msg, k, type.operator, arg, type.actual);
+ }
+ };
+ });
+
+ /* arrayOf checks */
+ keys.forEach(function (k) {
+ var name = 'arrayOf' + _capitalize(k);
+ if (ndebug) {
+ out[name] = noop;
+ return;
+ }
+ var type = types[k];
+ var expected = '[' + k + ']';
+ out[name] = function (arg, msg) {
+ if (!Array.isArray(arg)) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ var i;
+ for (i = 0; i < arg.length; i++) {
+ if (!type.check(arg[i])) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ }
+ };
+ });
+
+ /* optionalArrayOf checks */
+ keys.forEach(function (k) {
+ var name = 'optionalArrayOf' + _capitalize(k);
+ if (ndebug) {
+ out[name] = noop;
+ return;
+ }
+ var type = types[k];
+ var expected = '[' + k + ']';
+ out[name] = function (arg, msg) {
+ if (arg === undefined || arg === null) {
+ return;
+ }
+ if (!Array.isArray(arg)) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ var i;
+ for (i = 0; i < arg.length; i++) {
+ if (!type.check(arg[i])) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ }
+ };
+ });
+
+ /* re-export built-in assertions */
+ Object.keys(assert).forEach(function (k) {
+ if (k === 'AssertionError') {
+ out[k] = assert[k];
+ return;
+ }
+ if (ndebug) {
+ out[k] = noop;
+ return;
+ }
+ out[k] = assert[k];
+ });
+
+ /* export ourselves (for unit tests _only_) */
+ out._setExports = _setExports;
+
+ return out;
+}
+
+module.exports = _setExports(process.env.NODE_NDEBUG);
+
+
+/***/ }),
+/* 16 */
+/***/ (function(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
+
+
+/***/ }),
+/* 17 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.sortAlpha = sortAlpha;
+exports.sortOptionsByFlags = sortOptionsByFlags;
+exports.entries = entries;
+exports.removePrefix = removePrefix;
+exports.removeSuffix = removeSuffix;
+exports.addSuffix = addSuffix;
+exports.hyphenate = hyphenate;
+exports.camelCase = camelCase;
+exports.compareSortedArrays = compareSortedArrays;
+exports.sleep = sleep;
+const _camelCase = __webpack_require__(220);
+
+function sortAlpha(a, b) {
+ // sort alphabetically in a deterministic way
+ const shortLen = Math.min(a.length, b.length);
+ for (let i = 0; i < shortLen; i++) {
+ const aChar = a.charCodeAt(i);
+ const bChar = b.charCodeAt(i);
+ if (aChar !== bChar) {
+ return aChar - bChar;
+ }
+ }
+ return a.length - b.length;
+}
+
+function sortOptionsByFlags(a, b) {
+ const aOpt = a.flags.replace(/-/g, '');
+ const bOpt = b.flags.replace(/-/g, '');
+ return sortAlpha(aOpt, bOpt);
+}
+
+function entries(obj) {
+ const entries = [];
+ if (obj) {
+ for (const key in obj) {
+ entries.push([key, obj[key]]);
+ }
+ }
+ return entries;
+}
+
+function removePrefix(pattern, prefix) {
+ if (pattern.startsWith(prefix)) {
+ pattern = pattern.slice(prefix.length);
+ }
+
+ return pattern;
+}
+
+function removeSuffix(pattern, suffix) {
+ if (pattern.endsWith(suffix)) {
+ return pattern.slice(0, -suffix.length);
+ }
+
+ return pattern;
+}
+
+function addSuffix(pattern, suffix) {
+ if (!pattern.endsWith(suffix)) {
+ return pattern + suffix;
+ }
+
+ return pattern;
+}
+
+function hyphenate(str) {
+ return str.replace(/[A-Z]/g, match => {
+ return '-' + match.charAt(0).toLowerCase();
+ });
+}
+
+function camelCase(str) {
+ if (/[A-Z]/.test(str)) {
+ return null;
+ } else {
+ return _camelCase(str);
+ }
+}
+
+function compareSortedArrays(array1, array2) {
+ if (array1.length !== array2.length) {
+ return false;
+ }
+ for (let i = 0, len = array1.length; i < len; i++) {
+ if (array1[i] !== array2[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+
+function sleep(ms) {
+ return new Promise(resolve => {
+ setTimeout(resolve, ms);
+ });
+}
+
+/***/ }),
+/* 18 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.stringify = exports.parse = undefined;
+
+var _asyncToGenerator2;
+
+function _load_asyncToGenerator() {
+ return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2));
+}
+
+var _parse;
+
+function _load_parse() {
+ return _parse = __webpack_require__(98);
+}
+
+Object.defineProperty(exports, 'parse', {
+ enumerable: true,
+ get: function get() {
+ return _interopRequireDefault(_parse || _load_parse()).default;
+ }
+});
+
+var _stringify;
+
+function _load_stringify() {
+ return _stringify = __webpack_require__(190);
+}
+
+Object.defineProperty(exports, 'stringify', {
+ enumerable: true,
+ get: function get() {
+ return _interopRequireDefault(_stringify || _load_stringify()).default;
+ }
+});
+exports.implodeEntry = implodeEntry;
+exports.explodeEntry = explodeEntry;
+
+var _misc;
+
+function _load_misc() {
+ return _misc = __webpack_require__(17);
+}
+
+var _normalizePattern;
+
+function _load_normalizePattern() {
+ return _normalizePattern = __webpack_require__(36);
+}
+
+var _parse2;
+
+function _load_parse2() {
+ return _parse2 = _interopRequireDefault(__webpack_require__(98));
+}
+
+var _constants;
+
+function _load_constants() {
+ return _constants = __webpack_require__(9);
+}
+
+var _fs;
+
+function _load_fs() {
+ return _fs = _interopRequireWildcard(__webpack_require__(6));
+}
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const invariant = __webpack_require__(8);
+
+const path = __webpack_require__(0);
+const ssri = __webpack_require__(70);
+
+function getName(pattern) {
+ return (0, (_normalizePattern || _load_normalizePattern()).normalizePattern)(pattern).name;
+}
+
+function blankObjectUndefined(obj) {
+ return obj && Object.keys(obj).length ? obj : undefined;
+}
+
+function keyForRemote(remote) {
+ return remote.resolved || (remote.reference && remote.hash ? `${remote.reference}#${remote.hash}` : null);
+}
+
+function serializeIntegrity(integrity) {
+ // We need this because `Integrity.toString()` does not use sorting to ensure a stable string output
+ // See https://git.io/vx2Hy
+ return integrity.toString().split(' ').sort().join(' ');
+}
+
+function implodeEntry(pattern, obj) {
+ const inferredName = getName(pattern);
+ const integrity = obj.integrity ? serializeIntegrity(obj.integrity) : '';
+ const imploded = {
+ name: inferredName === obj.name ? undefined : obj.name,
+ version: obj.version,
+ uid: obj.uid === obj.version ? undefined : obj.uid,
+ resolved: obj.resolved,
+ registry: obj.registry === 'npm' ? undefined : obj.registry,
+ dependencies: blankObjectUndefined(obj.dependencies),
+ optionalDependencies: blankObjectUndefined(obj.optionalDependencies),
+ permissions: blankObjectUndefined(obj.permissions),
+ prebuiltVariants: blankObjectUndefined(obj.prebuiltVariants)
+ };
+ if (integrity) {
+ imploded.integrity = integrity;
+ }
+ return imploded;
+}
+
+function explodeEntry(pattern, obj) {
+ obj.optionalDependencies = obj.optionalDependencies || {};
+ obj.dependencies = obj.dependencies || {};
+ obj.uid = obj.uid || obj.version;
+ obj.permissions = obj.permissions || {};
+ obj.registry = obj.registry || 'npm';
+ obj.name = obj.name || getName(pattern);
+ const integrity = obj.integrity;
+ if (integrity && integrity.isIntegrity) {
+ obj.integrity = ssri.parse(integrity);
+ }
+ return obj;
+}
+
+class Lockfile {
+ constructor({ cache, source, parseResultType } = {}) {
+ this.source = source || '';
+ this.cache = cache;
+ this.parseResultType = parseResultType;
+ }
+
+ // source string if the `cache` was parsed
+
+
+ // if true, we're parsing an old yarn file and need to update integrity fields
+ hasEntriesExistWithoutIntegrity() {
+ if (!this.cache) {
+ return false;
+ }
+
+ for (const key in this.cache) {
+ // $FlowFixMe - `this.cache` is clearly defined at this point
+ if (!/^.*@(file:|http)/.test(key) && this.cache[key] && !this.cache[key].integrity) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ static fromDirectory(dir, reporter) {
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ // read the manifest in this directory
+ const lockfileLoc = path.join(dir, (_constants || _load_constants()).LOCKFILE_FILENAME);
+
+ let lockfile;
+ let rawLockfile = '';
+ let parseResult;
+
+ if (yield (_fs || _load_fs()).exists(lockfileLoc)) {
+ rawLockfile = yield (_fs || _load_fs()).readFile(lockfileLoc);
+ parseResult = (0, (_parse2 || _load_parse2()).default)(rawLockfile, lockfileLoc);
+
+ if (reporter) {
+ if (parseResult.type === 'merge') {
+ reporter.info(reporter.lang('lockfileMerged'));
+ } else if (parseResult.type === 'conflict') {
+ reporter.warn(reporter.lang('lockfileConflict'));
+ }
+ }
+
+ lockfile = parseResult.object;
+ } else if (reporter) {
+ reporter.info(reporter.lang('noLockfileFound'));
+ }
+
+ return new Lockfile({ cache: lockfile, source: rawLockfile, parseResultType: parseResult && parseResult.type });
+ })();
+ }
+
+ getLocked(pattern) {
+ const cache = this.cache;
+ if (!cache) {
+ return undefined;
+ }
+
+ const shrunk = pattern in cache && cache[pattern];
+
+ if (typeof shrunk === 'string') {
+ return this.getLocked(shrunk);
+ } else if (shrunk) {
+ explodeEntry(pattern, shrunk);
+ return shrunk;
+ }
+
+ return undefined;
+ }
+
+ removePattern(pattern) {
+ const cache = this.cache;
+ if (!cache) {
+ return;
+ }
+ delete cache[pattern];
+ }
+
+ getLockfile(patterns) {
+ const lockfile = {};
+ const seen = new Map();
+
+ // order by name so that lockfile manifest is assigned to the first dependency with this manifest
+ // the others that have the same remoteKey will just refer to the first
+ // ordering allows for consistency in lockfile when it is serialized
+ const sortedPatternsKeys = Object.keys(patterns).sort((_misc || _load_misc()).sortAlpha);
+
+ for (var _iterator = sortedPatternsKeys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+ var _ref;
+
+ if (_isArray) {
+ if (_i >= _iterator.length) break;
+ _ref = _iterator[_i++];
+ } else {
+ _i = _iterator.next();
+ if (_i.done) break;
+ _ref = _i.value;
+ }
+
+ const pattern = _ref;
+
+ const pkg = patterns[pattern];
+ const remote = pkg._remote,
+ ref = pkg._reference;
+
+ invariant(ref, 'Package is missing a reference');
+ invariant(remote, 'Package is missing a remote');
+
+ const remoteKey = keyForRemote(remote);
+ const seenPattern = remoteKey && seen.get(remoteKey);
+ if (seenPattern) {
+ // no point in duplicating it
+ lockfile[pattern] = seenPattern;
+
+ // if we're relying on our name being inferred and two of the patterns have
+ // different inferred names then we need to set it
+ if (!seenPattern.name && getName(pattern) !== pkg.name) {
+ seenPattern.name = pkg.name;
+ }
+ continue;
+ }
+ const obj = implodeEntry(pattern, {
+ name: pkg.name,
+ version: pkg.version,
+ uid: pkg._uid,
+ resolved: remote.resolved,
+ integrity: remote.integrity,
+ registry: remote.registry,
+ dependencies: pkg.dependencies,
+ peerDependencies: pkg.peerDependencies,
+ optionalDependencies: pkg.optionalDependencies,
+ permissions: ref.permissions,
+ prebuiltVariants: pkg.prebuiltVariants
+ });
+
+ lockfile[pattern] = obj;
+
+ if (remoteKey) {
+ seen.set(remoteKey, obj);
+ }
+ }
+
+ return lockfile;
+ }
+}
+exports.default = Lockfile;
+
+/***/ }),
+/* 19 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var store = __webpack_require__(126)('wks');
+var uid = __webpack_require__(130);
+var Symbol = __webpack_require__(16).Symbol;
+var USE_SYMBOL = typeof Symbol == 'function';
+
+var $exports = module.exports = function (name) {
+ return store[name] || (store[name] =
+ USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
+};
+
+$exports.store = store;
+
+
+/***/ }),
+/* 20 */
+/***/ (function(module, exports) {
+
+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;
+};
+
+Comparator.prototype.test = function(version) {
+ debug('Comparator.test', version, this.loose);
+
+ if (this.semver === ANY)
+ return true;
+
+ if (typeof version === 'string')
+ version = new SemVer(version, this.loose);
+
+ return cmp(version, this.operator, this.semver, this.loose);
+};
+
+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 === '>'));
+
+ return sameDirectionIncreasing || sameDirectionDecreasing ||
+ (sameSemVer && differentDirectionsInclusive) ||
+ oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
+};
+
+
+exports.Range = Range;
+function Range(range, loose) {
+ if (range instanceof Range) {
+ if (range.loose === loose) {
+ return range;
+ } else {
+ return new Range(range.raw, loose);
+ }
+ }
+
+ 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();
+}
+
+Range.prototype.format = function() {
+ this.range = this.set.map(function(comps) {
+ return comps.join(' ').trim();
+ }).join('||').trim();
+ return this.range;
+};
+
+Range.prototype.toString = function() {
+ return this.range;
+};
+
+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]);
+
+ // `~ 1.2.3` => `~1.2.3`
+ range = range.replace(re[TILDETRIM], tildeTrimReplace);
+
+ // `^ 1.2.3` => `^1.2.3`
+ range = range.replace(re[CARETTRIM], caretTrimReplace);
+
+ // normalize spaces
+ range = range.split(/\s+/).join(' ');
+
+ // At this point, the range is completely trimmed and
+ // ready to be split into comparators.
+
+ 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);
+ });
+
+ return set;
+};
+
+Range.prototype.intersects = function(range, loose) {
+ if (!(range instanceof Range)) {
+ throw new TypeError('a Range is required');
+ }
+
+ 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);
+ });
+ });
+ });
+ });
+};
+
+// 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(' ');
+ });
+}
+
+// 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(' ');
+}
+
+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;
+
+ 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';
+
+ debug('tilde return', ret);
+ return ret;
+ });
+}
+
+// ^ --> * (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(' ');
+}
+
+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;
+
+ 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';
+ }
+
+ debug('caret return', ret);
+ return ret;
+ });
+}
+
+function replaceXRanges(comp, loose) {
+ debug('replaceXRanges', comp, loose);
+ return comp.split(/\s+/).map(function(comp) {
+ return replaceXRange(comp, loose);
+ }).join(' ');
+}
+
+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;
+
+ if (gtlt === '=' && anyX)
+ gtlt = '';
+
+ 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;
+ }
+
+ 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';
+ }
+
+ debug('xRange return', ret);
+
+ return ret;
+ });
+}
+
+// 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;
+
+ return (from + ' ' + to).trim();
+}
+
+
+// if ANY of the sets match ALL of its comparators, then pass
+Range.prototype.test = function(version) {
+ if (!version)
+ return false;
+
+ 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;
+};
+
+function testSet(set, version) {
+ for (var i = 0; i < set.length; i++) {
+ if (!set[i].test(version))
+ return false;
+ }
+
+ 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;
+
+ 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;
+ }
+ }
+
+ // Version has a -pre, but it's not one of the ones we like.
+ return false;
+ }
+
+ return true;
+}
+
+exports.satisfies = satisfies;
+function satisfies(version, range, loose) {
+ try {
+ range = new Range(range, loose);
+ } catch (er) {
+ return false;
+ }
+ return range.test(version);
+}
+
+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 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);
+ }
+ }
+ })
+ 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;
+ }
+}
+
+// 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);
+}
+
+// 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);
+}
+
+exports.outside = outside;
+function outside(version, range, hilo, loose) {
+ version = new SemVer(version, loose);
+ range = new Range(range, loose);
+
+ 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 ">"');
+ }
+
+ // If it satisifes the range it is not outside
+ if (satisfies(version, range, loose)) {
+ return false;
+ }
+
+ // 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;
+ }
+
+ // 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;
+ }
+ }
+ return true;
+}
+
+exports.prerelease = prerelease;
+function prerelease(version, loose) {
+ var parsed = parse(version, loose);
+ return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
+}
+
+exports.intersects = intersects;
+function intersects(r1, r2, loose) {
+ r1 = new Range(r1, loose)
+ r2 = new Range(r2, loose)
+ return r1.intersects(r2)
+}
+
+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'));
+}
+
+
+/***/ }),
+/* 21 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+exports.__esModule = true;
+
+var _assign = __webpack_require__(560);
+
+var _assign2 = _interopRequireDefault(_assign);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+exports.default = _assign2.default || function (target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i];
+
+ for (var key in source) {
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
+ target[key] = source[key];
+ }
+ }
+ }
+
+ return target;
+};
+
+/***/ }),
+/* 22 */
+/***/ (function(module, exports) {
+
+module.exports = require("stream");
+
+/***/ }),
+/* 23 */
+/***/ (function(module, exports) {
+
+module.exports = require("url");
+
+/***/ }),
+/* 24 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscription; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isArray__ = __webpack_require__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isObject__ = __webpack_require__(412);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isFunction__ = __webpack_require__(145);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_tryCatch__ = __webpack_require__(51);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_errorObject__ = __webpack_require__(44);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__ = __webpack_require__(409);
+/** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_tryCatch,_util_errorObject,_util_UnsubscriptionError PURE_IMPORTS_END */
+
+
+
+
+
+
+var Subscription = /*@__PURE__*/ (function () {
+ function Subscription(unsubscribe) {
+ this.closed = false;
+ this._parent = null;
+ this._parents = null;
+ this._subscriptions = null;
+ if (unsubscribe) {
+ this._unsubscribe = unsubscribe;
+ }
+ }
+ Subscription.prototype.unsubscribe = function () {
+ var hasErrors = false;
+ var errors;
+ if (this.closed) {
+ return;
+ }
+ var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
+ this.closed = true;
+ this._parent = null;
+ this._parents = null;
+ this._subscriptions = null;
+ var index = -1;
+ var len = _parents ? _parents.length : 0;
+ while (_parent) {
+ _parent.remove(this);
+ _parent = ++index < len && _parents[index] || null;
+ }
+ if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__util_isFunction__["a" /* isFunction */])(_unsubscribe)) {
+ var trial = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(_unsubscribe).call(this);
+ if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) {
+ hasErrors = true;
+ errors = errors || (__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */] ?
+ flattenUnsubscriptionErrors(__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e.errors) : [__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e]);
+ }
+ }
+ if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__util_isArray__["a" /* isArray */])(_subscriptions)) {
+ index = -1;
+ len = _subscriptions.length;
+ while (++index < len) {
+ var sub = _subscriptions[index];
+ if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_isObject__["a" /* isObject */])(sub)) {
+ var trial = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(sub.unsubscribe).call(sub);
+ if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) {
+ hasErrors = true;
+ errors = errors || [];
+ var err = __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e;
+ if (err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) {
+ errors = errors.concat(flattenUnsubscriptionErrors(err.errors));
+ }
+ else {
+ errors.push(err);
+ }
+ }
+ }
+ }
+ }
+ if (hasErrors) {
+ throw new __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */](errors);
+ }
+ };
+ Subscription.prototype.add = function (teardown) {
+ if (!teardown || (teardown === Subscription.EMPTY)) {
+ return Subscription.EMPTY;
+ }
+ if (teardown === this) {
+ return this;
+ }
+ var subscription = teardown;
+ switch (typeof teardown) {
+ case 'function':
+ subscription = new Subscription(teardown);
+ case 'object':
+ if (subscription.closed || typeof subscription.unsubscribe !== 'function') {
+ return subscription;
+ }
+ else if (this.closed) {
+ subscription.unsubscribe();
+ return subscription;
+ }
+ else if (typeof subscription._addParent !== 'function') {
+ var tmp = subscription;
+ subscription = new Subscription();
+ subscription._subscriptions = [tmp];
+ }
+ break;
+ default:
+ throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
+ }
+ var subscriptions = this._subscriptions || (this._subscriptions = []);
+ subscriptions.push(subscription);
+ subscription._addParent(this);
+ return subscription;
+ };
+ Subscription.prototype.remove = function (subscription) {
+ var subscriptions = this._subscriptions;
+ if (subscriptions) {
+ var subscriptionIndex = subscriptions.indexOf(subscription);
+ if (subscriptionIndex !== -1) {
+ subscriptions.splice(subscriptionIndex, 1);
+ }
+ }
+ };
+ Subscription.prototype._addParent = function (parent) {
+ var _a = this, _parent = _a._parent, _parents = _a._parents;
+ if (!_parent || _parent === parent) {
+ this._parent = parent;
+ }
+ else if (!_parents) {
+ this._parents = [parent];
+ }
+ else if (_parents.indexOf(parent) === -1) {
+ _parents.push(parent);
+ }
+ };
+ Subscription.EMPTY = (function (empty) {
+ empty.closed = true;
+ return empty;
+ }(new Subscription()));
+ return Subscription;
+}());
+
+function flattenUnsubscriptionErrors(errors) {
+ return errors.reduce(function (errs, err) { return errs.concat((err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) ? err.errors : err); }, []);
+}
+//# sourceMappingURL=Subscription.js.map
+
+
+/***/ }),
+/* 25 */
+/***/ (function(module, exports, __webpack_require__) {
+
+// Copyright 2015 Joyent, Inc.
+
+module.exports = {
+ bufferSplit: bufferSplit,
+ addRSAMissing: addRSAMissing,
+ calculateDSAPublic: calculateDSAPublic,
+ calculateED25519Public: calculateED25519Public,
+ calculateX25519Public: calculateX25519Public,
+ mpNormalize: mpNormalize,
+ mpDenormalize: mpDenormalize,
+ ecNormalize: ecNormalize,
+ countZeros: countZeros,
+ assertCompatible: assertCompatible,
+ isCompatible: isCompatible,
+ opensslKeyDeriv: opensslKeyDeriv,
+ opensshCipherInfo: opensshCipherInfo,
+ publicFromPrivateECDSA: publicFromPrivateECDSA,
+ zeroPadToLength: zeroPadToLength,
+ writeBitString: writeBitString,
+ readBitString: readBitString
+};
+
+var assert = __webpack_require__(15);
+var Buffer = __webpack_require__(14).Buffer;
+var PrivateKey = __webpack_require__(32);
+var Key = __webpack_require__(26);
+var crypto = __webpack_require__(11);
+var algs = __webpack_require__(31);
+var asn1 = __webpack_require__(59);
+
+var ec, jsbn;
+var nacl;
+
+var MAX_CLASS_DEPTH = 3;
+
+function isCompatible(obj, klass, needVer) {
+ if (obj === null || typeof (obj) !== 'object')
+ return (false);
+ if (needVer === undefined)
+ needVer = klass.prototype._sshpkApiVersion;
+ if (obj instanceof klass &&
+ klass.prototype._sshpkApiVersion[0] == needVer[0])
+ return (true);
+ var proto = Object.getPrototypeOf(obj);
+ var depth = 0;
+ while (proto.constructor.name !== klass.name) {
+ proto = Object.getPrototypeOf(proto);
+ if (!proto || ++depth > MAX_CLASS_DEPTH)
+ return (false);
+ }
+ if (proto.constructor.name !== klass.name)
+ return (false);
+ var ver = proto._sshpkApiVersion;
+ if (ver === undefined)
+ ver = klass._oldVersionDetect(obj);
+ if (ver[0] != needVer[0] || ver[1] < needVer[1])
+ return (false);
+ return (true);
+}
+
+function assertCompatible(obj, klass, needVer, name) {
+ if (name === undefined)
+ name = 'object';
+ assert.ok(obj, name + ' must not be null');
+ assert.object(obj, name + ' must be an object');
+ if (needVer === undefined)
+ needVer = klass.prototype._sshpkApiVersion;
+ if (obj instanceof klass &&
+ klass.prototype._sshpkApiVersion[0] == needVer[0])
+ return;
+ var proto = Object.getPrototypeOf(obj);
+ var depth = 0;
+ while (proto.constructor.name !== klass.name) {
+ proto = Object.getPrototypeOf(proto);
+ assert.ok(proto && ++depth <= MAX_CLASS_DEPTH,
+ name + ' must be a ' + klass.name + ' instance');
+ }
+ assert.strictEqual(proto.constructor.name, klass.name,
+ name + ' must be a ' + klass.name + ' instance');
+ var ver = proto._sshpkApiVersion;
+ if (ver === undefined)
+ ver = klass._oldVersionDetect(obj);
+ assert.ok(ver[0] == needVer[0] && ver[1] >= needVer[1],
+ name + ' must be compatible with ' + klass.name + ' klass ' +
+ 'version ' + needVer[0] + '.' + needVer[1]);
+}
+
+var CIPHER_LEN = {
+ 'des-ede3-cbc': { key: 7, iv: 8 },
+ 'aes-128-cbc': { key: 16, iv: 16 }
+};
+var PKCS5_SALT_LEN = 8;
+
+function opensslKeyDeriv(cipher, salt, passphrase, count) {
+ assert.buffer(salt, 'salt');
+ assert.buffer(passphrase, 'passphrase');
+ assert.number(count, 'iteration count');
+
+ var clen = CIPHER_LEN[cipher];
+ assert.object(clen, 'supported cipher');
+
+ salt = salt.slice(0, PKCS5_SALT_LEN);
+
+ var D, D_prev, bufs;
+ var material = Buffer.alloc(0);
+ while (material.length < clen.key + clen.iv) {
+ bufs = [];
+ if (D_prev)
+ bufs.push(D_prev);
+ bufs.push(passphrase);
+ bufs.push(salt);
+ D = Buffer.concat(bufs);
+ for (var j = 0; j < count; ++j)
+ D = crypto.createHash('md5').update(D).digest();
+ material = Buffer.concat([material, D]);
+ D_prev = D;
+ }
+
+ return ({
+ key: material.slice(0, clen.key),
+ iv: material.slice(clen.key, clen.key + clen.iv)
+ });
+}
+
+/* Count leading zero bits on a buffer */
+function countZeros(buf) {
+ var o = 0, obit = 8;
+ while (o < buf.length) {
+ var mask = (1 << obit);
+ if ((buf[o] & mask) === mask)
+ break;
+ obit--;
+ if (obit < 0) {
+ o++;
+ obit = 8;
+ }
+ }
+ return (o*8 + (8 - obit) - 1);
+}
+
+function bufferSplit(buf, chr) {
+ assert.buffer(buf);
+ assert.string(chr);
+
+ var parts = [];
+ var lastPart = 0;
+ var matches = 0;
+ for (var i = 0; i < buf.length; ++i) {
+ if (buf[i] === chr.charCodeAt(matches))
+ ++matches;
+ else if (buf[i] === chr.charCodeAt(0))
+ matches = 1;
+ else
+ matches = 0;
+
+ if (matches >= chr.length) {
+ var newPart = i + 1;
+ parts.push(buf.slice(lastPart, newPart - matches));
+ lastPart = newPart;
+ matches = 0;
+ }
+ }
+ if (lastPart <= buf.length)
+ parts.push(buf.slice(lastPart, buf.length));
+
+ return (parts);
+}
+
+function ecNormalize(buf, addZero) {
+ assert.buffer(buf);
+ if (buf[0] === 0x00 && buf[1] === 0x04) {
+ if (addZero)
+ return (buf);
+ return (buf.slice(1));
+ } else if (buf[0] === 0x04) {
+ if (!addZero)
+ return (buf);
+ } else {
+ while (buf[0] === 0x00)
+ buf = buf.slice(1);
+ if (buf[0] === 0x02 || buf[0] === 0x03)
+ throw (new Error('Compressed elliptic curve points ' +
+ 'are not supported'));
+ if (buf[0] !== 0x04)
+ throw (new Error('Not a valid elliptic curve point'));
+ if (!addZero)
+ return (buf);
+ }
+ var b = Buffer.alloc(buf.length + 1);
+ b[0] = 0x0;
+ buf.copy(b, 1);
+ return (b);
+}
+
+function readBitString(der, tag) {
+ if (tag === undefined)
+ tag = asn1.Ber.BitString;
+ var buf = der.readString(tag, true);
+ assert.strictEqual(buf[0], 0x00, 'bit strings with unused bits are ' +
+ 'not supported (0x' + buf[0].toString(16) + ')');
+ return (buf.slice(1));
+}
+
+function writeBitString(der, buf, tag) {
+ if (tag === undefined)
+ tag = asn1.Ber.BitString;
+ var b = Buffer.alloc(buf.length + 1);
+ b[0] = 0x00;
+ buf.copy(b, 1);
+ der.writeBuffer(b, tag);
+}
+
+function mpNormalize(buf) {
+ assert.buffer(buf);
+ while (buf.length > 1 && buf[0] === 0x00 && (buf[1] & 0x80) === 0x00)
+ buf = buf.slice(1);
+ if ((buf[0] & 0x80) === 0x80) {
+ var b = Buffer.alloc(buf.length + 1);
+ b[0] = 0x00;
+ buf.copy(b, 1);
+ buf = b;
+ }
+ return (buf);
+}
+
+function mpDenormalize(buf) {
+ assert.buffer(buf);
+ while (buf.length > 1 && buf[0] === 0x00)
+ buf = buf.slice(1);
+ return (buf);
+}
+
+function zeroPadToLength(buf, len) {
+ assert.buffer(buf);
+ assert.number(len);
+ while (buf.length > len) {
+ assert.equal(buf[0], 0x00);
+ buf = buf.slice(1);
+ }
+ while (buf.length < len) {
+ var b = Buffer.alloc(buf.length + 1);
+ b[0] = 0x00;
+ buf.copy(b, 1);
+ buf = b;
+ }
+ return (buf);
+}
+
+function bigintToMpBuf(bigint) {
+ var buf = Buffer.from(bigint.toByteArray());
+ buf = mpNormalize(buf);
+ return (buf);
+}
+
+function calculateDSAPublic(g, p, x) {
+ assert.buffer(g);
+ assert.buffer(p);
+ assert.buffer(x);
+ try {
+ var bigInt = __webpack_require__(74).BigInteger;
+ } catch (e) {
+ throw (new Error('To load a PKCS#8 format DSA private key, ' +
+ 'the node jsbn library is required.'));
+ }
+ g = new bigInt(g);
+ p = new bigInt(p);
+ x = new bigInt(x);
+ var y = g.modPow(x, p);
+ var ybuf = bigintToMpBuf(y);
+ return (ybuf);
+}
+
+function calculateED25519Public(k) {
+ assert.buffer(k);
+
+ if (nacl === undefined)
+ nacl = __webpack_require__(68);
+
+ var kp = nacl.sign.keyPair.fromSeed(new Uint8Array(k));
+ return (Buffer.from(kp.publicKey));
+}
+
+function calculateX25519Public(k) {
+ assert.buffer(k);
+
+ if (nacl === undefined)
+ nacl = __webpack_require__(68);
+
+ var kp = nacl.box.keyPair.fromSeed(new Uint8Array(k));
+ return (Buffer.from(kp.publicKey));
+}
+
+function addRSAMissing(key) {
+ assert.object(key);
+ assertCompatible(key, PrivateKey, [1, 1]);
+ try {
+ var bigInt = __webpack_require__(74).BigInteger;
+ } catch (e) {
+ throw (new Error('To write a PEM private key from ' +
+ 'this source, the node jsbn lib is required.'));
+ }
+
+ var d = new bigInt(key.part.d.data);
+ var buf;
+
+ if (!key.part.dmodp) {
+ var p = new bigInt(key.part.p.data);
+ var dmodp = d.mod(p.subtract(1));
+
+ buf = bigintToMpBuf(dmodp);
+ key.part.dmodp = {name: 'dmodp', data: buf};
+ key.parts.push(key.part.dmodp);
+ }
+ if (!key.part.dmodq) {
+ var q = new bigInt(key.part.q.data);
+ var dmodq = d.mod(q.subtract(1));
+
+ buf = bigintToMpBuf(dmodq);
+ key.part.dmodq = {name: 'dmodq', data: buf};
+ key.parts.push(key.part.dmodq);
+ }
+}
+
+function publicFromPrivateECDSA(curveName, priv) {
+ assert.string(curveName, 'curveName');
+ assert.buffer(priv);
+ if (ec === undefined)
+ ec = __webpack_require__(132);
+ if (jsbn === undefined)
+ jsbn = __webpack_require__(74).BigInteger;
+ var params = algs.curves[curveName];
+ var p = new jsbn(params.p);
+ var a = new jsbn(params.a);
+ var b = new jsbn(params.b);
+ var curve = new ec.ECCurveFp(p, a, b);
+ var G = curve.decodePointHex(params.G.toString('hex'));
+
+ var d = new jsbn(mpNormalize(priv));
+ var pub = G.multiply(d);
+ pub = Buffer.from(curve.encodePointHex(pub), 'hex');
+
+ var parts = [];
+ parts.push({name: 'curve', data: Buffer.from(curveName)});
+ parts.push({name: 'Q', data: pub});
+
+ var key = new Key({type: 'ecdsa', curve: curve, parts: parts});
+ return (key);
+}
+
+function opensshCipherInfo(cipher) {
+ var inf = {};
+ switch (cipher) {
+ case '3des-cbc':
+ inf.keySize = 24;
+ inf.blockSize = 8;
+ inf.opensslName = 'des-ede3-cbc';
+ break;
+ case 'blowfish-cbc':
+ inf.keySize = 16;
+ inf.blockSize = 8;
+ inf.opensslName = 'bf-cbc';
+ break;
+ case 'aes128-cbc':
+ case 'aes128-ctr':
+ case 'aes128-gcm@openssh.com':
+ inf.keySize = 16;
+ inf.blockSize = 16;
+ inf.opensslName = 'aes-128-' + cipher.slice(7, 10);
+ break;
+ case 'aes192-cbc':
+ case 'aes192-ctr':
+ case 'aes192-gcm@openssh.com':
+ inf.keySize = 24;
+ inf.blockSize = 16;
+ inf.opensslName = 'aes-192-' + cipher.slice(7, 10);
+ break;
+ case 'aes256-cbc':
+ case 'aes256-ctr':
+ case 'aes256-gcm@openssh.com':
+ inf.keySize = 32;
+ inf.blockSize = 16;
+ inf.opensslName = 'aes-256-' + cipher.slice(7, 10);
+ break;
+ default:
+ throw (new Error(
+ 'Unsupported openssl cipher "' + cipher + '"'));
+ }
+ return (inf);
+}
+
+
+/***/ }),
+/* 26 */
+/***/ (function(module, exports, __webpack_require__) {
+
+// Copyright 2017 Joyent, Inc.
+
+module.exports = Key;
+
+var assert = __webpack_require__(15);
+var algs = __webpack_require__(31);
+var crypto = __webpack_require__(11);
+var Fingerprint = __webpack_require__(147);
+var Signature = __webpack_require__(67);
+var DiffieHellman = __webpack_require__(292).DiffieHellman;
+var errs = __webpack_require__(66);
+var utils = __webpack_require__(25);
+var PrivateKey = __webpack_require__(32);
+var edCompat;
+
+try {
+ edCompat = __webpack_require__(422);
+} catch (e) {
+ /* Just continue through, and bail out if we try to use it. */
+}
+
+var InvalidAlgorithmError = errs.InvalidAlgorithmError;
+var KeyParseError = errs.KeyParseError;
+
+var formats = {};
+formats['auto'] = __webpack_require__(423);
+formats['pem'] = __webpack_require__(79);
+formats['pkcs1'] = __webpack_require__(294);
+formats['pkcs8'] = __webpack_require__(148);
+formats['rfc4253'] = __webpack_require__(96);
+formats['ssh'] = __webpack_require__(424);
+formats['ssh-private'] = __webpack_require__(183);
+formats['openssh'] = formats['ssh-private'];
+formats['dnssec'] = __webpack_require__(293);
+
+function Key(opts) {
+ assert.object(opts, 'options');
+ assert.arrayOfObject(opts.parts, 'options.parts');
+ assert.string(opts.type, 'options.type');
+ assert.optionalString(opts.comment, 'options.comment');
+
+ var algInfo = algs.info[opts.type];
+ if (typeof (algInfo) !== 'object')
+ throw (new InvalidAlgorithmError(opts.type));
+
+ var partLookup = {};
+ for (var i = 0; i < opts.parts.length; ++i) {
+ var part = opts.parts[i];
+ partLookup[part.name] = part;
+ }
+
+ this.type = opts.type;
+ this.parts = opts.parts;
+ this.part = partLookup;
+ this.comment = undefined;
+ this.source = opts.source;
+
+ /* for speeding up hashing/fingerprint operations */
+ this._rfc4253Cache = opts._rfc4253Cache;
+ this._hashCache = {};
+
+ var sz;
+ this.curve = undefined;
+ if (this.type === 'ecdsa') {
+ var curve = this.part.curve.data.toString();
+ this.curve = curve;
+ sz = algs.curves[curve].size;
+ } else if (this.type === 'ed25519' || this.type === 'curve25519') {
+ sz = 256;
+ this.curve = 'curve25519';
+ } else {
+ var szPart = this.part[algInfo.sizePart];
+ sz = szPart.data.length;
+ sz = sz * 8 - utils.countZeros(szPart.data);
+ }
+ this.size = sz;
+}
+
+Key.formats = formats;
+
+Key.prototype.toBuffer = function (format, options) {
+ if (format === undefined)
+ format = 'ssh';
+ assert.string(format, 'format');
+ assert.object(formats[format], 'formats[format]');
+ assert.optionalObject(options, 'options');
+
+ if (format === 'rfc4253') {
+ if (this._rfc4253Cache === undefined)
+ this._rfc4253Cache = formats['rfc4253'].write(this);
+ return (this._rfc4253Cache);
+ }
+
+ return (formats[format].write(this, options));
+};
+
+Key.prototype.toString = function (format, options) {
+ return (this.toBuffer(format, options).toString());
+};
+
+Key.prototype.hash = function (algo) {
+ assert.string(algo, 'algorithm');
+ algo = algo.toLowerCase();
+ if (algs.hashAlgs[algo] === undefined)
+ throw (new InvalidAlgorithmError(algo));
+
+ if (this._hashCache[algo])
+ return (this._hashCache[algo]);
+ var hash = crypto.createHash(algo).
+ update(this.toBuffer('rfc4253')).digest();
+ this._hashCache[algo] = hash;
+ return (hash);
+};
+
+Key.prototype.fingerprint = function (algo) {
+ if (algo === undefined)
+ algo = 'sha256';
+ assert.string(algo, 'algorithm');
+ var opts = {
+ type: 'key',
+ hash: this.hash(algo),
+ algorithm: algo
+ };
+ return (new Fingerprint(opts));
+};
+
+Key.prototype.defaultHashAlgorithm = function () {
+ var hashAlgo = 'sha1';
+ if (this.type === 'rsa')
+ hashAlgo = 'sha256';
+ if (this.type === 'dsa' && this.size > 1024)
+ hashAlgo = 'sha256';
+ if (this.type === 'ed25519')
+ hashAlgo = 'sha512';
+ if (this.type === 'ecdsa') {
+ if (this.size <= 256)
+ hashAlgo = 'sha256';
+ else if (this.size <= 384)
+ hashAlgo = 'sha384';
+ else
+ hashAlgo = 'sha512';
+ }
+ return (hashAlgo);
+};
+
+Key.prototype.createVerify = function (hashAlgo) {
+ if (hashAlgo === undefined)
+ hashAlgo = this.defaultHashAlgorithm();
+ assert.string(hashAlgo, 'hash algorithm');
+
+ /* ED25519 is not supported by OpenSSL, use a javascript impl. */
+ if (this.type === 'ed25519' && edCompat !== undefined)
+ return (new edCompat.Verifier(this, hashAlgo));
+ if (this.type === 'curve25519')
+ throw (new Error('Curve25519 keys are not suitable for ' +
+ 'signing or verification'));
+
+ var v, nm, err;
+ try {
+ nm = hashAlgo.toUpperCase();
+ v = crypto.createVerify(nm);
+ } catch (e) {
+ err = e;
+ }
+ if (v === undefined || (err instanceof Error &&
+ err.message.match(/Unknown message digest/))) {
+ nm = 'RSA-';
+ nm += hashAlgo.toUpperCase();
+ v = crypto.createVerify(nm);
+ }
+ assert.ok(v, 'failed to create verifier');
+ var oldVerify = v.verify.bind(v);
+ var key = this.toBuffer('pkcs8');
+ var curve = this.curve;
+ var self = this;
+ v.verify = function (signature, fmt) {
+ if (Signature.isSignature(signature, [2, 0])) {
+ if (signature.type !== self.type)
+ return (false);
+ if (signature.hashAlgorithm &&
+ signature.hashAlgorithm !== hashAlgo)
+ return (false);
+ if (signature.curve && self.type === 'ecdsa' &&
+ signature.curve !== curve)
+ return (false);
+ return (oldVerify(key, signature.toBuffer('asn1')));
+
+ } else if (typeof (signature) === 'string' ||
+ Buffer.isBuffer(signature)) {
+ return (oldVerify(key, signature, fmt));
+
+ /*
+ * Avoid doing this on valid arguments, walking the prototype
+ * chain can be quite slow.
+ */
+ } else if (Signature.isSignature(signature, [1, 0])) {
+ throw (new Error('signature was created by too old ' +
+ 'a version of sshpk and cannot be verified'));
+
+ } else {
+ throw (new TypeError('signature must be a string, ' +
+ 'Buffer, or Signature object'));
+ }
+ };
+ return (v);
+};
+
+Key.prototype.createDiffieHellman = function () {
+ if (this.type === 'rsa')
+ throw (new Error('RSA keys do not support Diffie-Hellman'));
+
+ return (new DiffieHellman(this));
+};
+Key.prototype.createDH = Key.prototype.createDiffieHellman;
+
+Key.parse = function (data, format, options) {
+ if (typeof (data) !== 'string')
+ assert.buffer(data, 'data');
+ if (format === undefined)
+ format = 'auto';
+ assert.string(format, 'format');
+ if (typeof (options) === 'string')
+ options = { filename: options };
+ assert.optionalObject(options, 'options');
+ if (options === undefined)
+ options = {};
+ assert.optionalString(options.filename, 'options.filename');
+ if (options.filename === undefined)
+ options.filename = '(unnamed)';
+
+ assert.object(formats[format], 'formats[format]');
+
+ try {
+ var k = formats[format].read(data, options);
+ if (k instanceof PrivateKey)
+ k = k.toPublic();
+ if (!k.comment)
+ k.comment = options.filename;
+ return (k);
+ } catch (e) {
+ if (e.name === 'KeyEncryptedError')
+ throw (e);
+ throw (new KeyParseError(options.filename, format, e));
+ }
+};
+
+Key.isKey = function (obj, ver) {
+ return (utils.isCompatible(obj, Key, ver));
+};
+
+/*
+ * API versions for Key:
+ * [1,0] -- initial ver, may take Signature for createVerify or may not
+ * [1,1] -- added pkcs1, pkcs8 formats
+ * [1,2] -- added auto, ssh-private, openssh formats
+ * [1,3] -- added defaultHashAlgorithm
+ * [1,4] -- added ed support, createDH
+ * [1,5] -- first explicitly tagged version
+ * [1,6] -- changed ed25519 part names
+ */
+Key.prototype._sshpkApiVersion = [1, 6];
+
+Key._oldVersionDetect = function (obj) {
+ assert.func(obj.toBuffer);
+ assert.func(obj.fingerprint);
+ if (obj.createDH)
+ return ([1, 4]);
+ if (obj.defaultHashAlgorithm)
+ return ([1, 3]);
+ if (obj.formats['auto'])
+ return ([1, 2]);
+ if (obj.formats['pkcs1'])
+ return ([1, 1]);
+ return ([1, 0]);
+};
+
+
+/***/ }),
+/* 27 */
+/***/ (function(module, exports) {
+
+module.exports = require("assert");
+
+/***/ }),
+/* 28 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = nullify;
+function nullify(obj = {}) {
+ if (Array.isArray(obj)) {
+ for (var _iterator = obj, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+ var _ref;
+
+ if (_isArray) {
+ if (_i >= _iterator.length) break;
+ _ref = _iterator[_i++];
+ } else {
+ _i = _iterator.next();
+ if (_i.done) break;
+ _ref = _i.value;
+ }
+
+ const item = _ref;
+
+ nullify(item);
+ }
+ } else if (obj !== null && typeof obj === 'object' || typeof obj === 'function') {
+ Object.setPrototypeOf(obj, null);
+
+ // for..in can only be applied to 'object', not 'function'
+ if (typeof obj === 'object') {
+ for (const key in obj) {
+ nullify(obj[key]);
+ }
+ }
+ }
+
+ return obj;
+}
+
+/***/ }),
+/* 29 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+const escapeStringRegexp = __webpack_require__(355);
+const ansiStyles = __webpack_require__(474);
+const stdoutColor = __webpack_require__(567).stdout;
+
+const template = __webpack_require__(568);
+
+const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');
+
+// `supportsColor.level` → `ansiStyles.color[name]` mapping
+const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
+
+// `color-convert` models to exclude from the Chalk API due to conflicts and such
+const skipModels = new Set(['gray']);
+
+const styles = Object.create(null);
+
+function applyOptions(obj, options) {
+ options = options || {};
+
+ // Detect level if not set manually
+ const scLevel = stdoutColor ? stdoutColor.level : 0;
+ obj.level = options.level === undefined ? scLevel : options.level;
+ obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
+}
+
+function Chalk(options) {
+ // We check for this.template here since calling `chalk.constructor()`
+ // by itself will have a `this` of a previously constructed chalk object
+ if (!this || !(this instanceof Chalk) || this.template) {
+ const chalk = {};
+ applyOptions(chalk, options);
+
+ chalk.template = function () {
+ const args = [].slice.call(arguments);
+ return chalkTag.apply(null, [chalk.template].concat(args));
+ };
+
+ Object.setPrototypeOf(chalk, Chalk.prototype);
+ Object.setPrototypeOf(chalk.template, chalk);
+
+ chalk.template.constructor = Chalk;
+
+ return chalk.template;
+ }
+
+ applyOptions(this, options);
+}
+
+// Use bright blue on Windows as the normal blue color is illegible
+if (isSimpleWindowsTerm) {
+ ansiStyles.blue.open = '\u001B[94m';
+}
+
+for (const key of Object.keys(ansiStyles)) {
+ ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
+
+ styles[key] = {
+ get() {
+ const codes = ansiStyles[key];
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
+ }
+ };
+}
+
+styles.visible = {
+ get() {
+ return build.call(this, this._styles || [], true, 'visible');
+ }
+};
+
+ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
+for (const model of Object.keys(ansiStyles.color.ansi)) {
+ if (skipModels.has(model)) {
+ continue;
+ }
+
+ styles[model] = {
+ get() {
+ const level = this.level;
+ return function () {
+ const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
+ const codes = {
+ open,
+ close: ansiStyles.color.close,
+ closeRe: ansiStyles.color.closeRe
+ };
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
+ };
+ }
+ };
+}
+
+ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
+for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
+ if (skipModels.has(model)) {
+ continue;
+ }
+
+ const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
+ styles[bgModel] = {
+ get() {
+ const level = this.level;
+ return function () {
+ const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
+ const codes = {
+ open,
+ close: ansiStyles.bgColor.close,
+ closeRe: ansiStyles.bgColor.closeRe
+ };
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
+ };
+ }
+ };
+}
+
+const proto = Object.defineProperties(() => {}, styles);
+
+function build(_styles, _empty, key) {
+ const builder = function () {
+ return applyStyle.apply(builder, arguments);
+ };
+
+ builder._styles = _styles;
+ builder._empty = _empty;
+
+ const self = this;
+
+ Object.defineProperty(builder, 'level', {
+ enumerable: true,
+ get() {
+ return self.level;
+ },
+ set(level) {
+ self.level = level;
+ }
+ });
+
+ Object.defineProperty(builder, 'enabled', {
+ enumerable: true,
+ get() {
+ return self.enabled;
+ },
+ set(enabled) {
+ self.enabled = enabled;
+ }
+ });
+
+ // See below for fix regarding invisible grey/dim combination on Windows
+ builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey';
+
+ // `__proto__` is used because we must return a function, but there is
+ // no way to create a function with a different prototype
+ builder.__proto__ = proto; // eslint-disable-line no-proto
+
+ return builder;
+}
+
+function applyStyle() {
+ // Support varags, but simply cast to string in case there's only one arg
+ const args = arguments;
+ const argsLen = args.length;
+ let str = String(arguments[0]);
+
+ if (argsLen === 0) {
+ return '';
+ }
+
+ if (argsLen > 1) {
+ // Don't slice `arguments`, it prevents V8 optimizations
+ for (let a = 1; a < argsLen; a++) {
+ str += ' ' + args[a];
+ }
+ }
+
+ if (!this.enabled || this.level <= 0 || !str) {
+ return this._empty ? '' : str;
+ }
+
+ // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
+ // see https://github.com/chalk/chalk/issues/58
+ // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
+ const originalDim = ansiStyles.dim.open;
+ if (isSimpleWindowsTerm && this.hasGrey) {
+ ansiStyles.dim.open = '';
+ }
+
+ for (const code of this._styles.slice().reverse()) {
+ // Replace any instances already present with a re-opening code
+ // otherwise only the part of the string until said closing code
+ // will be colored, and the rest will simply be 'plain'.
+ str = code.open + str.replace(code.closeRe, code.open) + code.close;
+
+ // Close the styling before a linebreak and reopen
+ // after next line to fix a bleed issue on macOS
+ // https://github.com/chalk/chalk/pull/92
+ str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
+ }
+
+ // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
+ ansiStyles.dim.open = originalDim;
+
+ return str;
+}
+
+function chalkTag(chalk, strings) {
+ if (!Array.isArray(strings)) {
+ // If chalk() was called by itself or with a string,
+ // return the string itself as a string.
+ return [].slice.call(arguments, 1).join(' ');
+ }
+
+ const args = [].slice.call(arguments, 2);
+ const parts = [strings.raw[0]];
+
+ for (let i = 1; i < strings.length; i++) {
+ parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
+ parts.push(String(strings.raw[i]));
+ }
+
+ return template(chalk, parts.join(''));
+}
+
+Object.defineProperties(Chalk.prototype, styles);
+
+module.exports = Chalk(); // eslint-disable-line new-cap
+module.exports.supportsColor = stdoutColor;
+module.exports.default = module.exports; // For TypeScript
+
+
+/***/ }),
+/* 30 */
+/***/ (function(module, exports) {
+
+var core = module.exports = { version: '2.5.7' };
+if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
+
+
+/***/ }),
+/* 31 */
+/***/ (function(module, exports, __webpack_require__) {
+
+// Copyright 2015 Joyent, Inc.
+
+var Buffer = __webpack_require__(14).Buffer;
+
+var algInfo = {
+ 'dsa': {
+ parts: ['p', 'q', 'g', 'y'],
+ sizePart: 'p'
+ },
+ 'rsa': {
+ parts: ['e', 'n'],
+ sizePart: 'n'
+ },
+ 'ecdsa': {
+ parts: ['curve', 'Q'],
+ sizePart: 'Q'
+ },
+ 'ed25519': {
+ parts: ['A'],
+ sizePart: 'A'
+ }
+};
+algInfo['curve25519'] = algInfo['ed25519'];
+
+var algPrivInfo = {
+ 'dsa': {
+ parts: ['p', 'q', 'g', 'y', 'x']
+ },
+ 'rsa': {
+ parts: ['n', 'e', 'd', 'iqmp', 'p', 'q']
+ },
+ 'ecdsa': {
+ parts: ['curve', 'Q', 'd']
+ },
+ 'ed25519': {
+ parts: ['A', 'k']
+ }
+};
+algPrivInfo['curve25519'] = algPrivInfo['ed25519'];
+
+var hashAlgs = {
+ 'md5': true,
+ 'sha1': true,
+ 'sha256': true,
+ 'sha384': true,
+ 'sha512': true
+};
+
+/*
+ * Taken from
+ * http://csrc.nist.gov/groups/ST/toolkit/documents/dss/NISTReCur.pdf
+ */
+var curves = {
+ 'nistp256': {
+ size: 256,
+ pkcs8oid: '1.2.840.10045.3.1.7',
+ p: Buffer.from(('00' +
+ 'ffffffff 00000001 00000000 00000000' +
+ '00000000 ffffffff ffffffff ffffffff').
+ replace(/ /g, ''), 'hex'),
+ a: Buffer.from(('00' +
+ 'FFFFFFFF 00000001 00000000 00000000' +
+ '00000000 FFFFFFFF FFFFFFFF FFFFFFFC').
+ replace(/ /g, ''), 'hex'),
+ b: Buffer.from((
+ '5ac635d8 aa3a93e7 b3ebbd55 769886bc' +
+ '651d06b0 cc53b0f6 3bce3c3e 27d2604b').
+ replace(/ /g, ''), 'hex'),
+ s: Buffer.from(('00' +
+ 'c49d3608 86e70493 6a6678e1 139d26b7' +
+ '819f7e90').
+ replace(/ /g, ''), 'hex'),
+ n: Buffer.from(('00' +
+ 'ffffffff 00000000 ffffffff ffffffff' +
+ 'bce6faad a7179e84 f3b9cac2 fc632551').
+ replace(/ /g, ''), 'hex'),
+ G: Buffer.from(('04' +
+ '6b17d1f2 e12c4247 f8bce6e5 63a440f2' +
+ '77037d81 2deb33a0 f4a13945 d898c296' +
+ '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16' +
+ '2bce3357 6b315ece cbb64068 37bf51f5').
+ replace(/ /g, ''), 'hex')
+ },
+ 'nistp384': {
+ size: 384,
+ pkcs8oid: '1.3.132.0.34',
+ p: Buffer.from(('00' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff ffffffff fffffffe' +
+ 'ffffffff 00000000 00000000 ffffffff').
+ replace(/ /g, ''), 'hex'),
+ a: Buffer.from(('00' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE' +
+ 'FFFFFFFF 00000000 00000000 FFFFFFFC').
+ replace(/ /g, ''), 'hex'),
+ b: Buffer.from((
+ 'b3312fa7 e23ee7e4 988e056b e3f82d19' +
+ '181d9c6e fe814112 0314088f 5013875a' +
+ 'c656398d 8a2ed19d 2a85c8ed d3ec2aef').
+ replace(/ /g, ''), 'hex'),
+ s: Buffer.from(('00' +
+ 'a335926a a319a27a 1d00896a 6773a482' +
+ '7acdac73').
+ replace(/ /g, ''), 'hex'),
+ n: Buffer.from(('00' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff c7634d81 f4372ddf' +
+ '581a0db2 48b0a77a ecec196a ccc52973').
+ replace(/ /g, ''), 'hex'),
+ G: Buffer.from(('04' +
+ 'aa87ca22 be8b0537 8eb1c71e f320ad74' +
+ '6e1d3b62 8ba79b98 59f741e0 82542a38' +
+ '5502f25d bf55296c 3a545e38 72760ab7' +
+ '3617de4a 96262c6f 5d9e98bf 9292dc29' +
+ 'f8f41dbd 289a147c e9da3113 b5f0b8c0' +
+ '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f').
+ replace(/ /g, ''), 'hex')
+ },
+ 'nistp521': {
+ size: 521,
+ pkcs8oid: '1.3.132.0.35',
+ p: Buffer.from((
+ '01ffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffff').replace(/ /g, ''), 'hex'),
+ a: Buffer.from(('01FF' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC').
+ replace(/ /g, ''), 'hex'),
+ b: Buffer.from(('51' +
+ '953eb961 8e1c9a1f 929a21a0 b68540ee' +
+ 'a2da725b 99b315f3 b8b48991 8ef109e1' +
+ '56193951 ec7e937b 1652c0bd 3bb1bf07' +
+ '3573df88 3d2c34f1 ef451fd4 6b503f00').
+ replace(/ /g, ''), 'hex'),
+ s: Buffer.from(('00' +
+ 'd09e8800 291cb853 96cc6717 393284aa' +
+ 'a0da64ba').replace(/ /g, ''), 'hex'),
+ n: Buffer.from(('01ff' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff ffffffff fffffffa' +
+ '51868783 bf2f966b 7fcc0148 f709a5d0' +
+ '3bb5c9b8 899c47ae bb6fb71e 91386409').
+ replace(/ /g, ''), 'hex'),
+ G: Buffer.from(('04' +
+ '00c6 858e06b7 0404e9cd 9e3ecb66 2395b442' +
+ '9c648139 053fb521 f828af60 6b4d3dba' +
+ 'a14b5e77 efe75928 fe1dc127 a2ffa8de' +
+ '3348b3c1 856a429b f97e7e31 c2e5bd66' +
+ '0118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9' +
+ '98f54449 579b4468 17afbd17 273e662c' +
+ '97ee7299 5ef42640 c550b901 3fad0761' +
+ '353c7086 a272c240 88be9476 9fd16650').
+ replace(/ /g, ''), 'hex')
+ }
+};
+
+module.exports = {
+ info: algInfo,
+ privInfo: algPrivInfo,
+ hashAlgs: hashAlgs,
+ curves: curves
+};
+
+
+/***/ }),
+/* 32 */
+/***/ (function(module, exports, __webpack_require__) {
+
+// Copyright 2017 Joyent, Inc.
+
+module.exports = PrivateKey;
+
+var assert = __webpack_require__(15);
+var Buffer = __webpack_require__(14).Buffer;
+var algs = __webpack_require__(31);
+var crypto = __webpack_require__(11);
+var Fingerprint = __webpack_require__(147);
+var Signature = __webpack_require__(67);
+var errs = __webpack_require__(66);
+var util = __webpack_require__(3);
+var utils = __webpack_require__(25);
+var dhe = __webpack_require__(292);
+var generateECDSA = dhe.generateECDSA;
+var generateED25519 = dhe.generateED25519;
+var edCompat;
+var nacl;
+
+try {
+ edCompat = __webpack_require__(422);
+} catch (e) {
+ /* Just continue through, and bail out if we try to use it. */
+}
+
+var Key = __webpack_require__(26);
+
+var InvalidAlgorithmError = errs.InvalidAlgorithmError;
+var KeyParseError = errs.KeyParseError;
+var KeyEncryptedError = errs.KeyEncryptedError;
+
+var formats = {};
+formats['auto'] = __webpack_require__(423);
+formats['pem'] = __webpack_require__(79);
+formats['pkcs1'] = __webpack_require__(294);
+formats['pkcs8'] = __webpack_require__(148);
+formats['rfc4253'] = __webpack_require__(96);
+formats['ssh-private'] = __webpack_require__(183);
+formats['openssh'] = formats['ssh-private'];
+formats['ssh'] = formats['ssh-private'];
+formats['dnssec'] = __webpack_require__(293);
+
+function PrivateKey(opts) {
+ assert.object(opts, 'options');
+ Key.call(this, opts);
+
+ this._pubCache = undefined;
+}
+util.inherits(PrivateKey, Key);
+
+PrivateKey.formats = formats;
+
+PrivateKey.prototype.toBuffer = function (format, options) {
+ if (format === undefined)
+ format = 'pkcs1';
+ assert.string(format, 'format');
+ assert.object(formats[format], 'formats[format]');
+ assert.optionalObject(options, 'options');
+
+ return (formats[format].write(this, options));
+};
+
+PrivateKey.prototype.hash = function (algo) {
+ return (this.toPublic().hash(algo));
+};
+
+PrivateKey.prototype.toPublic = function () {
+ if (this._pubCache)
+ return (this._pubCache);
+
+ var algInfo = algs.info[this.type];
+ var pubParts = [];
+ for (var i = 0; i < algInfo.parts.length; ++i) {
+ var p = algInfo.parts[i];
+ pubParts.push(this.part[p]);
+ }
+
+ this._pubCache = new Key({
+ type: this.type,
+ source: this,
+ parts: pubParts
+ });
+ if (this.comment)
+ this._pubCache.comment = this.comment;
+ return (this._pubCache);
+};
+
+PrivateKey.prototype.derive = function (newType) {
+ assert.string(newType, 'type');
+ var priv, pub, pair;
+
+ if (this.type === 'ed25519' && newType === 'curve25519') {
+ if (nacl === undefined)
+ nacl = __webpack_require__(68);
+
+ priv = this.part.k.data;
+ if (priv[0] === 0x00)
+ priv = priv.slice(1);
+
+ pair = nacl.box.keyPair.fromSecretKey(new Uint8Array(priv));
+ pub = Buffer.from(pair.publicKey);
+
+ return (new PrivateKey({
+ type: 'curve25519',
+ parts: [
+ { name: 'A', data: utils.mpNormalize(pub) },
+ { name: 'k', data: utils.mpNormalize(priv) }
+ ]
+ }));
+ } else if (this.type === 'curve25519' && newType === 'ed25519') {
+ if (nacl === undefined)
+ nacl = __webpack_require__(68);
+
+ priv = this.part.k.data;
+ if (priv[0] === 0x00)
+ priv = priv.slice(1);
+
+ pair = nacl.sign.keyPair.fromSeed(new Uint8Array(priv));
+ pub = Buffer.from(pair.publicKey);
+
+ return (new PrivateKey({
+ type: 'ed25519',
+ parts: [
+ { name: 'A', data: utils.mpNormalize(pub) },
+ { name: 'k', data: utils.mpNormalize(priv) }
+ ]
+ }));
+ }
+ throw (new Error('Key derivation not supported from ' + this.type +
+ ' to ' + newType));
+};
+
+PrivateKey.prototype.createVerify = function (hashAlgo) {
+ return (this.toPublic().createVerify(hashAlgo));
+};
+
+PrivateKey.prototype.createSign = function (hashAlgo) {
+ if (hashAlgo === undefined)
+ hashAlgo = this.defaultHashAlgorithm();
+ assert.string(hashAlgo, 'hash algorithm');
+
+ /* ED25519 is not supported by OpenSSL, use a javascript impl. */
+ if (this.type === 'ed25519' && edCompat !== undefined)
+ return (new edCompat.Signer(this, hashAlgo));
+ if (this.type === 'curve25519')
+ throw (new Error('Curve25519 keys are not suitable for ' +
+ 'signing or verification'));
+
+ var v, nm, err;
+ try {
+ nm = hashAlgo.toUpperCase();
+ v = crypto.createSign(nm);
+ } catch (e) {
+ err = e;
+ }
+ if (v === undefined || (err instanceof Error &&
+ err.message.match(/Unknown message digest/))) {
+ nm = 'RSA-';
+ nm += hashAlgo.toUpperCase();
+ v = crypto.createSign(nm);
+ }
+ assert.ok(v, 'failed to create verifier');
+ var oldSign = v.sign.bind(v);
+ var key = this.toBuffer('pkcs1');
+ var type = this.type;
+ var curve = this.curve;
+ v.sign = function () {
+ var sig = oldSign(key);
+ if (typeof (sig) === 'string')
+ sig = Buffer.from(sig, 'binary');
+ sig = Signature.parse(sig, type, 'asn1');
+ sig.hashAlgorithm = hashAlgo;
+ sig.curve = curve;
+ return (sig);
+ };
+ return (v);
+};
+
+PrivateKey.parse = function (data, format, options) {
+ if (typeof (data) !== 'string')
+ assert.buffer(data, 'data');
+ if (format === undefined)
+ format = 'auto';
+ assert.string(format, 'format');
+ if (typeof (options) === 'string')
+ options = { filename: options };
+ assert.optionalObject(options, 'options');
+ if (options === undefined)
+ options = {};
+ assert.optionalString(options.filename, 'options.filename');
+ if (options.filename === undefined)
+ options.filename = '(unnamed)';
+
+ assert.object(formats[format], 'formats[format]');
+
+ try {
+ var k = formats[format].read(data, options);
+ assert.ok(k instanceof PrivateKey, 'key is not a private key');
+ if (!k.comment)
+ k.comment = options.filename;
+ return (k);
+ } catch (e) {
+ if (e.name === 'KeyEncryptedError')
+ throw (e);
+ throw (new KeyParseError(options.filename, format, e));
+ }
+};
+
+PrivateKey.isPrivateKey = function (obj, ver) {
+ return (utils.isCompatible(obj, PrivateKey, ver));
+};
+
+PrivateKey.generate = function (type, options) {
+ if (options === undefined)
+ options = {};
+ assert.object(options, 'options');
+
+ switch (type) {
+ case 'ecdsa':
+ if (options.curve === undefined)
+ options.curve = 'nistp256';
+ assert.string(options.curve, 'options.curve');
+ return (generateECDSA(options.curve));
+ case 'ed25519':
+ return (generateED25519());
+ default:
+ throw (new Error('Key generation not supported with key ' +
+ 'type "' + type + '"'));
+ }
+};
+
+/*
+ * API versions for PrivateKey:
+ * [1,0] -- initial ver
+ * [1,1] -- added auto, pkcs[18], openssh/ssh-private formats
+ * [1,2] -- added defaultHashAlgorithm
+ * [1,3] -- added derive, ed, createDH
+ * [1,4] -- first tagged version
+ * [1,5] -- changed ed25519 part names and format
+ */
+PrivateKey.prototype._sshpkApiVersion = [1, 5];
+
+PrivateKey._oldVersionDetect = function (obj) {
+ assert.func(obj.toPublic);
+ assert.func(obj.createSign);
+ if (obj.derive)
+ return ([1, 3]);
+ if (obj.defaultHashAlgorithm)
+ return ([1, 2]);
+ if (obj.formats['auto'])
+ return ([1, 1]);
+ return ([1, 0]);
+};
+
+
+/***/ }),
+/* 33 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.wrapLifecycle = exports.run = exports.install = exports.Install = undefined;
+
+var _extends2;
+
+function _load_extends() {
+ return _extends2 = _interopRequireDefault(__webpack_require__(21));
+}
+
+var _asyncToGenerator2;
+
+function _load_asyncToGenerator() {
+ return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2));
+}
+
+let install = exports.install = (() => {
+ var _ref29 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, lockfile) {
+ yield wrapLifecycle(config, flags, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ const install = new Install(flags, config, reporter, lockfile);
+ yield install.init();
+ }));
+ });
+
+ return function install(_x7, _x8, _x9, _x10) {
+ return _ref29.apply(this, arguments);
+ };
+})();
+
+let run = exports.run = (() => {
+ var _ref31 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) {
+ let lockfile;
+ let error = 'installCommandRenamed';
+ if (flags.lockfile === false) {
+ lockfile = new (_lockfile || _load_lockfile()).default();
+ } else {
+ lockfile = yield (_lockfile || _load_lockfile()).default.fromDirectory(config.lockfileFolder, reporter);
+ }
+
+ if (args.length) {
+ const exampleArgs = args.slice();
+
+ if (flags.saveDev) {
+ exampleArgs.push('--dev');
+ }
+ if (flags.savePeer) {
+ exampleArgs.push('--peer');
+ }
+ if (flags.saveOptional) {
+ exampleArgs.push('--optional');
+ }
+ if (flags.saveExact) {
+ exampleArgs.push('--exact');
+ }
+ if (flags.saveTilde) {
+ exampleArgs.push('--tilde');
+ }
+ let command = 'add';
+ if (flags.global) {
+ error = 'globalFlagRemoved';
+ command = 'global add';
+ }
+ throw new (_errors || _load_errors()).MessageError(reporter.lang(error, `yarn ${command} ${exampleArgs.join(' ')}`));
+ }
+
+ yield install(config, reporter, flags, lockfile);
+ });
+
+ return function run(_x11, _x12, _x13, _x14) {
+ return _ref31.apply(this, arguments);
+ };
+})();
+
+let wrapLifecycle = exports.wrapLifecycle = (() => {
+ var _ref32 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, flags, factory) {
+ yield config.executeLifecycleScript('preinstall');
+
+ yield factory();
+
+ // npm behaviour, seems kinda funky but yay compatibility
+ yield config.executeLifecycleScript('install');
+ yield config.executeLifecycleScript('postinstall');
+
+ if (!config.production) {
+ if (!config.disablePrepublish) {
+ yield config.executeLifecycleScript('prepublish');
+ }
+ yield config.executeLifecycleScript('prepare');
+ }
+ });
+
+ return function wrapLifecycle(_x15, _x16, _x17) {
+ return _ref32.apply(this, arguments);
+ };
+})();
+
+exports.hasWrapper = hasWrapper;
+exports.setFlags = setFlags;
+
+var _hooks;
+
+function _load_hooks() {
+ return _hooks = __webpack_require__(550);
+}
+
+var _index;
+
+function _load_index() {
+ return _index = _interopRequireDefault(__webpack_require__(210));
+}
+
+var _errors;
+
+function _load_errors() {
+ return _errors = __webpack_require__(5);
+}
+
+var _integrityChecker;
+
+function _load_integrityChecker() {
+ return _integrityChecker = _interopRequireDefault(__webpack_require__(199));
+}
+
+var _lockfile;
+
+function _load_lockfile() {
+ return _lockfile = _interopRequireDefault(__webpack_require__(18));
+}
+
+var _lockfile2;
+
+function _load_lockfile2() {
+ return _lockfile2 = __webpack_require__(18);
+}
+
+var _packageFetcher;
+
+function _load_packageFetcher() {
+ return _packageFetcher = _interopRequireWildcard(__webpack_require__(200));
+}
+
+var _packageInstallScripts;
+
+function _load_packageInstallScripts() {
+ return _packageInstallScripts = _interopRequireDefault(__webpack_require__(525));
+}
+
+var _packageCompatibility;
+
+function _load_packageCompatibility() {
+ return _packageCompatibility = _interopRequireWildcard(__webpack_require__(332));
+}
+
+var _packageResolver;
+
+function _load_packageResolver() {
+ return _packageResolver = _interopRequireDefault(__webpack_require__(334));
+}
+
+var _packageLinker;
+
+function _load_packageLinker() {
+ return _packageLinker = _interopRequireDefault(__webpack_require__(201));
+}
+
+var _index2;
+
+function _load_index2() {
+ return _index2 = __webpack_require__(52);
+}
+
+var _index3;
+
+function _load_index3() {
+ return _index3 = __webpack_require__(71);
+}
+
+var _autoclean;
+
+function _load_autoclean() {
+ return _autoclean = __webpack_require__(321);
+}
+
+var _constants;
+
+function _load_constants() {
+ return _constants = _interopRequireWildcard(__webpack_require__(9));
+}
+
+var _normalizePattern;
+
+function _load_normalizePattern() {
+ return _normalizePattern = __webpack_require__(36);
+}
+
+var _fs;
+
+function _load_fs() {
+ return _fs = _interopRequireWildcard(__webpack_require__(6));
+}
+
+var _map;
+
+function _load_map() {
+ return _map = _interopRequireDefault(__webpack_require__(28));
+}
+
+var _yarnVersion;
+
+function _load_yarnVersion() {
+ return _yarnVersion = __webpack_require__(112);
+}
+
+var _generatePnpMap;
+
+function _load_generatePnpMap() {
+ return _generatePnpMap = __webpack_require__(547);
+}
+
+var _workspaceLayout;
+
+function _load_workspaceLayout() {
+ return _workspaceLayout = _interopRequireDefault(__webpack_require__(84));
+}
+
+var _resolutionMap;
+
+function _load_resolutionMap() {
+ return _resolutionMap = _interopRequireDefault(__webpack_require__(204));
+}
+
+var _guessName;
+
+function _load_guessName() {
+ return _guessName = _interopRequireDefault(__webpack_require__(160));
+}
+
+var _audit;
+
+function _load_audit() {
+ return _audit = _interopRequireDefault(__webpack_require__(320));
+}
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const deepEqual = __webpack_require__(600);
+
+const emoji = __webpack_require__(270);
+const invariant = __webpack_require__(8);
+const path = __webpack_require__(0);
+const semver = __webpack_require__(20);
+const uuid = __webpack_require__(111);
+const ssri = __webpack_require__(70);
+
+const ONE_DAY = 1000 * 60 * 60 * 24;
+
+/**
+ * Try and detect the installation method for Yarn and provide a command to update it with.
+ */
+
+function getUpdateCommand(installationMethod) {
+ if (installationMethod === 'tar') {
+ return `curl --compressed -o- -L ${(_constants || _load_constants()).YARN_INSTALLER_SH} | bash`;
+ }
+
+ if (installationMethod === 'homebrew') {
+ return 'brew upgrade yarn';
+ }
+
+ if (installationMethod === 'deb') {
+ return 'sudo apt-get update && sudo apt-get install yarn';
+ }
+
+ if (installationMethod === 'rpm') {
+ return 'sudo yum install yarn';
+ }
+
+ if (installationMethod === 'npm') {
+ return 'npm install --global yarn';
+ }
+
+ if (installationMethod === 'chocolatey') {
+ return 'choco upgrade yarn';
+ }
+
+ if (installationMethod === 'apk') {
+ return 'apk update && apk add -u yarn';
+ }
+
+ return null;
+}
+
+function getUpdateInstaller(installationMethod) {
+ // Windows
+ if (installationMethod === 'msi') {
+ return (_constants || _load_constants()).YARN_INSTALLER_MSI;
+ }
+
+ return null;
+}
+
+function normalizeFlags(config, rawFlags) {
+ const flags = {
+ // install
+ har: !!rawFlags.har,
+ ignorePlatform: !!rawFlags.ignorePlatform,
+ ignoreEngines: !!rawFlags.ignoreEngines,
+ ignoreScripts: !!rawFlags.ignoreScripts,
+ ignoreOptional: !!rawFlags.ignoreOptional,
+ force: !!rawFlags.force,
+ flat: !!rawFlags.flat,
+ lockfile: rawFlags.lockfile !== false,
+ pureLockfile: !!rawFlags.pureLockfile,
+ updateChecksums: !!rawFlags.updateChecksums,
+ skipIntegrityCheck: !!rawFlags.skipIntegrityCheck,
+ frozenLockfile: !!rawFlags.frozenLockfile,
+ linkDuplicates: !!rawFlags.linkDuplicates,
+ checkFiles: !!rawFlags.checkFiles,
+ audit: !!rawFlags.audit,
+
+ // add
+ peer: !!rawFlags.peer,
+ dev: !!rawFlags.dev,
+ optional: !!rawFlags.optional,
+ exact: !!rawFlags.exact,
+ tilde: !!rawFlags.tilde,
+ ignoreWorkspaceRootCheck: !!rawFlags.ignoreWorkspaceRootCheck,
+
+ // outdated, update-interactive
+ includeWorkspaceDeps: !!rawFlags.includeWorkspaceDeps,
+
+ // add, remove, update
+ workspaceRootIsCwd: rawFlags.workspaceRootIsCwd !== false
+ };
+
+ if (config.getOption('ignore-scripts')) {
+ flags.ignoreScripts = true;
+ }
+
+ if (config.getOption('ignore-platform')) {
+ flags.ignorePlatform = true;
+ }
+
+ if (config.getOption('ignore-engines')) {
+ flags.ignoreEngines = true;
+ }
+
+ if (config.getOption('ignore-optional')) {
+ flags.ignoreOptional = true;
+ }
+
+ if (config.getOption('force')) {
+ flags.force = true;
+ }
+
+ return flags;
+}
+
+class Install {
+ constructor(flags, config, reporter, lockfile) {
+ this.rootManifestRegistries = [];
+ this.rootPatternsToOrigin = (0, (_map || _load_map()).default)();
+ this.lockfile = lockfile;
+ this.reporter = reporter;
+ this.config = config;
+ this.flags = normalizeFlags(config, flags);
+ this.resolutions = (0, (_map || _load_map()).default)(); // Legacy resolutions field used for flat install mode
+ this.resolutionMap = new (_resolutionMap || _load_resolutionMap()).default(config); // Selective resolutions for nested dependencies
+ this.resolver = new (_packageResolver || _load_packageResolver()).default(config, lockfile, this.resolutionMap);
+ this.integrityChecker = new (_integrityChecker || _load_integrityChecker()).default(config);
+ this.linker = new (_packageLinker || _load_packageLinker()).default(config, this.resolver);
+ this.scripts = new (_packageInstallScripts || _load_packageInstallScripts()).default(config, this.resolver, this.flags.force);
+ }
+
+ /**
+ * Create a list of dependency requests from the current directories manifests.
+ */
+
+ fetchRequestFromCwd(excludePatterns = [], ignoreUnusedPatterns = false) {
+ var _this = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ const patterns = [];
+ const deps = [];
+ let resolutionDeps = [];
+ const manifest = {};
+
+ const ignorePatterns = [];
+ const usedPatterns = [];
+ let workspaceLayout;
+
+ // some commands should always run in the context of the entire workspace
+ const cwd = _this.flags.includeWorkspaceDeps || _this.flags.workspaceRootIsCwd ? _this.config.lockfileFolder : _this.config.cwd;
+
+ // non-workspaces are always root, otherwise check for workspace root
+ const cwdIsRoot = !_this.config.workspaceRootFolder || _this.config.lockfileFolder === cwd;
+
+ // exclude package names that are in install args
+ const excludeNames = [];
+ for (var _iterator = excludePatterns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+ var _ref;
+
+ if (_isArray) {
+ if (_i >= _iterator.length) break;
+ _ref = _iterator[_i++];
+ } else {
+ _i = _iterator.next();
+ if (_i.done) break;
+ _ref = _i.value;
+ }
+
+ const pattern = _ref;
+
+ if ((0, (_index3 || _load_index3()).getExoticResolver)(pattern)) {
+ excludeNames.push((0, (_guessName || _load_guessName()).default)(pattern));
+ } else {
+ // extract the name
+ const parts = (0, (_normalizePattern || _load_normalizePattern()).normalizePattern)(pattern);
+ excludeNames.push(parts.name);
+ }
+ }
+
+ const stripExcluded = function stripExcluded(manifest) {
+ for (var _iterator2 = excludeNames, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
+ var _ref2;
+
+ if (_isArray2) {
+ if (_i2 >= _iterator2.length) break;
+ _ref2 = _iterator2[_i2++];
+ } else {
+ _i2 = _iterator2.next();
+ if (_i2.done) break;
+ _ref2 = _i2.value;
+ }
+
+ const exclude = _ref2;
+
+ if (manifest.dependencies && manifest.dependencies[exclude]) {
+ delete manifest.dependencies[exclude];
+ }
+ if (manifest.devDependencies && manifest.devDependencies[exclude]) {
+ delete manifest.devDependencies[exclude];
+ }
+ if (manifest.optionalDependencies && manifest.optionalDependencies[exclude]) {
+ delete manifest.optionalDependencies[exclude];
+ }
+ }
+ };
+
+ for (var _iterator3 = Object.keys((_index2 || _load_index2()).registries), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
+ var _ref3;
+
+ if (_isArray3) {
+ if (_i3 >= _iterator3.length) break;
+ _ref3 = _iterator3[_i3++];
+ } else {
+ _i3 = _iterator3.next();
+ if (_i3.done) break;
+ _ref3 = _i3.value;
+ }
+
+ const registry = _ref3;
+
+ const filename = (_index2 || _load_index2()).registries[registry].filename;
+
+ const loc = path.join(cwd, filename);
+ if (!(yield (_fs || _load_fs()).exists(loc))) {
+ continue;
+ }
+
+ _this.rootManifestRegistries.push(registry);
+
+ const projectManifestJson = yield _this.config.readJson(loc);
+ yield (0, (_index || _load_index()).default)(projectManifestJson, cwd, _this.config, cwdIsRoot);
+
+ Object.assign(_this.resolutions, projectManifestJson.resolutions);
+ Object.assign(manifest, projectManifestJson);
+
+ _this.resolutionMap.init(_this.resolutions);
+ for (var _iterator4 = Object.keys(_this.resolutionMap.resolutionsByPackage), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
+ var _ref4;
+
+ if (_isArray4) {
+ if (_i4 >= _iterator4.length) break;
+ _ref4 = _iterator4[_i4++];
+ } else {
+ _i4 = _iterator4.next();
+ if (_i4.done) break;
+ _ref4 = _i4.value;
+ }
+
+ const packageName = _ref4;
+
+ for (var _iterator8 = _this.resolutionMap.resolutionsByPackage[packageName], _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) {
+ var _ref9;
+
+ if (_isArray8) {
+ if (_i8 >= _iterator8.length) break;
+ _ref9 = _iterator8[_i8++];
+ } else {
+ _i8 = _iterator8.next();
+ if (_i8.done) break;
+ _ref9 = _i8.value;
+ }
+
+ const _ref8 = _ref9;
+ const pattern = _ref8.pattern;
+
+ resolutionDeps = [...resolutionDeps, { registry, pattern, optional: false, hint: 'resolution' }];
+ }
+ }
+
+ const pushDeps = function pushDeps(depType, manifest, { hint, optional }, isUsed) {
+ if (ignoreUnusedPatterns && !isUsed) {
+ return;
+ }
+ // We only take unused dependencies into consideration to get deterministic hoisting.
+ // Since flat mode doesn't care about hoisting and everything is top level and specified then we can safely
+ // leave these out.
+ if (_this.flags.flat && !isUsed) {
+ return;
+ }
+ const depMap = manifest[depType];
+ for (const name in depMap) {
+ if (excludeNames.indexOf(name) >= 0) {
+ continue;
+ }
+
+ let pattern = name;
+ if (!_this.lockfile.getLocked(pattern)) {
+ // when we use --save we save the dependency to the lockfile with just the name rather than the
+ // version combo
+ pattern += '@' + depMap[name];
+ }
+
+ // normalization made sure packages are mentioned only once
+ if (isUsed) {
+ usedPatterns.push(pattern);
+ } else {
+ ignorePatterns.push(pattern);
+ }
+
+ _this.rootPatternsToOrigin[pattern] = depType;
+ patterns.push(pattern);
+ deps.push({ pattern, registry, hint, optional, workspaceName: manifest.name, workspaceLoc: manifest._loc });
+ }
+ };
+
+ if (cwdIsRoot) {
+ pushDeps('dependencies', projectManifestJson, { hint: null, optional: false }, true);
+ pushDeps('devDependencies', projectManifestJson, { hint: 'dev', optional: false }, !_this.config.production);
+ pushDeps('optionalDependencies', projectManifestJson, { hint: 'optional', optional: true }, true);
+ }
+
+ if (_this.config.workspaceRootFolder) {
+ const workspaceLoc = cwdIsRoot ? loc : path.join(_this.config.lockfileFolder, filename);
+ const workspacesRoot = path.dirname(workspaceLoc);
+
+ let workspaceManifestJson = projectManifestJson;
+ if (!cwdIsRoot) {
+ // the manifest we read before was a child workspace, so get the root
+ workspaceManifestJson = yield _this.config.readJson(workspaceLoc);
+ yield (0, (_index || _load_index()).default)(workspaceManifestJson, workspacesRoot, _this.config, true);
+ }
+
+ const workspaces = yield _this.config.resolveWorkspaces(workspacesRoot, workspaceManifestJson);
+ workspaceLayout = new (_workspaceLayout || _load_workspaceLayout()).default(workspaces, _this.config);
+
+ // add virtual manifest that depends on all workspaces, this way package hoisters and resolvers will work fine
+ const workspaceDependencies = (0, (_extends2 || _load_extends()).default)({}, workspaceManifestJson.dependencies);
+ for (var _iterator5 = Object.keys(workspaces), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
+ var _ref5;
+
+ if (_isArray5) {
+ if (_i5 >= _iterator5.length) break;
+ _ref5 = _iterator5[_i5++];
+ } else {
+ _i5 = _iterator5.next();
+ if (_i5.done) break;
+ _ref5 = _i5.value;
+ }
+
+ const workspaceName = _ref5;
+
+ const workspaceManifest = workspaces[workspaceName].manifest;
+ workspaceDependencies[workspaceName] = workspaceManifest.version;
+
+ // include dependencies from all workspaces
+ if (_this.flags.includeWorkspaceDeps) {
+ pushDeps('dependencies', workspaceManifest, { hint: null, optional: false }, true);
+ pushDeps('devDependencies', workspaceManifest, { hint: 'dev', optional: false }, !_this.config.production);
+ pushDeps('optionalDependencies', workspaceManifest, { hint: 'optional', optional: true }, true);
+ }
+ }
+ const virtualDependencyManifest = {
+ _uid: '',
+ name: `workspace-aggregator-${uuid.v4()}`,
+ version: '1.0.0',
+ _registry: 'npm',
+ _loc: workspacesRoot,
+ dependencies: workspaceDependencies,
+ devDependencies: (0, (_extends2 || _load_extends()).default)({}, workspaceManifestJson.devDependencies),
+ optionalDependencies: (0, (_extends2 || _load_extends()).default)({}, workspaceManifestJson.optionalDependencies),
+ private: workspaceManifestJson.private,
+ workspaces: workspaceManifestJson.workspaces
+ };
+ workspaceLayout.virtualManifestName = virtualDependencyManifest.name;
+ const virtualDep = {};
+ virtualDep[virtualDependencyManifest.name] = virtualDependencyManifest.version;
+ workspaces[virtualDependencyManifest.name] = { loc: workspacesRoot, manifest: virtualDependencyManifest };
+
+ // ensure dependencies that should be excluded are stripped from the correct manifest
+ stripExcluded(cwdIsRoot ? virtualDependencyManifest : workspaces[projectManifestJson.name].manifest);
+
+ pushDeps('workspaces', { workspaces: virtualDep }, { hint: 'workspaces', optional: false }, true);
+
+ const implicitWorkspaceDependencies = (0, (_extends2 || _load_extends()).default)({}, workspaceDependencies);
+
+ for (var _iterator6 = (_constants || _load_constants()).OWNED_DEPENDENCY_TYPES, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
+ var _ref6;
+
+ if (_isArray6) {
+ if (_i6 >= _iterator6.length) break;
+ _ref6 = _iterator6[_i6++];
+ } else {
+ _i6 = _iterator6.next();
+ if (_i6.done) break;
+ _ref6 = _i6.value;
+ }
+
+ const type = _ref6;
+
+ for (var _iterator7 = Object.keys(projectManifestJson[type] || {}), _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
+ var _ref7;
+
+ if (_isArray7) {
+ if (_i7 >= _iterator7.length) break;
+ _ref7 = _iterator7[_i7++];
+ } else {
+ _i7 = _iterator7.next();
+ if (_i7.done) break;
+ _ref7 = _i7.value;
+ }
+
+ const dependencyName = _ref7;
+
+ delete implicitWorkspaceDependencies[dependencyName];
+ }
+ }
+
+ pushDeps('dependencies', { dependencies: implicitWorkspaceDependencies }, { hint: 'workspaces', optional: false }, true);
+ }
+
+ break;
+ }
+
+ // inherit root flat flag
+ if (manifest.flat) {
+ _this.flags.flat = true;
+ }
+
+ return {
+ requests: [...resolutionDeps, ...deps],
+ patterns,
+ manifest,
+ usedPatterns,
+ ignorePatterns,
+ workspaceLayout
+ };
+ })();
+ }
+
+ /**
+ * TODO description
+ */
+
+ prepareRequests(requests) {
+ return requests;
+ }
+
+ preparePatterns(patterns) {
+ return patterns;
+ }
+ preparePatternsForLinking(patterns, cwdManifest, cwdIsRoot) {
+ return patterns;
+ }
+
+ prepareManifests() {
+ var _this2 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ const manifests = yield _this2.config.getRootManifests();
+ return manifests;
+ })();
+ }
+
+ bailout(patterns, workspaceLayout) {
+ var _this3 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ // We don't want to skip the audit - it could yield important errors
+ if (_this3.flags.audit) {
+ return false;
+ }
+ // PNP is so fast that the integrity check isn't pertinent
+ if (_this3.config.plugnplayEnabled) {
+ return false;
+ }
+ if (_this3.flags.skipIntegrityCheck || _this3.flags.force) {
+ return false;
+ }
+ const lockfileCache = _this3.lockfile.cache;
+ if (!lockfileCache) {
+ return false;
+ }
+ const lockfileClean = _this3.lockfile.parseResultType === 'success';
+ const match = yield _this3.integrityChecker.check(patterns, lockfileCache, _this3.flags, workspaceLayout);
+ if (_this3.flags.frozenLockfile && (!lockfileClean || match.missingPatterns.length > 0)) {
+ throw new (_errors || _load_errors()).MessageError(_this3.reporter.lang('frozenLockfileError'));
+ }
+
+ const haveLockfile = yield (_fs || _load_fs()).exists(path.join(_this3.config.lockfileFolder, (_constants || _load_constants()).LOCKFILE_FILENAME));
+
+ const lockfileIntegrityPresent = !_this3.lockfile.hasEntriesExistWithoutIntegrity();
+ const integrityBailout = lockfileIntegrityPresent || !_this3.config.autoAddIntegrity;
+
+ if (match.integrityMatches && haveLockfile && lockfileClean && integrityBailout) {
+ _this3.reporter.success(_this3.reporter.lang('upToDate'));
+ return true;
+ }
+
+ if (match.integrityFileMissing && haveLockfile) {
+ // Integrity file missing, force script installations
+ _this3.scripts.setForce(true);
+ return false;
+ }
+
+ if (match.hardRefreshRequired) {
+ // e.g. node version doesn't match, force script installations
+ _this3.scripts.setForce(true);
+ return false;
+ }
+
+ if (!patterns.length && !match.integrityFileMissing) {
+ _this3.reporter.success(_this3.reporter.lang('nothingToInstall'));
+ yield _this3.createEmptyManifestFolders();
+ yield _this3.saveLockfileAndIntegrity(patterns, workspaceLayout);
+ return true;
+ }
+
+ return false;
+ })();
+ }
+
+ /**
+ * Produce empty folders for all used root manifests.
+ */
+
+ createEmptyManifestFolders() {
+ var _this4 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ if (_this4.config.modulesFolder) {
+ // already created
+ return;
+ }
+
+ for (var _iterator9 = _this4.rootManifestRegistries, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) {
+ var _ref10;
+
+ if (_isArray9) {
+ if (_i9 >= _iterator9.length) break;
+ _ref10 = _iterator9[_i9++];
+ } else {
+ _i9 = _iterator9.next();
+ if (_i9.done) break;
+ _ref10 = _i9.value;
+ }
+
+ const registryName = _ref10;
+ const folder = _this4.config.registries[registryName].folder;
+
+ yield (_fs || _load_fs()).mkdirp(path.join(_this4.config.lockfileFolder, folder));
+ }
+ })();
+ }
+
+ /**
+ * TODO description
+ */
+
+ markIgnored(patterns) {
+ for (var _iterator10 = patterns, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) {
+ var _ref11;
+
+ if (_isArray10) {
+ if (_i10 >= _iterator10.length) break;
+ _ref11 = _iterator10[_i10++];
+ } else {
+ _i10 = _iterator10.next();
+ if (_i10.done) break;
+ _ref11 = _i10.value;
+ }
+
+ const pattern = _ref11;
+
+ const manifest = this.resolver.getStrictResolvedPattern(pattern);
+ const ref = manifest._reference;
+ invariant(ref, 'expected package reference');
+
+ // just mark the package as ignored. if the package is used by a required package, the hoister
+ // will take care of that.
+ ref.ignore = true;
+ }
+ }
+
+ /**
+ * helper method that gets only recent manifests
+ * used by global.ls command
+ */
+ getFlattenedDeps() {
+ var _this5 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ var _ref12 = yield _this5.fetchRequestFromCwd();
+
+ const depRequests = _ref12.requests,
+ rawPatterns = _ref12.patterns;
+
+
+ yield _this5.resolver.init(depRequests, {});
+
+ const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this5.resolver.getManifests(), _this5.config);
+ _this5.resolver.updateManifests(manifests);
+
+ return _this5.flatten(rawPatterns);
+ })();
+ }
+
+ /**
+ * TODO description
+ */
+
+ init() {
+ var _this6 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ _this6.checkUpdate();
+
+ // warn if we have a shrinkwrap
+ if (yield (_fs || _load_fs()).exists(path.join(_this6.config.lockfileFolder, (_constants || _load_constants()).NPM_SHRINKWRAP_FILENAME))) {
+ _this6.reporter.warn(_this6.reporter.lang('shrinkwrapWarning'));
+ }
+
+ // warn if we have an npm lockfile
+ if (yield (_fs || _load_fs()).exists(path.join(_this6.config.lockfileFolder, (_constants || _load_constants()).NPM_LOCK_FILENAME))) {
+ _this6.reporter.warn(_this6.reporter.lang('npmLockfileWarning'));
+ }
+
+ let flattenedTopLevelPatterns = [];
+ const steps = [];
+
+ var _ref13 = yield _this6.fetchRequestFromCwd();
+
+ const depRequests = _ref13.requests,
+ rawPatterns = _ref13.patterns,
+ ignorePatterns = _ref13.ignorePatterns,
+ workspaceLayout = _ref13.workspaceLayout,
+ manifest = _ref13.manifest;
+
+ let topLevelPatterns = [];
+
+ const artifacts = yield _this6.integrityChecker.getArtifacts();
+ if (artifacts) {
+ _this6.linker.setArtifacts(artifacts);
+ _this6.scripts.setArtifacts(artifacts);
+ }
+
+ if ((_packageCompatibility || _load_packageCompatibility()).shouldCheck(manifest, _this6.flags)) {
+ steps.push((() => {
+ var _ref14 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) {
+ _this6.reporter.step(curr, total, _this6.reporter.lang('checkingManifest'), emoji.get('mag'));
+ yield _this6.checkCompatibility();
+ });
+
+ return function (_x, _x2) {
+ return _ref14.apply(this, arguments);
+ };
+ })());
+ }
+
+ const audit = new (_audit || _load_audit()).default(_this6.config, _this6.reporter);
+ let auditFoundProblems = false;
+
+ steps.push(function (curr, total) {
+ return (0, (_hooks || _load_hooks()).callThroughHook)('resolveStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ _this6.reporter.step(curr, total, _this6.reporter.lang('resolvingPackages'), emoji.get('mag'));
+ yield _this6.resolver.init(_this6.prepareRequests(depRequests), {
+ isFlat: _this6.flags.flat,
+ isFrozen: _this6.flags.frozenLockfile,
+ workspaceLayout
+ });
+ topLevelPatterns = _this6.preparePatterns(rawPatterns);
+ flattenedTopLevelPatterns = yield _this6.flatten(topLevelPatterns);
+ return { bailout: !_this6.flags.audit && (yield _this6.bailout(topLevelPatterns, workspaceLayout)) };
+ }));
+ });
+
+ if (_this6.flags.audit) {
+ steps.push(function (curr, total) {
+ return (0, (_hooks || _load_hooks()).callThroughHook)('auditStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ _this6.reporter.step(curr, total, _this6.reporter.lang('auditRunning'), emoji.get('mag'));
+ if (_this6.flags.offline) {
+ _this6.reporter.warn(_this6.reporter.lang('auditOffline'));
+ return { bailout: false };
+ }
+ const preparedManifests = yield _this6.prepareManifests();
+ // $FlowFixMe - Flow considers `m` in the map operation to be "mixed", so does not recognize `m.object`
+ const mergedManifest = Object.assign({}, ...Object.values(preparedManifests).map(function (m) {
+ return m.object;
+ }));
+ const auditVulnerabilityCounts = yield audit.performAudit(mergedManifest, _this6.lockfile, _this6.resolver, _this6.linker, topLevelPatterns);
+ auditFoundProblems = auditVulnerabilityCounts.info || auditVulnerabilityCounts.low || auditVulnerabilityCounts.moderate || auditVulnerabilityCounts.high || auditVulnerabilityCounts.critical;
+ return { bailout: yield _this6.bailout(topLevelPatterns, workspaceLayout) };
+ }));
+ });
+ }
+
+ steps.push(function (curr, total) {
+ return (0, (_hooks || _load_hooks()).callThroughHook)('fetchStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ _this6.markIgnored(ignorePatterns);
+ _this6.reporter.step(curr, total, _this6.reporter.lang('fetchingPackages'), emoji.get('truck'));
+ const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this6.resolver.getManifests(), _this6.config);
+ _this6.resolver.updateManifests(manifests);
+ yield (_packageCompatibility || _load_packageCompatibility()).check(_this6.resolver.getManifests(), _this6.config, _this6.flags.ignoreEngines);
+ }));
+ });
+
+ steps.push(function (curr, total) {
+ return (0, (_hooks || _load_hooks()).callThroughHook)('linkStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ // remove integrity hash to make this operation atomic
+ yield _this6.integrityChecker.removeIntegrityFile();
+ _this6.reporter.step(curr, total, _this6.reporter.lang('linkingDependencies'), emoji.get('link'));
+ flattenedTopLevelPatterns = _this6.preparePatternsForLinking(flattenedTopLevelPatterns, manifest, _this6.config.lockfileFolder === _this6.config.cwd);
+ yield _this6.linker.init(flattenedTopLevelPatterns, workspaceLayout, {
+ linkDuplicates: _this6.flags.linkDuplicates,
+ ignoreOptional: _this6.flags.ignoreOptional
+ });
+ }));
+ });
+
+ if (_this6.config.plugnplayEnabled) {
+ steps.push(function (curr, total) {
+ return (0, (_hooks || _load_hooks()).callThroughHook)('pnpStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ const pnpPath = `${_this6.config.lockfileFolder}/${(_constants || _load_constants()).PNP_FILENAME}`;
+
+ const code = yield (0, (_generatePnpMap || _load_generatePnpMap()).generatePnpMap)(_this6.config, flattenedTopLevelPatterns, {
+ resolver: _this6.resolver,
+ reporter: _this6.reporter,
+ targetPath: pnpPath,
+ workspaceLayout
+ });
+
+ try {
+ const file = yield (_fs || _load_fs()).readFile(pnpPath);
+ if (file === code) {
+ return;
+ }
+ } catch (error) {}
+
+ yield (_fs || _load_fs()).writeFile(pnpPath, code);
+ yield (_fs || _load_fs()).chmod(pnpPath, 0o755);
+ }));
+ });
+ }
+
+ steps.push(function (curr, total) {
+ return (0, (_hooks || _load_hooks()).callThroughHook)('buildStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ _this6.reporter.step(curr, total, _this6.flags.force ? _this6.reporter.lang('rebuildingPackages') : _this6.reporter.lang('buildingFreshPackages'), emoji.get('hammer'));
+
+ if (_this6.config.ignoreScripts) {
+ _this6.reporter.warn(_this6.reporter.lang('ignoredScripts'));
+ } else {
+ yield _this6.scripts.init(flattenedTopLevelPatterns);
+ }
+ }));
+ });
+
+ if (_this6.flags.har) {
+ steps.push((() => {
+ var _ref21 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) {
+ const formattedDate = new Date().toISOString().replace(/:/g, '-');
+ const filename = `yarn-install_${formattedDate}.har`;
+ _this6.reporter.step(curr, total, _this6.reporter.lang('savingHar', filename), emoji.get('black_circle_for_record'));
+ yield _this6.config.requestManager.saveHar(filename);
+ });
+
+ return function (_x3, _x4) {
+ return _ref21.apply(this, arguments);
+ };
+ })());
+ }
+
+ if (yield _this6.shouldClean()) {
+ steps.push((() => {
+ var _ref22 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) {
+ _this6.reporter.step(curr, total, _this6.reporter.lang('cleaningModules'), emoji.get('recycle'));
+ yield (0, (_autoclean || _load_autoclean()).clean)(_this6.config, _this6.reporter);
+ });
+
+ return function (_x5, _x6) {
+ return _ref22.apply(this, arguments);
+ };
+ })());
+ }
+
+ let currentStep = 0;
+ for (var _iterator11 = steps, _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : _iterator11[Symbol.iterator]();;) {
+ var _ref23;
+
+ if (_isArray11) {
+ if (_i11 >= _iterator11.length) break;
+ _ref23 = _iterator11[_i11++];
+ } else {
+ _i11 = _iterator11.next();
+ if (_i11.done) break;
+ _ref23 = _i11.value;
+ }
+
+ const step = _ref23;
+
+ const stepResult = yield step(++currentStep, steps.length);
+ if (stepResult && stepResult.bailout) {
+ if (_this6.flags.audit) {
+ audit.summary();
+ }
+ if (auditFoundProblems) {
+ _this6.reporter.warn(_this6.reporter.lang('auditRunAuditForDetails'));
+ }
+ _this6.maybeOutputUpdate();
+ return flattenedTopLevelPatterns;
+ }
+ }
+
+ // fin!
+ if (_this6.flags.audit) {
+ audit.summary();
+ }
+ if (auditFoundProblems) {
+ _this6.reporter.warn(_this6.reporter.lang('auditRunAuditForDetails'));
+ }
+ yield _this6.saveLockfileAndIntegrity(topLevelPatterns, workspaceLayout);
+ yield _this6.persistChanges();
+ _this6.maybeOutputUpdate();
+ _this6.config.requestManager.clearCache();
+ return flattenedTopLevelPatterns;
+ })();
+ }
+
+ checkCompatibility() {
+ var _this7 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ var _ref24 = yield _this7.fetchRequestFromCwd();
+
+ const manifest = _ref24.manifest;
+
+ yield (_packageCompatibility || _load_packageCompatibility()).checkOne((0, (_extends2 || _load_extends()).default)({ _reference: {} }, manifest), _this7.config, _this7.flags.ignoreEngines);
+ })();
+ }
+
+ persistChanges() {
+ var _this8 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ // get all the different registry manifests in this folder
+ const manifests = yield _this8.config.getRootManifests();
+
+ if (yield _this8.applyChanges(manifests)) {
+ yield _this8.config.saveRootManifests(manifests);
+ }
+ })();
+ }
+
+ applyChanges(manifests) {
+ let hasChanged = false;
+
+ if (this.config.plugnplayPersist) {
+ const object = manifests.npm.object;
+
+
+ if (typeof object.installConfig !== 'object') {
+ object.installConfig = {};
+ }
+
+ if (this.config.plugnplayEnabled && object.installConfig.pnp !== true) {
+ object.installConfig.pnp = true;
+ hasChanged = true;
+ } else if (!this.config.plugnplayEnabled && typeof object.installConfig.pnp !== 'undefined') {
+ delete object.installConfig.pnp;
+ hasChanged = true;
+ }
+
+ if (Object.keys(object.installConfig).length === 0) {
+ delete object.installConfig;
+ }
+ }
+
+ return Promise.resolve(hasChanged);
+ }
+
+ /**
+ * Check if we should run the cleaning step.
+ */
+
+ shouldClean() {
+ return (_fs || _load_fs()).exists(path.join(this.config.lockfileFolder, (_constants || _load_constants()).CLEAN_FILENAME));
+ }
+
+ /**
+ * TODO
+ */
+
+ flatten(patterns) {
+ var _this9 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ if (!_this9.flags.flat) {
+ return patterns;
+ }
+
+ const flattenedPatterns = [];
+
+ for (var _iterator12 = _this9.resolver.getAllDependencyNamesByLevelOrder(patterns), _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : _iterator12[Symbol.iterator]();;) {
+ var _ref25;
+
+ if (_isArray12) {
+ if (_i12 >= _iterator12.length) break;
+ _ref25 = _iterator12[_i12++];
+ } else {
+ _i12 = _iterator12.next();
+ if (_i12.done) break;
+ _ref25 = _i12.value;
+ }
+
+ const name = _ref25;
+
+ const infos = _this9.resolver.getAllInfoForPackageName(name).filter(function (manifest) {
+ const ref = manifest._reference;
+ invariant(ref, 'expected package reference');
+ return !ref.ignore;
+ });
+
+ if (infos.length === 0) {
+ continue;
+ }
+
+ if (infos.length === 1) {
+ // single version of this package
+ // take out a single pattern as multiple patterns may have resolved to this package
+ flattenedPatterns.push(_this9.resolver.patternsByPackage[name][0]);
+ continue;
+ }
+
+ const options = infos.map(function (info) {
+ const ref = info._reference;
+ invariant(ref, 'expected reference');
+ return {
+ // TODO `and is required by {PARENT}`,
+ name: _this9.reporter.lang('manualVersionResolutionOption', ref.patterns.join(', '), info.version),
+
+ value: info.version
+ };
+ });
+ const versions = infos.map(function (info) {
+ return info.version;
+ });
+ let version;
+
+ const resolutionVersion = _this9.resolutions[name];
+ if (resolutionVersion && versions.indexOf(resolutionVersion) >= 0) {
+ // use json `resolution` version
+ version = resolutionVersion;
+ } else {
+ version = yield _this9.reporter.select(_this9.reporter.lang('manualVersionResolution', name), _this9.reporter.lang('answer'), options);
+ _this9.resolutions[name] = version;
+ }
+
+ flattenedPatterns.push(_this9.resolver.collapseAllVersionsOfPackage(name, version));
+ }
+
+ // save resolutions to their appropriate root manifest
+ if (Object.keys(_this9.resolutions).length) {
+ const manifests = yield _this9.config.getRootManifests();
+
+ for (const name in _this9.resolutions) {
+ const version = _this9.resolutions[name];
+
+ const patterns = _this9.resolver.patternsByPackage[name];
+ if (!patterns) {
+ continue;
+ }
+
+ let manifest;
+ for (var _iterator13 = patterns, _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : _iterator13[Symbol.iterator]();;) {
+ var _ref26;
+
+ if (_isArray13) {
+ if (_i13 >= _iterator13.length) break;
+ _ref26 = _iterator13[_i13++];
+ } else {
+ _i13 = _iterator13.next();
+ if (_i13.done) break;
+ _ref26 = _i13.value;
+ }
+
+ const pattern = _ref26;
+
+ manifest = _this9.resolver.getResolvedPattern(pattern);
+ if (manifest) {
+ break;
+ }
+ }
+ invariant(manifest, 'expected manifest');
+
+ const ref = manifest._reference;
+ invariant(ref, 'expected reference');
+
+ const object = manifests[ref.registry].object;
+ object.resolutions = object.resolutions || {};
+ object.resolutions[name] = version;
+ }
+
+ yield _this9.config.saveRootManifests(manifests);
+ }
+
+ return flattenedPatterns;
+ })();
+ }
+
+ /**
+ * Remove offline tarballs that are no longer required
+ */
+
+ pruneOfflineMirror(lockfile) {
+ var _this10 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ const mirror = _this10.config.getOfflineMirrorPath();
+ if (!mirror) {
+ return;
+ }
+
+ const requiredTarballs = new Set();
+ for (const dependency in lockfile) {
+ const resolved = lockfile[dependency].resolved;
+ if (resolved) {
+ const basename = path.basename(resolved.split('#')[0]);
+ if (dependency[0] === '@' && basename[0] !== '@') {
+ requiredTarballs.add(`${dependency.split('/')[0]}-${basename}`);
+ }
+ requiredTarballs.add(basename);
+ }
+ }
+
+ const mirrorFiles = yield (_fs || _load_fs()).walk(mirror);
+ for (var _iterator14 = mirrorFiles, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : _iterator14[Symbol.iterator]();;) {
+ var _ref27;
+
+ if (_isArray14) {
+ if (_i14 >= _iterator14.length) break;
+ _ref27 = _iterator14[_i14++];
+ } else {
+ _i14 = _iterator14.next();
+ if (_i14.done) break;
+ _ref27 = _i14.value;
+ }
+
+ const file = _ref27;
+
+ const isTarball = path.extname(file.basename) === '.tgz';
+ // if using experimental-pack-script-packages-in-mirror flag, don't unlink prebuilt packages
+ const hasPrebuiltPackage = file.relative.startsWith('prebuilt/');
+ if (isTarball && !hasPrebuiltPackage && !requiredTarballs.has(file.basename)) {
+ yield (_fs || _load_fs()).unlink(file.absolute);
+ }
+ }
+ })();
+ }
+
+ /**
+ * Save updated integrity and lockfiles.
+ */
+
+ saveLockfileAndIntegrity(patterns, workspaceLayout) {
+ var _this11 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ const resolvedPatterns = {};
+ Object.keys(_this11.resolver.patterns).forEach(function (pattern) {
+ if (!workspaceLayout || !workspaceLayout.getManifestByPattern(pattern)) {
+ resolvedPatterns[pattern] = _this11.resolver.patterns[pattern];
+ }
+ });
+
+ // TODO this code is duplicated in a few places, need a common way to filter out workspace patterns from lockfile
+ patterns = patterns.filter(function (p) {
+ return !workspaceLayout || !workspaceLayout.getManifestByPattern(p);
+ });
+
+ const lockfileBasedOnResolver = _this11.lockfile.getLockfile(resolvedPatterns);
+
+ if (_this11.config.pruneOfflineMirror) {
+ yield _this11.pruneOfflineMirror(lockfileBasedOnResolver);
+ }
+
+ // write integrity hash
+ if (!_this11.config.plugnplayEnabled) {
+ yield _this11.integrityChecker.save(patterns, lockfileBasedOnResolver, _this11.flags, workspaceLayout, _this11.scripts.getArtifacts());
+ }
+
+ // --no-lockfile or --pure-lockfile or --frozen-lockfile
+ if (_this11.flags.lockfile === false || _this11.flags.pureLockfile || _this11.flags.frozenLockfile) {
+ return;
+ }
+
+ const lockFileHasAllPatterns = patterns.every(function (p) {
+ return _this11.lockfile.getLocked(p);
+ });
+ const lockfilePatternsMatch = Object.keys(_this11.lockfile.cache || {}).every(function (p) {
+ return lockfileBasedOnResolver[p];
+ });
+ const resolverPatternsAreSameAsInLockfile = Object.keys(lockfileBasedOnResolver).every(function (pattern) {
+ const manifest = _this11.lockfile.getLocked(pattern);
+ return manifest && manifest.resolved === lockfileBasedOnResolver[pattern].resolved && deepEqual(manifest.prebuiltVariants, lockfileBasedOnResolver[pattern].prebuiltVariants);
+ });
+ const integrityPatternsAreSameAsInLockfile = Object.keys(lockfileBasedOnResolver).every(function (pattern) {
+ const existingIntegrityInfo = lockfileBasedOnResolver[pattern].integrity;
+ if (!existingIntegrityInfo) {
+ // if this entry does not have an integrity, no need to re-write the lockfile because of it
+ return true;
+ }
+ const manifest = _this11.lockfile.getLocked(pattern);
+ if (manifest && manifest.integrity) {
+ const manifestIntegrity = ssri.stringify(manifest.integrity);
+ return manifestIntegrity === existingIntegrityInfo;
+ }
+ return false;
+ });
+
+ // remove command is followed by install with force, lockfile will be rewritten in any case then
+ if (!_this11.flags.force && _this11.lockfile.parseResultType === 'success' && lockFileHasAllPatterns && lockfilePatternsMatch && resolverPatternsAreSameAsInLockfile && integrityPatternsAreSameAsInLockfile && patterns.length) {
+ return;
+ }
+
+ // build lockfile location
+ const loc = path.join(_this11.config.lockfileFolder, (_constants || _load_constants()).LOCKFILE_FILENAME);
+
+ // write lockfile
+ const lockSource = (0, (_lockfile2 || _load_lockfile2()).stringify)(lockfileBasedOnResolver, false, _this11.config.enableLockfileVersions);
+ yield (_fs || _load_fs()).writeFilePreservingEol(loc, lockSource);
+
+ _this11._logSuccessSaveLockfile();
+ })();
+ }
+
+ _logSuccessSaveLockfile() {
+ this.reporter.success(this.reporter.lang('savedLockfile'));
+ }
+
+ /**
+ * Load the dependency graph of the current install. Only does package resolving and wont write to the cwd.
+ */
+ hydrate(ignoreUnusedPatterns) {
+ var _this12 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ const request = yield _this12.fetchRequestFromCwd([], ignoreUnusedPatterns);
+ const depRequests = request.requests,
+ rawPatterns = request.patterns,
+ ignorePatterns = request.ignorePatterns,
+ workspaceLayout = request.workspaceLayout;
+
+
+ yield _this12.resolver.init(depRequests, {
+ isFlat: _this12.flags.flat,
+ isFrozen: _this12.flags.frozenLockfile,
+ workspaceLayout
+ });
+ yield _this12.flatten(rawPatterns);
+ _this12.markIgnored(ignorePatterns);
+
+ // fetch packages, should hit cache most of the time
+ const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this12.resolver.getManifests(), _this12.config);
+ _this12.resolver.updateManifests(manifests);
+ yield (_packageCompatibility || _load_packageCompatibility()).check(_this12.resolver.getManifests(), _this12.config, _this12.flags.ignoreEngines);
+
+ // expand minimal manifests
+ for (var _iterator15 = _this12.resolver.getManifests(), _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : _iterator15[Symbol.iterator]();;) {
+ var _ref28;
+
+ if (_isArray15) {
+ if (_i15 >= _iterator15.length) break;
+ _ref28 = _iterator15[_i15++];
+ } else {
+ _i15 = _iterator15.next();
+ if (_i15.done) break;
+ _ref28 = _i15.value;
+ }
+
+ const manifest = _ref28;
+
+ const ref = manifest._reference;
+ invariant(ref, 'expected reference');
+ const type = ref.remote.type;
+ // link specifier won't ever hit cache
+
+ let loc = '';
+ if (type === 'link') {
+ continue;
+ } else if (type === 'workspace') {
+ if (!ref.remote.reference) {
+ continue;
+ }
+ loc = ref.remote.reference;
+ } else {
+ loc = _this12.config.generateModuleCachePath(ref);
+ }
+ const newPkg = yield _this12.config.readManifest(loc);
+ yield _this12.resolver.updateManifest(ref, newPkg);
+ }
+
+ return request;
+ })();
+ }
+
+ /**
+ * Check for updates every day and output a nag message if there's a newer version.
+ */
+
+ checkUpdate() {
+ if (this.config.nonInteractive) {
+ // don't show upgrade dialog on CI or non-TTY terminals
+ return;
+ }
+
+ // don't check if disabled
+ if (this.config.getOption('disable-self-update-check')) {
+ return;
+ }
+
+ // only check for updates once a day
+ const lastUpdateCheck = Number(this.config.getOption('lastUpdateCheck')) || 0;
+ if (lastUpdateCheck && Date.now() - lastUpdateCheck < ONE_DAY) {
+ return;
+ }
+
+ // don't bug for updates on tagged releases
+ if ((_yarnVersion || _load_yarnVersion()).version.indexOf('-') >= 0) {
+ return;
+ }
+
+ this._checkUpdate().catch(() => {
+ // swallow errors
+ });
+ }
+
+ _checkUpdate() {
+ var _this13 = this;
+
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
+ let latestVersion = yield _this13.config.requestManager.request({
+ url: (_constants || _load_constants()).SELF_UPDATE_VERSION_URL
+ });
+ invariant(typeof latestVersion === 'string', 'expected string');
+ latestVersion = latestVersion.trim();
+ if (!semver.valid(latestVersion)) {
+ return;
+ }
+
+ // ensure we only check for updates periodically
+ _this13.config.registries.yarn.saveHomeConfig({
+ lastUpdateCheck: Date.now()
+ });
+
+ if (semver.gt(latestVersion, (_yarnVersion || _load_yarnVersion()).version)) {
+ const installationMethod = yield (0, (_yarnVersion || _load_yarnVersion()).getInstallationMethod)();
+ _this13.maybeOutputUpdate = function () {
+ _this13.reporter.warn(_this13.reporter.lang('yarnOutdated', latestVersion, (_yarnVersion || _load_yarnVersion()).version));
+
+ const command = getUpdateCommand(installationMethod);
+ if (command) {
+ _this13.reporter.info(_this13.reporter.lang('yarnOutdatedCommand'));
+ _this13.reporter.command(command);
+ } else {
+ const installer = getUpdateInstaller(installationMethod);
+ if (installer) {
+ _this13.reporter.info(_this13.reporter.lang('yarnOutdatedInstaller', installer));
+ }
+ }
+ };
+ }
+ })();
+ }
+
+ /**
+ * Method to override with a possible upgrade message.
+ */
+
+ maybeOutputUpdate() {}
+}
+
+exports.Install = Install;
+function hasWrapper(commander, args) {
+ return true;
+}
+
+function setFlags(commander) {
+ commander.description('Yarn install is used to install all dependencies for a project.');
+ commander.usage('install [flags]');
+ commander.option('-A, --audit', 'Run vulnerability audit on installed packages');
+ commander.option('-g, --global', 'DEPRECATED');
+ commander.option('-S, --save', 'DEPRECATED - save package to your `dependencies`');
+ commander.option('-D, --save-dev', 'DEPRECATED - save package to your `devDependencies`');
+ commander.option('-P, --save-peer', 'DEPRECATED - save package to your `peerDependencies`');
+ commander.option('-O, --save-optional', 'DEPRECATED - save package to your `optionalDependencies`');
+ commander.option('-E, --save-exact', 'DEPRECATED');
+ commander.option('-T, --save-tilde', 'DEPRECATED');
+}
+
+/***/ }),
+/* 34 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var isObject = __webpack_require__(49);
+module.exports = function (it) {
+ if (!isObject(it)) throw TypeError(it + ' is not an object!');
+ return it;
+};
+
+
+/***/ }),
+/* 35 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SubjectSubscriber; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subject; });
+/* unused harmony export AnonymousSubject */
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscriber__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Subscription__ = __webpack_require__(24);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__ = __webpack_require__(180);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__SubjectSubscription__ = __webpack_require__(390);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__internal_symbol_rxSubscriber__ = __webpack_require__(288);
+/** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */
+
+
+
+
+
+
+
+var SubjectSubscriber = /*@__PURE__*/ (function (_super) {
+ __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](SubjectSubscriber, _super);
+ function SubjectSubscriber(destination) {
+ var _this = _super.call(this, destination) || this;
+ _this.destination = destination;
+ return _this;
+ }
+ return SubjectSubscriber;
+}(__WEBPACK_IMPORTED_MODULE_2__Subscriber__["a" /* Subscriber */]));
+
+var Subject = /*@__PURE__*/ (function (_super) {
+ __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](Subject, _super);
+ function Subject() {
+ var _this = _super.call(this) || this;
+ _this.observers = [];
+ _this.closed = false;
+ _this.isStopped = false;
+ _this.hasError = false;
+ _this.thrownError = null;
+ return _this;
+ }
+ Subject.prototype[__WEBPACK_IMPORTED_MODULE_6__internal_symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () {
+ return new SubjectSubscriber(this);
+ };
+ Subject.prototype.lift = function (operator) {
+ var subject = new AnonymousSubject(this, this);
+ subject.operator = operator;
+ return subject;
+ };
+ Subject.prototype.next = function (value) {
+ if (this.closed) {
+ throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
+ }
+ if (!this.isStopped) {
+ var observers = this.observers;
+ var len = observers.length;
+ var copy = observers.slice();
+ for (var i = 0; i < len; i++) {
+ copy[i].next(value);
+ }
+ }
+ };
+ Subject.prototype.error = function (err) {
+ if (this.closed) {
+ throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
+ }
+ this.hasError = true;
+ this.thrownError = err;
+ this.isStopped = true;
+ var observers = this.observers;
+ var len = observers.length;
+ var copy = observers.slice();
+ for (var i = 0; i < len; i++) {
+ copy[i].error(err);
+ }
+ this.observers.length = 0;
+ };
+ Subject.prototype.complete = function () {
+ if (this.closed) {
+ throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
+ }
+ this.isStopped = true;
+ var observers = this.observers;
+ var len = observers.length;
+ var copy = observers.slice();
+ for (var i = 0; i < len; i++) {
+ copy[i].complete();
+ }
+ this.observers.length = 0;
+ };
+ Subject.prototype.unsubscribe = function () {
+ this.isStopped = true;
+ this.closed = true;
+ this.observers = null;
+ };
+ Subject.prototype._trySubscribe = function (subscriber) {
+ if (this.closed) {
+ throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
+ }
+ else {
+ return _super.prototype._trySubscribe.call(this, subscriber);
+ }
+ };
+ Subject.prototype._subscribe = function (subscriber) {
+ if (this.closed) {
+ throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
+ }
+ else if (this.hasError) {
+ subscriber.error(this.thrownError);
+ return __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY;
+ }
+ else if (this.isStopped) {
+ subscriber.complete();
+ return __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY;
+ }
+ else {
+ this.observers.push(subscriber);
+ return new __WEBPACK_IMPORTED_MODULE_5__SubjectSubscription__["a" /* SubjectSubscription */](this, subscriber);
+ }
+ };
+ Subject.prototype.asObservable = function () {
+ var observable = new __WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */]();
+ observable.source = this;
+ return observable;
+ };
+ Subject.create = function (destination, source) {
+ return new AnonymousSubject(destination, source);
+ };
+ return Subject;
+}(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */]));
+
+var AnonymousSubject = /*@__PURE__*/ (function (_super) {
+ __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](AnonymousSubject, _super);
+ function AnonymousSubject(destination, source) {
+ var _this = _super.call(this) || this;
+ _this.destination = destination;
+ _this.source = source;
+ return _this;
+ }
+ AnonymousSubject.prototype.next = function (value) {
+ var destination = this.destination;
+ if (destination && destination.next) {
+ destination.next(value);
+ }
+ };
+ AnonymousSubject.prototype.error = function (err) {
+ var destination = this.destination;
+ if (destination && destination.error) {
+ this.destination.error(err);
+ }
+ };
+ AnonymousSubject.prototype.complete = function () {
+ var destination = this.destination;
+ if (destination && destination.complete) {
+ this.destination.complete();
+ }
+ };
+ AnonymousSubject.prototype._subscribe = function (subscriber) {
+ var source = this.source;
+ if (source) {
+ return this.source.subscribe(subscriber);
+ }
+ else {
+ return __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY;
+ }
+ };
+ return AnonymousSubject;
+}(Subject));
+
+//# sourceMappingURL=Subject.js.map
+
+
+/***/ }),
+/* 36 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.normalizePattern = normalizePattern;
+
+/**
+ * Explode and normalize a pattern into its name and range.
+ */
+
+function normalizePattern(pattern) {
+ let hasVersion = false;
+ let range = 'latest';
+ let name = pattern;
+
+ // if we're a scope then remove the @ and add it back later
+ let isScoped = false;
+ if (name[0] === '@') {
+ isScoped = true;
+ name = name.slice(1);
+ }
+
+ // take first part as the name
+ const parts = name.split('@');
+ if (parts.length > 1) {
+ name = parts.shift();
+ range = parts.join('@');
+
+ if (range) {
+ hasVersion = true;
+ } else {
+ range = '*';
+ }
+ }
+
+ // add back @ scope suffix
+ if (isScoped) {
+ name = `@${name}`;
+ }
+
+ return { name, range, hasVersion };
+}
+
+/***/ }),
+/* 37 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
+ * @license
+ * Lodash <https://lodash.com/>
+ * Copyright JS Foundation and other contributors <https://js.foundation/>
+ * Released under MIT license <https://lodash.com/license>
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */
+;(function() {
+
+ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
+ var undefined;
+
+ /** Used as the semantic version number. */
+ var VERSION = '4.17.10';
+
+ /** Used as the size to enable large array optimizations. */
+ var LARGE_ARRAY_SIZE = 200;
+
+ /** Error message constants. */
+ var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
+ FUNC_ERROR_TEXT = 'Expected a function';
+
+ /** Used to stand-in for `undefined` hash values. */
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
+
+ /** Used as the maximum memoize cache size. */
+ var MAX_MEMOIZE_SIZE = 500;
+
+ /** Used as the internal argument placeholder. */
+ var PLACEHOLDER = '__lodash_placeholder__';
+
+ /** Used to compose bitmasks for cloning. */
+ var CLONE_DEEP_FLAG = 1,
+ CLONE_FLAT_FLAG = 2,
+ CLONE_SYMBOLS_FLAG = 4;
+
+ /** Used to compose bitmasks for value comparisons. */
+ var COMPARE_PARTIAL_FLAG = 1,
+ COMPARE_UNORDERED_FLAG = 2;
+
+ /** Used to compose bitmasks for function metadata. */
+ var WRAP_BIND_FLAG = 1,
+ WRAP_BIND_KEY_FLAG = 2,
+ WRAP_CURRY_BOUND_FLAG = 4,
+ WRAP_CURRY_FLAG = 8,
+ WRAP_CURRY_RIGHT_FLAG = 16,
+ WRAP_PARTIAL_FLAG = 32,
+ WRAP_PARTIAL_RIGHT_FLAG = 64,
+ WRAP_ARY_FLAG = 128,
+ WRAP_REARG_FLAG = 256,
+ WRAP_FLIP_FLAG = 512;
+
+ /** Used as default options for `_.truncate`. */
+ var DEFAULT_TRUNC_LENGTH = 30,
+ DEFAULT_TRUNC_OMISSION = '...';
+
+ /** Used to detect hot functions by number of calls within a span of milliseconds. */
+ var HOT_COUNT = 800,
+ HOT_SPAN = 16;
+
+ /** Used to indicate the type of lazy iteratees. */
+ var LAZY_FILTER_FLAG = 1,
+ LAZY_MAP_FLAG = 2,
+ LAZY_WHILE_FLAG = 3;
+
+ /** Used as references for various `Number` constants. */
+ var INFINITY = 1 / 0,
+ MAX_SAFE_INTEGER = 9007199254740991,
+ MAX_INTEGER = 1.7976931348623157e+308,
+ NAN = 0 / 0;
+
+ /** Used as references for the maximum length and index of an array. */
+ var MAX_ARRAY_LENGTH = 4294967295,
+ MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
+ HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
+
+ /** Used to associate wrap methods with their bit flags. */
+ var wrapFlags = [
+ ['ary', WRAP_ARY_FLAG],
+ ['bind', WRAP_BIND_FLAG],
+ ['bindKey', WRAP_BIND_KEY_FLAG],
+ ['curry', WRAP_CURRY_FLAG],
+ ['curryRight', WRAP_CURRY_RIGHT_FLAG],
+ ['flip', WRAP_FLIP_FLAG],
+ ['partial', WRAP_PARTIAL_FLAG],
+ ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
+ ['rearg', WRAP_REARG_FLAG]
+ ];
+
+ /** `Object#toString` result references. */
+ var argsTag = '[object Arguments]',
+ arrayTag = '[object Array]',
+ asyncTag = '[object AsyncFunction]',
+ boolTag = '[object Boolean]',
+ dateTag = '[object Date]',
+ domExcTag = '[object DOMException]',
+ errorTag = '[object Error]',
+ funcTag = '[object Function]',
+ genTag = '[object GeneratorFunction]',
+ mapTag = '[object Map]',
+ numberTag = '[object Number]',
+ nullTag = '[object Null]',
+ objectTag = '[object Object]',
+ promiseTag = '[object Promise]',
+ proxyTag = '[object Proxy]',
+ regexpTag = '[object RegExp]',
+ setTag = '[object Set]',
+ stringTag = '[object String]',
+ symbolTag = '[object Symbol]',
+ undefinedTag = '[object Undefined]',
+ weakMapTag = '[object WeakMap]',
+ weakSetTag = '[object WeakSet]';
+
+ var arrayBufferTag = '[object ArrayBuffer]',
+ dataViewTag = '[object DataView]',
+ float32Tag = '[object Float32Array]',
+ float64Tag = '[object Float64Array]',
+ int8Tag = '[object Int8Array]',
+ int16Tag = '[object Int16Array]',
+ int32Tag = '[object Int32Array]',
+ uint8Tag = '[object Uint8Array]',
+ uint8ClampedTag = '[object Uint8ClampedArray]',
+ uint16Tag = '[object Uint16Array]',
+ uint32Tag = '[object Uint32Array]';
+
+ /** Used to match empty string literals in compiled template source. */
+ var reEmptyStringLeading = /\b__p \+= '';/g,
+ reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
+ reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
+
+ /** Used to match HTML entities and HTML characters. */
+ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
+ reUnescapedHtml = /[&<>"']/g,
+ reHasEscapedHtml = RegExp(reEscapedHtml.source),
+ reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
+
+ /** Used to match template delimiters. */
+ var reEscape = /<%-([\s\S]+?)%>/g,
+ reEvaluate = /<%([\s\S]+?)%>/g,
+ reInterpolate = /<%=([\s\S]+?)%>/g;
+
+ /** Used to match property names within property paths. */
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
+ reIsPlainProp = /^\w*$/,
+ rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
+
+ /**
+ * Used to match `RegExp`
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
+ */
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
+ reHasRegExpChar = RegExp(reRegExpChar.source);
+
+ /** Used to match leading and trailing whitespace. */
+ var reTrim = /^\s+|\s+$/g,
+ reTrimStart = /^\s+/,
+ reTrimEnd = /\s+$/;
+
+ /** Used to match wrap detail comments. */
+ var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
+ reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
+ reSplitDetails = /,? & /;
+
+ /** Used to match words composed of alphanumeric characters. */
+ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
+
+ /** Used to match backslashes in property paths. */
+ var reEscapeChar = /\\(\\)?/g;
+
+ /**
+ * Used to match
+ * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
+ */
+ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
+
+ /** Used to match `RegExp` flags from their coerced string values. */
+ var reFlags = /\w*$/;
+
+ /** Used to detect bad signed hexadecimal string values. */
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
+
+ /** Used to detect binary string values. */
+ var reIsBinary = /^0b[01]+$/i;
+
+ /** Used to detect host constructors (Safari). */
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
+
+ /** Used to detect octal string values. */
+ var reIsOctal = /^0o[0-7]+$/i;
+
+ /** Used to detect unsigned integer values. */
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
+
+ /** Used to match Latin Unicode letters (excluding mathematical operators). */
+ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
+
+ /** Used to ensure capturing order of template delimiters. */
+ var reNoMatch = /($^)/;
+
+ /** Used to match unescaped characters in compiled string literals. */
+ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
+
+ /** Used to compose unicode character classes. */
+ var rsAstralRange = '\\ud800-\\udfff',
+ rsComboMarksRange = '\\u0300-\\u036f',
+ reComboHalfMarksRange = '\\ufe20-\\ufe2f',
+ rsComboSymbolsRange = '\\u20d0-\\u20ff',
+ rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
+ rsDingbatRange = '\\u2700-\\u27bf',
+ rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
+ rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
+ rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
+ rsPunctuationRange = '\\u2000-\\u206f',
+ rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
+ rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
+ rsVarRange = '\\ufe0e\\ufe0f',
+ rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
+
+ /** Used to compose unicode capture groups. */
+ var rsApos = "['\u2019]",
+ rsAstral = '[' + rsAstralRange + ']',
+ rsBreak = '[' + rsBreakRange + ']',
+ rsCombo = '[' + rsComboRange + ']',
+ rsDigits = '\\d+',
+ rsDingbat = '[' + rsDingbatRange + ']',
+ rsLower = '[' + rsLowerRange + ']',
+ rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
+ rsFitz = '\\ud83c[\\udffb-\\udfff]',
+ rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
+ rsNonAstral = '[^' + rsAstralRange + ']',
+ rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
+ rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
+ rsUpper = '[' + rsUpperRange + ']',
+ rsZWJ = '\\u200d';
+
+ /** Used to compose unicode regexes. */
+ var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
+ rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
+ rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
+ rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
+ reOptMod = rsModifier + '?',
+ rsOptVar = '[' + rsVarRange + ']?',
+ rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
+ rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
+ rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
+ rsSeq = rsOptVar + reOptMod + rsOptJoin,
+ rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
+ rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
+
+ /** Used to match apostrophes. */
+ var reApos = RegExp(rsApos, 'g');
+
+ /**
+ * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
+ * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
+ */
+ var reComboMark = RegExp(rsCombo, 'g');
+
+ /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
+ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
+
+ /** Used to match complex or compound words. */
+ var reUnicodeWord = RegExp([
+ rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
+ rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
+ rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
+ rsUpper + '+' + rsOptContrUpper,
+ rsOrdUpper,
+ rsOrdLower,
+ rsDigits,
+ rsEmoji
+ ].join('|'), 'g');
+
+ /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
+ var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
+
+ /** Used to detect strings that need a more robust regexp to match words. */
+ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
+
+ /** Used to assign default `context` object properties. */
+ var contextProps = [
+ 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
+ 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
+ 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
+ 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
+ '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
+ ];
+
+ /** Used to make template sourceURLs easier to identify. */
+ var templateCounter = -1;
+
+ /** Used to identify `toStringTag` values of typed arrays. */
+ var typedArrayTags = {};
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
+ typedArrayTags[uint32Tag] = true;
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
+ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
+ typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
+ typedArrayTags[errorTag] = typedArrayTags[funcTag] =
+ typedArrayTags[mapTag] = typedArrayTags[numberTag] =
+ typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
+ typedArrayTags[setTag] = typedArrayTags[stringTag] =
+ typedArrayTags[weakMapTag] = false;
+
+ /** Used to identify `toStringTag` values supported by `_.clone`. */
+ var cloneableTags = {};
+ cloneableTags[argsTag] = cloneableTags[arrayTag] =
+ cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
+ cloneableTags[boolTag] = cloneableTags[dateTag] =
+ cloneableTags[float32Tag] = cloneableTags[float64Tag] =
+ cloneableTags[int8Tag] = cloneableTags[int16Tag] =
+ cloneableTags[int32Tag] = cloneableTags[mapTag] =
+ cloneableTags[numberTag] = cloneableTags[objectTag] =
+ cloneableTags[regexpTag] = cloneableTags[setTag] =
+ cloneableTags[stringTag] = cloneableTags[symbolTag] =
+ cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
+ cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
+ cloneableTags[errorTag] = cloneableTags[funcTag] =
+ cloneableTags[weakMapTag] = false;
+
+ /** Used to map Latin Unicode letters to basic Latin letters. */
+ var deburredLetters = {
+ // Latin-1 Supplement block.
+ '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
+ '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
+ '\xc7': 'C', '\xe7': 'c',
+ '\xd0': 'D', '\xf0': 'd',
+ '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
+ '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
+ '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
+ '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
+ '\xd1': 'N', '\xf1': 'n',
+ '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
+ '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
+ '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
+ '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
+ '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
+ '\xc6': 'Ae', '\xe6': 'ae',
+ '\xde': 'Th', '\xfe': 'th',
+ '\xdf': 'ss',
+ // Latin Extended-A block.
+ '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
+ '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
+ '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
+ '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
+ '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
+ '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
+ '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
+ '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
+ '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
+ '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
+ '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
+ '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
+ '\u0134': 'J', '\u0135': 'j',
+ '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
+ '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
+ '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
+ '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
+ '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
+ '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
+ '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
+ '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
+ '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
+ '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
+ '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
+ '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
+ '\u0163': 't', '\u0165': 't', '\u0167': 't',
+ '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
+ '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
+ '\u0174': 'W', '\u0175': 'w',
+ '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
+ '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
+ '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
+ '\u0132': 'IJ', '\u0133': 'ij',
+ '\u0152': 'Oe', '\u0153': 'oe',
+ '\u0149': "'n", '\u017f': 's'
+ };
+
+ /** Used to map characters to HTML entities. */
+ var htmlEscapes = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+ };
+
+ /** Used to map HTML entities to characters. */
+ var htmlUnescapes = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ ''': "'"
+ };
+
+ /** Used to escape characters for inclusion in compiled string literals. */
+ var stringEscapes = {
+ '\\': '\\',
+ "'": "'",
+ '\n': 'n',
+ '\r': 'r',
+ '\u2028': 'u2028',
+ '\u2029': 'u2029'
+ };
+
+ /** Built-in method references without a dependency on `root`. */
+ var freeParseFloat = parseFloat,
+ freeParseInt = parseInt;
+
+ /** Detect free variable `global` from Node.js. */
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
+
+ /** Detect free variable `self`. */
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+
+ /** Used as a reference to the global object. */
+ var root = freeGlobal || freeSelf || Function('return this')();
+
+ /** Detect free variable `exports`. */
+ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
+
+ /** Detect free variable `module`. */
+ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
+
+ /** Detect the popular CommonJS extension `module.exports`. */
+ var moduleExports = freeModule && freeModule.exports === freeExports;
+
+ /** Detect free variable `process` from Node.js. */
+ var freeProcess = moduleExports && freeGlobal.process;
+
+ /** Used to access faster Node.js helpers. */
+ var nodeUtil = (function() {
+ try {
+ // Use `util.types` for Node.js 10+.
+ var types = freeModule && freeModule.require && freeModule.require('util').types;
+
+ if (types) {
+ return types;
+ }
+
+ // Legacy `process.binding('util')` for Node.js < 10.
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
+ } catch (e) {}
+ }());
+
+ /* Node.js helper references. */
+ var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
+ nodeIsDate = nodeUtil && nodeUtil.isDate,
+ nodeIsMap = nodeUtil && nodeUtil.isMap,
+ nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
+ nodeIsSet = nodeUtil && nodeUtil.isSet,
+ nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * A faster alternative to `Function#apply`, this function invokes `func`
+ * with the `this` binding of `thisArg` and the arguments of `args`.
+ *
+ * @private
+ * @param {Function} func The function to invoke.
+ * @param {*} thisArg The `this` binding of `func`.
+ * @param {Array} args The arguments to invoke `func` with.
+ * @returns {*} Returns the result of `func`.
+ */
+ function apply(func, thisArg, args) {
+ switch (args.length) {
+ case 0: return func.call(thisArg);
+ case 1: return func.call(thisArg, args[0]);
+ case 2: return func.call(thisArg, args[0], args[1]);
+ case 3: return func.call(thisArg, args[0], args[1], args[2]);
+ }
+ return func.apply(thisArg, args);
+ }
+
+ /**
+ * A specialized version of `baseAggregator` for arrays.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} setter The function to set `accumulator` values.
+ * @param {Function} iteratee The iteratee to transform keys.
+ * @param {Object} accumulator The initial aggregated object.
+ * @returns {Function} Returns `accumulator`.
+ */
+ function arrayAggregator(array, setter, iteratee, accumulator) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ var value = array[index];
+ setter(accumulator, value, iteratee(value), array);
+ }
+ return accumulator;
+ }
+
+ /**
+ * A specialized version of `_.forEach` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayEach(array, iteratee) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ if (iteratee(array[index], index, array) === false) {
+ break;
+ }
+ }
+ return array;
+ }
+
+ /**
+ * A specialized version of `_.forEachRight` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayEachRight(array, iteratee) {
+ var length = array == null ? 0 : array.length;
+
+ while (length--) {
+ if (iteratee(array[length], length, array) === false) {
+ break;
+ }
+ }
+ return array;
+ }
+
+ /**
+ * A specialized version of `_.every` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`.
+ */
+ function arrayEvery(array, predicate) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ if (!predicate(array[index], index, array)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * A specialized version of `_.filter` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {Array} Returns the new filtered array.
+ */
+ function arrayFilter(array, predicate) {
+ var index = -1,
+ length = array == null ? 0 : array.length,
+ resIndex = 0,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index];
+ if (predicate(value, index, array)) {
+ result[resIndex++] = value;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * A specialized version of `_.includes` for arrays without support for
+ * specifying an index to search from.
+ *
+ * @private
+ * @param {Array} [array] The array to inspect.
+ * @param {*} target The value to search for.
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
+ */
+ function arrayIncludes(array, value) {
+ var length = array == null ? 0 : array.length;
+ return !!length && baseIndexOf(array, value, 0) > -1;
+ }
+
+ /**
+ * This function is like `arrayIncludes` except that it accepts a comparator.
+ *
+ * @private
+ * @param {Array} [array] The array to inspect.
+ * @param {*} target The value to search for.
+ * @param {Function} comparator The comparator invoked per element.
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
+ */
+ function arrayIncludesWith(array, value, comparator) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ if (comparator(value, array[index])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * A specialized version of `_.map` for arrays without support for iteratee
+ * shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ */
+ function arrayMap(array, iteratee) {
+ var index = -1,
+ length = array == null ? 0 : array.length,
+ result = Array(length);
+
+ while (++index < length) {
+ result[index] = iteratee(array[index], index, array);
+ }
+ return result;
+ }
+
+ /**
+ * Appends the elements of `values` to `array`.
+ *
+ * @private
+ * @param {Array} array The array to modify.
+ * @param {Array} values The values to append.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayPush(array, values) {
+ var index = -1,
+ length = values.length,
+ offset = array.length;
+
+ while (++index < length) {
+ array[offset + index] = values[index];
+ }
+ return array;
+ }
+
+ /**
+ * A specialized version of `_.reduce` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {boolean} [initAccum] Specify using the first element of `array` as
+ * the initial value.
+ * @returns {*} Returns the accumulated value.
+ */
+ function arrayReduce(array, iteratee, accumulator, initAccum) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ if (initAccum && length) {
+ accumulator = array[++index];
+ }
+ while (++index < length) {
+ accumulator = iteratee(accumulator, array[index], index, array);
+ }
+ return accumulator;
+ }
+
+ /**
+ * A specialized version of `_.reduceRight` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {boolean} [initAccum] Specify using the last element of `array` as
+ * the initial value.
+ * @returns {*} Returns the accumulated value.
+ */
+ function arrayReduceRight(array, iteratee, accumulator, initAccum) {
+ var length = array == null ? 0 : array.length;
+ if (initAccum && length) {
+ accumulator = array[--length];
+ }
+ while (length--) {
+ accumulator = iteratee(accumulator, array[length], length, array);
+ }
+ return accumulator;
+ }
+
+ /**
+ * A specialized version of `_.some` for arrays without support for iteratee
+ * shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
+ */
+ function arraySome(array, predicate) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ if (predicate(array[index], index, array)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Gets the size of an ASCII `string`.
+ *
+ * @private
+ * @param {string} string The string inspect.
+ * @returns {number} Returns the string size.
+ */
+ var asciiSize = baseProperty('length');
+
+ /**
+ * Converts an ASCII `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function asciiToArray(string) {
+ return string.split('');
+ }
+
+ /**
+ * Splits an ASCII `string` into an array of its words.
+ *
+ * @private
+ * @param {string} The string to inspect.
+ * @returns {Array} Returns the words of `string`.
+ */
+ function asciiWords(string) {
+ return string.match(reAsciiWord) || [];
+ }
+
+ /**
+ * The base implementation of methods like `_.findKey` and `_.findLastKey`,
+ * without support for iteratee shorthands, which iterates over `collection`
+ * using `eachFunc`.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to inspect.
+ * @param {Function} predicate The function invoked per iteration.
+ * @param {Function} eachFunc The function to iterate over `collection`.
+ * @returns {*} Returns the found element or its key, else `undefined`.
+ */
+ function baseFindKey(collection, predicate, eachFunc) {
+ var result;
+ eachFunc(collection, function(value, key, collection) {
+ if (predicate(value, key, collection)) {
+ result = key;
+ return false;
+ }
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
+ * support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} predicate The function invoked per iteration.
+ * @param {number} fromIndex The index to search from.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function baseFindIndex(array, predicate, fromIndex, fromRight) {
+ var length = array.length,
+ index = fromIndex + (fromRight ? 1 : -1);
+
+ while ((fromRight ? index-- : ++index < length)) {
+ if (predicate(array[index], index, array)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function baseIndexOf(array, value, fromIndex) {
+ return value === value
+ ? strictIndexOf(array, value, fromIndex)
+ : baseFindIndex(array, baseIsNaN, fromIndex);
+ }
+
+ /**
+ * This function is like `baseIndexOf` except that it accepts a comparator.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @param {Function} comparator The comparator invoked per element.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function baseIndexOfWith(array, value, fromIndex, comparator) {
+ var index = fromIndex - 1,
+ length = array.length;
+
+ while (++index < length) {
+ if (comparator(array[index], value)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * The base implementation of `_.isNaN` without support for number objects.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+ */
+ function baseIsNaN(value) {
+ return value !== value;
+ }
+
+ /**
+ * The base implementation of `_.mean` and `_.meanBy` without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {number} Returns the mean.
+ */
+ function baseMean(array, iteratee) {
+ var length = array == null ? 0 : array.length;
+ return length ? (baseSum(array, iteratee) / length) : NAN;
+ }
+
+ /**
+ * The base implementation of `_.property` without support for deep paths.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function baseProperty(key) {
+ return function(object) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
+ /**
+ * The base implementation of `_.propertyOf` without support for deep paths.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function basePropertyOf(object) {
+ return function(key) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
+ /**
+ * The base implementation of `_.reduce` and `_.reduceRight`, without support
+ * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} accumulator The initial value.
+ * @param {boolean} initAccum Specify using the first or last element of
+ * `collection` as the initial value.
+ * @param {Function} eachFunc The function to iterate over `collection`.
+ * @returns {*} Returns the accumulated value.
+ */
+ function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
+ eachFunc(collection, function(value, index, collection) {
+ accumulator = initAccum
+ ? (initAccum = false, value)
+ : iteratee(accumulator, value, index, collection);
+ });
+ return accumulator;
+ }
+
+ /**
+ * The base implementation of `_.sortBy` which uses `comparer` to define the
+ * sort order of `array` and replaces criteria objects with their corresponding
+ * values.
+ *
+ * @private
+ * @param {Array} array The array to sort.
+ * @param {Function} comparer The function to define sort order.
+ * @returns {Array} Returns `array`.
+ */
+ function baseSortBy(array, comparer) {
+ var length = array.length;
+
+ array.sort(comparer);
+ while (length--) {
+ array[length] = array[length].value;
+ }
+ return array;
+ }
+
+ /**
+ * The base implementation of `_.sum` and `_.sumBy` without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {number} Returns the sum.
+ */
+ function baseSum(array, iteratee) {
+ var result,
+ index = -1,
+ length = array.length;
+
+ while (++index < length) {
+ var current = iteratee(array[index]);
+ if (current !== undefined) {
+ result = result === undefined ? current : (result + current);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.times` without support for iteratee shorthands
+ * or max array length checks.
+ *
+ * @private
+ * @param {number} n The number of times to invoke `iteratee`.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the array of results.
+ */
+ function baseTimes(n, iteratee) {
+ var index = -1,
+ result = Array(n);
+
+ while (++index < n) {
+ result[index] = iteratee(index);
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
+ * of key-value pairs for `object` corresponding to the property names of `props`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array} props The property names to get values for.
+ * @returns {Object} Returns the key-value pairs.
+ */
+ function baseToPairs(object, props) {
+ return arrayMap(props, function(key) {
+ return [key, object[key]];
+ });
+ }
+
+ /**
+ * The base implementation of `_.unary` without support for storing metadata.
+ *
+ * @private
+ * @param {Function} func The function to cap arguments for.
+ * @returns {Function} Returns the new capped function.
+ */
+ function baseUnary(func) {
+ return function(value) {
+ return func(value);
+ };
+ }
+
+ /**
+ * The base implementation of `_.values` and `_.valuesIn` which creates an
+ * array of `object` property values corresponding to the property names
+ * of `props`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array} props The property names to get values for.
+ * @returns {Object} Returns the array of property values.
+ */
+ function baseValues(object, props) {
+ return arrayMap(props, function(key) {
+ return object[key];
+ });
+ }
+
+ /**
+ * Checks if a `cache` value for `key` exists.
+ *
+ * @private
+ * @param {Object} cache The cache to query.
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function cacheHas(cache, key) {
+ return cache.has(key);
+ }
+
+ /**
+ * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
+ * that is not found in the character symbols.
+ *
+ * @private
+ * @param {Array} strSymbols The string symbols to inspect.
+ * @param {Array} chrSymbols The character symbols to find.
+ * @returns {number} Returns the index of the first unmatched string symbol.
+ */
+ function charsStartIndex(strSymbols, chrSymbols) {
+ var index = -1,
+ length = strSymbols.length;
+
+ while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
+ return index;
+ }
+
+ /**
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
+ * that is not found in the character symbols.
+ *
+ * @private
+ * @param {Array} strSymbols The string symbols to inspect.
+ * @param {Array} chrSymbols The character symbols to find.
+ * @returns {number} Returns the index of the last unmatched string symbol.
+ */
+ function charsEndIndex(strSymbols, chrSymbols) {
+ var index = strSymbols.length;
+
+ while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
+ return index;
+ }
+
+ /**
+ * Gets the number of `placeholder` occurrences in `array`.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} placeholder The placeholder to search for.
+ * @returns {number} Returns the placeholder count.
+ */
+ function countHolders(array, placeholder) {
+ var length = array.length,
+ result = 0;
+
+ while (length--) {
+ if (array[length] === placeholder) {
+ ++result;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
+ * letters to basic Latin letters.
+ *
+ * @private
+ * @param {string} letter The matched letter to deburr.
+ * @returns {string} Returns the deburred letter.
+ */
+ var deburrLetter = basePropertyOf(deburredLetters);
+
+ /**
+ * Used by `_.escape` to convert characters to HTML entities.
+ *
+ * @private
+ * @param {string} chr The matched character to escape.
+ * @returns {string} Returns the escaped character.
+ */
+ var escapeHtmlChar = basePropertyOf(htmlEscapes);
+
+ /**
+ * Used by `_.template` to escape characters for inclusion in compiled string literals.
+ *
+ * @private
+ * @param {string} chr The matched character to escape.
+ * @returns {string} Returns the escaped character.
+ */
+ function escapeStringChar(chr) {
+ return '\\' + stringEscapes[chr];
+ }
+
+ /**
+ * Gets the value at `key` of `object`.
+ *
+ * @private
+ * @param {Object} [object] The object to query.
+ * @param {string} key The key of the property to get.
+ * @returns {*} Returns the property value.
+ */
+ function getValue(object, key) {
+ return object == null ? undefined : object[key];
+ }
+
+ /**
+ * Checks if `string` contains Unicode symbols.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {boolean} Returns `true` if a symbol is found, else `false`.
+ */
+ function hasUnicode(string) {
+ return reHasUnicode.test(string);
+ }
+
+ /**
+ * Checks if `string` contains a word composed of Unicode symbols.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {boolean} Returns `true` if a word is found, else `false`.
+ */
+ function hasUnicodeWord(string) {
+ return reHasUnicodeWord.test(string);
+ }
+
+ /**
+ * Converts `iterator` to an array.
+ *
+ * @private
+ * @param {Object} iterator The iterator to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function iteratorToArray(iterator) {
+ var data,
+ result = [];
+
+ while (!(data = iterator.next()).done) {
+ result.push(data.value);
+ }
+ return result;
+ }
+
+ /**
+ * Converts `map` to its key-value pairs.
+ *
+ * @private
+ * @param {Object} map The map to convert.
+ * @returns {Array} Returns the key-value pairs.
+ */
+ function mapToArray(map) {
+ var index = -1,
+ result = Array(map.size);
+
+ map.forEach(function(value, key) {
+ result[++index] = [key, value];
+ });
+ return result;
+ }
+
+ /**
+ * Creates a unary function that invokes `func` with its argument transformed.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {Function} transform The argument transform.
+ * @returns {Function} Returns the new function.
+ */
+ function overArg(func, transform) {
+ return function(arg) {
+ return func(transform(arg));
+ };
+ }
+
+ /**
+ * Replaces all `placeholder` elements in `array` with an internal placeholder
+ * and returns an array of their indexes.
+ *
+ * @private
+ * @param {Array} array The array to modify.
+ * @param {*} placeholder The placeholder to replace.
+ * @returns {Array} Returns the new array of placeholder indexes.
+ */
+ function replaceHolders(array, placeholder) {
+ var index = -1,
+ length = array.length,
+ resIndex = 0,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index];
+ if (value === placeholder || value === PLACEHOLDER) {
+ array[index] = PLACEHOLDER;
+ result[resIndex++] = index;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 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.
+ *
+ * @private
+ * @param {Object} set The set to convert.
+ * @returns {Array} Returns the values.
+ */
+ function setToArray(set) {
+ var index = -1,
+ result = Array(set.size);
+
+ set.forEach(function(value) {
+ result[++index] = value;
+ });
+ return result;
+ }
+
+ /**
+ * Converts `set` to its value-value pairs.
+ *
+ * @private
+ * @param {Object} set The set to convert.
+ * @returns {Array} Returns the value-value pairs.
+ */
+ function setToPairs(set) {
+ var index = -1,
+ result = Array(set.size);
+
+ set.forEach(function(value) {
+ result[++index] = [value, value];
+ });
+ return result;
+ }
+
+ /**
+ * A specialized version of `_.indexOf` which performs strict equality
+ * comparisons of values, i.e. `===`.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function strictIndexOf(array, value, fromIndex) {
+ var index = fromIndex - 1,
+ length = array.length;
+
+ while (++index < length) {
+ if (array[index] === value) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * A specialized version of `_.lastIndexOf` which performs strict equality
+ * comparisons of values, i.e. `===`.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function strictLastIndexOf(array, value, fromIndex) {
+ var index = fromIndex + 1;
+ while (index--) {
+ if (array[index] === value) {
+ return index;
+ }
+ }
+ return index;
+ }
+
+ /**
+ * Gets the number of symbols in `string`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {number} Returns the string size.
+ */
+ function stringSize(string) {
+ return hasUnicode(string)
+ ? unicodeSize(string)
+ : asciiSize(string);
+ }
+
+ /**
+ * Converts `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function stringToArray(string) {
+ return hasUnicode(string)
+ ? unicodeToArray(string)
+ : asciiToArray(string);
+ }
+
+ /**
+ * Used by `_.unescape` to convert HTML entities to characters.
+ *
+ * @private
+ * @param {string} chr The matched character to unescape.
+ * @returns {string} Returns the unescaped character.
+ */
+ var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
+
+ /**
+ * Gets the size of a Unicode `string`.
+ *
+ * @private
+ * @param {string} string The string inspect.
+ * @returns {number} Returns the string size.
+ */
+ function unicodeSize(string) {
+ var result = reUnicode.lastIndex = 0;
+ while (reUnicode.test(string)) {
+ ++result;
+ }
+ return result;
+ }
+
+ /**
+ * Converts a Unicode `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function unicodeToArray(string) {
+ return string.match(reUnicode) || [];
+ }
+
+ /**
+ * Splits a Unicode `string` into an array of its words.
+ *
+ * @private
+ * @param {string} The string to inspect.
+ * @returns {Array} Returns the words of `string`.
+ */
+ function unicodeWords(string) {
+ return string.match(reUnicodeWord) || [];
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Create a new pristine `lodash` function using the `context` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.1.0
+ * @category Util
+ * @param {Object} [context=root] The context object.
+ * @returns {Function} Returns a new `lodash` function.
+ * @example
+ *
+ * _.mixin({ 'foo': _.constant('foo') });
+ *
+ * var lodash = _.runInContext();
+ * lodash.mixin({ 'bar': lodash.constant('bar') });
+ *
+ * _.isFunction(_.foo);
+ * // => true
+ * _.isFunction(_.bar);
+ * // => false
+ *
+ * lodash.isFunction(lodash.foo);
+ * // => false
+ * lodash.isFunction(lodash.bar);
+ * // => true
+ *
+ * // Create a suped-up `defer` in Node.js.
+ * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
+ */
+ var runInContext = (function runInContext(context) {
+ context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
+
+ /** Built-in constructor references. */
+ var Array = context.Array,
+ Date = context.Date,
+ Error = context.Error,
+ Function = context.Function,
+ Math = context.Math,
+ Object = context.Object,
+ RegExp = context.RegExp,
+ String = context.String,
+ TypeError = context.TypeError;
+
+ /** Used for built-in method references. */
+ var arrayProto = Array.prototype,
+ funcProto = Function.prototype,
+ objectProto = Object.prototype;
+
+ /** Used to detect overreaching core-js shims. */
+ var coreJsData = context['__core-js_shared__'];
+
+ /** Used to resolve the decompiled source of functions. */
+ var funcToString = funcProto.toString;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
+
+ /** Used to generate unique IDs. */
+ var idCounter = 0;
+
+ /** Used to detect methods masquerading as native. */
+ var maskSrcKey = (function() {
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
+ return uid ? ('Symbol(src)_1.' + uid) : '';
+ }());
+
+ /**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var nativeObjectToString = objectProto.toString;
+
+ /** Used to infer the `Object` constructor. */
+ var objectCtorString = funcToString.call(Object);
+
+ /** Used to restore the original `_` reference in `_.noConflict`. */
+ var oldDash = root._;
+
+ /** Used to detect if a method is native. */
+ var reIsNative = RegExp('^' +
+ funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
+ );
+
+ /** Built-in value references. */
+ var Buffer = moduleExports ? context.Buffer : undefined,
+ Symbol = context.Symbol,
+ Uint8Array = context.Uint8Array,
+ allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
+ getPrototype = overArg(Object.getPrototypeOf, Object),
+ objectCreate = Object.create,
+ propertyIsEnumerable = objectProto.propertyIsEnumerable,
+ splice = arrayProto.splice,
+ spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
+ symIterator = Symbol ? Symbol.iterator : undefined,
+ symToStringTag = Symbol ? Symbol.toStringTag : undefined;
+
+ var defineProperty = (function() {
+ try {
+ var func = getNative(Object, 'defineProperty');
+ func({}, '', {});
+ return func;
+ } catch (e) {}
+ }());
+
+ /** Mocked built-ins. */
+ var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
+ ctxNow = Date && Date.now !== root.Date.now && Date.now,
+ ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
+
+ /* Built-in method references for those with the same name as other `lodash` methods. */
+ var nativeCeil = Math.ceil,
+ nativeFloor = Math.floor,
+ nativeGetSymbols = Object.getOwnPropertySymbols,
+ nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
+ nativeIsFinite = context.isFinite,
+ nativeJoin = arrayProto.join,
+ nativeKeys = overArg(Object.keys, Object),
+ nativeMax = Math.max,
+ nativeMin = Math.min,
+ nativeNow = Date.now,
+ nativeParseInt = context.parseInt,
+ nativeRandom = Math.random,
+ nativeReverse = arrayProto.reverse;
+
+ /* Built-in method references that are verified to be native. */
+ var DataView = getNative(context, 'DataView'),
+ Map = getNative(context, 'Map'),
+ Promise = getNative(context, 'Promise'),
+ Set = getNative(context, 'Set'),
+ WeakMap = getNative(context, 'WeakMap'),
+ nativeCreate = getNative(Object, 'create');
+
+ /** Used to store function metadata. */
+ var metaMap = WeakMap && new WeakMap;
+
+ /** Used to lookup unminified function names. */
+ var realNames = {};
+
+ /** Used to detect maps, sets, and weakmaps. */
+ var dataViewCtorString = toSource(DataView),
+ mapCtorString = toSource(Map),
+ promiseCtorString = toSource(Promise),
+ setCtorString = toSource(Set),
+ weakMapCtorString = toSource(WeakMap);
+
+ /** Used to convert symbols to primitives and strings. */
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
+ symbolToString = symbolProto ? symbolProto.toString : undefined;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a `lodash` object which wraps `value` to enable implicit method
+ * chain sequences. Methods that operate on and return arrays, collections,
+ * and functions can be chained together. Methods that retrieve a single value
+ * or may return a primitive value will automatically end the chain sequence
+ * and return the unwrapped value. Otherwise, the value must be unwrapped
+ * with `_#value`.
+ *
+ * Explicit chain sequences, which must be unwrapped with `_#value`, may be
+ * enabled using `_.chain`.
+ *
+ * The execution of chained methods is lazy, that is, it's deferred until
+ * `_#value` is implicitly or explicitly called.
+ *
+ * Lazy evaluation allows several methods to support shortcut fusion.
+ * Shortcut fusion is an optimization to merge iteratee calls; this avoids
+ * the creation of intermediate arrays and can greatly reduce the number of
+ * iteratee executions. Sections of a chain sequence qualify for shortcut
+ * fusion if the section is applied to an array and iteratees accept only
+ * one argument. The heuristic for whether a section qualifies for shortcut
+ * fusion is subject to change.
+ *
+ * Chaining is supported in custom builds as long as the `_#value` method is
+ * directly or indirectly included in the build.
+ *
+ * In addition to lodash methods, wrappers have `Array` and `String` methods.
+ *
+ * The wrapper `Array` methods are:
+ * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
+ *
+ * The wrapper `String` methods are:
+ * `replace` and `split`
+ *
+ * The wrapper methods that support shortcut fusion are:
+ * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
+ * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
+ * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
+ *
+ * The chainable wrapper methods are:
+ * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
+ * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
+ * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
+ * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
+ * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
+ * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
+ * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
+ * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
+ * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
+ * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
+ * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
+ * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
+ * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
+ * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
+ * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
+ * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
+ * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
+ * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
+ * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
+ * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
+ * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
+ * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
+ * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
+ * `zipObject`, `zipObjectDeep`, and `zipWith`
+ *
+ * The wrapper methods that are **not** chainable by default are:
+ * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
+ * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
+ * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
+ * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
+ * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
+ * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
+ * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
+ * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
+ * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
+ * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
+ * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
+ * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
+ * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
+ * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
+ * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
+ * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
+ * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
+ * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
+ * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
+ * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
+ * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
+ * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
+ * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
+ * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
+ * `upperFirst`, `value`, and `words`
+ *
+ * @name _
+ * @constructor
+ * @category Seq
+ * @param {*} value The value to wrap in a `lodash` instance.
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * function square(n) {
+ * return n * n;
+ * }
+ *
+ * var wrapped = _([1, 2, 3]);
+ *
+ * // Returns an unwrapped value.
+ * wrapped.reduce(_.add);
+ * // => 6
+ *
+ * // Returns a wrapped value.
+ * var squares = wrapped.map(square);
+ *
+ * _.isArray(squares);
+ * // => false
+ *
+ * _.isArray(squares.value());
+ * // => true
+ */
+ function lodash(value) {
+ if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
+ if (value instanceof LodashWrapper) {
+ return value;
+ }
+ if (hasOwnProperty.call(value, '__wrapped__')) {
+ return wrapperClone(value);
+ }
+ }
+ return new LodashWrapper(value);
+ }
+
+ /**
+ * The base implementation of `_.create` without support for assigning
+ * properties to the created object.
+ *
+ * @private
+ * @param {Object} proto The object to inherit from.
+ * @returns {Object} Returns the new object.
+ */
+ var baseCreate = (function() {
+ function object() {}
+ return function(proto) {
+ if (!isObject(proto)) {
+ return {};
+ }
+ if (objectCreate) {
+ return objectCreate(proto);
+ }
+ object.prototype = proto;
+ var result = new object;
+ object.prototype = undefined;
+ return result;
+ };
+ }());
+
+ /**
+ * The function whose prototype chain sequence wrappers inherit from.
+ *
+ * @private
+ */
+ function baseLodash() {
+ // No operation performed.
+ }
+
+ /**
+ * The base constructor for creating `lodash` wrapper objects.
+ *
+ * @private
+ * @param {*} value The value to wrap.
+ * @param {boolean} [chainAll] Enable explicit method chain sequences.
+ */
+ function LodashWrapper(value, chainAll) {
+ this.__wrapped__ = value;
+ this.__actions__ = [];
+ this.__chain__ = !!chainAll;
+ this.__index__ = 0;
+ this.__values__ = undefined;
+ }
+
+ /**
+ * By default, the template delimiters used by lodash are like those in
+ * embedded Ruby (ERB) as well as ES2015 template strings. Change the
+ * following template settings to use alternative delimiters.
+ *
+ * @static
+ * @memberOf _
+ * @type {Object}
+ */
+ lodash.templateSettings = {
+
+ /**
+ * Used to detect `data` property values to be HTML-escaped.
+ *
+ * @memberOf _.templateSettings
+ * @type {RegExp}
+ */
+ 'escape': reEscape,
+
+ /**
+ * Used to detect code to be evaluated.
+ *
+ * @memberOf _.templateSettings
+ * @type {RegExp}
+ */
+ 'evaluate': reEvaluate,
+
+ /**
+ * Used to detect `data` property values to inject.
+ *
+ * @memberOf _.templateSettings
+ * @type {RegExp}
+ */
+ 'interpolate': reInterpolate,
+
+ /**
+ * Used to reference the data object in the template text.
+ *
+ * @memberOf _.templateSettings
+ * @type {string}
+ */
+ 'variable': '',
+
+ /**
+ * Used to import variables into the compiled template.
+ *
+ * @memberOf _.templateSettings
+ * @type {Object}
+ */
+ 'imports': {
+
+ /**
+ * A reference to the `lodash` function.
+ *
+ * @memberOf _.templateSettings.imports
+ * @type {Function}
+ */
+ '_': lodash
+ }
+ };
+
+ // Ensure wrappers are instances of `baseLodash`.
+ lodash.prototype = baseLodash.prototype;
+ lodash.prototype.constructor = lodash;
+
+ LodashWrapper.prototype = baseCreate(baseLodash.prototype);
+ LodashWrapper.prototype.constructor = LodashWrapper;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
+ *
+ * @private
+ * @constructor
+ * @param {*} value The value to wrap.
+ */
+ function LazyWrapper(value) {
+ this.__wrapped__ = value;
+ this.__actions__ = [];
+ this.__dir__ = 1;
+ this.__filtered__ = false;
+ this.__iteratees__ = [];
+ this.__takeCount__ = MAX_ARRAY_LENGTH;
+ this.__views__ = [];
+ }
+
+ /**
+ * Creates a clone of the lazy wrapper object.
+ *
+ * @private
+ * @name clone
+ * @memberOf LazyWrapper
+ * @returns {Object} Returns the cloned `LazyWrapper` object.
+ */
+ function lazyClone() {
+ var result = new LazyWrapper(this.__wrapped__);
+ result.__actions__ = copyArray(this.__actions__);
+ result.__dir__ = this.__dir__;
+ result.__filtered__ = this.__filtered__;
+ result.__iteratees__ = copyArray(this.__iteratees__);
+ result.__takeCount__ = this.__takeCount__;
+ result.__views__ = copyArray(this.__views__);
+ return result;
+ }
+
+ /**
+ * Reverses the direction of lazy iteration.
+ *
+ * @private
+ * @name reverse
+ * @memberOf LazyWrapper
+ * @returns {Object} Returns the new reversed `LazyWrapper` object.
+ */
+ function lazyReverse() {
+ if (this.__filtered__) {
+ var result = new LazyWrapper(this);
+ result.__dir__ = -1;
+ result.__filtered__ = true;
+ } else {
+ result = this.clone();
+ result.__dir__ *= -1;
+ }
+ return result;
+ }
+
+ /**
+ * Extracts the unwrapped value from its lazy wrapper.
+ *
+ * @private
+ * @name value
+ * @memberOf LazyWrapper
+ * @returns {*} Returns the unwrapped value.
+ */
+ function lazyValue() {
+ var array = this.__wrapped__.value(),
+ dir = this.__dir__,
+ isArr = isArray(array),
+ isRight = dir < 0,
+ arrLength = isArr ? array.length : 0,
+ view = getView(0, arrLength, this.__views__),
+ start = view.start,
+ end = view.end,
+ length = end - start,
+ index = isRight ? end : (start - 1),
+ iteratees = this.__iteratees__,
+ iterLength = iteratees.length,
+ resIndex = 0,
+ takeCount = nativeMin(length, this.__takeCount__);
+
+ if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
+ return baseWrapperValue(array, this.__actions__);
+ }
+ var result = [];
+
+ outer:
+ while (length-- && resIndex < takeCount) {
+ index += dir;
+
+ var iterIndex = -1,
+ value = array[index];
+
+ while (++iterIndex < iterLength) {
+ var data = iteratees[iterIndex],
+ iteratee = data.iteratee,
+ type = data.type,
+ computed = iteratee(value);
+
+ if (type == LAZY_MAP_FLAG) {
+ value = computed;
+ } else if (!computed) {
+ if (type == LAZY_FILTER_FLAG) {
+ continue outer;
+ } else {
+ break outer;
+ }
+ }
+ }
+ result[resIndex++] = value;
+ }
+ return result;
+ }
+
+ // Ensure `LazyWrapper` is an instance of `baseLodash`.
+ LazyWrapper.prototype = baseCreate(baseLodash.prototype);
+ LazyWrapper.prototype.constructor = LazyWrapper;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a hash object.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+ function Hash(entries) {
+ var index = -1,
+ length = entries == null ? 0 : entries.length;
+
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+ }
+
+ /**
+ * Removes all key-value entries from the hash.
+ *
+ * @private
+ * @name clear
+ * @memberOf Hash
+ */
+ function hashClear() {
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
+ this.size = 0;
+ }
+
+ /**
+ * Removes `key` and its value from the hash.
+ *
+ * @private
+ * @name delete
+ * @memberOf Hash
+ * @param {Object} hash The hash to modify.
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+ function hashDelete(key) {
+ var result = this.has(key) && delete this.__data__[key];
+ this.size -= result ? 1 : 0;
+ return result;
+ }
+
+ /**
+ * Gets the hash value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf Hash
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+ function hashGet(key) {
+ var data = this.__data__;
+ if (nativeCreate) {
+ var result = data[key];
+ return result === HASH_UNDEFINED ? undefined : result;
+ }
+ return hasOwnProperty.call(data, key) ? data[key] : undefined;
+ }
+
+ /**
+ * Checks if a hash value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf Hash
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function hashHas(key) {
+ var data = this.__data__;
+ return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
+ }
+
+ /**
+ * Sets the hash `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf Hash
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the hash instance.
+ */
+ function hashSet(key, value) {
+ var data = this.__data__;
+ this.size += this.has(key) ? 0 : 1;
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
+ return this;
+ }
+
+ // Add methods to `Hash`.
+ Hash.prototype.clear = hashClear;
+ Hash.prototype['delete'] = hashDelete;
+ Hash.prototype.get = hashGet;
+ Hash.prototype.has = hashHas;
+ Hash.prototype.set = hashSet;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates an list cache object.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+ function ListCache(entries) {
+ var index = -1,
+ length = entries == null ? 0 : entries.length;
+
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+ }
+
+ /**
+ * Removes all key-value entries from the list cache.
+ *
+ * @private
+ * @name clear
+ * @memberOf ListCache
+ */
+ function listCacheClear() {
+ this.__data__ = [];
+ this.size = 0;
+ }
+
+ /**
+ * Removes `key` and its value from the list cache.
+ *
+ * @private
+ * @name delete
+ * @memberOf ListCache
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+ function listCacheDelete(key) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ if (index < 0) {
+ return false;
+ }
+ var lastIndex = data.length - 1;
+ if (index == lastIndex) {
+ data.pop();
+ } else {
+ splice.call(data, index, 1);
+ }
+ --this.size;
+ return true;
+ }
+
+ /**
+ * Gets the list cache value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf ListCache
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+ function listCacheGet(key) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ return index < 0 ? undefined : data[index][1];
+ }
+
+ /**
+ * Checks if a list cache value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf ListCache
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function listCacheHas(key) {
+ return assocIndexOf(this.__data__, key) > -1;
+ }
+
+ /**
+ * Sets the list cache `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf ListCache
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the list cache instance.
+ */
+ function listCacheSet(key, value) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ if (index < 0) {
+ ++this.size;
+ data.push([key, value]);
+ } else {
+ data[index][1] = value;
+ }
+ return this;
+ }
+
+ // Add methods to `ListCache`.
+ ListCache.prototype.clear = listCacheClear;
+ ListCache.prototype['delete'] = listCacheDelete;
+ ListCache.prototype.get = listCacheGet;
+ ListCache.prototype.has = listCacheHas;
+ ListCache.prototype.set = listCacheSet;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a map cache object to store key-value pairs.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+ function MapCache(entries) {
+ var index = -1,
+ length = entries == null ? 0 : entries.length;
+
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+ }
+
+ /**
+ * Removes all key-value entries from the map.
+ *
+ * @private
+ * @name clear
+ * @memberOf MapCache
+ */
+ function mapCacheClear() {
+ this.size = 0;
+ this.__data__ = {
+ 'hash': new Hash,
+ 'map': new (Map || ListCache),
+ 'string': new Hash
+ };
+ }
+
+ /**
+ * Removes `key` and its value from the map.
+ *
+ * @private
+ * @name delete
+ * @memberOf MapCache
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+ function mapCacheDelete(key) {
+ var result = getMapData(this, key)['delete'](key);
+ this.size -= result ? 1 : 0;
+ return result;
+ }
+
+ /**
+ * Gets the map value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf MapCache
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+ function mapCacheGet(key) {
+ return getMapData(this, key).get(key);
+ }
+
+ /**
+ * Checks if a map value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf MapCache
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function mapCacheHas(key) {
+ return getMapData(this, key).has(key);
+ }
+
+ /**
+ * Sets the map `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf MapCache
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the map cache instance.
+ */
+ function mapCacheSet(key, value) {
+ var data = getMapData(this, key),
+ size = data.size;
+
+ data.set(key, value);
+ this.size += data.size == size ? 0 : 1;
+ return this;
+ }
+
+ // Add methods to `MapCache`.
+ MapCache.prototype.clear = mapCacheClear;
+ MapCache.prototype['delete'] = mapCacheDelete;
+ MapCache.prototype.get = mapCacheGet;
+ MapCache.prototype.has = mapCacheHas;
+ MapCache.prototype.set = mapCacheSet;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ *
+ * Creates an array cache object to store unique values.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [values] The values to cache.
+ */
+ function SetCache(values) {
+ var index = -1,
+ length = values == null ? 0 : values.length;
+
+ this.__data__ = new MapCache;
+ while (++index < length) {
+ this.add(values[index]);
+ }
+ }
+
+ /**
+ * Adds `value` to the array cache.
+ *
+ * @private
+ * @name add
+ * @memberOf SetCache
+ * @alias push
+ * @param {*} value The value to cache.
+ * @returns {Object} Returns the cache instance.
+ */
+ function setCacheAdd(value) {
+ this.__data__.set(value, HASH_UNDEFINED);
+ return this;
+ }
+
+ /**
+ * Checks if `value` is in the array cache.
+ *
+ * @private
+ * @name has
+ * @memberOf SetCache
+ * @param {*} value The value to search for.
+ * @returns {number} Returns `true` if `value` is found, else `false`.
+ */
+ function setCacheHas(value) {
+ return this.__data__.has(value);
+ }
+
+ // Add methods to `SetCache`.
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
+ SetCache.prototype.has = setCacheHas;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a stack cache object to store key-value pairs.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+ function Stack(entries) {
+ var data = this.__data__ = new ListCache(entries);
+ this.size = data.size;
+ }
+
+ /**
+ * Removes all key-value entries from the stack.
+ *
+ * @private
+ * @name clear
+ * @memberOf Stack
+ */
+ function stackClear() {
+ this.__data__ = new ListCache;
+ this.size = 0;
+ }
+
+ /**
+ * Removes `key` and its value from the stack.
+ *
+ * @private
+ * @name delete
+ * @memberOf Stack
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+ function stackDelete(key) {
+ var data = this.__data__,
+ result = data['delete'](key);
+
+ this.size = data.size;
+ return result;
+ }
+
+ /**
+ * Gets the stack value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf Stack
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+ function stackGet(key) {
+ return this.__data__.get(key);
+ }
+
+ /**
+ * Checks if a stack value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf Stack
+ * @param {string} key The key of the entry to check.
... 126237 lines suppressed ...