jimp
Version:
An image processing library written entirely in JavaScript (i.e. zero external or native dependencies)
27 lines (23 loc) • 593 kB
JavaScript
/*
Jimp v0.10.2
https://github.com/oliver-moran/jimp
Ported for the Web by Phil Seaton
MIT License
Copyright (c) 2018 Oliver Moran
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((void 0===window||!window)&&"undefined"!=typeof self)var window=self;!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{(void 0!==window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jimp=t()}}(function(){return function a(o,s,l){function u(e,t){if(!s[e]){if(!o[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(f)return f(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[e]={exports:{}};o[e][0].call(i.exports,function(t){return u(o[e][1][t]||t)},i,i.exports,a,o,s,l)}return s[e].exports}for(var f="function"==typeof require&&require,t=0;t<l.length;t++)u(l[t]);return u}({1:[function(t,e,r){e.exports=function(t){if(Array.isArray(t))return t}},{}],2:[function(t,e,r){e.exports=function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}},{}],3:[function(t,e,r){e.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},{}],4:[function(t,e,r){e.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},{}],5:[function(t,n,e){var a=t("./setPrototypeOf");function i(t,e,r){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?n.exports=i=function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&a(i,r.prototype),i}:n.exports=i=Reflect.construct,i.apply(null,arguments)}n.exports=i},{"./setPrototypeOf":17}],6:[function(t,e,r){function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}e.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},{}],7:[function(t,e,r){e.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},{}],8:[function(t,e,r){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}e.exports=n},{}],9:[function(t,e,r){var n=t("./setPrototypeOf");e.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},{"./setPrototypeOf":17}],10:[function(t,e,r){e.exports=function(t){return t&&t.__esModule?t:{default:t}}},{}],11:[function(t,e,r){var o=t("../helpers/typeof");function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}e.exports=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==o(t)&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var a=n?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=t[i]}return r.default=t,e&&e.set(t,r),r}},{"../helpers/typeof":20}],12:[function(t,e,r){e.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},{}],13:[function(t,e,r){e.exports=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(t){i=!0,a=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw a}}return r}}},{}],14:[function(t,e,r){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},{}],15:[function(t,e,r){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},{}],16:[function(t,e,r){var n=t("../helpers/typeof"),i=t("./assertThisInitialized");e.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?i(t):e}},{"../helpers/typeof":20,"./assertThisInitialized":3}],17:[function(t,r,e){function n(t,e){return r.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}r.exports=n},{}],18:[function(t,e,r){var n=t("./arrayWithHoles"),i=t("./iterableToArrayLimit"),a=t("./nonIterableRest");e.exports=function(t,e){return n(t)||i(t,e)||a()}},{"./arrayWithHoles":1,"./iterableToArrayLimit":13,"./nonIterableRest":14}],19:[function(t,e,r){var n=t("./arrayWithoutHoles"),i=t("./iterableToArray"),a=t("./nonIterableSpread");e.exports=function(t){return n(t)||i(t)||a()}},{"./arrayWithoutHoles":2,"./iterableToArray":12,"./nonIterableSpread":15}],20:[function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=i=function(t){return n(t)}:e.exports=i=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},i(t)}e.exports=i},{}],21:[function(t,e,r){e.exports=t("regenerator-runtime")},{"regenerator-runtime":332}],22:[function(t,e,r){var n=t("./src/converter");function i(t,e){var r=new n(t,e);return function(t){return r.convert(t)}}i.BIN="01",i.OCT="01234567",i.DEC="0123456789",i.HEX="0123456789abcdef",e.exports=i},{"./src/converter":23}],23:[function(t,e,r){"use strict";function n(t,e){if(!(t&&e&&t.length&&e.length))throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=e}n.prototype.convert=function(t){var e,r,n,i={},a=this.srcAlphabet.length,o=this.dstAlphabet.length,s=t.length,l="string"==typeof t?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(e=0;e<s;e++)i[e]=this.srcAlphabet.indexOf(t[e]);do{for(e=n=r=0;e<s;e++)o<=(r=r*a+i[e])?(i[n++]=parseInt(r/o,10),r%=o):0<n&&(i[n++]=0);s=n,l=this.dstAlphabet.slice(r,r+1).concat(l)}while(0!==n);return l},n.prototype.isValid=function(t){for(var e=0;e<t.length;++e)if(-1===this.srcAlphabet.indexOf(t[e]))return!1;return!0},e.exports=n},{}],24:[function(x,E,t){(function(e){"use strict";var t=x("object-assign");function a(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i<a;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function o(t){return e.Buffer&&"function"==typeof e.Buffer.isBuffer?e.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var f=x("util/"),n=Object.prototype.hasOwnProperty,h=Array.prototype.slice,r="foo"===function(){}.name;function s(t){return Object.prototype.toString.call(t)}function l(t){return!o(t)&&("function"==typeof e.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var u=E.exports=m,i=/\s*function\s+([^\(\s]*)\s*/;function c(t){if(f.isFunction(t)){if(r)return t.name;var e=t.toString().match(i);return e&&e[1]}}function d(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function p(t){if(r||!f.isFunction(t))return f.inspect(t);var e=c(t);return"[Function"+(e?": "+e:"")+"]"}function b(t,e,r,n,i){throw new u.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function m(t,e){t||b(t,!0,e,"==",u.ok)}function g(t,e,r,n){if(t===e)return!0;if(o(t)&&o(e))return 0===a(t,e);if(f.isDate(t)&&f.isDate(e))return t.getTime()===e.getTime();if(f.isRegExp(t)&&f.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(l(t)&&l(e)&&s(t)===s(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===a(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(o(t)!==o(e))return!1;var i=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==i&&i===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(f.isPrimitive(t)||f.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=y(t),a=y(e);if(i&&!a||!i&&a)return!1;if(i)return t=h.call(t),e=h.call(e),g(t,e,r);var o,s,l=w(t),u=w(e);if(l.length!==u.length)return!1;for(l.sort(),u.sort(),s=l.length-1;0<=s;s--)if(l[s]!==u[s])return!1;for(s=l.length-1;0<=s;s--)if(o=l[s],!g(t[o],e[o],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function y(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function v(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function _(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&b(i,r,"Missing expected exception"+n);var a="string"==typeof n,o=!t&&i&&!r;if((!t&&f.isError(i)&&a&&v(i,r)||o)&&b(i,r,"Got unwanted exception"+n),t&&i&&r&&!v(i,r)||!t&&i)throw i}u.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return d(p(t.actual),128)+" "+t.operator+" "+d(p(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=c(e),a=n.indexOf("\n"+i);if(0<=a){var o=n.indexOf("\n",a+1);n=n.substring(o+1)}this.stack=n}}},f.inherits(u.AssertionError,Error),u.fail=b,u.ok=m,u.equal=function(t,e,r){t!=e&&b(t,e,r,"==",u.equal)},u.notEqual=function(t,e,r){t==e&&b(t,e,r,"!=",u.notEqual)},u.deepEqual=function(t,e,r){g(t,e,!1)||b(t,e,r,"deepEqual",u.deepEqual)},u.deepStrictEqual=function(t,e,r){g(t,e,!0)||b(t,e,r,"deepStrictEqual",u.deepStrictEqual)},u.notDeepEqual=function(t,e,r){g(t,e,!1)&&b(t,e,r,"notDeepEqual",u.notDeepEqual)},u.notDeepStrictEqual=function t(e,r,n){g(e,r,!0)&&b(e,r,n,"notDeepStrictEqual",t)},u.strictEqual=function(t,e,r){t!==e&&b(t,e,r,"===",u.strictEqual)},u.notStrictEqual=function(t,e,r){t===e&&b(t,e,r,"!==",u.notStrictEqual)},u.throws=function(t,e,r){_(!0,t,e,r)},u.doesNotThrow=function(t,e,r){_(!1,t,e,r)},u.ifError=function(t){if(t)throw t},u.strict=t(function t(e,r){e||b(e,!0,r,"==",t)},u,{equal:u.strictEqual,deepEqual:u.deepStrictEqual,notEqual:u.notStrictEqual,notDeepEqual:u.notDeepStrictEqual}),u.strict.strict=u.strict;var w=Object.keys||function(t){var e=[];for(var r in t)n.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0!==window?window:{})},{"object-assign":263,"util/":27}],25:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;function r(){}r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],26:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],27:[function(S,t,A){(function(n,i){var s=/%[sdj%]/g;A.format=function(t){if(!v(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(l(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,i=n.length,a=String(t).replace(s,function(t){if("%%"===t)return"%";if(i<=r)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),o=n[r];r<i;o=n[++r])g(o)||!f(o)?a+=" "+o:a+=" "+l(o);return a},A.deprecate=function(t,e){if(_(i.process))return function(){return A.deprecate(t,e).apply(this,arguments)};if(!0===n.noDeprecation)return t;var r=!1;return function(){if(!r){if(n.throwDeprecation)throw new Error(e);n.traceDeprecation?console.trace(e):console.error(e),r=!0}return t.apply(this,arguments)}};var t,a={};function l(t,e){var r={seen:[],stylize:u};return 3<=arguments.length&&(r.depth=arguments[2]),4<=arguments.length&&(r.colors=arguments[3]),m(e)?r.showHidden=e:e&&A._extend(r,e),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),c(r,t,r.depth)}function o(t,e){var r=l.styles[e];return r?"["+l.colors[r][0]+"m"+t+"["+l.colors[r][1]+"m":t}function u(t,e){return t}function c(e,r,n){if(e.customInspect&&r&&k(r.inspect)&&r.inspect!==A.inspect&&(!r.constructor||r.constructor.prototype!==r)){var t=r.inspect(n,e);return v(t)||(t=c(e,t,n)),t}var i=function(t,e){if(_(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(y(e))return t.stylize(""+e,"number");if(m(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(e,r);if(i)return i;var a=Object.keys(r),o=function(t){var r={};return t.forEach(function(t,e){r[t]=!0}),r}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),E(r)&&(0<=a.indexOf("message")||0<=a.indexOf("description")))return d(r);if(0===a.length){if(k(r)){var s=r.name?": "+r.name:"";return e.stylize("[Function"+s+"]","special")}if(w(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(x(r))return e.stylize(Date.prototype.toString.call(r),"date");if(E(r))return d(r)}var l,u="",f=!1,h=["{","}"];b(r)&&(f=!0,h=["[","]"]),k(r)&&(u=" [Function"+(r.name?": "+r.name:"")+"]");return w(r)&&(u=" "+RegExp.prototype.toString.call(r)),x(r)&&(u=" "+Date.prototype.toUTCString.call(r)),E(r)&&(u=" "+d(r)),0!==a.length||f&&0!=r.length?n<0?w(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),l=f?function(e,r,n,i,t){for(var a=[],o=0,s=r.length;o<s;++o)j(r,String(o))?a.push(p(e,r,n,i,String(o),!0)):a.push("");return t.forEach(function(t){t.match(/^\d+$/)||a.push(p(e,r,n,i,t,!0))}),a}(e,r,n,o,a):a.map(function(t){return p(e,r,n,o,t,f)}),e.seen.pop(),function(t,e,r){if(60<t.reduce(function(t,e){return 0,0<=e.indexOf("\n")&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0))return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(l,u,h)):h[0]+u+h[1]}function d(t){return"["+Error.prototype.toString.call(t)+"]"}function p(t,e,r,n,i,a){var o,s,l;if((l=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),j(n,i)||(o="["+i+"]"),s||(t.seen.indexOf(l.value)<0?-1<(s=g(r)?c(t,l.value,null):c(t,l.value,r-1)).indexOf("\n")&&(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=(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),t.stylize(o,"string"))}return o+": "+s}function b(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function g(t){return null===t}function y(t){return"number"==typeof t}function v(t){return"string"==typeof t}function _(t){return void 0===t}function w(t){return f(t)&&"[object RegExp]"===e(t)}function f(t){return"object"==typeof t&&null!==t}function x(t){return f(t)&&"[object Date]"===e(t)}function E(t){return f(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 r(t){return t<10?"0"+t.toString(10):t.toString(10)}A.debuglog=function(e){if(_(t)&&(t=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!a[e])if(new RegExp("\\b"+e+"\\b","i").test(t)){var r=n.pid;a[e]=function(){var t=A.format.apply(A,arguments);console.error("%s %d: %s",e,r,t)}}else a[e]=function(){};return a[e]},(A.inspect=l).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]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},A.isArray=b,A.isBoolean=m,A.isNull=g,A.isNullOrUndefined=function(t){return null==t},A.isNumber=y,A.isString=v,A.isSymbol=function(t){return"symbol"==typeof t},A.isUndefined=_,A.isRegExp=w,A.isObject=f,A.isDate=x,A.isError=E,A.isFunction=k,A.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},A.isBuffer=S("./support/isBuffer");var h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function j(t,e){return Object.prototype.hasOwnProperty.call(t,e)}A.log=function(){console.log("%s - %s",function(){var t=new Date,e=[r(t.getHours()),r(t.getMinutes()),r(t.getSeconds())].join(":");return[t.getDate(),h[t.getMonth()],e].join(" ")}(),A.format.apply(A,arguments))},A.inherits=S("inherits"),A._extend=function(t,e){if(!e||!f(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,S("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0!==window?window:{})},{"./support/isBuffer":26,_process:312,inherits:25}],28:[function(t,e,r){"use strict";r.byteLength=function(t){var e=h(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=h(t),i=n[0],a=n[1],o=new f(function(t,e,r){return 3*(e+r)/4-r}(0,i,a)),s=0,l=0<a?i-4:i;for(r=0;r<l;r+=4)e=u[t.charCodeAt(r)]<<18|u[t.charCodeAt(r+1)]<<12|u[t.charCodeAt(r+2)]<<6|u[t.charCodeAt(r+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=255&e;2===a&&(e=u[t.charCodeAt(r)]<<2|u[t.charCodeAt(r+1)]>>4,o[s++]=255&e);1===a&&(e=u[t.charCodeAt(r)]<<10|u[t.charCodeAt(r+1)]<<4|u[t.charCodeAt(r+2)]>>2,o[s++]=e>>8&255,o[s++]=255&e);return o},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i=[],a=0,o=r-n;a<o;a+=16383)i.push(l(t,a,o<a+16383?o:a+16383));1==n?(e=t[r-1],i.push(s[e>>2]+s[e<<4&63]+"==")):2==n&&(e=(t[r-2]<<8)+t[r-1],i.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+"="));return i.join("")};for(var s=[],u=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,a=n.length;i<a;++i)s[i]=n[i],u[n.charCodeAt(i)]=i;function h(t){var e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var n,i,a=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),a.push(s[(i=n)>>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return a.join("")}u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},{}],29:[function(t,e,r){var n=t("./lib/encoder"),i=t("./lib/decoder");e.exports={encode:n,decode:i}},{"./lib/decoder":30,"./lib/encoder":31}],30:[function(t,n,e){(function(r){function e(t,e){if(this.pos=0,this.buffer=t,this.is_with_alpha=!!e,this.bottom_up=!0,this.flag=this.buffer.toString("utf-8",0,this.pos+=2),"BM"!=this.flag)throw new Error("Invalid BMP File");this.parseHeader(),this.parseRGBA()}e.prototype.parseHeader=function(){if(this.fileSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.reserved=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.offset=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.headerSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.width=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.height=this.buffer.readInt32LE(this.pos),this.pos+=4,this.planes=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.bitPP=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.compress=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.rawSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.hr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.vr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.colors=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.importantColors=this.buffer.readUInt32LE(this.pos),this.pos+=4,16===this.bitPP&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=0===this.colors?1<<this.bitPP:this.colors;this.palette=new Array(t);for(var e=0;e<t;e++){var r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++),i=this.buffer.readUInt8(this.pos++),a=this.buffer.readUInt8(this.pos++);this.palette[e]={red:i,green:n,blue:r,quad:a}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},e.prototype.parseRGBA=function(){var t="bit"+this.bitPP,e=this.width*this.height*4;this.data=new r(e),this[t]()},e.prototype.bit1=function(){var t=Math.ceil(this.width/8),e=t%4,r=0<=this.height?this.height-1:-this.height;for(r=this.height-1;0<=r;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i<t;i++)for(var a=this.buffer.readUInt8(this.pos++),o=n*this.width*4+8*i*4,s=0;s<8&&8*i+s<this.width;s++){var l=this.palette[a>>7-s&1];this.data[o+4*s]=0,this.data[o+4*s+1]=l.blue,this.data[o+4*s+2]=l.green,this.data[o+4*s+3]=l.red}0!=e&&(this.pos+=4-e)}},e.prototype.bit4=function(){if(2==this.compress){this.data.fill(255);for(var r=0,t=this.bottom_up?this.height-1:0,e=!1;r<this.data.length;){var n=this.buffer.readUInt8(this.pos++),i=this.buffer.readUInt8(this.pos++);if(0==n){if(0==i){this.bottom_up?t--:t++,r=t*this.width*4,e=!1;continue}if(1==i)break;if(2==i){var a=this.buffer.readUInt8(this.pos++),o=this.buffer.readUInt8(this.pos++);this.bottom_up?t-=o:t+=o,r+=o*this.width*4+4*a}else{for(var s=this.buffer.readUInt8(this.pos++),l=0;l<i;l++)u.call(this,e?15&s:(240&s)>>4),1&l&&l+1<i&&(s=this.buffer.readUInt8(this.pos++)),e=!e;1==(i+1>>1&1)&&this.pos++}}else for(l=0;l<n;l++)u.call(this,e?15&i:(240&i)>>4),e=!e}function u(t){var e=this.palette[t];this.data[r]=0,this.data[r+1]=e.blue,this.data[r+2]=e.green,this.data[r+3]=e.red,r+=4}}else{var f=Math.ceil(this.width/2),h=f%4;for(o=this.height-1;0<=o;o--){var c=this.bottom_up?o:this.height-1-o;for(a=0;a<f;a++){i=this.buffer.readUInt8(this.pos++),r=c*this.width*4+2*a*4;var d=i>>4,p=15&i,b=this.palette[d];if(this.data[r]=0,this.data[r+1]=b.blue,this.data[r+2]=b.green,this.data[r+3]=b.red,2*a+1>=this.width)break;b=this.palette[p],this.data[r+4]=0,this.data[r+4+1]=b.blue,this.data[r+4+2]=b.green,this.data[r+4+3]=b.red}0!=h&&(this.pos+=4-h)}}},e.prototype.bit8=function(){if(1==this.compress){this.data.fill(255);for(var r=0,t=this.bottom_up?this.height-1:0;r<this.data.length;){var e=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++);if(0==e){if(0==n){this.bottom_up?t--:t++,r=t*this.width*4;continue}if(1==n)break;if(2==n){var i=this.buffer.readUInt8(this.pos++),a=this.buffer.readUInt8(this.pos++);this.bottom_up?t-=a:t+=a,r+=a*this.width*4+4*i}else{for(var o=0;o<n;o++){var s=this.buffer.readUInt8(this.pos++);l.call(this,s)}!0&n&&this.pos++}}else for(o=0;o<e;o++)l.call(this,n)}function l(t){var e=this.palette[t];this.data[r]=0,this.data[r+1]=e.blue,this.data[r+2]=e.green,this.data[r+3]=e.red,r+=4}}else{var u=this.width%4;for(a=this.height-1;0<=a;a--){var f=this.bottom_up?a:this.height-1-a;for(i=0;i<this.width;i++){n=this.buffer.readUInt8(this.pos++),r=f*this.width*4+4*i;if(n<this.palette.length){var h=this.palette[n];this.data[r]=0,this.data[r+1]=h.blue,this.data[r+2]=h.green,this.data[r+3]=h.red}else this.data[r]=0,this.data[r+1]=255,this.data[r+2]=255,this.data[r+3]=255}0!=u&&(this.pos+=4-u)}}},e.prototype.bit15=function(){for(var t=this.width%3,e=parseInt("11111",2),r=this.height-1;0<=r;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i<this.width;i++){var a=this.buffer.readUInt16LE(this.pos);this.pos+=2;var o=(a&e)/e*255|0,s=(a>>5&e)/e*255|0,l=(a>>10&e)/e*255|0,u=a>>15?255:0,f=n*this.width*4+4*i;this.data[f]=u,this.data[1+f]=o,this.data[2+f]=s,this.data[3+f]=l}this.pos+=t}},e.prototype.bit16=function(){var t=this.width%2*2;this.maskRed=31744,this.maskGreen=992,this.maskBlue=31,this.mask0=0,3==this.compress&&(this.maskRed=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskGreen=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskBlue=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.mask0=this.buffer.readUInt32LE(this.pos),this.pos+=4);for(var e=[0,0,0],r=0;r<16;r++)this.maskRed>>r&1&&e[0]++,this.maskGreen>>r&1&&e[1]++,this.maskBlue>>r&1&&e[2]++;e[1]+=e[0],e[2]+=e[1],e[0]=8-e[0],e[1]-=8,e[2]-=8;for(var n=this.height-1;0<=n;n--){for(var i=this.bottom_up?n:this.height-1-n,a=0;a<this.width;a++){var o=this.buffer.readUInt16LE(this.pos);this.pos+=2;var s=(o&this.maskBlue)<<e[0],l=(o&this.maskGreen)>>e[1],u=(o&this.maskRed)>>e[2],f=i*this.width*4+4*a;this.data[f]=0,this.data[1+f]=s,this.data[2+f]=l,this.data[3+f]=u}this.pos+=t}},e.prototype.bit24=function(){for(var t=this.height-1;0<=t;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var n=this.buffer.readUInt8(this.pos++),i=this.buffer.readUInt8(this.pos++),a=this.buffer.readUInt8(this.pos++),o=e*this.width*4+4*r;this.data[o]=0,this.data[1+o]=n,this.data[2+o]=i,this.data[3+o]=a}this.pos+=this.width%4}},e.prototype.bit32=function(){if(3==this.compress){this.maskRed=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskGreen=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskBlue=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.mask0=this.buffer.readUInt32LE(this.pos),this.pos+=4;for(var t=this.height-1;0<=t;t--)for(var e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var n=this.buffer.readUInt8(this.pos++),i=this.buffer.readUInt8(this.pos++),a=this.buffer.readUInt8(this.pos++),o=this.buffer.readUInt8(this.pos++),s=e*this.width*4+4*r;this.data[s]=n,this.data[s+1]=i,this.data[s+2]=a,this.data[s+3]=o}}else for(t=this.height-1;0<=t;t--)for(e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){i=this.buffer.readUInt8(this.pos++),a=this.buffer.readUInt8(this.pos++),o=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++),s=e*this.width*4+4*r;this.data[s]=n,this.data[s+1]=i,this.data[s+2]=a,this.data[s+3]=o}},e.prototype.getData=function(){return this.data},n.exports=function(t){return new e(t)}}).call(this,t("buffer").Buffer)},{buffer:47}],31:[function(t,e,r){(function(s){function r(t){this.buffer=t.data,this.width=t.width,this.height=t.height,this.extraBytes=this.width%4,this.rgbSize=this.height*(3*this.width+this.extraBytes),this.headerInfoSize=40,this.data=[],this.flag="BM",this.reserved=0,this.offset=54,this.fileSize=this.rgbSize+this.offset,this.planes=1,this.bitPP=24,this.compress=0,this.hr=0,this.vr=0,this.colors=0,this.importantColors=0}r.prototype.encode=function(){var t=new s(this.offset+this.rgbSize);this.pos=0,t.write(this.flag,this.pos,2),this.pos+=2,t.writeUInt32LE(this.fileSize,this.pos),this.pos+=4,t.writeUInt32LE(this.reserved,this.pos),this.pos+=4,t.writeUInt32LE(this.offset,this.pos),this.pos+=4,t.writeUInt32LE(this.headerInfoSize,this.pos),this.pos+=4,t.writeUInt32LE(this.width,this.pos),this.pos+=4,t.writeInt32LE(-this.height,this.pos),this.pos+=4,t.writeUInt16LE(this.planes,this.pos),this.pos+=2,t.writeUInt16LE(this.bitPP,this.pos),this.pos+=2,t.writeUInt32LE(this.compress,this.pos),this.pos+=4,t.writeUInt32LE(this.rgbSize,this.pos),this.pos+=4,t.writeUInt32LE(this.hr,this.pos),this.pos+=4,t.writeUInt32LE(this.vr,this.pos),this.pos+=4,t.writeUInt32LE(this.colors,this.pos),this.pos+=4,t.writeUInt32LE(this.importantColors,this.pos),this.pos+=4;for(var e=0,r=3*this.width+this.extraBytes,n=0;n<this.height;n++){for(var i=0;i<this.width;i++){var a=this.pos+n*r+3*i;e++,t[a]=this.buffer[e++],t[a+1]=this.buffer[e++],t[a+2]=this.buffer[e++]}if(0<this.extraBytes){var o=this.pos+n*r+3*this.width;t.fill(0,o,o+this.extraBytes)}}return t},e.exports=function(t,e){return void 0===e&&(e=100),{data:new r(t).encode(),width:t.width,height:t.height}}}).call(this,t("buffer").Buffer)},{buffer:47}],32:[function(t,e,r){},{}],33:[function(n,t,c){(function(u,f){"use strict";var h=n("assert"),a=n("pako/lib/zlib/zstream"),o=n("pako/lib/zlib/deflate.js"),s=n("pako/lib/zlib/inflate.js"),t=n("pako/lib/zlib/constants");for(var e in t)c[e]=t[e];c.NONE=0,c.DEFLATE=1,c.INFLATE=2,c.GZIP=3,c.GUNZIP=4,c.DEFLATERAW=5,c.INFLATERAW=6,c.UNZIP=7;function r(t){if("number"!=typeof t||t<c.DEFLATE||t>c.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=t,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,h(this.init_done,"close before init"),h(this.mode<=c.UNZIP),this.mode===c.DEFLATE||this.mode===c.GZIP||this.mode===c.DEFLATERAW?o.deflateEnd(this.strm):this.mode!==c.INFLATE&&this.mode!==c.GUNZIP&&this.mode!==c.INFLATERAW&&this.mode!==c.UNZIP||s.inflateEnd(this.strm),this.mode=c.NONE,this.dictionary=null)},r.prototype.write=function(t,e,r,n,i,a,o){return this._write(!0,t,e,r,n,i,a,o)},r.prototype.writeSync=function(t,e,r,n,i,a,o){return this._write(!1,t,e,r,n,i,a,o)},r.prototype._write=function(t,e,r,n,i,a,o,s){if(h.equal(arguments.length,8),h(this.init_done,"write before init"),h(this.mode!==c.NONE,"already finalized"),h.equal(!1,this.write_in_progress,"write already in progress"),h.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,h.equal(!1,void 0===e,"must provide flush value"),this.write_in_progress=!0,e!==c.Z_NO_FLUSH&&e!==c.Z_PARTIAL_FLUSH&&e!==c.Z_SYNC_FLUSH&&e!==c.Z_FULL_FLUSH&&e!==c.Z_FINISH&&e!==c.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=s,this.strm.output=a,this.strm.next_out=o,this.flush=e,!t)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return u.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var t=this.strm.avail_out,e=this.strm.avail_in;return this.write_in_progress=!1,[e,t]},r.prototype._process=function(){var t=null;switch(this.mode){case c.DEFLATE:case c.GZIP:case c.DEFLATERAW:this.err=o.deflate(this.strm,this.flush);break;case c.UNZIP:switch(0<this.strm.avail_in&&(t=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===t)break;if(31!==this.strm.input[t]){this.mode=c.INFLATE;break}if(t++,(this.gzip_id_bytes_read=1)===this.strm.avail_in)break;case 1:if(null===t)break;139===this.strm.input[t]?(this.gzip_id_bytes_read=2,this.mode=c.GUNZIP):this.mode=c.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case c.INFLATE:case c.GUNZIP:case c.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===c.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===c.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===c.Z_DATA_ERROR&&(this.err=c.Z_NEED_DICT));0<this.strm.avail_in&&this.mode===c.GUNZIP&&this.err===c.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},r.prototype._checkError=function(){switch(this.err){case c.Z_OK:case c.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===c.Z_FINISH)return this._error("unexpected end of file"),!1;break;case c.Z_STREAM_END:break;case c.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},r.prototype._after=function(){if(this._checkError()){var t=this.strm.avail_out,e=this.strm.avail_in;this.write_in_progress=!1,this.callback(e,t),this.pending_close&&this.close()}},r.prototype._error=function(t){this.strm.msg&&(t=this.strm.msg),this.onerror(t,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},r.prototype.init=function(t,e,r,n,i){h(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),h(8<=t&&t<=15,"invalid windowBits"),h(-1<=e&&e<=9,"invalid compression level"),h(1<=r&&r<=9,"invalid memlevel"),h(n===c.Z_FILTERED||n===c.Z_HUFFMAN_ONLY||n===c.Z_RLE||n===c.Z_FIXED||n===c.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(e,t,r,n,i),this._setDictionary()},r.prototype.params=function(){throw new Error("deflateParams Not supported")},r.prototype.reset=function(){this._reset(),this._setDictionary()},r.prototype._init=function(t,e,r,n,i){switch(this.level=t,this.windowBits=e,this.memLevel=r,this.strategy=n,this.flush=c.Z_NO_FLUSH,this.err=c.Z_OK,this.mode!==c.GZIP&&this.mode!==c.GUNZIP||(this.windowBits+=16),this.mode===c.UNZIP&&(this.windowBits+=32),this.mode!==c.DEFLATERAW&&this.mode!==c.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case c.DEFLATE:case c.GZIP:case c.DEFLATERAW:this.err=o.deflateInit2(this.strm,this.level,c.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case c.INFLATE:case c.GUNZIP:case c.INFLATERAW:case c.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==c.Z_OK&&this._error("Init error"),this.dictionary=i,this.write_in_progress=!1,this.init_done=!0},r.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=c.Z_OK,this.mode){case c.DEFLATE:case c.DEFLATERAW:this.err=o.deflateSetDictionary(this.strm,this.dictionary)}this.err!==c.Z_OK&&this._error("Failed to set dictionary")}},r.prototype._reset=function(){switch(this.err=c.Z_OK,this.mode){case c.DEFLATE:case c.DEFLATERAW:case c.GZIP:this.err=o.deflateReset(this.strm);break;case c.INFLATE:case c.INFLATERAW:case c.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==c.Z_OK&&this._error("Failed to reset stream")},c.Zlib=r}).call(this,n("_process"),n("buffer").Buffer)},{_process:312,assert:24,buffer:47,"pako/lib/zlib/constants":37,"pako/lib/zlib/deflate.js":39,"pako/lib/zlib/inflate.js":41,"pako/lib/zlib/zstream":45}],34:[function(I,t,T){(function(i){"use strict";var m=I("buffer").Buffer,o=I("stream").Transform,s=I("./binding"),t=I("util"),g=I("assert").ok,y=I("buffer").kMaxLength,v="Cannot create final Buffer. It would be larger than 0x"+y.toString(16)+" bytes";s.Z_MIN_WINDOWBITS=8,s.Z_MAX_WINDOWBITS=15,s.Z_DEFAULT_WINDOWBITS=15,s.Z_MIN_CHUNK=64,s.Z_MAX_CHUNK=1/0,s.Z_DEFAULT_CHUNK=16384,s.Z_MIN_MEMLEVEL=1,s.Z_MAX_MEMLEVEL=9,s.Z_DEFAULT_MEMLEVEL=8,s.Z_MIN_LEVEL=-1,s.Z_MAX_LEVEL=9,s.Z_DEFAULT_LEVEL=s.Z_DEFAULT_COMPRESSION;for(var e=Object.keys(s),r=0;r<e.length;r++){var n=e[r];n.match(/^Z/)&&Object.defineProperty(T,n,{enumerable:!0,value:s[n],writable:!1})}for(var a={Z_OK:s.Z_OK,Z_STREAM_END:s.Z_STREAM_END,Z_NEED_DICT:s.Z_NEED_DICT,Z_ERRNO:s.Z_ERRNO,Z_STREAM_ERROR:s.Z_STREAM_ERROR,Z_DATA_ERROR:s.Z_DATA_ERROR,Z_MEM_ERROR:s.Z_MEM_ERROR,Z_BUF_ERROR:s.Z_BUF_ERROR,Z_VERSION_ERROR:s.Z_VERSION_ERROR},l=Object.keys(a),u=0;u<l.length;u++){var f=l[u];a[a[f]]=f}function h(r,t,n){var i=[],a=0;function e(){for(var t;null!==(t=r.read());)i.push(t),a+=t.length;r.once("readable",e)}function o(){var t,e=null;y<=a?e=new RangeError(v):t=m.concat(i,a),i=[],r.close(),n(e,t)}r.on("error",function(t){r.removeListener("end",o),r.removeListener("readable",e),n(t)}),r.on("end",o),r.end(t),e()}function c(t,e){if("string"==typeof e&&(e=m.from(e)),!m.isBuffer(e))throw new TypeError("Not a string or buffer");var r=t._finishFlushFlag;return t._processChunk(e,r)}function d(t){if(!(this instanceof d))return new d(t);j.call(this,t,s.DEFLATE)}function p(t){if(!(this instanceof p))return new p(t);j.call(this,t,s.INFLATE)}function b(t){if(!(this instanceof b))return new b(t);j.call(this,t,s.GZIP)}function _(t){if(!(this instanceof _))return new _(t);j.call(this,t,s.GUNZIP)}function w(t){if(!(this instanceof w))return new w(t);j.call(this,t,s.DEFLATERAW)}function x(t){if(!(this instanceof x))return new x(t);j.call(this,t,s.INFLATERAW)}function E(t){if(!(this instanceof E))return new E(t);j.call(this,t,s.UNZIP)}function k(t){return t===s.Z_NO_FLUSH||t===s.Z_PARTIAL_FLUSH||t===s.Z_SYNC_FLUSH||t===s.Z_FULL_FLUSH||t===s.Z_FINISH||t===s.Z_BLOCK}function j(t,e){var r=this;if(this._opts=t=t||{},this._chunkSize=t.chunkSize||T.Z_DEFAULT_CHUNK,o.call(this,t),t.flush&&!k(t.flush))throw new Error("Invalid flush flag: "+t.flush);if(t.finishFlush&&!k(t.finishFlush))throw new Error("Invalid flush flag: "+t.finishFlush);if(this._flushFlag=t.flush||s.Z_NO_FLUSH,this._finishFlushFlag=void 0!==t.finishFlush?t.finishFlush:s.Z_FINISH,t.chunkSize&&(t.chunkSize<T.Z_MIN_CHUNK||t.chunkSize>T.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBits<T.Z_MIN_WINDOWBITS||t.windowBits>T.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.level<T.Z_MIN_LEVEL||t.level>T.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevel<T.Z_MIN_MEMLEVEL||t.memLevel>T.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=T.Z_FILTERED&&t.strategy!=T.Z_HUFFMAN_ONLY&&t.strategy!=T.Z_RLE&&t.strategy!=T.Z_FIXED&&t.strategy!=T.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!m.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(e);var n=this;this._hadError=!1,this._handle.onerror=function(t,e){S(n),n._hadError=!0;var r=new Error(t);r.errno=e,r.code=T.codes[e],n.emit("error",r)};var i=T.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(i=t.level);var a=T.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(a=t.strategy),this._handle.init(t.windowBits||T.Z_DEFAULT_WINDOWBITS,i,t.memLevel||T.Z_DEFAULT_MEMLEVEL,a,t.dictionary),this._buffer=m.allocUnsafe(this._chunkSize),this._offset=0,this._level=i,this._strategy=a,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function S(t,e){e&&i.nextTick(e),t._handle&&(t._handle.close(),t._handle=null)}function A(t){t.emit("close")}Object.defineProperty(T,"codes",{enumerable:!0,value:Object.freeze(a),writable:!1}),T.Deflate=d,T.Inflate=p,T.Gzip=b,T.Gunzip=_,T.DeflateRaw=w,T.InflateRaw=x,T.Unzip=E,T.createDeflate=function(t){return new d(t)},T.createInflate=function(t){return new p(t)},T.createDeflateRaw=function(t){return new w(t)},T.createInflateRaw=function(t){return new x(t)},T.createGzip=function(t){return new b(t)},T.createGunzip=function(t){return new _(t)},T.createUnzip=function(t){return new E(t)},T.deflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),h(new d(e),t,r)},T.deflateSync=function(t,e){return c(new d(e),t)},T.gzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),h(new b(e),t,r)},T.gzipSync=function(t,e){return c(new b(e),t)},T.deflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),h(new w(e),t,r)},T.deflateRawSync=function(t,e){return c(new w(e),t)},T.unzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),h(new E(e),t,r)},T.unzipSync=function(t,e){return c(new E(e),t)},T.inflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),h(new p(e),t,r)},T.inflateSync=function(t,e){return c(new p(e),t)},T.gunzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),h(new _(e),t,r)},T.gunzipSync=function(t,e){return c(new _(e),t)},T.inflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),h(new x(e),t,r)},T.inflateRawSync=function(t,e){return c(new x(e),t)},t.inherits(j,o),j.prototype.params=function(t,e,r){if(t<T.Z_MIN_LEVEL||t>T.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(e!=T.Z_FILTERED&&e!=T.Z_HUFFMAN_ONLY&&e!=T.Z_RLE&&e!=T.Z_FIXED&&e!=T.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+e);if(this._level!==t||this._strategy!==e){var n=this;this.flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(t,e),n._hadError||(n._level=t,n._strategy=e,r&&r())})}else i.nextTick(r)},j.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},j.prototype._flush=function(t){this._transform(m.alloc(0),"",t)},j.prototype.flush=function(t,e){var r=this,n=this._writableState;"function"!=typeof t&&(void 0!==t||e)||(e=t,t=s.Z_FULL_FLUSH),n.ended?e&&i.nextTick(e):n.ending?e&&this.once("end",e):n.needDrain?e&&this.once("drain",function(){return r.flush(t,e)}):(this._flushFlag=t,this.write(m.alloc(0),"",e))},j.prototype.close=function(t){S(this,t),i.nextTick(A,this)},j.prototype._transform=function(t,e,r){var n,i=this._writableState,a=(i.ending||i.ended)&&(!t||i.length===t.length);return null===t||m.isBuffer(t)?this._handle?(a?n=this._finishFlushFlag:(n=this._flushFlag,t.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(t,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},j.prototype._processChunk=function(a,o,s){var l=a&&a.length,u=this._chunkSize-this._offset,f=0,h=this,c="function"==typeof s;if(!c){var e,d=[],p=0;this.on("error",function(t){e=t}),g(this._handle,"zlib binding closed");do{var t=this._handle.writeSync(o,a,f,l,this._buffer,this._offset,u)}while(!this._hadError&&b(t[0],t[1]));if(this._hadError)throw e;if(y<=p)throw S(this),new RangeError(v);var r=m.concat(d,p);return S(this),r}g(this._handle,"zlib binding closed");var n=this._handle.write(o,a,f,l,this._buffer,this._offset,u);function b(t,e){if(this&&(this.buffer=null,this.callback=null),!h._hadError){var r=u-e;if(g(0<=r,"have should not go down"),0<r){var n=h._buffer.slice(h._offset,h._offset+r);h._offset+=r,c?h.push(n):(d.push(n),p+=n.length)}if((0===e||h._offset>=h._chunkSize)&&(u=h._chunkSize,h._offset=0,h._buffer=m.allocUnsafe(h._chunkSize)),0===e){if(f+=l-t,l=t,!c)return!0;var i=h._handle.write(o,a,f,l,h._buffer,h._offset,h._chunkSize);return i.callback=b,void(i.buffer=a)}if(!c)return!1;s()}}n.buffer=a,n.callback=b},t.inherits(d,j),t.inherits(p,j),t.inherits(b,j),t.inherits(_,j),t.inherits(w,j),t.inherits(x,j),t.inherits(E,j)}).call(this,I("_process"))},{"./binding":33,_process:312,assert:24,buffer:47,stream:334,util:365}],35:[function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(t){for(var e,r,n=Array.prototype.slice.call(arguments,1);n.length;){var i=n.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var a in i)e=i,r=a,Object.prototype.hasOwnProperty.call(e,r)&&(t[a]=i[a])}}return t},r.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+n),i);else for(var a=0;a<n;a++)t[i+a]=e[r+a]},flattenChunks:function(t){var e,r,n,i,a,o;for(e=n=0,r=t.length;e<r;e++)n+=t[e].length;for(o=new Uint8Array(n),e=i=0,r=t.length;e<r;e++)a=t[e],o.set(a,i),i+=a.length;return o}},a={arraySet:function(t,e,r,n,i){for(var a=0;a<n;a++)t[i+a]=e[r+a]},flattenChunks:function(t){return[].concat.apply([],t)}};r.setTyped=function(t){t?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,a))},r.setTyped(n)},{}],36:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){for(var i=65535&t|0,a=t>>>16&65535|0,o=0;0!==r;){for(r-=o=2e3<r?2e3:r;a=a+(i=i+e[n++]|0)|0,--o;);i%=65521,a%=65521}return i|a<<16|0}},{}],37:[function(t,e,r){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],38:[function(t,e,r){"use strict";var s=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();e.exports=function(t,e,r,n){var i=s,a=n+r;t^=-1;for(var o=n;o<a;o++)t=t>>>8^i[255&(t^e[o])];return-1^t}},{}],39:[function(t,e,r){"use strict";var l,c=t("../utils/common"),u=t("./trees"),d=t("./adler32"),p=t("./crc32"),n=t("./messages"),f=0,h=4,b=0,m=-2,g=-1,y=4,i=2,v=8,_=9,a=286,o=30,s=19,w=2*a+1,x=15,E=3,k=258,j=k+E+1,S=42,A=113,I=1,T=2,O=3,R=4;function P(t,e){return t.msg=n[e],e}function M(t){return(t<<1)-(4<t?9:0)}function L(t){for(var e=t.length;0<=--e;)t[e]=0}function C(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(c.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function B(t,e){u._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,C(t.strm)}function D(t,e){t.pending_buf[t.pending++]=e}function N(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function U(t,e){var r,n,i=t.max_chain_length,a=t.strstart,o=t.prev_length,s=t.nice_match,l=t.strstart>t.w_size-j?t.strstart-(t.w_size-j):0,u=t.window,f=t.w_mask,h=t.prev,c=t.strstart+k,d=u[a+o-1],p=u[a+o];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(u[(r=e)+o]===p&&u[r+o-1]===d&&u[r]===u[a]&&u[++r]===u[a+1]){a+=2,r++;do{}while(u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&a<c);if(n=k-(c-a),a=c-k,o<n){if(t.match_start=e,s<=(o=n))break;d=u[a+o-1],p=u[a+o]}}}while((e=h[e&f])>l&&0!=--i);return o<=t.lookahead?o:t.lookahead}function z(t){var e,r,n,i,a,o,s,l,u,f,h=t.w_size;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=h+(h-j)){for(c.arraySet(t.window,t.window,h,h,0),t.match_start-=h,t.strstart-=h,t.block_start-=h,e=r=t.hash_size;n=t.head[--e],t.head[e]=h<=n?n-h:0,--r;);for(e=r=h;n=t.prev[--e],t.prev[e]=h<=n?n-h:0,--r;);i+=h}if(0===t.strm.avail_in)break;if(o=t.strm,s=t.window,l=t.strstart+t.lookahead,u=i,f=void 0,f=o.avail_in,u<f&&(f=u),r=0===f?0:(o.avail_in-=f,c.arraySet(s,o.input,o.next_in,f,l),1===o.state.wrap?o.adler=d(o.adler,s,f,l):2===o.state.wrap&&(o.adler=p(o.adler,s,f,l)),o.next_in+=f,o.total_in+=f,f),t.lookahead+=r,t.lookahead+t.insert>=E)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=(t.ins_h<<t.hash_shift^t.window[a+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[a+E-1])&t.hash_mask,t.prev[a&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=a,a++,t.insert--,!(t.lookahead+t.insert<E)););}while(t.lookahead<j&&0!==t.strm.avail_in)}function F(t,e){for(var r,n;;){if(t.lookahead<j){if(z(t),t.lookahead<j&&e===f)return I;if(0===t.lookahead)break}if(r=0,t.lookahead>=E&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+E-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-j&&(t.match_length=U(t,r)),t.match_length>=E)if(n=u._tr_tally(t,t.strstart-t.match_start,t.match_length-E),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=E){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+E-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=u._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(B(t,!1),0===t.strm.avail_out))return I}return t.insert=t.strstart<E-1?t.strstart:E-1,e===h?(B(t,!0),0===t.strm.avail_out?O:R):t.last_lit&&(B(t,!1),0===t.strm.avail_out)?I:T}function H(t,e){for(var r,n,i;;){if(t.lookahead<j){if(z(t),t.lookahead<j&&e===f)return I;if(0===t.lookahead)break}if(r=0,t.lookahead>=E&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+E-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=E-1,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-j&&(t.match_length=U(t,r),t.match_length<=5&&(1===t.strategy||t.match_length===E&&4096<t.strstart-t.match_start)&&(t.match_length=E-1)),t.prev_length>=E&&t.match_length<=t.prev_length){for(i=t.strstart+t.lookahead-E,n=u._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-E),t.lookahead-=t.prev_