diff --git a/devtools/client/shared/vendor/jszip.js b/devtools/client/shared/vendor/jszip.js index 384350bf080e..639685c10b01 100644 --- a/devtools/client/shared/vendor/jszip.js +++ b/devtools/client/shared/vendor/jszip.js @@ -1,6 +1,6 @@ /*! -JSZip v3.1.3 - A Javascript class for generating and reading zip files +JSZip v3.2.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley @@ -289,7 +289,6 @@ module.exports = function crc32wrapper(input, crc) { return crc32str(crc|0, input, input.length, 0); } }; -// vim: set shiftwidth=4 softtabstop=4: },{"./utils":32}],5:[function(require,module,exports){ 'use strict'; @@ -325,7 +324,7 @@ module.exports = { Promise: ES6Promise }; -},{"lie":58}],7:[function(require,module,exports){ +},{"lie":37}],7:[function(require,module,exports){ 'use strict'; var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); @@ -346,21 +345,12 @@ exports.magic = "\x08\x00"; function FlateWorker(action, options) { GenericWorker.call(this, "FlateWorker/" + action); - this._pako = new pako[action]({ - raw:true, - level : options.level || -1 // default compression - }); + this._pako = null; + this._pakoAction = action; + this._pakoOptions = options; // the `meta` object from the last chunk received // this allow this worker to pass around metadata this.meta = {}; - - var self = this; - this._pako.onData = function(data) { - self.push({ - data : data, - meta : self.meta - }); - }; } utils.inherits(FlateWorker, GenericWorker); @@ -370,6 +360,9 @@ utils.inherits(FlateWorker, GenericWorker); */ FlateWorker.prototype.processChunk = function (chunk) { this.meta = chunk.meta; + if (this._pako === null) { + this._createPako(); + } this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false); }; @@ -378,6 +371,9 @@ FlateWorker.prototype.processChunk = function (chunk) { */ FlateWorker.prototype.flush = function () { GenericWorker.prototype.flush.call(this); + if (this._pako === null) { + this._createPako(); + } this._pako.push([], true); }; /** @@ -388,6 +384,26 @@ FlateWorker.prototype.cleanUp = function () { this._pako = null; }; +/** + * Create the _pako object. + * TODO: lazy-loading this object isn't the best solution but it's the + * quickest. The best solution is to lazy-load the worker list. See also the + * issue #446. + */ +FlateWorker.prototype._createPako = function () { + this._pako = new pako[this._pakoAction]({ + raw: true, + level: this._pakoOptions.level || -1 // default compression + }); + var self = this; + this._pako.onData = function(data) { + self.push({ + data : data, + meta : self.meta + }); + }; +}; + exports.compressWorker = function (compressionOptions) { return new FlateWorker("Deflate", compressionOptions); }; @@ -395,7 +411,7 @@ exports.uncompressWorker = function () { return new FlateWorker("Inflate", {}); }; -},{"./stream/GenericWorker":28,"./utils":32,"pako":59}],8:[function(require,module,exports){ +},{"./stream/GenericWorker":28,"./utils":32,"pako":38}],8:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -1041,7 +1057,7 @@ JSZip.defaults = require('./defaults'); // TODO find a better way to handle this version, // a require('package.json').version doesn't work with webpack, see #327 -JSZip.version = "3.1.3"; +JSZip.version = "3.2.0"; JSZip.loadAsync = function (content, options) { return new JSZip().loadAsync(content, options); @@ -1215,8 +1231,8 @@ module.exports = NodejsStreamInputAdapter; var Readable = require('readable-stream').Readable; -var util = require('util'); -util.inherits(NodejsStreamOutputAdapter, Readable); +var utils = require('../utils'); +utils.inherits(NodejsStreamOutputAdapter, Readable); /** * A nodejs stream using a worker as source. @@ -1254,7 +1270,7 @@ NodejsStreamOutputAdapter.prototype._read = function() { module.exports = NodejsStreamOutputAdapter; -},{"readable-stream":16,"util":undefined}],14:[function(require,module,exports){ +},{"../utils":32,"readable-stream":16}],14:[function(require,module,exports){ 'use strict'; module.exports = { @@ -1265,13 +1281,36 @@ module.exports = { */ isNode : typeof Buffer !== "undefined", /** - * Create a new nodejs Buffer. + * Create a new nodejs Buffer from an existing content. * @param {Object} data the data to pass to the constructor. * @param {String} encoding the encoding to use. * @return {Buffer} a new Buffer. */ - newBuffer : function(data, encoding){ - return new Buffer(data, encoding); + newBufferFrom: function(data, encoding) { + if (Buffer.from && Buffer.from !== Uint8Array.from) { + return Buffer.from(data, encoding); + } else { + if (typeof data === "number") { + // Safeguard for old Node.js versions. On newer versions, + // Buffer.from(number) / Buffer(number, encoding) already throw. + throw new Error("The \"data\" argument must not be a number"); + } + return new Buffer(data, encoding); + } + }, + /** + * Create a new nodejs Buffer with the specified size. + * @param {Integer} size the size of the buffer. + * @return {Buffer} a new Buffer. + */ + allocBuffer: function (size) { + if (Buffer.alloc) { + return Buffer.alloc(size); + } else { + var buf = new Buffer(size); + buf.fill(0); + return buf; + } }, /** * Find out if an object is a Buffer. @@ -1699,9 +1738,9 @@ var utils = require('../utils'); function ArrayReader(data) { DataReader.call(this, data); - for(var i = 0; i < this.data.length; i++) { - data[i] = data[i] & 0xFF; - } + for(var i = 0; i < this.data.length; i++) { + data[i] = data[i] & 0xFF; + } } utils.inherits(ArrayReader, DataReader); /** @@ -1771,7 +1810,7 @@ DataReader.prototype = { this.checkIndex(this.index + offset); }, /** - * Check that the specifed index will not be too far. + * Check that the specified index will not be too far. * @param {string} newIndex the index to check. * @throws {Error} an Error if the index is out of bounds. */ @@ -1984,8 +2023,6 @@ module.exports = function (data) { return new ArrayReader(utils.transformTo("array", data)); }; -// vim: set shiftwidth=4 softtabstop=4: - },{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(require,module,exports){ 'use strict'; exports.LOCAL_FILE_HEADER = "PK\x03\x04"; @@ -2484,24 +2521,19 @@ if (support.nodestream) { * Apply the final transformation of the data. If the user wants a Blob for * example, it's easier to work with an U8intArray and finally do the * ArrayBuffer/Blob conversion. - * @param {String} resultType the name of the final type - * @param {String} chunkType the type of the data in the given array. - * @param {Array} dataArray the array containing the data chunks to concatenate + * @param {String} type the name of the final type * @param {String|Uint8Array|Buffer} content the content to transform * @param {String} mimeType the mime type of the content, if applicable. * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format. */ -function transformZipOutput(resultType, chunkType, dataArray, mimeType) { - var content = null; - switch(resultType) { +function transformZipOutput(type, content, mimeType) { + switch(type) { case "blob" : - return utils.newBlob(dataArray, mimeType); + return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType); case "base64" : - content = concat(chunkType, dataArray); return base64.encode(content); default : - content = concat(chunkType, dataArray); - return utils.transformTo(resultType, content); + return utils.transformTo(type, content); } } @@ -2564,7 +2596,7 @@ function accumulate(helper, updateCallback) { }) .on('end', function (){ try { - var result = transformZipOutput(resultType, chunkType, dataArray, mimeType); + var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType); resolve(result); } catch (e) { reject(e); @@ -2586,8 +2618,6 @@ function StreamHelper(worker, outputType, mimeType) { var internalType = outputType; switch(outputType) { case "blob": - internalType = "arraybuffer"; - break; case "arraybuffer": internalType = "uint8array"; break; @@ -2707,7 +2737,7 @@ else { } catch (e) { try { - var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; + var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; var builder = new Builder(); builder.append(buffer); exports.blob = builder.getBlob('application/zip').size === 0; @@ -2895,7 +2925,7 @@ var buf2string = function (buf) { */ exports.utf8encode = function utf8encode(str) { if (support.nodebuffer) { - return nodejsUtils.newBuffer(str, "utf-8"); + return nodejsUtils.newBufferFrom(str, "utf-8"); } return string2buf(str); @@ -3007,7 +3037,7 @@ exports.Utf8EncodeWorker = Utf8EncodeWorker; var support = require('./support'); var base64 = require('./base64'); var nodejsUtils = require('./nodejsUtils'); -var setImmediate = require('core-js/library/fn/set-immediate'); +var setImmediate = require('set-immediate-shim'); var external = require("./external"); @@ -3030,18 +3060,23 @@ function string2binary(str) { /** * Create a new blob with the given content and the given type. - * @param {Array[String|ArrayBuffer]} parts the content to put in the blob. DO NOT use + * @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use * an Uint8Array because the stock browser of android 4 won't accept it (it * will be silently converted to a string, "[object Uint8Array]"). + * + * Use only ONE part to build the blob to avoid a memory leak in IE11 / Edge: + * when a large amount of Array is used to create the Blob, the amount of + * memory consumed is nearly 100 times the original data amount. + * * @param {String} type the mime type of the blob. * @return {Blob} the created blob. */ -exports.newBlob = function(parts, type) { +exports.newBlob = function(part, type) { exports.checkSupport("blob"); try { // Blob constructor - return new Blob(parts, { + return new Blob([part], { type: type }); } @@ -3049,11 +3084,9 @@ exports.newBlob = function(parts, type) { try { // deprecated, browser only, old way - var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; + var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; var builder = new Builder(); - for (var i = 0; i < parts.length; i++) { - builder.append(parts[i]); - } + builder.append(part); return builder.getBlob(type); } catch (e) { @@ -3149,7 +3182,7 @@ var arrayToStringHelper = { */ nodebuffer : (function () { try { - return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.newBuffer(1)).length === 1; + return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1; } catch (e) { return false; } @@ -3229,7 +3262,7 @@ transform["string"] = { return stringToArrayLike(input, new Uint8Array(input.length)); }, "nodebuffer": function(input) { - return stringToArrayLike(input, nodejsUtils.newBuffer(input.length)); + return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length)); } }; @@ -3244,7 +3277,7 @@ transform["array"] = { return new Uint8Array(input); }, "nodebuffer": function(input) { - return nodejsUtils.newBuffer(input); + return nodejsUtils.newBufferFrom(input); } }; @@ -3261,7 +3294,7 @@ transform["arraybuffer"] = { return new Uint8Array(input); }, "nodebuffer": function(input) { - return nodejsUtils.newBuffer(new Uint8Array(input)); + return nodejsUtils.newBufferFrom(new Uint8Array(input)); } }; @@ -3272,17 +3305,11 @@ transform["uint8array"] = { return arrayLikeToArrayLike(input, new Array(input.length)); }, "arraybuffer": function(input) { - // copy the uint8array: DO NOT propagate the original ArrayBuffer, it - // can be way larger (the whole zip file for example). - var copy = new Uint8Array(input.length); - if (input.length) { - copy.set(input, 0); - } - return copy.buffer; + return input.buffer; }, "uint8array": identity, "nodebuffer": function(input) { - return nodejsUtils.newBuffer(input); + return nodejsUtils.newBufferFrom(input); } }; @@ -3432,8 +3459,8 @@ exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinarySt // if inputData is already a promise, this flatten it. var promise = external.Promise.resolve(inputData).then(function(data) { - - + + var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1); if (isBlob && typeof FileReader !== "undefined") { @@ -3458,7 +3485,8 @@ exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinarySt if (!dataType) { return external.Promise.reject( - new Error("The data of '" + name + "' is in an unsupported format !") + new Error("Can't read the data of '" + name + "'. Is it " + + "in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?") ); } // special case : it's way easier to work with Uint8Array than with ArrayBuffer @@ -3481,7 +3509,7 @@ exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinarySt }); }; -},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"core-js/library/fn/set-immediate":36}],33:[function(require,module,exports){ +},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(require,module,exports){ 'use strict'; var readerFor = require('./reader/readerFor'); var utils = require('./utils'); @@ -3501,7 +3529,7 @@ function ZipEntries(loadOptions) { } ZipEntries.prototype = { /** - * Check that the reader is on the speficied signature. + * Check that the reader is on the specified signature. * @param {string} expectedSignature the expected signature. * @throws {Error} if it is an other signature. */ @@ -3509,7 +3537,7 @@ ZipEntries.prototype = { if (!this.reader.readAndCheckSignature(expectedSignature)) { this.reader.index -= 4; var signature = this.reader.readString(4); - throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); + throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); } }, /** @@ -3650,9 +3678,9 @@ ZipEntries.prototype = { if (isGarbage) { throw new Error("Can't find end of central directory : is this a zip file ? " + - "If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html"); + "If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"); } else { - throw new Error("Corrupted zip : can't find end of central directory"); + throw new Error("Corrupted zip: can't find end of central directory"); } } @@ -3677,7 +3705,7 @@ ZipEntries.prototype = { /* Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from - the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents + the zip file can fit into a 32bits integer. This cannot be solved : JavaScript represents all numbers as 64-bit double precision IEEE 754 floating point numbers. So, we have 53bits for integers and bitwise operations treat everything as 32bits. see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators @@ -3687,7 +3715,7 @@ ZipEntries.prototype = { // should look for a zip64 EOCD locator offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); if (offset < 0) { - throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); + throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); } this.reader.setIndex(offset); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); @@ -3698,7 +3726,7 @@ ZipEntries.prototype = { // console.warn("ZIP64 end of central directory not where expected."); this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); if (this.relativeOffsetEndOfZip64CentralDir < 0) { - throw new Error("Corrupted zip : can't find the ZIP64 end of central directory"); + throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); } } this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); @@ -4079,20 +4107,29 @@ ZipObject.prototype = { * @return StreamHelper the stream. */ internalStream: function (type) { - var outputType = type.toLowerCase(); - var askUnicodeString = outputType === "string" || outputType === "text"; - if (outputType === "binarystring" || outputType === "text") { - outputType = "string"; - } - var result = this._decompressWorker(); + var result = null, outputType = "string"; + try { + if (!type) { + throw new Error("No output type specified."); + } + outputType = type.toLowerCase(); + var askUnicodeString = outputType === "string" || outputType === "text"; + if (outputType === "binarystring" || outputType === "text") { + outputType = "string"; + } + result = this._decompressWorker(); - var isUnicodeString = !this._dataBinary; + var isUnicodeString = !this._dataBinary; - if (isUnicodeString && !askUnicodeString) { - result = result.pipe(new utf8.Utf8EncodeWorker()); - } - if (!isUnicodeString && askUnicodeString) { - result = result.pipe(new utf8.Utf8DecodeWorker()); + if (isUnicodeString && !askUnicodeString) { + result = result.pipe(new utf8.Utf8EncodeWorker()); + } + if (!isUnicodeString && askUnicodeString) { + result = result.pipe(new utf8.Utf8DecodeWorker()); + } + } catch (e) { + result = new GenericWorker("error"); + result.error(e); } return new StreamHelper(result, outputType, ""); @@ -4166,296 +4203,6 @@ for(var i = 0; i < removedMethods.length; i++) { module.exports = ZipObject; },{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(require,module,exports){ -require('../modules/web.immediate'); -module.exports = require('../modules/_core').setImmediate; -},{"../modules/_core":40,"../modules/web.immediate":56}],37:[function(require,module,exports){ -module.exports = function(it){ - if(typeof it != 'function')throw TypeError(it + ' is not a function!'); - return it; -}; -},{}],38:[function(require,module,exports){ -var isObject = require('./_is-object'); -module.exports = function(it){ - if(!isObject(it))throw TypeError(it + ' is not an object!'); - return it; -}; -},{"./_is-object":51}],39:[function(require,module,exports){ -var toString = {}.toString; - -module.exports = function(it){ - return toString.call(it).slice(8, -1); -}; -},{}],40:[function(require,module,exports){ -var core = module.exports = {version: '2.3.0'}; -if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef -},{}],41:[function(require,module,exports){ -// optional / simple context binding -var aFunction = require('./_a-function'); -module.exports = function(fn, that, length){ - aFunction(fn); - if(that === undefined)return fn; - switch(length){ - case 1: return function(a){ - return fn.call(that, a); - }; - case 2: return function(a, b){ - return fn.call(that, a, b); - }; - case 3: return function(a, b, c){ - return fn.call(that, a, b, c); - }; - } - return function(/* ...args */){ - return fn.apply(that, arguments); - }; -}; -},{"./_a-function":37}],42:[function(require,module,exports){ -// Thank's IE8 for his funny defineProperty -module.exports = !require('./_fails')(function(){ - return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; -}); -},{"./_fails":45}],43:[function(require,module,exports){ -var isObject = require('./_is-object') - , document = require('./_global').document - // in old IE typeof document.createElement is 'object' - , is = isObject(document) && isObject(document.createElement); -module.exports = function(it){ - return is ? document.createElement(it) : {}; -}; -},{"./_global":46,"./_is-object":51}],44:[function(require,module,exports){ -var global = require('./_global') - , core = require('./_core') - , ctx = require('./_ctx') - , hide = require('./_hide') - , PROTOTYPE = 'prototype'; - -var $export = function(type, name, source){ - var IS_FORCED = type & $export.F - , IS_GLOBAL = type & $export.G - , IS_STATIC = type & $export.S - , IS_PROTO = type & $export.P - , IS_BIND = type & $export.B - , IS_WRAP = type & $export.W - , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) - , expProto = exports[PROTOTYPE] - , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] - , key, own, out; - if(IS_GLOBAL)source = name; - for(key in source){ - // contains in native - own = !IS_FORCED && target && target[key] !== undefined; - if(own && key in exports)continue; - // export native or passed - out = own ? target[key] : source[key]; - // prevent global pollution for namespaces - exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] - // bind timers to global for call from export context - : IS_BIND && own ? ctx(out, global) - // wrap global constructors for prevent change them in library - : IS_WRAP && target[key] == out ? (function(C){ - var F = function(a, b, c){ - if(this instanceof C){ - switch(arguments.length){ - case 0: return new C; - case 1: return new C(a); - case 2: return new C(a, b); - } return new C(a, b, c); - } return C.apply(this, arguments); - }; - F[PROTOTYPE] = C[PROTOTYPE]; - return F; - // make static versions for prototype methods - })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% - if(IS_PROTO){ - (exports.virtual || (exports.virtual = {}))[key] = out; - // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% - if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out); - } - } -}; -// type bitmap -$export.F = 1; // forced -$export.G = 2; // global -$export.S = 4; // static -$export.P = 8; // proto -$export.B = 16; // bind -$export.W = 32; // wrap -$export.U = 64; // safe -$export.R = 128; // real proto method for `library` -module.exports = $export; -},{"./_core":40,"./_ctx":41,"./_global":46,"./_hide":47}],45:[function(require,module,exports){ -module.exports = function(exec){ - try { - return !!exec(); - } catch(e){ - return true; - } -}; -},{}],46:[function(require,module,exports){ -// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 -var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); -if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef -},{}],47:[function(require,module,exports){ -var dP = require('./_object-dp') - , createDesc = require('./_property-desc'); -module.exports = require('./_descriptors') ? function(object, key, value){ - return dP.f(object, key, createDesc(1, value)); -} : function(object, key, value){ - object[key] = value; - return object; -}; -},{"./_descriptors":42,"./_object-dp":52,"./_property-desc":53}],48:[function(require,module,exports){ -module.exports = require('./_global').document && document.documentElement; -},{"./_global":46}],49:[function(require,module,exports){ -module.exports = !require('./_descriptors') && !require('./_fails')(function(){ - return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7; -}); -},{"./_descriptors":42,"./_dom-create":43,"./_fails":45}],50:[function(require,module,exports){ -// fast apply, http://jsperf.lnkit.com/fast-apply/5 -module.exports = function(fn, args, that){ - var un = that === undefined; - switch(args.length){ - case 0: return un ? fn() - : fn.call(that); - case 1: return un ? fn(args[0]) - : fn.call(that, args[0]); - case 2: return un ? fn(args[0], args[1]) - : fn.call(that, args[0], args[1]); - case 3: return un ? fn(args[0], args[1], args[2]) - : fn.call(that, args[0], args[1], args[2]); - case 4: return un ? fn(args[0], args[1], args[2], args[3]) - : fn.call(that, args[0], args[1], args[2], args[3]); - } return fn.apply(that, args); -}; -},{}],51:[function(require,module,exports){ -module.exports = function(it){ - return typeof it === 'object' ? it !== null : typeof it === 'function'; -}; -},{}],52:[function(require,module,exports){ -var anObject = require('./_an-object') - , IE8_DOM_DEFINE = require('./_ie8-dom-define') - , toPrimitive = require('./_to-primitive') - , dP = Object.defineProperty; - -exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes){ - anObject(O); - P = toPrimitive(P, true); - anObject(Attributes); - if(IE8_DOM_DEFINE)try { - return dP(O, P, Attributes); - } catch(e){ /* empty */ } - if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); - if('value' in Attributes)O[P] = Attributes.value; - return O; -}; -},{"./_an-object":38,"./_descriptors":42,"./_ie8-dom-define":49,"./_to-primitive":55}],53:[function(require,module,exports){ -module.exports = function(bitmap, value){ - return { - enumerable : !(bitmap & 1), - configurable: !(bitmap & 2), - writable : !(bitmap & 4), - value : value - }; -}; -},{}],54:[function(require,module,exports){ -var ctx = require('./_ctx') - , invoke = require('./_invoke') - , html = require('./_html') - , cel = require('./_dom-create') - , global = require('./_global') - , process = global.process - , setTask = global.setImmediate - , clearTask = global.clearImmediate - , MessageChannel = global.MessageChannel - , counter = 0 - , queue = {} - , ONREADYSTATECHANGE = 'onreadystatechange' - , defer, channel, port; -var run = function(){ - var id = +this; - if(queue.hasOwnProperty(id)){ - var fn = queue[id]; - delete queue[id]; - fn(); - } -}; -var listener = function(event){ - run.call(event.data); -}; -// Node.js 0.9+ & IE10+ has setImmediate, otherwise: -if(!setTask || !clearTask){ - setTask = function setImmediate(fn){ - var args = [], i = 1; - while(arguments.length > i)args.push(arguments[i++]); - queue[++counter] = function(){ - invoke(typeof fn == 'function' ? fn : Function(fn), args); - }; - defer(counter); - return counter; - }; - clearTask = function clearImmediate(id){ - delete queue[id]; - }; - // Node.js 0.8- - if(require('./_cof')(process) == 'process'){ - defer = function(id){ - process.nextTick(ctx(run, id, 1)); - }; - // Browsers with MessageChannel, includes WebWorkers - } else if(MessageChannel){ - channel = new MessageChannel; - port = channel.port2; - channel.port1.onmessage = listener; - defer = ctx(port.postMessage, port, 1); - // Browsers with postMessage, skip WebWorkers - // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' - } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){ - defer = function(id){ - global.postMessage(id + '', '*'); - }; - global.addEventListener('message', listener, false); - // IE8- - } else if(ONREADYSTATECHANGE in cel('script')){ - defer = function(id){ - html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){ - html.removeChild(this); - run.call(id); - }; - }; - // Rest old browsers - } else { - defer = function(id){ - setTimeout(ctx(run, id, 1), 0); - }; - } -} -module.exports = { - set: setTask, - clear: clearTask -}; -},{"./_cof":39,"./_ctx":41,"./_dom-create":43,"./_global":46,"./_html":48,"./_invoke":50}],55:[function(require,module,exports){ -// 7.1.1 ToPrimitive(input [, PreferredType]) -var isObject = require('./_is-object'); -// instead of the ES6 spec version, we didn't implement @@toPrimitive case -// and the second argument - flag - preferred type is a string -module.exports = function(it, S){ - if(!isObject(it))return it; - var fn, val; - if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; - if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; - if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; - throw TypeError("Can't convert object to primitive value"); -}; -},{"./_is-object":51}],56:[function(require,module,exports){ -var $export = require('./_export') - , $task = require('./_task'); -$export($export.G + $export.B, { - setImmediate: $task.set, - clearImmediate: $task.clear -}); -},{"./_export":44,"./_task":54}],57:[function(require,module,exports){ (function (global){ 'use strict'; var Mutation = global.MutationObserver || global.WebKitMutationObserver; @@ -4528,7 +4275,7 @@ function immediate(task) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],58:[function(require,module,exports){ +},{}],37:[function(require,module,exports){ 'use strict'; var immediate = require('immediate'); @@ -4555,6 +4302,26 @@ function Promise(resolver) { } } +Promise.prototype["finally"] = function (callback) { + if (typeof callback !== 'function') { + return this; + } + var p = this.constructor; + return this.then(resolve, reject); + + function resolve(value) { + function yes () { + return value; + } + return p.resolve(callback()).then(yes); + } + function reject(reason) { + function no () { + throw reason; + } + return p.resolve(callback()).then(no); + } +}; Promise.prototype["catch"] = function (onRejected) { return this.then(null, onRejected); }; @@ -4647,7 +4414,7 @@ handlers.reject = function (self, error) { function getThen(obj) { // Make sure we only access the accessor once as required by the spec var then = obj && obj.then; - if (obj && typeof obj === 'object' && typeof then === 'function') { + if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') { return function appyThen() { then.apply(obj, arguments); }; @@ -4783,7 +4550,7 @@ function race(iterable) { } } -},{"immediate":57}],59:[function(require,module,exports){ +},{"immediate":36}],38:[function(require,module,exports){ // Top level file is just a mixin of submodules & constants 'use strict'; @@ -4799,7 +4566,7 @@ assign(pako, deflate, inflate, constants); module.exports = pako; -},{"./lib/deflate":60,"./lib/inflate":61,"./lib/utils/common":62,"./lib/zlib/constants":65}],60:[function(require,module,exports){ +},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(require,module,exports){ 'use strict'; @@ -5160,7 +4927,7 @@ function deflate(input, options) { deflator.push(input, true); // That will never happens, if you don't cheat with options :) - if (deflator.err) { throw deflator.msg; } + if (deflator.err) { throw deflator.msg || msg[deflator.err]; } return deflator.result; } @@ -5201,7 +4968,7 @@ exports.deflate = deflate; exports.deflateRaw = deflateRaw; exports.gzip = gzip; -},{"./utils/common":62,"./utils/strings":63,"./zlib/deflate":67,"./zlib/messages":72,"./zlib/zstream":74}],61:[function(require,module,exports){ +},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(require,module,exports){ 'use strict'; @@ -5585,7 +5352,7 @@ function inflate(input, options) { inflator.push(input, true); // That will never happens, if you don't cheat with options :) - if (inflator.err) { throw inflator.msg; } + if (inflator.err) { throw inflator.msg || msg[inflator.err]; } return inflator.result; } @@ -5621,7 +5388,7 @@ exports.inflate = inflate; exports.inflateRaw = inflateRaw; exports.ungzip = inflate; -},{"./utils/common":62,"./utils/strings":63,"./zlib/constants":65,"./zlib/gzheader":68,"./zlib/inflate":70,"./zlib/messages":72,"./zlib/zstream":74}],62:[function(require,module,exports){ +},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(require,module,exports){ 'use strict'; @@ -5725,7 +5492,7 @@ exports.setTyped = function (on) { exports.setTyped(TYPED_OK); -},{}],63:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ // String encode/decode helpers 'use strict'; @@ -5912,13 +5679,32 @@ exports.utf8border = function (buf, max) { return (pos + _utf8len[buf[pos]] > max) ? pos : max; }; -},{"./common":62}],64:[function(require,module,exports){ +},{"./common":41}],43:[function(require,module,exports){ 'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6. // It doesn't worth to make additional optimizationa as in original. // Small size is preferable. +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + function adler32(adler, buf, len, pos) { var s1 = (adler & 0xffff) |0, s2 = ((adler >>> 16) & 0xffff) |0, @@ -5946,9 +5732,27 @@ function adler32(adler, buf, len, pos) { module.exports = adler32; -},{}],65:[function(require,module,exports){ +},{}],44:[function(require,module,exports){ 'use strict'; +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. module.exports = { @@ -5998,13 +5802,31 @@ module.exports = { //Z_NULL: null // Use -1 or null inline, depending on var type }; -},{}],66:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ 'use strict'; // Note: we can't get significant speed boost here. // So write code to minimize size - no pregenerated tables // and array tools dependencies. +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. // Use ordinary array, since untyped makes no boost here function makeTable() { @@ -6041,9 +5863,28 @@ function crc32(crc, buf, len, pos) { module.exports = crc32; -},{}],67:[function(require,module,exports){ +},{}],46:[function(require,module,exports){ 'use strict'; +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + var utils = require('../utils/common'); var trees = require('./trees'); var adler32 = require('./adler32'); @@ -7898,9 +7739,27 @@ exports.deflatePrime = deflatePrime; exports.deflateTune = deflateTune; */ -},{"../utils/common":62,"./adler32":64,"./crc32":66,"./messages":72,"./trees":73}],68:[function(require,module,exports){ +},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(require,module,exports){ 'use strict'; +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. function GZheader() { /* true if compressed data believed to be text */ @@ -7940,9 +7799,28 @@ function GZheader() { module.exports = GZheader; -},{}],69:[function(require,module,exports){ +},{}],48:[function(require,module,exports){ 'use strict'; +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + // See state defs from inflate.js var BAD = 30; /* got a data error -- remain here until reset */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ @@ -8268,9 +8146,27 @@ module.exports = function inflate_fast(strm, start) { return; }; -},{}],70:[function(require,module,exports){ +},{}],49:[function(require,module,exports){ 'use strict'; +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. var utils = require('../utils/common'); var adler32 = require('./adler32'); @@ -9808,9 +9704,27 @@ exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ -},{"../utils/common":62,"./adler32":64,"./crc32":66,"./inffast":69,"./inftrees":71}],71:[function(require,module,exports){ +},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(require,module,exports){ 'use strict'; +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. var utils = require('../utils/common'); @@ -10038,10 +9952,8 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta return 1; } - var i = 0; /* process all codes and make table entries */ for (;;) { - i++; /* create table entry */ here_bits = len - drop; if (work[sym] < end) { @@ -10137,9 +10049,28 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta return 0; }; -},{"../utils/common":62}],72:[function(require,module,exports){ +},{"../utils/common":41}],51:[function(require,module,exports){ 'use strict'; +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + module.exports = { 2: 'need dictionary', /* Z_NEED_DICT 2 */ 1: 'stream end', /* Z_STREAM_END 1 */ @@ -10152,9 +10083,27 @@ module.exports = { '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; -},{}],73:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ 'use strict'; +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. var utils = require('../utils/common'); @@ -11356,9 +11305,27 @@ exports._tr_flush_block = _tr_flush_block; exports._tr_tally = _tr_tally; exports._tr_align = _tr_align; -},{"../utils/common":62}],74:[function(require,module,exports){ +},{"../utils/common":41}],53:[function(require,module,exports){ 'use strict'; +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. function ZStream() { /* next input byte */ @@ -11387,5 +11354,14 @@ function ZStream() { module.exports = ZStream; +},{}],54:[function(require,module,exports){ +'use strict'; +module.exports = typeof setImmediate === 'function' ? setImmediate : + function setImmediate() { + var args = [].slice.apply(arguments); + args.splice(1, 0, 0); + setTimeout.apply(null, args); + }; + },{}]},{},[10])(10) }); \ No newline at end of file