-
Notifications
You must be signed in to change notification settings - Fork 1
/
milkcocoa.1.0.0.min.js
4 lines (4 loc) · 107 KB
/
milkcocoa.1.0.0.min.js
1
2
3
4
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Milkcocoa=t():e.Milkcocoa=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=63)}([function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(e){function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function i(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=s.prototype):(null===e&&(e=new s(t)),e.length=t),e}function s(e,t,n){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return a(this,e,t,n)}function a(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?p(e,t,n,r):"string"==typeof t?h(e,t,n):d(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function c(e,t,n,r){return u(t),t<=0?o(e,t):void 0!==n?"string"==typeof r?o(e,t).fill(n,r):o(e,t).fill(n):o(e,t)}function f(e,t){if(u(t),e=o(e,t<0?0:0|g(t)),!s.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function h(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!s.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|y(t,n);e=o(e,r);var i=e.write(t,n);return i!==r&&(e=e.slice(0,i)),e}function l(e,t){var n=t.length<0?0:0|g(t.length);e=o(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function p(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),s.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=s.prototype):e=l(e,t),e}function d(e,t){if(s.isBuffer(t)){var n=0|g(t.length);return e=o(e,n),0===e.length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||V(t.length)?o(e,0):l(e,t);if("Buffer"===t.type&&Q(t.data))return l(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function g(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),s.alloc(+e)}function y(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function b(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return L(this,t,n);case"latin1":case"binary":return j(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:_(e,t,n,r,i);if("number"==typeof t)return t&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):_(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function _(e,t,n,r,i){function o(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,a=e.length,u=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}var c;if(i){var f=-1;for(c=n;c<a;c++)if(o(e,c)===o(t,f===-1?0:c-f)){if(f===-1&&(f=c),c-f+1===u)return f*s}else f!==-1&&(c-=c-f),f=-1}else for(n+u>a&&(n=a-u),c=n;c>=0;c--){for(var h=!0,l=0;l<u;l++)if(o(e,c+l)!==o(t,l)){h=!1;break}if(h)return c}return-1}function k(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function E(e,t,n,r){return J(z(t,e.length-n),e,n,r)}function S(e,t,n,r){return J(K(t),e,n,r)}function T(e,t,n,r){return S(e,t,n,r)}function R(e,t,n,r){return J(X(t),e,n,r)}function x(e,t,n,r){return J(G(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?$.fromByteArray(e):$.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=n){var u,c,f,h;switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128===(192&u)&&(h=(31&o)<<6|63&u,h>127&&(s=h));break;case 3:u=e[i+1],c=e[i+2],128===(192&u)&&128===(192&c)&&(h=(15&o)<<12|(63&u)<<6|63&c,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:u=e[i+1],c=e[i+2],f=e[i+3],128===(192&u)&&128===(192&c)&&128===(192&f)&&(h=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,h>65535&&h<1114112&&(s=h))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return P(r)}function P(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ee));return n}function L(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function j(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function M(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=W(e[o]);return i}function C(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function I(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,n,r,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function U(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function D(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(e,t,n,r,i){return i||D(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function Y(e,t,n,r,i){return i||D(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function F(e){if(e=H(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function H(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function K(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function G(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}function X(e){return $.toByteArray(F(e))}function J(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function V(e){return e!==e}var $=n(35),Z=n(38),Q=n(14);t.Buffer=s,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:r(),t.kMaxLength=i(),s.poolSize=8192,s._augment=function(e){return e.__proto__=s.prototype,e},s.from=function(e,t,n){return a(null,e,t,n)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(e,t,n){return c(null,e,t,n)},s.allocUnsafe=function(e){return f(null,e)},s.allocUnsafeSlow=function(e){return f(null,e)},s.isBuffer=function(e){return!(null==e||!e._isBuffer)},s.compare=function(e,t){if(!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Q(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},s.byteLength=y,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},s.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?O(this,0,e):b.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},s.prototype.compare=function(e,t,n,r,i){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,a=n-t,u=Math.min(o,a),c=this.slice(r,i),f=e.slice(t,n),h=0;h<u;++h)if(c[h]!==f[h]){o=c[h],a=f[h];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},s.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return k(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return R(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;s.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var r;if(s.TYPED_ARRAY_SUPPORT)r=this.subarray(e,t),r.__proto__=s.prototype;else{var i=t-e;r=new s(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},s.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},s.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),Z.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),Z.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),Z.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),Z.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=Math.pow(2,8*n)-1;B(this,e,t,n,i,0)}var o=1,s=0;for(this[t]=255&e;++s<n&&(o*=256);)this[t+s]=e/o&255;return t+n},s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=Math.pow(2,8*n)-1;B(this,e,t,n,i,0)}var o=n-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):q(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);B(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);B(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):q(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return Y(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return Y(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},s.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=s.isBuffer(e)?e:z(new s(e,r).toString()),u=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%u]}return this};var te=/[^+\/0-9A-Za-z-_]/g}).call(t,n(0))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function o(e){if(h===clearTimeout)return clearTimeout(e);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(e);try{return h(e)}catch(t){try{return h.call(null,e)}catch(t){return h.call(this,e)}}}function s(){g&&p&&(g=!1,p.length?d=p.concat(d):v=-1,d.length&&a())}function a(){if(!g){var e=i(s);g=!0;for(var t=d.length;t;){for(p=d,d=[];++v<t;)p&&p[v].run();v=-1,t=d.length}p=null,g=!1,o(e)}}function u(e,t){this.fun=e,this.array=t}function c(){}var f,h,l=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{h="function"==typeof clearTimeout?clearTimeout:r}catch(e){h=r}}();var p,d=[],g=!1,v=-1;l.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];d.push(new u(e,t)),1!==d.length||g||i(a)},u.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=c,l.addListener=c,l.once=c,l.off=c,l.removeListener=c,l.removeAllListeners=c,l.emit=c,l.binding=function(e){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(e){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";function r(e){return this instanceof r?(c.call(this,e),f.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(e)}function i(){this.allowHalfOpen||this._writableState.ended||a(o,this)}function o(e){e.end()}var s=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=r;var a=n(8),u=n(6);u.inherits=n(3);var c=n(16),f=n(11);u.inherits(r,c);for(var h=s(f.prototype),l=0;l<h.length;l++){var p=h[l];r.prototype[p]||(r.prototype[p]=f.prototype[p])}},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(n=this._events[e],s(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(o(n))for(a=Array.prototype.slice.call(arguments,1),c=n.slice(),i=c.length,u=0;u<i;u++)c[u].apply(this,a);return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(i=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(a=s;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){(function(e){function n(e){return Array.isArray?Array.isArray(e):"[object Array]"===v(e)}function r(e){return"boolean"==typeof e}function i(e){return null===e}function o(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function c(e){return void 0===e}function f(e){return"[object RegExp]"===v(e)}function h(e){return"object"==typeof e&&null!==e}function l(e){return"[object Date]"===v(e)}function p(e){return"[object Error]"===v(e)||e instanceof Error}function d(e){return"function"==typeof e}function g(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function v(e){return Object.prototype.toString.call(e)}t.isArray=n,t.isBoolean=r,t.isNull=i,t.isNullOrUndefined=o,t.isNumber=s,t.isString=a,t.isSymbol=u,t.isUndefined=c,t.isRegExp=f,t.isObject=h,t.isDate=l,t.isError=p,t.isFunction=d,t.isPrimitive=g,t.isBuffer=e.isBuffer}).call(t,n(1).Buffer)},function(e,t,n){"use strict";(function(e){var r=n(1),i=r.Buffer,o=r.SlowBuffer,s=r.kMaxLength||2147483647;t.alloc=function(e,t,n){if("function"==typeof i.alloc)return i.alloc(e,t,n);if("number"==typeof n)throw new TypeError("encoding must not be number");if("number"!=typeof e)throw new TypeError("size must be a number");if(e>s)throw new RangeError("size is too large");var r=n,o=t;void 0===o&&(r=void 0,o=0);var a=new i(e);if("string"==typeof o)for(var u=new i(o,r),c=u.length,f=-1;++f<e;)a[f]=u[f%c];else a.fill(o);return a},t.allocUnsafe=function(e){if("function"==typeof i.allocUnsafe)return i.allocUnsafe(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>s)throw new RangeError("size is too large");return new i(e)},t.from=function(t,n,r){if("function"==typeof i.from&&(!e.Uint8Array||Uint8Array.from!==i.from))return i.from(t,n,r);if("number"==typeof t)throw new TypeError('"value" argument must not be a number');if("string"==typeof t)return new i(t,n);if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer){var o=n;if(1===arguments.length)return new i(t);"undefined"==typeof o&&(o=0);var s=r;if("undefined"==typeof s&&(s=t.byteLength-o),o>=t.byteLength)throw new RangeError("'offset' is out of bounds");if(s>t.byteLength-o)throw new RangeError("'length' is out of bounds");return new i(t.slice(o,o+s))}if(i.isBuffer(t)){var a=new i(t.length);return t.copy(a,0,0,t.length),a}if(t){if(Array.isArray(t)||"undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return new i(t);if("Buffer"===t.type&&Array.isArray(t.data))return new i(t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},t.allocUnsafeSlow=function(e){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=s)throw new RangeError("size is too large");return new o(e)}}).call(t,n(0))},function(e,t,n){"use strict";(function(t){function n(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,n)});case 3:return t.nextTick(function(){e.call(null,n,r)});case 4:return t.nextTick(function(){e.call(null,n,r,i)});default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return t.nextTick(function(){e.apply(null,o)})}}!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports=n:e.exports=t.nextTick}).call(t,n(2))},function(e,t,n){"use strict";t.decode=t.parse=n(40),t.encode=t.stringify=n(41)},function(e,t,n){"use strict";function r(e){this.afterTransform=function(t,n){return i(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function i(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!==n&&void 0!==n&&e.push(n),i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}function o(e){if(!(this instanceof o))return new o(e);a.call(this,e),this._transformState=new r(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(e,n){s(t,e,n)}):s(t)})}function s(e,t,n){if(t)return e.emit("error",t);null!==n&&void 0!==n&&e.push(n);var r=e._writableState,i=e._transformState;if(r.length)throw new Error("Calling transform done when ws.length != 0");if(i.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}e.exports=o;var a=n(4),u=n(6);u.inherits=n(3),u.inherits(o,a),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,a.prototype.push.call(this,e,t);
},o.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},o.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0}},function(e,t,n){"use strict";(function(t,r){function i(){}function o(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function s(e,t){S=S||n(4),e=e||{},this.objectMode=!!e.objectMode,t instanceof S&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var o=e.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){g(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new E(this)}function a(e){return S=S||n(4),j.call(a,this)||this instanceof S?(this._writableState=new s(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),void A.call(this)):new a(e)}function u(e,t){var n=new Error("write after end");e.emit("error",n),T(t,n)}function c(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):P.isBuffer(n)||"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),T(r,o),i=!1),i}function f(e,t,n){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=L.from(t,n)),t}function h(e,t,n,r,i){n=f(t,n,r),P.isBuffer(n)&&(r="buffer");var s=t.objectMode?1:n.length;t.length+=s;var a=t.length<t.highWaterMark;if(a||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest=new o(n,r,i),u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else l(e,t,!1,s,n,r,i);return a}function l(e,t,n,r,i,o,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function p(e,t,n,r,i){--t.pendingcb,n?T(i,r):i(r),e._writableState.errorEmitted=!0,e.emit("error",r)}function d(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function g(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(d(n),t)p(e,n,r,t,i);else{var o=m(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||b(e,n),r?R(v,e,n,o,i):v(e,n,o,i)}}function v(e,t,n,r){n||y(e,t),t.pendingcb--,r(),_(e,t)}function y(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function b(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var s=0;n;)i[s]=n,n=n.next,s+=1;l(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new E(t)}else{for(;n;){var a=n.chunk,u=n.encoding,c=n.callback,f=t.objectMode?1:a.length;if(l(e,t,!1,f,a,u,c),n=n.next,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}function m(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function w(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function _(e,t){var n=m(t);return n&&(0===t.pendingcb?(w(e,t),t.finished=!0,e.emit("finish")):w(e,t)),n}function k(e,t,n){t.ending=!0,_(e,t),n&&(t.finished?T(n):e.once("finish",n)),t.ended=!0,e.writable=!1}function E(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}e.exports=a;var S,T=n(8),R=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:T;a.WritableState=s;var x=n(6);x.inherits=n(3);var A,O={deprecate:n(55)};!function(){try{A=n(13)}catch(e){}finally{A||(A=n(5).EventEmitter)}}();var P=n(1).Buffer,L=n(7);x.inherits(a,A),s.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(s.prototype,"buffer",{get:O.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var j;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(j=Function.prototype[Symbol.hasInstance],Object.defineProperty(a,Symbol.hasInstance,{value:function(e){return!!j.call(this,e)||e&&e._writableState instanceof s}})):j=function(e){return e instanceof this},a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},a.prototype.write=function(e,t,n){var r=this._writableState,o=!1;return"function"==typeof t&&(n=t,t=null),P.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=i),r.ended?u(this,n):c(this,r,e,n)&&(r.pendingcb++,o=h(this,r,e,t,n)),o},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||b(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},a.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||k(this,r,n)}}).call(t,n(2),n(51).setImmediate)},function(e,t,n){(function(r){var i=function(){try{return n(13)}catch(e){}}();t=e.exports=n(16),t.Stream=i||t,t.Readable=t,t.Writable=n(11),t.Duplex=n(4),t.Transform=n(10),t.PassThrough=n(15),!r.browser&&"disable"===r.env.READABLE_STREAM&&i&&(e.exports=i)}).call(t,n(2))},function(e,t,n){function r(){i.call(this)}e.exports=r;var i=n(5).EventEmitter,o=n(3);o(r,i),r.Readable=n(12),r.Writable=n(46),r.Duplex=n(42),r.Transform=n(45),r.PassThrough=n(44),r.Stream=r,r.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&c.pause&&c.pause()}function r(){c.readable&&c.resume&&c.resume()}function o(){f||(f=!0,e.end())}function s(){f||(f=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){c.removeListener("data",n),e.removeListener("drain",r),c.removeListener("end",o),c.removeListener("close",s),c.removeListener("error",a),e.removeListener("error",a),c.removeListener("end",u),c.removeListener("close",u),e.removeListener("close",u)}var c=this;c.on("data",n),e.on("drain",r),e._isStdio||t&&t.end===!1||(c.on("end",o),c.on("close",s));var f=!1;return c.on("error",a),e.on("error",a),c.on("end",u),c.on("close",u),e.on("close",u),e.emit("pipe",c),e}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";function r(e){return this instanceof r?void i.call(this,e):new r(e)}e.exports=r;var i=n(10),o=n(6);o.inherits=n(3),o.inherits(r,i),r.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";(function(t){function r(e,t,n){return"function"==typeof e.prependListener?e.prependListener(t,n):void(e._events&&e._events[t]?L(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n))}function i(e,t){O=O||n(4),e=e||{},this.objectMode=!!e.objectMode,t instanceof O&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=~~this.highWaterMark,this.buffer=new N,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(D||(D=n(19).StringDecoder),this.decoder=new D(e.encoding),this.encoding=e.encoding)}function o(e){return O=O||n(4),this instanceof o?(this._readableState=new i(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),void j.call(this)):new o(e)}function s(e,t,n,r,i){var o=f(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,h(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var c;!t.decoder||i||r||(n=t.decoder.write(n),c=!t.objectMode&&0===n.length),i||(t.reading=!1),c||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&l(e))),d(e,t)}else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function u(e){return e>=Y?e=Y:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function c(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function f(e,t){var n=null;return C.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function h(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,l(e)}}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(q("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?P(p,e):p(e))}function p(e){q("emit readable"),e.emit("readable"),w(e)}function d(e,t){t.readingMore||(t.readingMore=!0,P(g,e,t))}function g(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(q("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function v(e){return function(){var t=e._readableState;q("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&M(e,"data")&&(t.flowing=!0,w(e))}}function y(e){q("readable nexttick read 0"),e.read(0)}function b(e,t){t.resumeScheduled||(t.resumeScheduled=!0,P(m,e,t))}function m(e,t){t.reading||(q("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),w(e),t.flowing&&!t.reading&&e.read(0)}function w(e){var t=e._readableState;for(q("flow",t.flowing);t.flowing&&null!==e.read(););}function _(e,t){if(0===t.length)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=k(e,t.buffer,t.decoder),n}function k(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?E(e,t):S(e,t),r}function E(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(i+=s===o.length?o:o.slice(0,e),e-=s,0===e){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function S(e,t){var n=I.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),e-=s,0===e){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function T(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,P(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function x(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)}function A(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}e.exports=o;var O,P=n(8),L=n(14);o.ReadableState=i;var j,M=(n(5).EventEmitter,function(e,t){return e.listeners(t).length});!function(){try{j=n(13)}catch(e){}finally{j||(j=n(5).EventEmitter)}}();var C=n(1).Buffer,I=n(7),B=n(6);B.inherits=n(3);var U=n(62),q=void 0;q=U&&U.debuglog?U.debuglog("stream"):function(){};var D,N=n(43);B.inherits(o,j),o.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding,t!==n.encoding&&(e=I.from(e,t),t="")),s(this,n,e,t,!1)},o.prototype.unshift=function(e){var t=this._readableState;return s(this,t,e,"",!0)},o.prototype.isPaused=function(){return this._readableState.flowing===!1},o.prototype.setEncoding=function(e){return D||(D=n(19).StringDecoder),this._readableState.decoder=new D(e),this._readableState.encoding=e,this};var Y=8388608;o.prototype.read=function(e){q("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return q("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?T(this):l(this),null;if(e=c(e,t),0===e&&t.ended)return 0===t.length&&T(this),null;var r=t.needReadable;q("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&(r=!0,q("length less than watermark",r)),t.ended||t.reading?(r=!1,q("reading or ended",r)):r&&(q("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=c(n,t)));var i;return i=e>0?_(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&T(this)),null!==i&&this.emit("data",i),i},o.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},o.prototype.pipe=function(e,n){function i(e){q("onunpipe"),e===l&&s()}function o(){q("onend"),e.end()}function s(){q("cleanup"),e.removeListener("close",c),e.removeListener("finish",f),e.removeListener("drain",y),e.removeListener("error",u),e.removeListener("unpipe",i),l.removeListener("end",o),l.removeListener("end",s),l.removeListener("data",a),b=!0,!p.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}function a(t){q("ondata"),m=!1;var n=e.write(t);!1!==n||m||((1===p.pipesCount&&p.pipes===e||p.pipesCount>1&&A(p.pipes,e)!==-1)&&!b&&(q("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++,m=!0),l.pause())}function u(t){q("onerror",t),h(),e.removeListener("error",u),0===M(e,"error")&&e.emit("error",t)}function c(){e.removeListener("finish",f),h()}function f(){q("onfinish"),e.removeListener("close",c),h()}function h(){q("unpipe"),l.unpipe(e)}var l=this,p=this._readableState;switch(p.pipesCount){case 0:p.pipes=e;break;case 1:p.pipes=[p.pipes,e];break;default:p.pipes.push(e)}p.pipesCount+=1,q("pipe count=%d opts=%j",p.pipesCount,n);var d=(!n||n.end!==!1)&&e!==t.stdout&&e!==t.stderr,g=d?o:s;p.endEmitted?P(g):l.once("end",g),e.on("unpipe",i);var y=v(l);e.on("drain",y);var b=!1,m=!1;return l.on("data",a),r(e,"error",u),e.once("close",c),e.once("finish",f),e.emit("pipe",l),p.flowing||(q("pipe resume"),l.resume()),e},o.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var o=A(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},o.prototype.on=function(e,t){var n=j.prototype.on.call(this,e,t);if("data"===e)this._readableState.flowing!==!1&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&l(this,r):P(y,this))}return n},o.prototype.addListener=o.prototype.on,o.prototype.resume=function(){var e=this._readableState;return e.flowing||(q("resume"),e.flowing=!0,b(this,e)),this},o.prototype.pause=function(){return q("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(q("pause"),this._readableState.flowing=!1,this.emit("pause")),this},o.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;e.on("end",function(){if(q("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(i){if(q("wrapped data"),t.decoder&&(i=t.decoder.write(i)),(!t.objectMode||null!==i&&void 0!==i)&&(t.objectMode||i&&i.length)){var o=r.push(i);o||(n=!0,e.pause())}});for(var i in e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));var o=["error","close","destroy","pause","resume"];return x(o,function(t){e.on(t,r.emit.bind(r,t))}),r._read=function(t){q("wrapped _read",t),n&&(n=!1,e.resume())},r},o._fromList=_}).call(t,n(2))},function(e,t,n){(function(e){var r=n(49),i=n(60),o=n(36),s=n(53),a=t;a.request=function(t,n){t="string"==typeof t?s.parse(t):i(t);var o=e.location.protocol.search(/^https?:$/)===-1?"http:":"",a=t.protocol||o,u=t.hostname||t.host,c=t.port,f=t.path||"/";u&&u.indexOf(":")!==-1&&(u="["+u+"]"),t.url=(u?a+"//"+u:"")+(c?":"+c:"")+f,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var h=new r(t);return n&&h.on("response",n),h},a.get=function(e,t){var n=a.request(e,t);return n.end(),n},a.Agent=function(){},a.Agent.defaultMaxSockets=4,a.STATUS_CODES=o,a.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(t,n(0))},function(e,t,n){(function(e){function n(){if(void 0!==o)return o;if(e.XMLHttpRequest){o=new e.XMLHttpRequest;try{o.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){o=null}}else o=null;return o}function r(e){var t=n();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function i(e){return"function"==typeof e}t.fetch=i(e.fetch)&&i(e.ReadableStream),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(e){}var o,s="undefined"!=typeof e.ArrayBuffer,a=s&&i(e.ArrayBuffer.prototype.slice);t.arraybuffer=t.fetch||s&&r("arraybuffer"),t.msstream=!t.fetch&&a&&r("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&s&&r("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!n()&&i(n().overrideMimeType),t.vbArray=i(e.VBArray),o=null}).call(t,n(0))},function(e,t,n){function r(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function s(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var a=n(1).Buffer,u=a.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},c=t.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=s;break;default:return void(this.write=i)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};c.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";e=e.slice(n,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var r=t.charCodeAt(t.length-1);if(!(r>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,r=t.charCodeAt(i);if(r>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},c.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},c.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},function(e,t){function n(e,t){var n=t||0,i=r;return i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]}for(var r=[],i=0;i<256;++i)r[i]=(i+256).toString(16).substr(1);e.exports=n},function(e,t,n){(function(t){var n,r=t.crypto||t.msCrypto;if(r&&r.getRandomValues){var i=new Uint8Array(16);n=function(){return r.getRandomValues(i),i}}if(!n){var o=new Array(16);n=function(){for(var e,t=0;t<16;t++)0===(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}e.exports=n}).call(t,n(0))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(9),a=r(s),u=n(56),c=r(u),f=n(61),h=r(f),l=n(32),p=r(l),d=n(33),g=r(d),v=n(29),y=r(v),b=function(){function e(t){if(i(this,e),this.options=t,this.appId=t.appId,this.store=t.store,!this.appId)throw new Error("appId required");if(!this.store)throw new Error("store required");this.uuid=this.get_uuid(t.uuid),this.apiKey=t.apiKey,this.accessToken=t.accessToken,this.useSSL=!t.hasOwnProperty("useSSL")||t.useSSL,this.host=t.host||"pubsub1.mlkcca.com",this.port=t.port||443,this.keepaliveTimeout=t.keepaliveTimeout||300;var n={};this.accessToken&&(n.Authorization="Bearer "+this.accessToken),this.remote=new g.default(this.host,this.port,this.useSSL,n),this.wsOptions={headers:n},this.websocket=new p.default({host:this._get_pubsub_url(this.useSSL,this.host,this.port,this.appId,this.apiKey,this.accessToken,this.uuid),logger:console,WebSocket:this.options.WebSocket,wsOptions:this.wsOptions,keepalive:t.keepalive||36},this),this.connect()}return o(e,[{key:"version",value:function(){return h.default.version}},{key:"getAppId",value:function(){return this.appId}},{key:"get_uuid",value:function(e){if(e)this.store.set("uuid",e);else{var t=this.store.get("uuid",e);t?e=t:(e=(0,c.default)(),this.store.set("uuid",e))}return e}},{key:"connect",value:function(){this.websocket.connect()}},{key:"disconnect",value:function(){this.websocket.disconnect()}},{key:"on",value:function(e,t){this.websocket.on(e,t)}},{key:"_get_pubsub_url",value:function(e,t,n,r,i,o,s){var u="ws"+(e?"s":"")+"://"+t+":"+n+"/ws2/"+r+"/";return i?u+i+"?"+a.default.stringify({uuid:s}):o?u+"?"+a.default.stringify({at:o,uuid:s}):u+"?"+a.default.stringify({uuid:s})}},{key:"_get_api_url",value:function(e){var t=this._get_options();return t.apiKey?"/api/"+e+"/"+t.appId+"/"+t.apiKey:"/api/"+e+"/"+t.appId}},{key:"_get_on_url",value:function(e){var t=this._get_options();return t.apiKey?"/on/"+e+"/"+t.appId+"/"+t.apiKey:"/on/"+e+"/"+t.appId}},{key:"_get_pubsub",value:function(){return this.websocket}},{key:"_get_remote",value:function(){return this.remote}},{key:"_get_options",value:function(){return this.options}},{key:"dataStore",value:function(e,t){return new y.default(this,e,t)}},{key:"grant",value:function(e,t){var n=this._get_api_url("grant"),r={};this.remote.get(n,r).then(function(e){t(null,e)}).catch(function(e){t(e)})}}],[{key:"history",value:function(e,t){var n=e.appId,r=e.apiKey,i=!e.hasOwnProperty("useSSL")||e.useSSL,o=e.host||"pubsub1.mlkcca.com",s=e.port||443,a=new g.default(o,s,i,{});a.get("/api/history/"+n+"/"+r,{c:e.path}).then(function(e){t(null,e)}).catch(function(e){t(e)})}},{key:"grant",value:function(){}}]),e}();t.default=b,e.exports=t.default},function(e,t,n){"use strict";function r(e){function t(e){var t={menubar:1,location:0,resizable:0,scrollbars:1,status:0,dialog:1,width:700,height:375},r=window.open(e,o,t);n(r,"unload",function(){}),n(window,"message",function(e){e&&e.data&&a(e.data)})}function n(e,t,n){e.attachEvent?e.attachEvent("on"+t,n):e.addEventListener&&e.addEventListener(t,n,!1)}var r=e.appId,i=e.transport||"window",o=e.windowTitle||"Login",s=e.endpoint||"https://milkcocoav3.herokuapp.com",a=e.callback;if(!a)throw new Error("callback should be setted");var u=s+("/auth-api/auth/"+r+"/mlkcca?redirect_uri=")+encodeURIComponent(window.location.href);if("window"==i)t(u);else{if("redirect"!=i)throw new Error("invalid transport");t(u)}}Object.defineProperty(t,"__esModule",{value:!0}),t.authWithMilkcocoa=r},function(e,t){function n(){}e.exports=n,e.exports.HttpsAgent=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(26),a=r(s),u=function(){function e(t){i(this,e),this.spanList=[]}return o(e,[{key:"add",value:function(e,t){var n=new a.default(e,t);this.spanList.push(n),this.combine()}},{key:"combine",value:function(){this.spanList=this.spanList.reduce(function(e,t){return 0==e.length?[t]:e[0].combine(t)?e:e.concat([t])},[])}},{key:"query",value:function(e,t){for(var n=0;n<this.spanList.length;n++){var r=this.spanList[n],i=r.query(e,t);if(null!==i)return i}return null}}]),e}();t.default=u,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t,n){r(this,e),this.ts=t,this.data=n,this.tailTs=this.data[this.data.length-1].t}return i(e,[{key:"combine",value:function(e){return this.ts>=e.getTailTs()&&e.ts>=this.getTailTs()&&(this.data=this.mergeData(this.data,e.data),this.ts=Math.max(this.ts,e.ts),this.tailTs=Math.min(this.getTailTs(),e.getTailTs()),!0)}},{key:"mergeData",value:function(e,t){var n=e.concat(t),r={},i=n.filter(function(e){return!r[e.id]&&(r[e.id]=!0,!0)});return i.sort(function(e,t){return e.t>t.t?-1:e.t<t.t?1:0}),i}},{key:"getTailTs",value:function(){return this.tailTs}},{key:"query",value:function(e,t){if(this.ts>=e){var n=this.getData(e);if(n.length>=t)return n.slice(0,t)}return null}},{key:"getData",value:function(e){return this.data.filter(function(t){return t.t<=e})}}]),e}();t.default=o,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(){r(this,e),this.requestId=0,this.messages=[]}return i(e,[{key:"add",value:function(e,t){var n=this.getRequestId();return this.messages.push({id:n,message:e,cb:t}),n}},{key:"recvAck",value:function(e,t){var n=this.messages.filter(function(t){return t.id===e})[0];n&&n.cb&&n.cb(t),this.messages=this.messages.filter(function(t){return t.id!==e})}},{key:"enq",value:function(){var e=this.messages.shift();return e?e:null}},{key:"getRequestId",value:function(){return this.requestId>1e5&&(this.requestId=0),this.requestId++}}]),e}();t.default=o,e.exports=t.default},function(e,t,n){"use strict";(function(t){function r(e,t,n,r,i,o,c,f,p){function d(e){if(p){var t="";e.on("data",function(e){t+=e}),e.on("end",function(){p(null,JSON.parse(t))})}}var g=t?a:s;o&&(i+="?"+u.stringify(o)),console.log(i);var v={hostname:n,port:r||(t?443:80),path:i,method:e,headers:f,agent:t?l:h};if("GET"==e)return g.get(v,d).on("error",function(e){p(e)});var y=g.request(v,d);return y.setTimeout(5e3),y.on("timeout",function(){p&&p(new Error("timed out"),null),y.abort()}),y.on("error",function(e){p&&p(e,null)}),y.write(c),y.end(),y}function i(e,t,n,r,i,s,a,c,f){var h=r||(t?443:80),l=(t?"https://":"http://")+n+":"+h+i;s&&(l+="?"+u.stringify(s));var p=o(e,l);p.withCredentials=!0,p.onload=function(){try{var e=JSON.parse(p.responseText);f(null,e)}catch(e){f(null,JSON.parse(p.responseText))}},p.onerror=function(){f(p.statusText||"unknown error")};for(var d in c)p.setRequestHeader(d,c[d]);p.send(a)}function o(e,t){console.log(t);var n=new XMLHttpRequest;return"withCredentials"in n?n.open(e,t,!0):"undefined"!=typeof XDomainRequest?(n=new XDomainRequest,n.open(e,t)):n=null,n}var s=n(17),a=n(37),u=n(9),c=n(24),f=c.HttpsAgent,h=new c({maxSockets:100,maxFreeSockets:10,timeout:3e5,freeSocketKeepAliveTimeout:3e4}),l=new f({maxSockets:100,maxFreeSockets:10,timeout:3e5,freeSocketKeepAliveTimeout:3e4});"browser"!==t.title?e.exports={request:r}:e.exports={request:i}}).call(t,n(2))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(30),a=r(s),u=n(31),c=r(u),f=n(25),h=r(f),l=function(){function e(t,n,r){i(this,e),this.root=t,this.path=n;var o=r||{};this.setDataType(o.datatype||"json"),this.cache=new h.default}return o(e,[{key:"setDataType",value:function(e){if("text"!=e&&"json"!=e&&"binary"==e)throw new Error("invalid datatype");this.datatype=e}},{key:"on",value:function(e,t,n){var r=this;"push"==e?this.root._get_pubsub().subscribe(this.path,"push",function(e){t(a.default.decode(e,r.datatype))},n):"set"==e?this.root._get_pubsub().subscribe(this.path,"set",function(e){t(a.default.decode(e,r.datatype));
},n):"send"==e&&this.root._get_pubsub().subscribe(this.path,"send",function(e){t(c.default.decode(e,r.datatype))},n)}},{key:"off",value:function(e,t){var n="_p";"push"==e?n="_p":"send"==e&&(n="_s"),this.root._get_pubsub().unsubscribe(this.path,n,t)}},{key:"push",value:function(e,t,n){"function"==typeof t&&(n=t),this.root._get_pubsub().publish(this.path,"push",e,n)}},{key:"set",value:function(e,t,n,r){"function"==typeof n&&(r=n),this.root._get_pubsub().publish(this.path,"set",t,r,{_id:e})}},{key:"send",value:function(e,t){this.root._get_pubsub().publish(this.path,"_s",e,t)}},{key:"history",value:function(e,t){var n=this,r=this.root._get_api_url("history"),i={c:this.path};if(i.limit=e.limit||100,i.order=e.order||"desc",e.ts&&(i.id="d",i.ts=e.ts),e.useCache&&e.ts&&"desc"==i.order){var o=this.cache.query(e.ts,i.limit);if(o)return void t(null,o)}this.root._get_remote().get(r,i).then(function(r){if(r.err)t(r.err);else{var o=r.content,s=o.map(function(e){return a.default.decode(e,n.datatype)});e.useCache&&e.ts&&"desc"==i.order&&o.length>0&&n.cache.add(e.ts,s),t(null,s)}}).catch(function(e){t(e)})}}]),e}();t.default=l,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(){r(this,e)}return i(e,null,[{key:"decode",value:function(e,t){return"json"==t?this.json(e):"text"==t?this.text(e):"binary"==t?this.binary(e):this.text(e)}},{key:"json",value:function(e){return{id:e.id,timestamp:e.t,value:JSON.parse(e.v)}}},{key:"text",value:function(e){return e}},{key:"binary",value:function(e){return e}}]),e}();t.default=o,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(){r(this,e)}return i(e,null,[{key:"decode",value:function(e,t){return"json"==t?this.json(e):"text"==t?this.text(e):"binary"==t?this.binary(e):this.text(e)}},{key:"json",value:function(e){return{value:JSON.parse(e.v)}}},{key:"text",value:function(e){return e}},{key:"binary",value:function(e){return e}}]),e}();t.default=o,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(27),c=r(u),f=n(47),h=r(f),l=n(34),p=n(5).EventEmitter,d=function(e){function t(e,n){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.root=e,r.op=n,r.subscribers={},r.timestamp=0,r.caller=null,r}return s(t,e),a(t,[{key:"reg",value:function(e,t,n){this.subscribers[e]={cb:t},this.on(e,t),this._startSubscribe(n)}},{key:"_get_path_list",value:function(){return Object.keys(this.subscribers)}},{key:"_startSubscribe",value:function(e){var t=this;this._stopSubscribe();var n=this.root._get_on_url(this.op||"push"),r=this._get_path_list();if(0!=r.length){var i=r.join(",");this.caller=this.root._get_remote().get2(n,Object.assign({c:i,t:this.timestamp},{}),function(n,r){return n?(e&&e(n),void setTimeout(function(){t._startSubscribe()},5e3)):void(r.err?"permission_denied"==r.err?e&&e(r.err):e&&e(r.err):(Object.keys(r).forEach(function(e){t.timestamp<r[e][0][0]&&(t.timestamp=r[e][0][0]),r[e].reverse().map(function(e){return{id:e[1],t:e[0],v:e[2]}}).forEach(function(n){t.emit(e,n)})}),t._startSubscribe()))})}}},{key:"_stopSubscribe",value:function(){this.caller&&this.caller.abort()}},{key:"unreg",value:function(e,t){delete this.subscribers[e],t?this.removeListener(e,t):this.removeAllListeners(e)}},{key:"deliver",value:function(e,t){this.emit(e,t)}},{key:"get",value:function(){var e=this;return Object.keys(this.subscribers).map(function(t){return e.subscribers[t]})}}]),t}(p),g=function(e){function t(e,n){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.options=e,r.root=n,r.target=e.WebSocket,r.host=e.host,r.logger=e.logger,r.subscriberMan={},r.subscriberMan.push=new d(n,"push"),r.subscriberMan.set=new d(n,"set"),r.subscriberMan.send=new d(n,"send"),r.offlineQueue=[],r.messageStore=new c.default,r.wsOptions=e.wsOptions,r.reconnectPeriod=e.reconnectPeriod||5e3,r.reconnectTimer=null,r.pingTimer=null,r.pongArrived=!0,r.state="offline",r}return s(t,e),a(t,[{key:"sendEvent",value:function(e,t){var n=null;switch(this.getState()){case"offline":n=this.offline(e,t);break;case"connecting":n=this.connecting(e,t);break;case"online":n=this.online(e,t);break;case"disconnecting":n=this.disconnecting(e,t);break;default:console.error("unknow state")}n&&(this.emit("state-changed",{currentState:this.state,nextState:n.nextState}),this.logger.log("state changed from "+this.state+" to "+n.nextState),this.state=n.nextState)}},{key:"getState",value:function(){return this.state}},{key:"offline",value:function(e){return"connect"==e?{nextState:"connecting"}:null}},{key:"connecting",value:function(e,t){return"connect"==e?(this.logger.warn("already connecting"),null):"opened"==e?(this.emit("open",{}),this.flushOfflineMessage(),this._setupPingTimer(),{nextState:"online"}):"error"==e?(this._clean(),this._setupReconnect(),null):"closed"==e?(this._clean(),t.code>1e3?(this._setupReconnect(),null):{nextState:"offline"}):null}},{key:"online",value:function(e,t){return"connect"==e?(this.logger.warn("already connected"),null):"opened"==e?(this.logger.warn("already connected"),null):"error"==e?(this._clean(),this._setupReconnect(),{nextState:"connecting"}):"closed"==e?(this._clean(),t.code>1e3?(this._setupReconnect(),{nextState:"connecting"}):{nextState:"offline"}):"disconnect"==e?(this._disconnect(),{nextState:"disconnecting"}):null}},{key:"disconnecting",value:function(e){return"error"==e||"closed"==e?(this._clean(),{nextState:"offline"}):(this.logger.warn("now disconnecting"),null)}},{key:"connect",value:function(){this.sendEvent("connect",{})}},{key:"disconnect",value:function(){this.sendEvent("disconnect",{})}},{key:"publish",value:function(e,t,n,r,i){var o=this;this.flushOfflineMessage(function(){n=JSON.stringify(n);var s=o.messageStore.add({path:e,op:t,v:n,options:i},r),a=o.root._get_api_url(t||"push");o.root._get_remote().get(a,Object.assign({c:e,v:n},i)).then(function(e){o.messageStore.recvAck(s,e)}).catch(function(e){r(e)})})}},{key:"flushOfflineMessage",value:function(e){var t=this,n=this.messageStore.enq();if(n){var r=n.message,i=n.id,o=this.root._get_api_url(r.op||"push");this.root._get_remote().get(o,Object.assign({c:r.path,v:r.v},r.options)).then(function(n){t.messageStore.recvAck(i,n),t.flushOfflineMessage(e)}).catch(function(t){e(t)})}else e(null)}},{key:"subscribe",value:function(e,t,n,r){this.subscriberMan[t].reg(e,n,r)}},{key:"unsubscribe",value:function(e,t,n){this.subscriberMan[t].unreg(e,n)}},{key:"_connect",value:function(){var e=this;this.client=new l(this.target,this.host,this.wsOptions),this.client.on("error",function(t){e.logger.error(t),e.sendEvent("error",{})}),this.client.on("close",function(t){e.logger.log("closed",t),e.sendEvent("closed",{code:t})}),this.client.on("open",function(){e.sendEvent("opened",{})}),this.client.on("message",function(t){var n=JSON.parse(t);n.hasOwnProperty("e")?e.response(n):e.deliver(n)}),this.client.on("pong",function(){e._handlePong()})}},{key:"_disconnect",value:function(){this.client.close()}},{key:"_setupReconnect",value:function(){var e=this;setTimeout(function(){e._connect()},this.reconnectPeriod)}},{key:"response",value:function(e){this.messageStore.recvAck(e.e,e)}},{key:"deliver",value:function(e){this._resetPingInterval(),this.subscriberMan.deliver(e.p,e)}},{key:"_subscribe",value:function(e,t,n,r){this.send({p:e,_t:"s",_o:t},r)}},{key:"send",value:function(e,t){this.messageStore.add(e,t),this.client&&"online"==this.getState()&&(this.client.send(JSON.stringify(e)),this._resetPingInterval())}},{key:"_clean",value:function(){this.client.close(),this.client.clean(),this.client=null,null!==this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),this.emit("close",{})}},{key:"_setupPingTimer",value:function(){var e=this;!this.pingTimer&&this.options.keepalive&&(this.pongArrived=!0,this.pingTimer=(0,h.default)(function(){e._checkPing()},1e3*this.options.keepalive))}},{key:"_resetPingInterval",value:function(){this.pingTimer&&this.options.keepalive&&this.pingTimer.reschedule(1e3*this.options.keepalive)}},{key:"_checkPing",value:function(){this.pongArrived?(this.pongArrived=!1,this.client.ping()):this.sendEvent("error",{message:"pong not coming"})}},{key:"_handlePong",value:function(){this.pongArrived=!0}}]),t}(p);t.default=g,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(28),s=function(){function e(t,n,i,o){r(this,e),this.host=t,this.port=n,this.secure=i,this.headers=o}return i(e,[{key:"post",value:function(e,t){var n=this;return new Promise(function(r,i){o.request("POST",n.secure,n.host,n.port,e,null,JSON.stringify(t),n.headers,function(e,t){return e?i(e):t.err?i(t.err):void r(t.content)})})}},{key:"get",value:function(e,t){var n=this;return new Promise(function(r,i){o.request("GET",n.secure,n.host,n.port,e,t,null,n.headers,function(e,t){return e?i(e):void r(t)})})}},{key:"get2",value:function(e,t,n){return o.request("GET",this.secure,this.host,this.port,e,t,null,this.headers,function(e,t){return e?n(e):void n(null,t)})}},{key:"put",value:function(e,t){var n=this;return new Promise(function(r,i){o.request("PUT",n.secure,n.host,n.port,e,null,JSON.stringify(t),n.headers,function(e,t){return e?i(e):t.err?i(t.err):void r(t.content)})})}},{key:"delete",value:function(e,t){var n=this,r={};return Object.keys(t).forEach(function(e){r[e]=JSON.stringify(t[e])}),new Promise(function(t,i){o.request("DELETE",n.secure,n.host,n.port,e,r,null,n.headers,function(e,n){return e?i(e):n.err?i(n.err):void t(n.content)})})}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";(function(r){function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u="browser"===r.title,c=n(5).EventEmitter,f=function(e){function t(e,n,r){i(this,t);var s=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return u?(s.client=new e(n),s.client.onerror=s.fire("error"),s.client.onclose=function(e){s.emit("close",e.code)},s.client.onopen=s.fire("open"),s.client.onmessage=function(e){"pong"==e.data?s.emit("pong",e.data):s.emit("message",e.data)}):(s.client=new e(n,r),s.client.on("error",s.fire("error")),s.client.on("close",s.fire("close")),s.client.on("open",s.fire("open")),s.client.on("message",function(e){"pong"==e?s.emit("pong",e):s.emit("message",e)})),s}return s(t,e),a(t,[{key:"getReadyState",value:function(){return this.client.readyState}},{key:"send",value:function(e){this.client.send(e)}},{key:"ping",value:function(e){this.client.send("ping")}},{key:"fire",value:function(e){var t=this;return function(n){t.emit(e,n)}}},{key:"close",value:function(e,t){this.client.close(e,t)}},{key:"clean",value:function(){this.removeAllListeners("error"),this.removeAllListeners("close"),this.removeAllListeners("open"),this.removeAllListeners("message")}}]),t}(c);t.default=f,e.exports=t.default}).call(t,n(2))},function(e,t,n){"use strict";function r(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,s,a,u=e.length;s=r(e),a=new h(3*u/4-s),i=s>0?u-4:u;var c=0;for(t=0,n=0;t<i;t+=4,n+=3)o=f[e.charCodeAt(t)]<<18|f[e.charCodeAt(t+1)]<<12|f[e.charCodeAt(t+2)]<<6|f[e.charCodeAt(t+3)],a[c++]=o>>16&255,a[c++]=o>>8&255,a[c++]=255&o;return 2===s?(o=f[e.charCodeAt(t)]<<2|f[e.charCodeAt(t+1)]>>4,a[c++]=255&o):1===s&&(o=f[e.charCodeAt(t)]<<10|f[e.charCodeAt(t+1)]<<4|f[e.charCodeAt(t+2)]>>2,a[c++]=o>>8&255,a[c++]=255&o),a}function s(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function a(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(s(r));return i.join("")}function u(e){for(var t,n=e.length,r=n%3,i="",o=[],s=16383,u=0,f=n-r;u<f;u+=s)o.push(a(e,u,u+s>f?f:u+s));return 1===r?(t=e[n-1],i+=c[t>>2],i+=c[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=c[t>>10],i+=c[t>>4&63],i+=c[t<<2&63],i+="="),o.push(i),o.join("")}t.byteLength=i,t.toByteArray=o,t.fromByteArray=u;for(var c=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,d=l.length;p<d;++p)c[p]=l[p],f[l.charCodeAt(p)]=p;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},function(e,t){e.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},function(e,t,n){var r=n(17),i=e.exports;for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o]);i.request=function(e,t){return e||(e={}),e.scheme="https",e.protocol="https:",r.request.call(this,e,t)}},function(e,t){t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,f=-7,h=n?i-1:0,l=n?-1:1,p=e[t+h];for(h+=l,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+e[t+h],h+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=256*s+e[t+h],h+=l,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:(p?-1:1)*(1/0);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,f=(1<<c)-1,h=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+h>=1?l/u:l*Math.pow(2,1-h),t*u>=2&&(s++,u/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+p]=255&s,p+=d,s/=256,c-=8);e[n+p-d]|=128*g}},function(e,t,n){(function(e,r){var i;!function(o){function s(e){throw new RangeError(j[e])}function a(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function u(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(L,".");var i=e.split("."),o=a(i,t).join(".");return r+o}function c(e){for(var t,n,r=[],i=0,o=e.length;i<o;)t=e.charCodeAt(i++),t>=55296&&t<=56319&&i<o?(n=e.charCodeAt(i++),56320==(64512&n)?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--)):r.push(t);return r}function f(e){return a(e,function(e){var t="";return e>65535&&(e-=65536,t+=I(e>>>10&1023|55296),e=56320|1023&e),t+=I(e)}).join("")}function h(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:_}function l(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function p(e,t,n){var r=0;for(e=n?C(e/T):e>>1,e+=C(e/t);e>M*E>>1;r+=_)e=C(e/M);return C(r+(M+1)*e/(e+S))}function d(e){var t,n,r,i,o,a,u,c,l,d,g=[],v=e.length,y=0,b=x,m=R;for(n=e.lastIndexOf(A),n<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&s("not-basic"),g.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<v;){for(o=y,a=1,u=_;i>=v&&s("invalid-input"),c=h(e.charCodeAt(i++)),(c>=_||c>C((w-y)/a))&&s("overflow"),y+=c*a,l=u<=m?k:u>=m+E?E:u-m,!(c<l);u+=_)d=_-l,a>C(w/d)&&s("overflow"),a*=d;t=g.length+1,m=p(y-o,t,0==o),C(y/t)>w-b&&s("overflow"),b+=C(y/t),y%=t,g.splice(y++,0,b)}return f(g)}function g(e){var t,n,r,i,o,a,u,f,h,d,g,v,y,b,m,S=[];for(e=c(e),v=e.length,t=x,n=0,o=R,a=0;a<v;++a)g=e[a],g<128&&S.push(I(g));for(r=i=S.length,i&&S.push(A);r<v;){for(u=w,a=0;a<v;++a)g=e[a],g>=t&&g<u&&(u=g);for(y=r+1,u-t>C((w-n)/y)&&s("overflow"),n+=(u-t)*y,t=u,a=0;a<v;++a)if(g=e[a],g<t&&++n>w&&s("overflow"),g==t){for(f=n,h=_;d=h<=o?k:h>=o+E?E:h-o,!(f<d);h+=_)m=f-d,b=_-d,S.push(I(l(d+m%b,0))),f=C(m/b);S.push(I(l(f,0))),o=p(n,y,r==i),n=0,++r}++n,++t}return S.join("")}function v(e){return u(e,function(e){return O.test(e)?d(e.slice(4).toLowerCase()):e})}function y(e){return u(e,function(e){return P.test(e)?"xn--"+g(e):e})}var b=("object"==typeof t&&t&&!t.nodeType&&t,"object"==typeof e&&e&&!e.nodeType&&e,"object"==typeof r&&r);b.global!==b&&b.window!==b&&b.self!==b||(o=b);var m,w=2147483647,_=36,k=1,E=26,S=38,T=700,R=72,x=128,A="-",O=/^xn--/,P=/[^\x20-\x7E]/,L=/[\x2E\u3002\uFF0E\uFF61]/g,j={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=_-k,C=Math.floor,I=String.fromCharCode;m={version:"1.4.1",ucs2:{decode:c,encode:f},decode:d,encode:g,toASCII:y,toUnicode:v},i=function(){return m}.call(t,n,t,e),!(void 0!==i&&(e.exports=i))}(this)}).call(t,n(59)(e),n(0))},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var f=0;f<c;++f){var h,l,p,d,g=e[f].replace(a,"%20"),v=g.indexOf(n);v>=0?(h=g.substr(0,v),l=g.substr(v+1)):(h=g,l=""),p=decodeURIComponent(h),d=decodeURIComponent(l),r(s,p)?i(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";function r(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?r(s(e),function(s){var a=encodeURIComponent(i(s))+n;return o(e[s])?r(e[s],function(e){return a+encodeURIComponent(i(e))}).join(t):a+encodeURIComponent(i(e[s]))}).join(t):a?encodeURIComponent(i(a))+n+encodeURIComponent(i(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){e.exports=n(4)},function(e,t,n){"use strict";function r(){this.head=null,this.tail=null,this.length=0}var i=(n(1).Buffer,n(7));e.exports=r,r.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},r.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},r.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},r.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t}},function(e,t,n){e.exports=n(15)},function(e,t,n){e.exports=n(10)},function(e,t,n){e.exports=n(11)},function(e,t,n){"use strict";function r(e,t,n){var r=this;this._callback=e,this._args=n,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=r._interval),r._interval&&clearInterval(r._interval),r._interval=setInterval(r._callback,e,r._args)},this.clear=function(){r._interval&&(clearInterval(r._interval),r._interval=void 0)},this.destroy=function(){r._interval&&clearInterval(r._interval),r._callback=void 0,r._interval=void 0,r._args=void 0}}function i(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new r(arguments[0],arguments[1],e)}e.exports=i},function(e,t,n){(function(e,t){!function(e,n){"use strict";function r(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var r={callback:e,args:t};return g[d]=r,p(d),d++}function i(e){delete g[e]}function o(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}function s(e){if(v)setTimeout(s,0,e);else{var t=g[e];if(t){v=!0;try{o(t)}finally{i(e),v=!1}}}}function a(){p=function(e){t.nextTick(function(){s(e)})}}function u(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}function c(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&s(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),p=function(n){e.postMessage(t+n,"*")}}function f(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;s(t)},p=function(t){e.port2.postMessage(t)}}function h(){var e=y.documentElement;p=function(t){var n=y.createElement("script");n.onreadystatechange=function(){s(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}function l(){p=function(e){setTimeout(s,0,e)}}if(!e.setImmediate){var p,d=1,g={},v=!1,y=e.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(e);b=b&&b.setTimeout?b:e,"[object process]"==={}.toString.call(e.process)?a():u()?c():e.MessageChannel?f():y&&"onreadystatechange"in y.createElement("script")?h():l(),b.setImmediate=r,b.clearImmediate=i}}("undefined"==typeof self?"undefined"==typeof e?this:e:self)}).call(t,n(0),n(2))},function(e,t,n){(function(t,r,i){function o(e,t){return a.fetch&&t?"fetch":a.mozchunkedarraybuffer?"moz-chunked-arraybuffer":a.msstream?"ms-stream":a.arraybuffer&&e?"arraybuffer":a.vbArray&&e?"text:vbarray":"text"}function s(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}}var a=n(18),u=n(3),c=n(50),f=n(12),h=n(52),l=c.IncomingMessage,p=c.readyStates,d=e.exports=function(e){var n=this;f.Writable.call(n),n._opts=e,n._body=[],n._headers={},e.auth&&n.setHeader("Authorization","Basic "+new t(e.auth).toString("base64")),Object.keys(e.headers).forEach(function(t){n.setHeader(t,e.headers[t])});var r,i=!0;if("disable-fetch"===e.mode||"timeout"in e)i=!1,r=!0;else if("prefer-streaming"===e.mode)r=!1;else if("allow-wrong-content-type"===e.mode)r=!a.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");r=!0}n._mode=o(r,i),n.on("finish",function(){n._onFinish()})};u(d,f.Writable),d.prototype.setHeader=function(e,t){var n=this,r=e.toLowerCase();g.indexOf(r)===-1&&(n._headers[r]={name:e,value:t})},d.prototype.getHeader=function(e){var t=this;return t._headers[e.toLowerCase()].value},d.prototype.removeHeader=function(e){var t=this;delete t._headers[e.toLowerCase()]},d.prototype._onFinish=function(){var e=this;if(!e._destroyed){var n=e._opts,o=e._headers,s=null;if("POST"!==n.method&&"PUT"!==n.method&&"PATCH"!==n.method&&"MERGE"!==n.method||(s=a.blobConstructor?new r.Blob(e._body.map(function(e){return h(e)}),{type:(o["content-type"]||{}).value||""}):t.concat(e._body).toString()),"fetch"===e._mode){var u=Object.keys(o).map(function(e){return[o[e].name,o[e].value]});r.fetch(e._opts.url,{method:e._opts.method,headers:u,body:s||void 0,mode:"cors",credentials:n.withCredentials?"include":"same-origin"}).then(function(t){e._fetchResponse=t,e._connect()},function(t){e.emit("error",t)})}else{var c=e._xhr=new r.XMLHttpRequest;try{c.open(e._opts.method,e._opts.url,!0)}catch(t){return void i.nextTick(function(){e.emit("error",t)})}"responseType"in c&&(c.responseType=e._mode.split(":")[0]),"withCredentials"in c&&(c.withCredentials=!!n.withCredentials),"text"===e._mode&&"overrideMimeType"in c&&c.overrideMimeType("text/plain; charset=x-user-defined"),"timeout"in n&&(c.timeout=n.timeout,c.ontimeout=function(){e.emit("timeout")}),Object.keys(o).forEach(function(e){c.setRequestHeader(o[e].name,o[e].value)}),e._response=null,c.onreadystatechange=function(){switch(c.readyState){case p.LOADING:case p.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(c.onprogress=function(){e._onXHRProgress()}),c.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{c.send(s)}catch(t){return void i.nextTick(function(){e.emit("error",t)})}}}},d.prototype._onXHRProgress=function(){var e=this;s(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress())},d.prototype._connect=function(){var e=this;e._destroyed||(e._response=new l(e._xhr,e._fetchResponse,e._mode),e._response.on("error",function(t){e.emit("error",t)}),e.emit("response",e._response))},d.prototype._write=function(e,t,n){var r=this;r._body.push(e),n()},d.prototype.abort=d.prototype.destroy=function(){var e=this;e._destroyed=!0,e._response&&(e._response._destroyed=!0),e._xhr&&e._xhr.abort()},d.prototype.end=function(e,t,n){var r=this;"function"==typeof e&&(n=e,e=void 0),f.Writable.prototype.end.call(r,e,t,n)},d.prototype.flushHeaders=function(){},d.prototype.setTimeout=function(){},d.prototype.setNoDelay=function(){},d.prototype.setSocketKeepAlive=function(){};var g=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"]}).call(t,n(1).Buffer,n(0),n(2))},function(e,t,n){(function(e,r,i){var o=n(18),s=n(3),a=n(12),u=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=t.IncomingMessage=function(t,n,i){function s(){c.read().then(function(e){if(!u._destroyed){if(e.done)return void u.push(null);u.push(new r(e.value)),s()}}).catch(function(e){u.emit("error",e)})}var u=this;if(a.Readable.call(u),u._mode=i,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",function(){e.nextTick(function(){u.emit("close")})}),"fetch"===i){u._fetchResponse=n,u.url=n.url,u.statusCode=n.status,u.statusMessage=n.statusText,n.headers.forEach(function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)});var c=n.body.getReader();s()}else{u._xhr=t,u._pos=0,u.url=t.responseURL,u.statusCode=t.status,u.statusMessage=t.statusText;var f=t.getAllResponseHeaders().split(/\r?\n/);if(f.forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===u.headers[n]&&(u.headers[n]=[]),u.headers[n].push(t[2])):void 0!==u.headers[n]?u.headers[n]+=", "+t[2]:u.headers[n]=t[2],u.rawHeaders.push(t[1],t[2])}}),u._charset="x-user-defined",!o.overrideMimeType){var h=u.rawHeaders["mime-type"];if(h){var l=h.match(/;\s*charset=([^;])(;|$)/);l&&(u._charset=l[1].toLowerCase())}u._charset||(u._charset="utf-8")}}};s(c,a.Readable),c.prototype._read=function(){},c.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text:vbarray":if(t.readyState!==u.DONE)break;try{n=new i.VBArray(t.responseBody).toArray()}catch(e){}if(null!==n){e.push(new r(n));break}case"text":try{n=t.responseText}catch(t){e._mode="text:vbarray";break}if(n.length>e._pos){var o=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=new r(o.length),a=0;a<o.length;a++)s[a]=255&o.charCodeAt(a);e.push(s)}else e.push(o,e._charset);e._pos=n.length}break;case"arraybuffer":if(t.readyState!==u.DONE||!t.response)break;n=t.response,e.push(new r(new Uint8Array(n)));break;case"moz-chunked-arraybuffer":if(n=t.response,t.readyState!==u.LOADING||!n)break;e.push(new r(new Uint8Array(n)));break;case"ms-stream":if(n=t.response,t.readyState!==u.LOADING)break;var c=new i.MSStreamReader;c.onprogress=function(){c.result.byteLength>e._pos&&(e.push(new r(new Uint8Array(c.result.slice(e._pos)))),e._pos=c.result.byteLength)},c.onload=function(){e.push(null)},c.readAsArrayBuffer(n)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(t,n(2),n(1).Buffer,n(0))},function(e,t,n){function r(e,t){this._id=e,this._clearFn=t}var i=Function.prototype.apply;t.setTimeout=function(){return new r(i.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new r(i.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),
e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(48),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,n){var r=n(1).Buffer;e.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(r.isBuffer(e)){for(var t=new Uint8Array(e.length),n=e.length,i=0;i<n;i++)t[i]=e[i];return t.buffer}throw new Error("Argument must be a Buffer")}},function(e,t,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(e,t,n){if(e&&c.isObject(e)&&e instanceof r)return e;var i=new r;return i.parse(e,t,n),i}function o(e){return c.isString(e)&&(e=i(e)),e instanceof r?e.format():r.prototype.format.call(e)}function s(e,t){return i(e,!1,!0).resolve(t)}function a(e,t){return e?i(e,!1,!0).resolveObject(t):t}var u=n(39),c=n(54);t.parse=i,t.resolve=s,t.resolveObject=a,t.format=o,t.Url=r;var f=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,p=["<",">",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(p),g=["'"].concat(d),v=["%","/","?",";","#"].concat(g),y=["/","?","#"],b=255,m=/^[+a-z0-9A-Z_-]{0,63}$/,w=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},k={javascript:!0,"javascript:":!0},E={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},S=n(9);r.prototype.parse=function(e,t,n){if(!c.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),i=r!==-1&&r<e.indexOf("#")?"?":"#",o=e.split(i),s=/\\/g;o[0]=o[0].replace(s,"/"),e=o.join(i);var a=e;if(a=a.trim(),!n&&1===e.split("#").length){var h=l.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=S.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var p=f.exec(a);if(p){p=p[0];var d=p.toLowerCase();this.protocol=d,a=a.substr(p.length)}if(n||p||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var T="//"===a.substr(0,2);!T||p&&k[p]||(a=a.substr(2),this.slashes=!0)}if(!k[p]&&(T||p&&!E[p])){for(var R=-1,x=0;x<y.length;x++){var A=a.indexOf(y[x]);A!==-1&&(R===-1||A<R)&&(R=A)}var O,P;P=R===-1?a.lastIndexOf("@"):a.lastIndexOf("@",R),P!==-1&&(O=a.slice(0,P),a=a.slice(P+1),this.auth=decodeURIComponent(O)),R=-1;for(var x=0;x<v.length;x++){var A=a.indexOf(v[x]);A!==-1&&(R===-1||A<R)&&(R=A)}R===-1&&(R=a.length),this.host=a.slice(0,R),a=a.slice(R),this.parseHost(),this.hostname=this.hostname||"";var L="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!L)for(var j=this.hostname.split(/\./),x=0,M=j.length;x<M;x++){var C=j[x];if(C&&!C.match(m)){for(var I="",B=0,U=C.length;B<U;B++)I+=C.charCodeAt(B)>127?"x":C[B];if(!I.match(m)){var q=j.slice(0,x),D=j.slice(x+1),N=C.match(w);N&&(q.push(N[1]),D.unshift(N[2])),D.length&&(a="/"+D.join(".")+a),this.hostname=q.join(".");break}}}this.hostname.length>b?this.hostname="":this.hostname=this.hostname.toLowerCase(),L||(this.hostname=u.toASCII(this.hostname));var Y=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+Y,this.href+=this.host,L&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!_[d])for(var x=0,M=g.length;x<M;x++){var H=g[x];if(a.indexOf(H)!==-1){var W=encodeURIComponent(H);W===H&&(W=escape(H)),a=a.split(H).join(W)}}var z=a.indexOf("#");z!==-1&&(this.hash=a.substr(z),a=a.slice(0,z));var K=a.indexOf("?");if(K!==-1?(this.search=a.substr(K),this.query=a.substr(K+1),t&&(this.query=S.parse(this.query)),a=a.slice(0,K)):t&&(this.search="",this.query={}),a&&(this.pathname=a),E[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Y=this.pathname||"",G=this.search||"";this.path=Y+G}return this.href=this.format(),this},r.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",i=!1,o="";this.host?i=e+this.host:this.hostname&&(i=e+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(o=S.stringify(this.query));var s=this.search||o&&"?"+o||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||E[t])&&i!==!1?(i="//"+(i||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):i||(i=""),r&&"#"!==r.charAt(0)&&(r="#"+r),s&&"?"!==s.charAt(0)&&(s="?"+s),n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),s=s.replace("#","%23"),t+i+n+s+r},r.prototype.resolve=function(e){return this.resolveObject(i(e,!1,!0)).format()},r.prototype.resolveObject=function(e){if(c.isString(e)){var t=new r;t.parse(e,!1,!0),e=t}for(var n=new r,i=Object.keys(this),o=0;o<i.length;o++){var s=i[o];n[s]=this[s]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var a=Object.keys(e),u=0;u<a.length;u++){var f=a[u];"protocol"!==f&&(n[f]=e[f])}return E[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!E[e.protocol]){for(var h=Object.keys(e),l=0;l<h.length;l++){var p=h[l];n[p]=e[p]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||k[e.protocol])n.pathname=e.pathname;else{for(var d=(e.pathname||"").split("/");d.length&&!(e.host=d.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var g=n.pathname||"",v=n.search||"";n.path=g+v}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var y=n.pathname&&"/"===n.pathname.charAt(0),b=e.host||e.pathname&&"/"===e.pathname.charAt(0),m=b||y||n.host&&e.pathname,w=m,_=n.pathname&&n.pathname.split("/")||[],d=e.pathname&&e.pathname.split("/")||[],S=n.protocol&&!E[n.protocol];if(S&&(n.hostname="",n.port=null,n.host&&(""===_[0]?_[0]=n.host:_.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host=null),m=m&&(""===d[0]||""===_[0])),b)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,_=d;else if(d.length)_||(_=[]),_.pop(),_=_.concat(d),n.search=e.search,n.query=e.query;else if(!c.isNullOrUndefined(e.search)){if(S){n.hostname=n.host=_.shift();var T=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");T&&(n.auth=T.shift(),n.host=n.hostname=T.shift())}return n.search=e.search,n.query=e.query,c.isNull(n.pathname)&&c.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!_.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var R=_.slice(-1)[0],x=(n.host||e.host||_.length>1)&&("."===R||".."===R)||""===R,A=0,O=_.length;O>=0;O--)R=_[O],"."===R?_.splice(O,1):".."===R?(_.splice(O,1),A++):A&&(_.splice(O,1),A--);if(!m&&!w)for(;A--;A)_.unshift("..");!m||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),x&&"/"!==_.join("/").substr(-1)&&_.push("");var P=""===_[0]||_[0]&&"/"===_[0].charAt(0);if(S){n.hostname=n.host=P?"":_.length?_.shift():"";var T=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");T&&(n.auth=T.shift(),n.host=n.hostname=T.shift())}return m=m||n.host&&_.length,m&&!P&&_.unshift(""),_.length?n.pathname=_.join("/"):(n.pathname=null,n.path=null),c.isNull(n.pathname)&&c.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var e=this.host,t=h.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){(function(t){function n(e,t){function n(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(r("noDeprecation"))return e;var i=!1;return n}function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var n=t.localStorage[e];return null!=n&&"true"===String(n).toLowerCase()}e.exports=n}).call(t,n(0))},function(e,t,n){var r=n(57),i=n(58),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){function r(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var s=void 0!==e.clockseq?e.clockseq:u,h=void 0!==e.msecs?e.msecs:(new Date).getTime(),l=void 0!==e.nsecs?e.nsecs:f+1,p=h-c+(l-f)/1e4;if(p<0&&void 0===e.clockseq&&(s=s+1&16383),(p<0||h>c)&&void 0===e.nsecs&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=h,f=l,u=s,h+=122192928e5;var d=(1e4*(268435455&h)+l)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=255&d;var g=h/4294967296*1e4&268435455;i[r++]=g>>>8&255,i[r++]=255&g,i[r++]=g>>>24&15|16,i[r++]=g>>>16&255,i[r++]=s>>>8|128,i[r++]=255&s;for(var v=e.node||a,y=0;y<6;++y)i[r+y]=v[y];return t?t:o(i)}var i=n(21),o=n(20),s=i(),a=[1|s[0],s[1],s[2],s[3],s[4],s[5]],u=16383&(s[6]<<8|s[7]),c=0,f=0;e.exports=r},function(e,t,n){function r(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||i)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[r+a]=s[a];return t||o(s)}var i=n(21),o=n(20);e.exports=r},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){function n(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var i in n)r.call(n,i)&&(e[i]=n[i])}return e}e.exports=n;var r=Object.prototype.hasOwnProperty},function(e,t){e.exports={name:"mlkcca-js",version:"1.0.0",description:"mlkcca js sdk",main:"./lib/node/index.js",engines:{node:">=6.x"},scripts:{build:"gulp compile","build:web":"webpack","build:node":"gulp babel",test:"mocha test --recursive"},repository:{type:"git",url:"git+https://github.com/mlkcca/js.git"},keywords:["milkcocoa","IoT","pubsub","js"],author:"Uhuru, Inc",license:"MIT",bugs:{url:"https://github.com/mlkcca/js/issues"},homepage:"https://github.com/mlkcca/js#readme",dependencies:{agentkeepalive:"^3.1.0",reinterval:"^1.1.0",uuid:"^3.0.1",ws:"^2.2.0"},devDependencies:{assert:"^1.4.1","babel-core":"^6.23.1","babel-loader":"^6.3.2","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.22.0","babel-preset-es2017":"^6.22.0",gulp:"^3.9.1","gulp-babel":"^6.1.2","gulp-clean":"^0.3.2","gulp-rename":"^1.2.2","gulp-sourcemaps":"^2.4.1","gulp-uglify":"^2.0.1",mocha:"^3.2.0","run-sequence":"^1.2.2","stats-webpack-plugin":"^0.5.0",webpack:"^2.2.1"}}},function(e,t){},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(22),c=r(u),f=n(23),h={get:function(e){try{return localStorage.getItem(e)}catch(e){return null}},set:function(e,t){try{return localStorage.setItem(e,t)}catch(e){return null}}},l=function(e){function t(e){return i(this,t),e.store=h,e.WebSocket=window.WebSocket,o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return s(t,e),a(t,[{key:"version",value:function(){return packageJSON.version}}],[{key:"authWithMilkcocoa",value:function(e,n){(0,f.authWithMilkcocoa)(Object.assign({},e.authOptions,{appId:e.appId,callback:function(r){console.log(r),n(null,new t(Object.assign({},e,{accessToken:r})))}}))}}]),t}(c.default);t.default=l,e.exports=t.default}])});