diff --git a/README.md b/README.md index a18b34110..aaaba6174 100644 --- a/README.md +++ b/README.md @@ -337,7 +337,7 @@ options: `fetch` mode ,else `XMLHttpRequest` - [enableProxy] {Boolean}, Enable proxy request, default is false. - [proxy] {String | Object}, proxy agent uri or options, default is null. -- [retryMax] {Number}, used by auto retry send request count when request error is net error or timeout. +- [retryMax] {Number}, used by auto retry send request count when request error is net error or timeout. **_NOTE:_** Not support `put` with stream, `putStream`, `append` with stream because the stream can only be consumed once example: @@ -396,6 +396,19 @@ const store = new OSS({ }); ``` +5. retry request with stream +```js +for (let i = 0; i <= store.options.retryMax; i++) { + try { + const result = await store.putStream("", fs.createReadStream("")); + console.log(result); + break; // break if success + } catch (e) { + console.log(e); + } +} +``` + ## Bucket Operations ### .listBuckets(query[, options]) diff --git a/dist/aliyun-oss-sdk.js b/dist/aliyun-oss-sdk.js index cd83dbc40..1087528f7 100644 --- a/dist/aliyun-oss-sdk.js +++ b/dist/aliyun-oss-sdk.js @@ -1,4 +1,4 @@ -// Aliyun OSS SDK for JavaScript v6.13.0 +// Aliyun OSS SDK for JavaScript v6.13.1 // Copyright Aliyun.com, Inc. or its affiliates. All Rights Reserved. // License at https://github.com/ali-sdk/ali-oss/blob/master/LICENSE (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.OSS = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 2 && _args8[2] !== undefined ? _args8[2] : {}; - writeStream = null; - needDestroy = false; - - if (is.writableStream(file)) { - writeStream = file; - } else if (is.string(file)) { - writeStream = fs.createWriteStream(file); - needDestroy = true; - } else { - // get(name, options) - options = file; - } - - options = options || {}; - responseCacheControl = options.responseCacheControl === null ? '' : 'no-cache'; - options.subres = Object.assign(responseCacheControl ? { - 'response-cache-control': responseCacheControl - } : {}, options.subres); - - if (options.versionId) { - options.subres.versionId = options.versionId; - } - - if (options.process) { - options.subres['x-oss-process'] = options.process; - } - - _context8.prev = 9; - params = this._objectRequestParams('GET', name, options); - params.writeStream = writeStream; - params.successStatuses = [200, 206, 304]; - _context8.next = 15; - return this.request(params); - - case 15: - result = _context8.sent; - - if (needDestroy) { - writeStream.destroy(); - } - _context8.next = 26; - break; - - case 19: - _context8.prev = 19; - _context8.t0 = _context8["catch"](9); - - if (!needDestroy) { - _context8.next = 25; - break; - } - - writeStream.destroy(); // should delete the exists file before throw error - - _context8.next = 25; - return this._deleteFileSafe(file); - - case 25: - throw _context8.t0; - - case 26: - return _context8.abrupt("return", { - res: result.res, - content: result.data - }); - - case 27: - case "end": - return _context8.stop(); - } - } - }, _callee8, this, [[9, 19]]); - })); - - function get(_x18, _x19) { - return _get.apply(this, arguments); - } - - return get; -}(); - -},{"../common/callback":23,"../common/image":26,"../common/object/copyObject":29,"../common/object/delete":30,"../common/object/deleteMulti":31,"../common/object/deleteObjectTagging":32,"../common/object/generateObjectUrl":33,"../common/object/get":34,"../common/object/getACL":35,"../common/object/getBucketVersions":36,"../common/object/getObjectMeta":37,"../common/object/getObjectTagging":38,"../common/object/getObjectUrl":39,"../common/object/getSymlink":40,"../common/object/head":41,"../common/object/putACL":42,"../common/object/putObjectTagging":43,"../common/object/putSymlink":44,"../common/object/signatureUrl":45,"../common/utils/isBlob":60,"../common/utils/isBuffer":61,"../common/utils/isFile":62,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"copy-to":101,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.map":245,"core-js/modules/es.function.name":249,"core-js/modules/es.number.constructor":250,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"fs":78,"is-type-of":392,"merge-descriptors":311,"mime":313,"path":316,"regenerator-runtime/runtime":337}],5:[function(require,module,exports){ +},{"../common/callback":23,"../common/image":26,"../common/object/copyObject":29,"../common/object/delete":30,"../common/object/deleteMulti":31,"../common/object/deleteObjectTagging":32,"../common/object/generateObjectUrl":33,"../common/object/get":34,"../common/object/getACL":35,"../common/object/getBucketVersions":36,"../common/object/getObjectMeta":37,"../common/object/getObjectTagging":38,"../common/object/getObjectUrl":39,"../common/object/getSymlink":40,"../common/object/head":41,"../common/object/putACL":42,"../common/object/putObjectTagging":43,"../common/object/putSymlink":44,"../common/object/signatureUrl":45,"../common/utils/isBlob":60,"../common/utils/isBuffer":61,"../common/utils/isFile":62,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"copy-to":103,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.map":247,"core-js/modules/es.function.name":251,"core-js/modules/es.number.constructor":252,"core-js/modules/es.object.assign":253,"core-js/modules/es.object.keys":255,"core-js/modules/es.object.to-string":256,"core-js/modules/es.promise":257,"core-js/modules/es.regexp.exec":258,"core-js/modules/es.regexp.to-string":259,"core-js/modules/es.string.replace":263,"core-js/modules/web.dom-collections.for-each":294,"fs":78,"merge-descriptors":313,"mime":315,"path":80,"regenerator-runtime/runtime":338}],5:[function(require,module,exports){ "use strict"; -exports.version = "6.13.0"; +exports.version = "6.13.1"; },{}],6:[function(require,module,exports){ "use strict"; @@ -2149,7 +2031,7 @@ function _abortBucketWorm() { exports.abortBucketWorm = abortBucketWorm; -},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],7:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":338}],7:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2204,7 +2086,7 @@ function _completeBucketWorm() { exports.completeBucketWorm = completeBucketWorm; -},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],8:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":338}],8:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2276,7 +2158,7 @@ function _deleteBucketInventory() { exports.deleteBucketInventory = deleteBucketInventory; -},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],9:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],9:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2327,7 +2209,7 @@ proto.deleteBucketLifecycle = /*#__PURE__*/function () { return deleteBucketLifecycle; }(); -},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],10:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":338}],10:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2378,7 +2260,7 @@ proto.deleteBucketWebsite = /*#__PURE__*/function () { return deleteBucketWebsite; }(); -},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],11:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":338}],11:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2446,7 +2328,7 @@ function _extendBucketWorm() { exports.extendBucketWorm = extendBucketWorm; -},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],12:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":338}],12:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2522,7 +2404,7 @@ function _getBucketInventory() { exports.getBucketInventory = getBucketInventory; -},{"../utils/checkBucketName":48,"../utils/formatInventoryConfig":56,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],13:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/formatInventoryConfig":56,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],13:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2604,7 +2486,7 @@ proto.getBucketLifecycle = /*#__PURE__*/function () { return getBucketLifecycle; }(); -},{"../utils/checkBucketName":48,"../utils/formatObjKey":57,"../utils/isArray":59,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.map":245,"regenerator-runtime/runtime":337}],14:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/formatObjKey":57,"../utils/isArray":59,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.map":247,"regenerator-runtime/runtime":338}],14:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2663,7 +2545,7 @@ proto.getBucketVersioning = /*#__PURE__*/function () { return getBucketVersioning; }(); -},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],15:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":338}],15:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2733,7 +2615,7 @@ proto.getBucketWebsite = /*#__PURE__*/function () { return getBucketWebsite; }(); -},{"../utils/checkBucketName":48,"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],16:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":338}],16:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2798,7 +2680,7 @@ function _getBucketWorm() { exports.getBucketWorm = getBucketWorm; -},{"../utils/checkBucketName":48,"../utils/dataFix":53,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],17:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/dataFix":53,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],17:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2864,7 +2746,7 @@ function _initiateBucketWorm() { exports.initiateBucketWorm = initiateBucketWorm; -},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],18:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":338}],18:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2949,7 +2831,7 @@ function _listBucketInventory() { exports.listBucketInventory = listBucketInventory; -},{"../utils/checkBucketName":48,"../utils/formatInventoryConfig":56,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],19:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/formatInventoryConfig":56,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],19:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -3067,7 +2949,7 @@ function _putBucketInventory() { exports.putBucketInventory = putBucketInventory; -},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":234,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],20:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":236,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],20:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -3252,7 +3134,7 @@ function checkRule(rule) { } } -},{"../utils/checkBucketName":48,"../utils/checkObjectTag":50,"../utils/deepCopy":54,"../utils/getStrBytesCount":58,"../utils/isArray":59,"../utils/isObject":64,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],21:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/checkObjectTag":50,"../utils/deepCopy":54,"../utils/getStrBytesCount":58,"../utils/isArray":59,"../utils/isObject":64,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.includes":242,"core-js/modules/web.dom-collections.for-each":294,"regenerator-runtime/runtime":338}],21:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -3337,7 +3219,7 @@ proto.putBucketVersioning = /*#__PURE__*/function () { return putBucketVersioning; }(); -},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.includes":240,"regenerator-runtime/runtime":337}],22:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.includes":242,"regenerator-runtime/runtime":338}],22:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -3449,7 +3331,7 @@ proto.putBucketWebsite = /*#__PURE__*/function () { return putBucketWebsite; }(); -},{"../utils/checkBucketName":48,"../utils/isArray":59,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],23:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/isArray":59,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":338}],23:[function(require,module,exports){ (function (Buffer){ "use strict"; @@ -3496,7 +3378,7 @@ exports.encodeCallback = function encodeCallback(reqParams, options) { }; }).call(this,require("buffer").Buffer) -},{"buffer":98,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257,"core-js/modules/web.dom-collections.for-each":292}],24:[function(require,module,exports){ +},{"buffer":79,"core-js/modules/es.array.for-each":240,"core-js/modules/es.object.keys":255,"core-js/modules/es.object.to-string":256,"core-js/modules/es.regexp.to-string":259,"core-js/modules/web.dom-collections.for-each":294}],24:[function(require,module,exports){ "use strict"; require("core-js/modules/es.array.concat"); @@ -3582,7 +3464,7 @@ function getReqUrl(params) { exports.getReqUrl = getReqUrl; -},{"../utils/checkConfigValid":49,"../utils/isIP":63,"copy-to":101,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"is-type-of":392,"merge-descriptors":311,"url":394}],25:[function(require,module,exports){ +},{"../utils/checkConfigValid":49,"../utils/isIP":63,"copy-to":103,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.for-each":240,"core-js/modules/es.regexp.exec":258,"core-js/modules/es.string.replace":263,"core-js/modules/web.dom-collections.for-each":294,"is-type-of":392,"merge-descriptors":313,"url":394}],25:[function(require,module,exports){ "use strict"; require("core-js/modules/es.array.concat"); @@ -3624,6 +3506,10 @@ module.exports = function (options) { throw new Error('require accessKeyId, accessKeySecret'); } + if (options.stsToken && !options.refreshSTSToken) { + console.warn("It's recommended to set `refreshSTSToken` to refresh stsToken、accessKeyId、accessKeySecret automatically when sts info expires"); + } + if (options.bucket) { _checkBucketName(options.bucket); } @@ -3660,7 +3546,7 @@ module.exports = function (options) { return opts; }; -},{"../utils/checkBucketName":48,"../utils/checkConfigValid":49,"../utils/setRegion":68,"core-js/modules/es.array.concat":234,"core-js/modules/es.object.assign":251,"core-js/modules/es.string.trim":265,"humanize-ms":299,"url":394}],26:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"../utils/checkConfigValid":49,"../utils/setRegion":68,"core-js/modules/es.array.concat":236,"core-js/modules/es.object.assign":253,"core-js/modules/es.string.trim":267,"humanize-ms":301,"url":394}],26:[function(require,module,exports){ "use strict"; var merge = require('merge-descriptors'); @@ -3668,7 +3554,7 @@ var merge = require('merge-descriptors'); var proto = exports; merge(proto, require('./processObjectSave')); -},{"./processObjectSave":27,"merge-descriptors":311}],27:[function(require,module,exports){ +},{"./processObjectSave":27,"merge-descriptors":313}],27:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -3752,7 +3638,7 @@ function checkArgs(name, key) { } } -},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":234,"js-base64":310,"querystring":323,"regenerator-runtime/runtime":337}],28:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":236,"js-base64":312,"querystring":324,"regenerator-runtime/runtime":338}],28:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -4025,22 +3911,33 @@ proto.initMultipartUpload = /*#__PURE__*/function () { proto.uploadPart = /*#__PURE__*/function () { var _uploadPart2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(name, uploadId, partNo, file, start, end, options) { - var data; + var mayBeBufferOrStream, data; return _regenerator.default.wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: + _context5.next = 2; + return this._createStream(file, start, end); + + case 2: + mayBeBufferOrStream = _context5.sent; data = { - stream: this._createStream(file, start, end), size: end - start }; - _context5.next = 3; + + if (isBuffer(mayBeBufferOrStream)) { + data.content = mayBeBufferOrStream; + } else { + data.stream = mayBeBufferOrStream; + } + + _context5.next = 7; return this._uploadPart(name, uploadId, partNo, data, options); - case 3: + case 7: return _context5.abrupt("return", _context5.sent); - case 4: + case 8: case "end": return _context5.stop(); } @@ -4178,7 +4075,13 @@ proto._uploadPart = /*#__PURE__*/function () { }; params = this._objectRequestParams('PUT', name, opt); params.mime = opt.mime; - params.stream = data.stream; + + if (data.stream) { + params.stream = data.stream; + } else if (data.content) { + params.content = data.content; + } + params.successStatuses = [200]; _context7.next = 11; return this.request(params); @@ -4194,15 +4097,18 @@ proto._uploadPart = /*#__PURE__*/function () { throw new Error('Please set the etag of expose-headers in OSS \n https://help.aliyun.com/document_detail/32069.html'); case 14: - data.stream = null; - params.stream = null; + if (data.stream) { + data.stream = null; + params.stream = null; + } + return _context7.abrupt("return", { name: name, etag: result.res.headers.etag, res: result.res }); - case 17: + case 16: case "end": return _context7.stop(); } @@ -4217,7 +4123,7 @@ proto._uploadPart = /*#__PURE__*/function () { return _uploadPart; }(); -},{"./callback":23,"./utils/deepCopy":54,"./utils/isBuffer":61,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"copy-to":101,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.filter":236,"core-js/modules/es.array.map":245,"core-js/modules/es.array.sort":247,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257,"regenerator-runtime/runtime":337}],29:[function(require,module,exports){ +},{"./callback":23,"./utils/deepCopy":54,"./utils/isBuffer":61,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"copy-to":103,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.filter":238,"core-js/modules/es.array.map":247,"core-js/modules/es.array.sort":249,"core-js/modules/es.object.to-string":256,"core-js/modules/es.regexp.to-string":259,"regenerator-runtime/runtime":338}],29:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -4339,7 +4245,7 @@ proto._getSourceName = function _getSourceName(sourceName, bucketName) { return sourceName; }; -},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.find":237,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],30:[function(require,module,exports){ +},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.find":239,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.includes":242,"core-js/modules/es.object.keys":255,"core-js/modules/es.regexp.exec":258,"core-js/modules/es.string.replace":263,"core-js/modules/web.dom-collections.for-each":294,"regenerator-runtime/runtime":338}],30:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -4403,7 +4309,7 @@ proto.delete = /*#__PURE__*/function () { return _delete; }(); -},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],31:[function(require,module,exports){ +},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],31:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -4526,7 +4432,7 @@ proto.deleteMulti = /*#__PURE__*/function () { return deleteMulti; }(); -},{"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337,"utility":396}],32:[function(require,module,exports){ +},{"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338,"utility":396}],32:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -4593,7 +4499,7 @@ proto.deleteObjectTagging = /*#__PURE__*/function () { return deleteObjectTagging; }(); -},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],33:[function(require,module,exports){ +},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],33:[function(require,module,exports){ "use strict"; require("core-js/modules/es.array.concat"); @@ -4630,7 +4536,8 @@ proto.generateObjectUrl = function generateObjectUrl(name, baseUrl) { return baseUrl + this._escape(this._objectName(name)); }; -},{"../utils/isIP":63,"core-js/modules/es.array.concat":234,"url":394}],34:[function(require,module,exports){ +},{"../utils/isIP":63,"core-js/modules/es.array.concat":236,"url":394}],34:[function(require,module,exports){ +(function (process){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -4661,6 +4568,9 @@ proto.get = /*#__PURE__*/function () { var options, writeStream, needDestroy, + isBrowserEnv, + responseCacheControl, + defaultSubresOptions, result, params, _args = arguments; @@ -4683,9 +4593,12 @@ proto.get = /*#__PURE__*/function () { } options = options || {}; - options.subres = Object.assign({ - 'response-cache-control': 'no-cache' - }, options.subres); + isBrowserEnv = process && process.browser; + responseCacheControl = options.responseCacheControl === null ? '' : 'no-cache'; + defaultSubresOptions = isBrowserEnv && responseCacheControl ? { + 'response-cache-control': responseCacheControl + } : {}; + options.subres = Object.assign(defaultSubresOptions, options.subres); if (options.versionId) { options.subres.versionId = options.versionId; @@ -4695,52 +4608,52 @@ proto.get = /*#__PURE__*/function () { options.subres['x-oss-process'] = options.process; } - _context.prev = 8; + _context.prev = 11; params = this._objectRequestParams('GET', name, options); params.writeStream = writeStream; params.successStatuses = [200, 206, 304]; - _context.next = 14; + _context.next = 17; return this.request(params); - case 14: + case 17: result = _context.sent; if (needDestroy) { writeStream.destroy(); } - _context.next = 25; + _context.next = 28; break; - case 18: - _context.prev = 18; - _context.t0 = _context["catch"](8); + case 21: + _context.prev = 21; + _context.t0 = _context["catch"](11); if (!needDestroy) { - _context.next = 24; + _context.next = 27; break; } writeStream.destroy(); // should delete the exists file before throw error - _context.next = 24; + _context.next = 27; return this._deleteFileSafe(file); - case 24: + case 27: throw _context.t0; - case 25: + case 28: return _context.abrupt("return", { res: result.res, content: result.data }); - case 26: + case 29: case "end": return _context.stop(); } } - }, _callee, this, [[8, 18]]); + }, _callee, this, [[11, 21]]); })); function get(_x, _x2) { @@ -4750,7 +4663,8 @@ proto.get = /*#__PURE__*/function () { return get; }(); -},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"fs":78,"is-type-of":392,"regenerator-runtime/runtime":337}],35:[function(require,module,exports){ +}).call(this,require('_process')) +},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"_process":393,"core-js/modules/es.object.assign":253,"fs":78,"is-type-of":392,"regenerator-runtime/runtime":338}],35:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -4823,7 +4737,7 @@ proto.getACL = /*#__PURE__*/function () { return getACL; }(); -},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],36:[function(require,module,exports){ +},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],36:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -5008,7 +4922,7 @@ function formatQuery() { return obj; } -},{"../utils/isArray":59,"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.map":245,"core-js/modules/es.number.constructor":250,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],37:[function(require,module,exports){ +},{"../utils/isArray":59,"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.map":247,"core-js/modules/es.number.constructor":252,"core-js/modules/es.object.assign":253,"core-js/modules/es.object.keys":255,"core-js/modules/es.regexp.exec":258,"core-js/modules/es.string.replace":263,"core-js/modules/web.dom-collections.for-each":294,"regenerator-runtime/runtime":338}],37:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -5073,7 +4987,7 @@ proto.getObjectMeta = /*#__PURE__*/function () { return getObjectMeta; }(); -},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],38:[function(require,module,exports){ +},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],38:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -5164,7 +5078,7 @@ proto.getObjectTagging = /*#__PURE__*/function () { return getObjectTagging; }(); -},{"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.assign":251,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],39:[function(require,module,exports){ +},{"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":240,"core-js/modules/es.object.assign":253,"core-js/modules/web.dom-collections.for-each":294,"regenerator-runtime/runtime":338}],39:[function(require,module,exports){ "use strict"; var _require = require('../utils/isIP'), @@ -5263,7 +5177,7 @@ proto.getSymlink = /*#__PURE__*/function () { return getSymlink; }(); -},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],41:[function(require,module,exports){ +},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],41:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -5352,7 +5266,7 @@ proto.head = /*#__PURE__*/function () { return head; }(); -},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.index-of":241,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],42:[function(require,module,exports){ +},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.index-of":243,"core-js/modules/es.object.assign":253,"core-js/modules/es.object.keys":255,"core-js/modules/web.dom-collections.for-each":294,"regenerator-runtime/runtime":338}],42:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -5418,7 +5332,7 @@ proto.putACL = /*#__PURE__*/function () { return putACL; }(); -},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],43:[function(require,module,exports){ +},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],43:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -5513,7 +5427,7 @@ proto.putObjectTagging = /*#__PURE__*/function () { return putObjectTagging; }(); -},{"../utils/checkObjectTag":50,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.map":245,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"regenerator-runtime/runtime":337}],44:[function(require,module,exports){ +},{"../utils/checkObjectTag":50,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.map":247,"core-js/modules/es.object.assign":253,"core-js/modules/es.object.keys":255,"regenerator-runtime/runtime":338}],44:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -5588,7 +5502,7 @@ proto.putSymlink = /*#__PURE__*/function () { return putSymlink; }(); -},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],45:[function(require,module,exports){ +},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":253,"regenerator-runtime/runtime":338}],45:[function(require,module,exports){ "use strict"; var urlutil = require('url'); @@ -5636,7 +5550,7 @@ proto.signatureUrl = function signatureUrl(name, options) { return url.format(); }; -},{"../../common/signUtils":47,"../utils/isIP":63,"copy-to":101,"url":394,"utility":396}],46:[function(require,module,exports){ +},{"../../common/signUtils":47,"../utils/isIP":63,"copy-to":103,"url":394,"utility":396}],46:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -5911,7 +5825,7 @@ proto._makeAbortEvent = function _makeAbortEvent() { return abortEvent; }; -},{"./utils/isArray":59,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.iterator":242,"core-js/modules/es.function.name":249,"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255,"core-js/modules/es.string.iterator":259,"core-js/modules/web.dom-collections.for-each":292,"core-js/modules/web.dom-collections.iterator":293,"regenerator-runtime/runtime":337}],47:[function(require,module,exports){ +},{"./utils/isArray":59,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.iterator":244,"core-js/modules/es.function.name":251,"core-js/modules/es.object.to-string":256,"core-js/modules/es.promise":257,"core-js/modules/es.string.iterator":261,"core-js/modules/web.dom-collections.for-each":294,"core-js/modules/web.dom-collections.iterator":295,"regenerator-runtime/runtime":338}],47:[function(require,module,exports){ (function (Buffer){ "use strict"; @@ -6123,7 +6037,7 @@ exports._signatureForURL = function _signatureForURL(accessKeySecret) { }; }).call(this,require("buffer").Buffer) -},{"./../../shims/crypto/crypto.js":387,"./utils/lowercaseKeyHeader":65,"buffer":98,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.index-of":241,"core-js/modules/es.array.join":243,"core-js/modules/es.array.sort":247,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.trim":265,"core-js/modules/web.dom-collections.for-each":292,"is-type-of":392}],48:[function(require,module,exports){ +},{"./../../shims/crypto/crypto.js":387,"./utils/lowercaseKeyHeader":65,"buffer":79,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.index-of":243,"core-js/modules/es.array.join":245,"core-js/modules/es.array.sort":249,"core-js/modules/es.object.keys":255,"core-js/modules/es.object.to-string":256,"core-js/modules/es.regexp.to-string":259,"core-js/modules/es.string.trim":267,"core-js/modules/web.dom-collections.for-each":294,"is-type-of":392}],48:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6242,7 +6156,7 @@ function checkObjectTag(tag) { exports.checkObjectTag = checkObjectTag; -},{"./checkValid":51,"./isObject":64,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.entries":252,"core-js/modules/web.dom-collections.for-each":292}],51:[function(require,module,exports){ +},{"./checkValid":51,"./isObject":64,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.for-each":240,"core-js/modules/es.object.entries":254,"core-js/modules/web.dom-collections.for-each":294}],51:[function(require,module,exports){ "use strict"; require("core-js/modules/es.array.for-each"); @@ -6266,7 +6180,7 @@ function checkValid(_value, _rules) { exports.checkValid = checkValid; -},{"core-js/modules/es.array.for-each":238,"core-js/modules/web.dom-collections.for-each":292}],52:[function(require,module,exports){ +},{"core-js/modules/es.array.for-each":240,"core-js/modules/web.dom-collections.for-each":294}],52:[function(require,module,exports){ (function (Buffer){ "use strict"; @@ -6420,7 +6334,7 @@ function createRequest(params) { exports.createRequest = createRequest; }).call(this,require("buffer").Buffer) -},{"../client/getReqUrl":24,"./../../../shims/crypto/crypto.js":387,"./encoder":55,"./isIP":63,"./setRegion":68,"buffer":98,"copy-to":101,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.includes":240,"core-js/modules/es.array.index-of":241,"core-js/modules/es.object.assign":251,"core-js/modules/es.string.includes":258,"dateformat":295,"debug":391,"mime":313,"path":316}],53:[function(require,module,exports){ +},{"../client/getReqUrl":24,"./../../../shims/crypto/crypto.js":387,"./encoder":55,"./isIP":63,"./setRegion":68,"buffer":79,"copy-to":103,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.includes":242,"core-js/modules/es.array.index-of":243,"core-js/modules/es.object.assign":253,"core-js/modules/es.string.includes":260,"dateformat":297,"debug":391,"mime":315,"path":80}],53:[function(require,module,exports){ "use strict"; require("core-js/modules/es.array.for-each"); @@ -6519,7 +6433,7 @@ function fixLowerFirst(o, lowerFirst) { } } -},{"./isObject":64,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/es.object.entries":252,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292}],54:[function(require,module,exports){ +},{"./isObject":64,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.includes":242,"core-js/modules/es.object.entries":254,"core-js/modules/es.object.keys":255,"core-js/modules/es.regexp.exec":258,"core-js/modules/es.string.replace":263,"core-js/modules/web.dom-collections.for-each":294}],54:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -6567,7 +6481,7 @@ exports.deepCopyWith = function (obj, customizer) { } if (isBuffer_1.isBuffer(value)) { - return obj.slice(); + return value.slice(); } var copy = Array.isArray(value) ? [] : {}; @@ -6584,7 +6498,7 @@ exports.deepCopyWith = function (obj, customizer) { } }; -},{"./isBuffer":61,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.slice":246,"core-js/modules/es.object.keys":253,"core-js/modules/web.dom-collections.for-each":292}],55:[function(require,module,exports){ +},{"./isBuffer":61,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.slice":248,"core-js/modules/es.object.keys":255,"core-js/modules/web.dom-collections.for-each":294}],55:[function(require,module,exports){ (function (Buffer){ "use strict"; @@ -6606,7 +6520,7 @@ function encoder(str) { exports.encoder = encoder; }).call(this,require("buffer").Buffer) -},{"buffer":98,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257}],56:[function(require,module,exports){ +},{"buffer":79,"core-js/modules/es.object.to-string":256,"core-js/modules/es.regexp.to-string":259}],56:[function(require,module,exports){ "use strict"; require("core-js/modules/es.array.map"); @@ -6674,7 +6588,7 @@ function formatFn(_) { return _; } -},{"../utils/dataFix":53,"../utils/formatObjKey":57,"../utils/isArray":59,"../utils/isObject":64,"core-js/modules/es.array.map":245,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261}],57:[function(require,module,exports){ +},{"../utils/dataFix":53,"../utils/formatObjKey":57,"../utils/isArray":59,"../utils/isObject":64,"core-js/modules/es.array.map":247,"core-js/modules/es.regexp.exec":258,"core-js/modules/es.string.replace":263}],57:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -6743,7 +6657,7 @@ function handelFormat(key, type, options) { return key; } -},{"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.includes":258,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292}],58:[function(require,module,exports){ +},{"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.includes":242,"core-js/modules/es.object.keys":255,"core-js/modules/es.regexp.exec":258,"core-js/modules/es.string.includes":260,"core-js/modules/es.string.replace":263,"core-js/modules/web.dom-collections.for-each":294}],58:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6785,7 +6699,7 @@ exports.isArray = function (obj) { return Object.prototype.toString.call(obj) === '[object Array]'; }; -},{"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257}],60:[function(require,module,exports){ +},{"core-js/modules/es.object.to-string":256,"core-js/modules/es.regexp.to-string":259}],60:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6815,7 +6729,7 @@ function isBuffer(obj) { exports.isBuffer = isBuffer; }).call(this,{"isBuffer":require("../../../node_modules/is-buffer/index.js")}) -},{"../../../node_modules/is-buffer/index.js":308}],62:[function(require,module,exports){ +},{"../../../node_modules/is-buffer/index.js":310}],62:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6863,7 +6777,7 @@ exports.isObject = function (obj) { return Object.prototype.toString.call(obj) === '[object Object]'; }; -},{"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257}],65:[function(require,module,exports){ +},{"core-js/modules/es.object.to-string":256,"core-js/modules/es.regexp.to-string":259}],65:[function(require,module,exports){ "use strict"; require("core-js/modules/es.array.for-each"); @@ -6893,7 +6807,7 @@ function lowercaseKeyHeader(headers) { exports.lowercaseKeyHeader = lowercaseKeyHeader; -},{"./isObject":64,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.keys":253,"core-js/modules/web.dom-collections.for-each":292}],66:[function(require,module,exports){ +},{"./isObject":64,"core-js/modules/es.array.for-each":240,"core-js/modules/es.object.keys":255,"core-js/modules/web.dom-collections.for-each":294}],66:[function(require,module,exports){ "use strict"; require("core-js/modules/es.array.concat"); @@ -6964,7 +6878,7 @@ function obj2xml(obj, options) { exports.obj2xml = obj2xml; -},{"./formatObjKey":57,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.join":243,"core-js/modules/es.array.map":245,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292}],67:[function(require,module,exports){ +},{"./formatObjKey":57,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.for-each":240,"core-js/modules/es.array.join":245,"core-js/modules/es.array.map":247,"core-js/modules/es.object.keys":255,"core-js/modules/es.object.to-string":256,"core-js/modules/es.regexp.exec":258,"core-js/modules/es.regexp.to-string":259,"core-js/modules/es.string.replace":263,"core-js/modules/web.dom-collections.for-each":294}],67:[function(require,module,exports){ "use strict"; require("core-js/modules/es.object.to-string"); @@ -7014,7 +6928,7 @@ function retry(func, retryMax) { exports.retry = retry; -},{"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255}],68:[function(require,module,exports){ +},{"core-js/modules/es.object.to-string":256,"core-js/modules/es.promise":257}],68:[function(require,module,exports){ "use strict"; var __importDefault = void 0 && (void 0).__importDefault || function (mod) { @@ -7125,7 +7039,7 @@ function checkCredentials(obj) { }); } -},{"./formatObjKey":57,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.find":237,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"regenerator-runtime/runtime":337}],70:[function(require,module,exports){ +},{"./formatObjKey":57,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.find":239,"core-js/modules/es.array.for-each":240,"core-js/modules/es.object.assign":253,"core-js/modules/es.object.keys":255,"regenerator-runtime/runtime":338}],70:[function(require,module,exports){ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); @@ -8752,998 +8666,1791 @@ function fromByteArray (uint8) { },{}],78:[function(require,module,exports){ },{}],79:[function(require,module,exports){ -(function (global){ -var ClientRequest = require('./lib/request') -var response = require('./lib/response') -var extend = require('xtend') -var statusCodes = require('builtin-status-codes') -var url = require('url') - -var http = exports - -http.request = function (opts, cb) { - if (typeof opts === 'string') - opts = url.parse(opts) - else - opts = extend(opts) +(function (Buffer){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ - // Normally, the page is loaded from http or https, so not specifying a protocol - // will result in a (valid) protocol-relative url. However, this won't work if - // the protocol is something else, like 'file:' - var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' +'use strict' - var protocol = opts.protocol || defaultProtocol - var host = opts.hostname || opts.host - var port = opts.port - var path = opts.path || '/' +var base64 = require('base64-js') +var ieee754 = require('ieee754') - // Necessary for IPv6 addresses - if (host && host.indexOf(':') !== -1) - host = '[' + host + ']' +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 - // This may be a relative url. The browser should always be able to interpret it correctly. - opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path - opts.method = (opts.method || 'GET').toUpperCase() - opts.headers = opts.headers || {} +var K_MAX_LENGTH = 0x7fffffff +exports.kMaxLength = K_MAX_LENGTH - // Also valid opts.auth, opts.mode +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Print warning and recommend using `buffer` v4.x which has an Object + * implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * We report that the browser does not support typed arrays if the are not subclassable + * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` + * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support + * for __proto__ and has a buggy typed array implementation. + */ +Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() - var req = new ClientRequest(opts) - if (cb) - req.on('response', cb) - return req +if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && + typeof console.error === 'function') { + console.error( + 'This browser lacks typed array (Uint8Array) support which is required by ' + + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' + ) } -http.get = function get (opts, cb) { - var req = http.request(opts, cb) - req.end() - return req +function typedArraySupport () { + // Can typed array instances can be augmented? + try { + var arr = new Uint8Array(1) + arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } } + return arr.foo() === 42 + } catch (e) { + return false + } } -http.ClientRequest = ClientRequest -http.IncomingMessage = response.IncomingMessage - -http.Agent = function () {} -http.Agent.defaultMaxSockets = 4 - -http.globalAgent = new http.Agent() - -http.STATUS_CODES = statusCodes - -http.METHODS = [ - 'CHECKOUT', - 'CONNECT', - 'COPY', - 'DELETE', - 'GET', - 'HEAD', - 'LOCK', - 'M-SEARCH', - 'MERGE', - 'MKACTIVITY', - 'MKCOL', - 'MOVE', - 'NOTIFY', - 'OPTIONS', - 'PATCH', - 'POST', - 'PROPFIND', - 'PROPPATCH', - 'PURGE', - 'PUT', - 'REPORT', - 'SEARCH', - 'SUBSCRIBE', - 'TRACE', - 'UNLOCK', - 'UNSUBSCRIBE' -] -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./lib/request":81,"./lib/response":82,"builtin-status-codes":99,"url":394,"xtend":386}],80:[function(require,module,exports){ -(function (global){ -exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer + } +}) -exports.writableStream = isFunction(global.WritableStream) +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset + } +}) -exports.abortController = isFunction(global.AbortController) +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // Return an augmented `Uint8Array` instance + var buf = new Uint8Array(length) + buf.__proto__ = Buffer.prototype + return buf +} -// The xhr request to example.com may violate some restrictive CSP configurations, -// so if we're running in a browser that supports `fetch`, avoid calling getXHR() -// and assume support for certain features below. -var xhr -function getXHR () { - // Cache the xhr value - if (xhr !== undefined) return xhr +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ - if (global.XMLHttpRequest) { - xhr = new global.XMLHttpRequest() - // If XDomainRequest is available (ie only, where xhr might not work - // cross domain), use the page location. Otherwise use example.com - // Note: this doesn't actually make an http request. - try { - xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com') - } catch(e) { - xhr = null - } - } else { - // Service workers don't have XHR - xhr = null - } - return xhr +function Buffer (arg, encodingOrOffset, length) { + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + return allocUnsafe(arg) + } + return from(arg, encodingOrOffset, length) } -function checkTypeSupport (type) { - var xhr = getXHR() - if (!xhr) return false - try { - xhr.responseType = type - return xhr.responseType === type - } catch (e) {} - return false +// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 +if (typeof Symbol !== 'undefined' && Symbol.species != null && + Buffer[Symbol.species] === Buffer) { + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true, + enumerable: false, + writable: false + }) } -// If fetch is supported, then arraybuffer will be supported too. Skip calling -// checkTypeSupport(), since that calls getXHR(). -exports.arraybuffer = exports.fetch || checkTypeSupport('arraybuffer') +Buffer.poolSize = 8192 // not used by this implementation -// These next two tests unavoidably show warnings in Chrome. Since fetch will always -// be used if it's available, just return false for these to avoid the warnings. -exports.msstream = !exports.fetch && checkTypeSupport('ms-stream') -exports.mozchunkedarraybuffer = !exports.fetch && checkTypeSupport('moz-chunked-arraybuffer') +function from (value, encodingOrOffset, length) { + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } -// If fetch is supported, then overrideMimeType will be supported too. Skip calling -// getXHR(). -exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false) + if (ArrayBuffer.isView(value)) { + return fromArrayLike(value) + } -function isFunction (value) { - return typeof value === 'function' -} + if (value == null) { + throw TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) + } -xhr = null // Help gc + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],81:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var response = require('./response') -var stream = require('readable-stream') + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) + } -var IncomingMessage = response.IncomingMessage -var rStates = response.readyStates + var valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) + } -function decideMode (preferBinary, useFetch) { - if (capability.fetch && useFetch) { - return 'fetch' - } else if (capability.mozchunkedarraybuffer) { - return 'moz-chunked-arraybuffer' - } else if (capability.msstream) { - return 'ms-stream' - } else if (capability.arraybuffer && preferBinary) { - return 'arraybuffer' - } else { - return 'text' - } -} + var b = fromObject(value) + if (b) return b -var ClientRequest = module.exports = function (opts) { - var self = this - stream.Writable.call(self) + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from( + value[Symbol.toPrimitive]('string'), encodingOrOffset, length + ) + } - self._opts = opts - self._body = [] - self._headers = {} - if (opts.auth) - self.setHeader('Authorization', 'Basic ' + Buffer.from(opts.auth).toString('base64')) - Object.keys(opts.headers).forEach(function (name) { - self.setHeader(name, opts.headers[name]) - }) + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) +} - var preferBinary - var useFetch = true - if (opts.mode === 'disable-fetch' || ('requestTimeout' in opts && !capability.abortController)) { - // If the use of XHR should be preferred. Not typically needed. - useFetch = false - preferBinary = true - } else if (opts.mode === 'prefer-streaming') { - // If streaming is a high priority but binary compatibility and - // the accuracy of the 'content-type' header aren't - preferBinary = false - } else if (opts.mode === 'allow-wrong-content-type') { - // If streaming is more important than preserving the 'content-type' header - preferBinary = !capability.overrideMimeType - } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { - // Use binary if text streaming may corrupt data or the content-type header, or for speed - preferBinary = true - } else { - throw new Error('Invalid value for opts.mode') - } - self._mode = decideMode(preferBinary, useFetch) - self._fetchTimer = null +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(value, encodingOrOffset, length) +} - self.on('finish', function () { - self._onFinish() - }) +// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: +// https://github.com/feross/buffer/pull/148 +Buffer.prototype.__proto__ = Uint8Array.prototype +Buffer.__proto__ = Uint8Array + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } } -inherits(ClientRequest, stream.Writable) +function alloc (size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' + ? createBuffer(size).fill(fill, encoding) + : createBuffer(size).fill(fill) + } + return createBuffer(size) +} -ClientRequest.prototype.setHeader = function (name, value) { - var self = this - var lowerName = name.toLowerCase() - // This check is not necessary, but it prevents warnings from browsers about setting unsafe - // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but - // http-browserify did it, so I will too. - if (unsafeHeaders.indexOf(lowerName) !== -1) - return +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(size, fill, encoding) +} - self._headers[lowerName] = { - name: name, - value: value - } +function allocUnsafe (size) { + assertSize(size) + return createBuffer(size < 0 ? 0 : checked(size) | 0) +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(size) +} + +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + + var length = byteLength(string, encoding) | 0 + var buf = createBuffer(length) + + var actual = buf.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + buf = buf.slice(0, actual) + } + + return buf +} + +function fromArrayLike (array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0 + var buf = createBuffer(length) + for (var i = 0; i < length; i += 1) { + buf[i] = array[i] & 255 + } + return buf +} + +function fromArrayBuffer (array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds') + } + + var buf + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array) + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset) + } else { + buf = new Uint8Array(array, byteOffset, length) + } + + // Return an augmented `Uint8Array` instance + buf.__proto__ = Buffer.prototype + return buf +} + +function fromObject (obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0 + var buf = createBuffer(len) + + if (buf.length === 0) { + return buf + } + + obj.copy(buf, 0, 0, len) + return buf + } + + if (obj.length !== undefined) { + if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { + return createBuffer(0) + } + return fromArrayLike(obj) + } + + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(obj.data) + } +} + +function checked (length) { + // Note: cannot use `length < K_MAX_LENGTH` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= K_MAX_LENGTH) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +} + +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) + } + + if (a === b) return 0 + + var x = a.length + var y = b.length + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!Array.isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + var i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + var buffer = Buffer.allocUnsafe(length) + var pos = 0 + for (i = 0; i < list.length; ++i) { + var buf = list[i] + if (isInstance(buf, Uint8Array)) { + buf = Buffer.from(buf) + } + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + buf.copy(buffer, pos) + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) + } + + var len = string.length + var mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && len === 0) return 0 + + // Use a for loop to avoid recursion + var loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) { + return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 + } + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + var loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) +// to detect a Buffer instance. It's not possible to use `instanceof Buffer` +// reliably in a browserify context because there could be multiple different +// copies of the 'buffer' package in use. This method works even for Buffer +// instances that were created from another copy of the `buffer` package. +// See: https://github.com/feross/buffer/issues/154 +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + var i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + var len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + var len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + var len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + var length = this.length + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.toLocaleString = Buffer.prototype.toString + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + var str = '' + var max = exports.INSPECT_MAX_BYTES + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) + } + if (!Buffer.isBuffer(target)) { + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) + ) + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) + + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (numberIsNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + var i + if (dir) { + var foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + var found = true + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + var remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + var strLen = string.length + + if (length > strLen / 2) { + length = strLen / 2 + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16) + if (numberIsNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function latin1Write (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset >>> 0 + if (isFinite(length)) { + length = length >>> 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + var remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + var loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + return asciiWrite(this, string, offset, length) + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + var res = [] + + var i = start + while (i < end) { + var firstByte = buf[i] + var codePoint = null + var bytesPerSequence = (firstByte > 0xEF) ? 4 + : (firstByte > 0xDF) ? 3 + : (firstByte > 0xBF) ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +var MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + var len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = '' + var i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret } -ClientRequest.prototype.getHeader = function (name) { - var header = this._headers[name.toLowerCase()] - if (header) - return header.value - return null -} +function latin1Slice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) -ClientRequest.prototype.removeHeader = function (name) { - var self = this - delete self._headers[name.toLowerCase()] + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret } -ClientRequest.prototype._onFinish = function () { - var self = this +function hexSlice (buf, start, end) { + var len = buf.length - if (self._destroyed) - return - var opts = self._opts + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len - var headersObj = self._headers - var body = null - if (opts.method !== 'GET' && opts.method !== 'HEAD') { - body = new Blob(self._body, { - type: (headersObj['content-type'] || {}).value || '' - }); - } + var out = '' + for (var i = start; i < end; ++i) { + out += toHex(buf[i]) + } + return out +} - // create flattened list of headers - var headersList = [] - Object.keys(headersObj).forEach(function (keyName) { - var name = headersObj[keyName].name - var value = headersObj[keyName].value - if (Array.isArray(value)) { - value.forEach(function (v) { - headersList.push([name, v]) - }) - } else { - headersList.push([name, value]) - } - }) +function utf16leSlice (buf, start, end) { + var bytes = buf.slice(start, end) + var res = '' + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) + } + return res +} - if (self._mode === 'fetch') { - var signal = null - if (capability.abortController) { - var controller = new AbortController() - signal = controller.signal - self._fetchAbortController = controller +Buffer.prototype.slice = function slice (start, end) { + var len = this.length + start = ~~start + end = end === undefined ? len : ~~end - if ('requestTimeout' in opts && opts.requestTimeout !== 0) { - self._fetchTimer = global.setTimeout(function () { - self.emit('requestTimeout') - if (self._fetchAbortController) - self._fetchAbortController.abort() - }, opts.requestTimeout) - } - } + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } - global.fetch(self._opts.url, { - method: self._opts.method, - headers: headersList, - body: body || undefined, - mode: 'cors', - credentials: opts.withCredentials ? 'include' : 'same-origin', - signal: signal - }).then(function (response) { - self._fetchResponse = response - self._connect() - }, function (reason) { - global.clearTimeout(self._fetchTimer) - if (!self._destroyed) - self.emit('error', reason) - }) - } else { - var xhr = self._xhr = new global.XMLHttpRequest() - try { - xhr.open(self._opts.method, self._opts.url, true) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } - // Can't set responseType on really old browsers - if ('responseType' in xhr) - xhr.responseType = self._mode + if (end < start) end = start - if ('withCredentials' in xhr) - xhr.withCredentials = !!opts.withCredentials + var newBuf = this.subarray(start, end) + // Return an augmented `Uint8Array` instance + newBuf.__proto__ = Buffer.prototype + return newBuf +} - if (self._mode === 'text' && 'overrideMimeType' in xhr) - xhr.overrideMimeType('text/plain; charset=x-user-defined') +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} - if ('requestTimeout' in opts) { - xhr.timeout = opts.requestTimeout - xhr.ontimeout = function () { - self.emit('requestTimeout') - } - } +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) - headersList.forEach(function (header) { - xhr.setRequestHeader(header[0], header[1]) - }) + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } - self._response = null - xhr.onreadystatechange = function () { - switch (xhr.readyState) { - case rStates.LOADING: - case rStates.DONE: - self._onXHRProgress() - break - } - } - // Necessary for streaming in Firefox, since xhr.response is ONLY defined - // in onprogress, not in onreadystatechange with xhr.readyState = 3 - if (self._mode === 'moz-chunked-arraybuffer') { - xhr.onprogress = function () { - self._onXHRProgress() - } - } + return val +} - xhr.onerror = function () { - if (self._destroyed) - return - self.emit('error', new Error('XHR error')) - } +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } - try { - xhr.send(body) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - } + var val = this[offset + --byteLength] + var mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val } -/** - * Checks if xhr.status is readable and non-zero, indicating no error. - * Even though the spec says it should be available in readyState 3, - * accessing it throws an exception in IE8 - */ -function statusValid (xhr) { - try { - var status = xhr.status - return (status !== null && status !== 0) - } catch (e) { - return false - } +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] } -ClientRequest.prototype._onXHRProgress = function () { - var self = this +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} - if (!statusValid(self._xhr) || self._destroyed) - return +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} - if (!self._response) - self._connect() +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - self._response._onXHRProgress() + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) } -ClientRequest.prototype._connect = function () { - var self = this +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - if (self._destroyed) - return + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} - self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer) - self._response.on('error', function(err) { - self.emit('error', err) - }) +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) - self.emit('response', self._response) -} + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 -ClientRequest.prototype._write = function (chunk, encoding, cb) { - var self = this + if (val >= mul) val -= Math.pow(2, 8 * byteLength) - self._body.push(chunk) - cb() + return val } -ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { - var self = this - self._destroyed = true - global.clearTimeout(self._fetchTimer) - if (self._response) - self._response._destroyed = true - if (self._xhr) - self._xhr.abort() - else if (self._fetchAbortController) - self._fetchAbortController.abort() -} +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) -ClientRequest.prototype.end = function (data, encoding, cb) { - var self = this - if (typeof data === 'function') { - cb = data - data = undefined - } + var i = byteLength + var mul = 1 + var val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 - stream.Writable.prototype.end.call(self, data, encoding, cb) -} + if (val >= mul) val -= Math.pow(2, 8 * byteLength) -ClientRequest.prototype.flushHeaders = function () {} -ClientRequest.prototype.setTimeout = function () {} -ClientRequest.prototype.setNoDelay = function () {} -ClientRequest.prototype.setSocketKeepAlive = function () {} + return val +} -// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method -var unsafeHeaders = [ - 'accept-charset', - 'accept-encoding', - 'access-control-request-headers', - 'access-control-request-method', - 'connection', - 'content-length', - 'cookie', - 'cookie2', - 'date', - 'dnt', - 'expect', - 'host', - 'keep-alive', - 'origin', - 'referer', - 'te', - 'trailer', - 'transfer-encoding', - 'upgrade', - 'via' -] +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":80,"./response":82,"_process":393,"buffer":98,"inherits":307,"readable-stream":97}],82:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var stream = require('readable-stream') +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} -var rStates = exports.readyStates = { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val } -var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) { - var self = this - stream.Readable.call(self) +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - self._mode = mode - self.headers = {} - self.rawHeaders = [] - self.trailers = {} - self.rawTrailers = [] + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} - // Fake the 'close' event, but only once 'end' fires - self.on('end', function () { - // The nextTick is necessary to prevent the 'request' module from causing an infinite loop - process.nextTick(function () { - self.emit('close') - }) - }) +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - if (mode === 'fetch') { - self._fetchResponse = response + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} - self.url = response.url - self.statusCode = response.status - self.statusMessage = response.statusText - - response.headers.forEach(function (header, key){ - self.headers[key.toLowerCase()] = header - self.rawHeaders.push(key, header) - }) +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} - if (capability.writableStream) { - var writable = new WritableStream({ - write: function (chunk) { - return new Promise(function (resolve, reject) { - if (self._destroyed) { - reject() - } else if(self.push(Buffer.from(chunk))) { - resolve() - } else { - self._resumeFetch = resolve - } - }) - }, - close: function () { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.push(null) - }, - abort: function (err) { - if (!self._destroyed) - self.emit('error', err) - } - }) +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} - try { - response.body.pipeTo(writable).catch(function (err) { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.emit('error', err) - }) - return - } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this - } - // fallback for when writableStream or pipeTo aren't available - var reader = response.body.getReader() - function read () { - reader.read().then(function (result) { - if (self._destroyed) - return - if (result.done) { - global.clearTimeout(fetchTimer) - self.push(null) - return - } - self.push(Buffer.from(result.value)) - read() - }).catch(function (err) { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.emit('error', err) - }) - } - read() - } else { - self._xhr = xhr - self._pos = 0 +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} - self.url = xhr.responseURL - self.statusCode = xhr.status - self.statusMessage = xhr.statusText - var headers = xhr.getAllResponseHeaders().split(/\r?\n/) - headers.forEach(function (header) { - var matches = header.match(/^([^:]+):\s*(.*)/) - if (matches) { - var key = matches[1].toLowerCase() - if (key === 'set-cookie') { - if (self.headers[key] === undefined) { - self.headers[key] = [] - } - self.headers[key].push(matches[2]) - } else if (self.headers[key] !== undefined) { - self.headers[key] += ', ' + matches[2] - } else { - self.headers[key] = matches[2] - } - self.rawHeaders.push(matches[1], matches[2]) - } - }) +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} - self._charset = 'x-user-defined' - if (!capability.overrideMimeType) { - var mimeType = self.rawHeaders['mime-type'] - if (mimeType) { - var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) - if (charsetMatch) { - self._charset = charsetMatch[1].toLowerCase() - } - } - if (!self._charset) - self._charset = 'utf-8' // best guess - } - } +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') } -inherits(IncomingMessage, stream.Readable) +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } -IncomingMessage.prototype._read = function () { - var self = this + var mul = 1 + var i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } - var resolve = self._resumeFetch - if (resolve) { - self._resumeFetch = null - resolve() - } + return offset + byteLength } -IncomingMessage.prototype._onXHRProgress = function () { - var self = this +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } - var xhr = self._xhr + var i = byteLength - 1 + var mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } - var response = null - switch (self._mode) { - case 'text': - response = xhr.responseText - if (response.length > self._pos) { - var newData = response.substr(self._pos) - if (self._charset === 'x-user-defined') { - var buffer = Buffer.alloc(newData.length) - for (var i = 0; i < newData.length; i++) - buffer[i] = newData.charCodeAt(i) & 0xff + return offset + byteLength +} - self.push(buffer) - } else { - self.push(newData, self._charset) - } - self._pos = response.length - } - break - case 'arraybuffer': - if (xhr.readyState !== rStates.DONE || !xhr.response) - break - response = xhr.response - self.push(Buffer.from(new Uint8Array(response))) - break - case 'moz-chunked-arraybuffer': // take whole - response = xhr.response - if (xhr.readyState !== rStates.LOADING || !response) - break - self.push(Buffer.from(new Uint8Array(response))) - break - case 'ms-stream': - response = xhr.response - if (xhr.readyState !== rStates.LOADING) - break - var reader = new global.MSStreamReader() - reader.onprogress = function () { - if (reader.result.byteLength > self._pos) { - self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos)))) - self._pos = reader.result.byteLength - } - } - reader.onload = function () { - self.push(null) - } - // reader.onerror = ??? // TODO: this - reader.readAsArrayBuffer(response) - break - } +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + this[offset] = (value & 0xff) + return offset + 1 +} - // The ms-stream case handles end separately in reader.onload() - if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { - self.push(null) - } +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 } -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":80,"_process":393,"buffer":98,"inherits":307,"readable-stream":97}],83:[function(require,module,exports){ -'use strict'; +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} -function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + return offset + 4 +} -var codes = {}; +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} -function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) } - function getMessage(arg1, arg2, arg3) { - if (typeof message === 'string') { - return message; - } else { - return message(arg1, arg2, arg3); + var i = 0 + var mul = 1 + var sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } - var NodeError = - /*#__PURE__*/ - function (_Base) { - _inheritsLoose(NodeError, _Base); + return offset + byteLength +} - function NodeError(arg1, arg2, arg3) { - return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = byteLength - 1 + var mul = 1 + var sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } - return NodeError; - }(Base); + return offset + byteLength +} - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - codes[code] = NodeError; -} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} -function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function (i) { - return String(i); - }); +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); - } - } else { - return "of ".concat(thing, " ").concat(String(expected)); - } -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} -function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith +function writeFloat (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} -function endsWith(str, search, this_len) { - if (this_len === undefined || this_len > str.length) { - this_len = str.length; +function writeDouble (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} - return str.substring(this_len - search.length, this_len) === search; -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 -function includes(str, search, start) { - if (typeof start !== 'number') { - start = 0; + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') } + if (start < 0 || start >= this.length) throw new RangeError('Index out of range') + if (end < 0) throw new RangeError('sourceEnd out of bounds') - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start } -} -createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"'; -}, TypeError); -createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { - // determiner: 'must be' or 'must not be' - var determiner; + var len = end - start - if (typeof expected === 'string' && startsWith(expected, 'not ')) { - determiner = 'must not be'; - expected = expected.replace(/^not /, ''); + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (var i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start] + } } else { - determiner = 'must be'; + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + targetStart + ) } - var msg; + return len +} - if (endsWith(name, ' argument')) { - // For cases like 'first argument' - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); - } else { - var type = includes(name, '.') ? 'property' : 'argument'; - msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } else if (typeof val === 'number') { + val = val & 255 } - msg += ". Received type ".concat(typeof actual); - return msg; -}, TypeError); -createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); -createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { - return 'The ' + name + ' method is not implemented'; -}); -createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); -createErrorType('ERR_STREAM_DESTROYED', function (name) { - return 'Cannot call ' + name + ' after a stream was destroyed'; -}); -createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); -createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); -createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); -createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); -createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { - return 'Unknown encoding: ' + arg; -}, TypeError); -createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); -module.exports.codes = codes; + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } -},{}],84:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. -'use strict'; -/**/ + if (end <= start) { + return this + } -var objectKeys = Object.keys || function (obj) { - var keys = []; + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 - for (var key in obj) { - keys.push(key); + if (!val) val = 0 + + var i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + var bytes = Buffer.isBuffer(val) + ? val + : Buffer.from(val, encoding) + var len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } } - return keys; -}; -/**/ + return this +} +// HELPER FUNCTIONS +// ================ -module.exports = Duplex; +var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g -var Readable = require('./_stream_readable'); +function base64clean (str) { + // Node takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = str.trim().replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} -var Writable = require('./_stream_writable'); +function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) +} + +function utf8ToBytes (string, units) { + units = units || Infinity + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] -require('inherits')(Duplex, Readable); + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) -{ - // Allow the keys array to be GC'ed. - var keys = objectKeys(Writable.prototype); + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } - for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } -} + // valid lead + leadSurrogate = codePoint -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - this.allowHalfOpen = true; + continue + } - if (options) { - if (options.readable === false) this.readable = false; - if (options.writable === false) this.writable = false; + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } - if (options.allowHalfOpen === false) { - this.allowHalfOpen = false; - this.once('end', onend); + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) } - } -} -Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.highWaterMark; - } -}); -Object.defineProperty(Duplex.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); - } -}); -Object.defineProperty(Duplex.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); // the no-half-open enforcer + leadSurrogate = null -function onend() { - // If the writable side ended, then we're ok. - if (this._writableState.ended) return; // no more data can be written. - // But allow more writes to happen in this tick. + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } - process.nextTick(onEndNT, this); + return bytes } -function onEndNT(self) { - self.end(); +function asciiToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray } -Object.defineProperty(Duplex.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined || this._writableState === undefined) { - return false; - } - - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (this._readableState === undefined || this._writableState === undefined) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - +function utf16leToBytes (str, units) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break - this._readableState.destroyed = value; - this._writableState.destroyed = value; + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) } -}); -}).call(this,require('_process')) -},{"./_stream_readable":86,"./_stream_writable":88,"_process":393,"inherits":307}],85:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. -'use strict'; -module.exports = PassThrough; + return byteArray +} -var Transform = require('./_stream_transform'); +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} -require('inherits')(PassThrough, Transform); +function blitBuffer (src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - Transform.call(this, options); +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) +} +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare } -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; -},{"./_stream_transform":87,"inherits":307}],86:[function(require,module,exports){ -(function (process,global){ +}).call(this,require("buffer").Buffer) +},{"base64-js":76,"buffer":79,"ieee754":302}],80:[function(require,module,exports){ +(function (process){ +// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, +// backported and transplited with Babel, with backwards-compat fixes + // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -9764,1112 +10471,1368 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -'use strict'; - -module.exports = Readable; -/**/ - -var Duplex; -/**/ - -Readable.ReadableState = ReadableState; -/**/ - -var EE = require('events').EventEmitter; - -var EElistenerCount = function EElistenerCount(emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ - - -var Stream = require('./internal/streams/stream'); -/**/ - - -var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} - -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} -/**/ - -var debugUtil = require('util'); +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } -var debug; + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function debug() {}; + return parts; } -/**/ +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; -var BufferList = require('./internal/streams/buffer_list'); + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); -var destroyImpl = require('./internal/streams/destroy'); + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); -var StringDecoder; -var createReadableStreamAsyncIterator; -var from; + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; -require('inherits')(Readable, Stream); +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; -var errorOrDestroy = destroyImpl.errorOrDestroy; -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} + return (isAbsolute ? '/' : '') + path; +}; -function ReadableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() +// path.relative(from, to) +// posix version +exports.relative = function(from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } - this.sync = true; // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - this.paused = true; // Should close be emitted on destroy. Defaults to true. + if (start > end) return []; + return arr.slice(start, end - start + 1); + } - this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); - this.autoDestroy = !!options.autoDestroy; // has it been destroyed + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } - this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } - this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s + outputParts = outputParts.concat(toParts.slice(samePartsLength)); - this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled + return outputParts.join('/'); +}; - this.readingMore = false; - this.decoder = null; - this.encoding = null; +exports.sep = '/'; +exports.delimiter = ':'; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; +exports.dirname = function (path) { + if (typeof path !== 'string') path = path + ''; + if (path.length === 0) return '.'; + var code = path.charCodeAt(0); + var hasRoot = code === 47 /*/*/; + var end = -1; + var matchedSlash = true; + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i); + if (code === 47 /*/*/) { + if (!matchedSlash) { + end = i; + break; + } + } else { + // We saw the first non-path separator + matchedSlash = false; + } } -} -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5 + if (end === -1) return hasRoot ? '/' : '.'; + if (hasRoot && end === 1) { + // return '//'; + // Backwards-compat fix: + return '/'; + } + return path.slice(0, end); +}; - var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); // legacy +function basename(path) { + if (typeof path !== 'string') path = path + ''; - this.readable = true; + var start = 0; + var end = -1; + var matchedSlash = true; + var i; - if (options) { - if (typeof options.read === 'function') this._read = options.read; - if (typeof options.destroy === 'function') this._destroy = options.destroy; + for (i = path.length - 1; i >= 0; --i) { + if (path.charCodeAt(i) === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false; + end = i + 1; + } } - Stream.call(this); + if (end === -1) return ''; + return path.slice(start, end); } -Object.defineProperty(Readable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined) { - return false; - } - - return this._readableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed +// Uses a mixed approach for backwards-compatibility, as ext behavior changed +// in new Node.js versions, so only basename() above is backported here +exports.basename = function (path, ext) { + var f = basename(path); + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; +exports.extname = function (path) { + if (typeof path !== 'string') path = path + ''; + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + for (var i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46 /*.*/) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + startDot = i; + else if (preDotState !== 1) + preDotState = 1; + } else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } - this._readableState.destroyed = value; + if (startDot === -1 || end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + return ''; } -}); -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; + return path.slice(startDot, end); +}; -Readable.prototype._destroy = function (err, cb) { - cb(err); -}; // Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. +function filter (xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} +// String.prototype.substr - negative index don't work in IE8 +var substr = 'ab'.substr(-1) === 'b' + ? function (str, start, len) { return str.substr(start, len) } + : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } +; -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; +}).call(this,require('_process')) +},{"_process":393}],81:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; +module.exports = Stream; - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } +var EE = require('events').EventEmitter; +var inherits = require('inherits'); - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } +inherits(Stream, EE); +Stream.Readable = require('readable-stream/readable.js'); +Stream.Writable = require('readable-stream/writable.js'); +Stream.Duplex = require('readable-stream/duplex.js'); +Stream.Transform = require('readable-stream/transform.js'); +Stream.PassThrough = require('readable-stream/passthrough.js'); - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; // Unshift should *always* be something directly out of read() +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - debug('readableAddChunk', chunk); - var state = stream._readableState; +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); +function Stream() { + EE.call(this); +} - if (er) { - errorOrDestroy(stream, er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); +Stream.prototype.pipe = function(dest, options) { + var source = this; + + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); } + } + } - if (addToFront) { - if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); - } else if (state.destroyed) { - return false; - } else { - state.reading = false; + source.on('data', ondata); - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - maybeReadMore(stream, state); + function ondrain() { + if (source.readable && source.resume) { + source.resume(); } - } // We can push more data if we are below the highWaterMark. - // Also, if we have no data yet, we can stand some more bytes. - // This is to work around cases where hwm=0, such as the repl. + } + dest.on('drain', ondrain); - return !state.ended && (state.length < state.highWaterMark || state.length === 0); -} + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - state.awaitDrain = 0; - stream.emit('data', chunk); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - if (state.needReadable) emitReadable(stream); + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); } - maybeReadMore(stream, state); -} -function chunkInvalid(state, chunk) { - var er; + function onclose() { + if (didOnEnd) return; + didOnEnd = true; - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + if (typeof dest.destroy === 'function') dest.destroy(); } - return er; -} + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } + } -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; // backwards compatibility. + source.on('error', onerror); + dest.on('error', onerror); + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 + source.removeListener('end', onend); + source.removeListener('close', onclose); - this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: + source.removeListener('error', onerror); + dest.removeListener('error', onerror); - var p = this._readableState.buffer.head; - var content = ''; + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); - while (p !== null) { - content += decoder.write(p.data); - p = p.next; + dest.removeListener('close', cleanup); } - this._readableState.buffer.clear(); - - if (content !== '') this._readableState.buffer.push(content); - this._readableState.length = content.length; - return this; -}; // Don't raise the hwm > 1GB - + source.on('end', cleanup); + source.on('close', cleanup); -var MAX_HWM = 0x40000000; + dest.on('close', cleanup); -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } + dest.emit('pipe', source); - return n; -} // This function is designed to be inlinable, so please take care when making -// changes to the function body. + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; +},{"events":299,"inherits":309,"readable-stream/duplex.js":325,"readable-stream/passthrough.js":334,"readable-stream/readable.js":335,"readable-stream/transform.js":336,"readable-stream/writable.js":337}],82:[function(require,module,exports){ +(function (global){ +var ClientRequest = require('./lib/request') +var response = require('./lib/response') +var extend = require('xtend') +var statusCodes = require('builtin-status-codes') +var url = require('url') -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; +var http = exports - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } // If we're asking for more than the current hwm, then raise the hwm. +http.request = function (opts, cb) { + if (typeof opts === 'string') + opts = url.parse(opts) + else + opts = extend(opts) + // Normally, the page is loaded from http or https, so not specifying a protocol + // will result in a (valid) protocol-relative url. However, this won't work if + // the protocol is something else, like 'file:' + var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; // Don't have enough + var protocol = opts.protocol || defaultProtocol + var host = opts.hostname || opts.host + var port = opts.port + var path = opts.path || '/' - if (!state.ended) { - state.needReadable = true; - return 0; - } + // Necessary for IPv6 addresses + if (host && host.indexOf(':') !== -1) + host = '[' + host + ']' - return state.length; -} // you can override either this method, or the async _read(n) below. + // This may be a relative url. The browser should always be able to interpret it correctly. + opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path + opts.method = (opts.method || 'GET').toUpperCase() + opts.headers = opts.headers || {} + // Also valid opts.auth, opts.mode -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. + var req = new ClientRequest(opts) + if (cb) + req.on('response', cb) + return req +} - if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } +http.get = function get (opts, cb) { + var req = http.request(opts, cb) + req.end() + return req +} - n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. +http.ClientRequest = ClientRequest +http.IncomingMessage = response.IncomingMessage - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - // if we need a readable event, then we need to do some reading. +http.Agent = function () {} +http.Agent.defaultMaxSockets = 4 +http.globalAgent = new http.Agent() - var doRead = state.needReadable; - debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some +http.STATUS_CODES = statusCodes - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. +http.METHODS = [ + 'CHECKOUT', + 'CONNECT', + 'COPY', + 'DELETE', + 'GET', + 'HEAD', + 'LOCK', + 'M-SEARCH', + 'MERGE', + 'MKACTIVITY', + 'MKCOL', + 'MOVE', + 'NOTIFY', + 'OPTIONS', + 'PATCH', + 'POST', + 'PROPFIND', + 'PROPPATCH', + 'PURGE', + 'PUT', + 'REPORT', + 'SEARCH', + 'SUBSCRIBE', + 'TRACE', + 'UNLOCK', + 'UNSUBSCRIBE' +] +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./lib/request":84,"./lib/response":85,"builtin-status-codes":101,"url":394,"xtend":386}],83:[function(require,module,exports){ +(function (global){ +exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) +exports.writableStream = isFunction(global.WritableStream) - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; // if the length is currently zero, then we *need* a readable event. +exports.abortController = isFunction(global.AbortController) - if (state.length === 0) state.needReadable = true; // call internal read method +// The xhr request to example.com may violate some restrictive CSP configurations, +// so if we're running in a browser that supports `fetch`, avoid calling getXHR() +// and assume support for certain features below. +var xhr +function getXHR () { + // Cache the xhr value + if (xhr !== undefined) return xhr - this._read(state.highWaterMark); + if (global.XMLHttpRequest) { + xhr = new global.XMLHttpRequest() + // If XDomainRequest is available (ie only, where xhr might not work + // cross domain), use the page location. Otherwise use example.com + // Note: this doesn't actually make an http request. + try { + xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com') + } catch(e) { + xhr = null + } + } else { + // Service workers don't have XHR + xhr = null + } + return xhr +} - state.sync = false; // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. +function checkTypeSupport (type) { + var xhr = getXHR() + if (!xhr) return false + try { + xhr.responseType = type + return xhr.responseType === type + } catch (e) {} + return false +} - if (!state.reading) n = howMuchToRead(nOrig, state); - } +// If fetch is supported, then arraybuffer will be supported too. Skip calling +// checkTypeSupport(), since that calls getXHR(). +exports.arraybuffer = exports.fetch || checkTypeSupport('arraybuffer') - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; +// These next two tests unavoidably show warnings in Chrome. Since fetch will always +// be used if it's available, just return false for these to avoid the warnings. +exports.msstream = !exports.fetch && checkTypeSupport('ms-stream') +exports.mozchunkedarraybuffer = !exports.fetch && checkTypeSupport('moz-chunked-arraybuffer') - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } +// If fetch is supported, then overrideMimeType will be supported too. Skip calling +// getXHR(). +exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false) - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. +function isFunction (value) { + return typeof value === 'function' +} - if (nOrig !== n && state.ended) endReadable(this); - } +xhr = null // Help gc - if (ret !== null) this.emit('data', ret); - return ret; -}; +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],84:[function(require,module,exports){ +(function (process,global,Buffer){ +var capability = require('./capability') +var inherits = require('inherits') +var response = require('./response') +var stream = require('readable-stream') -function onEofChunk(stream, state) { - debug('onEofChunk'); - if (state.ended) return; +var IncomingMessage = response.IncomingMessage +var rStates = response.readyStates - if (state.decoder) { - var chunk = state.decoder.end(); +function decideMode (preferBinary, useFetch) { + if (capability.fetch && useFetch) { + return 'fetch' + } else if (capability.mozchunkedarraybuffer) { + return 'moz-chunked-arraybuffer' + } else if (capability.msstream) { + return 'ms-stream' + } else if (capability.arraybuffer && preferBinary) { + return 'arraybuffer' + } else { + return 'text' + } +} - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } +var ClientRequest = module.exports = function (opts) { + var self = this + stream.Writable.call(self) - state.ended = true; + self._opts = opts + self._body = [] + self._headers = {} + if (opts.auth) + self.setHeader('Authorization', 'Basic ' + Buffer.from(opts.auth).toString('base64')) + Object.keys(opts.headers).forEach(function (name) { + self.setHeader(name, opts.headers[name]) + }) - if (state.sync) { - // if we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call - emitReadable(stream); - } else { - // emit 'readable' now to make sure it gets picked up. - state.needReadable = false; + var preferBinary + var useFetch = true + if (opts.mode === 'disable-fetch' || ('requestTimeout' in opts && !capability.abortController)) { + // If the use of XHR should be preferred. Not typically needed. + useFetch = false + preferBinary = true + } else if (opts.mode === 'prefer-streaming') { + // If streaming is a high priority but binary compatibility and + // the accuracy of the 'content-type' header aren't + preferBinary = false + } else if (opts.mode === 'allow-wrong-content-type') { + // If streaming is more important than preserving the 'content-type' header + preferBinary = !capability.overrideMimeType + } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { + // Use binary if text streaming may corrupt data or the content-type header, or for speed + preferBinary = true + } else { + throw new Error('Invalid value for opts.mode') + } + self._mode = decideMode(preferBinary, useFetch) + self._fetchTimer = null - if (!state.emittedReadable) { - state.emittedReadable = true; - emitReadable_(stream); - } - } -} // Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. + self.on('finish', function () { + self._onFinish() + }) +} +inherits(ClientRequest, stream.Writable) -function emitReadable(stream) { - var state = stream._readableState; - debug('emitReadable', state.needReadable, state.emittedReadable); - state.needReadable = false; +ClientRequest.prototype.setHeader = function (name, value) { + var self = this + var lowerName = name.toLowerCase() + // This check is not necessary, but it prevents warnings from browsers about setting unsafe + // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but + // http-browserify did it, so I will too. + if (unsafeHeaders.indexOf(lowerName) !== -1) + return - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } + self._headers[lowerName] = { + name: name, + value: value + } } -function emitReadable_(stream) { - var state = stream._readableState; - debug('emitReadable_', state.destroyed, state.length, state.ended); +ClientRequest.prototype.getHeader = function (name) { + var header = this._headers[name.toLowerCase()] + if (header) + return header.value + return null +} - if (!state.destroyed && (state.length || state.ended)) { - stream.emit('readable'); - state.emittedReadable = false; - } // The stream needs another readable event if - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. +ClientRequest.prototype.removeHeader = function (name) { + var self = this + delete self._headers[name.toLowerCase()] +} +ClientRequest.prototype._onFinish = function () { + var self = this - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - flow(stream); -} // at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. + if (self._destroyed) + return + var opts = self._opts + var headersObj = self._headers + var body = null + if (opts.method !== 'GET' && opts.method !== 'HEAD') { + body = new Blob(self._body, { + type: (headersObj['content-type'] || {}).value || '' + }); + } -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(maybeReadMore_, stream, state); - } -} + // create flattened list of headers + var headersList = [] + Object.keys(headersObj).forEach(function (keyName) { + var name = headersObj[keyName].name + var value = headersObj[keyName].value + if (Array.isArray(value)) { + value.forEach(function (v) { + headersList.push([name, v]) + }) + } else { + headersList.push([name, value]) + } + }) -function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) // didn't get any data, stop spinning. - break; - } + if (self._mode === 'fetch') { + var signal = null + if (capability.abortController) { + var controller = new AbortController() + signal = controller.signal + self._fetchAbortController = controller - state.readingMore = false; -} // abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. + if ('requestTimeout' in opts && opts.requestTimeout !== 0) { + self._fetchTimer = global.setTimeout(function () { + self.emit('requestTimeout') + if (self._fetchAbortController) + self._fetchAbortController.abort() + }, opts.requestTimeout) + } + } + + global.fetch(self._opts.url, { + method: self._opts.method, + headers: headersList, + body: body || undefined, + mode: 'cors', + credentials: opts.withCredentials ? 'include' : 'same-origin', + signal: signal + }).then(function (response) { + self._fetchResponse = response + self._connect() + }, function (reason) { + global.clearTimeout(self._fetchTimer) + if (!self._destroyed) + self.emit('error', reason) + }) + } else { + var xhr = self._xhr = new global.XMLHttpRequest() + try { + xhr.open(self._opts.method, self._opts.url, true) + } catch (err) { + process.nextTick(function () { + self.emit('error', err) + }) + return + } + // Can't set responseType on really old browsers + if ('responseType' in xhr) + xhr.responseType = self._mode -Readable.prototype._read = function (n) { - errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); -}; + if ('withCredentials' in xhr) + xhr.withCredentials = !!opts.withCredentials -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; + if (self._mode === 'text' && 'overrideMimeType' in xhr) + xhr.overrideMimeType('text/plain; charset=x-user-defined') - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; + if ('requestTimeout' in opts) { + xhr.timeout = opts.requestTimeout + xhr.ontimeout = function () { + self.emit('requestTimeout') + } + } - case 1: - state.pipes = [state.pipes, dest]; - break; + headersList.forEach(function (header) { + xhr.setRequestHeader(header[0], header[1]) + }) - default: - state.pipes.push(dest); - break; - } + self._response = null + xhr.onreadystatechange = function () { + switch (xhr.readyState) { + case rStates.LOADING: + case rStates.DONE: + self._onXHRProgress() + break + } + } + // Necessary for streaming in Firefox, since xhr.response is ONLY defined + // in onprogress, not in onreadystatechange with xhr.readyState = 3 + if (self._mode === 'moz-chunked-arraybuffer') { + xhr.onprogress = function () { + self._onXHRProgress() + } + } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); - dest.on('unpipe', onunpipe); + xhr.onerror = function () { + if (self._destroyed) + return + self.emit('error', new Error('XHR error')) + } - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); + try { + xhr.send(body) + } catch (err) { + process.nextTick(function () { + self.emit('error', err) + }) + return + } + } +} - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } +/** + * Checks if xhr.status is readable and non-zero, indicating no error. + * Even though the spec says it should be available in readyState 3, + * accessing it throws an exception in IE8 + */ +function statusValid (xhr) { + try { + var status = xhr.status + return (status !== null && status !== 0) + } catch (e) { + return false + } +} - function onend() { - debug('onend'); - dest.end(); - } // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. +ClientRequest.prototype._onXHRProgress = function () { + var self = this + if (!statusValid(self._xhr) || self._destroyed) + return - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - var cleanedUp = false; + if (!self._response) + self._connect() - function cleanup() { - debug('cleanup'); // cleanup event handlers once the pipe is broken + self._response._onXHRProgress() +} - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - cleanedUp = true; // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. +ClientRequest.prototype._connect = function () { + var self = this - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } + if (self._destroyed) + return - src.on('data', ondata); + self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer) + self._response.on('error', function(err) { + self.emit('error', err) + }) - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - debug('dest.write', ret); + self.emit('response', self._response) +} - if (ret === false) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', state.awaitDrain); - state.awaitDrain++; - } +ClientRequest.prototype._write = function (chunk, encoding, cb) { + var self = this - src.pause(); - } - } // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. + self._body.push(chunk) + cb() +} +ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { + var self = this + self._destroyed = true + global.clearTimeout(self._fetchTimer) + if (self._response) + self._response._destroyed = true + if (self._xhr) + self._xhr.abort() + else if (self._fetchAbortController) + self._fetchAbortController.abort() +} - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); - } // Make sure our error handler is attached before userland ones. +ClientRequest.prototype.end = function (data, encoding, cb) { + var self = this + if (typeof data === 'function') { + cb = data + data = undefined + } + stream.Writable.prototype.end.call(self, data, encoding, cb) +} - prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. +ClientRequest.prototype.flushHeaders = function () {} +ClientRequest.prototype.setTimeout = function () {} +ClientRequest.prototype.setNoDelay = function () {} +ClientRequest.prototype.setSocketKeepAlive = function () {} - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } +// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method +var unsafeHeaders = [ + 'accept-charset', + 'accept-encoding', + 'access-control-request-headers', + 'access-control-request-method', + 'connection', + 'content-length', + 'cookie', + 'cookie2', + 'date', + 'dnt', + 'expect', + 'host', + 'keep-alive', + 'origin', + 'referer', + 'te', + 'trailer', + 'transfer-encoding', + 'upgrade', + 'via' +] - dest.once('close', onclose); +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) +},{"./capability":83,"./response":85,"_process":393,"buffer":79,"inherits":309,"readable-stream":100}],85:[function(require,module,exports){ +(function (process,global,Buffer){ +var capability = require('./capability') +var inherits = require('inherits') +var stream = require('readable-stream') - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } +var rStates = exports.readyStates = { + UNSENT: 0, + OPENED: 1, + HEADERS_RECEIVED: 2, + LOADING: 3, + DONE: 4 +} - dest.once('finish', onfinish); +var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) { + var self = this + stream.Readable.call(self) - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } // tell the dest that it's being piped to + self._mode = mode + self.headers = {} + self.rawHeaders = [] + self.trailers = {} + self.rawTrailers = [] + + // Fake the 'close' event, but only once 'end' fires + self.on('end', function () { + // The nextTick is necessary to prevent the 'request' module from causing an infinite loop + process.nextTick(function () { + self.emit('close') + }) + }) + if (mode === 'fetch') { + self._fetchResponse = response - dest.emit('pipe', src); // start the flow if it hasn't been started already. + self.url = response.url + self.statusCode = response.status + self.statusMessage = response.statusText + + response.headers.forEach(function (header, key){ + self.headers[key.toLowerCase()] = header + self.rawHeaders.push(key, header) + }) - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } + if (capability.writableStream) { + var writable = new WritableStream({ + write: function (chunk) { + return new Promise(function (resolve, reject) { + if (self._destroyed) { + reject() + } else if(self.push(Buffer.from(chunk))) { + resolve() + } else { + self._resumeFetch = resolve + } + }) + }, + close: function () { + global.clearTimeout(fetchTimer) + if (!self._destroyed) + self.push(null) + }, + abort: function (err) { + if (!self._destroyed) + self.emit('error', err) + } + }) - return dest; -}; + try { + response.body.pipeTo(writable).catch(function (err) { + global.clearTimeout(fetchTimer) + if (!self._destroyed) + self.emit('error', err) + }) + return + } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this + } + // fallback for when writableStream or pipeTo aren't available + var reader = response.body.getReader() + function read () { + reader.read().then(function (result) { + if (self._destroyed) + return + if (result.done) { + global.clearTimeout(fetchTimer) + self.push(null) + return + } + self.push(Buffer.from(result.value)) + read() + }).catch(function (err) { + global.clearTimeout(fetchTimer) + if (!self._destroyed) + self.emit('error', err) + }) + } + read() + } else { + self._xhr = xhr + self._pos = 0 -function pipeOnDrain(src) { - return function pipeOnDrainFunctionResult() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; + self.url = xhr.responseURL + self.statusCode = xhr.status + self.statusMessage = xhr.statusText + var headers = xhr.getAllResponseHeaders().split(/\r?\n/) + headers.forEach(function (header) { + var matches = header.match(/^([^:]+):\s*(.*)/) + if (matches) { + var key = matches[1].toLowerCase() + if (key === 'set-cookie') { + if (self.headers[key] === undefined) { + self.headers[key] = [] + } + self.headers[key].push(matches[2]) + } else if (self.headers[key] !== undefined) { + self.headers[key] += ', ' + matches[2] + } else { + self.headers[key] = matches[2] + } + self.rawHeaders.push(matches[1], matches[2]) + } + }) - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; + self._charset = 'x-user-defined' + if (!capability.overrideMimeType) { + var mimeType = self.rawHeaders['mime-type'] + if (mimeType) { + var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) + if (charsetMatch) { + self._charset = charsetMatch[1].toLowerCase() + } + } + if (!self._charset) + self._charset = 'utf-8' // best guess + } + } } -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; // if we're not piping anywhere, then do nothing. - - if (state.pipesCount === 0) return this; // just one destination. most common case. - - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - if (!dest) dest = state.pipes; // got a match. +inherits(IncomingMessage, stream.Readable) - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } // slow case. multiple pipe destinations. +IncomingMessage.prototype._read = function () { + var self = this + var resolve = self._resumeFetch + if (resolve) { + self._resumeFetch = null + resolve() + } +} - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; +IncomingMessage.prototype._onXHRProgress = function () { + var self = this - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, { - hasUnpiped: false - }); - } + var xhr = self._xhr - return this; - } // try to find the right one. + var response = null + switch (self._mode) { + case 'text': + response = xhr.responseText + if (response.length > self._pos) { + var newData = response.substr(self._pos) + if (self._charset === 'x-user-defined') { + var buffer = Buffer.alloc(newData.length) + for (var i = 0; i < newData.length; i++) + buffer[i] = newData.charCodeAt(i) & 0xff + self.push(buffer) + } else { + self.push(newData, self._charset) + } + self._pos = response.length + } + break + case 'arraybuffer': + if (xhr.readyState !== rStates.DONE || !xhr.response) + break + response = xhr.response + self.push(Buffer.from(new Uint8Array(response))) + break + case 'moz-chunked-arraybuffer': // take whole + response = xhr.response + if (xhr.readyState !== rStates.LOADING || !response) + break + self.push(Buffer.from(new Uint8Array(response))) + break + case 'ms-stream': + response = xhr.response + if (xhr.readyState !== rStates.LOADING) + break + var reader = new global.MSStreamReader() + reader.onprogress = function () { + if (reader.result.byteLength > self._pos) { + self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos)))) + self._pos = reader.result.byteLength + } + } + reader.onload = function () { + self.push(null) + } + // reader.onerror = ??? // TODO: this + reader.readAsArrayBuffer(response) + break + } - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - dest.emit('unpipe', this, unpipeInfo); - return this; -}; // set up data events if they are asked for -// Ensure readable listeners eventually get something + // The ms-stream case handles end separately in reader.onload() + if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { + self.push(null) + } +} +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) +},{"./capability":83,"_process":393,"buffer":79,"inherits":309,"readable-stream":100}],86:[function(require,module,exports){ +'use strict'; -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - var state = this._readableState; +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } - if (ev === 'data') { - // update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused +var codes = {}; - if (state.flowing !== false) this.resume(); - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug('on readable', state.length, state.reading); +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); } } - return res; -}; - -Readable.prototype.addListener = Readable.prototype.on; - -Readable.prototype.removeListener = function (ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); - - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); - return res; -}; + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } -Readable.prototype.removeAllListeners = function (ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); + return NodeError; + }(Base); - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js - return res; -}; -function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount('readable') > 0; +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); - if (state.resumeScheduled && !state.paused) { - // flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true; // crude way to check if we should resume - } else if (self.listenerCount('data') > 0) { - self.resume(); + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); } -} - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} // pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith -Readable.prototype.resume = function () { - var state = this._readableState; +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith - if (!state.flowing) { - debug('resume'); // we flow only if there is no one listening - // for readable, but we still have to call - // resume() - state.flowing = !state.readableListening; - resume(this, state); +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; } - state.paused = false; - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); - } -} + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes -function resume_(stream, state) { - debug('resume', state.reading); - if (!state.reading) { - stream.read(0); +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; } - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } } -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; - if (this._readableState.flowing !== false) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; } - this._readableState.paused = true; - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); + var msg; - while (state.flowing && stream.read() !== null) { - ; + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); } -} // wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; -Readable.prototype.wrap = function (stream) { - var _this = this; - - var state = this._readableState; - var paused = false; - stream.on('end', function () { - debug('wrapped end'); +},{}],87:[function(require,module,exports){ +(function (process){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. +'use strict'; +/**/ - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } +var objectKeys = Object.keys || function (obj) { + var keys = []; - _this.push(null); - }); - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode + for (var key in obj) { + keys.push(key); + } - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + return keys; +}; +/**/ - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); // proxy all the other methods. - // important when wrapping filters and duplexes. +module.exports = Duplex; - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } // proxy certain important events. +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } // when we try to consume some more bytes, simply unpause the - // underlying stream. +require('inherits')(Duplex, Readable); +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); - this._read = function (n) { - debug('wrapped _read', n); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} - if (paused) { - paused = false; - stream.resume(); - } - }; +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; - return this; -}; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; -if (typeof Symbol === 'function') { - Readable.prototype[Symbol.asyncIterator] = function () { - if (createReadableStreamAsyncIterator === undefined) { - createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); } - - return createReadableStreamAsyncIterator(this); - }; + } } -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function get() { - return this._readableState.highWaterMark; + return this._writableState.highWaterMark; } }); -Object.defineProperty(Readable.prototype, 'readableBuffer', { +Object.defineProperty(Duplex.prototype, 'writableBuffer', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function get() { - return this._readableState && this._readableState.buffer; + return this._writableState && this._writableState.getBuffer(); } }); -Object.defineProperty(Readable.prototype, 'readableFlowing', { +Object.defineProperty(Duplex.prototype, 'writableLength', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function get() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; - } + return this._writableState.length; } -}); // exposed for testing purposes only. +}); // the no-half-open enforcer -Readable._fromList = fromList; -Object.defineProperty(Readable.prototype, 'readableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.length; - } -}); // Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; // no more data can be written. + // But allow more writes to happen in this tick. -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = state.buffer.consume(n, state.decoder); - } - return ret; + process.nextTick(onEndNT, this); } -function endReadable(stream) { - var state = stream._readableState; - debug('endReadable', state.endEmitted); - - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); - } +function onEndNT(self) { + self.end(); } -function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. - - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the writable side is ready for autoDestroy as well - var wState = stream._writableState; - - if (!wState || wState.autoDestroy && wState.finished) { - stream.destroy(); - } +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; } - } -} -if (typeof Symbol === 'function') { - Readable.from = function (iterable, opts) { - if (from === undefined) { - from = require('./internal/streams/from'); - } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed - return from(Readable, iterable, opts); - }; -} -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; + this._readableState.destroyed = value; + this._writableState.destroyed = value; } - - return -1; -} -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":83,"./_stream_duplex":84,"./internal/streams/async_iterator":89,"./internal/streams/buffer_list":90,"./internal/streams/destroy":91,"./internal/streams/from":93,"./internal/streams/state":95,"./internal/streams/stream":96,"_process":393,"buffer":98,"events":297,"inherits":307,"string_decoder/":341,"util":78}],87:[function(require,module,exports){ +}); +}).call(this,require('_process')) +},{"./_stream_readable":89,"./_stream_writable":91,"_process":393,"inherits":309}],88:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -10890,188 +11853,26 @@ function indexOf(xs, x) { // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. 'use strict'; -module.exports = Transform; - -var _require$codes = require('../errors').codes, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, - ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - -var Duplex = require('./_stream_duplex'); - -require('inherits')(Transform, Duplex); - -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - - if (cb === null) { - return this.emit('error', new ERR_MULTIPLE_CALLBACK()); - } - - ts.writechunk = null; - ts.writecb = null; - if (data != null) // single equals check for both `null` and `undefined` - this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } -} - -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; // start out asking for a readable event once data is transformed. - - this._readableState.needReadable = true; // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - - this._readableState.sync = false; - - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - if (typeof options.flush === 'function') this._flush = options.flush; - } // When the writable side finishes, then flush out anything remaining. - +module.exports = PassThrough; - this.on('prefinish', prefinish); -} +var Transform = require('./_stream_transform'); -function prefinish() { - var _this = this; +require('inherits')(PassThrough, Transform); - if (typeof this._flush === 'function' && !this._readableState.destroyed) { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); } -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; // This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. - - -Transform.prototype._transform = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); -}; - -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; // Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. - - -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - -Transform.prototype._destroy = function (err, cb) { - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - }); +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); }; - -function done(stream, er, data) { - if (er) return stream.emit('error', er); - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); // TODO(BridgeAR): Write a test for these two error cases - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - - if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); - if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); - return stream.push(null); -} -},{"../errors":83,"./_stream_duplex":84,"inherits":307}],88:[function(require,module,exports){ +},{"./_stream_transform":90,"inherits":309}],89:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -11093,51 +11894,27 @@ function done(stream, er, data) { // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. 'use strict'; -module.exports = Writable; -/* */ - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} // It seems a linked list but it is not -// there will be only 2 of these for each stream - - -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - - this.finish = function () { - onCorkedFinish(_this, state); - }; -} -/* */ - +module.exports = Readable; /**/ - var Duplex; /**/ -Writable.WritableState = WritableState; +Readable.ReadableState = ReadableState; /**/ -var internalUtil = { - deprecate: require('util-deprecate') +var EE = require('events').EventEmitter; + +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; }; /**/ /**/ + var Stream = require('./internal/streams/stream'); /**/ @@ -11153,3185 +11930,2757 @@ function _uint8ArrayToBuffer(chunk) { function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } +/**/ -var destroyImpl = require('./internal/streams/destroy'); - -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, - ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - -var errorOrDestroy = destroyImpl.errorOrDestroy; - -require('inherits')(Writable, Stream); - -function nop() {} - -function WritableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream, - // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream - // contains buffers or objects. - - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - - this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called - - this.finalCalled = false; // drain event flag. - - this.needDrain = false; // at the start of calling end() - - this.ending = false; // when end() has been called, and returned - - this.ended = false; // when 'finish' is emitted - - this.finished = false; // has it been destroyed - - this.destroyed = false; // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - - this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - - this.length = 0; // a flag to see when we're in the middle of a write. - - this.writing = false; // when true all writes will be buffered until .uncork() call - - this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - - this.sync = true; // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - - this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) - - this.onwrite = function (er) { - onwrite(stream, er); - }; // the callback that the user supplies to write(chunk,encoding,cb) - - - this.writecb = null; // the amount that is being written when _write is called. - - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - - this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - - this.prefinished = false; // True if the error was already emitted and should not be thrown again - - this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. - - this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end') - - this.autoDestroy = !!options.autoDestroy; // count buffered requests - - this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - - this.corkedRequestsFree = new CorkedRequest(this); -} - -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - - while (current) { - out.push(current); - current = current.next; - } - - return out; -}; - -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function writableStateBufferGetter() { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') - }); - } catch (_) {} -})(); // Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. +var debugUtil = require('util'); -var realHasInstance; +var debug; -if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function value(object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - return object && object._writableState instanceof WritableState; - } - }); +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); } else { - realHasInstance = function realHasInstance(object) { - return object instanceof this; - }; + debug = function debug() {}; } +/**/ -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - // Checking for a Stream.Duplex instance is faster here instead of inside - // the WritableState constructor, at least with V8 6.5 - var isDuplex = this instanceof Duplex; - if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); // legacy. +var BufferList = require('./internal/streams/buffer_list'); - this.writable = true; +var destroyImpl = require('./internal/streams/destroy'); - if (options) { - if (typeof options.write === 'function') this._write = options.write; - if (typeof options.writev === 'function') this._writev = options.writev; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - if (typeof options.final === 'function') this._final = options.final; - } +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; - Stream.call(this); -} // Otherwise people can pipe Writable streams, which is just wrong. +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. -Writable.prototype.pipe = function () { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); -}; +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; -function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb +require('inherits')(Readable, Stream); - errorOrDestroy(stream, er); - process.nextTick(cb, er); -} // Checks that a user-supplied chunk is valid, especially for the particular -// mode the stream is in. Currently this means that `null` is never accepted -// and undefined/non-string values are only allowed in object mode. +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. -function validChunk(stream, state, chunk, cb) { - var er; + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} - if (chunk === null) { - er = new ERR_STREAM_NULL_VALUES(); - } else if (typeof chunk !== 'string' && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); - } +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. - if (er) { - errorOrDestroy(stream, er); - process.nextTick(cb, er); - return false; - } + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away - return true; -} + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() - var isBuf = !state.objectMode && _isUint8Array(chunk); + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } + this.sync = true; // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; // Should close be emitted on destroy. Defaults to true. - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== 'function') cb = nop; - if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; -}; + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') -Writable.prototype.cork = function () { - this._writableState.corked++; -}; + this.autoDestroy = !!options.autoDestroy; // has it been destroyed -Writable.prototype.uncork = function () { - var state = this._writableState; + this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; + this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; + this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled -Object.defineProperty(Writable.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); + this.readingMore = false; + this.decoder = null; + this.encoding = null; + + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; } -}); +} -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); // legacy + + this.readable = true; + + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; } - return chunk; + Stream.call(this); } -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { +Object.defineProperty(Readable.prototype, 'destroyed', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function get() { - return this._writableState.highWaterMark; - } -}); // if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. + if (this._readableState === undefined) { + return false; + } -function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } + + this._readableState.destroyed = value; } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; // Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. - if (!ret) state.needDrain = true; - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; - state.bufferedRequestCount += 1; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + + skipChunkCheck = true; + } } else { - doWrite(stream, state, false, len, chunk, encoding, cb); + skipChunkCheck = true; } - return ret; -} + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; // Unshift should *always* be something directly out of read() -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - process.nextTick(cb, er); // this can emit finish, and it will always happen - // after error +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); // this can emit finish, but finish must - // always follow error - - finishMaybe(stream, state); - } -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); - onwriteStateUpdate(state); - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state) || stream.destroyed; + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); } - } -} + } // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} // Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); } -} // if there's something in the buffer waiting, then process it + maybeReadMore(stream, state); +} -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; +function chunkInvalid(state, chunk) { + var er; - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } + return er; +} - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; // backwards compatibility. - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. + this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: - if (state.writing) { - break; - } - } + var p = this._readableState.buffer.head; + var content = ''; - if (entry === null) state.lastBufferedRequest = null; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; } - state.bufferedRequest = entry; - state.bufferProcessing = false; -} + this._readableState.buffer.clear(); -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); -}; + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; // Don't raise the hwm > 1GB -Writable.prototype._writev = null; -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; +var MAX_HWM = 0x40000000; - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; } - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks - - if (state.corked) { - state.corked = 1; - this.uncork(); - } // ignore unnecessary end() calls. - - - if (!state.ending) endWritable(this, state, cb); - return this; -}; + return n; +} // This function is designed to be inlinable, so please take care when making +// changes to the function body. -Object.defineProperty(Writable.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } // If we're asking for more than the current hwm, then raise the hwm. - if (err) { - errorOrDestroy(stream, err); - } - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); -} + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; // Don't have enough -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } + if (!state.ended) { + state.needReadable = true; + return 0; } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); + return state.length; +} // you can override either this method, or the async _read(n) below. - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the readable side is ready for autoDestroy as well - var rState = stream._readableState; +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. - if (!rState || rState.autoDestroy && rState.endEmitted) { - stream.destroy(); - } - } - } + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; } - return need; -} + n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + // if we need a readable event, then we need to do some reading. - if (cb) { - if (state.finished) process.nextTick(cb);else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; -} + var doRead = state.needReadable; + debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } // reuse the free corkReq. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; // if the length is currently zero, then we *need* a readable event. - state.corkedRequestsFree.next = corkReq; -} + if (state.length === 0) state.needReadable = true; // call internal read method -Object.defineProperty(Writable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._writableState === undefined) { - return false; - } + this._read(state.highWaterMark); - return this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed + state.sync = false; // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } - this._writableState.destroyed = value; + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; } -}); -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; -Writable.prototype._destroy = function (err, cb) { - cb(err); -}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":83,"./_stream_duplex":84,"./internal/streams/destroy":91,"./internal/streams/state":95,"./internal/streams/stream":96,"_process":393,"buffer":98,"inherits":307,"util-deprecate":343}],89:[function(require,module,exports){ -(function (process){ -'use strict'; + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. -var _Object$setPrototypeO; + if (nOrig !== n && state.ended) endReadable(this); + } -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + if (ret !== null) this.emit('data', ret); + return ret; +}; -var finished = require('./end-of-stream'); +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; -var kLastResolve = Symbol('lastResolve'); -var kLastReject = Symbol('lastReject'); -var kError = Symbol('error'); -var kEnded = Symbol('ended'); -var kLastPromise = Symbol('lastPromise'); -var kHandlePromise = Symbol('handlePromise'); -var kStream = Symbol('stream'); + if (state.decoder) { + var chunk = state.decoder.end(); -function createIterResult(value, done) { - return { - value: value, - done: done - }; -} + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } -function readAndResolve(iter) { - var resolve = iter[kLastResolve]; + state.ended = true; - if (resolve !== null) { - var data = iter[kStream].read(); // we defer if data is null - // we can be expecting either 'end' or - // 'error' + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve(createIterResult(data, false)); + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); } } -} +} // Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. -function onReadable(iter) { - // we wait for the next tick, because it might - // emit an error with process.nextTick - process.nextTick(readAndResolve, iter); -} -function wrapForNext(lastPromise, iter) { - return function (resolve, reject) { - lastPromise.then(function () { - if (iter[kEnded]) { - resolve(createIterResult(undefined, true)); - return; - } +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; - iter[kHandlePromise](resolve, reject); - }, reject); - }; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } } -var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); -var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); - next: function next() { - var _this = this; + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. - // if we have detected an error in the meanwhile - // reject straight away - var error = this[kError]; - if (error !== null) { - return Promise.reject(error); - } + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} // at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. - if (this[kEnded]) { - return Promise.resolve(createIterResult(undefined, true)); - } - if (this[kStream].destroyed) { - // We need to defer via nextTick because if .destroy(err) is - // called, the error will be emitted via nextTick, and - // we cannot guarantee that there is no error lingering around - // waiting to be emitted. - return new Promise(function (resolve, reject) { - process.nextTick(function () { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve(createIterResult(undefined, true)); - } - }); - }); - } // if we have multiple next() calls - // we will wait for the previous Promise to finish - // this logic is optimized to support for await loops, - // where next() is only called once at a time +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) // didn't get any data, stop spinning. + break; + } - var lastPromise = this[kLastPromise]; - var promise; + state.readingMore = false; +} // abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. - if (lastPromise) { - promise = new Promise(wrapForNext(lastPromise, this)); - } else { - // fast path needed to support multiple this.push() - // without triggering the next() queue - var data = this[kStream].read(); - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; - promise = new Promise(this[kHandlePromise]); - } +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; - this[kLastPromise] = promise; - return promise; - } -}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { - return this; -}), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; - // destroy(err, cb) is a private API - // we can guarantee we have that here, because we control the - // Readable class this is attached to - return new Promise(function (resolve, reject) { - _this2[kStream].destroy(null, function (err) { - if (err) { - reject(err); - return; - } + case 1: + state.pipes = [state.pipes, dest]; + break; - resolve(createIterResult(undefined, true)); - }); - }); -}), _Object$setPrototypeO), AsyncIteratorPrototype); + default: + state.pipes.push(dest); + break; + } -var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { - var _Object$create; + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve, reject) { - var data = iterator[kStream].read(); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve; - iterator[kLastReject] = reject; + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function (err) { - if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise - // returned by next() and store the error + } + } - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } + function onend() { + debug('onend'); + dest.end(); + } // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. - iterator[kError] = err; - return; - } - var resolve = iterator[kLastResolve]; + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; - if (resolve !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(undefined, true)); - } + function cleanup() { + debug('cleanup'); // cleanup event handlers once the pipe is broken - iterator[kEnded] = true; - }); - stream.on('readable', onReadable.bind(null, iterator)); - return iterator; -}; + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. -module.exports = createReadableStreamAsyncIterator; -}).call(this,require('_process')) -},{"./end-of-stream":92,"_process":393}],90:[function(require,module,exports){ -'use strict'; + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + + src.on('data', ondata); + + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + src.pause(); + } + } // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } // Make sure our error handler is attached before userland ones. -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } -var _require = require('buffer'), - Buffer = _require.Buffer; + dest.once('close', onclose); -var _require2 = require('util'), - inspect = _require2.inspect; + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } -var custom = inspect && inspect.custom || 'inspect'; + dest.once('finish', onfinish); -function copyBuffer(src, target, offset) { - Buffer.prototype.copy.call(src, target, offset); -} + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } // tell the dest that it's being piped to -module.exports = -/*#__PURE__*/ -function () { - function BufferList() { - _classCallCheck(this, BufferList); - this.head = null; - this.tail = null; - this.length = 0; + dest.emit('pipe', src); // start the flow if it hasn't been started already. + + if (!state.flowing) { + debug('pipe resume'); + src.resume(); } - _createClass(BufferList, [{ - key: "push", - value: function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - } - }, { - key: "unshift", - value: function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - } - }, { - key: "shift", - value: function shift() { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; - } - }, { - key: "clear", - value: function clear() { - this.head = this.tail = null; - this.length = 0; - } - }, { - key: "join", - value: function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; + return dest; +}; - while (p = p.next) { - ret += s + p.data; - } +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; - return ret; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); } - }, { - key: "concat", - value: function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; + }; +} - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; // if we're not piping anywhere, then do nothing. - return ret; - } // Consumes a specified amount of bytes or characters from the buffered data. + if (state.pipesCount === 0) return this; // just one destination. most common case. - }, { - key: "consume", - value: function consume(n, hasStrings) { - var ret; + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; // got a match. - if (n < this.head.data.length) { - // `slice` is the same for buffers and strings. - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - // First chunk is a perfect match. - ret = this.shift(); - } else { - // Result spans more than one buffer. - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } // slow case. multiple pipe destinations. - return ret; + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this, { + hasUnpiped: false + }); } - }, { - key: "first", - value: function first() { - return this.head.data; - } // Consumes a specified amount of characters from the buffered data. - }, { - key: "_getString", - value: function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; + return this; + } // try to find the right one. - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; // set up data events if they are asked for +// Ensure readable listeners eventually get something - break; - } - ++c; - } +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; - this.length -= c; - return ret; - } // Consumes a specified amount of bytes from the buffered data. + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused - }, { - key: "_getBuffer", - value: function _getBuffer(n) { - var ret = Buffer.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = buf.slice(nb); - } + return res; +}; - break; - } +Readable.prototype.addListener = Readable.prototype.on; - ++c; - } +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); - this.length -= c; - return ret; - } // Make sure the linked list only shows the minimal necessary information. + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } - }, { - key: custom, - value: function value(_, options) { - return inspect(this, _objectSpread({}, options, { - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - })); - } - }]); + return res; +}; - return BufferList; -}(); -},{"buffer":98,"util":78}],91:[function(require,module,exports){ -(function (process){ -'use strict'; // undocumented cb() API, needed for core, not for public API +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); -function destroy(err, cb) { - var _this = this; + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; + return res; +}; - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); - } - } +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; - return this; - } // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} // pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. - if (this._readableState) { - this._readableState.destroyed = true; - } // if this is a duplex stream mark the writable part as destroyed as well +Readable.prototype.resume = function () { + var state = this._readableState; - if (this._writableState) { - this._writableState.destroyed = true; - } + if (!state.flowing) { + debug('resume'); // we flow only if there is no one listening + // for readable, but we still have to call + // resume() - this._destroy(err || null, function (err) { - if (!cb && err) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err); - } else { - process.nextTick(emitCloseNT, _this); - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err); - } else { - process.nextTick(emitCloseNT, _this); - } - }); + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; return this; -} +}; -function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } } -function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) return; - if (self._readableState && !self._readableState.emitClose) return; - self.emit('close'); -} +function resume_(stream, state) { + debug('resume', state.reading); -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; + if (!state.reading) { + stream.read(0); } - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); } -function emitErrorNT(self, err) { - self.emit('error', err); -} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); -function errorOrDestroy(stream, err) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); -} + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } -module.exports = { - destroy: destroy, - undestroy: undestroy, - errorOrDestroy: errorOrDestroy + this._readableState.paused = true; + return this; }; -}).call(this,require('_process')) -},{"_process":393}],92:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/end-of-stream with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; -var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; + while (state.flowing && stream.read() !== null) { + ; + } +} // wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - callback.apply(this, args); - }; -} +Readable.prototype.wrap = function (stream) { + var _this = this; -function noop() {} + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } -function eos(stream, opts, callback) { - if (typeof opts === 'function') return eos(stream, null, opts); - if (!opts) opts = {}; - callback = once(callback || noop); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable = opts.writable || opts.writable !== false && stream.writable; + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode - var onlegacyfinish = function onlegacyfinish() { - if (!stream.writable) onfinish(); - }; + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - var writableEnded = stream._writableState && stream._writableState.finished; + var ret = _this.push(chunk); - var onfinish = function onfinish() { - writable = false; - writableEnded = true; - if (!readable) callback.call(stream); - }; + if (!ret) { + paused = true; + stream.pause(); + } + }); // proxy all the other methods. + // important when wrapping filters and duplexes. - var readableEnded = stream._readableState && stream._readableState.endEmitted; + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } // proxy certain important events. - var onend = function onend() { - readable = false; - readableEnded = true; - if (!writable) callback.call(stream); - }; - var onerror = function onerror(err) { - callback.call(stream, err); - }; + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } // when we try to consume some more bytes, simply unpause the + // underlying stream. - var onclose = function onclose() { - var err; - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } + this._read = function (n) { + debug('wrapped _read', n); - if (writable && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); + if (paused) { + paused = false; + stream.resume(); } }; - var onrequest = function onrequest() { - stream.req.on('finish', onfinish); - }; + return this; +}; - if (isRequest(stream)) { - stream.on('complete', onfinish); - stream.on('abort', onclose); - if (stream.req) onrequest();else stream.on('request', onrequest); - } else if (writable && !stream._writableState) { - // legacy streams - stream.on('end', onlegacyfinish); - stream.on('close', onlegacyfinish); - } +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); + } - stream.on('end', onend); - stream.on('finish', onfinish); - if (opts.error !== false) stream.on('error', onerror); - stream.on('close', onclose); - return function () { - stream.removeListener('complete', onfinish); - stream.removeListener('abort', onclose); - stream.removeListener('request', onrequest); - if (stream.req) stream.req.removeListener('finish', onfinish); - stream.removeListener('end', onlegacyfinish); - stream.removeListener('close', onlegacyfinish); - stream.removeListener('finish', onfinish); - stream.removeListener('end', onend); - stream.removeListener('error', onerror); - stream.removeListener('close', onclose); + return createReadableStreamAsyncIterator(this); }; } -module.exports = eos; -},{"../../../errors":83}],93:[function(require,module,exports){ -module.exports = function () { - throw new Error('Readable.from is not available in the browser') -}; - -},{}],94:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/pump with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); // exposed for testing purposes only. -var eos; +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); // Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - callback.apply(void 0, arguments); - }; +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; } -var _require$codes = require('../../../errors').codes, - ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); -function noop(err) { - // Rethrow the error if it exists to avoid swallowing it - if (err) throw err; + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } } -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. + + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } } -function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on('close', function () { - closed = true; - }); - if (eos === undefined) eos = require('./end-of-stream'); - eos(stream, { - readable: reading, - writable: writing - }, function (err) { - if (err) return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function (err) { - if (closed) return; - if (destroyed) return; - destroyed = true; // request.destroy just do .end - .abort is what we want +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = require('./internal/streams/from'); + } - if (isRequest(stream)) return stream.abort(); - if (typeof stream.destroy === 'function') return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED('pipe')); + return from(Readable, iterable, opts); }; } -function call(fn) { - fn(); -} +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } -function pipe(from, to) { - return from.pipe(to); + return -1; } +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":86,"./_stream_duplex":87,"./internal/streams/async_iterator":92,"./internal/streams/buffer_list":93,"./internal/streams/destroy":94,"./internal/streams/from":96,"./internal/streams/state":98,"./internal/streams/stream":99,"_process":393,"buffer":79,"events":299,"inherits":309,"string_decoder/":341,"util":78}],90:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. +'use strict'; -function popCallback(streams) { - if (!streams.length) return noop; - if (typeof streams[streams.length - 1] !== 'function') return noop; - return streams.pop(); -} +module.exports = Transform; -function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } +var _require$codes = require('../errors').codes, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - var callback = popCallback(streams); - if (Array.isArray(streams[0])) streams = streams[0]; +var Duplex = require('./_stream_duplex'); - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams'); +require('inherits')(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); } - var error; - var destroys = streams.map(function (stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function (err) { - if (!error) error = err; - if (err) destroys.forEach(call); - if (reading) return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); + ts.writechunk = null; + ts.writecb = null; + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } } -module.exports = pipeline; -},{"../../../errors":83,"./end-of-stream":92}],95:[function(require,module,exports){ -'use strict'; +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; // start out asking for a readable event once data is transformed. -var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; + this._readableState.needReadable = true; // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. -function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; -} + this._readableState.sync = false; -function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } // When the writable side finishes, then flush out anything remaining. - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : 'highWaterMark'; - throw new ERR_INVALID_OPT_VALUE(name, hwm); - } - return Math.floor(hwm); - } // Default value + this.on('prefinish', prefinish); +} +function prefinish() { + var _this = this; - return state.objectMode ? 16 : 16 * 1024; + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } } -module.exports = { - getHighWaterMark: getHighWaterMark +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; // This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. + + +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); }; -},{"../../../errors":83}],96:[function(require,module,exports){ -module.exports = require('events').EventEmitter; -},{"events":297}],97:[function(require,module,exports){ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); -exports.finished = require('./lib/internal/streams/end-of-stream.js'); -exports.pipeline = require('./lib/internal/streams/pipeline.js'); +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; -},{"./lib/_stream_duplex.js":84,"./lib/_stream_passthrough.js":85,"./lib/_stream_readable.js":86,"./lib/_stream_transform.js":87,"./lib/_stream_writable.js":88,"./lib/internal/streams/end-of-stream.js":92,"./lib/internal/streams/pipeline.js":94}],98:[function(require,module,exports){ -(function (Buffer){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; // Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. -'use strict' -var base64 = require('base64-js') -var ieee754 = require('ieee754') +Transform.prototype._read = function (n) { + var ts = this._transformState; -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; -var K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ -Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && - typeof console.error === 'function') { - console.error( - 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' - ) -} +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided -function typedArraySupport () { - // Can typed array instances can be augmented? - try { - var arr = new Uint8Array(1) - arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } } - return arr.foo() === 42 - } catch (e) { - return false - } + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); } +},{"../errors":86,"./_stream_duplex":87,"inherits":309}],91:[function(require,module,exports){ +(function (process,global){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. +'use strict'; + +module.exports = Writable; +/* */ -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} // It seems a linked list but it is not +// there will be only 2 of these for each stream -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') - } - // Return an augmented `Uint8Array` instance - var buf = new Uint8Array(length) - buf.__proto__ = Buffer.prototype - return buf -} +function CorkedRequest(state) { + var _this = this; -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ + this.next = null; + this.entry = null; -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) - } - return from(arg, encodingOrOffset, length) + this.finish = function () { + onCorkedFinish(_this, state); + }; } +/* */ -// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species != null && - Buffer[Symbol.species] === Buffer) { - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true, - enumerable: false, - writable: false - }) -} +/**/ -Buffer.poolSize = 8192 // not used by this implementation -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } +var Duplex; +/**/ - if (ArrayBuffer.isView(value)) { - return fromArrayLike(value) - } +Writable.WritableState = WritableState; +/**/ - if (value == null) { - throw TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } +/**/ - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) - } +var Stream = require('./internal/streams/stream'); +/**/ - var valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) - } - var b = fromObject(value) - if (b) return b +var Buffer = require('buffer').Buffer; - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from( - value[Symbol.toPrimitive]('string'), encodingOrOffset, length - ) - } +var OurUint8Array = global.Uint8Array || function () {}; - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); } -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length) +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Buffer.prototype.__proto__ = Uint8Array.prototype -Buffer.__proto__ = Uint8Array - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} +var destroyImpl = require('./internal/streams/destroy'); -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(size).fill(fill, encoding) - : createBuffer(size).fill(fill) - } - return createBuffer(size) -} +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} +var errorOrDestroy = destroyImpl.errorOrDestroy; -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(size) -} +require('inherits')(Writable, Stream); -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } +function nop() {} - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - var length = byteLength(string, encoding) | 0 - var buf = createBuffer(length) + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream + // contains buffers or objects. - var actual = buf.write(string, encoding) + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual) - } + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called - return buf -} + this.finalCalled = false; // drain event flag. -function fromArrayLike (array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - var buf = createBuffer(length) - for (var i = 0; i < length; i += 1) { - buf[i] = array[i] & 255 - } - return buf -} + this.needDrain = false; // at the start of calling end() -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') - } + this.ending = false; // when end() has been called, and returned - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') - } + this.ended = false; // when 'finish' is emitted - var buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) - } else { - buf = new Uint8Array(array, byteOffset, length) - } + this.finished = false; // has it been destroyed - // Return an augmented `Uint8Array` instance - buf.__proto__ = Buffer.prototype - return buf -} + this.destroyed = false; // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - var buf = createBuffer(len) + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. - if (buf.length === 0) { - return buf - } + this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. - obj.copy(buf, 0, 0, len) - return buf - } + this.length = 0; // a flag to see when we're in the middle of a write. - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) - } - return fromArrayLike(obj) - } + this.writing = false; // when true all writes will be buffered until .uncork() call - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} + this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. -function checked (length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') - } - return length | 0 -} + this.sync = true; // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} + this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false -} + this.onwrite = function (er) { + onwrite(stream, er); + }; // the callback that the user supplies to write(chunk,encoding,cb) -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - if (a === b) return 0 + this.writecb = null; // the amount that is being written when _write is called. - var x = a.length - var y = b.length + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } + this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams - if (x < y) return -1 - if (y < x) return 1 - return 0 -} + this.prefinished = false; // True if the error was already emitted and should not be thrown again -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} + this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end') - if (list.length === 0) { - return Buffer.alloc(0) - } + this.autoDestroy = !!options.autoDestroy; // count buffered requests - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } + this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (isInstance(buf, Uint8Array)) { - buf = Buffer.from(buf) - } - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer + this.corkedRequestsFree = new CorkedRequest(this); } -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + + while (current) { + out.push(current); + current = current.next; } - var len = string.length - var mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 + return out; +}; - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); // Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. -function slowToString (encoding, start, end) { - var loweredCase = false - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. +var realHasInstance; - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} - if (end === undefined || end > this.length) { - end = this.length - } +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 - if (end <= 0) { - return '' - } + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); // legacy. - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 + this.writable = true; - if (end <= start) { - return '' + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; } - if (!encoding) encoding = 'utf8' + Stream.call(this); +} // Otherwise people can pipe Writable streams, which is just wrong. - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; - case 'ascii': - return asciiSlice(this, start, end) +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} // Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. - case 'base64': - return base64Slice(this, start, end) - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) +function validChunk(stream, state, chunk, cb) { + var er; - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); } -} -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i + return true; } -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); } - return this -} -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); } - return this -} + return ret; +}; -Buffer.prototype.toString = function toString () { - var length = this.length - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} +Writable.prototype.cork = function () { + this._writableState.corked++; +}; -Buffer.prototype.toLocaleString = Buffer.prototype.toString +Writable.prototype.uncork = function () { + var state = this._writableState; -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); } +}); - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); } - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } + return chunk; +} - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; } +}); // if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); - if (this === target) return 0 + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) + if (!ret) state.needDrain = true; - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; } + + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); } - if (x < y) return -1 - if (y < x) return 1 - return 0 + return ret; } -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (numberIsNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); // this can emit finish, and it will always happen + // after error - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); // this can emit finish, but finish must + // always follow error - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) + finishMaybe(stream, state); } +} - throw new TypeError('val must be string, number or Buffer') +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; } -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); } - } - function read (buf, i) { - if (indexSize === 1) { - return buf[i] + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); } else { - return buf.readUInt16BE(i * indexSize) + afterWrite(stream, state, finished, cb); } } +} - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} // Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. - return -1 -} -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} // if there's something in the buffer waiting, then process it -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; } - } - var strLen = string.length + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (numberIsNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} + state.pendingcb++; + state.lastBufferedRequest = null; -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} + if (state.writing) { + break; + } + } -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} + if (entry === null) state.lastBufferedRequest = null; + } -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) + state.bufferedRequest = entry; + state.bufferProcessing = false; } -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0 - if (isFinite(length)) { - length = length >>> 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } +Writable.prototype._writev = null; - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; } - if (!encoding) encoding = 'utf8' + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) + if (state.corked) { + state.corked = 1; + this.uncork(); + } // ignore unnecessary end() calls. - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - case 'ascii': - return asciiWrite(this, string, offset, length) + if (!state.ending) endWritable(this, state, cb); + return this; +}; - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true + if (err) { + errorOrDestroy(stream, err); } - } -} -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); } -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } } } -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] +function finishMaybe(stream, state) { + var need = needFinish(state); - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 + if (need) { + prefinish(stream, state); - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } } - - res.push(codePoint) - i += bytesPerSequence } - return decodeCodePointsArray(res) + return need; } -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); } - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res + state.ended = true; + stream.writable = false; } -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } // reuse the free corkReq. + + + state.corkedRequestsFree.next = corkReq; } -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed + + + this._writableState.destroyed = value; } - return ret +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; + +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":86,"./_stream_duplex":87,"./internal/streams/destroy":94,"./internal/streams/state":98,"./internal/streams/stream":99,"_process":393,"buffer":79,"inherits":309,"util-deprecate":343}],92:[function(require,module,exports){ +(function (process){ +'use strict'; + +var _Object$setPrototypeO; + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var finished = require('./end-of-stream'); + +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); + +function createIterResult(value, done) { + return { + value: value, + done: done + }; } -function hexSlice (buf, start, end) { - var len = buf.length +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len + if (resolve !== null) { + var data = iter[kStream].read(); // we defer if data is null + // we can be expecting either 'end' or + // 'error' - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } } - return out } -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) - } - return res +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); } -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, - if (end < start) end = start + next: function next() { + var _this = this; - var newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - newBuf.__proto__ = Buffer.prototype - return newBuf -} + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} + if (error !== null) { + return Promise.reject(error); + } -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time - return val -} -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } + var lastPromise = this[kLastPromise]; + var promise; - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + + promise = new Promise(this[kHandlePromise]); + } + + this[kLastPromise] = promise; + return promise; } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; - return val -} + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise + // returned by next() and store the error -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} + iterator[kError] = err; + return; + } -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) + var resolve = iterator[kLastResolve]; - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 +module.exports = createReadableStreamAsyncIterator; +}).call(this,require('_process')) +},{"./end-of-stream":95,"_process":393}],93:[function(require,module,exports){ +'use strict'; - if (val >= mul) val -= Math.pow(2, 8 * byteLength) +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - return val -} +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - if (val >= mul) val -= Math.pow(2, 8 * byteLength) +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - return val -} +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} +var _require = require('buffer'), + Buffer = _require.Buffer; -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} +var _require2 = require('util'), + inspect = _require2.inspect; -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val +var custom = inspect && inspect.custom || 'inspect'; + +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); } -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) +module.exports = +/*#__PURE__*/ +function () { + function BufferList() { + _classCallCheck(this, BufferList); - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} + this.head = null; + this.tail = null; + this.length = 0; + } -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} + while (p = p.next) { + ret += s + p.data; + } -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} + return ret; + } // Consumes a specified amount of bytes or characters from the buffered data. -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } // Consumes a specified amount of characters from the buffered data. - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; - return offset + byteLength -} + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } + break; + } - return offset + byteLength -} + ++c; + } -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - this[offset] = (value & 0xff) - return offset + 1 -} + this.length -= c; + return ret; + } // Consumes a specified amount of bytes from the buffered data. -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - return offset + 4 -} + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} + break; + } -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) + ++c; + } - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } + this.length -= c; + return ret; + } // Make sure the linked list only shows the minimal necessary information. - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread({}, options, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } + }]); - return offset + byteLength -} + return BufferList; +}(); +},{"buffer":79,"util":78}],94:[function(require,module,exports){ +(function (process){ +'use strict'; // undocumented cb() API, needed for core, not for public API -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) +function destroy(err, cb) { + var _this = this; - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - return offset + byteLength -} + return this; + } // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} + if (this._readableState) { + this._readableState.destroyed = true; + } // if this is a duplex stream mark the writable part as destroyed as well -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - return offset + 4 -} + if (this._writableState) { + this._writableState.destroyed = true; + } -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') + return this; } -function writeFloat (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); } -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); } -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 } -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) +function emitErrorNT(self, err) { + self.emit('error', err); } -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); } -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; +}).call(this,require('_process')) +},{"_process":393}],95:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 +var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } - var len = end - start + callback.apply(this, args); + }; +} - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (var i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } +function noop() {} - return len +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; } -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } else if (typeof val === 'number') { - val = val & 255 - } +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; - if (end <= start) { - return this - } + var writableEnded = stream._writableState && stream._writableState.finished; - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; - if (!val) val = 0 + var readableEnded = stream._readableState && stream._readableState.endEmitted; - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : Buffer.from(val, encoding) - var len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + + var onerror = function onerror(err) { + callback.call(stream, err); + }; + + var onclose = function onclose() { + var err; + + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] + + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } + }; + + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); } - return this + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; } -// HELPER FUNCTIONS -// ================ +module.exports = eos; +},{"../../../errors":86}],96:[function(require,module,exports){ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; -var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g +},{}],97:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} +var eos; -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; } -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] +var _require$codes = require('../../../errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} - // valid lead - leadSurrogate = codePoint +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('./end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; // request.destroy just do .end - .abort is what we want - continue - } + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } +function call(fn) { + fn(); +} - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } +function pipe(from, to) { + return from.pipe(to); +} - leadSurrogate = null +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; } - return bytes -} + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); } - return byteArray + + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); } -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break +module.exports = pipeline; +},{"../../../errors":86,"./end-of-stream":95}],98:[function(require,module,exports){ +'use strict'; - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } +var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; - return byteArray +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; } -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare + return Math.floor(hwm); + } // Default value + + + return state.objectMode ? 16 : 16 * 1024; } -}).call(this,require("buffer").Buffer) -},{"base64-js":76,"buffer":98,"ieee754":300}],99:[function(require,module,exports){ +module.exports = { + getHighWaterMark: getHighWaterMark +}; +},{"../../../errors":86}],99:[function(require,module,exports){ +module.exports = require('events').EventEmitter; + +},{"events":299}],100:[function(require,module,exports){ +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); +exports.finished = require('./lib/internal/streams/end-of-stream.js'); +exports.pipeline = require('./lib/internal/streams/pipeline.js'); + +},{"./lib/_stream_duplex.js":87,"./lib/_stream_passthrough.js":88,"./lib/_stream_readable.js":89,"./lib/_stream_transform.js":90,"./lib/_stream_writable.js":91,"./lib/internal/streams/end-of-stream.js":95,"./lib/internal/streams/pipeline.js":97}],101:[function(require,module,exports){ module.exports = { "100": "Continue", "101": "Switching Protocols", @@ -14397,7 +14746,7 @@ module.exports = { "511": "Network Authentication Required" } -},{}],100:[function(require,module,exports){ +},{}],102:[function(require,module,exports){ module.exports={ "O_RDONLY": 0, "O_WRONLY": 1, @@ -14608,7 +14957,7 @@ module.exports={ "UV_UDP_REUSEADDR": 4 } -},{}],101:[function(require,module,exports){ +},{}],103:[function(require,module,exports){ /*! * copy-to - index.js * Copyright(c) 2014 dead_horse @@ -14771,14 +15120,14 @@ function notDefined(obj, key) { && obj.__lookupSetter__(key) === undefined; } -},{}],102:[function(require,module,exports){ +},{}],104:[function(require,module,exports){ module.exports = function (it) { if (typeof it != 'function') { throw TypeError(String(it) + ' is not a function'); } return it; }; -},{}],103:[function(require,module,exports){ +},{}],105:[function(require,module,exports){ var isObject = require('../internals/is-object'); module.exports = function (it) { @@ -14787,7 +15136,7 @@ module.exports = function (it) { } return it; }; -},{"../internals/is-object":164}],104:[function(require,module,exports){ +},{"../internals/is-object":166}],106:[function(require,module,exports){ var wellKnownSymbol = require('../internals/well-known-symbol'); var create = require('../internals/object-create'); var definePropertyModule = require('../internals/object-define-property'); @@ -14809,7 +15158,7 @@ module.exports = function (key) { ArrayPrototype[UNSCOPABLES][key] = true; }; -},{"../internals/object-create":178,"../internals/object-define-property":180,"../internals/well-known-symbol":231}],105:[function(require,module,exports){ +},{"../internals/object-create":180,"../internals/object-define-property":182,"../internals/well-known-symbol":233}],107:[function(require,module,exports){ 'use strict'; var charAt = require('../internals/string-multibyte').charAt; @@ -14819,14 +15168,14 @@ module.exports = function (S, index, unicode) { return index + (unicode ? charAt(S, index).length : 1); }; -},{"../internals/string-multibyte":211}],106:[function(require,module,exports){ +},{"../internals/string-multibyte":213}],108:[function(require,module,exports){ module.exports = function (it, Constructor, name) { if (!(it instanceof Constructor)) { throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); } return it; }; -},{}],107:[function(require,module,exports){ +},{}],109:[function(require,module,exports){ var isObject = require('../internals/is-object'); module.exports = function (it) { @@ -14835,10 +15184,10 @@ module.exports = function (it) { } return it; }; -},{"../internals/is-object":164}],108:[function(require,module,exports){ +},{"../internals/is-object":166}],110:[function(require,module,exports){ module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined'; -},{}],109:[function(require,module,exports){ +},{}],111:[function(require,module,exports){ 'use strict'; var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native'); var DESCRIPTORS = require('../internals/descriptors'); @@ -14996,7 +15345,7 @@ module.exports = { TypedArrayPrototype: TypedArrayPrototype }; -},{"../internals/array-buffer-native":108,"../internals/classof":126,"../internals/create-non-enumerable-property":131,"../internals/descriptors":136,"../internals/global":150,"../internals/has":151,"../internals/is-object":164,"../internals/object-define-property":180,"../internals/object-get-prototype-of":185,"../internals/object-set-prototype-of":189,"../internals/redefine":197,"../internals/uid":228,"../internals/well-known-symbol":231}],110:[function(require,module,exports){ +},{"../internals/array-buffer-native":110,"../internals/classof":128,"../internals/create-non-enumerable-property":133,"../internals/descriptors":138,"../internals/global":152,"../internals/has":153,"../internals/is-object":166,"../internals/object-define-property":182,"../internals/object-get-prototype-of":187,"../internals/object-set-prototype-of":191,"../internals/redefine":199,"../internals/uid":230,"../internals/well-known-symbol":233}],112:[function(require,module,exports){ 'use strict'; var global = require('../internals/global'); var DESCRIPTORS = require('../internals/descriptors'); @@ -15224,7 +15573,7 @@ module.exports = { DataView: $DataView }; -},{"../internals/an-instance":106,"../internals/array-buffer-native":108,"../internals/array-fill":112,"../internals/create-non-enumerable-property":131,"../internals/descriptors":136,"../internals/fails":145,"../internals/global":150,"../internals/ieee754":156,"../internals/internal-state":160,"../internals/object-define-property":180,"../internals/object-get-own-property-names":183,"../internals/object-get-prototype-of":185,"../internals/object-set-prototype-of":189,"../internals/redefine-all":196,"../internals/set-to-string-tag":206,"../internals/to-index":216,"../internals/to-integer":218,"../internals/to-length":219}],111:[function(require,module,exports){ +},{"../internals/an-instance":108,"../internals/array-buffer-native":110,"../internals/array-fill":114,"../internals/create-non-enumerable-property":133,"../internals/descriptors":138,"../internals/fails":147,"../internals/global":152,"../internals/ieee754":158,"../internals/internal-state":162,"../internals/object-define-property":182,"../internals/object-get-own-property-names":185,"../internals/object-get-prototype-of":187,"../internals/object-set-prototype-of":191,"../internals/redefine-all":198,"../internals/set-to-string-tag":208,"../internals/to-index":218,"../internals/to-integer":220,"../internals/to-length":221}],113:[function(require,module,exports){ 'use strict'; var toObject = require('../internals/to-object'); var toAbsoluteIndex = require('../internals/to-absolute-index'); @@ -15255,7 +15604,7 @@ module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* } return O; }; -},{"../internals/to-absolute-index":215,"../internals/to-length":219,"../internals/to-object":220}],112:[function(require,module,exports){ +},{"../internals/to-absolute-index":217,"../internals/to-length":221,"../internals/to-object":222}],114:[function(require,module,exports){ 'use strict'; var toObject = require('../internals/to-object'); var toAbsoluteIndex = require('../internals/to-absolute-index'); @@ -15274,7 +15623,7 @@ module.exports = function fill(value /* , start = 0, end = @length */) { return O; }; -},{"../internals/to-absolute-index":215,"../internals/to-length":219,"../internals/to-object":220}],113:[function(require,module,exports){ +},{"../internals/to-absolute-index":217,"../internals/to-length":221,"../internals/to-object":222}],115:[function(require,module,exports){ 'use strict'; var $forEach = require('../internals/array-iteration').forEach; var arrayMethodIsStrict = require('../internals/array-method-is-strict'); @@ -15289,7 +15638,7 @@ module.exports = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callback return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } : [].forEach; -},{"../internals/array-iteration":116,"../internals/array-method-is-strict":119,"../internals/array-method-uses-to-length":120}],114:[function(require,module,exports){ +},{"../internals/array-iteration":118,"../internals/array-method-is-strict":121,"../internals/array-method-uses-to-length":122}],116:[function(require,module,exports){ 'use strict'; var bind = require('../internals/function-bind-context'); var toObject = require('../internals/to-object'); @@ -15332,7 +15681,7 @@ module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undef return result; }; -},{"../internals/call-with-safe-iteration-closing":123,"../internals/create-property":133,"../internals/function-bind-context":147,"../internals/get-iterator-method":149,"../internals/is-array-iterator-method":161,"../internals/to-length":219,"../internals/to-object":220}],115:[function(require,module,exports){ +},{"../internals/call-with-safe-iteration-closing":125,"../internals/create-property":135,"../internals/function-bind-context":149,"../internals/get-iterator-method":151,"../internals/is-array-iterator-method":163,"../internals/to-length":221,"../internals/to-object":222}],117:[function(require,module,exports){ var toIndexedObject = require('../internals/to-indexed-object'); var toLength = require('../internals/to-length'); var toAbsoluteIndex = require('../internals/to-absolute-index'); @@ -15366,7 +15715,7 @@ module.exports = { indexOf: createMethod(false) }; -},{"../internals/to-absolute-index":215,"../internals/to-indexed-object":217,"../internals/to-length":219}],116:[function(require,module,exports){ +},{"../internals/to-absolute-index":217,"../internals/to-indexed-object":219,"../internals/to-length":221}],118:[function(require,module,exports){ var bind = require('../internals/function-bind-context'); var IndexedObject = require('../internals/indexed-object'); var toObject = require('../internals/to-object'); @@ -15433,7 +15782,7 @@ module.exports = { findIndex: createMethod(6) }; -},{"../internals/array-species-create":122,"../internals/function-bind-context":147,"../internals/indexed-object":157,"../internals/to-length":219,"../internals/to-object":220}],117:[function(require,module,exports){ +},{"../internals/array-species-create":124,"../internals/function-bind-context":149,"../internals/indexed-object":159,"../internals/to-length":221,"../internals/to-object":222}],119:[function(require,module,exports){ 'use strict'; var toIndexedObject = require('../internals/to-indexed-object'); var toInteger = require('../internals/to-integer'); @@ -15463,7 +15812,7 @@ module.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[ return -1; } : nativeLastIndexOf; -},{"../internals/array-method-is-strict":119,"../internals/array-method-uses-to-length":120,"../internals/to-indexed-object":217,"../internals/to-integer":218,"../internals/to-length":219}],118:[function(require,module,exports){ +},{"../internals/array-method-is-strict":121,"../internals/array-method-uses-to-length":122,"../internals/to-indexed-object":219,"../internals/to-integer":220,"../internals/to-length":221}],120:[function(require,module,exports){ var fails = require('../internals/fails'); var wellKnownSymbol = require('../internals/well-known-symbol'); var V8_VERSION = require('../internals/engine-v8-version'); @@ -15484,7 +15833,7 @@ module.exports = function (METHOD_NAME) { }); }; -},{"../internals/engine-v8-version":142,"../internals/fails":145,"../internals/well-known-symbol":231}],119:[function(require,module,exports){ +},{"../internals/engine-v8-version":144,"../internals/fails":147,"../internals/well-known-symbol":233}],121:[function(require,module,exports){ 'use strict'; var fails = require('../internals/fails'); @@ -15496,7 +15845,7 @@ module.exports = function (METHOD_NAME, argument) { }); }; -},{"../internals/fails":145}],120:[function(require,module,exports){ +},{"../internals/fails":147}],122:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var fails = require('../internals/fails'); var has = require('../internals/has'); @@ -15525,7 +15874,7 @@ module.exports = function (METHOD_NAME, options) { }); }; -},{"../internals/descriptors":136,"../internals/fails":145,"../internals/has":151}],121:[function(require,module,exports){ +},{"../internals/descriptors":138,"../internals/fails":147,"../internals/has":153}],123:[function(require,module,exports){ var aFunction = require('../internals/a-function'); var toObject = require('../internals/to-object'); var IndexedObject = require('../internals/indexed-object'); @@ -15567,7 +15916,7 @@ module.exports = { right: createMethod(true) }; -},{"../internals/a-function":102,"../internals/indexed-object":157,"../internals/to-length":219,"../internals/to-object":220}],122:[function(require,module,exports){ +},{"../internals/a-function":104,"../internals/indexed-object":159,"../internals/to-length":221,"../internals/to-object":222}],124:[function(require,module,exports){ var isObject = require('../internals/is-object'); var isArray = require('../internals/is-array'); var wellKnownSymbol = require('../internals/well-known-symbol'); @@ -15589,7 +15938,7 @@ module.exports = function (originalArray, length) { } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); }; -},{"../internals/is-array":162,"../internals/is-object":164,"../internals/well-known-symbol":231}],123:[function(require,module,exports){ +},{"../internals/is-array":164,"../internals/is-object":166,"../internals/well-known-symbol":233}],125:[function(require,module,exports){ var anObject = require('../internals/an-object'); var iteratorClose = require('../internals/iterator-close'); @@ -15604,7 +15953,7 @@ module.exports = function (iterator, fn, value, ENTRIES) { } }; -},{"../internals/an-object":107,"../internals/iterator-close":168}],124:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/iterator-close":170}],126:[function(require,module,exports){ var wellKnownSymbol = require('../internals/well-known-symbol'); var ITERATOR = wellKnownSymbol('iterator'); @@ -15644,14 +15993,14 @@ module.exports = function (exec, SKIP_CLOSING) { return ITERATION_SUPPORT; }; -},{"../internals/well-known-symbol":231}],125:[function(require,module,exports){ +},{"../internals/well-known-symbol":233}],127:[function(require,module,exports){ var toString = {}.toString; module.exports = function (it) { return toString.call(it).slice(8, -1); }; -},{}],126:[function(require,module,exports){ +},{}],128:[function(require,module,exports){ var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support'); var classofRaw = require('../internals/classof-raw'); var wellKnownSymbol = require('../internals/well-known-symbol'); @@ -15679,7 +16028,7 @@ module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; }; -},{"../internals/classof-raw":125,"../internals/to-string-tag-support":224,"../internals/well-known-symbol":231}],127:[function(require,module,exports){ +},{"../internals/classof-raw":127,"../internals/to-string-tag-support":226,"../internals/well-known-symbol":233}],129:[function(require,module,exports){ var has = require('../internals/has'); var ownKeys = require('../internals/own-keys'); var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); @@ -15695,7 +16044,7 @@ module.exports = function (target, source) { } }; -},{"../internals/has":151,"../internals/object-define-property":180,"../internals/object-get-own-property-descriptor":181,"../internals/own-keys":192}],128:[function(require,module,exports){ +},{"../internals/has":153,"../internals/object-define-property":182,"../internals/object-get-own-property-descriptor":183,"../internals/own-keys":194}],130:[function(require,module,exports){ var wellKnownSymbol = require('../internals/well-known-symbol'); var MATCH = wellKnownSymbol('match'); @@ -15712,7 +16061,7 @@ module.exports = function (METHOD_NAME) { } return false; }; -},{"../internals/well-known-symbol":231}],129:[function(require,module,exports){ +},{"../internals/well-known-symbol":233}],131:[function(require,module,exports){ var fails = require('../internals/fails'); module.exports = !fails(function () { @@ -15721,7 +16070,7 @@ module.exports = !fails(function () { return Object.getPrototypeOf(new F()) !== F.prototype; }); -},{"../internals/fails":145}],130:[function(require,module,exports){ +},{"../internals/fails":147}],132:[function(require,module,exports){ 'use strict'; var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype; var create = require('../internals/object-create'); @@ -15739,7 +16088,7 @@ module.exports = function (IteratorConstructor, NAME, next) { return IteratorConstructor; }; -},{"../internals/create-property-descriptor":132,"../internals/iterators":170,"../internals/iterators-core":169,"../internals/object-create":178,"../internals/set-to-string-tag":206}],131:[function(require,module,exports){ +},{"../internals/create-property-descriptor":134,"../internals/iterators":172,"../internals/iterators-core":171,"../internals/object-create":180,"../internals/set-to-string-tag":208}],133:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var definePropertyModule = require('../internals/object-define-property'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); @@ -15751,7 +16100,7 @@ module.exports = DESCRIPTORS ? function (object, key, value) { return object; }; -},{"../internals/create-property-descriptor":132,"../internals/descriptors":136,"../internals/object-define-property":180}],132:[function(require,module,exports){ +},{"../internals/create-property-descriptor":134,"../internals/descriptors":138,"../internals/object-define-property":182}],134:[function(require,module,exports){ module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), @@ -15761,7 +16110,7 @@ module.exports = function (bitmap, value) { }; }; -},{}],133:[function(require,module,exports){ +},{}],135:[function(require,module,exports){ 'use strict'; var toPrimitive = require('../internals/to-primitive'); var definePropertyModule = require('../internals/object-define-property'); @@ -15773,7 +16122,7 @@ module.exports = function (object, key, value) { else object[propertyKey] = value; }; -},{"../internals/create-property-descriptor":132,"../internals/object-define-property":180,"../internals/to-primitive":223}],134:[function(require,module,exports){ +},{"../internals/create-property-descriptor":134,"../internals/object-define-property":182,"../internals/to-primitive":225}],136:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var createIteratorConstructor = require('../internals/create-iterator-constructor'); @@ -15865,7 +16214,7 @@ module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, I return methods; }; -},{"../internals/create-iterator-constructor":130,"../internals/create-non-enumerable-property":131,"../internals/export":144,"../internals/is-pure":165,"../internals/iterators":170,"../internals/iterators-core":169,"../internals/object-get-prototype-of":185,"../internals/object-set-prototype-of":189,"../internals/redefine":197,"../internals/set-to-string-tag":206,"../internals/well-known-symbol":231}],135:[function(require,module,exports){ +},{"../internals/create-iterator-constructor":132,"../internals/create-non-enumerable-property":133,"../internals/export":146,"../internals/is-pure":167,"../internals/iterators":172,"../internals/iterators-core":171,"../internals/object-get-prototype-of":187,"../internals/object-set-prototype-of":191,"../internals/redefine":199,"../internals/set-to-string-tag":208,"../internals/well-known-symbol":233}],137:[function(require,module,exports){ var path = require('../internals/path'); var has = require('../internals/has'); var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped'); @@ -15878,7 +16227,7 @@ module.exports = function (NAME) { }); }; -},{"../internals/has":151,"../internals/object-define-property":180,"../internals/path":193,"../internals/well-known-symbol-wrapped":230}],136:[function(require,module,exports){ +},{"../internals/has":153,"../internals/object-define-property":182,"../internals/path":195,"../internals/well-known-symbol-wrapped":232}],138:[function(require,module,exports){ var fails = require('../internals/fails'); // Thank's IE8 for his funny defineProperty @@ -15886,7 +16235,7 @@ module.exports = !fails(function () { return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); -},{"../internals/fails":145}],137:[function(require,module,exports){ +},{"../internals/fails":147}],139:[function(require,module,exports){ var global = require('../internals/global'); var isObject = require('../internals/is-object'); @@ -15898,7 +16247,7 @@ module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; -},{"../internals/global":150,"../internals/is-object":164}],138:[function(require,module,exports){ +},{"../internals/global":152,"../internals/is-object":166}],140:[function(require,module,exports){ // iterable DOM collections // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods module.exports = { @@ -15935,23 +16284,23 @@ module.exports = { TouchList: 0 }; -},{}],139:[function(require,module,exports){ +},{}],141:[function(require,module,exports){ var userAgent = require('../internals/engine-user-agent'); module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent); -},{"../internals/engine-user-agent":141}],140:[function(require,module,exports){ +},{"../internals/engine-user-agent":143}],142:[function(require,module,exports){ var classof = require('../internals/classof-raw'); var global = require('../internals/global'); module.exports = classof(global.process) == 'process'; -},{"../internals/classof-raw":125,"../internals/global":150}],141:[function(require,module,exports){ +},{"../internals/classof-raw":127,"../internals/global":152}],143:[function(require,module,exports){ var getBuiltIn = require('../internals/get-built-in'); module.exports = getBuiltIn('navigator', 'userAgent') || ''; -},{"../internals/get-built-in":148}],142:[function(require,module,exports){ +},{"../internals/get-built-in":150}],144:[function(require,module,exports){ var global = require('../internals/global'); var userAgent = require('../internals/engine-user-agent'); @@ -15973,7 +16322,7 @@ if (v8) { module.exports = version && +version; -},{"../internals/engine-user-agent":141,"../internals/global":150}],143:[function(require,module,exports){ +},{"../internals/engine-user-agent":143,"../internals/global":152}],145:[function(require,module,exports){ // IE8- don't enum bug keys module.exports = [ 'constructor', @@ -15985,7 +16334,7 @@ module.exports = [ 'valueOf' ]; -},{}],144:[function(require,module,exports){ +},{}],146:[function(require,module,exports){ var global = require('../internals/global'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); @@ -16041,7 +16390,7 @@ module.exports = function (options, source) { } }; -},{"../internals/copy-constructor-properties":127,"../internals/create-non-enumerable-property":131,"../internals/global":150,"../internals/is-forced":163,"../internals/object-get-own-property-descriptor":181,"../internals/redefine":197,"../internals/set-global":204}],145:[function(require,module,exports){ +},{"../internals/copy-constructor-properties":129,"../internals/create-non-enumerable-property":133,"../internals/global":152,"../internals/is-forced":165,"../internals/object-get-own-property-descriptor":183,"../internals/redefine":199,"../internals/set-global":206}],147:[function(require,module,exports){ module.exports = function (exec) { try { return !!exec(); @@ -16050,7 +16399,7 @@ module.exports = function (exec) { } }; -},{}],146:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ 'use strict'; // TODO: Remove from `core-js@4` since it's moved to entry points require('../modules/es.regexp.exec'); @@ -16177,7 +16526,7 @@ module.exports = function (KEY, length, exec, sham) { if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true); }; -},{"../internals/create-non-enumerable-property":131,"../internals/fails":145,"../internals/redefine":197,"../internals/regexp-exec":199,"../internals/well-known-symbol":231,"../modules/es.regexp.exec":256}],147:[function(require,module,exports){ +},{"../internals/create-non-enumerable-property":133,"../internals/fails":147,"../internals/redefine":199,"../internals/regexp-exec":201,"../internals/well-known-symbol":233,"../modules/es.regexp.exec":258}],149:[function(require,module,exports){ var aFunction = require('../internals/a-function'); // optional / simple context binding @@ -16203,7 +16552,7 @@ module.exports = function (fn, that, length) { }; }; -},{"../internals/a-function":102}],148:[function(require,module,exports){ +},{"../internals/a-function":104}],150:[function(require,module,exports){ var path = require('../internals/path'); var global = require('../internals/global'); @@ -16216,7 +16565,7 @@ module.exports = function (namespace, method) { : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method]; }; -},{"../internals/global":150,"../internals/path":193}],149:[function(require,module,exports){ +},{"../internals/global":152,"../internals/path":195}],151:[function(require,module,exports){ var classof = require('../internals/classof'); var Iterators = require('../internals/iterators'); var wellKnownSymbol = require('../internals/well-known-symbol'); @@ -16229,7 +16578,7 @@ module.exports = function (it) { || Iterators[classof(it)]; }; -},{"../internals/classof":126,"../internals/iterators":170,"../internals/well-known-symbol":231}],150:[function(require,module,exports){ +},{"../internals/classof":128,"../internals/iterators":172,"../internals/well-known-symbol":233}],152:[function(require,module,exports){ (function (global){ var check = function (it) { return it && it.Math == Math && it; @@ -16246,17 +16595,17 @@ module.exports = (function () { return this; })() || Function('return this')(); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],151:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; -},{}],152:[function(require,module,exports){ +},{}],154:[function(require,module,exports){ module.exports = {}; -},{}],153:[function(require,module,exports){ +},{}],155:[function(require,module,exports){ var global = require('../internals/global'); module.exports = function (a, b) { @@ -16266,12 +16615,12 @@ module.exports = function (a, b) { } }; -},{"../internals/global":150}],154:[function(require,module,exports){ +},{"../internals/global":152}],156:[function(require,module,exports){ var getBuiltIn = require('../internals/get-built-in'); module.exports = getBuiltIn('document', 'documentElement'); -},{"../internals/get-built-in":148}],155:[function(require,module,exports){ +},{"../internals/get-built-in":150}],157:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var fails = require('../internals/fails'); var createElement = require('../internals/document-create-element'); @@ -16283,7 +16632,7 @@ module.exports = !DESCRIPTORS && !fails(function () { }).a != 7; }); -},{"../internals/descriptors":136,"../internals/document-create-element":137,"../internals/fails":145}],156:[function(require,module,exports){ +},{"../internals/descriptors":138,"../internals/document-create-element":139,"../internals/fails":147}],158:[function(require,module,exports){ // IEEE754 conversions based on https://github.com/feross/ieee754 // eslint-disable-next-line no-shadow-restricted-names var Infinity = 1 / 0; @@ -16373,7 +16722,7 @@ module.exports = { unpack: unpack }; -},{}],157:[function(require,module,exports){ +},{}],159:[function(require,module,exports){ var fails = require('../internals/fails'); var classof = require('../internals/classof-raw'); @@ -16388,7 +16737,7 @@ module.exports = fails(function () { return classof(it) == 'String' ? split.call(it, '') : Object(it); } : Object; -},{"../internals/classof-raw":125,"../internals/fails":145}],158:[function(require,module,exports){ +},{"../internals/classof-raw":127,"../internals/fails":147}],160:[function(require,module,exports){ var isObject = require('../internals/is-object'); var setPrototypeOf = require('../internals/object-set-prototype-of'); @@ -16407,7 +16756,7 @@ module.exports = function ($this, dummy, Wrapper) { return $this; }; -},{"../internals/is-object":164,"../internals/object-set-prototype-of":189}],159:[function(require,module,exports){ +},{"../internals/is-object":166,"../internals/object-set-prototype-of":191}],161:[function(require,module,exports){ var store = require('../internals/shared-store'); var functionToString = Function.toString; @@ -16421,7 +16770,7 @@ if (typeof store.inspectSource != 'function') { module.exports = store.inspectSource; -},{"../internals/shared-store":208}],160:[function(require,module,exports){ +},{"../internals/shared-store":210}],162:[function(require,module,exports){ var NATIVE_WEAK_MAP = require('../internals/native-weak-map'); var global = require('../internals/global'); var isObject = require('../internals/is-object'); @@ -16487,7 +16836,7 @@ module.exports = { getterFor: getterFor }; -},{"../internals/create-non-enumerable-property":131,"../internals/global":150,"../internals/has":151,"../internals/hidden-keys":152,"../internals/is-object":164,"../internals/native-weak-map":174,"../internals/shared-key":207,"../internals/shared-store":208}],161:[function(require,module,exports){ +},{"../internals/create-non-enumerable-property":133,"../internals/global":152,"../internals/has":153,"../internals/hidden-keys":154,"../internals/is-object":166,"../internals/native-weak-map":176,"../internals/shared-key":209,"../internals/shared-store":210}],163:[function(require,module,exports){ var wellKnownSymbol = require('../internals/well-known-symbol'); var Iterators = require('../internals/iterators'); @@ -16499,7 +16848,7 @@ module.exports = function (it) { return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); }; -},{"../internals/iterators":170,"../internals/well-known-symbol":231}],162:[function(require,module,exports){ +},{"../internals/iterators":172,"../internals/well-known-symbol":233}],164:[function(require,module,exports){ var classof = require('../internals/classof-raw'); // `IsArray` abstract operation @@ -16508,7 +16857,7 @@ module.exports = Array.isArray || function isArray(arg) { return classof(arg) == 'Array'; }; -},{"../internals/classof-raw":125}],163:[function(require,module,exports){ +},{"../internals/classof-raw":127}],165:[function(require,module,exports){ var fails = require('../internals/fails'); var replacement = /#|\.prototype\./; @@ -16531,15 +16880,15 @@ var POLYFILL = isForced.POLYFILL = 'P'; module.exports = isForced; -},{"../internals/fails":145}],164:[function(require,module,exports){ +},{"../internals/fails":147}],166:[function(require,module,exports){ module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; -},{}],165:[function(require,module,exports){ +},{}],167:[function(require,module,exports){ module.exports = false; -},{}],166:[function(require,module,exports){ +},{}],168:[function(require,module,exports){ var isObject = require('../internals/is-object'); var classof = require('../internals/classof-raw'); var wellKnownSymbol = require('../internals/well-known-symbol'); @@ -16553,7 +16902,7 @@ module.exports = function (it) { return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp'); }; -},{"../internals/classof-raw":125,"../internals/is-object":164,"../internals/well-known-symbol":231}],167:[function(require,module,exports){ +},{"../internals/classof-raw":127,"../internals/is-object":166,"../internals/well-known-symbol":233}],169:[function(require,module,exports){ var anObject = require('../internals/an-object'); var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); var toLength = require('../internals/to-length'); @@ -16613,7 +16962,7 @@ module.exports = function (iterable, unboundFunction, options) { } return new Result(false); }; -},{"../internals/an-object":107,"../internals/function-bind-context":147,"../internals/get-iterator-method":149,"../internals/is-array-iterator-method":161,"../internals/iterator-close":168,"../internals/to-length":219}],168:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/function-bind-context":149,"../internals/get-iterator-method":151,"../internals/is-array-iterator-method":163,"../internals/iterator-close":170,"../internals/to-length":221}],170:[function(require,module,exports){ var anObject = require('../internals/an-object'); module.exports = function (iterator) { @@ -16623,7 +16972,7 @@ module.exports = function (iterator) { } }; -},{"../internals/an-object":107}],169:[function(require,module,exports){ +},{"../internals/an-object":109}],171:[function(require,module,exports){ 'use strict'; var getPrototypeOf = require('../internals/object-get-prototype-of'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); @@ -16662,9 +17011,9 @@ module.exports = { BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS }; -},{"../internals/create-non-enumerable-property":131,"../internals/has":151,"../internals/is-pure":165,"../internals/object-get-prototype-of":185,"../internals/well-known-symbol":231}],170:[function(require,module,exports){ -arguments[4][152][0].apply(exports,arguments) -},{"dup":152}],171:[function(require,module,exports){ +},{"../internals/create-non-enumerable-property":133,"../internals/has":153,"../internals/is-pure":167,"../internals/object-get-prototype-of":187,"../internals/well-known-symbol":233}],172:[function(require,module,exports){ +arguments[4][154][0].apply(exports,arguments) +},{"dup":154}],173:[function(require,module,exports){ var global = require('../internals/global'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var macrotask = require('../internals/task').set; @@ -16744,12 +17093,12 @@ module.exports = queueMicrotask || function (fn) { } last = task; }; -},{"../internals/engine-is-ios":139,"../internals/engine-is-node":140,"../internals/global":150,"../internals/object-get-own-property-descriptor":181,"../internals/task":214}],172:[function(require,module,exports){ +},{"../internals/engine-is-ios":141,"../internals/engine-is-node":142,"../internals/global":152,"../internals/object-get-own-property-descriptor":183,"../internals/task":216}],174:[function(require,module,exports){ var global = require('../internals/global'); module.exports = global.Promise; -},{"../internals/global":150}],173:[function(require,module,exports){ +},{"../internals/global":152}],175:[function(require,module,exports){ var fails = require('../internals/fails'); module.exports = !!Object.getOwnPropertySymbols && !fails(function () { @@ -16758,7 +17107,7 @@ module.exports = !!Object.getOwnPropertySymbols && !fails(function () { return !String(Symbol()); }); -},{"../internals/fails":145}],174:[function(require,module,exports){ +},{"../internals/fails":147}],176:[function(require,module,exports){ var global = require('../internals/global'); var inspectSource = require('../internals/inspect-source'); @@ -16766,7 +17115,7 @@ var WeakMap = global.WeakMap; module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap)); -},{"../internals/global":150,"../internals/inspect-source":159}],175:[function(require,module,exports){ +},{"../internals/global":152,"../internals/inspect-source":161}],177:[function(require,module,exports){ 'use strict'; var aFunction = require('../internals/a-function'); @@ -16786,7 +17135,7 @@ module.exports.f = function (C) { return new PromiseCapability(C); }; -},{"../internals/a-function":102}],176:[function(require,module,exports){ +},{"../internals/a-function":104}],178:[function(require,module,exports){ var isRegExp = require('../internals/is-regexp'); module.exports = function (it) { @@ -16795,7 +17144,7 @@ module.exports = function (it) { } return it; }; -},{"../internals/is-regexp":166}],177:[function(require,module,exports){ +},{"../internals/is-regexp":168}],179:[function(require,module,exports){ 'use strict'; var DESCRIPTORS = require('../internals/descriptors'); var fails = require('../internals/fails'); @@ -16849,7 +17198,7 @@ module.exports = !nativeAssign || fails(function () { } return T; } : nativeAssign; -},{"../internals/descriptors":136,"../internals/fails":145,"../internals/indexed-object":157,"../internals/object-get-own-property-symbols":184,"../internals/object-keys":187,"../internals/object-property-is-enumerable":188,"../internals/to-object":220}],178:[function(require,module,exports){ +},{"../internals/descriptors":138,"../internals/fails":147,"../internals/indexed-object":159,"../internals/object-get-own-property-symbols":186,"../internals/object-keys":189,"../internals/object-property-is-enumerable":190,"../internals/to-object":222}],180:[function(require,module,exports){ var anObject = require('../internals/an-object'); var defineProperties = require('../internals/object-define-properties'); var enumBugKeys = require('../internals/enum-bug-keys'); @@ -16929,7 +17278,7 @@ module.exports = Object.create || function create(O, Properties) { return Properties === undefined ? result : defineProperties(result, Properties); }; -},{"../internals/an-object":107,"../internals/document-create-element":137,"../internals/enum-bug-keys":143,"../internals/hidden-keys":152,"../internals/html":154,"../internals/object-define-properties":179,"../internals/shared-key":207}],179:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/document-create-element":139,"../internals/enum-bug-keys":145,"../internals/hidden-keys":154,"../internals/html":156,"../internals/object-define-properties":181,"../internals/shared-key":209}],181:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var definePropertyModule = require('../internals/object-define-property'); var anObject = require('../internals/an-object'); @@ -16947,7 +17296,7 @@ module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperti return O; }; -},{"../internals/an-object":107,"../internals/descriptors":136,"../internals/object-define-property":180,"../internals/object-keys":187}],180:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/descriptors":138,"../internals/object-define-property":182,"../internals/object-keys":189}],182:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var IE8_DOM_DEFINE = require('../internals/ie8-dom-define'); var anObject = require('../internals/an-object'); @@ -16969,7 +17318,7 @@ exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, A return O; }; -},{"../internals/an-object":107,"../internals/descriptors":136,"../internals/ie8-dom-define":155,"../internals/to-primitive":223}],181:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/descriptors":138,"../internals/ie8-dom-define":157,"../internals/to-primitive":225}],183:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); @@ -16991,7 +17340,7 @@ exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnProper if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); }; -},{"../internals/create-property-descriptor":132,"../internals/descriptors":136,"../internals/has":151,"../internals/ie8-dom-define":155,"../internals/object-property-is-enumerable":188,"../internals/to-indexed-object":217,"../internals/to-primitive":223}],182:[function(require,module,exports){ +},{"../internals/create-property-descriptor":134,"../internals/descriptors":138,"../internals/has":153,"../internals/ie8-dom-define":157,"../internals/object-property-is-enumerable":190,"../internals/to-indexed-object":219,"../internals/to-primitive":225}],184:[function(require,module,exports){ var toIndexedObject = require('../internals/to-indexed-object'); var nativeGetOwnPropertyNames = require('../internals/object-get-own-property-names').f; @@ -17015,7 +17364,7 @@ module.exports.f = function getOwnPropertyNames(it) { : nativeGetOwnPropertyNames(toIndexedObject(it)); }; -},{"../internals/object-get-own-property-names":183,"../internals/to-indexed-object":217}],183:[function(require,module,exports){ +},{"../internals/object-get-own-property-names":185,"../internals/to-indexed-object":219}],185:[function(require,module,exports){ var internalObjectKeys = require('../internals/object-keys-internal'); var enumBugKeys = require('../internals/enum-bug-keys'); @@ -17027,10 +17376,10 @@ exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys(O, hiddenKeys); }; -},{"../internals/enum-bug-keys":143,"../internals/object-keys-internal":186}],184:[function(require,module,exports){ +},{"../internals/enum-bug-keys":145,"../internals/object-keys-internal":188}],186:[function(require,module,exports){ exports.f = Object.getOwnPropertySymbols; -},{}],185:[function(require,module,exports){ +},{}],187:[function(require,module,exports){ var has = require('../internals/has'); var toObject = require('../internals/to-object'); var sharedKey = require('../internals/shared-key'); @@ -17049,7 +17398,7 @@ module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) } return O instanceof Object ? ObjectPrototype : null; }; -},{"../internals/correct-prototype-getter":129,"../internals/has":151,"../internals/shared-key":207,"../internals/to-object":220}],186:[function(require,module,exports){ +},{"../internals/correct-prototype-getter":131,"../internals/has":153,"../internals/shared-key":209,"../internals/to-object":222}],188:[function(require,module,exports){ var has = require('../internals/has'); var toIndexedObject = require('../internals/to-indexed-object'); var indexOf = require('../internals/array-includes').indexOf; @@ -17068,7 +17417,7 @@ module.exports = function (object, names) { return result; }; -},{"../internals/array-includes":115,"../internals/has":151,"../internals/hidden-keys":152,"../internals/to-indexed-object":217}],187:[function(require,module,exports){ +},{"../internals/array-includes":117,"../internals/has":153,"../internals/hidden-keys":154,"../internals/to-indexed-object":219}],189:[function(require,module,exports){ var internalObjectKeys = require('../internals/object-keys-internal'); var enumBugKeys = require('../internals/enum-bug-keys'); @@ -17078,7 +17427,7 @@ module.exports = Object.keys || function keys(O) { return internalObjectKeys(O, enumBugKeys); }; -},{"../internals/enum-bug-keys":143,"../internals/object-keys-internal":186}],188:[function(require,module,exports){ +},{"../internals/enum-bug-keys":145,"../internals/object-keys-internal":188}],190:[function(require,module,exports){ 'use strict'; var nativePropertyIsEnumerable = {}.propertyIsEnumerable; var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; @@ -17093,7 +17442,7 @@ exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { return !!descriptor && descriptor.enumerable; } : nativePropertyIsEnumerable; -},{}],189:[function(require,module,exports){ +},{}],191:[function(require,module,exports){ var anObject = require('../internals/an-object'); var aPossiblePrototype = require('../internals/a-possible-prototype'); @@ -17119,7 +17468,7 @@ module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { }; }() : undefined); -},{"../internals/a-possible-prototype":103,"../internals/an-object":107}],190:[function(require,module,exports){ +},{"../internals/a-possible-prototype":105,"../internals/an-object":109}],192:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var objectKeys = require('../internals/object-keys'); var toIndexedObject = require('../internals/to-indexed-object'); @@ -17153,7 +17502,7 @@ module.exports = { values: createMethod(false) }; -},{"../internals/descriptors":136,"../internals/object-keys":187,"../internals/object-property-is-enumerable":188,"../internals/to-indexed-object":217}],191:[function(require,module,exports){ +},{"../internals/descriptors":138,"../internals/object-keys":189,"../internals/object-property-is-enumerable":190,"../internals/to-indexed-object":219}],193:[function(require,module,exports){ 'use strict'; var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support'); var classof = require('../internals/classof'); @@ -17164,7 +17513,7 @@ module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() { return '[object ' + classof(this) + ']'; }; -},{"../internals/classof":126,"../internals/to-string-tag-support":224}],192:[function(require,module,exports){ +},{"../internals/classof":128,"../internals/to-string-tag-support":226}],194:[function(require,module,exports){ var getBuiltIn = require('../internals/get-built-in'); var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names'); var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols'); @@ -17177,12 +17526,12 @@ module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; }; -},{"../internals/an-object":107,"../internals/get-built-in":148,"../internals/object-get-own-property-names":183,"../internals/object-get-own-property-symbols":184}],193:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/get-built-in":150,"../internals/object-get-own-property-names":185,"../internals/object-get-own-property-symbols":186}],195:[function(require,module,exports){ var global = require('../internals/global'); module.exports = global; -},{"../internals/global":150}],194:[function(require,module,exports){ +},{"../internals/global":152}],196:[function(require,module,exports){ module.exports = function (exec) { try { return { error: false, value: exec() }; @@ -17191,7 +17540,7 @@ module.exports = function (exec) { } }; -},{}],195:[function(require,module,exports){ +},{}],197:[function(require,module,exports){ var anObject = require('../internals/an-object'); var isObject = require('../internals/is-object'); var newPromiseCapability = require('../internals/new-promise-capability'); @@ -17205,7 +17554,7 @@ module.exports = function (C, x) { return promiseCapability.promise; }; -},{"../internals/an-object":107,"../internals/is-object":164,"../internals/new-promise-capability":175}],196:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/is-object":166,"../internals/new-promise-capability":177}],198:[function(require,module,exports){ var redefine = require('../internals/redefine'); module.exports = function (target, src, options) { @@ -17213,7 +17562,7 @@ module.exports = function (target, src, options) { return target; }; -},{"../internals/redefine":197}],197:[function(require,module,exports){ +},{"../internals/redefine":199}],199:[function(require,module,exports){ var global = require('../internals/global'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var has = require('../internals/has'); @@ -17255,7 +17604,7 @@ var TEMPLATE = String(String).split('String'); return typeof this == 'function' && getInternalState(this).source || inspectSource(this); }); -},{"../internals/create-non-enumerable-property":131,"../internals/global":150,"../internals/has":151,"../internals/inspect-source":159,"../internals/internal-state":160,"../internals/set-global":204}],198:[function(require,module,exports){ +},{"../internals/create-non-enumerable-property":133,"../internals/global":152,"../internals/has":153,"../internals/inspect-source":161,"../internals/internal-state":162,"../internals/set-global":206}],200:[function(require,module,exports){ var classof = require('./classof-raw'); var regexpExec = require('./regexp-exec'); @@ -17279,7 +17628,7 @@ module.exports = function (R, S) { }; -},{"./classof-raw":125,"./regexp-exec":199}],199:[function(require,module,exports){ +},{"./classof-raw":127,"./regexp-exec":201}],201:[function(require,module,exports){ 'use strict'; var regexpFlags = require('./regexp-flags'); var stickyHelpers = require('./regexp-sticky-helpers'); @@ -17368,7 +17717,7 @@ if (PATCH) { module.exports = patchedExec; -},{"./regexp-flags":200,"./regexp-sticky-helpers":201}],200:[function(require,module,exports){ +},{"./regexp-flags":202,"./regexp-sticky-helpers":203}],202:[function(require,module,exports){ 'use strict'; var anObject = require('../internals/an-object'); @@ -17386,7 +17735,7 @@ module.exports = function () { return result; }; -},{"../internals/an-object":107}],201:[function(require,module,exports){ +},{"../internals/an-object":109}],203:[function(require,module,exports){ 'use strict'; var fails = require('./fails'); @@ -17411,7 +17760,7 @@ exports.BROKEN_CARET = fails(function () { return re.exec('str') != null; }); -},{"./fails":145}],202:[function(require,module,exports){ +},{"./fails":147}],204:[function(require,module,exports){ // `RequireObjectCoercible` abstract operation // https://tc39.github.io/ecma262/#sec-requireobjectcoercible module.exports = function (it) { @@ -17419,7 +17768,7 @@ module.exports = function (it) { return it; }; -},{}],203:[function(require,module,exports){ +},{}],205:[function(require,module,exports){ // `SameValue` abstract operation // https://tc39.github.io/ecma262/#sec-samevalue module.exports = Object.is || function is(x, y) { @@ -17427,7 +17776,7 @@ module.exports = Object.is || function is(x, y) { return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; }; -},{}],204:[function(require,module,exports){ +},{}],206:[function(require,module,exports){ var global = require('../internals/global'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); @@ -17439,7 +17788,7 @@ module.exports = function (key, value) { } return value; }; -},{"../internals/create-non-enumerable-property":131,"../internals/global":150}],205:[function(require,module,exports){ +},{"../internals/create-non-enumerable-property":133,"../internals/global":152}],207:[function(require,module,exports){ 'use strict'; var getBuiltIn = require('../internals/get-built-in'); var definePropertyModule = require('../internals/object-define-property'); @@ -17460,7 +17809,7 @@ module.exports = function (CONSTRUCTOR_NAME) { } }; -},{"../internals/descriptors":136,"../internals/get-built-in":148,"../internals/object-define-property":180,"../internals/well-known-symbol":231}],206:[function(require,module,exports){ +},{"../internals/descriptors":138,"../internals/get-built-in":150,"../internals/object-define-property":182,"../internals/well-known-symbol":233}],208:[function(require,module,exports){ var defineProperty = require('../internals/object-define-property').f; var has = require('../internals/has'); var wellKnownSymbol = require('../internals/well-known-symbol'); @@ -17473,7 +17822,7 @@ module.exports = function (it, TAG, STATIC) { } }; -},{"../internals/has":151,"../internals/object-define-property":180,"../internals/well-known-symbol":231}],207:[function(require,module,exports){ +},{"../internals/has":153,"../internals/object-define-property":182,"../internals/well-known-symbol":233}],209:[function(require,module,exports){ var shared = require('../internals/shared'); var uid = require('../internals/uid'); @@ -17483,7 +17832,7 @@ module.exports = function (key) { return keys[key] || (keys[key] = uid(key)); }; -},{"../internals/shared":209,"../internals/uid":228}],208:[function(require,module,exports){ +},{"../internals/shared":211,"../internals/uid":230}],210:[function(require,module,exports){ var global = require('../internals/global'); var setGlobal = require('../internals/set-global'); @@ -17492,7 +17841,7 @@ var store = global[SHARED] || setGlobal(SHARED, {}); module.exports = store; -},{"../internals/global":150,"../internals/set-global":204}],209:[function(require,module,exports){ +},{"../internals/global":152,"../internals/set-global":206}],211:[function(require,module,exports){ var IS_PURE = require('../internals/is-pure'); var store = require('../internals/shared-store'); @@ -17504,7 +17853,7 @@ var store = require('../internals/shared-store'); copyright: '© 2020 Denis Pushkarev (zloirock.ru)' }); -},{"../internals/is-pure":165,"../internals/shared-store":208}],210:[function(require,module,exports){ +},{"../internals/is-pure":167,"../internals/shared-store":210}],212:[function(require,module,exports){ var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var wellKnownSymbol = require('../internals/well-known-symbol'); @@ -17519,7 +17868,7 @@ module.exports = function (O, defaultConstructor) { return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S); }; -},{"../internals/a-function":102,"../internals/an-object":107,"../internals/well-known-symbol":231}],211:[function(require,module,exports){ +},{"../internals/a-function":104,"../internals/an-object":109,"../internals/well-known-symbol":233}],213:[function(require,module,exports){ var toInteger = require('../internals/to-integer'); var requireObjectCoercible = require('../internals/require-object-coercible'); @@ -17548,7 +17897,7 @@ module.exports = { charAt: createMethod(true) }; -},{"../internals/require-object-coercible":202,"../internals/to-integer":218}],212:[function(require,module,exports){ +},{"../internals/require-object-coercible":204,"../internals/to-integer":220}],214:[function(require,module,exports){ var fails = require('../internals/fails'); var whitespaces = require('../internals/whitespaces'); @@ -17562,7 +17911,7 @@ module.exports = function (METHOD_NAME) { }); }; -},{"../internals/fails":145,"../internals/whitespaces":232}],213:[function(require,module,exports){ +},{"../internals/fails":147,"../internals/whitespaces":234}],215:[function(require,module,exports){ var requireObjectCoercible = require('../internals/require-object-coercible'); var whitespaces = require('../internals/whitespaces'); @@ -17592,7 +17941,7 @@ module.exports = { trim: createMethod(3) }; -},{"../internals/require-object-coercible":202,"../internals/whitespaces":232}],214:[function(require,module,exports){ +},{"../internals/require-object-coercible":204,"../internals/whitespaces":234}],216:[function(require,module,exports){ var global = require('../internals/global'); var fails = require('../internals/fails'); var bind = require('../internals/function-bind-context'); @@ -17701,7 +18050,7 @@ module.exports = { clear: clear }; -},{"../internals/document-create-element":137,"../internals/engine-is-ios":139,"../internals/engine-is-node":140,"../internals/fails":145,"../internals/function-bind-context":147,"../internals/global":150,"../internals/html":154}],215:[function(require,module,exports){ +},{"../internals/document-create-element":139,"../internals/engine-is-ios":141,"../internals/engine-is-node":142,"../internals/fails":147,"../internals/function-bind-context":149,"../internals/global":152,"../internals/html":156}],217:[function(require,module,exports){ var toInteger = require('../internals/to-integer'); var max = Math.max; @@ -17715,7 +18064,7 @@ module.exports = function (index, length) { return integer < 0 ? max(integer + length, 0) : min(integer, length); }; -},{"../internals/to-integer":218}],216:[function(require,module,exports){ +},{"../internals/to-integer":220}],218:[function(require,module,exports){ var toInteger = require('../internals/to-integer'); var toLength = require('../internals/to-length'); @@ -17729,7 +18078,7 @@ module.exports = function (it) { return length; }; -},{"../internals/to-integer":218,"../internals/to-length":219}],217:[function(require,module,exports){ +},{"../internals/to-integer":220,"../internals/to-length":221}],219:[function(require,module,exports){ // toObject with fallback for non-array-like ES3 strings var IndexedObject = require('../internals/indexed-object'); var requireObjectCoercible = require('../internals/require-object-coercible'); @@ -17738,7 +18087,7 @@ module.exports = function (it) { return IndexedObject(requireObjectCoercible(it)); }; -},{"../internals/indexed-object":157,"../internals/require-object-coercible":202}],218:[function(require,module,exports){ +},{"../internals/indexed-object":159,"../internals/require-object-coercible":204}],220:[function(require,module,exports){ var ceil = Math.ceil; var floor = Math.floor; @@ -17748,7 +18097,7 @@ module.exports = function (argument) { return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); }; -},{}],219:[function(require,module,exports){ +},{}],221:[function(require,module,exports){ var toInteger = require('../internals/to-integer'); var min = Math.min; @@ -17759,7 +18108,7 @@ module.exports = function (argument) { return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; -},{"../internals/to-integer":218}],220:[function(require,module,exports){ +},{"../internals/to-integer":220}],222:[function(require,module,exports){ var requireObjectCoercible = require('../internals/require-object-coercible'); // `ToObject` abstract operation @@ -17768,7 +18117,7 @@ module.exports = function (argument) { return Object(requireObjectCoercible(argument)); }; -},{"../internals/require-object-coercible":202}],221:[function(require,module,exports){ +},{"../internals/require-object-coercible":204}],223:[function(require,module,exports){ var toPositiveInteger = require('../internals/to-positive-integer'); module.exports = function (it, BYTES) { @@ -17777,7 +18126,7 @@ module.exports = function (it, BYTES) { return offset; }; -},{"../internals/to-positive-integer":222}],222:[function(require,module,exports){ +},{"../internals/to-positive-integer":224}],224:[function(require,module,exports){ var toInteger = require('../internals/to-integer'); module.exports = function (it) { @@ -17786,7 +18135,7 @@ module.exports = function (it) { return result; }; -},{"../internals/to-integer":218}],223:[function(require,module,exports){ +},{"../internals/to-integer":220}],225:[function(require,module,exports){ var isObject = require('../internals/is-object'); // `ToPrimitive` abstract operation @@ -17802,7 +18151,7 @@ module.exports = function (input, PREFERRED_STRING) { throw TypeError("Can't convert object to primitive value"); }; -},{"../internals/is-object":164}],224:[function(require,module,exports){ +},{"../internals/is-object":166}],226:[function(require,module,exports){ var wellKnownSymbol = require('../internals/well-known-symbol'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); @@ -17812,7 +18161,7 @@ test[TO_STRING_TAG] = 'z'; module.exports = String(test) === '[object z]'; -},{"../internals/well-known-symbol":231}],225:[function(require,module,exports){ +},{"../internals/well-known-symbol":233}],227:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var global = require('../internals/global'); @@ -18044,7 +18393,7 @@ if (DESCRIPTORS) { }; } else module.exports = function () { /* empty */ }; -},{"../internals/an-instance":106,"../internals/array-buffer":110,"../internals/array-buffer-view-core":109,"../internals/array-iteration":116,"../internals/classof":126,"../internals/create-non-enumerable-property":131,"../internals/create-property-descriptor":132,"../internals/descriptors":136,"../internals/export":144,"../internals/global":150,"../internals/has":151,"../internals/inherit-if-required":158,"../internals/internal-state":160,"../internals/is-object":164,"../internals/object-create":178,"../internals/object-define-property":180,"../internals/object-get-own-property-descriptor":181,"../internals/object-get-own-property-names":183,"../internals/object-set-prototype-of":189,"../internals/set-species":205,"../internals/to-index":216,"../internals/to-length":219,"../internals/to-offset":221,"../internals/to-primitive":223,"../internals/typed-array-constructors-require-wrappers":226,"../internals/typed-array-from":227}],226:[function(require,module,exports){ +},{"../internals/an-instance":108,"../internals/array-buffer":112,"../internals/array-buffer-view-core":111,"../internals/array-iteration":118,"../internals/classof":128,"../internals/create-non-enumerable-property":133,"../internals/create-property-descriptor":134,"../internals/descriptors":138,"../internals/export":146,"../internals/global":152,"../internals/has":153,"../internals/inherit-if-required":160,"../internals/internal-state":162,"../internals/is-object":166,"../internals/object-create":180,"../internals/object-define-property":182,"../internals/object-get-own-property-descriptor":183,"../internals/object-get-own-property-names":185,"../internals/object-set-prototype-of":191,"../internals/set-species":207,"../internals/to-index":218,"../internals/to-length":221,"../internals/to-offset":223,"../internals/to-primitive":225,"../internals/typed-array-constructors-require-wrappers":228,"../internals/typed-array-from":229}],228:[function(require,module,exports){ /* eslint-disable no-new */ var global = require('../internals/global'); var fails = require('../internals/fails'); @@ -18068,7 +18417,7 @@ module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () { return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1; }); -},{"../internals/array-buffer-view-core":109,"../internals/check-correctness-of-iteration":124,"../internals/fails":145,"../internals/global":150}],227:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/check-correctness-of-iteration":126,"../internals/fails":147,"../internals/global":152}],229:[function(require,module,exports){ var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var getIteratorMethod = require('../internals/get-iterator-method'); @@ -18102,7 +18451,7 @@ module.exports = function from(source /* , mapfn, thisArg */) { return result; }; -},{"../internals/array-buffer-view-core":109,"../internals/function-bind-context":147,"../internals/get-iterator-method":149,"../internals/is-array-iterator-method":161,"../internals/to-length":219,"../internals/to-object":220}],228:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/function-bind-context":149,"../internals/get-iterator-method":151,"../internals/is-array-iterator-method":163,"../internals/to-length":221,"../internals/to-object":222}],230:[function(require,module,exports){ var id = 0; var postfix = Math.random(); @@ -18110,7 +18459,7 @@ module.exports = function (key) { return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); }; -},{}],229:[function(require,module,exports){ +},{}],231:[function(require,module,exports){ var NATIVE_SYMBOL = require('../internals/native-symbol'); module.exports = NATIVE_SYMBOL @@ -18119,12 +18468,12 @@ module.exports = NATIVE_SYMBOL // eslint-disable-next-line no-undef && typeof Symbol.iterator == 'symbol'; -},{"../internals/native-symbol":173}],230:[function(require,module,exports){ +},{"../internals/native-symbol":175}],232:[function(require,module,exports){ var wellKnownSymbol = require('../internals/well-known-symbol'); exports.f = wellKnownSymbol; -},{"../internals/well-known-symbol":231}],231:[function(require,module,exports){ +},{"../internals/well-known-symbol":233}],233:[function(require,module,exports){ var global = require('../internals/global'); var shared = require('../internals/shared'); var has = require('../internals/has'); @@ -18143,12 +18492,12 @@ module.exports = function (name) { } return WellKnownSymbolsStore[name]; }; -},{"../internals/global":150,"../internals/has":151,"../internals/native-symbol":173,"../internals/shared":209,"../internals/uid":228,"../internals/use-symbol-as-uid":229}],232:[function(require,module,exports){ +},{"../internals/global":152,"../internals/has":153,"../internals/native-symbol":175,"../internals/shared":211,"../internals/uid":230,"../internals/use-symbol-as-uid":231}],234:[function(require,module,exports){ // a string of all valid unicode whitespaces // eslint-disable-next-line max-len module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; -},{}],233:[function(require,module,exports){ +},{}],235:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var fails = require('../internals/fails'); @@ -18186,7 +18535,7 @@ $({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, } }); -},{"../internals/an-object":107,"../internals/array-buffer":110,"../internals/export":144,"../internals/fails":145,"../internals/species-constructor":210,"../internals/to-absolute-index":215,"../internals/to-length":219}],234:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/array-buffer":112,"../internals/export":146,"../internals/fails":147,"../internals/species-constructor":212,"../internals/to-absolute-index":217,"../internals/to-length":221}],236:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var fails = require('../internals/fails'); @@ -18248,7 +18597,7 @@ $({ target: 'Array', proto: true, forced: FORCED }, { } }); -},{"../internals/array-method-has-species-support":118,"../internals/array-species-create":122,"../internals/create-property":133,"../internals/engine-v8-version":142,"../internals/export":144,"../internals/fails":145,"../internals/is-array":162,"../internals/is-object":164,"../internals/to-length":219,"../internals/to-object":220,"../internals/well-known-symbol":231}],235:[function(require,module,exports){ +},{"../internals/array-method-has-species-support":120,"../internals/array-species-create":124,"../internals/create-property":135,"../internals/engine-v8-version":144,"../internals/export":146,"../internals/fails":147,"../internals/is-array":164,"../internals/is-object":166,"../internals/to-length":221,"../internals/to-object":222,"../internals/well-known-symbol":233}],237:[function(require,module,exports){ var $ = require('../internals/export'); var fill = require('../internals/array-fill'); var addToUnscopables = require('../internals/add-to-unscopables'); @@ -18262,7 +18611,7 @@ $({ target: 'Array', proto: true }, { // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('fill'); -},{"../internals/add-to-unscopables":104,"../internals/array-fill":112,"../internals/export":144}],236:[function(require,module,exports){ +},{"../internals/add-to-unscopables":106,"../internals/array-fill":114,"../internals/export":146}],238:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var $filter = require('../internals/array-iteration').filter; @@ -18282,7 +18631,7 @@ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGT } }); -},{"../internals/array-iteration":116,"../internals/array-method-has-species-support":118,"../internals/array-method-uses-to-length":120,"../internals/export":144}],237:[function(require,module,exports){ +},{"../internals/array-iteration":118,"../internals/array-method-has-species-support":120,"../internals/array-method-uses-to-length":122,"../internals/export":146}],239:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var $find = require('../internals/array-iteration').find; @@ -18308,7 +18657,7 @@ $({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, { // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables(FIND); -},{"../internals/add-to-unscopables":104,"../internals/array-iteration":116,"../internals/array-method-uses-to-length":120,"../internals/export":144}],238:[function(require,module,exports){ +},{"../internals/add-to-unscopables":106,"../internals/array-iteration":118,"../internals/array-method-uses-to-length":122,"../internals/export":146}],240:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var forEach = require('../internals/array-for-each'); @@ -18319,7 +18668,7 @@ $({ target: 'Array', proto: true, forced: [].forEach != forEach }, { forEach: forEach }); -},{"../internals/array-for-each":113,"../internals/export":144}],239:[function(require,module,exports){ +},{"../internals/array-for-each":115,"../internals/export":146}],241:[function(require,module,exports){ var $ = require('../internals/export'); var from = require('../internals/array-from'); var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); @@ -18334,7 +18683,7 @@ $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { from: from }); -},{"../internals/array-from":114,"../internals/check-correctness-of-iteration":124,"../internals/export":144}],240:[function(require,module,exports){ +},{"../internals/array-from":116,"../internals/check-correctness-of-iteration":126,"../internals/export":146}],242:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var $includes = require('../internals/array-includes').includes; @@ -18354,7 +18703,7 @@ $({ target: 'Array', proto: true, forced: !USES_TO_LENGTH }, { // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('includes'); -},{"../internals/add-to-unscopables":104,"../internals/array-includes":115,"../internals/array-method-uses-to-length":120,"../internals/export":144}],241:[function(require,module,exports){ +},{"../internals/add-to-unscopables":106,"../internals/array-includes":117,"../internals/array-method-uses-to-length":122,"../internals/export":146}],243:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var $indexOf = require('../internals/array-includes').indexOf; @@ -18378,7 +18727,7 @@ $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !US } }); -},{"../internals/array-includes":115,"../internals/array-method-is-strict":119,"../internals/array-method-uses-to-length":120,"../internals/export":144}],242:[function(require,module,exports){ +},{"../internals/array-includes":117,"../internals/array-method-is-strict":121,"../internals/array-method-uses-to-length":122,"../internals/export":146}],244:[function(require,module,exports){ 'use strict'; var toIndexedObject = require('../internals/to-indexed-object'); var addToUnscopables = require('../internals/add-to-unscopables'); @@ -18433,7 +18782,7 @@ addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); -},{"../internals/add-to-unscopables":104,"../internals/define-iterator":134,"../internals/internal-state":160,"../internals/iterators":170,"../internals/to-indexed-object":217}],243:[function(require,module,exports){ +},{"../internals/add-to-unscopables":106,"../internals/define-iterator":136,"../internals/internal-state":162,"../internals/iterators":172,"../internals/to-indexed-object":219}],245:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var IndexedObject = require('../internals/indexed-object'); @@ -18453,7 +18802,7 @@ $({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, { } }); -},{"../internals/array-method-is-strict":119,"../internals/export":144,"../internals/indexed-object":157,"../internals/to-indexed-object":217}],244:[function(require,module,exports){ +},{"../internals/array-method-is-strict":121,"../internals/export":146,"../internals/indexed-object":159,"../internals/to-indexed-object":219}],246:[function(require,module,exports){ var $ = require('../internals/export'); var lastIndexOf = require('../internals/array-last-index-of'); @@ -18463,7 +18812,7 @@ $({ target: 'Array', proto: true, forced: lastIndexOf !== [].lastIndexOf }, { lastIndexOf: lastIndexOf }); -},{"../internals/array-last-index-of":117,"../internals/export":144}],245:[function(require,module,exports){ +},{"../internals/array-last-index-of":119,"../internals/export":146}],247:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var $map = require('../internals/array-iteration').map; @@ -18483,7 +18832,7 @@ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGT } }); -},{"../internals/array-iteration":116,"../internals/array-method-has-species-support":118,"../internals/array-method-uses-to-length":120,"../internals/export":144}],246:[function(require,module,exports){ +},{"../internals/array-iteration":118,"../internals/array-method-has-species-support":120,"../internals/array-method-uses-to-length":122,"../internals/export":146}],248:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var isObject = require('../internals/is-object'); @@ -18534,7 +18883,7 @@ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGT } }); -},{"../internals/array-method-has-species-support":118,"../internals/array-method-uses-to-length":120,"../internals/create-property":133,"../internals/export":144,"../internals/is-array":162,"../internals/is-object":164,"../internals/to-absolute-index":215,"../internals/to-indexed-object":217,"../internals/to-length":219,"../internals/well-known-symbol":231}],247:[function(require,module,exports){ +},{"../internals/array-method-has-species-support":120,"../internals/array-method-uses-to-length":122,"../internals/create-property":135,"../internals/export":146,"../internals/is-array":164,"../internals/is-object":166,"../internals/to-absolute-index":217,"../internals/to-indexed-object":219,"../internals/to-length":221,"../internals/well-known-symbol":233}],249:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); @@ -18568,7 +18917,7 @@ $({ target: 'Array', proto: true, forced: FORCED }, { } }); -},{"../internals/a-function":102,"../internals/array-method-is-strict":119,"../internals/export":144,"../internals/fails":145,"../internals/to-object":220}],248:[function(require,module,exports){ +},{"../internals/a-function":104,"../internals/array-method-is-strict":121,"../internals/export":146,"../internals/fails":147,"../internals/to-object":222}],250:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var toAbsoluteIndex = require('../internals/to-absolute-index'); @@ -18640,7 +18989,7 @@ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGT } }); -},{"../internals/array-method-has-species-support":118,"../internals/array-method-uses-to-length":120,"../internals/array-species-create":122,"../internals/create-property":133,"../internals/export":144,"../internals/to-absolute-index":215,"../internals/to-integer":218,"../internals/to-length":219,"../internals/to-object":220}],249:[function(require,module,exports){ +},{"../internals/array-method-has-species-support":120,"../internals/array-method-uses-to-length":122,"../internals/array-species-create":124,"../internals/create-property":135,"../internals/export":146,"../internals/to-absolute-index":217,"../internals/to-integer":220,"../internals/to-length":221,"../internals/to-object":222}],251:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var defineProperty = require('../internals/object-define-property').f; @@ -18664,7 +19013,7 @@ if (DESCRIPTORS && !(NAME in FunctionPrototype)) { }); } -},{"../internals/descriptors":136,"../internals/object-define-property":180}],250:[function(require,module,exports){ +},{"../internals/descriptors":138,"../internals/object-define-property":182}],252:[function(require,module,exports){ 'use strict'; var DESCRIPTORS = require('../internals/descriptors'); var global = require('../internals/global'); @@ -18744,7 +19093,7 @@ if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumb redefine(global, NUMBER, NumberWrapper); } -},{"../internals/classof-raw":125,"../internals/descriptors":136,"../internals/fails":145,"../internals/global":150,"../internals/has":151,"../internals/inherit-if-required":158,"../internals/is-forced":163,"../internals/object-create":178,"../internals/object-define-property":180,"../internals/object-get-own-property-descriptor":181,"../internals/object-get-own-property-names":183,"../internals/redefine":197,"../internals/string-trim":213,"../internals/to-primitive":223}],251:[function(require,module,exports){ +},{"../internals/classof-raw":127,"../internals/descriptors":138,"../internals/fails":147,"../internals/global":152,"../internals/has":153,"../internals/inherit-if-required":160,"../internals/is-forced":165,"../internals/object-create":180,"../internals/object-define-property":182,"../internals/object-get-own-property-descriptor":183,"../internals/object-get-own-property-names":185,"../internals/redefine":199,"../internals/string-trim":215,"../internals/to-primitive":225}],253:[function(require,module,exports){ var $ = require('../internals/export'); var assign = require('../internals/object-assign'); @@ -18754,7 +19103,7 @@ $({ target: 'Object', stat: true, forced: Object.assign !== assign }, { assign: assign }); -},{"../internals/export":144,"../internals/object-assign":177}],252:[function(require,module,exports){ +},{"../internals/export":146,"../internals/object-assign":179}],254:[function(require,module,exports){ var $ = require('../internals/export'); var $entries = require('../internals/object-to-array').entries; @@ -18766,7 +19115,7 @@ $({ target: 'Object', stat: true }, { } }); -},{"../internals/export":144,"../internals/object-to-array":190}],253:[function(require,module,exports){ +},{"../internals/export":146,"../internals/object-to-array":192}],255:[function(require,module,exports){ var $ = require('../internals/export'); var toObject = require('../internals/to-object'); var nativeKeys = require('../internals/object-keys'); @@ -18782,7 +19131,7 @@ $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { } }); -},{"../internals/export":144,"../internals/fails":145,"../internals/object-keys":187,"../internals/to-object":220}],254:[function(require,module,exports){ +},{"../internals/export":146,"../internals/fails":147,"../internals/object-keys":189,"../internals/to-object":222}],256:[function(require,module,exports){ var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support'); var redefine = require('../internals/redefine'); var toString = require('../internals/object-to-string'); @@ -18793,7 +19142,7 @@ if (!TO_STRING_TAG_SUPPORT) { redefine(Object.prototype, 'toString', toString, { unsafe: true }); } -},{"../internals/object-to-string":191,"../internals/redefine":197,"../internals/to-string-tag-support":224}],255:[function(require,module,exports){ +},{"../internals/object-to-string":193,"../internals/redefine":199,"../internals/to-string-tag-support":226}],257:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); @@ -19176,7 +19525,7 @@ $({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { } }); -},{"../internals/a-function":102,"../internals/an-instance":106,"../internals/check-correctness-of-iteration":124,"../internals/engine-is-node":140,"../internals/engine-v8-version":142,"../internals/export":144,"../internals/get-built-in":148,"../internals/global":150,"../internals/host-report-errors":153,"../internals/inspect-source":159,"../internals/internal-state":160,"../internals/is-forced":163,"../internals/is-object":164,"../internals/is-pure":165,"../internals/iterate":167,"../internals/microtask":171,"../internals/native-promise-constructor":172,"../internals/new-promise-capability":175,"../internals/perform":194,"../internals/promise-resolve":195,"../internals/redefine":197,"../internals/redefine-all":196,"../internals/set-species":205,"../internals/set-to-string-tag":206,"../internals/species-constructor":210,"../internals/task":214,"../internals/well-known-symbol":231}],256:[function(require,module,exports){ +},{"../internals/a-function":104,"../internals/an-instance":108,"../internals/check-correctness-of-iteration":126,"../internals/engine-is-node":142,"../internals/engine-v8-version":144,"../internals/export":146,"../internals/get-built-in":150,"../internals/global":152,"../internals/host-report-errors":155,"../internals/inspect-source":161,"../internals/internal-state":162,"../internals/is-forced":165,"../internals/is-object":166,"../internals/is-pure":167,"../internals/iterate":169,"../internals/microtask":173,"../internals/native-promise-constructor":174,"../internals/new-promise-capability":177,"../internals/perform":196,"../internals/promise-resolve":197,"../internals/redefine":199,"../internals/redefine-all":198,"../internals/set-species":207,"../internals/set-to-string-tag":208,"../internals/species-constructor":212,"../internals/task":216,"../internals/well-known-symbol":233}],258:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var exec = require('../internals/regexp-exec'); @@ -19185,7 +19534,7 @@ $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, { exec: exec }); -},{"../internals/export":144,"../internals/regexp-exec":199}],257:[function(require,module,exports){ +},{"../internals/export":146,"../internals/regexp-exec":201}],259:[function(require,module,exports){ 'use strict'; var redefine = require('../internals/redefine'); var anObject = require('../internals/an-object'); @@ -19212,7 +19561,7 @@ if (NOT_GENERIC || INCORRECT_NAME) { }, { unsafe: true }); } -},{"../internals/an-object":107,"../internals/fails":145,"../internals/redefine":197,"../internals/regexp-flags":200}],258:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/fails":147,"../internals/redefine":199,"../internals/regexp-flags":202}],260:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var notARegExp = require('../internals/not-a-regexp'); @@ -19228,7 +19577,7 @@ $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, } }); -},{"../internals/correct-is-regexp-logic":128,"../internals/export":144,"../internals/not-a-regexp":176,"../internals/require-object-coercible":202}],259:[function(require,module,exports){ +},{"../internals/correct-is-regexp-logic":130,"../internals/export":146,"../internals/not-a-regexp":178,"../internals/require-object-coercible":204}],261:[function(require,module,exports){ 'use strict'; var charAt = require('../internals/string-multibyte').charAt; var InternalStateModule = require('../internals/internal-state'); @@ -19259,7 +19608,7 @@ defineIterator(String, 'String', function (iterated) { return { value: point, done: false }; }); -},{"../internals/define-iterator":134,"../internals/internal-state":160,"../internals/string-multibyte":211}],260:[function(require,module,exports){ +},{"../internals/define-iterator":136,"../internals/internal-state":162,"../internals/string-multibyte":213}],262:[function(require,module,exports){ 'use strict'; var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); var anObject = require('../internals/an-object'); @@ -19305,7 +19654,7 @@ fixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCal ]; }); -},{"../internals/advance-string-index":105,"../internals/an-object":107,"../internals/fix-regexp-well-known-symbol-logic":146,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":202,"../internals/to-length":219}],261:[function(require,module,exports){ +},{"../internals/advance-string-index":107,"../internals/an-object":109,"../internals/fix-regexp-well-known-symbol-logic":148,"../internals/regexp-exec-abstract":200,"../internals/require-object-coercible":204,"../internals/to-length":221}],263:[function(require,module,exports){ 'use strict'; var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); var anObject = require('../internals/an-object'); @@ -19442,7 +19791,7 @@ fixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, ma } }); -},{"../internals/advance-string-index":105,"../internals/an-object":107,"../internals/fix-regexp-well-known-symbol-logic":146,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":202,"../internals/to-integer":218,"../internals/to-length":219,"../internals/to-object":220}],262:[function(require,module,exports){ +},{"../internals/advance-string-index":107,"../internals/an-object":109,"../internals/fix-regexp-well-known-symbol-logic":148,"../internals/regexp-exec-abstract":200,"../internals/require-object-coercible":204,"../internals/to-integer":220,"../internals/to-length":221,"../internals/to-object":222}],264:[function(require,module,exports){ 'use strict'; var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); var anObject = require('../internals/an-object'); @@ -19478,7 +19827,7 @@ fixRegExpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybe ]; }); -},{"../internals/an-object":107,"../internals/fix-regexp-well-known-symbol-logic":146,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":202,"../internals/same-value":203}],263:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/fix-regexp-well-known-symbol-logic":148,"../internals/regexp-exec-abstract":200,"../internals/require-object-coercible":204,"../internals/same-value":205}],265:[function(require,module,exports){ 'use strict'; var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); var isRegExp = require('../internals/is-regexp'); @@ -19614,7 +19963,7 @@ fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCal ]; }, !SUPPORTS_Y); -},{"../internals/advance-string-index":105,"../internals/an-object":107,"../internals/fails":145,"../internals/fix-regexp-well-known-symbol-logic":146,"../internals/is-regexp":166,"../internals/regexp-exec":199,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":202,"../internals/species-constructor":210,"../internals/to-length":219}],264:[function(require,module,exports){ +},{"../internals/advance-string-index":107,"../internals/an-object":109,"../internals/fails":147,"../internals/fix-regexp-well-known-symbol-logic":148,"../internals/is-regexp":168,"../internals/regexp-exec":201,"../internals/regexp-exec-abstract":200,"../internals/require-object-coercible":204,"../internals/species-constructor":212,"../internals/to-length":221}],266:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; @@ -19648,7 +19997,7 @@ $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGE } }); -},{"../internals/correct-is-regexp-logic":128,"../internals/export":144,"../internals/is-pure":165,"../internals/not-a-regexp":176,"../internals/object-get-own-property-descriptor":181,"../internals/require-object-coercible":202,"../internals/to-length":219}],265:[function(require,module,exports){ +},{"../internals/correct-is-regexp-logic":130,"../internals/export":146,"../internals/is-pure":167,"../internals/not-a-regexp":178,"../internals/object-get-own-property-descriptor":183,"../internals/require-object-coercible":204,"../internals/to-length":221}],267:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var $trim = require('../internals/string-trim').trim; @@ -19662,7 +20011,7 @@ $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { } }); -},{"../internals/export":144,"../internals/string-trim":213,"../internals/string-trim-forced":212}],266:[function(require,module,exports){ +},{"../internals/export":146,"../internals/string-trim":215,"../internals/string-trim-forced":214}],268:[function(require,module,exports){ // `Symbol.prototype.description` getter // https://tc39.github.io/ecma262/#sec-symbol.prototype.description 'use strict'; @@ -19714,7 +20063,7 @@ if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in Nati }); } -},{"../internals/copy-constructor-properties":127,"../internals/descriptors":136,"../internals/export":144,"../internals/global":150,"../internals/has":151,"../internals/is-object":164,"../internals/object-define-property":180}],267:[function(require,module,exports){ +},{"../internals/copy-constructor-properties":129,"../internals/descriptors":138,"../internals/export":146,"../internals/global":152,"../internals/has":153,"../internals/is-object":166,"../internals/object-define-property":182}],269:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var global = require('../internals/global'); @@ -20027,7 +20376,7 @@ setToStringTag($Symbol, SYMBOL); hiddenKeys[HIDDEN] = true; -},{"../internals/an-object":107,"../internals/array-iteration":116,"../internals/create-non-enumerable-property":131,"../internals/create-property-descriptor":132,"../internals/define-well-known-symbol":135,"../internals/descriptors":136,"../internals/export":144,"../internals/fails":145,"../internals/get-built-in":148,"../internals/global":150,"../internals/has":151,"../internals/hidden-keys":152,"../internals/internal-state":160,"../internals/is-array":162,"../internals/is-object":164,"../internals/is-pure":165,"../internals/native-symbol":173,"../internals/object-create":178,"../internals/object-define-property":180,"../internals/object-get-own-property-descriptor":181,"../internals/object-get-own-property-names":183,"../internals/object-get-own-property-names-external":182,"../internals/object-get-own-property-symbols":184,"../internals/object-keys":187,"../internals/object-property-is-enumerable":188,"../internals/redefine":197,"../internals/set-to-string-tag":206,"../internals/shared":209,"../internals/shared-key":207,"../internals/to-indexed-object":217,"../internals/to-object":220,"../internals/to-primitive":223,"../internals/uid":228,"../internals/use-symbol-as-uid":229,"../internals/well-known-symbol":231,"../internals/well-known-symbol-wrapped":230}],268:[function(require,module,exports){ +},{"../internals/an-object":109,"../internals/array-iteration":118,"../internals/create-non-enumerable-property":133,"../internals/create-property-descriptor":134,"../internals/define-well-known-symbol":137,"../internals/descriptors":138,"../internals/export":146,"../internals/fails":147,"../internals/get-built-in":150,"../internals/global":152,"../internals/has":153,"../internals/hidden-keys":154,"../internals/internal-state":162,"../internals/is-array":164,"../internals/is-object":166,"../internals/is-pure":167,"../internals/native-symbol":175,"../internals/object-create":180,"../internals/object-define-property":182,"../internals/object-get-own-property-descriptor":183,"../internals/object-get-own-property-names":185,"../internals/object-get-own-property-names-external":184,"../internals/object-get-own-property-symbols":186,"../internals/object-keys":189,"../internals/object-property-is-enumerable":190,"../internals/redefine":199,"../internals/set-to-string-tag":208,"../internals/shared":211,"../internals/shared-key":209,"../internals/to-indexed-object":219,"../internals/to-object":222,"../internals/to-primitive":225,"../internals/uid":230,"../internals/use-symbol-as-uid":231,"../internals/well-known-symbol":233,"../internals/well-known-symbol-wrapped":232}],270:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $copyWithin = require('../internals/array-copy-within'); @@ -20041,7 +20390,7 @@ exportTypedArrayMethod('copyWithin', function copyWithin(target, start /* , end return $copyWithin.call(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-copy-within":111}],269:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-copy-within":113}],271:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $every = require('../internals/array-iteration').every; @@ -20055,7 +20404,7 @@ exportTypedArrayMethod('every', function every(callbackfn /* , thisArg */) { return $every(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116}],270:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-iteration":118}],272:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $fill = require('../internals/array-fill'); @@ -20070,7 +20419,7 @@ exportTypedArrayMethod('fill', function fill(value /* , start, end */) { return $fill.apply(aTypedArray(this), arguments); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-fill":112}],271:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-fill":114}],273:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $filter = require('../internals/array-iteration').filter; @@ -20092,7 +20441,7 @@ exportTypedArrayMethod('filter', function filter(callbackfn /* , thisArg */) { return result; }); -},{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116,"../internals/species-constructor":210}],272:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-iteration":118,"../internals/species-constructor":212}],274:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $findIndex = require('../internals/array-iteration').findIndex; @@ -20106,7 +20455,7 @@ exportTypedArrayMethod('findIndex', function findIndex(predicate /* , thisArg */ return $findIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116}],273:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-iteration":118}],275:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $find = require('../internals/array-iteration').find; @@ -20120,7 +20469,7 @@ exportTypedArrayMethod('find', function find(predicate /* , thisArg */) { return $find(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116}],274:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-iteration":118}],276:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $forEach = require('../internals/array-iteration').forEach; @@ -20134,7 +20483,7 @@ exportTypedArrayMethod('forEach', function forEach(callbackfn /* , thisArg */) { $forEach(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116}],275:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-iteration":118}],277:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $includes = require('../internals/array-includes').includes; @@ -20148,7 +20497,7 @@ exportTypedArrayMethod('includes', function includes(searchElement /* , fromInde return $includes(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-includes":115}],276:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-includes":117}],278:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $indexOf = require('../internals/array-includes').indexOf; @@ -20162,7 +20511,7 @@ exportTypedArrayMethod('indexOf', function indexOf(searchElement /* , fromIndex return $indexOf(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-includes":115}],277:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-includes":117}],279:[function(require,module,exports){ 'use strict'; var global = require('../internals/global'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); @@ -20202,7 +20551,7 @@ exportTypedArrayMethod('values', typedArrayValues, !CORRECT_ITER_NAME); // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype-@@iterator exportTypedArrayMethod(ITERATOR, typedArrayValues, !CORRECT_ITER_NAME); -},{"../internals/array-buffer-view-core":109,"../internals/global":150,"../internals/well-known-symbol":231,"../modules/es.array.iterator":242}],278:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/global":152,"../internals/well-known-symbol":233,"../modules/es.array.iterator":244}],280:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); @@ -20217,7 +20566,7 @@ exportTypedArrayMethod('join', function join(separator) { return $join.apply(aTypedArray(this), arguments); }); -},{"../internals/array-buffer-view-core":109}],279:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111}],281:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $lastIndexOf = require('../internals/array-last-index-of'); @@ -20232,7 +20581,7 @@ exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fr return $lastIndexOf.apply(aTypedArray(this), arguments); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-last-index-of":117}],280:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-last-index-of":119}],282:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $map = require('../internals/array-iteration').map; @@ -20250,7 +20599,7 @@ exportTypedArrayMethod('map', function map(mapfn /* , thisArg */) { }); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116,"../internals/species-constructor":210}],281:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-iteration":118,"../internals/species-constructor":212}],283:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $reduceRight = require('../internals/array-reduce').right; @@ -20264,7 +20613,7 @@ exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initi return $reduceRight(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-reduce":121}],282:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-reduce":123}],284:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $reduce = require('../internals/array-reduce').left; @@ -20278,7 +20627,7 @@ exportTypedArrayMethod('reduce', function reduce(callbackfn /* , initialValue */ return $reduce(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-reduce":121}],283:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-reduce":123}],285:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); @@ -20301,7 +20650,7 @@ exportTypedArrayMethod('reverse', function reverse() { } return that; }); -},{"../internals/array-buffer-view-core":109}],284:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111}],286:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var toLength = require('../internals/to-length'); @@ -20330,7 +20679,7 @@ exportTypedArrayMethod('set', function set(arrayLike /* , offset */) { while (index < len) this[offset + index] = src[index++]; }, FORCED); -},{"../internals/array-buffer-view-core":109,"../internals/fails":145,"../internals/to-length":219,"../internals/to-object":220,"../internals/to-offset":221}],285:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/fails":147,"../internals/to-length":221,"../internals/to-object":222,"../internals/to-offset":223}],287:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var speciesConstructor = require('../internals/species-constructor'); @@ -20358,7 +20707,7 @@ exportTypedArrayMethod('slice', function slice(start, end) { return result; }, FORCED); -},{"../internals/array-buffer-view-core":109,"../internals/fails":145,"../internals/species-constructor":210}],286:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/fails":147,"../internals/species-constructor":212}],288:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $some = require('../internals/array-iteration').some; @@ -20372,7 +20721,7 @@ exportTypedArrayMethod('some', function some(callbackfn /* , thisArg */) { return $some(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); -},{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116}],287:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/array-iteration":118}],289:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); @@ -20386,7 +20735,7 @@ exportTypedArrayMethod('sort', function sort(comparefn) { return $sort.call(aTypedArray(this), comparefn); }); -},{"../internals/array-buffer-view-core":109}],288:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111}],290:[function(require,module,exports){ 'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var toLength = require('../internals/to-length'); @@ -20409,7 +20758,7 @@ exportTypedArrayMethod('subarray', function subarray(begin, end) { ); }); -},{"../internals/array-buffer-view-core":109,"../internals/species-constructor":210,"../internals/to-absolute-index":215,"../internals/to-length":219}],289:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/species-constructor":212,"../internals/to-absolute-index":217,"../internals/to-length":221}],291:[function(require,module,exports){ 'use strict'; var global = require('../internals/global'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); @@ -20438,7 +20787,7 @@ exportTypedArrayMethod('toLocaleString', function toLocaleString() { return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice.call(aTypedArray(this)) : aTypedArray(this), arguments); }, FORCED); -},{"../internals/array-buffer-view-core":109,"../internals/fails":145,"../internals/global":150}],290:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/fails":147,"../internals/global":152}],292:[function(require,module,exports){ 'use strict'; var exportTypedArrayMethod = require('../internals/array-buffer-view-core').exportTypedArrayMethod; var fails = require('../internals/fails'); @@ -20461,7 +20810,7 @@ var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString; // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tostring exportTypedArrayMethod('toString', arrayToString, IS_NOT_ARRAY_METHOD); -},{"../internals/array-buffer-view-core":109,"../internals/fails":145,"../internals/global":150}],291:[function(require,module,exports){ +},{"../internals/array-buffer-view-core":111,"../internals/fails":147,"../internals/global":152}],293:[function(require,module,exports){ var createTypedArrayConstructor = require('../internals/typed-array-constructor'); // `Uint8Array` constructor @@ -20472,7 +20821,7 @@ createTypedArrayConstructor('Uint8', function (init) { }; }); -},{"../internals/typed-array-constructor":225}],292:[function(require,module,exports){ +},{"../internals/typed-array-constructor":227}],294:[function(require,module,exports){ var global = require('../internals/global'); var DOMIterables = require('../internals/dom-iterables'); var forEach = require('../internals/array-for-each'); @@ -20489,7 +20838,7 @@ for (var COLLECTION_NAME in DOMIterables) { } } -},{"../internals/array-for-each":113,"../internals/create-non-enumerable-property":131,"../internals/dom-iterables":138,"../internals/global":150}],293:[function(require,module,exports){ +},{"../internals/array-for-each":115,"../internals/create-non-enumerable-property":133,"../internals/dom-iterables":140,"../internals/global":152}],295:[function(require,module,exports){ var global = require('../internals/global'); var DOMIterables = require('../internals/dom-iterables'); var ArrayIteratorMethods = require('../modules/es.array.iterator'); @@ -20524,7 +20873,7 @@ for (var COLLECTION_NAME in DOMIterables) { } } -},{"../internals/create-non-enumerable-property":131,"../internals/dom-iterables":138,"../internals/global":150,"../internals/well-known-symbol":231,"../modules/es.array.iterator":242}],294:[function(require,module,exports){ +},{"../internals/create-non-enumerable-property":133,"../internals/dom-iterables":140,"../internals/global":152,"../internals/well-known-symbol":233,"../modules/es.array.iterator":244}],296:[function(require,module,exports){ (function (Buffer){ // Copyright Joyent, Inc. and other Node contributors. // @@ -20635,7 +20984,7 @@ function objectToString(o) { } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":308}],295:[function(require,module,exports){ +},{"../../is-buffer/index.js":310}],297:[function(require,module,exports){ /* * Date Format 1.2.3 * (c) 2007-2009 Steven Levithan @@ -20863,7 +21212,7 @@ function kindOf(val) { } })(this); -},{}],296:[function(require,module,exports){ +},{}],298:[function(require,module,exports){ /*! * escape-html * Copyright(c) 2012-2013 TJ Holowaychuk @@ -20943,7 +21292,7 @@ function escapeHtml(string) { : html; } -},{}],297:[function(require,module,exports){ +},{}],299:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -21468,7 +21817,7 @@ function functionBindPolyfill(context) { }; } -},{}],298:[function(require,module,exports){ +},{}],300:[function(require,module,exports){ var http = require('http') var url = require('url') @@ -21501,7 +21850,7 @@ function validateParams (params) { return params } -},{"http":79,"url":394}],299:[function(require,module,exports){ +},{"http":82,"url":394}],301:[function(require,module,exports){ /*! * humanize-ms - index.js * Copyright(c) 2014 dead_horse @@ -21527,7 +21876,7 @@ module.exports = function (t) { return r; }; -},{"ms":315,"util":346}],300:[function(require,module,exports){ +},{"ms":317,"util":346}],302:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 @@ -21613,7 +21962,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],301:[function(require,module,exports){ +},{}],303:[function(require,module,exports){ 'use strict'; var types = [ require('./nextTick'), @@ -21712,7 +22061,7 @@ function immediate(task) { } } -},{"./messageChannel":302,"./mutation.js":303,"./nextTick":78,"./queueMicrotask":304,"./stateChange":305,"./timeout":306}],302:[function(require,module,exports){ +},{"./messageChannel":304,"./mutation.js":305,"./nextTick":78,"./queueMicrotask":306,"./stateChange":307,"./timeout":308}],304:[function(require,module,exports){ (function (global){ 'use strict'; @@ -21733,7 +22082,7 @@ exports.install = function (func) { }; }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],303:[function(require,module,exports){ +},{}],305:[function(require,module,exports){ (function (global){ 'use strict'; //based off rsvp https://github.com/tildeio/rsvp.js @@ -21758,7 +22107,7 @@ exports.install = function (handle) { }; }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],304:[function(require,module,exports){ +},{}],306:[function(require,module,exports){ (function (global){ 'use strict'; exports.test = function () { @@ -21772,7 +22121,7 @@ exports.install = function (func) { }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],305:[function(require,module,exports){ +},{}],307:[function(require,module,exports){ (function (global){ 'use strict'; @@ -21799,7 +22148,7 @@ exports.install = function (handle) { }; }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],306:[function(require,module,exports){ +},{}],308:[function(require,module,exports){ 'use strict'; exports.test = function () { return true; @@ -21810,7 +22159,7 @@ exports.install = function (t) { setTimeout(t, 0); }; }; -},{}],307:[function(require,module,exports){ +},{}],309:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -21839,7 +22188,7 @@ if (typeof Object.create === 'function') { } } -},{}],308:[function(require,module,exports){ +},{}],310:[function(require,module,exports){ /*! * Determine if an object is a Buffer * @@ -21862,14 +22211,14 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],309:[function(require,module,exports){ +},{}],311:[function(require,module,exports){ var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; -},{}],310:[function(require,module,exports){ +},{}],312:[function(require,module,exports){ (function (global){ /* * base64.js @@ -21895,16 +22244,7 @@ module.exports = Array.isArray || function (arr) { // existing version for noConflict() global = global || {}; var _Base64 = global.Base64; - var version = "2.5.2"; - // if node.js and NOT React Native, we use Buffer - var buffer; - if (typeof module !== 'undefined' && module.exports) { - try { - buffer = eval("require('buffer').Buffer"); - } catch (err) { - buffer = undefined; - } - } + var version = "2.6.3"; // constants var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; @@ -21951,24 +22291,41 @@ module.exports = Array.isArray || function (arr) { ]; return chars.join(''); }; - var btoa = global.btoa ? function(b) { - return global.btoa(b); - } : function(b) { + var btoa = global.btoa && typeof global.btoa == 'function' + ? function(b){ return global.btoa(b) } : function(b) { + if (b.match(/[^\x00-\xFF]/)) throw new RangeError( + 'The string contains invalid characters.' + ); return b.replace(/[\s\S]{1,3}/g, cb_encode); }; var _encode = function(u) { - var isUint8Array = Object.prototype.toString.call(u) === '[object Uint8Array]'; - return isUint8Array ? u.toString('base64') - : btoa(utob(String(u))); - } + return btoa(utob(String(u))); + }; + var mkUriSafe = function (b64) { + return b64.replace(/[+\/]/g, function(m0) { + return m0 == '+' ? '-' : '_'; + }).replace(/=/g, ''); + }; var encode = function(u, urisafe) { - return !urisafe - ? _encode(u) - : _encode(String(u)).replace(/[+\/]/g, function(m0) { - return m0 == '+' ? '-' : '_'; - }).replace(/=/g, ''); + return urisafe ? mkUriSafe(_encode(u)) : _encode(u); }; var encodeURI = function(u) { return encode(u, true) }; + var fromUint8Array; + if (global.Uint8Array) fromUint8Array = function(a, urisafe) { + // return btoa(fromCharCode.apply(null, a)); + var b64 = ''; + for (var i = 0, l = a.length; i < l; i += 3) { + var a0 = a[i], a1 = a[i+1], a2 = a[i+2]; + var ord = a0 << 16 | a1 << 8 | a2; + b64 += b64chars.charAt( ord >>> 18) + + b64chars.charAt((ord >>> 12) & 63) + + ( typeof a1 != 'undefined' + ? b64chars.charAt((ord >>> 6) & 63) : '=') + + ( typeof a2 != 'undefined' + ? b64chars.charAt( ord & 63) : '='); + } + return urisafe ? mkUriSafe(b64) : b64; + }; // decoder stuff var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g; var cb_btou = function(cccc) { @@ -22012,30 +22369,27 @@ module.exports = Array.isArray || function (arr) { chars.length -= [0, 0, 2, 1][padlen]; return chars.join(''); }; - var _atob = global.atob ? function(a) { - return global.atob(a); - } : function(a){ + var _atob = global.atob && typeof global.atob == 'function' + ? function(a){ return global.atob(a) } : function(a){ return a.replace(/\S{1,4}/g, cb_decode); }; var atob = function(a) { return _atob(String(a).replace(/[^A-Za-z0-9\+\/]/g, '')); }; - var _decode = buffer ? - buffer.from && Uint8Array && buffer.from !== Uint8Array.from - ? function(a) { - return (a.constructor === buffer.constructor - ? a : buffer.from(a, 'base64')).toString(); - } - : function(a) { - return (a.constructor === buffer.constructor - ? a : new buffer(a, 'base64')).toString(); - } - : function(a) { return btou(_atob(a)) }; + var _decode = function(a) { return btou(_atob(a)) }; + var _fromURI = function(a) { + return String(a).replace(/[-_]/g, function(m0) { + return m0 == '-' ? '+' : '/' + }).replace(/[^A-Za-z0-9\+\/]/g, ''); + }; var decode = function(a){ - return _decode( - String(a).replace(/[-_]/g, function(m0) { return m0 == '-' ? '+' : '/' }) - .replace(/[^A-Za-z0-9\+\/]/g, '') - ); + return _decode(_fromURI(a)); + }; + var toUint8Array; + if (global.Uint8Array) toUint8Array = function(a) { + return Uint8Array.from(atob(_fromURI(a)), function(c) { + return c.charCodeAt(0); + }); }; var noConflict = function() { var Base64 = global.Base64; @@ -22055,7 +22409,8 @@ module.exports = Array.isArray || function (arr) { btou: btou, decode: decode, noConflict: noConflict, - __buffer__: buffer + fromUint8Array: fromUint8Array, + toUint8Array: toUint8Array }; // if ES5 is available, make Base64.extendString() available if (typeof Object.defineProperty === 'function') { @@ -22096,9 +22451,8 @@ module.exports = Array.isArray || function (arr) { return {Base64: global.Base64} })); - }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],311:[function(require,module,exports){ +},{}],313:[function(require,module,exports){ /*! * merge-descriptors * Copyright(c) 2014 Jonathan Ong @@ -22160,7 +22514,7 @@ function merge(dest, src, redefine) { return dest } -},{}],312:[function(require,module,exports){ +},{}],314:[function(require,module,exports){ 'use strict'; /** @@ -22228,520 +22582,214 @@ Mime.prototype.define = function(typeMap, force) { // Use first extension as default if (force || !this._extensions[type]) { var ext = extensions[0]; - this._extensions[type] = (ext[0] != '*') ? ext : ext.substr(1) - } - } -}; - -/** - * Lookup a mime type based on extension - */ -Mime.prototype.getType = function(path) { - path = String(path); - var last = path.replace(/^.*[/\\]/, '').toLowerCase(); - var ext = last.replace(/^.*\./, '').toLowerCase(); - - var hasPath = last.length < path.length; - var hasDot = ext.length < last.length - 1; - - return (hasDot || !hasPath) && this._types[ext] || null; -}; - -/** - * Return file extension associated with a mime type - */ -Mime.prototype.getExtension = function(type) { - type = /^\s*([^;\s]*)/.test(type) && RegExp.$1; - return type && this._extensions[type.toLowerCase()] || null; -}; - -module.exports = Mime; - -},{}],313:[function(require,module,exports){ -'use strict'; - -var Mime = require('./Mime'); -module.exports = new Mime(require('./types/standard')); - -},{"./Mime":312,"./types/standard":314}],314:[function(require,module,exports){ -module.exports = {"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma","es"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/mrb-consumer+xml":["*xdf"],"application/mrb-publish+xml":["*xdf"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["*xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/ttml+xml":["ttml"],"application/urc-ressheet+xml":["rsheet"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-error+xml":["xer"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}; -},{}],315:[function(require,module,exports){ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var w = d * 7; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isFinite(val)) { - return options.long ? fmtLong(val) : fmtShort(val); - } - throw new Error( - 'val is not a non-empty string or a valid number. val=' + - JSON.stringify(val) - ); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'weeks': - case 'week': - case 'w': - return n * w; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - default: - return undefined; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; - } - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; - } - if (msAbs >= s) { - return Math.round(ms / s) + 's'; - } - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - return ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); -} - -},{}],316:[function(require,module,exports){ -(function (process){ -// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, -// backported and transplited with Babel, with backwards-compat fixes - -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } - - return parts; -} - -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; - -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; - - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; -}; - -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; - -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); -}; - - -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; + this._extensions[type] = (ext[0] != '*') ? ext : ext.substr(1) } } +}; - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } +/** + * Lookup a mime type based on extension + */ +Mime.prototype.getType = function(path) { + path = String(path); + var last = path.replace(/^.*[/\\]/, '').toLowerCase(); + var ext = last.replace(/^.*\./, '').toLowerCase(); - outputParts = outputParts.concat(toParts.slice(samePartsLength)); + var hasPath = last.length < path.length; + var hasDot = ext.length < last.length - 1; - return outputParts.join('/'); + return (hasDot || !hasPath) && this._types[ext] || null; }; -exports.sep = '/'; -exports.delimiter = ':'; +/** + * Return file extension associated with a mime type + */ +Mime.prototype.getExtension = function(type) { + type = /^\s*([^;\s]*)/.test(type) && RegExp.$1; + return type && this._extensions[type.toLowerCase()] || null; +}; -exports.dirname = function (path) { - if (typeof path !== 'string') path = path + ''; - if (path.length === 0) return '.'; - var code = path.charCodeAt(0); - var hasRoot = code === 47 /*/*/; - var end = -1; - var matchedSlash = true; - for (var i = path.length - 1; i >= 1; --i) { - code = path.charCodeAt(i); - if (code === 47 /*/*/) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } +module.exports = Mime; - if (end === -1) return hasRoot ? '/' : '.'; - if (hasRoot && end === 1) { - // return '//'; - // Backwards-compat fix: - return '/'; - } - return path.slice(0, end); -}; +},{}],315:[function(require,module,exports){ +'use strict'; -function basename(path) { - if (typeof path !== 'string') path = path + ''; +var Mime = require('./Mime'); +module.exports = new Mime(require('./types/standard')); - var start = 0; - var end = -1; - var matchedSlash = true; - var i; +},{"./Mime":314,"./types/standard":316}],316:[function(require,module,exports){ +module.exports = {"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma","es"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/mrb-consumer+xml":["*xdf"],"application/mrb-publish+xml":["*xdf"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["*xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/ttml+xml":["ttml"],"application/urc-ressheet+xml":["rsheet"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-error+xml":["xer"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}; +},{}],317:[function(require,module,exports){ +/** + * Helpers. + */ - for (i = path.length - 1; i >= 0; --i) { - if (path.charCodeAt(i) === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; - } - } +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; - if (end === -1) return ''; - return path.slice(start, end); -} +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ -// Uses a mixed approach for backwards-compatibility, as ext behavior changed -// in new Node.js versions, so only basename() above is backported here -exports.basename = function (path, ext) { - var f = basename(path); - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); } - return f; + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); }; -exports.extname = function (path) { - if (typeof path !== 'string') path = path + ''; - var startDot = -1; - var startPart = 0; - var end = -1; - var matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - var preDotState = 0; - for (var i = path.length - 1; i >= 0; --i) { - var code = path.charCodeAt(i); - if (code === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === 46 /*.*/) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) - startDot = i; - else if (preDotState !== 1) - preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; } +} - if (startDot === -1 || end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ''; +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; } - return path.slice(startDot, end); -}; + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; } -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; +/** + * Pluralization helper. + */ -}).call(this,require('_process')) -},{"_process":393}],317:[function(require,module,exports){ +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} + +},{}],318:[function(require,module,exports){ (function (global){ /*! - * Platform.js - * Copyright 2014-2018 Benjamin Tan - * Copyright 2011-2013 John-David Dalton - * Available under MIT license + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license */ ;(function() { 'use strict'; @@ -23108,7 +23156,7 @@ var substr = 'ab'.substr(-1) === 'b' 'Konqueror', 'Lunascape', 'Maxthon', - { 'label': 'Microsoft Edge', 'pattern': 'Edge' }, + { 'label': 'Microsoft Edge', 'pattern': '(?:Edge|Edg|EdgA|EdgiOS)' }, 'Midori', 'Nook Browser', 'PaleMoon', @@ -23124,13 +23172,18 @@ var substr = 'ab'.substr(-1) === 'b' { 'label': 'SRWare Iron', 'pattern': 'Iron' }, 'Sunrise', 'Swiftfox', + 'Vivaldi', 'Waterfox', 'WebPositive', + { 'label': 'Yandex Browser', 'pattern': 'YaBrowser' }, + { 'label': 'UC Browser', 'pattern': 'UCBrowser' }, 'Opera Mini', { 'label': 'Opera Mini', 'pattern': 'OPiOS' }, 'Opera', { 'label': 'Opera', 'pattern': 'OPR' }, + 'Chromium', 'Chrome', + { 'label': 'Chrome', 'pattern': '(?:HeadlessChrome)' }, { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' }, { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' }, { 'label': 'Firefox for iOS', 'pattern': 'FxiOS' }, @@ -23176,6 +23229,7 @@ var substr = 'ab'.substr(-1) === 'b' /* Detectable manufacturers. */ var manufacturer = getManufacturer({ 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 }, + 'Alcatel': {}, 'Archos': {}, 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 }, 'Asus': { 'Transformer': 1 }, @@ -23184,22 +23238,28 @@ var substr = 'ab'.substr(-1) === 'b' 'Google': { 'Google TV': 1, 'Nexus': 1 }, 'HP': { 'TouchPad': 1 }, 'HTC': {}, + 'Huawei': {}, + 'Lenovo': {}, 'LG': {}, 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 }, 'Motorola': { 'Xoom': 1 }, 'Nintendo': { 'Wii U': 1, 'Wii': 1 }, 'Nokia': { 'Lumia': 1 }, + 'Oppo': {}, 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 }, - 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 } + 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 }, + 'Xiaomi': { 'Mi': 1, 'Redmi': 1 } }); /* Detectable operating systems (order is important). */ var os = getOS([ 'Windows Phone', + 'KaiOS', 'Android', 'CentOS', { 'label': 'Chrome OS', 'pattern': 'CrOS' }, 'Debian', + { 'label': 'DragonFly BSD', 'pattern': 'DragonFly' }, 'Fedora', 'FreeBSD', 'Gentoo', @@ -23355,9 +23415,26 @@ var substr = 'ab'.substr(-1) === 'b' // Convert layout to an array so we can add extra details. layout && (layout = [layout]); + // Detect Android products. + // Browsers on Android devices typically provide their product IDS after "Android;" + // up to "Build" or ") AppleWebKit". + // Example: + // "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36 + // (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36" + if (/\bAndroid\b/.test(os) && !product && + (data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) { + product = trim(data[1]) + // Replace any language codes (eg. "en-US"). + .replace(/^[a-z]{2}-[a-z]{2};\s*/i, '') + || null; + } // Detect product names that contain their manufacturer's name. if (manufacturer && !product) { product = getProduct([manufacturer]); + } else if (manufacturer && product) { + product = product + .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ') + .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2'); } // Clean up Google TV. if ((data = /\bGoogle TV\b/.exec(product))) { @@ -23385,7 +23462,7 @@ var substr = 'ab'.substr(-1) === 'b' : ''); } // Detect Kubuntu. - else if (name == 'Konqueror' && !/buntu/i.test(os)) { + else if (name == 'Konqueror' && /^Linux\b/i.test(os)) { os = 'Kubuntu'; } // Detect Android browsers. @@ -23405,6 +23482,10 @@ var substr = 'ab'.substr(-1) === 'b' description.unshift('accelerated'); } } + // Detect UC Browser speed mode. + else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) { + description.push('speed mode'); + } // Detect PaleMoon identifying as Firefox. else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) { description.push('identifying as Firefox ' + data[1]); @@ -23434,7 +23515,7 @@ var substr = 'ab'.substr(-1) === 'b' // Detect non-Opera (Presto-based) versions (order is important). if (!version) { version = getVersion([ - '(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))', + '(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)', 'Version', qualify(name), '(?:Firefox|Minefield|NetFront)' @@ -23562,7 +23643,7 @@ var substr = 'ab'.substr(-1) === 'b' (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || ''); } // Detect Firefox Mobile. - if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS)\b/.test(os)) { + if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) { name = 'Firefox Mobile'; } // Obscure Maxthon's unreliable version. @@ -23658,7 +23739,7 @@ var substr = 'ab'.substr(-1) === 'b' version = null; } // Use the full Chrome version when available. - data[1] = (/\bChrome\/([\d.]+)/i.exec(ua) || 0)[1]; + data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1]; // Detect Blink layout engine. if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') { layout = ['Blink']; @@ -23667,7 +23748,7 @@ var substr = 'ab'.substr(-1) === 'b' // http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi if (!useFeatures || (!likeChrome && !data[1])) { layout && (layout[1] = 'like Safari'); - data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : '8'); + data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : data < 602 ? 9 : data < 604 ? 10 : data < 606 ? 11 : data < 608 ? 12 : '12'); } else { layout && (layout[1] = 'like Chrome'); data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28'); @@ -23677,6 +23758,8 @@ var substr = 'ab'.substr(-1) === 'b' // Obscure version for some Safari 1-2 releases. if (name == 'Safari' && (!version || parseInt(version) > 45)) { version = data; + } else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) { + description.unshift('headless'); } } // Detect Opera desktop modes. @@ -23704,16 +23787,24 @@ var substr = 'ab'.substr(-1) === 'b' os = null; } } + // Newer versions of SRWare Iron uses the Chrome tag to indicate its version number. + else if (/\bSRWare Iron\b/.test(name) && !version) { + version = getVersion('Chrome'); + } // Strip incorrect OS versions. if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 && ua.indexOf('/' + data + '-') > -1) { os = trim(os.replace(data, '')); } + // Ensure OS does not include the browser name. + if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) { + os = os.replace(RegExp(' *' + qualify(name) + ' *'), ''); + } // Add layout engine. if (layout && !/\b(?:Avant|Nook)\b/.test(name) && ( /Browser|Lunascape|Maxthon/.test(name) || name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) || - /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(name) && layout[1])) { + /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(name) && layout[1])) { // Don't add layout details to description if they are falsey. (data = layout[layout.length - 1]) && description.push(data); } @@ -23882,8 +23973,8 @@ var substr = 'ab'.substr(-1) === 'b' * * Common values include: * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista", - * "Windows XP", "OS X", "Ubuntu", "Debian", "Fedora", "Red Hat", "SuSE", - * "Android", "iOS" and "Windows Phone" + * "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat", + * "SuSE", "Android", "iOS" and "Windows Phone" * * @memberOf platform.os * @type string|null @@ -23956,7 +24047,7 @@ var substr = 'ab'.substr(-1) === 'b' }.call(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],318:[function(require,module,exports){ +},{}],319:[function(require,module,exports){ (function (process){ 'use strict'; @@ -24005,19 +24096,170 @@ function nextTick(fn, arg1, arg2, arg3) { }).call(this,require('_process')) -},{"_process":393}],319:[function(require,module,exports){ -var immediate = require('immediate'); +},{"_process":393}],320:[function(require,module,exports){ +// shim for using process in browser var process = module.exports = {}; -process.nextTick = immediate +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; process.title = 'browser'; -process.title1 = 'test123'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; + function noop() {} + process.on = noop; process.addListener = noop; process.once = noop; @@ -24027,17 +24269,20 @@ process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; + process.listeners = function (name) { return [] } + process.binding = function (name) { - throw new Error('process.binding is not supported'); + throw new Error('process.binding is not supported'); }; + process.cwd = function () { return '/' }; process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); + throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; -},{"immediate":301}],320:[function(require,module,exports){ +},{}],321:[function(require,module,exports){ (function (global){ /*! https://mths.be/punycode v1.4.1 by @mathias */ ;(function(root) { @@ -24574,7 +24819,7 @@ process.umask = function() { return 0; }; }(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],321:[function(require,module,exports){ +},{}],322:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -24660,7 +24905,7 @@ var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; -},{}],322:[function(require,module,exports){ +},{}],323:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -24747,16 +24992,16 @@ var objectKeys = Object.keys || function (obj) { return res; }; -},{}],323:[function(require,module,exports){ +},{}],324:[function(require,module,exports){ 'use strict'; exports.decode = exports.parse = require('./decode'); exports.encode = exports.stringify = require('./encode'); -},{"./decode":321,"./encode":322}],324:[function(require,module,exports){ +},{"./decode":322,"./encode":323}],325:[function(require,module,exports){ module.exports = require('./lib/_stream_duplex.js'); -},{"./lib/_stream_duplex.js":325}],325:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":326}],326:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -24888,7 +25133,7 @@ Duplex.prototype._destroy = function (err, cb) { pna.nextTick(cb, err); }; -},{"./_stream_readable":327,"./_stream_writable":329,"core-util-is":294,"inherits":307,"process-nextick-args":318}],326:[function(require,module,exports){ +},{"./_stream_readable":328,"./_stream_writable":330,"core-util-is":296,"inherits":309,"process-nextick-args":319}],327:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -24936,7 +25181,7 @@ function PassThrough(options) { PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; -},{"./_stream_transform":328,"core-util-is":294,"inherits":307}],327:[function(require,module,exports){ +},{"./_stream_transform":329,"core-util-is":296,"inherits":309}],328:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -25958,7 +26203,7 @@ function indexOf(xs, x) { return -1; } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":325,"./internal/streams/BufferList":330,"./internal/streams/destroy":331,"./internal/streams/stream":332,"_process":393,"core-util-is":294,"events":297,"inherits":307,"isarray":309,"process-nextick-args":318,"safe-buffer":338,"string_decoder/":341,"util":78}],328:[function(require,module,exports){ +},{"./_stream_duplex":326,"./internal/streams/BufferList":331,"./internal/streams/destroy":332,"./internal/streams/stream":333,"_process":393,"core-util-is":296,"events":299,"inherits":309,"isarray":311,"process-nextick-args":319,"safe-buffer":339,"string_decoder/":341,"util":78}],329:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -26173,7 +26418,7 @@ function done(stream, er, data) { return stream.push(null); } -},{"./_stream_duplex":325,"core-util-is":294,"inherits":307}],329:[function(require,module,exports){ +},{"./_stream_duplex":326,"core-util-is":296,"inherits":309}],330:[function(require,module,exports){ (function (process,global,setImmediate){ // Copyright Joyent, Inc. and other Node contributors. // @@ -26863,7 +27108,7 @@ Writable.prototype._destroy = function (err, cb) { cb(err); }; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) -},{"./_stream_duplex":325,"./internal/streams/destroy":331,"./internal/streams/stream":332,"_process":393,"core-util-is":294,"inherits":307,"process-nextick-args":318,"safe-buffer":338,"timers":342,"util-deprecate":343}],330:[function(require,module,exports){ +},{"./_stream_duplex":326,"./internal/streams/destroy":332,"./internal/streams/stream":333,"_process":393,"core-util-is":296,"inherits":309,"process-nextick-args":319,"safe-buffer":339,"timers":342,"util-deprecate":343}],331:[function(require,module,exports){ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -26943,7 +27188,7 @@ if (util && util.inspect && util.inspect.custom) { return this.constructor.name + ' ' + obj; }; } -},{"safe-buffer":338,"util":78}],331:[function(require,module,exports){ +},{"safe-buffer":339,"util":78}],332:[function(require,module,exports){ 'use strict'; /**/ @@ -27018,12 +27263,12 @@ module.exports = { destroy: destroy, undestroy: undestroy }; -},{"process-nextick-args":318}],332:[function(require,module,exports){ -arguments[4][96][0].apply(exports,arguments) -},{"dup":96,"events":297}],333:[function(require,module,exports){ +},{"process-nextick-args":319}],333:[function(require,module,exports){ +arguments[4][99][0].apply(exports,arguments) +},{"dup":99,"events":299}],334:[function(require,module,exports){ module.exports = require('./readable').PassThrough -},{"./readable":334}],334:[function(require,module,exports){ +},{"./readable":335}],335:[function(require,module,exports){ exports = module.exports = require('./lib/_stream_readable.js'); exports.Stream = exports; exports.Readable = exports; @@ -27032,13 +27277,13 @@ exports.Duplex = require('./lib/_stream_duplex.js'); exports.Transform = require('./lib/_stream_transform.js'); exports.PassThrough = require('./lib/_stream_passthrough.js'); -},{"./lib/_stream_duplex.js":325,"./lib/_stream_passthrough.js":326,"./lib/_stream_readable.js":327,"./lib/_stream_transform.js":328,"./lib/_stream_writable.js":329}],335:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":326,"./lib/_stream_passthrough.js":327,"./lib/_stream_readable.js":328,"./lib/_stream_transform.js":329,"./lib/_stream_writable.js":330}],336:[function(require,module,exports){ module.exports = require('./readable').Transform -},{"./readable":334}],336:[function(require,module,exports){ +},{"./readable":335}],337:[function(require,module,exports){ module.exports = require('./lib/_stream_writable.js'); -},{"./lib/_stream_writable.js":329}],337:[function(require,module,exports){ +},{"./lib/_stream_writable.js":330}],338:[function(require,module,exports){ /** * Copyright (c) 2014-present, Facebook, Inc. * @@ -27767,7 +28012,7 @@ module.exports = require('./lib/_stream_writable.js'); (function() { return this })() || Function("return this")() ); -},{}],338:[function(require,module,exports){ +},{}],339:[function(require,module,exports){ /* eslint-disable node/no-deprecated-api */ var buffer = require('buffer') var Buffer = buffer.Buffer @@ -27831,7 +28076,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { return buffer.SlowBuffer(size) } -},{"buffer":98}],339:[function(require,module,exports){ +},{"buffer":79}],340:[function(require,module,exports){ (function (Buffer){ ;(function (sax) { // wrapper for non-node envs sax.parser = function (strict, opt) { return new SAXParser(strict, opt) } @@ -29400,136 +29645,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { })(typeof exports === 'undefined' ? this.sax = {} : exports) }).call(this,require("buffer").Buffer) -},{"buffer":98,"stream":340,"string_decoder":341}],340:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -module.exports = Stream; - -var EE = require('events').EventEmitter; -var inherits = require('inherits'); - -inherits(Stream, EE); -Stream.Readable = require('readable-stream/readable.js'); -Stream.Writable = require('readable-stream/writable.js'); -Stream.Duplex = require('readable-stream/duplex.js'); -Stream.Transform = require('readable-stream/transform.js'); -Stream.PassThrough = require('readable-stream/passthrough.js'); - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; - - - -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. - -function Stream() { - EE.call(this); -} - -Stream.prototype.pipe = function(dest, options) { - var source = this; - - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); - } - } - } - - source.on('data', ondata); - - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } - } - - dest.on('drain', ondrain); - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); - } - - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; - - dest.end(); - } - - - function onclose() { - if (didOnEnd) return; - didOnEnd = true; - - if (typeof dest.destroy === 'function') dest.destroy(); - } - - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. - } - } - - source.on('error', onerror); - dest.on('error', onerror); - - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); - - source.removeListener('end', onend); - source.removeListener('close', onclose); - - source.removeListener('error', onerror); - dest.removeListener('error', onerror); - - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); - - dest.removeListener('close', cleanup); - } - - source.on('end', cleanup); - source.on('close', cleanup); - - dest.on('close', cleanup); - - dest.emit('pipe', source); - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; -}; - -},{"events":297,"inherits":307,"readable-stream/duplex.js":324,"readable-stream/passthrough.js":333,"readable-stream/readable.js":334,"readable-stream/transform.js":335,"readable-stream/writable.js":336}],341:[function(require,module,exports){ +},{"buffer":79,"stream":81,"string_decoder":341}],341:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -29826,7 +29942,7 @@ function simpleWrite(buf) { function simpleEnd(buf) { return buf && buf.length ? this.write(buf) : ''; } -},{"safe-buffer":338}],342:[function(require,module,exports){ +},{"safe-buffer":339}],342:[function(require,module,exports){ (function (setImmediate,clearImmediate){ var nextTick = require('process/browser.js').nextTick; var apply = Function.prototype.apply; @@ -29905,7 +30021,7 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : delete immediateIds[id]; }; }).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":319,"timers":342}],343:[function(require,module,exports){ +},{"process/browser.js":320,"timers":342}],343:[function(require,module,exports){ (function (global){ /** @@ -31198,7 +31314,7 @@ function hasOwnProperty(obj, prop) { }).call(this); -},{"./bom":347,"./defaults":349,"./processors":351,"events":297,"sax":339,"timers":342}],351:[function(require,module,exports){ +},{"./bom":347,"./defaults":349,"./processors":351,"events":299,"sax":340,"timers":342}],351:[function(require,module,exports){ // Generated by CoffeeScript 1.12.7 (function() { "use strict"; @@ -35549,7 +35665,7 @@ exports.pbkdf2 = function () { error('sorry,pbkdf2 is not implemented yet'); }; -},{"./md5":389,"./sha":390,"buffer":98,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.fill":235,"core-js/modules/es.array.join":243,"core-js/modules/es.array.slice":246,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257}],388:[function(require,module,exports){ +},{"./md5":389,"./sha":390,"buffer":79,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.fill":237,"core-js/modules/es.array.join":245,"core-js/modules/es.array.slice":248,"core-js/modules/es.object.to-string":256,"core-js/modules/es.regexp.to-string":259}],388:[function(require,module,exports){ "use strict"; require("core-js/modules/es.array.concat"); @@ -35600,7 +35716,7 @@ module.exports = { hash: hash }; -},{"buffer":98,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.fill":235}],389:[function(require,module,exports){ +},{"buffer":79,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.fill":237}],389:[function(require,module,exports){ "use strict"; /* @@ -35894,7 +36010,7 @@ module.exports.writableStream = function isWritableStream(obj) { }; }).call(this,{"isBuffer":require("../node_modules/is-buffer/index.js")}) -},{"../lib/common/utils/isArray":59,"../node_modules/is-buffer/index.js":308,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"stream":340}],393:[function(require,module,exports){ +},{"../lib/common/utils/isArray":59,"../node_modules/is-buffer/index.js":310,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"stream":81}],393:[function(require,module,exports){ "use strict"; var immediate = require('immediate'); @@ -35941,7 +36057,7 @@ process.umask = function () { return 0; }; -},{"immediate":301}],394:[function(require,module,exports){ +},{"immediate":303}],394:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -36702,7 +36818,7 @@ Url.prototype.parseHost = function () { if (host) this.hostname = host; }; -},{"./util":395,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.index-of":241,"core-js/modules/es.array.join":243,"core-js/modules/es.array.last-index-of":244,"core-js/modules/es.array.slice":246,"core-js/modules/es.array.splice":248,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.match":260,"core-js/modules/es.string.replace":261,"core-js/modules/es.string.search":262,"core-js/modules/es.string.split":263,"core-js/modules/es.string.trim":265,"punycode":320,"querystring":323}],395:[function(require,module,exports){ +},{"./util":395,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.index-of":243,"core-js/modules/es.array.join":245,"core-js/modules/es.array.last-index-of":246,"core-js/modules/es.array.slice":248,"core-js/modules/es.array.splice":250,"core-js/modules/es.object.keys":255,"core-js/modules/es.regexp.exec":258,"core-js/modules/es.string.match":262,"core-js/modules/es.string.replace":263,"core-js/modules/es.string.search":264,"core-js/modules/es.string.split":265,"core-js/modules/es.string.trim":267,"punycode":321,"querystring":324}],395:[function(require,module,exports){ 'use strict'; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -36758,7 +36874,7 @@ exports.timestamp = function timestamp(t) { return Math.round(Date.now() / 1000); }; -},{"core-js/modules/es.number.constructor":250,"escape-html":296}],397:[function(require,module,exports){ +},{"core-js/modules/es.number.constructor":252,"escape-html":298}],397:[function(require,module,exports){ (function (process,Buffer){ 'use strict'; @@ -37565,6 +37681,6 @@ exports.requestWithCallback = function requestWithCallback(url, args, callback) }; }).call(this,require('_process'),require("buffer").Buffer) -},{"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"_process":393,"buffer":98,"constants":100,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.index-of":241,"core-js/modules/es.array.join":243,"core-js/modules/es.function.name":249,"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255,"debug":391,"http":79,"https":298,"humanize-ms":299,"url":394,"util":346}]},{},[1])(1) +},{"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"_process":393,"buffer":79,"constants":102,"core-js/modules/es.array.concat":236,"core-js/modules/es.array.index-of":243,"core-js/modules/es.array.join":245,"core-js/modules/es.function.name":251,"core-js/modules/es.object.to-string":256,"core-js/modules/es.promise":257,"debug":391,"http":82,"https":300,"humanize-ms":301,"url":394,"util":346}]},{},[1])(1) }); diff --git a/dist/aliyun-oss-sdk.min.js b/dist/aliyun-oss-sdk.min.js index 042a6f972..904c44457 100644 --- a/dist/aliyun-oss-sdk.min.js +++ b/dist/aliyun-oss-sdk.min.js @@ -1,20 +1,20 @@ -// Aliyun OSS SDK for JavaScript v6.13.0 +// Aliyun OSS SDK for JavaScript v6.13.1 // Copyright Aliyun.com, Inc. or its affiliates. All Rights Reserved. // License at https://github.com/ali-sdk/ali-oss/blob/master/LICENSE -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.OSS=e()}}(function(){var define,module,exports;return function(){function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,function(e){return i(t[s][1][e]||e)},l,l.exports,e,t,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s1e4)){e.next=36;break}return this._setOptions=Date.now(),e.next=35,I.call(this);case 35:return e.abrupt("return",this.request(t));case 36:throw s;case 37:if(!t.xmlResponse){e.next=42;break}return e.next=40,this.parseXML(n.data);case 40:a=e.sent,n.data=a;case 42:return e.abrupt("return",n);case 43:case"end":return e.stop()}},e,this,[[3,10]])})),u.apply(this,arguments)}var c=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.symbol"),e("core-js/modules/es.symbol.description"),e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.includes"),e("core-js/modules/es.array.index-of"),e("core-js/modules/es.array.slice"),e("core-js/modules/es.function.name"),e("core-js/modules/es.object.assign"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.promise"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.regexp.to-string"),e("core-js/modules/es.string.replace"),e("core-js/modules/es.string.split"),e("core-js/modules/es.string.starts-with");var l=c(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var f=c(e("@babel/runtime/helpers/asyncToGenerator")),p=e("debug")("ali-oss"),d=e("xml2js"),h=e("agentkeepalive"),m=e("merge-descriptors"),y=e("platform"),b=e("utility"),g=e("urllib"),v=e("./version"),w=e("bowser"),x=e("../common/signUtils"),j=e("../common/client/initOptions"),_=e("../common/utils/createRequest"),E=_.createRequest,T=e("../common/utils/encoder"),S=T.encoder,O=e("../common/client/getReqUrl"),k=O.getReqUrl,A=e("../common/utils/setSTSToken"),I=A.setSTSToken,N=e("../common/utils/retry"),D=N.retry,C=new h;t.exports=s,s.initOptions=function(e){e.stsToken||console.warn("Please use STS Token for safety, see more details at https://help.aliyun.com/document_detail/32077.html");var t=Object.assign({secure:o(),useFetch:!1},e);return j(t)};var R=s.prototype;R.debug=p,m(R,e("./object")),m(R,e("../common/bucket/getBucketWebsite")),m(R,e("../common/bucket/putBucketWebsite")),m(R,e("../common/bucket/deleteBucketWebsite")),m(R,e("../common/bucket/getBucketLifecycle")),m(R,e("../common/bucket/putBucketLifecycle")),m(R,e("../common/bucket/deleteBucketLifecycle")),m(R,e("../common/bucket/putBucketVersioning")),m(R,e("../common/bucket/getBucketVersioning")),m(R,e("../common/bucket/getBucketInventory")),m(R,e("../common/bucket/deleteBucketInventory")),m(R,e("../common/bucket/listBucketInventory")),m(R,e("../common/bucket/putBucketInventory")),m(R,e("../common/bucket/abortBucketWorm")),m(R,e("../common/bucket/completeBucketWorm")),m(R,e("../common/bucket/extendBucketWorm")),m(R,e("../common/bucket/getBucketWorm")),m(R,e("../common/bucket/initiateBucketWorm")),m(R,e("./managed-upload")),m(R,e("../common/multipart")),m(R,e("../common/parallel")),R.signature=function(e){return this.debug("authorization stringToSign: %s",e,"info"),x.computeSignature(this.options.accessKeySecret,e,this.options.headerEncoding)},R._getReqUrl=k,R.authorization=function(e,t,r,n){var i=x.buildCanonicalString(e.toUpperCase(),t,{headers:n,parameters:r});return x.authorization(this.options.accessKeyId,this.options.accessKeySecret,i,this.options.headerEncoding)},R.request=function(){var e=(0,f.default)(l.default.mark(function e(t){var r,n=this;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=!t.stream||t.stream.readable,this.options.retryMax&&r?this.request=D(a.bind(this),this.options.retryMax,{errorHandler:function(e){return!!function(e){var t=[-1,-2].includes(e.status),r=n.options.requestErrorRetryHandle||function(){return!0};return t&&r(e)}(e)}}):this.request=a.bind(this),e.next=4,this.request(t);case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),R._getResource=function(e){var t="/";return e.bucket&&(t+="".concat(e.bucket,"/")),e.object&&(t+=S(e.object,this.options.headerEncoding)),t},R._escape=function(e){return b.encodeURIComponent(e).replace(/%2F/g,"/")},R._getUserAgent=function(){var e=n&&n.browser?"js":"nodejs",t="aliyun-sdk-".concat(e,"/").concat(v.version),r=y.description;return!r&&n&&(r="Node.js ".concat(n.version.slice(1)," on ").concat(n.platform," ").concat(n.arch)),this._checkUserAgent("".concat(t," ").concat(r))},R._checkUserAgent=function(e){return e.replace(/\u03b1/,"alpha").replace(/\u03b2/,"beta")},R.checkBrowserAndVersion=function(e,t){return w.name===e&&w.version.split(".")[0]===t},R.parseXML=function(e){return new Promise(function(t,n){r.isBuffer(e)&&(e=e.toString()),d.parseString(e,{explicitRoot:!1,explicitArray:!1},function(e,r){e?n(e):t(r)})})},R.requestError=function(){function e(e){return t.apply(this,arguments)}var t=(0,f.default)(l.default.mark(function e(t){var r,n,i,o;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=null,t.data&&t.data.length){e.next=5;break}-1===t.status||-2===t.status?(r=new Error(t.message),r.name=t.name,r.status=t.status,r.code=t.name):(404===t.status?(r=new Error("Object not exists"),r.name="NoSuchKeyError",r.status=404,r.code="NoSuchKey"):412===t.status?(r=new Error("Pre condition failed"),r.name="PreconditionFailedError",r.status=412,r.code="PreconditionFailed"):(r=new Error("Unknow error, status: ".concat(t.status)),r.name="UnknowError",r.status=t.status),r.requestId=t.headers["x-oss-request-id"],r.host=""),e.next=32;break;case 5:return n=String(t.data),this.debug("request response error data: %s",n,"error"),e.prev=7,e.next=10,this.parseXML(n);case 10:if(e.t0=e.sent,e.t0){e.next=13;break}e.t0={};case 13:i=e.t0,e.next=23;break;case 16:return e.prev=16,e.t1=e.catch(7),this.debug(n,"error"),e.t1.message+="\nraw xml: ".concat(n),e.t1.status=t.status,e.t1.requestId=t.headers["x-oss-request-id"],e.abrupt("return",e.t1);case 23:o=i.Message||"unknow request error, status: ".concat(t.status),i.Condition&&(o+=" (condition: ".concat(i.Condition,")")),r=new Error(o),r.name=i.Code?"".concat(i.Code,"Error"):"UnknowError",r.status=t.status,r.code=i.Code,r.requestId=i.RequestId,r.hostId=i.HostId,r.serverTime=i.ServerTime;case 32:return this.debug("generate error %j",r,"error"),e.abrupt("return",r);case 34:case"end":return e.stop()}},e,this,[[7,16]])}));return e}()}).call(this,{isBuffer:e("../../node_modules/is-buffer/index.js")},e("_process"))},{"../../node_modules/is-buffer/index.js":308,"../common/bucket/abortBucketWorm":6,"../common/bucket/completeBucketWorm":7,"../common/bucket/deleteBucketInventory":8,"../common/bucket/deleteBucketLifecycle":9,"../common/bucket/deleteBucketWebsite":10,"../common/bucket/extendBucketWorm":11,"../common/bucket/getBucketInventory":12,"../common/bucket/getBucketLifecycle":13,"../common/bucket/getBucketVersioning":14,"../common/bucket/getBucketWebsite":15,"../common/bucket/getBucketWorm":16,"../common/bucket/initiateBucketWorm":17,"../common/bucket/listBucketInventory":18,"../common/bucket/putBucketInventory":19,"../common/bucket/putBucketLifecycle":20,"../common/bucket/putBucketVersioning":21,"../common/bucket/putBucketWebsite":22,"../common/client/getReqUrl":24,"../common/client/initOptions":25,"../common/multipart":28,"../common/parallel":46,"../common/signUtils":47,"../common/utils/createRequest":52,"../common/utils/encoder":55,"../common/utils/retry":67,"../common/utils/setSTSToken":69,"./managed-upload":3,"./object":4,"./version":5,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,_process:393,agentkeepalive:75,bowser:77,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.includes":240,"core-js/modules/es.array.index-of":241,"core-js/modules/es.array.slice":246,"core-js/modules/es.function.name":249,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.replace":261,"core-js/modules/es.string.split":263,"core-js/modules/es.string.starts-with":264,"core-js/modules/es.symbol":267,"core-js/modules/es.symbol.description":266,debug:391,"merge-descriptors":311,platform:317,"regenerator-runtime/runtime":337,urllib:397,utility:396,xml2js:352}],3:[function(e,t,r){(function(t){"use strict";function n(e,t){if(!(this instanceof n))return new n(e,t);x.call(this,t),this.file=e,this.reader=new FileReader,this.start=0,this.finish=!1,this.fileBuffer=null}var i=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.filter"),e("core-js/modules/es.array.find"),e("core-js/modules/es.array.from"),e("core-js/modules/es.array.index-of"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.array.map"),e("core-js/modules/es.array.slice"),e("core-js/modules/es.array.splice"),e("core-js/modules/es.array-buffer.slice"),e("core-js/modules/es.function.name"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.promise"),e("core-js/modules/es.regexp.to-string"),e("core-js/modules/es.string.iterator"),e("core-js/modules/es.typed-array.uint8-array"),e("core-js/modules/es.typed-array.copy-within"),e("core-js/modules/es.typed-array.every"),e("core-js/modules/es.typed-array.fill"),e("core-js/modules/es.typed-array.filter"),e("core-js/modules/es.typed-array.find"),e("core-js/modules/es.typed-array.find-index"),e("core-js/modules/es.typed-array.for-each"),e("core-js/modules/es.typed-array.includes"),e("core-js/modules/es.typed-array.index-of"),e("core-js/modules/es.typed-array.iterator"),e("core-js/modules/es.typed-array.join"),e("core-js/modules/es.typed-array.last-index-of"),e("core-js/modules/es.typed-array.map"),e("core-js/modules/es.typed-array.reduce"),e("core-js/modules/es.typed-array.reduce-right"),e("core-js/modules/es.typed-array.reverse"),e("core-js/modules/es.typed-array.set"),e("core-js/modules/es.typed-array.slice"),e("core-js/modules/es.typed-array.some"),e("core-js/modules/es.typed-array.sort"),e("core-js/modules/es.typed-array.subarray"),e("core-js/modules/es.typed-array.to-locale-string"),e("core-js/modules/es.typed-array.to-string");var o=i(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var s=i(e("@babel/runtime/helpers/asyncToGenerator")),a=e("util"),u=e("path"),c=e("mime"),l=e("copy-to"),f=e("../common/utils/isBlob"),p=f.isBlob,d=e("../common/utils/isFile"),h=d.isFile,m=e("../common/utils/isArray"),y=m.isArray,b=e("../common/utils/isBuffer"),g=b.isBuffer,v=r;v.multipartUpload=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,s.default)(o.default.mark(function e(t,r){var n,i,s,a,l,f,d,m,y,b=arguments;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=b.length>2&&void 0!==b[2]?b[2]:{},this.resetCancelFlag(),!n.checkpoint||!n.checkpoint.uploadId){e.next=7;break}return r&&h(r)&&(n.checkpoint.file=r),e.next=6,this._resumeMultipart(n.checkpoint,n);case 6:return e.abrupt("return",e.sent);case 7:return i=102400,n.mime||(h(r)?n.mime=c.getType(u.extname(r.name)):p(r)?n.mime=r.type:g(r)?n.mime="":n.mime=c.getType(u.extname(r))),n.headers=n.headers||{},this._convertMetaToHeaders(n.meta,n.headers),e.next=13,this._getFileSize(r);case 13:if(!((s=e.sent)0&&l(f).to(d),h=this._divideParts(a,u),m=h.length,b=!1,g=function(e,n){return new Promise(function(){var a=(0,s.default)(o.default.mark(function s(a,u){var d,g,v,w,x,j;return o.default.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,e.isCancel()){o.next=33;break}return d=h[n-1],g=e._createStream(i,d.start,d.end),v={stream:g,size:d.end-d.start},y(e.multipartUploadStreams)?e.multipartUploadStreams.push(g):e.multipartUploadStreams=[g],w=function(){g.destroyed||g.destroy();var t=e.multipartUploadStreams.indexOf(g);-1!==t&&e.multipartUploadStreams.splice(t,1)},g.on("close",w),g.on("end",w),g.on("error",w),o.prev=10,o.next=13,e._uploadPart(p,c,n,v);case 13:x=o.sent,o.next=22;break;case 16:if(o.prev=16,o.t0=o.catch(10),w(),404!==o.t0.status){o.next=21;break}throw e._makeAbortEvent();case 21:throw o.t0;case 22:if(e.isCancel()||b){o.next=30;break}if(t.doneParts.push({number:n,etag:x.res.headers.etag}),!r.progress){o.next=27;break}return o.next=27,r.progress(f.length/m,t,x.res);case 27:a({number:n,etag:x.res.headers.etag}),o.next=31;break;case 30:a();case 31:o.next=34;break;case 33:a();case 34:o.next=45;break;case 36:o.prev=36,o.t1=o.catch(0),j=new Error,j.name=o.t1.name,j.message=o.t1.message,j.stack=o.t1.stack,j.partNum=n,l(o.t1).to(j),u(j);case 45:case"end":return o.stop()}},s,null,[[0,36],[10,16]])}));return function(e,t){return a.apply(this,arguments)}}())},v=Array.from(new Array(m),function(e,t){return t+1}),w=d.map(function(e){return e.number}),x=v.filter(function(e){return w.indexOf(e)<0}),j=5,_=r.parallel||j,e.next=17,this._parallel(x,_,function(e){return new Promise(function(t,r){g(n,e).then(function(e){e&&d.push(e),t()}).catch(function(e){r(e)})})});case 17:if(E=e.sent,b=!0,!(T=E.find(function(e){return"abort"===e.name}))){e.next=22;break}throw T;case 22:if(!this.isCancel()){e.next=25;break}throw g=null,this._makeCancelEvent();case 25:if(!(E&&E.length>0)){e.next=28;break}throw E[0].message="Failed to upload some parts with error: ".concat(E[0].toString()," part_num: ").concat(E[0].partNum),E[0];case 28:return e.next=30,this.completeMultipartUpload(p,c,d,r);case 30:return e.abrupt("return",e.sent);case 31:case"end":return e.stop()}},e,this)}));return e}(),v._getFileSize=function(){function e(e){return t.apply(this,arguments)}var t=(0,s.default)(o.default.mark(function e(t){return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!g(t)){e.next=4;break}return e.abrupt("return",t.length);case 4:if(!p(t)&&!h(t)){e.next=6;break}return e.abrupt("return",t.size);case 6:throw new Error("_getFileSize requires Buffer/File/Blob.");case 7:case"end":return e.stop()}},e)}));return e}();var w=e("stream"),x=w.Readable;a.inherits(n,x),n.prototype.readFileAndPush=function(e){if(this.fileBuffer)for(var t=!0;t&&this.fileBuffer&&this.startthis.fileBuffer.length?this.fileBuffer.length:n,this.start=n,t=this.push(this.fileBuffer.slice(r,n))}},n.prototype._read=function(e){if(this.file&&this.start>=this.file.size||this.fileBuffer&&this.start>=this.fileBuffer.length||this.finish||0===this.start&&!this.file)return this.finish||(this.fileBuffer=null,this.finish=!0),void this.push(null);e=e||16384;var r=this;this.reader.onload=function(n){r.fileBuffer=t.from(new Uint8Array(n.target.result)),r.file=null,r.readFileAndPush(e)},0===this.start?this.reader.readAsArrayBuffer(this.file):this.readFileAndPush(e)},v._createStream=function(e,t,r){if(p(e)||h(e))return new n(e.slice(t,r));if(g(e)){var i=e.subarray(t,r);return new x({read:function(){this.push(i),this.push(null)}})}throw new Error("_createStream requires Buffer/File/Blob.")},v._getPartSize=function(e,t){t||(t=1048576);var r=Math.ceil(e/1e4);return t1&&void 0!==l[1]?l[1]:{},n=t["continuation-token"]||t.continuationToken,delete t["continuation-token"],delete t.continuationToken,n&&(r.subres=Object.assign({"continuation-token":n},r.subres)),o=this._objectRequestParams("GET","",r),o.query=Object.assign({"list-type":2},t),o.xmlResponse=!0,o.successStatuses=[200],e.next=11,this.request(o);case 11:return s=e.sent,a=s.data.Contents,u=this,a&&(Array.isArray(a)||(a=[a]),a=a.map(function(e){return{name:e.Key,url:u._objectUrl(e.Key),lastModified:e.LastModified,etag:e.ETag,type:e.Type,size:Number(e.Size),storageClass:e.StorageClass,owner:e.Owner?{id:e.Owner.ID,displayName:e.Owner.DisplayName}:null}})),c=s.data.CommonPrefixes||null,c&&(Array.isArray(c)||(c=[c]),c=c.map(function(e){return e.Prefix})),e.abrupt("return",{res:s.res,objects:a,prefixes:c,isTruncated:"true"===s.data.IsTruncated,keyCount:+s.data.KeyCount,continuationToken:s.data.ContinuationToken||null,nextContinuationToken:s.data.NextContinuationToken||null});case 18:case"end":return e.stop()}},e,this)}));return e}(),v.restore=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=r||{},r.subres=Object.assign({restore:""},r.subres),r.versionId&&(r.subres.versionId=r.versionId),n=this._objectRequestParams("POST",t,r),n.successStatuses=[202],e.next=7,this.request(n);case 7:return o=e.sent,e.abrupt("return",{res:o.res});case 9:case"end":return e.stop()}},e,this)}));return e}(),v._objectUrl=function(e){return this._getReqUrl({bucket:this.options.bucket,object:e})},v._objectRequestParams=function(e,t,r){if(!this.options.bucket&&!this.options.cname)throw new Error("Please create a bucket first");r=r||{},t=this._objectName(t);var n={object:t,bucket:this.options.bucket,method:e,subres:r&&r.subres,timeout:r&&r.timeout,ctx:r&&r.ctx};return r.headers&&(n.headers={},a(r.headers).to(n.headers)),n},v._objectName=function(e){return e.replace(/^\/+/,"")},v._convertMetaToHeaders=function(e,t){e&&Object.keys(e).forEach(function(r){t["x-oss-meta-".concat(r)]=e[r]})},v._deleteFileSafe=function(e){var t=this;return new Promise(function(r){s.exists(e,function(n){n?s.unlink(e,function(n){n&&t.debug("unlink %j error: %s",e,n,"error"),r()}):r()})})},v.get=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o,a,u,c,f,p=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=p.length>2&&void 0!==p[2]?p[2]:{},o=null,a=!1,l.writableStream(r)?o=r:l.string(r)?(o=s.createWriteStream(r),a=!0):n=r,n=n||{},u=null===n.responseCacheControl?"":"no-cache",n.subres=Object.assign(u?{"response-cache-control":u}:{},n.subres),n.versionId&&(n.subres.versionId=n.versionId),n.process&&(n.subres["x-oss-process"]=n.process),e.prev=9,f=this._objectRequestParams("GET",t,n),f.writeStream=o,f.successStatuses=[200,206,304],e.next=15,this.request(f);case 15:c=e.sent,a&&o.destroy(),e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(9),!a){e.next=25;break}return o.destroy(),e.next=25,this._deleteFileSafe(r);case 25:throw e.t0;case 26:return e.abrupt("return",{res:c.res,content:c.data});case 27:case"end":return e.stop()}},e,this,[[9,19]])}));return e}()},{"../common/callback":23,"../common/image":26,"../common/object/copyObject":29,"../common/object/delete":30,"../common/object/deleteMulti":31,"../common/object/deleteObjectTagging":32,"../common/object/generateObjectUrl":33,"../common/object/get":34,"../common/object/getACL":35,"../common/object/getBucketVersions":36,"../common/object/getObjectMeta":37,"../common/object/getObjectTagging":38,"../common/object/getObjectUrl":39,"../common/object/getSymlink":40,"../common/object/head":41,"../common/object/putACL":42,"../common/object/putObjectTagging":43,"../common/object/putSymlink":44,"../common/object/signatureUrl":45,"../common/utils/isBlob":60,"../common/utils/isBuffer":61,"../common/utils/isFile":62,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"copy-to":101,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.map":245,"core-js/modules/es.function.name":249,"core-js/modules/es.number.constructor":250,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,fs:78,"is-type-of":392,"merge-descriptors":311,mime:313,path:316,"regenerator-runtime/runtime":337}],5:[function(e,t,r){"use strict" -;r.version="6.13.0"},{}],6:[function(e,t,r){"use strict";function n(e,t){return i.apply(this,arguments)}function i(){return i=(0,a.default)(s.default.mark(function e(t,r){var n,i;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return u.checkBucketName(t),n=this._bucketRequestParams("DELETE",t,"worm",r),e.next=4,this.request(n);case 4:return i=e.sent,e.abrupt("return",{res:i.res,status:i.status});case 6:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}var o=e("@babel/runtime/helpers/interopRequireDefault"),s=o(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var a=o(e("@babel/runtime/helpers/asyncToGenerator"));Object.defineProperty(r,"__esModule",{value:!0}),r.abortBucketWorm=void 0;var u=e("../utils/checkBucketName");r.abortBucketWorm=n},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],7:[function(e,t,r){"use strict";function n(e,t,r){return i.apply(this,arguments)}function i(){return i=(0,a.default)(s.default.mark(function e(t,r,n){var i,o;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return u.checkBucketName(t),i=this._bucketRequestParams("POST",t,{wormId:r},n),e.next=4,this.request(i);case 4:return o=e.sent,e.abrupt("return",{res:o.res,status:o.status});case 6:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}var o=e("@babel/runtime/helpers/interopRequireDefault"),s=o(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var a=o(e("@babel/runtime/helpers/asyncToGenerator"));Object.defineProperty(r,"__esModule",{value:!0}),r.completeBucketWorm=void 0;var u=e("../utils/checkBucketName");r.completeBucketWorm=n},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],8:[function(e,t,r){"use strict";function n(e,t){return i.apply(this,arguments)}function i(){return i=(0,a.default)(s.default.mark(function e(t,r){var n,i,o,a,c=arguments;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>2&&void 0!==c[2]?c[2]:{},i=Object.assign({inventory:"",inventoryId:r},n.subres),u.checkBucketName(t),o=this._bucketRequestParams("DELETE",t,i,n),o.successStatuses=[204],e.next=7,this.request(o);case 7:return a=e.sent,e.abrupt("return",{status:a.status,res:a.res});case 9:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}var o=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var s=o(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var a=o(e("@babel/runtime/helpers/asyncToGenerator"));Object.defineProperty(r,"__esModule",{value:!0}),r.deleteBucketInventory=void 0;var u=e("../utils/checkBucketName");r.deleteBucketInventory=n},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],9:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("../utils/checkBucketName"),a=s.checkBucketName;r.deleteBucketLifecycle=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a(t),n=this._bucketRequestParams("DELETE",t,"lifecycle",r),n.successStatuses=[204],e.next=5,this.request(n);case 5:return o=e.sent,e.abrupt("return",{res:o.res});case 7:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],10:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("../utils/checkBucketName"),a=s.checkBucketName;r.deleteBucketWebsite=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a(t),n=this._bucketRequestParams("DELETE",t,"website",r),n.successStatuses=[204],e.next=5,this.request(n);case 5:return o=e.sent,e.abrupt("return",{res:o.res});case 7:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],11:[function(e,t,r){"use strict";function n(e,t,r,n){return i.apply(this,arguments)}function i(){return i=(0,a.default)(s.default.mark(function e(t,r,n,i){var o,a,l;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return u.checkBucketName(t),o=this._bucketRequestParams("POST",t,{wormExtend:"",wormId:r},i),a={ExtendWormConfiguration:{RetentionPeriodInDays:n}},o.mime="xml",o.content=c.obj2xml(a,{headers:!0}),o.successStatuses=[200],e.next=8,this.request(o);case 8:return l=e.sent,e.abrupt("return",{res:l.res,status:l.status});case 10:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}var o=e("@babel/runtime/helpers/interopRequireDefault"),s=o(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var a=o(e("@babel/runtime/helpers/asyncToGenerator"));Object.defineProperty(r,"__esModule",{value:!0}),r.extendBucketWorm=void 0;var u=e("../utils/checkBucketName"),c=e("../utils/obj2xml");r.extendBucketWorm=n},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],12:[function(e,t,r){"use strict";function n(e,t){return i.apply(this,arguments)}function i(){return i=(0,a.default)(s.default.mark(function e(t,r){var n,i,o,a,l=arguments;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=l.length>2&&void 0!==l[2]?l[2]:{},i=Object.assign({inventory:"",inventoryId:r},n.subres),u.checkBucketName(t),o=this._bucketRequestParams("GET",t,i,n),o.successStatuses=[200],o.xmlResponse=!0,e.next=8,this.request(o);case 8:return a=e.sent,e.abrupt("return",{status:a.status,res:a.res,inventory:c.formatInventoryConfig(a.data)});case 10:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}var o=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var s=o(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var a=o(e("@babel/runtime/helpers/asyncToGenerator"));Object.defineProperty(r,"__esModule",{value:!0}),r.getBucketInventory=void 0;var u=e("../utils/checkBucketName"),c=e("../utils/formatInventoryConfig");r.getBucketInventory=n},{"../utils/checkBucketName":48,"../utils/formatInventoryConfig":56,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],13:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.map");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("../utils/checkBucketName"),a=s.checkBucketName,u=e("../utils/isArray"),c=u.isArray,l=e("../utils/formatObjKey"),f=l.formatObjKey;r.getBucketLifecycle=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a(t),n=this._bucketRequestParams("GET",t,"lifecycle",r),n.successStatuses=[200],n.xmlResponse=!0,e.next=6,this.request(n);case 6:return o=e.sent,s=o.data.Rule||null,s&&(c(s)||(s=[s]),s=s.map(function(e){return e.ID&&(e.id=e.ID,delete e.ID),e.Tag&&!c(e.Tag)&&(e.Tag=[e.Tag]),f(e,"firstLowerCase")})),e.abrupt("return",{rules:s,res:o.res});case 10:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/checkBucketName":48,"../utils/formatObjKey":57,"../utils/isArray":59,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.map":245,"regenerator-runtime/runtime":337}],14:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("../utils/checkBucketName"),a=s.checkBucketName;r.getBucketVersioning=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a(t),n=this._bucketRequestParams("GET",t,"versioning",r),n.xmlResponse=!0,n.successStatuses=[200],e.next=6,this.request(n);case 6:return o=e.sent,s=o.data.Status,e.abrupt("return",{status:o.status,versionStatus:s,res:o.res});case 9:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],15:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("../utils/checkBucketName"),a=s.checkBucketName,u=e("../utils/isObject"),c=u.isObject;r.getBucketWebsite=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a(t),n=this._bucketRequestParams("GET",t,"website",r),n.successStatuses=[200],n.xmlResponse=!0,e.next=6,this.request(n);case 6:return o=e.sent,s=[],o.data.RoutingRules&&o.data.RoutingRules.RoutingRule&&(s=c(o.data.RoutingRules.RoutingRule)?[o.data.RoutingRules.RoutingRule]:o.data.RoutingRules.RoutingRule),e.abrupt("return",{index:o.data.IndexDocument&&o.data.IndexDocument.Suffix||"",supportSubDir:o.data.IndexDocument&&o.data.IndexDocument.SupportSubDir||"false",type:o.data.IndexDocument&&o.data.IndexDocument.Type,routingRules:s,error:o.data.ErrorDocument&&o.data.ErrorDocument.Key||null,res:o.res});case 10:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/checkBucketName":48,"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],16:[function(e,t,r){"use strict";function n(e,t){return i.apply(this,arguments)}function i(){return i=(0,a.default)(s.default.mark(function e(t,r){var n,i;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return u.checkBucketName(t),n=this._bucketRequestParams("GET",t,"worm",r),n.successStatuses=[200],n.xmlResponse=!0,e.next=6,this.request(n);case 6:return i=e.sent,c.dataFix(i.data,{lowerFirst:!0,rename:{RetentionPeriodInDays:"days"}}),e.abrupt("return",Object.assign(Object.assign({},i.data),{res:i.res,status:i.status}));case 9:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}var o=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var s=o(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var a=o(e("@babel/runtime/helpers/asyncToGenerator"));Object.defineProperty(r,"__esModule",{value:!0}),r.getBucketWorm=void 0;var u=e("../utils/checkBucketName"),c=e("../utils/dataFix");r.getBucketWorm=n},{"../utils/checkBucketName":48,"../utils/dataFix":53,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],17:[function(e,t,r){"use strict";function n(e,t,r){return i.apply(this,arguments)}function i(){return i=(0,a.default)(s.default.mark(function e(t,r,n){var i,o,a;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c.checkBucketName(t),i=this._bucketRequestParams("POST",t,"worm",n),o={InitiateWormConfiguration:{RetentionPeriodInDays:r}},i.mime="xml",i.content=u.obj2xml(o,{headers:!0}),i.successStatuses=[200],e.next=8,this.request(i);case 8:return a=e.sent,e.abrupt("return",{res:a.res,wormId:a.res.headers["x-oss-worm-id"],status:a.status});case 10:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}var o=e("@babel/runtime/helpers/interopRequireDefault"),s=o(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var a=o(e("@babel/runtime/helpers/asyncToGenerator"));Object.defineProperty(r,"__esModule",{value:!0}),r.initiateBucketWorm=void 0;var u=e("../utils/obj2xml"),c=e("../utils/checkBucketName");r.initiateBucketWorm=n},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],18:[function(e,t,r){"use strict";function n(e){return i.apply(this,arguments)}function i(){return i=(0,a.default)(s.default.mark(function e(t){var r,n,i,o,a,l,f,p,d=arguments;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=d.length>1&&void 0!==d[1]?d[1]:{},n=r.continuationToken,i=Object.assign({inventory:""},n&&{"continuation-token":n},r.subres),u.checkBucketName(t),o=this._bucketRequestParams("GET",t,i,r),o.successStatuses=[200],o.xmlResponse=!0,e.next=9,this.request(o);case 9:return a=e.sent,l=a.data,f=a.res,p=a.status,e.abrupt("return",{isTruncated:"true"===l.IsTruncated,nextContinuationToken:l.NextContinuationToken,inventoryList:c.formatInventoryConfig(l.InventoryConfiguration,!0),status:p,res:f});case 12:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}var o=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var s=o(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var a=o(e("@babel/runtime/helpers/asyncToGenerator"));Object.defineProperty(r,"__esModule",{value:!0}),r.listBucketInventory=void 0;var u=e("../utils/checkBucketName"),c=e("../utils/formatInventoryConfig");r.listBucketInventory=n},{"../utils/checkBucketName":48,"../utils/formatInventoryConfig":56,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],19:[function(e,t,r){"use strict";function n(e,t){return i.apply(this,arguments)}function i(){return i=(0,a.default)(s.default.mark(function e(t,r){var n,i,o,a,l,f,p,d,h,m,y,b=arguments;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=b.length>2&&void 0!==b[2]?b[2]:{},i=Object.assign({inventory:"",inventoryId:r.id},n.subres),u.checkBucketName(t),o=r.OSSBucketDestination,a=r.optionalFields,l=r.includedObjectVersions,f="acs:oss:::",p="acs:ram::".concat(o.accountId,":role/"),d={InventoryConfiguration:{Id:r.id,IsEnabled:r.isEnabled,Filter:{Prefix:r.prefix||""},Destination:{OSSBucketDestination:{Format:o.format,AccountId:o.accountId,RoleArn:"".concat(p).concat(o.rolename),Bucket:"".concat(f).concat(o.bucket),Prefix:o.prefix||"",Encryption:o.encryption||""}},Schedule:{Frequency:r.frequency},IncludedObjectVersions:l,OptionalFields:{Field:(null===a||void 0===a?void 0:a.field)||[]}}},h=c.obj2xml(d,{headers:!0,firstUpperCase:!0}),m=this._bucketRequestParams("PUT",t,i,n),m.successStatuses=[200],m.mime="xml",m.content=h,e.next=14,this.request(m);case 14:return y=e.sent,e.abrupt("return",{status:y.status,res:y.res});case 16:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}var o=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.concat"),e("core-js/modules/es.object.assign");var s=o(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var a=o(e("@babel/runtime/helpers/asyncToGenerator"));Object.defineProperty(r,"__esModule",{value:!0}),r.putBucketInventory=void 0;var u=e("../utils/checkBucketName"),c=e("../utils/obj2xml");r.putBucketInventory=n},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":234,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],20:[function(e,t,r){"use strict";function n(e){e.days&&(e.expiration={days:e.days}),e.date&&(e.expiration={createdBeforeDate:e.date})}function i(e,t){var r=e.days,n=e.createdBeforeDate;if(!r&&!n)throw new Error("".concat(t," must includes days or createdBeforeDate"));if(r&&!/^[1-9][0-9]*$/.test(r))throw new Error("days must be a positive integer");if(n&&!/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(n))throw new Error("createdBeforeDate must be date and conform to iso8601 format")}function o(e){if(!d(e)&&!b(e))throw new Error("tag must be Object or Array");e=b(e)?[e]:e;var t={};m(e).forEach(function(e){t[e.key]=e.value}),x(t)}function s(e){if(e.id&&_(e.id)>255)throw new Error("ID is composed of 255 bytes at most");if(void 0===e.prefix)throw new Error("Rule must includes prefix");if(!["Enabled","Disabled"].includes(e.status))throw new Error("Status must be Enabled or Disabled");if(e.transition){if(!["IA","Archive"].includes(e.transition.storageClass))throw new Error("StorageClass must be IA or Archive");i(e.transition,"Transition")}if(e.expiration)if(e.expiration.expiredObjectDeleteMarker){if(e.expiration.days||e.expiration.createdBeforeDate)throw new Error("expiredObjectDeleteMarker cannot be used with days or createdBeforeDate")}else i(e.expiration,"Expiration");if(e.abortMultipartUpload&&i(e.abortMultipartUpload,"AbortMultipartUpload"),!(e.expiration||e.abortMultipartUpload||e.transition||e.noncurrentVersionTransition))throw new Error("Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition");if(e.tag){if(e.abortMultipartUpload)throw new Error("Tag cannot be used with abortMultipartUpload");o(e.tag)}}var a=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.for-each"),e("core-js/modules/es.array.includes"),e("core-js/modules/web.dom-collections.for-each");var u=a(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var c=a(e("@babel/runtime/helpers/asyncToGenerator")),l=e("../utils/checkBucketName"),f=l.checkBucketName,p=e("../utils/isArray"),d=p.isArray,h=e("../utils/deepCopy"),m=h.deepCopy,y=e("../utils/isObject"),b=y.isObject,g=e("../utils/obj2xml"),v=g.obj2xml,w=e("../utils/checkObjectTag"),x=w.checkObjectTag,j=e("../utils/getStrBytesCount"),_=j.getStrBytesCount;r.putBucketLifecycle=function(){function e(e,r,n){return t.apply(this,arguments)}var t=(0,c.default)(u.default.mark(function e(t,r,i){var o,a,c,l,p;return u.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(f(t),d(r)){e.next=3;break}throw new Error("rules must be Array");case 3:return o=this._bucketRequestParams("PUT",t,"lifecycle",i),a=[],c={LifecycleConfiguration:{Rule:a}},r.forEach(function(e){n(e),s(e),e.id&&(e.ID=e.id,delete e.id),a.push(e)}),l=v(c,{headers:!0,firstUpperCase:!0}),o.content=l,o.mime="xml",o.successStatuses=[200],e.next=13,this.request(o);case 13:return p=e.sent,e.abrupt("return",{res:p.res});case 15:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/checkBucketName":48,"../utils/checkObjectTag":50,"../utils/deepCopy":54,"../utils/getStrBytesCount":58,"../utils/isArray":59,"../utils/isObject":64,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],21:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.includes");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("../utils/checkBucketName"),a=s.checkBucketName,u=e("../utils/obj2xml"),c=u.obj2xml;r.putBucketVersioning=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o,s,u,l=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=l.length>2&&void 0!==l[2]?l[2]:{},a(t),["Enabled","Suspended"].includes(r)){e.next=4;break}throw new Error("status must be Enabled or Suspended");case 4:return o=this._bucketRequestParams("PUT",t,"versioning",n),s={VersioningConfiguration:{Status:r}},o.mime="xml",o.content=c(s,{headers:!0}),e.next=10,this.request(o);case 10:return u=e.sent,e.abrupt("return",{res:u.res,status:u.status});case 12:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.includes":240,"regenerator-runtime/runtime":337}],22:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("../utils/checkBucketName"),a=s.checkBucketName,u=e("../utils/obj2xml"),c=u.obj2xml,l=e("../utils/isArray"),f=l.isArray;r.putBucketWebsite=function(){function e(e){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t){var r,n,o,s,u,l,p,d=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=d.length>1&&void 0!==d[1]?d[1]:{},n=d.length>2?d[2]:void 0,a(t),o=this._bucketRequestParams("PUT",t,"website",n),s={Suffix:r.index||"index.html"},u={IndexDocument:s},l={WebsiteConfiguration:u},r.supportSubDir&&(s.SupportSubDir=r.supportSubDir),r.type&&(s.Type=r.type),r.error&&(u.ErrorDocument={Key:r.error}),void 0===r.routingRules){e.next=14;break}if(f(r.routingRules)){e.next=13;break}throw new Error("RoutingRules must be Array");case 13:u.RoutingRules={RoutingRule:r.routingRules};case 14:return l=c(l),o.content=l,o.mime="xml",o.successStatuses=[200],e.next=20,this.request(o);case 20:return p=e.sent,e.abrupt("return",{res:p.res});case 22:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/checkBucketName":48,"../utils/isArray":59,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],23:[function(e,t,r){(function(t){"use strict";e("core-js/modules/es.array.for-each"),e("core-js/modules/es.object.keys"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.regexp.to-string"),e("core-js/modules/web.dom-collections.for-each"),r.encodeCallback=function(e,r){if(e.headers=e.headers||{},!Object.prototype.hasOwnProperty.call(e.headers,"x-oss-callback")&&r.callback){var n={callbackUrl:encodeURI(r.callback.url),callbackBody:r.callback.body};r.callback.host&&(n.callbackHost=r.callback.host),r.callback.contentType&&(n.callbackBodyType=r.callback.contentType);var i=t.from(JSON.stringify(n)).toString("base64");if(e.headers["x-oss-callback"]=i,r.callback.customValue){var o={};Object.keys(r.callback.customValue).forEach(function(e){o["x:".concat(e)]=r.callback.customValue[e]}),e.headers["x-oss-callback-var"]=t.from(JSON.stringify(o)).toString("base64")}}}}).call(this,e("buffer").Buffer)},{buffer:98,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257,"core-js/modules/web.dom-collections.for-each":292}],24:[function(e,t,r){"use strict";function n(e){var t={},r=this.options.cname;l.checkConfigValid(this.options.endpoint,"endpoint"),o.default(this.options.endpoint,!1).to(t),!e.bucket||r||c.isIP(t.hostname)||this.options.sldEnable||(t.host="".concat(e.bucket,".").concat(t.host));var n="/";e.bucket&&this.options.sldEnable&&(n+="".concat(e.bucket,"/")),e.object&&(n+=this._escape(e.object).replace(/\+/g,"%2B")),t.pathname=n;var i={};if(e.query&&a.default(i,e.query),e.subres){var f={};u.default.string(e.subres)?f[e.subres]="":u.default.array(e.subres)?e.subres.forEach(function(e){f[e]=""}):f=e.subres,a.default(i,f)}return t.query=i,s.default.format(t)}e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.for-each"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.string.replace"),e("core-js/modules/web.dom-collections.for-each");var i=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.getReqUrl=void 0;var o=i(e("copy-to")),s=i(e("url")),a=i(e("merge-descriptors")),u=i(e("is-type-of")),c=e("../utils/isIP"),l=e("../utils/checkConfigValid");r.getReqUrl=n},{"../utils/checkConfigValid":49,"../utils/isIP":63,"copy-to":101,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"is-type-of":392,"merge-descriptors":311,url:394}],25:[function(e,t,r){"use strict";function n(e,t){f(e,"endpoint");var r=o.parse(e);if(r.protocol||(r=o.parse("http".concat(t?"s":"","://").concat(e))),"http:"!==r.protocol&&"https:"!==r.protocol)throw new Error("Endpoint protocol must be http or https.");return r}e("core-js/modules/es.array.concat"),e("core-js/modules/es.object.assign"),e("core-js/modules/es.string.trim");var i=e("humanize-ms"),o=e("url"),s=e("../utils/checkBucketName"),a=s.checkBucketName,u=e("../utils/setRegion"),c=u.setRegion,l=e("../utils/checkConfigValid"),f=l.checkConfigValid;t.exports=function(e){if(!e||!e.accessKeyId||!e.accessKeySecret)throw new Error("require accessKeyId, accessKeySecret");e.bucket&&a(e.bucket);var t=Object.assign({region:"oss-cn-hangzhou",internal:!1,secure:!1,timeout:6e4,bucket:null,endpoint:null,cname:!1,isRequestPay:!1,sldEnable:!1,headerEncoding:"utf-8",refreshSTSToken:null},e);if(t.accessKeyId=t.accessKeyId.trim(),t.accessKeySecret=t.accessKeySecret.trim(),t.timeout&&(t.timeout=i(t.timeout)),t.endpoint)t.endpoint=n(t.endpoint,t.secure);else{if(!t.region)throw new Error("require options.endpoint or options.region");t.endpoint=c(t.region,t.internal,t.secure)}return t.inited=!0,t}},{"../utils/checkBucketName":48,"../utils/checkConfigValid":49,"../utils/setRegion":68,"core-js/modules/es.array.concat":234,"core-js/modules/es.object.assign":251,"core-js/modules/es.string.trim":265,"humanize-ms":299,url:394}],26:[function(e,t,r){"use strict";e("merge-descriptors")(r,e("./processObjectSave"))},{"./processObjectSave":27,"merge-descriptors":311}],27:[function(e,t,r){"use strict";function n(e,t){if(!e)throw new Error("".concat(t," is required"));if("string"!=typeof e)throw new Error("".concat(t," must be String"))}var i=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.concat");var o=i(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var s=i(e("@babel/runtime/helpers/asyncToGenerator")),a=e("../utils/checkBucketName"),u=a.checkBucketName,c=e("querystring"),l=e("js-base64"),f=l.Base64.encode;r.processObjectSave=function(){function e(e,r,n,i){return t.apply(this,arguments)}var t=(0,s.default)(o.default.mark(function e(t,r,i,s){var a,l,p,d;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n(t,"sourceObject"),n(r,"targetObject"),n(i,"process"),r=this._objectName(r),s&&u(s),a=this._objectRequestParams("POST",t,{subres:"x-oss-process"}),l=s?",b_".concat(f(s)):"",r=f(r),p={"x-oss-process":"".concat(i,"|sys/saveas,o_").concat(r).concat(l)},a.content=c.stringify(p),e.next=12,this.request(a);case 12:return d=e.sent,e.abrupt("return",{res:d.res,status:d.res.status});case 14:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":234,"js-base64":310,querystring:323,"regenerator-runtime/runtime":337}],28:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.filter"),e("core-js/modules/es.array.map"),e("core-js/modules/es.array.sort"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.regexp.to-string");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("copy-to"),a=e("./callback"),u=e("./utils/deepCopy"),c=u.deepCopyWith,l=e("./utils/isBuffer"),f=l.isBuffer,p=r;p.listUploads=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o,a,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=r||{},n={},s(r).to(n),n.subres="uploads",o=this._objectRequestParams("GET","",n),o.query=t,o.xmlResponse=!0,o.successStatuses=[200],e.next=10,this.request(o);case 10:return a=e.sent,u=a.data.Upload||[],Array.isArray(u)||(u=[u]),u=u.map(function(e){return{name:e.Key,uploadId:e.UploadId,initiated:e.Initiated}}),e.abrupt("return",{res:a.res,uploads:u,bucket:a.data.Bucket,nextKeyMarker:a.data.NextKeyMarker,nextUploadIdMarker:a.data.NextUploadIdMarker,isTruncated:"true"===a.data.IsTruncated});case 15:case"end":return e.stop()}},e,this)}));return e}(),p.listParts=function(){function e(e,r,n,i){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r,n,o){var a,u,c;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=o||{},a={},s(o).to(a),a.subres={uploadId:r},u=this._objectRequestParams("GET",t,a),u.query=n,u.xmlResponse=!0,u.successStatuses=[200],e.next=10,this.request(u);case 10:return c=e.sent,e.abrupt("return",{res:c.res,uploadId:c.data.UploadId,bucket:c.data.Bucket,name:c.data.Key,partNumberMarker:c.data.PartNumberMarker,nextPartNumberMarker:c.data.NextPartNumberMarker,maxParts:c.data.MaxParts,isTruncated:c.data.IsTruncated,parts:c.data.Part||[]});case 12:case"end":return e.stop()}},e,this)}));return e}(),p.abortMultipartUpload=function(){function e(e,r,n){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r,n){var o,a,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this._stop(),n=n||{},o={},s(n).to(o),o.subres={uploadId:r},a=this._objectRequestParams("DELETE",t,o),a.successStatuses=[204],e.next=9,this.request(a);case 9:return u=e.sent,e.abrupt("return",{res:u.res});case 11:case"end":return e.stop()}},e,this)}));return e}(),p.initMultipartUpload=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=r||{},n={},s(r).to(n),n.headers=n.headers||{},this._convertMetaToHeaders(r.meta,n.headers),n.subres="uploads",o=this._objectRequestParams("POST",t,n),o.mime=r.mime,o.xmlResponse=!0,o.successStatuses=[200],e.next=12,this.request(o);case 12:return a=e.sent,e.abrupt("return",{res:a.res,bucket:a.data.Bucket,name:a.data.Key,uploadId:a.data.UploadId});case 14:case"end":return e.stop()}},e,this)}));return e}(),p.uploadPart=function(){function e(e,r,n,i,o,s,a){return t.apply(this,arguments)} -var t=(0,o.default)(i.default.mark(function e(t,r,n,o,s,a,u){var c;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c={stream:this._createStream(o,s,a),size:a-s},e.next=3,this._uploadPart(t,r,n,c,u);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e,this)}));return e}(),p.completeMultipartUpload=function(){function e(e,r,n,i){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r,n,o){var s,u,l,p,d,h,m,y;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(s=n.concat().sort(function(e,t){return e.number-t.number}).filter(function(e,t,r){return!t||e.number!==r[t-1].number}),u='\n\n',l=0;l\n",u+="".concat(p.number,"\n"),u+="".concat(p.etag,"\n"),u+="\n";return u+="",o=o||{},d={},d=c(o,function(e){if(f(e))return null}),d.headers&&delete d.headers["x-oss-server-side-encryption"],d.subres={uploadId:r},h=this._objectRequestParams("POST",t,d),a.encodeCallback(h,d),h.mime="xml",h.content=u,h.headers&&h.headers["x-oss-callback"]||(h.xmlResponse=!0),h.successStatuses=[200],e.next=17,this.request(h);case 17:return m=e.sent,y={res:m.res,bucket:h.bucket,name:t,etag:m.res.headers.etag},h.headers&&h.headers["x-oss-callback"]&&(y.data=JSON.parse(m.data.toString())),e.abrupt("return",y);case 21:case"end":return e.stop()}},e,this)}));return e}(),p._uploadPart=function(){function e(e,r,n,i,o){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r,n,o,a){var u,c,l;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=a||{},u={},s(a).to(u),u.headers={"Content-Length":o.size},u.subres={partNumber:n,uploadId:r},c=this._objectRequestParams("PUT",t,u),c.mime=u.mime,c.stream=o.stream,c.successStatuses=[200],e.next=11,this.request(c);case 11:if(l=e.sent,l.res.headers.etag){e.next=14;break}throw new Error("Please set the etag of expose-headers in OSS \n https://help.aliyun.com/document_detail/32069.html");case 14:return o.stream=null,c.stream=null,e.abrupt("return",{name:t,etag:l.res.headers.etag,res:l.res});case 17:case"end":return e.stop()}},e,this)}));return e}()},{"./callback":23,"./utils/deepCopy":54,"./utils/isBuffer":61,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"copy-to":101,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.filter":236,"core-js/modules/es.array.map":245,"core-js/modules/es.array.sort":247,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257,"regenerator-runtime/runtime":337}],29:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.find"),e("core-js/modules/es.array.for-each"),e("core-js/modules/es.array.includes"),e("core-js/modules/es.object.keys"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.string.replace"),e("core-js/modules/web.dom-collections.for-each");var i=n(e("@babel/runtime/regenerator")),o=n(e("@babel/runtime/helpers/typeof"));e("regenerator-runtime/runtime");var s=n(e("@babel/runtime/helpers/asyncToGenerator")),a=e("../utils/checkBucketName"),u=a.checkBucketName,c=r,l=["content-type","content-encoding","content-language","content-disposition","cache-control","expires"];c.copy=function(){function e(e,r,n,i){return t.apply(this,arguments)}var t=(0,s.default)(i.default.mark(function e(t,r,n,s){var a,u,c;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===(0,o.default)(n)&&(s=n),s=s||{},s.headers=s.headers||{},Object.keys(s.headers).forEach(function(e){s.headers["x-oss-copy-source-".concat(e.toLowerCase())]=s.headers[e]}),(s.meta||Object.keys(s.headers).find(function(e){return l.includes(e.toLowerCase())}))&&(s.headers["x-oss-metadata-directive"]="REPLACE"),this._convertMetaToHeaders(s.meta,s.headers),r=this._getSourceName(r,n),s.versionId&&(r="".concat(r,"?versionId=").concat(s.versionId)),s.headers["x-oss-copy-source"]=r,a=this._objectRequestParams("PUT",t,s),a.xmlResponse=!0,a.successStatuses=[200,304],e.next=14,this.request(a);case 14:return u=e.sent,c=u.data,c&&(c={etag:c.ETag,lastModified:c.LastModified}),e.abrupt("return",{data:c,res:u.res});case 18:case"end":return e.stop()}},e,this)}));return e}(),c._getSourceName=function(e,t){return"string"==typeof t?e=this._objectName(e):"/"!==e[0]?t=this.options.bucket:(t=e.replace(/\/(.+?)(\/.*)/,"$1"),e=e.replace(/(\/.+?\/)(.*)/,"$2")),u(t),e=encodeURIComponent(e),e="/".concat(t,"/").concat(e)}},{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.find":237,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],30:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator"));r.delete=function(){function e(e){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t){var r,n,o,s=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},r.subres=Object.assign({},r.subres),r.versionId&&(r.subres.versionId=r.versionId),n=this._objectRequestParams("DELETE",t,r),n.successStatuses=[204],e.next=7,this.request(n);case 7:return o=e.sent,e.abrupt("return",{res:o.res});case 9:case"end":return e.stop()}},e,this)}));return e}()},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],31:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("utility"),a=e("../utils/obj2xml"),u=a.obj2xml;r.deleteMulti=function(){function e(e){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t){var r,n,o,a,c,l,f,p,d,h,m,y,b,g=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=g.length>1&&void 0!==g[1]?g[1]:{},n=[],t&&t.length){e.next=4;break}throw new Error("names is required");case 4:for(o=0;o1&&void 0!==s[1]?s[1]:{},r.subres=Object.assign({tagging:""},r.subres),r.versionId&&(r.subres.versionId=r.versionId),t=this._objectName(t),n=this._objectRequestParams("DELETE",t,r),n.successStatuses=[204],e.next=8,this.request(n);case 8:return o=e.sent,e.abrupt("return",{status:o.status,res:o.res});case 10:case"end":return e.stop()}},e,this)}));return e}()},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],33:[function(e,t,r){"use strict";e("core-js/modules/es.array.concat");var n=e("url"),i=e("../utils/isIP"),o=i.isIP;r.generateObjectUrl=function(e,t){if(o(this.options.endpoint.hostname))throw new Error("can not get the object URL when endpoint is IP");if(t)"/"!==t[t.length-1]&&(t+="/");else{t=this.options.endpoint.format();var r=n.parse(t),i=this.options.bucket;r.hostname="".concat(i,".").concat(r.hostname),r.host="".concat(i,".").concat(r.host),t=r.format()}return t+this._escape(this._objectName(e))}},{"../utils/isIP":63,"core-js/modules/es.array.concat":234,url:394}],34:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("fs"),a=e("is-type-of");r.get=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o,u,c,l,f=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=f.length>2&&void 0!==f[2]?f[2]:{},o=null,u=!1,a.writableStream(r)?o=r:a.string(r)?(o=s.createWriteStream(r),u=!0):n=r,n=n||{},n.subres=Object.assign({"response-cache-control":"no-cache"},n.subres),n.versionId&&(n.subres.versionId=n.versionId),n.process&&(n.subres["x-oss-process"]=n.process),e.prev=8,l=this._objectRequestParams("GET",t,n),l.writeStream=o,l.successStatuses=[200,206,304],e.next=14,this.request(l);case 14:c=e.sent,u&&o.destroy(),e.next=25;break;case 18:if(e.prev=18,e.t0=e.catch(8),!u){e.next=24;break}return o.destroy(),e.next=24,this._deleteFileSafe(r);case 24:throw e.t0;case 25:return e.abrupt("return",{res:c.res,content:c.data});case 26:case"end":return e.stop()}},e,this,[[8,18]])}));return e}()},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,fs:78,"is-type-of":392,"regenerator-runtime/runtime":337}],35:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator"));r.getACL=function(){function e(e){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t){var r,n,o,s=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},r.subres=Object.assign({acl:""},r.subres),r.versionId&&(r.subres.versionId=r.versionId),t=this._objectName(t),n=this._objectRequestParams("GET",t,r),n.successStatuses=[200],n.xmlResponse=!0,e.next=9,this.request(n);case 9:return o=e.sent,e.abrupt("return",{acl:o.data.AccessControlList.Grant,owner:{id:o.data.Owner.ID,displayName:o.data.Owner.DisplayName},res:o.res});case 11:case"end":return e.stop()}},e,this)}));return e}()},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],36:[function(e,t,r){"use strict";function n(){return i.apply(this,arguments)}function i(){return i=(0,c.default)(u.default.mark(function e(){var t,r,n,i,o,a,c,l,f=arguments;return u.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=f.length>0&&void 0!==f[0]?f[0]:{},r=f.length>1&&void 0!==f[1]?f[1]:{},!t.versionIdMarker||void 0!==t.keyMarker){e.next=4;break}throw new Error("A version-id marker cannot be specified without a key marker");case 4:return r.subres=Object.assign({versions:""},r.subres),r.versionId&&(r.subres.versionId=r.versionId),n=this._objectRequestParams("GET","",r),n.xmlResponse=!0,n.successStatuses=[200],n.query=s(t),e.next=12,this.request(n);case 12:return i=e.sent,o=i.data.Version||[],a=i.data.DeleteMarker||[],c=this,o&&(Array.isArray(o)||(o=[o]),o=o.map(function(e){return{name:e.Key,url:c._objectUrl(e.Key),lastModified:e.LastModified,isLatest:"true"===e.IsLatest,versionId:e.VersionId,etag:e.ETag,type:e.Type,size:Number(e.Size),storageClass:e.StorageClass,owner:{id:e.Owner.ID,displayName:e.Owner.DisplayName}}})),a&&(h(a)||(a=[a]),a=a.map(function(e){return{name:e.Key,lastModified:e.LastModified,versionId:e.VersionId,owner:{id:e.Owner.ID,displayName:e.Owner.DisplayName}}})),l=i.data.CommonPrefixes||null,l&&(h(l)||(l=[l]),l=l.map(function(e){return e.Prefix})),e.abrupt("return",{res:i.res,objects:o,deleteMarker:a,prefixes:l,nextMarker:i.data.NextKeyMarker||null,NextVersionIdMarker:i.data.NextVersionIdMarker||null,nextKeyMarker:i.data.NextKeyMarker||null,nextVersionIdMarker:i.data.NextVersionIdMarker||null,isTruncated:"true"===i.data.IsTruncated});case 21:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}function o(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};return p(e)&&Object.keys(e).forEach(function(r){t[o(r)]=e[r]}),t}var a=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.for-each"),e("core-js/modules/es.array.map"),e("core-js/modules/es.number.constructor"),e("core-js/modules/es.object.assign"),e("core-js/modules/es.object.keys"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.string.replace"),e("core-js/modules/web.dom-collections.for-each");var u=a(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var c=a(e("@babel/runtime/helpers/asyncToGenerator")),l=r,f=e("../utils/isObject"),p=f.isObject,d=e("../utils/isArray"),h=d.isArray;l.getBucketVersions=n,l.listObjectVersions=n},{"../utils/isArray":59,"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.map":245,"core-js/modules/es.number.constructor":250,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],37:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator"));r.getObjectMeta=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=r||{},t=this._objectName(t),r.subres=Object.assign({objectMeta:""},r.subres),r.versionId&&(r.subres.versionId=r.versionId),n=this._objectRequestParams("HEAD",t,r),n.successStatuses=[200],e.next=8,this.request(n);case 8:return o=e.sent,e.abrupt("return",{status:o.status,res:o.res});case 10:case"end":return e.stop()}},e,this)}));return e}()},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],38:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.for-each"),e("core-js/modules/es.object.assign"),e("core-js/modules/web.dom-collections.for-each");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=r,a=e("../utils/isObject"),u=a.isObject;s.getObjectTagging=function(){function e(e){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t){var r,n,o,s,a,c,l=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=l.length>1&&void 0!==l[1]?l[1]:{},r.subres=Object.assign({tagging:""},r.subres),r.versionId&&(r.subres.versionId=r.versionId),t=this._objectName(t),n=this._objectRequestParams("GET",t,r),n.successStatuses=[200],e.next=8,this.request(n);case 8:return o=e.sent,e.next=11,this.parseXML(o.data);case 11:return s=e.sent,a=s.TagSet.Tag,a=a&&u(a)?[a]:a||[],c={},a.forEach(function(e){c[e.Key]=e.Value}),e.abrupt("return",{status:o.status,res:o.res,tag:c});case 17:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.assign":251,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],39:[function(e,t,r){"use strict";var n=e("../utils/isIP"),i=n.isIP;r.getObjectUrl=function(e,t){if(i(this.options.endpoint.hostname))throw new Error("can not get the object URL when endpoint is IP");return t?"/"!==t[t.length-1]&&(t+="/"):t=this.options.endpoint.format(),t+this._escape(this._objectName(e))}},{"../utils/isIP":63}],40:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator"));r.getSymlink=function(){function e(e){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t){var r,n,o,s,a=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},r.subres=Object.assign({symlink:""},r.subres),r.versionId&&(r.subres.versionId=r.versionId),t=this._objectName(t),n=this._objectRequestParams("GET",t,r),n.successStatuses=[200],e.next=8,this.request(n);case 8:return o=e.sent,s=o.res.headers["x-oss-symlink-target"],e.abrupt("return",{targetName:decodeURIComponent(s),res:o.res});case 11:case"end":return e.stop()}},e,this)}));return e}()},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],41:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.for-each"),e("core-js/modules/es.array.index-of"),e("core-js/modules/es.object.assign"),e("core-js/modules/es.object.keys"),e("core-js/modules/web.dom-collections.for-each");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator"));r.head=function(){function e(e){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t){var r,n,o,s,a=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},r.subres=Object.assign({},r.subres),r.versionId&&(r.subres.versionId=r.versionId),n=this._objectRequestParams("HEAD",t,r),n.successStatuses=[200,304],e.next=7,this.request(n);case 7:return o=e.sent,s={meta:null,res:o.res,status:o.status},200===o.status&&Object.keys(o.headers).forEach(function(e){0===e.indexOf("x-oss-meta-")&&(s.meta||(s.meta={}),s.meta[e.substring(11)]=o.headers[e])}),e.abrupt("return",s);case 11:case"end":return e.stop()}},e,this)}));return e}()},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.index-of":241,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],42:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator"));r.putACL=function(){function e(e,r,n){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r,n){var o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=n||{},n.subres=Object.assign({acl:""},n.subres),n.versionId&&(n.subres.versionId=n.versionId),n.headers=n.headers||{},n.headers["x-oss-object-acl"]=r,t=this._objectName(t),o=this._objectRequestParams("PUT",t,n),o.successStatuses=[200],e.next=10,this.request(o);case 10:return s=e.sent,e.abrupt("return",{res:s.res});case 12:case"end":return e.stop()}},e,this)}));return e}()},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],43:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.map"),e("core-js/modules/es.object.assign"),e("core-js/modules/es.object.keys");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("../utils/obj2xml"),a=s.obj2xml,u=e("../utils/checkObjectTag"),c=u.checkObjectTag;r.putObjectTagging=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r){var n,o,s,u,l=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=l.length>2&&void 0!==l[2]?l[2]:{},c(r),n.subres=Object.assign({tagging:""},n.subres),n.versionId&&(n.subres.versionId=n.versionId),t=this._objectName(t),o=this._objectRequestParams("PUT",t,n),o.successStatuses=[200],r=Object.keys(r).map(function(e){return{Key:e,Value:r[e]}}),s={Tagging:{TagSet:{Tag:r}}},o.mime="xml",o.content=a(s),e.next=13,this.request(o);case 13:return u=e.sent,e.abrupt("return",{res:u.res,status:u.status});case 15:case"end":return e.stop()}},e,this)}));return e}()},{"../utils/checkObjectTag":50,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.map":245,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"regenerator-runtime/runtime":337}],44:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.object.assign");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator"));r.putSymlink=function(){function e(e,r,n){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r,n){var o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=n||{},n.headers=n.headers||{},r=this._escape(this._objectName(r)),this._convertMetaToHeaders(n.meta,n.headers),n.headers["x-oss-symlink-target"]=r,n.subres=Object.assign({symlink:""},n.subres),n.versionId&&(n.subres.versionId=n.versionId),n.storageClass&&(n.headers["x-oss-storage-class"]=n.storageClass),t=this._objectName(t),o=this._objectRequestParams("PUT",t,n),o.successStatuses=[200],e.next=13,this.request(o);case 13:return s=e.sent,e.abrupt("return",{res:s.res});case 15:case"end":return e.stop()}},e,this)}));return e}()},{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],45:[function(e,t,r){"use strict";var n=e("url"),i=e("utility"),o=e("copy-to"),s=e("../../common/signUtils"),a=e("../utils/isIP"),u=a.isIP;r.signatureUrl=function(e,t){if(u(this.options.endpoint.hostname))throw new Error("can not get the object URL when endpoint is IP");t=t||{},e=this._objectName(e),t.method=t.method||"GET";var r=i.timestamp()+(t.expires||1800),a={bucket:this.options.bucket,object:e},c=this._getResource(a);this.options.stsToken&&(t["security-token"]=this.options.stsToken);var l=s._signatureForURL(this.options.accessKeySecret,t,c,r),f=n.parse(this._getReqUrl(a));return f.query={OSSAccessKeyId:this.options.accessKeyId,Expires:r,Signature:l.Signature},o(l.subResource).to(f.query),f.format()}},{"../../common/signUtils":47,"../utils/isIP":63,"copy-to":101,url:394,utility:396}],46:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.for-each"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.function.name"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.promise"),e("core-js/modules/es.string.iterator"),e("core-js/modules/web.dom-collections.for-each"),e("core-js/modules/web.dom-collections.iterator");var i=n(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=e("./utils/isArray"),a=s.isArray,u=r;u._parallelNode=function(){function e(e,r,n,i){return t.apply(this,arguments)}var t=(0,o.default)(i.default.mark(function e(t,r,n,o){var s,a,u,c,l,f,p,d;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:s=this,a=[],u=[],c=t.length/r,l=t.length%r,f=0===l?c:(t.length-l)/r+1,p=1,d=0;case 8:if(!(d0)return f=!0,void(p<=0&&i(c));p+=1,a(e.value,o(s))}d=!1}var c=[];if(t<=0||!e)return void i(c);var l=function(e){var t=-1,r=e.length;return function(){return++tt[0]?1:e[0]2&&void 0!==arguments[2]?arguments[2]:"utf-8";return n.createHmac("sha1",e).update(t.from(r,i)).digest("base64")},r.authorization=function(e,t,r,n){return"OSS ".concat(e,":").concat(this.computeSignature(t,r,n))},r._signatureForURL=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,s={},a=r.subResource,u=void 0===a?{}:a;if(r.process){u["x-oss-process"]=r.process}if(r.trafficLimit){u["x-oss-traffic-limit"]=r.trafficLimit}if(r.response&&Object.keys(r.response).forEach(function(e){var t="response-".concat(e.toLowerCase());u[t]=r.response[e]}),Object.keys(r).forEach(function(e){var t=e.toLowerCase(),n=r[e];0===t.indexOf("x-oss-")?s[t]=n:0===t.indexOf("content-md5")?s[e]=n:0===t.indexOf("content-type")&&(s[e]=n)}),Object.prototype.hasOwnProperty.call(r,"security-token")&&(u["security-token"]=r["security-token"]),Object.prototype.hasOwnProperty.call(r,"callback")){var c={callbackUrl:encodeURI(r.callback.url),callbackBody:r.callback.body};if(r.callback.host&&(c.callbackHost=r.callback.host),r.callback.contentType&&(c.callbackBodyType=r.callback.contentType),u.callback=t.from(JSON.stringify(c)).toString("base64"),r.callback.customValue){var l={};Object.keys(r.callback.customValue).forEach(function(e){l["x:".concat(e)]=r.callback.customValue[e]}),u["callback-var"]=t.from(JSON.stringify(l)).toString("base64")}}var f=this.buildCanonicalString(r.method,n,{headers:s,parameters:u},i.toString());return{Signature:this.computeSignature(e,f,o),subResource:u}}}).call(this,e("buffer").Buffer)},{"./../../shims/crypto/crypto.js":387,"./utils/lowercaseKeyHeader":65,buffer:98,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.index-of":241,"core-js/modules/es.array.join":243,"core-js/modules/es.array.sort":247,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.trim":265,"core-js/modules/web.dom-collections.for-each":292,"is-type-of":392}],48:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.checkBucketName=void 0,r.checkBucketName=function(e){ -if(!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]?/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/:/^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/).test(e))throw new Error("The bucket must be conform to the specifications")}},{}],49:[function(e,t,r){"use strict";function n(e){return"string"==typeof e?/^[a-zA-Z0-9._:\/-]+$/.test(e):!!e.host&&/^[a-zA-Z0-9._:\/-]+$/.test(e.host)}Object.defineProperty(r,"__esModule",{value:!0}),r.checkConfigValid=void 0;var i={endpoint:n,region:/^[a-zA-Z0-9\-_]+$/};r.checkConfigValid=function(e,t){if(i[t]){if(!(i[t]instanceof Function?i[t](e):i[t].test(e)))throw new Error("The ".concat(t," must be conform to the specifications"))}}},{}],50:[function(e,t,r){"use strict";function n(e){if(!a(e))throw new Error("tag must be Object");var t=Object.entries(e);if(t.length>10)throw new Error("maximum of 10 tags for a object");var r=["key","value"];t.forEach(function(e){e.forEach(function(e,t){o(e,c[r[t]])})})}e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.for-each"),e("core-js/modules/es.object.entries"),e("core-js/modules/web.dom-collections.for-each"),Object.defineProperty(r,"__esModule",{value:!0}),r.checkObjectTag=void 0;var i=e("./checkValid"),o=i.checkValid,s=e("./isObject"),a=s.isObject,u=[{validator:function(e){if("string"!=typeof e)throw new Error("the key and value of the tag must be String")}},{pattern:/^[a-zA-Z0-9 +-=._:\/]+$/,msg:"tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)"}],c={key:[].concat(u,[{pattern:/^.{1,128}$/,msg:"tag key can be a maximum of 128 bytes in length"}]),value:[].concat(u,[{pattern:/^.{0,256}$/,msg:"tag value can be a maximum of 256 bytes in length"}])};r.checkObjectTag=n},{"./checkValid":51,"./isObject":64,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.entries":252,"core-js/modules/web.dom-collections.for-each":292}],51:[function(e,t,r){"use strict";function n(e,t){t.forEach(function(t){if(t.validator)t.validator(e);else if(t.pattern&&!t.pattern.test(e))throw new Error(t.msg)})}e("core-js/modules/es.array.for-each"),e("core-js/modules/web.dom-collections.for-each"),Object.defineProperty(r,"__esModule",{value:!0}),r.checkValid=void 0,r.checkValid=n},{"core-js/modules/es.array.for-each":238,"core-js/modules/web.dom-collections.for-each":292}],52:[function(e,t,r){(function(t){"use strict";function n(e,t){return e[t]||e[t.toLowerCase()]}function i(e,t){delete e[t],delete e[t.toLowerCase()]}function o(e){var r=new Date;this.options.amendTimeSkewed&&(r=+new Date+this.options.amendTimeSkewed);var o={"x-oss-date":c(r,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),"x-oss-user-agent":this.userAgent};this.userAgent.includes("nodejs")&&(o["User-Agent"]=this.userAgent),this.options.isRequestPay&&Object.assign(o,{"x-oss-request-payer":"requester"}),this.options.stsToken&&(o["x-oss-security-token"]=this.options.stsToken),l(e.headers).to(o),n(o,"Content-Type")||(e.mime&&e.mime.indexOf("/")>0?o["Content-Type"]=e.mime:o["Content-Type"]=u.getType(e.mime||f.extname(e.object||""))),n(o,"Content-Type")||i(o,"Content-Type"),e.content&&(o["Content-MD5"]=s.createHash("md5").update(t.from(e.content,"utf8")).digest("base64"),o["Content-Length"]||(o["Content-Length"]=e.content.length));var p=Object.prototype.hasOwnProperty;for(var h in o)o[h]&&p.call(o,h)&&(o[h]=d(String(o[h]),this.options.headerEncoding));var y=this._getResource(e);if(o.authorization=this.authorization(e.method,y,e.subres,o,this.options.headerEncoding),m(this.options.endpoint.hostname)){var g=this.options,w=g.region,x=g.internal,j=g.secure,_=b(w,x,j);o.host="".concat(e.bucket,".").concat(_.host)}var E=v.bind(this)(e);a("request %s %s, with headers %j, !!stream: %s",e.method,E,o,!!e.stream);var T=e.timeout||this.options.timeout,S={method:e.method,content:e.content,stream:e.stream,headers:o,timeout:T,writeStream:e.writeStream,customResponse:e.customResponse,ctx:e.ctx||this.ctx};return this.agent&&(S.agent=this.agent),this.httpsAgent&&(S.httpsAgent=this.httpsAgent),S.enableProxy=!!this.options.enableProxy,S.proxy=this.options.proxy?this.options.proxy:null,{url:E,params:S}}e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.includes"),e("core-js/modules/es.array.index-of"),e("core-js/modules/es.object.assign"),e("core-js/modules/es.string.includes"),Object.defineProperty(r,"__esModule",{value:!0}),r.createRequest=void 0;var s=e("./../../../shims/crypto/crypto.js"),a=e("debug")("ali-oss"),u=e("mime"),c=e("dateformat"),l=e("copy-to"),f=e("path"),p=e("./encoder"),d=p.encoder,h=e("./isIP"),m=h.isIP,y=e("./setRegion"),b=y.setRegion,g=e("../client/getReqUrl"),v=g.getReqUrl;r.createRequest=o}).call(this,e("buffer").Buffer)},{"../client/getReqUrl":24,"./../../../shims/crypto/crypto.js":387,"./encoder":55,"./isIP":63,"./setRegion":68,buffer:98,"copy-to":101,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.includes":240,"core-js/modules/es.array.index-of":241,"core-js/modules/es.object.assign":251,"core-js/modules/es.string.includes":258,dateformat:295,debug:391,mime:313,path:316}],53:[function(e,t,r){"use strict";function n(e,t,r){if(s.isObject(e)){var a=t.remove,u=void 0===a?[]:a,c=t.rename,l=void 0===c?{}:c,f=t.camel,p=void 0===f?[]:f,d=t.bool,h=void 0===d?[]:d,m=t.lowerFirst,y=void 0!==m&&m;return u.forEach(function(t){return delete e[t]}),Object.entries(l).forEach(function(t){e[t[0]]&&(e[t[1]]||(e[t[1]]=e[t[0]],delete e[t[0]]))}),p.forEach(function(t){if(e[t]){var r=t.replace(/^(.)/,function(e){return e.toLowerCase()}).replace(/-(\w)/g,function(e,t){return t.toUpperCase()});e[r]||(e[r]=e[t])}}),h.forEach(function(t){e[t]=i(e[t])}),"function"==typeof r&&r(e),o(e,y),n}}function i(e){return!!e&&(!!a.includes(e)||!u.includes(e)&&e)}function o(e,t){t&&Object.keys(e).forEach(function(t){var r=t.replace(/^\w/,function(e){return e.toLowerCase()});void 0===e[r]&&(e[r]=e[t],delete e[t])})}e("core-js/modules/es.array.for-each"),e("core-js/modules/es.array.includes"),e("core-js/modules/es.object.entries"),e("core-js/modules/es.object.keys"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.string.replace"),e("core-js/modules/web.dom-collections.for-each"),Object.defineProperty(r,"__esModule",{value:!0}),r.dataFix=void 0;var s=e("./isObject"),a=["true","TRUE","1",1],u=["false","FALSE","0",0];r.dataFix=n},{"./isObject":64,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/es.object.entries":252,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292}],54:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.for-each"),e("core-js/modules/es.array.slice"),e("core-js/modules/es.object.keys"),e("core-js/modules/web.dom-collections.for-each");var i=n(e("@babel/runtime/helpers/typeof"));Object.defineProperty(r,"__esModule",{value:!0}),r.deepCopyWith=r.deepCopy=void 0;var o=e("./isBuffer");r.deepCopy=function(e){if(null===e||"object"!==(0,i.default)(e))return e;if(o.isBuffer(e))return e.slice();var t=Array.isArray(e)?[]:{};return Object.keys(e).forEach(function(n){t[n]=r.deepCopy(e[n])}),t},r.deepCopyWith=function(e,t){function n(r,s,a){var u=t(r,s,a);if(void 0!==u)return u;if(null===r||"object"!==(0,i.default)(r))return r;if(o.isBuffer(r))return e.slice();var c=Array.isArray(r)?[]:{};return Object.keys(r).forEach(function(e){c[e]=n(r[e],e,r)}),c}return t?n(e,"",null):r.deepCopy(e)}},{"./isBuffer":61,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.slice":246,"core-js/modules/es.object.keys":253,"core-js/modules/web.dom-collections.for-each":292}],55:[function(e,t,r){(function(t){"use strict";function n(e){return"utf-8"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8")?e:t.from(e).toString("latin1")}e("core-js/modules/es.object.to-string"),e("core-js/modules/es.regexp.to-string"),Object.defineProperty(r,"__esModule",{value:!0}),r.encoder=void 0,r.encoder=n}).call(this,e("buffer").Buffer)},{buffer:98,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257}],56:[function(e,t,r){"use strict";function n(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&s.isObject(e)&&(e=[e]),e=a.isArray(e)?e.map(i):i(e)}function i(e){return o.dataFix(e,{bool:["IsEnabled"]},function(e){var t,r;e.prefix=e.Filter.Prefix,delete e.Filter,e.OSSBucketDestination=e.Destination.OSSBucketDestination,e.OSSBucketDestination.rolename=e.OSSBucketDestination.RoleArn.replace(/.*\//,""),delete e.OSSBucketDestination.RoleArn,e.OSSBucketDestination.bucket=e.OSSBucketDestination.Bucket.replace(/.*:::/,""),delete e.OSSBucketDestination.Bucket,delete e.Destination,e.frequency=e.Schedule.Frequency,delete e.Schedule.Frequency,(null===(t=null===e||void 0===e?void 0:e.OptionalFields)||void 0===t?void 0:t.Field)&&!a.isArray(null===(r=e.OptionalFields)||void 0===r?void 0:r.Field)&&(e.OptionalFields.Field=[e.OptionalFields.Field])}),e=u.formatObjKey(e,"firstLowerCase",{exclude:["OSSBucketDestination","SSE-OSS","SSE-KMS"]})}e("core-js/modules/es.array.map"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.string.replace"),Object.defineProperty(r,"__esModule",{value:!0}),r.formatInventoryConfig=void 0;var o=e("../utils/dataFix"),s=e("../utils/isObject"),a=e("../utils/isArray"),u=e("../utils/formatObjKey");r.formatInventoryConfig=n},{"../utils/dataFix":53,"../utils/formatObjKey":57,"../utils/isArray":59,"../utils/isObject":64,"core-js/modules/es.array.map":245,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261}],57:[function(e,t,r){"use strict";function n(e,t,r){if(null===e||"object"!==(0,s.default)(e))return e;var o;if(Array.isArray(e)){o=[];for(var a=0;a").concat(e[t],""):"object"===n(e[t])?r+="<".concat(t,">").concat(i(e[t]),""):"array"===n(e[t])?r+=e[t].map(function(e){return"<".concat(t,">").concat(i(e),"")}).join(""):r+="<".concat(t,">").concat(e[t].toString(),""))}):r+=e.toString(),r}e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.for-each"),e("core-js/modules/es.array.join"),e("core-js/modules/es.array.map"),e("core-js/modules/es.object.keys"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.regexp.to-string"),e("core-js/modules/es.string.replace"),e("core-js/modules/web.dom-collections.for-each"),Object.defineProperty(r,"__esModule",{value:!0}),r.obj2xml=void 0;var o=e("./formatObjKey");r.obj2xml=i},{"./formatObjKey":57,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.join":243,"core-js/modules/es.array.map":245,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292}],67:[function(e,t,r){"use strict";function n(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=0,i=r.retryDelay,o=void 0===i?500:i,s=r.errorHandler,a=void 0===s?function(){return!0}:s;return function r(){for(var i=arguments.length,s=new Array(i),u=0;u1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];s.checkConfigValid(e,"region");var n=r?"https://":"http://",i=t?"-internal.aliyuncs.com":".aliyuncs.com";return"vpc100-oss-cn-"===e.substr(0,"vpc100-oss-cn-".length)&&(i=".aliyuncs.com"),o.default.parse(n+e+i)}var i=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.setRegion=void 0;var o=i(e("url")),s=e("./checkConfigValid");r.setRegion=n},{"./checkConfigValid":49,url:394}],69:[function(e,t,r){"use strict";function n(){return i.apply(this,arguments)}function i(){return i=(0,u.default)(a.default.mark(function e(){var t;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.options||(this.options={}),e.next=3,this.options.refreshSTSToken();case 3:t=e.sent,t=c.formatObjKey(t,"firstLowerCase"),t.securityToken&&(t.stsToken=t.securityToken),o(t),Object.assign(this.options,t);case 8:case"end":return e.stop()}},e,this)})),i.apply(this,arguments)}function o(e){var t=["accessKeySecret","accessKeyId","stsToken"],r=Object.keys(e);t.forEach(function(e){if(!r.find(function(t){return t===e}))throw Error("refreshSTSToken must return contains ".concat(e))})}var s=e("@babel/runtime/helpers/interopRequireDefault");e("core-js/modules/es.array.find"),e("core-js/modules/es.array.for-each"),e("core-js/modules/es.object.assign"),e("core-js/modules/es.object.keys");var a=s(e("@babel/runtime/regenerator"));e("regenerator-runtime/runtime");var u=s(e("@babel/runtime/helpers/asyncToGenerator"));Object.defineProperty(r,"__esModule",{value:!0}),r.setSTSToken=void 0;var c=e("./formatObjKey");r.setSTSToken=n},{"./formatObjKey":57,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.find":237,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"regenerator-runtime/runtime":337}],70:[function(e,t,r){function n(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(i,o){function s(e){n(u,i,o,s,a,"next",e)}function a(e){n(u,i,o,s,a,"throw",e)}var u=e.apply(t,r);s(void 0)})}}t.exports=i},{}],71:[function(e,t,r){function n(e){return e&&e.__esModule?e:{default:e}}t.exports=n},{}],72:[function(e,t,r){function n(e){"@babel/helpers - typeof";return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(e){return typeof e}:t.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}t.exports=n},{}],73:[function(e,t,r){var n=function(e){"use strict";function t(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}function r(e,t,r,n){var o=t&&t.prototype instanceof i?t:i,s=Object.create(o.prototype),a=new d(n||[]);return s._invoke=c(e,r,a),s}function n(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function i(){}function o(){}function s(){}function a(e){["next","throw","return"].forEach(function(r){t(e,r,function(e){return this._invoke(r,e)})})}function u(e,t){function r(i,o,s,a){var u=n(e[i],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&g.call(l,"__await")?t.resolve(l.__await).then(function(e){r("next",e,s,a)},function(e){r("throw",e,s,a)}):t.resolve(l).then(function(e){c.value=e,s(c)},function(e){return r("throw",e,s,a)})}a(u.arg)}function i(e,n){function i(){return new t(function(t,i){r(e,n,t,i)})}return o=o?o.then(i,i):i()}var o;this._invoke=i}function c(e,t,r){var i=_;return function(o,s){if(i===T)throw new Error("Generator is already running");if(i===S){if("throw"===o)throw s;return m()}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=l(a,r);if(u){if(u===O)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===_)throw i=S,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=T;var c=n(e,t,r);if("normal"===c.type){if(i=r.done?S:E,c.arg===O)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=S,r.method="throw",r.arg=c.arg)}}}function l(e,t){var r=e.iterator[t.method];if(r===y){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=y,l(e,t),"throw"===t.method))return O;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return O}var i=n(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,O;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=y),t.delegate=null,O):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,O)}function f(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function p(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function d(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(f,this),this.reset(!0)}function h(e){if(e){var t=e[w];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var s=g.call(i,"catchLoc"),a=g.call(i,"finallyLoc");if(s&&a){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&g.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),p(r),O}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;p(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:h(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=y),O}},e}("object"==typeof t?t.exports:{});try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},{}],74:[function(e,t,r){t.exports=e("regenerator-runtime")},{"regenerator-runtime":73}],75:[function(e,t,r){function n(){}t.exports=n,t.exports.HttpsAgent=n},{}],76:[function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function i(e){var t=n(e),r=t[0],i=t[1];return 3*(r+i)/4-i}function o(e,t,r){return 3*(t+r)/4-r}function s(e){var t,r,i=n(e),s=i[0],a=i[1],u=new p(o(e,s,a)),c=0,l=a>0?s-4:s;for(r=0;r>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===a&&(t=f[e.charCodeAt(r)]<<2|f[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===a&&(t=f[e.charCodeAt(r)]<<10|f[e.charCodeAt(r+1)]<<4|f[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u}function a(e){return l[e>>18&63]+l[e>>12&63]+l[e>>6&63]+l[63&e]}function u(e,t,r){for(var n,i=[],o=t;os?s:o+16383));return 1===n?(t=e[r-1],i.push(l[t>>2]+l[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(l[t>>10]+l[t>>4&63]+l[t<<2&63]+"=")),i.join("")}r.byteLength=i,r.toByteArray=s,r.fromByteArray=c;for(var l=[],f=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,m=d.length;h1&&r[1]||""}function r(t){var r=e.match(t);return r&&r.length>1&&r[2]||""}var i,o=t(/(ipod|iphone|ipad)/i).toLowerCase(),a=/like android/i.test(e),u=!a&&/android/i.test(e),c=/nexus\s*[0-6]\s*/i.test(e),l=!c&&/nexus\s*[0-9]+/i.test(e),f=/CrOS/.test(e),p=/silk/i.test(e),d=/sailfish/i.test(e),h=/tizen/i.test(e),m=/(web|hpw)(o|0)s/i.test(e),y=/windows phone/i.test(e),b=(/SamsungBrowser/i.test(e),!y&&/windows/i.test(e)),g=!o&&!p&&/macintosh/i.test(e),v=!u&&!d&&!h&&!m&&/linux/i.test(e),w=r(/edg([ea]|ios)\/(\d+(\.\d+)?)/i),x=t(/version\/(\d+(\.\d+)?)/i),j=/tablet/i.test(e)&&!/tablet pc/i.test(e),_=!j&&/[^-]mobi/i.test(e),E=/xbox/i.test(e);/opera/i.test(e)?i={name:"Opera",opera:s,version:x||t(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(e)?i={name:"Opera",opera:s,version:t(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||x}:/SamsungBrowser/i.test(e)?i={name:"Samsung Internet for Android",samsungBrowser:s,version:x||t(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/Whale/i.test(e)?i={name:"NAVER Whale browser",whale:s,version:t(/(?:whale)[\s\/](\d+(?:\.\d+)+)/i)}:/MZBrowser/i.test(e)?i={name:"MZ Browser",mzbrowser:s,version:t(/(?:MZBrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/coast/i.test(e)?i={name:"Opera Coast",coast:s,version:x||t(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/focus/i.test(e)?i={name:"Focus",focus:s,version:t(/(?:focus)[\s\/](\d+(?:\.\d+)+)/i)}:/yabrowser/i.test(e)?i={name:"Yandex Browser",yandexbrowser:s,version:x||t(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(e)?i={name:"UC Browser",ucbrowser:s,version:t(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(e)?i={name:"Maxthon",maxthon:s,version:t(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(e)?i={name:"Epiphany",epiphany:s,version:t(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(e)?i={name:"Puffin",puffin:s,version:t(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(e)?i={name:"Sleipnir",sleipnir:s,version:t(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(e)?i={name:"K-Meleon",kMeleon:s,version:t(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:y?(i={name:"Windows Phone",osname:"Windows Phone",windowsphone:s},w?(i.msedge=s,i.version=w):(i.msie=s,i.version=t(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(e)?i={name:"Internet Explorer",msie:s,version:t(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:f?i={name:"Chrome",osname:"Chrome OS",chromeos:s,chromeBook:s,chrome:s,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/edg([ea]|ios)/i.test(e)?i={name:"Microsoft Edge",msedge:s,version:w}:/vivaldi/i.test(e)?i={name:"Vivaldi",vivaldi:s,version:t(/vivaldi\/(\d+(\.\d+)?)/i)||x}:d?i={name:"Sailfish",osname:"Sailfish OS",sailfish:s,version:t(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(e)?i={name:"SeaMonkey",seamonkey:s,version:t(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(e)?(i={name:"Firefox",firefox:s,version:t(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(e)&&(i.firefoxos=s,i.osname="Firefox OS")):p?i={name:"Amazon Silk",silk:s,version:t(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(e)?i={name:"PhantomJS",phantom:s,version:t(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(e)?i={name:"SlimerJS",slimer:s,version:t(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(e)||/rim\stablet/i.test(e)?i={name:"BlackBerry",osname:"BlackBerry OS",blackberry:s,version:x||t(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:m?(i={name:"WebOS",osname:"WebOS",webos:s,version:x||t(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(e)&&(i.touchpad=s)):/bada/i.test(e)?i={name:"Bada",osname:"Bada",bada:s,version:t(/dolfin\/(\d+(\.\d+)?)/i)}:h?i={name:"Tizen",osname:"Tizen",tizen:s,version:t(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||x}:/qupzilla/i.test(e)?i={name:"QupZilla",qupzilla:s,version:t(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||x}:/chromium/i.test(e)?i={name:"Chromium",chromium:s,version:t(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||x -}:/chrome|crios|crmo/i.test(e)?i={name:"Chrome",chrome:s,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:u?i={name:"Android",version:x}:/safari|applewebkit/i.test(e)?(i={name:"Safari",safari:s},x&&(i.version=x)):o?(i={name:"iphone"==o?"iPhone":"ipad"==o?"iPad":"iPod"},x&&(i.version=x)):i=/googlebot/i.test(e)?{name:"Googlebot",googlebot:s,version:t(/googlebot\/(\d+(\.\d+))/i)||x}:{name:t(/^(.*)\/(.*) /),version:r(/^(.*)\/(.*) /)},!i.msedge&&/(apple)?webkit/i.test(e)?(/(apple)?webkit\/537\.36/i.test(e)?(i.name=i.name||"Blink",i.blink=s):(i.name=i.name||"Webkit",i.webkit=s),!i.version&&x&&(i.version=x)):!i.opera&&/gecko\//i.test(e)&&(i.name=i.name||"Gecko",i.gecko=s,i.version=i.version||t(/gecko\/(\d+(\.\d+)?)/i)),i.windowsphone||!u&&!i.silk?!i.windowsphone&&o?(i[o]=s,i.ios=s,i.osname="iOS"):g?(i.mac=s,i.osname="macOS"):E?(i.xbox=s,i.osname="Xbox"):b?(i.windows=s,i.osname="Windows"):v&&(i.linux=s,i.osname="Linux"):(i.android=s,i.osname="Android");var T="";i.windows?T=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}(t(/Windows ((NT|XP)( \d\d?.\d)?)/i)):i.windowsphone?T=t(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):i.mac?(T=t(/Mac OS X (\d+([_\.\s]\d+)*)/i),T=T.replace(/[_\s]/g,".")):o?(T=t(/os (\d+([_\s]\d+)*) like mac os x/i),T=T.replace(/[_\s]/g,".")):u?T=t(/android[ \/-](\d+(\.\d+)*)/i):i.webos?T=t(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):i.blackberry?T=t(/rim\stablet\sos\s(\d+(\.\d+)*)/i):i.bada?T=t(/bada\/(\d+(\.\d+)*)/i):i.tizen&&(T=t(/tizen[\/\s](\d+(\.\d+)*)/i)),T&&(i.osversion=T);var S=!i.windows&&T.split(".")[0];return j||l||"ipad"==o||u&&(3==S||S>=4&&!_)||i.silk?i.tablet=s:(_||"iphone"==o||"ipod"==o||u||c||i.blackberry||i.webos||i.bada)&&(i.mobile=s),i.msedge||i.msie&&i.version>=10||i.yandexbrowser&&i.version>=15||i.vivaldi&&i.version>=1||i.chrome&&i.version>=20||i.samsungBrowser&&i.version>=4||i.whale&&1===n([i.version,"1.0"])||i.mzbrowser&&1===n([i.version,"6.0"])||i.focus&&1===n([i.version,"1.0"])||i.firefox&&i.version>=20||i.safari&&i.version>=6||i.opera&&i.version>=10||i.ios&&i.osversion&&i.osversion.split(".")[0]>=6||i.blackberry&&i.version>=10.1||i.chromium&&i.version>=20?i.a=s:i.msie&&i.version<10||i.chrome&&i.version<20||i.firefox&&i.version<20||i.safari&&i.version<6||i.opera&&i.version<10||i.ios&&i.osversion&&i.osversion.split(".")[0]<6||i.chromium&&i.version<20?i.c=s:i.x=s,i}function t(e){return e.split(".").length}function r(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r=0;){if(i[0][n]>i[1][n])return 1;if(i[0][n]!==i[1][n])return-1;if(0===n)return 0}}function i(t,r,i){var o=a;"string"==typeof r&&(i=r,r=void 0),void 0===r&&(r=!1),i&&(o=e(i));var s=""+o.version;for(var u in t)if(t.hasOwnProperty(u)&&o[u]){if("string"!=typeof t[u])throw new Error("Browser version in the minVersion map should be a string: "+u+": "+String(t));return n([s,t[u]])<0}return r}function o(e,t,r){return!i(e,t,r)}var s=!0,a=e("undefined"!=typeof navigator?navigator.userAgent||"":"");return a.test=function(e){for(var t=0;te._pos){var o=r.substr(e._pos);if("x-user-defined"===e._charset){for(var s=i.alloc(o.length),a=0;ae._pos&&(e.push(i.from(new Uint8Array(c.result.slice(e._pos)))),e._pos=c.result.byteLength)},c.onload=function(){e.push(null)},c.readAsArrayBuffer(r)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":80,_process:393,buffer:98,inherits:307,"readable-stream":97}],83:[function(e,t,r){"use strict";function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(e,t,r){function i(e,r,n){return"string"==typeof t?t:t(e,r,n)}r||(r=Error);var o=function(e){function t(t,r,n){return e.call(this,i(t,r,n))||this}return n(t,e),t}(r);o.prototype.name=r.name,o.prototype.code=e,c[e]=o}function o(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(e){return String(e)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function s(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function a(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function u(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}var c={};i("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;"string"==typeof t&&s(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(a(e," argument"))i="The ".concat(e," ").concat(n," ").concat(o(t,"type"));else{var c=u(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(c," ").concat(n," ").concat(o(t,"type"))}return i+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=c},{}],84:[function(e,t,r){(function(r){"use strict";function n(e){if(!(this instanceof n))return new n(e);a.call(this,e),u.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",i)))}function i(){this._writableState.ended||r.nextTick(o,this)}function o(e){e.end()}var s=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=n;var a=e("./_stream_readable"),u=e("./_stream_writable");e("inherits")(n,a);for(var c=s(u.prototype),l=0;l0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===C.prototype||(t=i(t)),n)s.endEmitted?K(e,new z):l(e,s,t,!0);else if(s.ended)K(e,new V);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?l(e,s,t,!1):b(e,s)):l(e,s,t,!1)}else n||(s.reading=!1,b(e,s))}return!s.ended&&(s.length=$?e=$:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function d(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=p(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function h(e,t){if(I("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?m(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,y(e)))}}function m(e){var t=e._readableState;I("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(I("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(y,e))}function y(e){var t=e._readableState;I("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,E(e)}function b(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(g,e,t))}function g(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function x(e){I("readable nexttick read 0"),e.read(0)}function j(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(_,e,t))}function _(e,t){I("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),E(e),t.flowing&&!t.reading&&e.read(0)}function E(e){var t=e._readableState;for(I("flow",t.flowing);t.flowing&&null!==e.read(););}function T(e,t){if(0===t.length)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function S(e){var t=e._readableState;I("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(O,t,e))}function O(e,t){if(I("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function k(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return I("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?S(this):m(this),null;if(0===(e=d(e,t))&&t.ended)return 0===t.length&&S(this),null;var n=t.needReadable;I("need readable",n),(0===t.length||t.length-e0?T(e,t):null,null===i?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&S(this)),null!==i&&this.emit("data",i),i},u.prototype._read=function(e){K(this,new H("_read()"))},u.prototype.pipe=function(e,t){function n(e,t){I("onunpipe"),e===p&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,o())}function i(){I("onend"),e.end()}function o(){I("cleanup"),e.removeListener("close",c),e.removeListener("finish",l),e.removeListener("drain",y),e.removeListener("error",u),e.removeListener("unpipe",n),p.removeListener("end",i),p.removeListener("end",f),p.removeListener("data",a),b=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}function a(t){I("ondata");var r=e.write(t);I("dest.write",r),!1===r&&((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&-1!==k(d.pipes,e))&&!b&&(I("false write response, pause",d.awaitDrain),d.awaitDrain++),p.pause())}function u(t){I("onerror",t),f(),e.removeListener("error",u),0===N(e,"error")&&K(e,t)}function c(){e.removeListener("finish",l),f()}function l(){I("onfinish"),e.removeListener("close",c),f()}function f(){I("unpipe"),p.unpipe(e)}var p=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,I("pipe count=%d opts=%j",d.pipesCount,t);var h=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,m=h?i:f;d.endEmitted?r.nextTick(m):p.once("end",m),e.on("unpipe",n);var y=v(p);e.on("drain",y);var b=!1;return p.on("data",a),s(e,"error",u),e.once("close",c),e.once("finish",l),e.emit("pipe",p),d.flowing||(I("pipe resume"),p.resume()),e},u.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,I("on readable",i.length,i.reading),i.length?m(this):i.reading||r.nextTick(x,this))),n},u.prototype.addListener=u.prototype.on,u.prototype.removeListener=function(e,t){var n=D.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(w,this),n},u.prototype.removeAllListeners=function(e){var t=D.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(w,this),t},u.prototype.resume=function(){var e=this._readableState;return e.flowing||(I("resume"),e.flowing=!e.readableListening,j(this,e)),e.paused=!1,this},u.prototype.pause=function(){return I("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(I("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},u.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(I("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){if(I("wrapped data"),r.decoder&&(i=r.decoder.write(i)),(!r.objectMode||null!==i&&void 0!==i)&&(r.objectMode||i&&i.length)){t.push(i)||(n=!0,e.pause())}});for(var i in e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new W(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),c.prototype._write=function(e,t,r){r(new L("_write()"))},c.prototype._writev=null,c.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||T(this,n,r),this},Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),c.prototype.destroy=D.destroy,c.prototype._undestroy=D.undestroy,c.prototype._destroy=function(e,t){t(e)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":83,"./_stream_duplex":84,"./internal/streams/destroy":91,"./internal/streams/state":95,"./internal/streams/stream":96,_process:393,buffer:98,inherits:307,"util-deprecate":343}],89:[function(e,t,r){(function(r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){return{value:e,done:t}}function o(e){var t=e[l];if(null!==t){var r=e[y].read();null!==r&&(e[h]=null,e[l]=null,e[f]=null,t(i(r,!1)))}}function s(e){r.nextTick(o,e)}function a(e,t){return function(r,n){e.then(function(){if(t[d])return void r(i(void 0,!0));t[m](r,n)},n)}}var u,c=e("./end-of-stream"),l=Symbol("lastResolve"),f=Symbol("lastReject"),p=Symbol("error"),d=Symbol("ended"),h=Symbol("lastPromise"),m=Symbol("handlePromise"),y=Symbol("stream"),b=Object.getPrototypeOf(function(){}),g=Object.setPrototypeOf((u={get stream(){return this[y]},next:function(){var e=this,t=this[p];if(null!==t)return Promise.reject(t);if(this[d])return Promise.resolve(i(void 0,!0));if(this[y].destroyed)return new Promise(function(t,n){r.nextTick(function(){e[p]?n(e[p]):t(i(void 0,!0))})});var n,o=this[h];if(o)n=new Promise(a(o,this));else{var s=this[y].read();if(null!==s)return Promise.resolve(i(s,!1));n=new Promise(this[m])}return this[h]=n,n}},n(u,Symbol.asyncIterator,function(){return this}),n(u,"return",function(){var e=this;return new Promise(function(t,r){e[y].destroy(null,function(e){if(e)return void r(e);t(i(void 0,!0))})})}),u),b),v=function(e){var t,r=Object.create(g,(t={},n(t,y,{value:e,writable:!0}),n(t,l,{value:null,writable:!0}),n(t,f,{value:null,writable:!0}),n(t,p,{value:null,writable:!0}),n(t,d,{value:e._readableState.endEmitted,writable:!0}),n(t,m,{value:function(e,t){var n=r[y].read();n?(r[h]=null,r[l]=null,r[f]=null,e(i(n,!1))):(r[l]=e,r[f]=t)},writable:!0}),t));return r[h]=null,c(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[f];return null!==t&&(r[h]=null,r[l]=null,r[f]=null,t(e)),void(r[p]=e)}var n=r[l];null!==n&&(r[h]=null,r[l]=null,r[f]=null,n(i(void 0,!0))),r[d]=!0}),e.on("readable",s.bind(null,r)),r};t.exports=v}).call(this,e("_process"))},{"./end-of-stream":92,_process:393}],90:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return f.alloc(0);for(var t=f.allocUnsafe(e>>>0),r=this.head,n=0;r;)c(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=f.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:h,value:function(e,t){return d(this,i({},t,{depth:0,customInspect:!1}))}}]),e}()},{buffer:98,util:78}],91:[function(e,t,r){(function(e){"use strict";function r(t,r){var o=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(r?r(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(s,this,t)):e.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!r&&t?o._writableState?o._writableState.errorEmitted?e.nextTick(i,o):(o._writableState.errorEmitted=!0,e.nextTick(n,o,t)):e.nextTick(n,o,t):r?(e.nextTick(i,o),r(t)):e.nextTick(i,o)}),this)}function n(e,t){s(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(e,t){e.emit("error",t)}function a(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}t.exports={destroy:r,undestroy:o,errorOrDestroy:a}}).call(this,e("_process"))},{_process:393}],92:[function(e,t,r){"use strict";function n(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0,function(e){i||(i=e),e&&o.forEach(a),u||(o.forEach(a),n(i))})});return t.reduce(u)}var f,p=e("../../../errors").codes,d=p.ERR_MISSING_ARGS,h=p.ERR_STREAM_DESTROYED;t.exports=l},{"../../../errors":83,"./end-of-stream":92}],95:[function(e,t,r){"use strict";function n(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}function i(e,t,r,i){var s=n(t,i,r);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0){throw new o(i?r:"highWaterMark",s)}return Math.floor(s)}return e.objectMode?16:16384}var o=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:i}},{"../../../errors":83}],96:[function(e,t,r){t.exports=e("events").EventEmitter},{events:297}],97:[function(e,t,r){r=t.exports=e("./lib/_stream_readable.js"),r.Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":84,"./lib/_stream_passthrough.js":85,"./lib/_stream_readable.js":86,"./lib/_stream_transform.js":87,"./lib/_stream_writable.js":88,"./lib/internal/streams/end-of-stream.js":92,"./lib/internal/streams/pipeline.js":94}],98:[function(e,t,r){(function(t){"use strict";function n(e){if(e>K)throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=new Uint8Array(e);return r.__proto__=t.prototype,r}function t(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return a(e)}return i(e,t,r)}function i(e,r,n){if("string"==typeof e)return u(e,r);if(ArrayBuffer.isView(e))return c(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return l(e,r,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return t.from(i,r,n);var o=f(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return t.from(e[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function o(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function s(e,t,r){return o(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}function a(e){return o(e),n(e<0?0:0|p(e))}function u(e,r){if("string"==typeof r&&""!==r||(r="utf8"),!t.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var i=0|h(e,r),o=n(i),s=o.write(e,r);return s!==i&&(o=o.slice(0,s)),o}function c(e){for(var t=e.length<0?0:0|p(e.length),r=n(t),i=0;i=K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");return 0|e}function d(e){return+e!=e&&(e=0),t.alloc(+e)}function h(e,r){if(t.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(o)return i?-1:q(e).length;r=(""+r).toLowerCase(),o=!0}}function m(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return k(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,r,n,i,o){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,V(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=t.from(r,i)),t.isBuffer(r))return 0===r.length?-1:g(e,r,n,i,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,r,n):Uint8Array.prototype.lastIndexOf.call(e,r,n):g(e,[r],n,i,o);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){function o(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}var c;if(i){var l=-1;for(c=r;ca&&(r=a-u),c=r;c>=0;c--){for(var f=!0,p=0;pi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var u,c,l,f;switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(f=(31&o)<<6|63&u)>127&&(s=f);break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(f=(15&o)<<12|(63&u)<<6|63&c)>2047&&(f<55296||f>57343)&&(s=f);break;case 4:u=e[i+1],c=e[i+2],l=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(f=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&f<1114112&&(s=f)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return O(n)}function O(e){var t=e.length;if(t<=Y)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function C(e,r,n,i,o,s){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||re.length)throw new RangeError("Index out of range")}function R(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,i){return t=+t,r>>>=0,i||R(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),z.write(e,t,r,n,23,4),r+4}function P(e,t,r,n,i){return t=+t,r>>>=0,i||R(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),z.write(e,t,r,n,52,8),r+8}function L(e){if(e=e.split("=")[0],e=e.trim().replace($,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function B(e){return e<16?"0"+e.toString(16):e.toString(16)}function q(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(e){for(var t=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function G(e){return H.toByteArray(L(e))}function W(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function V(e){return e!==e}var H=e("base64-js"),z=e("ieee754");r.Buffer=t,r.SlowBuffer=d,r.INSPECT_MAX_BYTES=50;var K=2147483647;r.kMaxLength=K,t.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),t.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(t.prototype,"parent",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.buffer}}),Object.defineProperty(t.prototype,"offset",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),t.poolSize=8192,t.from=function(e,t,r){return i(e,t,r)},t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,t.alloc=function(e,t,r){return s(e,t,r)},t.allocUnsafe=function(e){return a(e)},t.allocUnsafeSlow=function(e){return a(e)},t.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==t.prototype},t.compare=function(e,r){if(X(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),X(r,Uint8Array)&&(r=t.from(r,r.offset,r.byteLength)),!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);ot&&(e+=" ... "),""},t.prototype.compare=function(e,r,n,i,o){if(X(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),!t.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,a=n-r,u=Math.min(s,a),c=this.slice(i,o),l=e.slice(r,n),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return x(this,e,t,r);case"latin1":case"binary":return j(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Y=4096;t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),r<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,t>>>=0,r||D(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||D(e,t,this.length) -;for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},t.prototype.readUInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),this[e]},t.prototype.readUInt16LE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]|this[e+1]<<8},t.prototype.readUInt16BE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]<<8|this[e+1]},t.prototype.readUInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},t.prototype.readUInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},t.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);for(var n=this[e],i=1,o=0;++o=i&&(n-=Math.pow(2,8*t)),n},t.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},t.prototype.readInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},t.prototype.readInt16LE=function(e,t){e>>>=0,t||D(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(e,t){e>>>=0,t||D(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},t.prototype.readInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},t.prototype.readFloatLE=function(e,t){return e>>>=0,t||D(e,4,this.length),z.read(this,e,!0,23,4)},t.prototype.readFloatBE=function(e,t){return e>>>=0,t||D(e,4,this.length),z.read(this,e,!1,23,4)},t.prototype.readDoubleLE=function(e,t){return e>>>=0,t||D(e,8,this.length),z.read(this,e,!0,52,8)},t.prototype.readDoubleBE=function(e,t){return e>>>=0,t||D(e,8,this.length),z.read(this,e,!1,52,8)},t.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){C(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){C(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},t.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,1,255,0),this[t]=255&e,t+1},t.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},t.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},t.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},t.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},t.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);C(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},t.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);C(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},t.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},t.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},t.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},t.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},t.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},t.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},t.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},t.prototype.writeDoubleLE=function(e,t,r){return P(this,e,t,!0,r)},t.prototype.writeDoubleBE=function(e,t,r){return P(this,e,t,!1,r)},t.prototype.copy=function(e,r,n,i){if(!t.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r=0;--s)e[s+r]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,i),r);return o},t.prototype.fill=function(e,r,n,i){if("string"==typeof e){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!t.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){var o=e.charCodeAt(0);("utf8"===i&&o<128||"latin1"===i)&&(e=o)}}else"number"==typeof e&&(e&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var s;if("number"==typeof e)for(s=r;s>8&255]},C=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},R=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},M=function(e){return A(e,23,4)},P=function(e){return A(e,52,8)},L=function(e,t){b(e.prototype,t,{get:function(){return x(this)[t]}})},B=function(e,t,r,n){var i=p(r),o=x(e);if(i+t>o.byteLength)throw k("Wrong index");var s=x(o.buffer).bytes,a=i+o.byteOffset,u=s.slice(a,a+t);return n?u:u.reverse()},q=function(e,t,r,n,i,o){var s=p(r),a=x(e);if(s+t>a.byteLength)throw k("Wrong index");for(var u=x(a.buffer).bytes,c=s+a.byteOffset,l=n(+i),f=0;fW;)(F=G[W++])in E||s(E,F,_[F]);U.constructor=E}m&&h(S)!==O&&m(S,O);var X=new T(new E(2)),V=S.setInt8;X.setInt8(0,2147483648),X.setInt8(1,2147483649),!X.getInt8(0)&&X.getInt8(1)||a(S,{setInt8:function(e,t){V.call(this,e,t<<24>>24)},setUint8:function(e,t){V.call(this,e,t<<24>>24)}},{unsafe:!0})}else E=function(e){c(this,E,"ArrayBuffer");var t=p(e);j(this,{bytes:g.call(new Array(t),0),byteLength:t}),i||(this.byteLength=t)},T=function(e,t,r){c(this,T,"DataView"),c(e,E,"DataView");var n=x(e).byteLength,o=l(t);if(o<0||o>n)throw k("Wrong offset");if(r=void 0===r?n-o:f(r),o+r>n)throw k("Wrong length");j(this,{buffer:e,byteLength:r,byteOffset:o}),i||(this.buffer=e,this.byteLength=r,this.byteOffset=o)},i&&(L(E,"byteLength"),L(T,"buffer"),L(T,"byteLength"),L(T,"byteOffset")),a(T.prototype,{getInt8:function(e){return B(this,1,e)[0]<<24>>24},getUint8:function(e){return B(this,1,e)[0]},getInt16:function(e){var t=B(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=B(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return R(B(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return R(B(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return I(B(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return I(B(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){q(this,1,e,N,t)},setUint8:function(e,t){q(this,1,e,N,t)},setInt16:function(e,t){q(this,2,e,D,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){q(this,2,e,D,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){q(this,4,e,C,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){q(this,4,e,C,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){q(this,4,e,M,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){q(this,8,e,P,t,arguments.length>2?arguments[2]:void 0)}});v(E,"ArrayBuffer"),v(T,"DataView"),t.exports={ArrayBuffer:E,DataView:T}},{"../internals/an-instance":106,"../internals/array-buffer-native":108,"../internals/array-fill":112,"../internals/create-non-enumerable-property":131,"../internals/descriptors":136,"../internals/fails":145,"../internals/global":150,"../internals/ieee754":156,"../internals/internal-state":160,"../internals/object-define-property":180,"../internals/object-get-own-property-names":183,"../internals/object-get-prototype-of":185,"../internals/object-set-prototype-of":189,"../internals/redefine-all":196,"../internals/set-to-string-tag":206,"../internals/to-index":216,"../internals/to-integer":218,"../internals/to-length":219}],111:[function(e,t,r){"use strict";var n=e("../internals/to-object"),i=e("../internals/to-absolute-index"),o=e("../internals/to-length"),s=Math.min;t.exports=[].copyWithin||function(e,t){var r=n(this),a=o(r.length),u=i(e,a),c=i(t,a),l=arguments.length>2?arguments[2]:void 0,f=s((void 0===l?a:i(l,a))-c,a-u),p=1;for(c0;)c in r?r[u]=r[c]:delete r[u],u+=p,c+=p;return r}},{"../internals/to-absolute-index":215,"../internals/to-length":219,"../internals/to-object":220}],112:[function(e,t,r){"use strict";var n=e("../internals/to-object"),i=e("../internals/to-absolute-index"),o=e("../internals/to-length");t.exports=function(e){for(var t=n(this),r=o(t.length),s=arguments.length,a=i(s>1?arguments[1]:void 0,r),u=s>2?arguments[2]:void 0,c=void 0===u?r:i(u,r);c>a;)t[a++]=e;return t}},{"../internals/to-absolute-index":215,"../internals/to-length":219,"../internals/to-object":220}],113:[function(e,t,r){"use strict";var n=e("../internals/array-iteration").forEach,i=e("../internals/array-method-is-strict"),o=e("../internals/array-method-uses-to-length"),s=i("forEach"),a=o("forEach");t.exports=s&&a?[].forEach:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}},{"../internals/array-iteration":116,"../internals/array-method-is-strict":119,"../internals/array-method-uses-to-length":120}],114:[function(e,t,r){"use strict";var n=e("../internals/function-bind-context"),i=e("../internals/to-object"),o=e("../internals/call-with-safe-iteration-closing"),s=e("../internals/is-array-iterator-method"),a=e("../internals/to-length"),u=e("../internals/create-property"),c=e("../internals/get-iterator-method");t.exports=function(e){var t,r,l,f,p,d,h=i(e),m="function"==typeof this?this:Array,y=arguments.length,b=y>1?arguments[1]:void 0,g=void 0!==b,v=c(h),w=0;if(g&&(b=n(b,y>2?arguments[2]:void 0,2)),void 0==v||m==Array&&s(v))for(t=a(h.length),r=new m(t);t>w;w++)d=g?b(h[w],w):h[w],u(r,w,d);else for(f=v.call(h),p=f.next,r=new m;!(l=p.call(f)).done;w++)d=g?o(f,b,[l.value,w],!0):l.value,u(r,w,d);return r.length=w,r}},{"../internals/call-with-safe-iteration-closing":123,"../internals/create-property":133,"../internals/function-bind-context":147,"../internals/get-iterator-method":149,"../internals/is-array-iterator-method":161,"../internals/to-length":219,"../internals/to-object":220}],115:[function(e,t,r){var n=e("../internals/to-indexed-object"),i=e("../internals/to-length"),o=e("../internals/to-absolute-index"),s=function(e){return function(t,r,s){var a,u=n(t),c=i(u.length),l=o(s,c);if(e&&r!=r){for(;c>l;)if((a=u[l++])!=a)return!0}else for(;c>l;l++)if((e||l in u)&&u[l]===r)return e||l||0;return!e&&-1}};t.exports={includes:s(!0),indexOf:s(!1)}},{"../internals/to-absolute-index":215,"../internals/to-indexed-object":217,"../internals/to-length":219}],116:[function(e,t,r){var n=e("../internals/function-bind-context"),i=e("../internals/indexed-object"),o=e("../internals/to-object"),s=e("../internals/to-length"),a=e("../internals/array-species-create"),u=[].push,c=function(e){var t=1==e,r=2==e,c=3==e,l=4==e,f=6==e,p=5==e||f;return function(d,h,m,y){for(var b,g,v=o(d),w=i(v),x=n(h,m,3),j=s(w.length),_=0,E=y||a,T=t?E(d,j):r?E(d,0):void 0;j>_;_++)if((p||_ in w)&&(b=w[_],g=x(b,_,v),e))if(t)T[_]=g;else if(g)switch(e){case 3:return!0;case 5:return b;case 6:return _;case 2:u.call(T,b)}else if(l)return!1;return f?-1:c||l?l:T}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6)}},{"../internals/array-species-create":122,"../internals/function-bind-context":147,"../internals/indexed-object":157,"../internals/to-length":219,"../internals/to-object":220}],117:[function(e,t,r){"use strict";var n=e("../internals/to-indexed-object"),i=e("../internals/to-integer"),o=e("../internals/to-length"),s=e("../internals/array-method-is-strict"),a=e("../internals/array-method-uses-to-length"),u=Math.min,c=[].lastIndexOf,l=!!c&&1/[1].lastIndexOf(1,-0)<0,f=s("lastIndexOf"),p=a("indexOf",{ACCESSORS:!0,1:0}),d=l||!f||!p;t.exports=d?function(e){if(l)return c.apply(this,arguments)||0;var t=n(this),r=o(t.length),s=r-1;for(arguments.length>1&&(s=u(s,i(arguments[1]))),s<0&&(s=r+s);s>=0;s--)if(s in t&&t[s]===e)return s||0;return-1}:c},{"../internals/array-method-is-strict":119,"../internals/array-method-uses-to-length":120,"../internals/to-indexed-object":217,"../internals/to-integer":218,"../internals/to-length":219}],118:[function(e,t,r){var n=e("../internals/fails"),i=e("../internals/well-known-symbol"),o=e("../internals/engine-v8-version"),s=i("species");t.exports=function(e){return o>=51||!n(function(){var t=[],r=t.constructor={};return r[s]=function(){return{foo:1}},1!==t[e](Boolean).foo})}},{"../internals/engine-v8-version":142,"../internals/fails":145,"../internals/well-known-symbol":231}],119:[function(e,t,r){"use strict";var n=e("../internals/fails");t.exports=function(e,t){var r=[][e];return!!r&&n(function(){r.call(null,t||function(){throw 1},1)})}},{"../internals/fails":145}],120:[function(e,t,r){var n=e("../internals/descriptors"),i=e("../internals/fails"),o=e("../internals/has"),s=Object.defineProperty,a={},u=function(e){throw e};t.exports=function(e,t){if(o(a,e))return a[e];t||(t={});var r=[][e],c=!!o(t,"ACCESSORS")&&t.ACCESSORS,l=o(t,0)?t[0]:u,f=o(t,1)?t[1]:void 0;return a[e]=!!r&&!i(function(){if(c&&!n)return!0;var e={length:-1};c?s(e,1,{enumerable:!0,get:u}):e[1]=1,r.call(e,l,f)})}},{"../internals/descriptors":136,"../internals/fails":145,"../internals/has":151}],121:[function(e,t,r){var n=e("../internals/a-function"),i=e("../internals/to-object"),o=e("../internals/indexed-object"),s=e("../internals/to-length"),a=function(e){return function(t,r,a,u){n(r);var c=i(t),l=o(c),f=s(c.length),p=e?f-1:0,d=e?-1:1;if(a<2)for(;;){if(p in l){u=l[p],p+=d;break}if(p+=d,e?p<0:f<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:f>p;p+=d)p in l&&(u=r(u,l[p],p,c));return u}};t.exports={left:a(!1),right:a(!0)}},{"../internals/a-function":102,"../internals/indexed-object":157,"../internals/to-length":219,"../internals/to-object":220}],122:[function(e,t,r){var n=e("../internals/is-object"),i=e("../internals/is-array"),o=e("../internals/well-known-symbol"),s=o("species");t.exports=function(e,t){var r;return i(e)&&(r=e.constructor,"function"!=typeof r||r!==Array&&!i(r.prototype)?n(r)&&null===(r=r[s])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===t?0:t)}},{"../internals/is-array":162,"../internals/is-object":164,"../internals/well-known-symbol":231}],123:[function(e,t,r){var n=e("../internals/an-object"),i=e("../internals/iterator-close");t.exports=function(e,t,r,o){try{return o?t(n(r)[0],r[1]):t(r)}catch(t){throw i(e),t}}},{"../internals/an-object":107,"../internals/iterator-close":168}],124:[function(e,t,r){var n=e("../internals/well-known-symbol"),i=n("iterator"),o=!1;try{var s=0,a={next:function(){return{done:!!s++}},return:function(){o=!0}};a[i]=function(){return this},Array.from(a,function(){throw 2})}catch(e){}t.exports=function(e,t){if(!t&&!o)return!1;var r=!1;try{var n={};n[i]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r}},{"../internals/well-known-symbol":231}],125:[function(e,t,r){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],126:[function(e,t,r){var n=e("../internals/to-string-tag-support"),i=e("../internals/classof-raw"),o=e("../internals/well-known-symbol"),s=o("toStringTag"),a="Arguments"==i(function(){return arguments}()),u=function(e,t){try{return e[t]}catch(e){}};t.exports=n?i:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=u(t=Object(e),s))?r:a?i(t):"Object"==(n=i(t))&&"function"==typeof t.callee?"Arguments":n}},{"../internals/classof-raw":125,"../internals/to-string-tag-support":224,"../internals/well-known-symbol":231}],127:[function(e,t,r){var n=e("../internals/has"),i=e("../internals/own-keys"),o=e("../internals/object-get-own-property-descriptor"),s=e("../internals/object-define-property");t.exports=function(e,t){for(var r=i(t),a=s.f,u=o.f,c=0;c=74)&&(n=s.match(/Chrome\/(\d+)/))&&(i=n[1]),t.exports=i&&+i},{"../internals/engine-user-agent":141,"../internals/global":150}],143:[function(e,t,r){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},{}],144:[function(e,t,r){var n=e("../internals/global"),i=e("../internals/object-get-own-property-descriptor").f,o=e("../internals/create-non-enumerable-property"),s=e("../internals/redefine"),a=e("../internals/set-global"),u=e("../internals/copy-constructor-properties"),c=e("../internals/is-forced");t.exports=function(e,t){var r,l,f,p,d,h=e.target,m=e.global,y=e.stat;if(r=m?n:y?n[h]||a(h,{}):(n[h]||{}).prototype)for(l in t){if(p=t[l],e.noTargetGet?(d=i(r,l),f=d&&d.value):f=r[l],!c(m?l:h+(y?".":"#")+l,e.forced)&&void 0!==f){if(typeof p==typeof f)continue;u(p,f)}(e.sham||f&&f.sham)&&o(p,"sham",!0),s(r,l,p,e)}}},{"../internals/copy-constructor-properties":127,"../internals/create-non-enumerable-property":131,"../internals/global":150,"../internals/is-forced":163,"../internals/object-get-own-property-descriptor":181,"../internals/redefine":197,"../internals/set-global":204}],145:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],146:[function(e,t,r){"use strict";e("../modules/es.regexp.exec");var n=e("../internals/redefine"),i=e("../internals/fails"),o=e("../internals/well-known-symbol"),s=e("../internals/regexp-exec"),a=e("../internals/create-non-enumerable-property"),u=o("species"),c=!i(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")}),l=function(){return"$0"==="a".replace(/./,"$0")}(),f=o("replace"),p=function(){return!!/./[f]&&""===/./[f]("a","$0")}(),d=!i(function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]});t.exports=function(e,t,r,f){var h=o(e),m=!i(function(){var t={};return t[h]=function(){return 7},7!=""[e](t)}),y=m&&!i(function(){var t=!1,r=/a/;return"split"===e&&(r={},r.constructor={},r.constructor[u]=function(){return r},r.flags="",r[h]=/./[h]),r.exec=function(){return t=!0,null},r[h](""),!t});if(!m||!y||"replace"===e&&(!c||!l||p)||"split"===e&&!d){var b=/./[h],g=r(h,""[e],function(e,t,r,n,i){return t.exec===s?m&&!i?{done:!0,value:b.call(t,r,n)}:{done:!0,value:e.call(r,t,n)}:{done:!1}},{REPLACE_KEEPS_$0:l,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),v=g[0],w=g[1];n(String.prototype,e,v),n(RegExp.prototype,h,2==t?function(e,t){return w.call(e,this,t)}:function(e){return w.call(e,this)})}f&&a(RegExp.prototype[h],"sham",!0)}},{"../internals/create-non-enumerable-property":131,"../internals/fails":145,"../internals/redefine":197,"../internals/regexp-exec":199,"../internals/well-known-symbol":231,"../modules/es.regexp.exec":256}],147:[function(e,t,r){var n=e("../internals/a-function");t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 0:return function(){return e.call(t)};case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{"../internals/a-function":102}],148:[function(e,t,r){var n=e("../internals/path"),i=e("../internals/global"),o=function(e){return"function"==typeof e?e:void 0};t.exports=function(e,t){return arguments.length<2?o(n[e])||o(i[e]):n[e]&&n[e][t]||i[e]&&i[e][t]}},{"../internals/global":150,"../internals/path":193}],149:[function(e,t,r){var n=e("../internals/classof"),i=e("../internals/iterators"),o=e("../internals/well-known-symbol"),s=o("iterator");t.exports=function(e){if(void 0!=e)return e[s]||e["@@iterator"]||i[n(e)]}},{"../internals/classof":126,"../internals/iterators":170,"../internals/well-known-symbol":231}],150:[function(e,t,r){(function(e){var r=function(e){return e&&e.Math==Math&&e};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof e&&e)||function(){return this}()||Function("return this")()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],151:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],152:[function(e,t,r){t.exports={}},{}],153:[function(e,t,r){var n=e("../internals/global");t.exports=function(e,t){var r=n.console;r&&r.error&&(1===arguments.length?r.error(e):r.error(e,t))}},{"../internals/global":150}],154:[function(e,t,r){var n=e("../internals/get-built-in");t.exports=n("document","documentElement")},{"../internals/get-built-in":148}],155:[function(e,t,r){var n=e("../internals/descriptors"),i=e("../internals/fails"),o=e("../internals/document-create-element");t.exports=!n&&!i(function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a})},{"../internals/descriptors":136,"../internals/document-create-element":137,"../internals/fails":145}],156:[function(e,t,r){var n=Math.abs,i=Math.pow,o=Math.floor,s=Math.log,a=Math.LN2,u=function(e,t,r){var u,c,l,f=new Array(r),p=8*r-t-1,d=(1<>1,m=23===t?i(2,-24)-i(2,-77):0,y=e<0||0===e&&1/e<0?1:0,b=0;for(e=n(e),e!=e||e===1/0?(c=e!=e?1:0,u=d):(u=o(s(e)/a),e*(l=i(2,-u))<1&&(u--,l*=2),e+=u+h>=1?m/l:m*i(2,1-h),e*l>=2&&(u++,l/=2),u+h>=d?(c=0,u=d):u+h>=1?(c=(e*l-1)*i(2,t),u+=h):(c=e*i(2,h-1)*i(2,t),u=0));t>=8;f[b++]=255&c,c/=256,t-=8);for(u=u<0;f[b++]=255&u,u/=256,p-=8);return f[--b]|=128*y,f},c=function(e,t){var r,n=e.length,o=8*n-t-1,s=(1<>1,u=o-7,c=n-1,l=e[c--],f=127&l;for(l>>=7;u>0;f=256*f+e[c],c--,u-=8);for(r=f&(1<<-u)-1,f>>=-u,u+=t;u>0;r=256*r+e[c],c--,u-=8);if(0===f)f=1-a;else{if(f===s)return r?NaN:l?-1/0:1/0;r+=i(2,t),f-=a}return(l?-1:1)*r*i(2,f-t)};t.exports={pack:u,unpack:c}},{}],157:[function(e,t,r){var n=e("../internals/fails"),i=e("../internals/classof-raw"),o="".split;t.exports=n(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return"String"==i(e)?o.call(e,""):Object(e)}:Object},{"../internals/classof-raw":125,"../internals/fails":145}],158:[function(e,t,r){var n=e("../internals/is-object"),i=e("../internals/object-set-prototype-of");t.exports=function(e,t,r){var o,s;return i&&"function"==typeof(o=t.constructor)&&o!==r&&n(s=o.prototype)&&s!==r.prototype&&i(e,s),e}},{"../internals/is-object":164,"../internals/object-set-prototype-of":189}],159:[function(e,t,r){var n=e("../internals/shared-store"),i=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(e){return i.call(e)}),t.exports=n.inspectSource},{"../internals/shared-store":208}],160:[function(e,t,r){var n,i,o,s=e("../internals/native-weak-map"),a=e("../internals/global"),u=e("../internals/is-object"),c=e("../internals/create-non-enumerable-property"),l=e("../internals/has"),f=e("../internals/shared-store"),p=e("../internals/shared-key"),d=e("../internals/hidden-keys"),h=a.WeakMap,m=function(e){return o(e)?i(e):n(e,{})},y=function(e){return function(t){var r;if(!u(t)||(r=i(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return r}};if(s){var b=f.state||(f.state=new h),g=b.get,v=b.has,w=b.set;n=function(e,t){return t.facade=e,w.call(b,e,t),t},i=function(e){return g.call(b,e)||{}},o=function(e){return v.call(b,e)}}else{var x=p("state");d[x]=!0,n=function(e,t){return t.facade=e,c(e,x,t),t},i=function(e){return l(e,x)?e[x]:{}},o=function(e){return l(e,x)}}t.exports={set:n,get:i,has:o,enforce:m,getterFor:y}},{"../internals/create-non-enumerable-property":131,"../internals/global":150,"../internals/has":151,"../internals/hidden-keys":152,"../internals/is-object":164,"../internals/native-weak-map":174,"../internals/shared-key":207,"../internals/shared-store":208}],161:[function(e,t,r){var n=e("../internals/well-known-symbol"),i=e("../internals/iterators"),o=n("iterator"),s=Array.prototype;t.exports=function(e){return void 0!==e&&(i.Array===e||s[o]===e)}},{"../internals/iterators":170,"../internals/well-known-symbol":231}],162:[function(e,t,r){var n=e("../internals/classof-raw");t.exports=Array.isArray||function(e){return"Array"==n(e)}},{"../internals/classof-raw":125}],163:[function(e,t,r){var n=e("../internals/fails"),i=/#|\.prototype\./,o=function(e,t){var r=a[s(e)];return r==c||r!=u&&("function"==typeof t?n(t):!!t)},s=o.normalize=function(e){return String(e).replace(i,".").toLowerCase()},a=o.data={},u=o.NATIVE="N",c=o.POLYFILL="P";t.exports=o},{"../internals/fails":145}],164:[function(e,t,r){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],165:[function(e,t,r){t.exports=!1},{}],166:[function(e,t,r){var n=e("../internals/is-object"),i=e("../internals/classof-raw"),o=e("../internals/well-known-symbol"),s=o("match");t.exports=function(e){var t;return n(e)&&(void 0!==(t=e[s])?!!t:"RegExp"==i(e))}},{"../internals/classof-raw":125,"../internals/is-object":164,"../internals/well-known-symbol":231}],167:[function(e,t,r){var n=e("../internals/an-object"),i=e("../internals/is-array-iterator-method"),o=e("../internals/to-length"),s=e("../internals/function-bind-context"),a=e("../internals/get-iterator-method"),u=e("../internals/iterator-close"),c=function(e,t){this.stopped=e,this.result=t};t.exports=function(e,t,r){var l,f,p,d,h,m,y,b=r&&r.that,g=!(!r||!r.AS_ENTRIES),v=!(!r||!r.IS_ITERATOR),w=!(!r||!r.INTERRUPTED),x=s(t,b,1+g+w),j=function(e){return l&&u(l),new c(!0,e)},_=function(e){return g?(n(e),w?x(e[0],e[1],j):x(e[0],e[1])):w?x(e,j):x(e)};if(v)l=e;else{if("function"!=typeof(f=a(e)))throw TypeError("Target is not iterable");if(i(f)){for(p=0,d=o(e.length);d>p;p++)if((h=_(e[p]))&&h instanceof c)return h;return new c(!1)}l=f.call(e)}for(m=l.next;!(y=m.call(l)).done;){try{h=_(y.value)}catch(e){throw u(l),e}if("object"==typeof h&&h&&h instanceof c)return h}return new c(!1)}},{"../internals/an-object":107,"../internals/function-bind-context":147,"../internals/get-iterator-method":149,"../internals/is-array-iterator-method":161,"../internals/iterator-close":168,"../internals/to-length":219}],168:[function(e,t,r){var n=e("../internals/an-object");t.exports=function(e){var t=e.return;if(void 0!==t)return n(t.call(e)).value}},{"../internals/an-object":107}],169:[function(e,t,r){"use strict";var n,i,o,s=e("../internals/object-get-prototype-of"),a=e("../internals/create-non-enumerable-property"),u=e("../internals/has"),c=e("../internals/well-known-symbol"),l=e("../internals/is-pure"),f=c("iterator"),p=!1,d=function(){return this};[].keys&&(o=[].keys(),"next"in o?(i=s(s(o)))!==Object.prototype&&(n=i):p=!0),void 0==n&&(n={}),l||u(n,f)||a(n,f,d),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:p}},{"../internals/create-non-enumerable-property":131,"../internals/has":151,"../internals/is-pure":165,"../internals/object-get-prototype-of":185,"../internals/well-known-symbol":231}],170:[function(e,t,r){arguments[4][152][0].apply(r,arguments)},{dup:152}],171:[function(e,t,r){var n,i,o,s,a,u,c,l,f=e("../internals/global"),p=e("../internals/object-get-own-property-descriptor").f,d=e("../internals/task").set,h=e("../internals/engine-is-ios"),m=e("../internals/engine-is-node"),y=f.MutationObserver||f.WebKitMutationObserver,b=f.document,g=f.process,v=f.Promise,w=p(f,"queueMicrotask"),x=w&&w.value;x||(n=function(){var e,t;for(m&&(e=g.domain)&&e.exit();i;){t=i.fn,i=i.next;try{t()}catch(e){throw i?s():o=void 0,e}}o=void 0,e&&e.enter()},!h&&!m&&y&&b?(a=!0,u=b.createTextNode(""),new y(n).observe(u,{characterData:!0}),s=function(){u.data=a=!a}):v&&v.resolve?(c=v.resolve(void 0),l=c.then,s=function(){l.call(c,n)}):s=m?function(){g.nextTick(n)}:function(){d.call(f,n)}),t.exports=x||function(e){var t={fn:e,next:void 0};o&&(o.next=t),i||(i=t,s()),o=t}},{"../internals/engine-is-ios":139,"../internals/engine-is-node":140,"../internals/global":150,"../internals/object-get-own-property-descriptor":181,"../internals/task":214}],172:[function(e,t,r){var n=e("../internals/global");t.exports=n.Promise},{"../internals/global":150}],173:[function(e,t,r){var n=e("../internals/fails");t.exports=!!Object.getOwnPropertySymbols&&!n(function(){return!String(Symbol())})},{"../internals/fails":145}],174:[function(e,t,r){var n=e("../internals/global"),i=e("../internals/inspect-source"),o=n.WeakMap;t.exports="function"==typeof o&&/native code/.test(i(o))},{"../internals/global":150,"../internals/inspect-source":159}],175:[function(e,t,r){"use strict";var n=e("../internals/a-function"),i=function(e){var t,r;this.promise=new e(function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n}),this.resolve=n(t),this.reject=n(r)};t.exports.f=function(e){return new i(e)}},{"../internals/a-function":102}],176:[function(e,t,r){var n=e("../internals/is-regexp");t.exports=function(e){if(n(e))throw TypeError("The method doesn't accept regular expressions");return e}},{"../internals/is-regexp":166}],177:[function(e,t,r){"use strict";var n=e("../internals/descriptors"),i=e("../internals/fails"),o=e("../internals/object-keys"),s=e("../internals/object-get-own-property-symbols"),a=e("../internals/object-property-is-enumerable"),u=e("../internals/to-object"),c=e("../internals/indexed-object"),l=Object.assign,f=Object.defineProperty;t.exports=!l||i(function(){if(n&&1!==l({b:1},l(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach(function(e){t[e]=e}),7!=l({},e)[r]||o(l({},t)).join("")!=i})?function(e,t){for(var r=u(e),i=arguments.length,l=1,f=s.f,p=a.f;i>l;)for(var d,h=c(arguments[l++]),m=f?o(h).concat(f(h)):o(h),y=m.length,b=0;y>b;)d=m[b++],n&&!p.call(h,d)||(r[d]=h[d]);return r}:l},{"../internals/descriptors":136,"../internals/fails":145,"../internals/indexed-object":157,"../internals/object-get-own-property-symbols":184,"../internals/object-keys":187,"../internals/object-property-is-enumerable":188,"../internals/to-object":220}],178:[function(e,t,r){var n,i=e("../internals/an-object"),o=e("../internals/object-define-properties"),s=e("../internals/enum-bug-keys"),a=e("../internals/hidden-keys"),u=e("../internals/html"),c=e("../internals/document-create-element"),l=e("../internals/shared-key"),f=l("IE_PROTO"),p=function(){},d=function(e){return"