diff --git a/dist/image-sequencer.js b/dist/image-sequencer.js index ffa4a442..51b44ac3 100644 --- a/dist/image-sequencer.js +++ b/dist/image-sequencer.js @@ -22639,1000 +22639,1000 @@ var info = { } module.exports = [Invert,info]; },{}],62:[function(require,module,exports){ -/** - * Copyright (c) 2015 Guyon Roche - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions:
- * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ -"use strict"; - -var _ = require("underscore"); - -var main = module.exports = { - Bitmap: require("./lib/bitmap") -}; - -_.extend(main, require("./lib/enums")); +/** + * Copyright (c) 2015 Guyon Roche + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ +"use strict"; + +var _ = require("underscore"); + +var main = module.exports = { + Bitmap: require("./lib/bitmap") +}; + +_.extend(main, require("./lib/enums")); },{"./lib/bitmap":63,"./lib/enums":64,"underscore":145}],63:[function(require,module,exports){ (function (Buffer){ -/** - * Copyright (c) 2015 Guyon Roche - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ -"use strict"; - -var fs = require("fs"); -var _ = require("underscore"); -var Promise = require("bluebird"); -var jpeg = require("jpeg-js"); -//var png = require("png-js"); -var PNG = require("node-png").PNG; - -var Enums = require("./enums"); -var Utils = require("./utils"); -var Resize = require("./resize"); -//var Graphics = require("./graphics"); - -// default pad colour -var transparentBlack = { - r: 0, g: 0, b: 0, a: 0 -}; - -var Bitmap = module.exports = function(options) { - if (options) { - if (options instanceof Bitmap) { - this._data = { - data: new Buffer(options.data.data), - width: options.width, - height: options.height - }; - } else if (options.data) { - // attach to supplied data - this._data = options; - } else if (options.width && options.height) { - // construct new bitmap - this._data = { - data: new Buffer(4 * options.width * options.height), - width: options.width, - height: options.height - }; - - // optional colour - if (options.color) { - this._fill(options.color); - } - } - } -}; - -Bitmap.prototype = { - get width() { - return this._data.width; - }, - get height() { - return this._data.height; - }, - //get graphics() { - // if (!this._graphics) { - // this._graphics = new Graphics(this); - // } - // return this._graphics; - //}, - - attach: function(data) { - var prev = this._data; - this._data = data; - return prev; - }, - detach: function() { - var data = this._data; - delete this._data; - return data; - }, - - _deduceFileType: function(filename) { - if (!filename) { - throw new Error("Can't determine image type"); - } - switch (filename.substr(-4).toLowerCase()) { - case ".jpg": - return Enums.ImageType.JPG; - case ".png": - return Enums.ImageType.PNG; - } - if (filename.substr(-5).toLowerCase() == ".jpeg") { - return Enums.ImageType.JPG; - } - throw new Error("Can't recognise image type: " + filename); - }, - - _readStream: function(stream) { - var self = this; - var deferred = Promise.defer(); - - var chunks = []; - stream.on('data', function(chunk) { - chunks.push(chunk); - }); - stream.on('end', function() { - var data = Buffer.concat(chunks); - deferred.resolve(data); - }); - stream.on('error', function(error) { - deferred.reject(error); - }); - - return deferred.promise; - }, - _readPNG: function(stream) { - var deferred = Promise.defer(); - - var png = new PNG({filterType: 4}); - png.on('parsed', function() { - deferred.resolve(png); - }); - png.on('error', function(error) { - deferred.rejecyt(error); - }); - stream.pipe(png); - - return deferred.promise; - }, - _parseOptions: function(options, filename) { - options = options || {}; - if (typeof options === "number") { - options = { type: options }; - } - options.type = options.type || this._deduceFileType(filename); - return options; - }, - read: function(stream, options) { - var self = this; - options = this._parseOptions(options); - - switch(options.type) { - case Enums.ImageType.JPG: - return this._readStream(stream) - .then(function(data) { - self._data = jpeg.decode(data); - }); - case Enums.ImageType.PNG: - return this._readPNG(stream) - .then(function(png) { - self._data = { - data: png.data, - width: png.width, - height: png.height - }; - }); - default: - return Promise.reject(new Error("Not supported: ImageType " + options.type)); - } - }, - readFile: function(filename, options) { - var self = this; - return Utils.fs.exists(filename) - .then(function(exists) { - if (exists) { - options = self._parseOptions(options, filename); - var stream = fs.createReadStream(filename); - return self.read(stream, options); - } else { - throw new Error("File Not Found: " + filename); - } - }); - }, - - write: function(stream, options) { - options = this._parseOptions(options); - var deferred = Promise.defer(); - try { - stream.on('finish', function() { - deferred.resolve(); - }); - stream.on('error', function(error) { - deferred.reject(error); - }); - - switch(options.type) { - case Enums.ImageType.JPG: - var buffer = jpeg.encode(this._data, options.quality || 90).data; - stream.write(buffer); - stream.end(); - break; - case Enums.ImageType.PNG: - var png = new PNG(); - png.width = this.width; - png.height = this.height; - png.data = this._data.data; - png.on('end', function() { - deferred.resolve(); - }); - png.on('error', function(error) { - deferred.reject(error); - }); - png.pack().pipe(stream); - break; - default: - throw new Error("Not supported: ImageType " + options.type); - } - } - catch(ex) { - deferred.reject(ex); - } - return deferred.promise; - }, - writeFile: function(filename, options) { - options = this._parseOptions(options, filename); - var stream = fs.createWriteStream(filename); - return this.write(stream, options); - }, - - clone: function() { - return new Bitmap({ - width: this.width, - height: this.height, - data: new Buffer(this._data.data) - }); - }, - - setPixel: function(x,y, r,g,b,a) { - if (g === undefined) { - var color = r; - r = color.r; - g = color.g; - b = color.b; - a = color.a; - } - if (a === undefined) a = 255; - var pos = (y * this.width + x) * 4; - var buffer = this._data.data; - buffer[pos++] = r; - buffer[pos++] = g; - buffer[pos++] = b; - buffer[pos++] = a; - }, - getPixel: function(x,y, color) { - var pos = (y * this.width + x) * 4; - color = color || {}; - var buffer = this._data.data; - color.r = buffer[pos++]; - color.g = buffer[pos++]; - color.b = buffer[pos++]; - color.a = buffer[pos++]; - return color; - }, - - negative: function() { - var that = new Bitmap({width: this.width, height: this.height}); - var n = this.width * this.height; - - var src = this._data.data; - var dst = that._data.data; - var srcPos = 0; - var dstPos = 0; - for (var i = 0; i < n; i++) { - dst[dstPos++] = 255 - src[srcPos++]; - dst[dstPos++] = 255 - src[srcPos++]; - dst[dstPos++] = 255 - src[srcPos++]; - dst[dstPos++] = src[srcPos++]; - } - return that; - }, - - resize: function(options) { - var that = new Bitmap(options); - var temp; - switch (options.fit) { - case "pad": // fit all of src in dst with aspect ratio preserved. - var padColor = options.padColor || transparentBlack; - var srcAr = this.width / this.height; - var w2 = Math.round(srcAr * that.height); - var h2 = Math.round(that.width / srcAr); - var wMargin = 0; - var hMargin = 0; - if (w2 < that.width) { - // pad sides - temp = new Bitmap({width: w2, height: that.height}); - wMargin = (that.width - w2) / 2; - that._fill(padColor, 0, 0, Math.floor(wMargin), that.height); - that._fill(padColor, that.width - Math.ceil(wMargin), 0, Math.ceil(wMargin), that.height); - - Resize[options.algorithm](this, temp, options); - that._blt(temp, {left: Math.floor(wMargin), top: Math.floor(hMargin)}); - } else if (h2 < that.height) { - // pad top & bottom - temp = new Bitmap({width: that.width, height: h2}); - hMargin = (that.height - h2) / 2; - that._fill(padColor, 0, 0, that.width, Math.floor(hMargin)); - that._fill(padColor, 0, that.height - Math.ceil(hMargin), that.width, Math.ceil(hMargin)); - - Resize[options.algorithm](this, temp, options); - that._blt(temp, {left: Math.floor(wMargin), top: Math.floor(hMargin)}); - } else { - // stretch straight into that - Resize[options.algorithm](this, that, options); - } - break; - case "crop": // crop original to fit in dst with aspect ratio preserved - var gravity = options.gravity || {x: 0.5, y: 0.5}; - var dstAr = that.width / that.height; - var w2 = Math.round(dstAr * this.height); - var h2 = Math.round(this.width / dstAr); - if (w2 < this.width) { - // crop src width - var dw = this.width - w2; - temp = this.crop({left: Math.round(gravity.x * dw), top: 0, width: w2, height: this.height}); - } else if (h2 < this.height) { - // crop src height - var dh = this.height - h2; - temp = this.crop({left: 0, top: Math.round(gravity.y * dh), width: this.width, height: h2}); - } else { - temp = this; - } - Resize[options.algorithm](temp, that, options); - break; - case "stretch": - default: - Resize[options.algorithm](this, that, options); - break; - } - - return that; - }, - - rotate: function(options) { - // TODO: crop, user supplied dst width, height - - // options.degrees || options.radians; - // options.fit = ['pad','crop','same'] - // options.padColor - var radians = options.radians !== undefined ? options.radians : 3.141592653589793 * options.degrees / 180; - if (radians < 0.000000001) { - return new Bitmap(this); - } - //console.log("radians=" + radians); - - var rotators = { - forward: { - cos: Math.cos(radians), - sin: Math.sin(radians) - }, - backward: { - cos: Math.cos(-radians), - sin: Math.sin(-radians) - } - } - //console.log("cos=" + cos + ", sin=" + sin) - - var srcWidth = this.width; - var srcHeight = this.height; - var srcWidthHalf = srcWidth / 2; - var srcHeightHalf = srcHeight / 2; - - var padColor = options.padColor || transparentBlack; - var padArray = [padColor.r, padColor.g, padColor.b, padColor.a]; - var rotate = function(point, rotator) { - // in-place rotation of point - var x = rotator.cos * point.x - rotator.sin * point.y; - var y = rotator.sin * point.x + rotator.cos * point.y; - point.x = x; - point.y = y; - return point; - }; - var cropToSource = function(point) { - var m = Math.abs(point.x/srcWidthHalf); - var n = Math.abs(point.y/srcHeightHalf); - return Math.max(m,n); - }; - - var dstWidth, dstHeight; - switch (options.fit) { - case 'custom': - dstWidth = options.width; - dstHeight = options.height; - break; - case 'pad': - // entire src fits in dst - var tl = rotate({x:-srcWidthHalf,y:srcHeightHalf}, rotators.forward); - var tr = rotate({x:srcWidthHalf,y:srcHeightHalf}, rotators.forward); - var bl = rotate({x:-srcWidthHalf,y:-srcHeightHalf}, rotators.forward); - var br = rotate({x:srcWidthHalf,y:-srcHeightHalf}, rotators.forward); - dstWidth = Math.round(Math.max(tl.x,tr.x,bl.x,br.x) - Math.min(tl.x,tr.x,bl.x,br.x)); - dstHeight = Math.round(Math.max(tl.y,tr.y,bl.y,br.y) - Math.min(tl.y,tr.y,bl.y,br.y)); - break; - case 'crop': - var tl = rotate({x:-srcWidthHalf,y:srcHeightHalf}, rotators.forward); - var tr = rotate({x:srcWidthHalf,y:srcHeightHalf}, rotators.forward); - var bl = rotate({x:-srcWidthHalf,y:-srcHeightHalf}, rotators.forward); - var br = rotate({x:srcWidthHalf,y:-srcHeightHalf}, rotators.forward); - var d = Math.max(cropToSource(tl), cropToSource(tr), cropToSource(bl), cropToSource(br)); - dstWidth = Math.floor(srcWidth / d); - dstHeight = Math.floor(srcHeight / d); - break; - case 'same': - default: - // dst is same size as src - dstWidth = srcWidth; - dstHeight = srcHeight; - break; - } - - var that = new Bitmap({width: dstWidth, height: dstHeight}); - - var srcBuf = this._data.data; - var dstBuf = that._data.data; - - // we will rotate the destination pixels back to the source and interpolate the colour - var srcCoord = {}; - var dstWidthHalf = dstWidth / 2; - var dstHeightHalf = dstHeight / 2; - var dstWidth4 = dstWidth * 4; - var srcWidth4 = srcWidth * 4; - - //console.log("src=[" + srcWidth + "," + srcHeight + "]") - //console.log("dst=[" + dstWidth + "," + dstHeight + "]") - for (var i = 0; i < dstHeight; i++) { - for (var j = 0; j < dstWidth; j++) { - // calculate src coords - srcCoord.x = j - dstWidthHalf; - srcCoord.y = dstHeightHalf - i; - //console.log("x=" + srcCoord.x + ", y=" + srcCoord.y); - rotate(srcCoord, rotators.backward); - //console.log(" ==> x=" + srcCoord.x + ", y=" + srcCoord.y); - - // srcX and SrcY are in src coords - var srcX = srcCoord.x + srcWidthHalf; - var srcY = srcHeightHalf - srcCoord.y; - //console.log("srcX=" + srcX + ", srcY=" + srcY); - - // now interpolate (bilinear! - var dstPos = (i * dstWidth + j) * 4; - //console.log("dstPos=" + dstPos) - if ((srcX > -1) && (srcX < srcWidth) && (srcY > -1) && (srcY < srcHeight)) { - var srcPosX = Math.floor(srcX); - var srcPosY = Math.floor(srcY); - var srcPos = (srcPosY * srcWidth + srcPosX) * 4; - for (var k = 0; k < 4; k++) { - var kSrcPos = srcPos + k; - var kPad = padArray[k]; - - var tl = ((srcX >= 0) && (srcY >= 0)) ? srcBuf[kSrcPos] : kPad; - var tr = ((srcX < srcWidth-1) && (srcY >= 0)) ? srcBuf[kSrcPos+4] : kPad; - var bl = ((srcX >= 0) && (srcY < srcHeight-1)) ? srcBuf[kSrcPos + srcWidth4] : kPad; - var br = ((srcX < srcWidth-1) && (srcY < srcHeight-1)) ? srcBuf[kSrcPos + srcWidth4 + 4] : kPad; - - var tx = srcX - srcPosX; - var ty = srcY - srcPosY; - - var t = (1-tx) * tl + tx * tr; - var b = (1-tx) * bl + tx * br; - dstBuf[dstPos++] = (1-ty) * t + ty * b; - } - } else { - dstBuf[dstPos++] = padColor.r; - dstBuf[dstPos++] = padColor.g; - dstBuf[dstPos++] = padColor.b; - dstBuf[dstPos++] = padColor.a; - } - } - } - return that; - }, - - crop: function(options) { - var t = options.top; - var l = options.left; - var w = options.width; - var h = options.height; - //console.log("Crop: l="+l + ", t="+t + ", w="+w + ", h="+h); - - var that = new Bitmap({width: w, height: h}); - - var srcBuf = this._data.data; - var dstBuf = that._data.data; - - var w4 = w * 4; - for (var i = 0; i < h; i++) { - var srcPos = ((i+t)*this.width + l) * 4; - var dstPos = i * w * 4; - srcBuf.copy(dstBuf, dstPos, srcPos, srcPos + w4); - } - return that; - }, - - blur: function(options) { - // todo: expand to own file with different blur algorithms - var that = new Bitmap({width: this.width, height: this.height}); - var w = this.width; - var h = this.height; - - var W = w-1; - var H = h-1; - - var V = w*4; // used for i offsets - - var src = this._data.data; - var dst = that._data.data; - for (var i = 0; i < h; i++) { - for (var j = 0; j < w; j++) { - for (var k = 0; k < 4; k++) { - var pos = (i*w + j) * 4 + k; - var t = src[pos -(i>0?V:0) - (j>0?4:0)] * 1 + // 1/16 - src[pos -(i>0?V:0) ] * 2 + // 2/16 - src[pos -(i>0?V:0) + (jl;)u=T[p++],f =3&&0===t.bl_tree[2*A[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),u=t.opt_len+3+7>>>3,(l=t.static_len+3+7>>>3)<=u&&(u=l)):u=l=n+5,n+4<=u&&-1!==e?et(t,e,n,r):t.strategy===i||l===u?(q(t,(c<<1)+(r?1:0),3),$(t,C,M)):(q(t,(f<<1)+(r?1:0),3),function(t,e,n,r){var i;for(q(t,e-257,5),q(t,n-1,5),q(t,r-4,4),i=0;i=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(l,w,S)):S[0]+w+S[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,n,r,i,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),T(r,i)||(o="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=v(n)?c(t,u.value,null):c(t,u.value,n-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n")):s=t.stylize("[Circular]","special")),_(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function v(t){return null===t}function g(t){return"number"==typeof t}function m(t){return"string"==typeof t}function _(t){return void 0===t}function y(t){return w(t)&&"[object RegExp]"===E(t)}function w(t){return"object"==typeof t&&null!==t}function b(t){return w(t)&&"[object Date]"===E(t)}function x(t){return w(t)&&("[object Error]"===E(t)||t instanceof Error)}function k(t){return"function"==typeof t}function E(t){return Object.prototype.toString.call(t)}function S(t){return t<10?"0"+t.toString(10):t.toString(10)}n.debuglog=function(t){if(_(a)&&(a=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(a)){var r=e.pid;o[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else o[t]=function(){};return o[t]},n.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=d,n.isNull=v,n.isNullOrUndefined=function(t){return null==t},n.isNumber=g,n.isString=m,n.isSymbol=function(t){return"symbol"==typeof t},n.isUndefined=_,n.isRegExp=y,n.isObject=w,n.isDate=b,n.isError=x,n.isFunction=k,n.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},n.isBuffer=t("./support/isBuffer");var j=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}n.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[S(t.getHours()),S(t.getMinutes()),S(t.getSeconds())].join(":"),[t.getDate(),j[t.getMonth()],e].join(" ")),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!w(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":43,_process:117,inherits:42}],45:[function(t,e,n){(function(e,r){"use strict";var i=t("assert"),a=t("pako/lib/zlib/zstream"),o=t("pako/lib/zlib/deflate.js"),s=t("pako/lib/zlib/inflate.js"),u=t("pako/lib/zlib/constants");for(var l in u)n[l]=u[l];n.NONE=0,n.DEFLATE=1,n.INFLATE=2,n.GZIP=3,n.GUNZIP=4,n.DEFLATERAW=5,n.INFLATERAW=6,n.UNZIP=7;function c(t){if("number"!=typeof t||t>1,c=-7,f=n?i-1:0,h=n?-1:1,p=t[e+f];for(f+=h,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=l}return(p?-1:1)*o*Math.pow(2,a-r)},n.write=function(t,e,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<