-
Notifications
You must be signed in to change notification settings - Fork 14
/
aws-iot-device-sdk-js-react-native.js
22 lines (19 loc) · 192 KB
/
aws-iot-device-sdk-js-react-native.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.pro1=e():t.pro1=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=43)}([function(t,e,n){!function(n,r){t.exports=e=r()}(0,function(){var t=t||function(t,e){var n={},r=n.lib={},i=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=r.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=void 0!=e?e:4*t.length},toString:function(t){return(t||a).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;e[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var o=0;o<i;o+=4)e[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],i=0;i<e;i+=4){var s=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var i=(n<<16)+e&r;return i/=4294967296,(i+=.5)*(t.random()>.5?1:-1)}}(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new o.init(r,e)}}),s=n.enc={},a=s.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new o.init(n,e/2)}},c=s.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new o.init(n,e)}},u=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},h=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,i=n.sigBytes,s=this.blockSize,a=4*s,c=i/a;c=e?t.ceil(c):t.max((0|c)-this._minBufferSize,0);var u=c*s,h=t.min(4*u,i);if(u){for(var f=0;f<u;f+=s)this._doProcessBlock(r,f);var l=r.splice(0,u);n.sigBytes-=h}return new o.init(l,h)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),f=(r.Hasher=h.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},function(t,e,n){!function(r,i){t.exports=e=i(n(0))}(0,function(t){t.lib.Cipher||function(e){var n=t,r=n.lib,i=r.Base,o=r.WordArray,s=r.BufferedBlockAlgorithm,a=n.enc,c=(a.Utf8,a.Base64),u=n.algo,h=u.EvpKDF,f=r.Cipher=s.extend({cfg:i.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,n){this.cfg=this.cfg.extend(n),this._xformMode=t,this._key=e,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?E:m}return function(e){return{encrypt:function(n,r,i){return t(r).encrypt(e,n,r,i)},decrypt:function(n,r,i){return t(r).decrypt(e,n,r,i)}}}}()}),l=(r.StreamCipher=f.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),n.mode={}),p=r.BlockCipherMode=i.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),d=l.CBC=function(){function t(t,n,r){var i=this._iv;if(i){var o=i;this._iv=e}else var o=this._prevBlock;for(var s=0;s<r;s++)t[n+s]^=o[s]}var n=p.extend();return n.Encryptor=n.extend({processBlock:function(e,n){var r=this._cipher,i=r.blockSize;t.call(this,e,n,i),r.encryptBlock(e,n),this._prevBlock=e.slice(n,n+i)}}),n.Decryptor=n.extend({processBlock:function(e,n){var r=this._cipher,i=r.blockSize,o=e.slice(n,n+i);r.decryptBlock(e,n),t.call(this,e,n,i),this._prevBlock=o}}),n}(),g=n.pad={},v=g.Pkcs7={pad:function(t,e){for(var n=4*e,r=n-t.sigBytes%n,i=r<<24|r<<16|r<<8|r,s=[],a=0;a<r;a+=4)s.push(i);var c=o.create(s,r);t.concat(c)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},b=(r.BlockCipher=f.extend({cfg:f.cfg.extend({mode:d,padding:v}),reset:function(){f.reset.call(this);var t=this.cfg,e=t.iv,n=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=n.createEncryptor;else{var r=n.createDecryptor;this._minBufferSize=1}this._mode=r.call(n,this,e&&e.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else{var e=this._process(!0);t.unpad(e)}return e},blockSize:4}),r.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),y=n.format={},_=y.OpenSSL={stringify:function(t){var e=t.ciphertext,n=t.salt;if(n)var r=o.create([1398893684,1701076831]).concat(n).concat(e);else var r=e;return r.toString(c)},parse:function(t){var e=c.parse(t),n=e.words;if(1398893684==n[0]&&1701076831==n[1]){var r=o.create(n.slice(2,4));n.splice(0,4),e.sigBytes-=16}return b.create({ciphertext:e,salt:r})}},m=r.SerializableCipher=i.extend({cfg:i.extend({format:_}),encrypt:function(t,e,n,r){r=this.cfg.extend(r);var i=t.createEncryptor(n,r),o=i.finalize(e),s=i.cfg;return b.create({ciphertext:o,key:n,iv:s.iv,algorithm:t,mode:s.mode,padding:s.padding,blockSize:t.blockSize,formatter:r.format})},decrypt:function(t,e,n,r){return r=this.cfg.extend(r),e=this._parse(e,r.format),t.createDecryptor(n,r).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),w=n.kdf={},S=w.OpenSSL={execute:function(t,e,n,r){r||(r=o.random(8));var i=h.create({keySize:e+n}).compute(t,r),s=o.create(i.words.slice(e),4*n);return i.sigBytes=4*e,b.create({key:i,iv:s,salt:r})}},E=r.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:S}),encrypt:function(t,e,n,r){r=this.cfg.extend(r);var i=r.kdf.execute(n,t.keySize,t.ivSize);r.iv=i.iv;var o=m.encrypt.call(this,t,e,i.key,r);return o.mixIn(i),o},decrypt:function(t,e,n,r){r=this.cfg.extend(r),e=this._parse(e,r.format);var i=r.kdf.execute(n,t.keySize,t.ivSize,e.salt);return r.iv=i.iv,m.decrypt.call(this,t,e,i.key,r)}})}()})},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(t){if(h===setTimeout)return setTimeout(t,0);if((h===n||!h)&&setTimeout)return h=setTimeout,setTimeout(t,0);try{return h(t,0)}catch(e){try{return h.call(null,t,0)}catch(e){return h.call(this,t,0)}}}function o(t){if(f===clearTimeout)return clearTimeout(t);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function s(){g&&p&&(g=!1,p.length?d=p.concat(d):v=-1,d.length&&a())}function a(){if(!g){var t=i(s);g=!0;for(var e=d.length;e;){for(p=d,d=[];++v<e;)p&&p[v].run();v=-1,e=d.length}p=null,g=!1,o(t)}}function c(t,e){this.fun=t,this.array=e}function u(){}var h,f,l=t.exports={};!function(){try{h="function"==typeof setTimeout?setTimeout:n}catch(t){h=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(t){f=r}}();var p,d=[],g=!1,v=-1;l.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];d.push(new c(t,e)),1!==d.length||g||i(a)},c.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=u,l.addListener=u,l.once=u,l.off=u,l.removeListener=u,l.removeAllListeners=u,l.emit=u,l.prependListener=u,l.prependOnceListener=u,l.listeners=function(t){return[]},l.binding=function(t){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(t){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){function r(t,e){for(var n in t)e[n]=t[n]}function i(t,e,n){return s(t,e,n)}var o=n(11),s=o.Buffer;s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?t.exports=o:(r(o,e),e.Buffer=i),r(s,i),i.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return s(t,e,n)},i.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=s(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return s(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o.SlowBuffer(t)}},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!i(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,i,a,c,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var h=new Error('Uncaught, unspecified "error" event. ('+e+")");throw h.context=e,h}if(n=this._events[t],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),u=n.slice(),i=u.length,c=0;c<i;c++)u[c].apply(this,a);return!0},n.prototype.addListener=function(t,e){var i;if(!r(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,r(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned&&(i=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.trace),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var i=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,i,s,a;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],s=n.length,i=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(n)){for(a=s;a-- >0;)if(n[a]===e||n[a].listener&&n[a].listener===e){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],r(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);u.call(this,t),h.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",i)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(t){t.end()}var s=n(15).nextTick,a=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=r;var c=n(12);c.inherits=n(4);var u=n(36),h=n(38);c.inherits(r,u);for(var f=a(h.prototype),l=0;l<f.length;l++){var p=f[l];r.prototype[p]||(r.prototype[p]=h.prototype[p])}Object.defineProperty(r.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),r.prototype._destroy=function(t,e){this.push(null),this.end(),s(e,t)}},function(t,e,n){!function(r,i){t.exports=e=i(n(0))}(0,function(t){return function(){var e=t,n=e.lib,r=n.WordArray,i=e.enc;i.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=e[o>>>2]>>>24-o%4*8&255,a=e[o+1>>>2]>>>24-(o+1)%4*8&255,c=e[o+2>>>2]>>>24-(o+2)%4*8&255,u=s<<16|a<<8|c,h=0;h<4&&o+.75*h<n;h++)i.push(r.charAt(u>>>6*(3-h)&63));var f=r.charAt(64);if(f)for(;i.length%4;)i.push(f);return i.join("")},parse:function(t){var e=t.length,n=this._map,i=n.charAt(64);if(i){var o=t.indexOf(i);-1!=o&&(e=o)}for(var s=[],a=0,c=0;c<e;c++)if(c%4){var u=n.indexOf(t.charAt(c-1))<<c%4*2,h=n.indexOf(t.charAt(c))>>>6-c%4*2,f=u|h;s[a>>>2]|=f<<24-a%4*8,a++}return r.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),t.enc.Base64})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(20),n(19))}(0,function(t){return function(){var e=t,n=e.lib,r=n.Base,i=n.WordArray,o=e.algo,s=o.MD5,a=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:s,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,r=n.hasher.create(),o=i.create(),s=o.words,a=n.keySize,c=n.iterations;s.length<a;){u&&r.update(u);var u=r.update(t).finalize(e);r.reset();for(var h=1;h<c;h++)u=r.finalize(u),r.reset();o.concat(u)}return o.sigBytes=4*a,o}});e.EvpKDF=function(t,e,n){return a.create(n).compute(t,e)}}(),t.EvpKDF})},function(t,e,n){!function(r,i){t.exports=e=i(n(0))}(0,function(t){return function(e){function n(t,e,n,r,i,o,s){var a=t+(e&n|~e&r)+i+s;return(a<<o|a>>>32-o)+e}function r(t,e,n,r,i,o,s){var a=t+(e&r|n&~r)+i+s;return(a<<o|a>>>32-o)+e}function i(t,e,n,r,i,o,s){var a=t+(e^n^r)+i+s;return(a<<o|a>>>32-o)+e}function o(t,e,n,r,i,o,s){var a=t+(n^(e|~r))+i+s;return(a<<o|a>>>32-o)+e}var s=t,a=s.lib,c=a.WordArray,u=a.Hasher,h=s.algo,f=[];!function(){for(var t=0;t<64;t++)f[t]=4294967296*e.abs(e.sin(t+1))|0}();var l=h.MD5=u.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var s=0;s<16;s++){var a=e+s,c=t[a];t[a]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}var u=this._hash.words,h=t[e+0],l=t[e+1],p=t[e+2],d=t[e+3],g=t[e+4],v=t[e+5],b=t[e+6],y=t[e+7],_=t[e+8],m=t[e+9],w=t[e+10],S=t[e+11],E=t[e+12],k=t[e+13],I=t[e+14],A=t[e+15],x=u[0],T=u[1],C=u[2],B=u[3];x=n(x,T,C,B,h,7,f[0]),B=n(B,x,T,C,l,12,f[1]),C=n(C,B,x,T,p,17,f[2]),T=n(T,C,B,x,d,22,f[3]),x=n(x,T,C,B,g,7,f[4]),B=n(B,x,T,C,v,12,f[5]),C=n(C,B,x,T,b,17,f[6]),T=n(T,C,B,x,y,22,f[7]),x=n(x,T,C,B,_,7,f[8]),B=n(B,x,T,C,m,12,f[9]),C=n(C,B,x,T,w,17,f[10]),T=n(T,C,B,x,S,22,f[11]),x=n(x,T,C,B,E,7,f[12]),B=n(B,x,T,C,k,12,f[13]),C=n(C,B,x,T,I,17,f[14]),T=n(T,C,B,x,A,22,f[15]),x=r(x,T,C,B,l,5,f[16]),B=r(B,x,T,C,b,9,f[17]),C=r(C,B,x,T,S,14,f[18]),T=r(T,C,B,x,h,20,f[19]),x=r(x,T,C,B,v,5,f[20]),B=r(B,x,T,C,w,9,f[21]),C=r(C,B,x,T,A,14,f[22]),T=r(T,C,B,x,g,20,f[23]),x=r(x,T,C,B,m,5,f[24]),B=r(B,x,T,C,I,9,f[25]),C=r(C,B,x,T,d,14,f[26]),T=r(T,C,B,x,_,20,f[27]),x=r(x,T,C,B,k,5,f[28]),B=r(B,x,T,C,p,9,f[29]),C=r(C,B,x,T,y,14,f[30]),T=r(T,C,B,x,E,20,f[31]),x=i(x,T,C,B,v,4,f[32]),B=i(B,x,T,C,_,11,f[33]),C=i(C,B,x,T,S,16,f[34]),T=i(T,C,B,x,I,23,f[35]),x=i(x,T,C,B,l,4,f[36]),B=i(B,x,T,C,g,11,f[37]),C=i(C,B,x,T,y,16,f[38]),T=i(T,C,B,x,w,23,f[39]),x=i(x,T,C,B,k,4,f[40]),B=i(B,x,T,C,h,11,f[41]),C=i(C,B,x,T,d,16,f[42]),T=i(T,C,B,x,b,23,f[43]),x=i(x,T,C,B,m,4,f[44]),B=i(B,x,T,C,E,11,f[45]),C=i(C,B,x,T,A,16,f[46]),T=i(T,C,B,x,p,23,f[47]),x=o(x,T,C,B,h,6,f[48]),B=o(B,x,T,C,y,10,f[49]),C=o(C,B,x,T,I,15,f[50]),T=o(T,C,B,x,v,21,f[51]),x=o(x,T,C,B,E,6,f[52]),B=o(B,x,T,C,d,10,f[53]),C=o(C,B,x,T,w,15,f[54]),T=o(T,C,B,x,l,21,f[55]),x=o(x,T,C,B,_,6,f[56]),B=o(B,x,T,C,A,10,f[57]),C=o(C,B,x,T,b,15,f[58]),T=o(T,C,B,x,k,21,f[59]),x=o(x,T,C,B,g,6,f[60]),B=o(B,x,T,C,S,10,f[61]),C=o(C,B,x,T,p,15,f[62]),T=o(T,C,B,x,m,21,f[63]),u[0]=u[0]+x|0,u[1]=u[1]+T|0,u[2]=u[2]+C|0,u[3]=u[3]+B|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var o=e.floor(r/4294967296),s=r;n[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var h=c[u];c[u]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return a},clone:function(){var t=u.clone.call(this);return t._hash=this._hash.clone(),t}});s.MD5=u._createHelper(l),s.HmacMD5=u._createHmacHelper(l)}(Math),t.MD5})},function(t,e,n){"use strict";(function(t){function r(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t,e){if(r()<e)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):(null===t&&(t=new o(e)),t.length=e),t}function o(t,e,n){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(this,t)}return s(this,t,e,n)}function s(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?l(t,e,n,r):"string"==typeof e?h(t,e,n):p(t,e)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e,n,r){return a(e),e<=0?i(t,e):void 0!==n?"string"==typeof r?i(t,e).fill(n,r):i(t,e).fill(n):i(t,e)}function u(t,e){if(a(e),t=i(t,e<0?0:0|d(e)),!o.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function h(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!o.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|v(e,n);t=i(t,r);var s=t.write(e,n);return s!==r&&(t=t.slice(0,s)),t}function f(t,e){var n=e.length<0?0:0|d(e.length);t=i(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function l(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),o.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=o.prototype):t=f(t,e),t}function p(t,e){if(o.isBuffer(e)){var n=0|d(e.length);return t=i(t,n),0===t.length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||$(e.length)?i(t,0):f(t,e);if("Buffer"===e.type&&J(e.data))return f(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function d(t){if(t>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),o.alloc(+t)}function v(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(t).length;default:if(r)return W(t).length;e=(""+e).toLowerCase(),r=!0}}function b(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return T(this,e,n);case"ascii":return B(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return x(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function _(t,e,n,r,i){if(0===t.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:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:m(t,e,n,r,i);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):m(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,n,r,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}var u;if(i){var h=-1;for(u=n;u<a;u++)if(o(t,u)===o(e,-1===h?0:u-h)){if(-1===h&&(h=u),u-h+1===c)return h*s}else-1!==h&&(u-=u-h),h=-1}else for(n+c>a&&(n=a-c),u=n;u>=0;u--){for(var f=!0,l=0;l<c;l++)if(o(t,u+l)!==o(e,l)){f=!1;break}if(f)return u}return-1}function w(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.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(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function S(t,e,n,r){return Q(W(e,t.length-n),t,n,r)}function E(t,e,n,r){return Q(K(e),t,n,r)}function k(t,e,n,r){return E(t,e,n,r)}function I(t,e,n,r){return Q(V(e),t,n,r)}function A(t,e,n,r){return Q(Y(e,t.length-n),t,n,r)}function x(t,e,n){return 0===e&&n===t.length?G.fromByteArray(t):G.fromByteArray(t.slice(e,n))}function T(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=n){var c,u,h,f;switch(a){case 1:o<128&&(s=o);break;case 2:c=t[i+1],128==(192&c)&&(f=(31&o)<<6|63&c)>127&&(s=f);break;case 3:c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&(f=(15&o)<<12|(63&c)<<6|63&u)>2047&&(f<55296||f>57343)&&(s=f);break;case 4:c=t[i+1],u=t[i+2],h=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&(f=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)>65535&&f<1114112&&(s=f)}}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 C(r)}function C(t){var e=t.length;if(e<=Z)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=Z));return n}function B(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function O(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function R(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=F(t[o]);return i}function M(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function P(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,n,r,i,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function L(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function j(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(t,e,n,r,i){return i||D(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(t,e,n,r,23,4),n+4}function H(t,e,n,r,i){return i||D(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(t,e,n,r,52,8),n+8}function q(t){if(t=z(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function z(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function W(t,e){e=e||1/0;for(var n,r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=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((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function K(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}function Y(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}function V(t){return G.toByteArray(q(t))}function Q(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function $(t){return t!==t}/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var G=n(53),X=n(79),J=n(29);e.Buffer=o,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=r(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,n){return s(null,t,e,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,n){return c(null,t,e,n)},o.allocUnsafe=function(t){return u(null,t)},o.allocUnsafeSlow=function(t){return u(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,s=Math.min(n,r);i<s;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(t){switch(String(t).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}},o.concat=function(t,e){if(!J(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=o.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},o.byteLength=v,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},o.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):b.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},o.prototype.compare=function(t,e,n,r,i){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,i>>>=0,this===t)return 0;for(var s=i-r,a=n-e,c=Math.min(s,a),u=this.slice(r,i),h=t.slice(e,n),f=0;f<c;++f)if(u[f]!==h[f]){s=u[f],a=h[f];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},o.prototype.indexOf=function(t,e,n){return _(this,t,e,n,!0)},o.prototype.lastIndexOf=function(t,e,n){return _(this,t,e,n,!1)},o.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return S(this,t,e,n);case"ascii":return E(this,t,e,n);case"latin1":case"binary":return k(this,t,e,n);case"base64":return I(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;o.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r;if(o.TYPED_ARRAY_SUPPORT)r=this.subarray(t,e),r.__proto__=o.prototype;else{var i=e-t;r=new o(i,void 0);for(var s=0;s<i;++s)r[s]=this[s+t]}return r},o.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},o.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),X.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),X.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),X.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),X.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){N(this,t,e,n,Math.pow(2,8*n)-1,0)}var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},o.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){N(this,t,e,n,Math.pow(2,8*n)-1,0)}var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);N(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);N(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,n){return U(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return U(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return H(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return H(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<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),t.length-e<r-n&&(r=t.length-e+n);var i,s=r-n;if(this===t&&n<e&&e<r)for(i=s-1;i>=0;--i)t[i+e]=this[i+n];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},o.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=o.isBuffer(t)?t:W(new o(t,r).toString()),c=a.length;for(s=0;s<n-e;++s)this[s+e]=a[s%c]}return this};var tt=/[^+\/0-9A-Za-z-_]/g}).call(e,n(3))},function(t,e,n){(function(t){function n(t){return Array.isArray?Array.isArray(t):"[object Array]"===v(t)}function r(t){return"boolean"==typeof t}function i(t){return null===t}function o(t){return null==t}function s(t){return"number"==typeof t}function a(t){return"string"==typeof t}function c(t){return"symbol"==typeof t}function u(t){return void 0===t}function h(t){return"[object RegExp]"===v(t)}function f(t){return"object"==typeof t&&null!==t}function l(t){return"[object Date]"===v(t)}function p(t){return"[object Error]"===v(t)||t instanceof Error}function d(t){return"function"==typeof t}function g(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function v(t){return Object.prototype.toString.call(t)}e.isArray=n,e.isBoolean=r,e.isNull=i,e.isNullOrUndefined=o,e.isNumber=s,e.isString=a,e.isSymbol=c,e.isUndefined=u,e.isRegExp=h,e.isObject=f,e.isDate=l,e.isError=p,e.isFunction=d,e.isPrimitive=g,e.isBuffer=t.isBuffer}).call(e,n(11).Buffer)},function(t,e){t.exports=function(t){return void 0===t||null===t}},function(t,e,n){!function(r,i){t.exports=e=i(n(0))}(0,function(t){return function(e){var n=t,r=n.lib,i=r.Base,o=r.WordArray,s=n.x64={};s.Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),s.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=void 0!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;r<e;r++){var i=t[r];n.push(i.high),n.push(i.low)}return o.create(n,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;r<n;r++)e[r]=e[r].clone();return t}})}(),t})},function(t,e,n){"use strict";(function(e){function n(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return e.nextTick(function(){t.apply(null,o)})}}!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:n}:t.exports=e}).call(e,n(2))},function(t,e,n){e=t.exports=n(36),e.Stream=e,e.Readable=e,e.Writable=n(38),e.Duplex=n(7),e.Transform=n(37),e.PassThrough=n(96)},function(t,e,n){(function(t,r){function i(t,n){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(n)?r.showHidden=n:n&&e._extend(r,n),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),c(r,t,r.depth)}function o(t,e){var n=i.styles[e];return n?"["+i.colors[n][0]+"m"+t+"["+i.colors[n][1]+"m":t}function s(t,e){return t}function a(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function c(t,n,r){if(t.customInspect&&n&&A(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,t);return _(i)||(i=c(t,i,r)),i}var o=u(t,n);if(o)return o;var s=Object.keys(n),g=a(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(n)),I(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return h(n);if(0===s.length){if(A(n)){var v=n.name?": "+n.name:"";return t.stylize("[Function"+v+"]","special")}if(S(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(k(n))return t.stylize(Date.prototype.toString.call(n),"date");if(I(n))return h(n)}var b="",y=!1,m=["{","}"];if(d(n)&&(y=!0,m=["[","]"]),A(n)){b=" [Function"+(n.name?": "+n.name:"")+"]"}if(S(n)&&(b=" "+RegExp.prototype.toString.call(n)),k(n)&&(b=" "+Date.prototype.toUTCString.call(n)),I(n)&&(b=" "+h(n)),0===s.length&&(!y||0==n.length))return m[0]+b+m[1];if(r<0)return S(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var w;return w=y?f(t,n,r,g,s):s.map(function(e){return l(t,n,r,g,e,y)}),t.seen.pop(),p(w,b,m)}function u(t,e){if(w(e))return t.stylize("undefined","undefined");if(_(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return y(e)?t.stylize(""+e,"number"):g(e)?t.stylize(""+e,"boolean"):v(e)?t.stylize("null","null"):void 0}function h(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,n,r,i){for(var o=[],s=0,a=e.length;s<a;++s)C(e,String(s))?o.push(l(t,e,n,r,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(l(t,e,n,r,i,!0))}),o}function l(t,e,n,r,i,o){var s,a,u;if(u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},u.get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),C(r,i)||(s="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=v(n)?c(t,u.value,null):c(t,u.value,n-1),a.indexOf("\n")>-1&&(a=o?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),w(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function p(t,e,n){var r=0;return t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function d(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function v(t){return null===t}function b(t){return null==t}function y(t){return"number"==typeof t}function _(t){return"string"==typeof t}function m(t){return"symbol"==typeof t}function w(t){return void 0===t}function S(t){return E(t)&&"[object RegExp]"===T(t)}function E(t){return"object"==typeof t&&null!==t}function k(t){return E(t)&&"[object Date]"===T(t)}function I(t){return E(t)&&("[object Error]"===T(t)||t instanceof Error)}function A(t){return"function"==typeof t}function x(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function T(t){return Object.prototype.toString.call(t)}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var B=/%[sdj%]/g;e.format=function(t){if(!_(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(i(arguments[n]));return e.join(" ")}for(var n=1,r=arguments,o=r.length,s=String(t).replace(B,function(t){if("%%"===t)return"%";if(n>=o)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}),a=r[n];n<o;a=r[++n])v(a)||!E(a)?s+=" "+a:s+=" "+i(a);return s},e.deprecate=function(n,i){function o(){if(!s){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation,s=!0}return n.apply(this,arguments)}if(w(t.process))return function(){return e.deprecate(n,i).apply(this,arguments)};if(!0===r.noDeprecation)return n;var s=!1;return o};var O,R={};e.debuglog=function(t){if(w(O)&&(O=r.env.NODE_DEBUG||""),t=t.toUpperCase(),!R[t])if(new RegExp("\\b"+t+"\\b","i").test(O)){r.pid;R[t]=function(){e.format.apply(e,arguments)}}else R[t]=function(){};return R[t]},e.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=g,e.isNull=v,e.isNullOrUndefined=b,e.isNumber=y,e.isString=_,e.isSymbol=m,e.isUndefined=w,e.isRegExp=S,e.isObject=E,e.isDate=k,e.isError=I,e.isFunction=A,e.isPrimitive=x,e.isBuffer=n(105);e.log=function(){},e.inherits=n(104),e._extend=function(t,e){if(!e||!E(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(e,n(3),n(2))},function(t,e,n){(function(e){function r(t){return t>9?t:"0"+t}function i(){var t=new Date;return t.getUTCFullYear()+""+r(t.getUTCMonth()+1)+r(t.getUTCDate())+"T"+r(t.getUTCHours())+r(t.getUTCMinutes())+r(t.getUTCSeconds())+"Z"}function o(t){return t.substring(0,t.indexOf("T"))}function s(t,e,n,r){var i=v.HmacSHA256(e,"AWS4"+t,{asBytes:!0}),o=v.HmacSHA256(n,i,{asBytes:!0}),s=v.HmacSHA256(r,o,{asBytes:!0});return v.HmacSHA256("aws4_request",s,{asBytes:!0})}function a(t,e,n,r,i,o,a,c,u,h,f,l,p,d){var g="host:"+n.toLowerCase()+"\n",b=t+"\n"+r+"\n"+i+"\n"+g+"\nhost\n"+v.SHA256(h,{asBytes:!0}),_=v.SHA256(b,{asBytes:!0}),m="AWS4-HMAC-SHA256\n"+l+"\n"+f+"/"+c+"/"+u+"/aws4_request\n"+_,w=s(a,f,c,u),S=v.HmacSHA256(m,w,{asBytes:!0}),E=i+"&X-Amz-Signature="+S;y(d)||(E+="&X-Amz-Security-Token="+encodeURIComponent(d));var k=e+n+r+"?"+E;return k}function c(t,e,n,r){var s=i(),c=o(s),u="X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential="+e+"%2F"+c+"%2F"+t.region+"%2Fiotdevicegateway%2Faws4_request&X-Amz-Date="+s+"&X-Amz-SignedHeaders=host",h=t.host;return y(t.port)||443===t.port||(h=t.host+":"+t.port),a("GET","wss://",h,"/mqtt",u,e,n,t.region,"iotdevicegateway","",c,s,t.debug,r)}function u(t){var e=t.host;return y(t.port)||443===t.port||(e=t.host+":"+t.port),"wss://"+e+"/mqtt"}function h(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(this,t[n],parseInt(n,10))}function f(t){var e={},n={};return h(t.split(/\r?\n/),function(t){t=t.split(/(^|\s)[;#]/)[0];var r=t.match(/^\s*\[([^\[\]]+)\]\s*$/);if(r)n=r[1];else if(n){var i=t.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);i&&(e[n]=e[n]||{},e[n][i[1]]=i[2])}}),e}function l(t){function r(t,e){0===x.filter(function(e){return e.topic===t}).length&&x.push({topic:t,options:e})}function i(t,e){var n=x.filter(function(e){return e.topic!==t});x=n}function o(t,e,n){var o=null;!1!==T&&("subscribe"===t?o=r:"unsubscribe"===t&&(o=i),"[object Array]"===Object.prototype.toString.call(e)?e.forEach(function(t,e,r){o(t,n)}):o(e,n))}function s(){return"inactive"===P}function a(e){var n=t.protocol;if("wss"===n){var r;r=""===O||""===R?"wss://no-credentials-available":c(t,O,R,M),t.debug,t.url=r}else"wss-custom-auth"===n&&(t.url=u(t),t.debug,n="wss");return G[n](e,t)}function h(){B=j,X.options.reconnectPeriod=B,H=null,P="stable"}function p(){var t=!0;return k>0&&S.length>=k&&("oldest"===I?S.shift():t=!1),t}function d(){var t=C.shift();if(y(t)){var e=A.shift();if(y(e)){var n=S.shift();y(n)||X.publish(n.topic,n.message,n.options,n.callback),0===S.length&&(clearInterval(N),N=null)}else o(e.type,e.topics,e.options),"subscribe"===e.type?y(e.callback)?X.subscribe(e.topics,e.options):X.subscribe(e.topics,e.options,e.callback):"unsubscribe"===e.type&&X.unsubscribe(e.topics,e.callback)}else y(t.callback)?X.subscribe(t.topic,t.options):X.subscribe(t.topic,t.options,t.callback)}if(!(this instanceof l))return new l(t);var v=this,S=[],E=!0,k=0,I="oldest";S.length=0;var A=[];A.length=0;var x=[],T=!0;x.length=0;var C=[];C.length=0;var B,O,R,M,P="inactive",N=null,L=250,j=1e3,D=2e4,U=128e3,H=null,q=n(50),z=q.version,F="?SDK=JavaScript&Version="+z;if(y(t)||0===Object.keys(t).length)throw new Error(b.INVALID_CONNECT_OPTIONS);if(y(t.keepalive)&&(t.keepalive=300),(y(t.enableMetrics)||!0===t.enableMetrics)&&(y(t.username)?t.username=F:t.username+=F),y(t.baseReconnectTimeMs)||(j=t.baseReconnectTimeMs),y(t.minimumConnectionTimeMs)||(D=t.minimumConnectionTimeMs),y(t.maximumReconnectTimeMs)||(U=t.maximumReconnectTimeMs),y(t.drainTimeMs)||(L=t.drainTimeMs),y(t.autoResubscribe)||(T=t.autoResubscribe),y(t.offlineQueueing)||(E=t.offlineQueueing),y(t.offlineQueueMaxSize)||(k=t.offlineQueueMaxSize),y(t.offlineQueueDropBehavior)||(I=t.offlineQueueDropBehavior),B=j,t.reconnectPeriod=B,t.fastDisconnectDetection=!0,t.resubscribe=!1,t.baseReconnectTimeMs<=0)throw new Error(b.INVALID_RECONNECT_TIMING);if(U<j)throw new Error(b.INVALID_RECONNECT_TIMING);if(D<j)throw new Error(b.INVALID_RECONNECT_TIMING);if("newest"!==I&&"oldest"!==I)throw new Error(b.INVALID_OFFLINE_QUEUEING_PARAMETERS);if(k<0)throw new Error(b.INVALID_OFFLINE_QUEUEING_PARAMETERS);if(y(t.protocol)&&(t.protocol="mqtts"),y(t.host))throw new Error(b.INVALID_CONNECT_OPTIONS);if("mqtts"===t.protocol)y(t.port)&&(t.port=8883),_(t);else if("wss"===t.protocol||"wss-custom-auth"===t.protocol){if("wss"===t.protocol){if(O=y(t.accessKeyId)?e.env.AWS_ACCESS_KEY_ID:t.accessKeyId,R=y(t.secretKey)?e.env.AWS_SECRET_ACCESS_KEY:t.secretKey,M=y(t.sessionToken)?e.env.AWS_SESSION_TOKEN:t.sessionToken,y(O)||y(R)){var W;try{W=y(t.filename)?function(){var t=e.env.HOME||e.env.USERPROFILE||(e.env.HOMEPATH?(e.env.HOMEDRIVE||"C:/")+e.env.HOMEPATH:null);return m.join(t,".aws","credentials")}():t.filename;var K=t.profile||e.env.AWS_PROFILE||"default",Y=f(w.readFileSync(W,"utf-8")),V=Y[K];O=V.aws_access_key_id,R=V.aws_secret_access_key,M=V.aws_session_token}catch(t){}}if(y(O)||y(R))throw new Error(b.INVALID_CONNECT_OPTIONS)}else if(y(t.customAuthHeaders))throw new Error(b.INVALID_CONNECT_OPTIONS);if(!y(t.host)&&y(t.region)){var Q=/[a-zA-Z0-9]+\.iot\.([a-z]+-[a-z]+-[0-9]+)\.amazonaws\..+/,$=Q.exec(t.host);if(null===$)throw new Error(b.INVALID_CONNECT_OPTIONS);t.region=$[1]}y(t.port)&&(t.port=443),y(t.websocketOptions)?t.websocketOptions={protocol:"mqttv3.1"}:t.websocketOptions.protocol="mqttv3.1","wss-custom-auth"===t.protocol&&(t.websocketOptions.headers=t.customAuthHeaders)}!y(t)&&t.debug;var G={};G.mqtts=n(47),G.wss=n(48);var X=new g.MqttClient(a,t);X.on("connect",function(t){null===H&&(H=setTimeout(h,D)),P="established",null===N&&(C=x.slice(0),N=setInterval(d,L)),v.emit("connect",t)}),X.on("close",function(e){y(e)||v.emit("error",e),!y(t)&&t.debug,clearTimeout(H),H=null,clearInterval(N),N=null,P="inactive",v.emit("close")}),X.on("reconnect",function(){B*=2,B=Math.min(U,B),X.options.reconnectPeriod=B,v.emit("reconnect")}),X.on("offline",function(){v.emit("offline")}),X.on("error",function(t){v.emit("error",t)}),X.on("packetsend",function(t){v.emit("packetsend",t)}),X.on("packetreceive",function(t){v.emit("packetreceive",t)}),X.on("message",function(t,e,n){v.emit("message",t,e,n)}),this.publish=function(t,e,n,r){!0!==E||!s()&&null===N?!0!==E&&s()||X.publish(t,e,n,r):p()&&S.push({topic:t,message:e,options:n,callback:r})},this.subscribe=function(t,e,n){s()&&!1!==T?A.length<50?A.push({type:"subscribe",topics:t,options:e,callback:n}):v.emit("error",new Error("Maximum queued offline subscription reached")):(o("subscribe",t,e),y(n)?X.subscribe(t,e):X.subscribe(t,e,n))},this.unsubscribe=function(e,n){s()&&!1!==T?A.length<50&&A.push({type:"unsubscribe",topics:e,options:t,callback:n}):(o("unsubscribe",e),X.unsubscribe(e,n))},this.end=function(t,e){X.end(t,e)},this.handleMessage=X.handleMessage.bind(X),X.handleMessage=function(t,e){v.handleMessage(t,e)},this.updateWebSocketCredentials=function(t,e,n,r){O=t,R=e,M=n},this.getWebsocketHeaders=function(){return t.websocketOptions.headers},this.updateCustomAuthHeaders=function(e){t.websocketOptions.headers=e},this.simulateNetworkFailure=function(){X.stream.emit("error",new Error("simulated connection error")),X.stream.end()}}var p=n(6),d=n(17).inherits,g=n(87),v=n(57),b=n(46),y=n(13),_=n(45),m=n(90),w=n(22);d(l,p.EventEmitter),t.exports=l,t.exports.DeviceClient=l,t.exports.prepareWebSocketUrl=c,t.exports.prepareWebSocketCustomAuthUrl=u}).call(e,n(2))},function(t,e,n){!function(r,i){t.exports=e=i(n(0))}(0,function(t){!function(){var e=t,n=e.lib,r=n.Base,i=e.enc,o=i.Utf8,s=e.algo;s.HMAC=r.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=o.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var i=this._oKey=e.clone(),s=this._iKey=e.clone(),a=i.words,c=s.words,u=0;u<n;u++)a[u]^=1549556828,c[u]^=909522486;i.sigBytes=s.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})}()})},function(t,e,n){!function(r,i){t.exports=e=i(n(0))}(0,function(t){return function(){var e=t,n=e.lib,r=n.WordArray,i=n.Hasher,o=e.algo,s=[],a=o.SHA1=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],a=n[3],c=n[4],u=0;u<80;u++){if(u<16)s[u]=0|t[e+u];else{var h=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=h<<1|h>>>31}var f=(r<<5|r>>>27)+c+s[u];f+=u<20?1518500249+(i&o|~i&a):u<40?1859775393+(i^o^a):u<60?(i&o|i&a|o&a)-1894007588:(i^o^a)-899497514,c=a,a=o,o=i<<30|i>>>2,i=r,r=f}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+a|0,n[4]=n[4]+c|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(r+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA1=i._createHelper(a),e.HmacSHA1=i._createHmacHelper(a)}(),t.SHA1})},function(t,e,n){"use strict";function r(t,e){function n(n){e.rejectUnauthorized&&t.emit("error",n),r.end()}var r;return e.port=e.port||8883,e.host=e.hostname||e.host||"localhost",e.rejectUnauthorized=!1!==e.rejectUnauthorized,delete e.path,r=i.connect(e),r.on("secureConnect",function(){e.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",n)}),r.on("error",n),r}var i=n(110);t.exports=r},function(t,e){},function(t,e,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(t,e,n){if(t&&u.isObject(t)&&t instanceof r)return t;var i=new r;return i.parse(t,e,n),i}function o(t){return u.isString(t)&&(t=i(t)),t instanceof r?t.format():r.prototype.format.call(t)}function s(t,e){return i(t,!1,!0).resolve(e)}function a(t,e){return t?i(t,!1,!0).resolveObject(e):e}var c=n(91),u=n(102);e.parse=i,e.resolve=s,e.resolveObject=a,e.format=o,e.Url=r;var h=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,p=["<",">",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(p),g=["'"].concat(d),v=["%","/","?",";","#"].concat(g),b=["/","?","#"],y=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},S={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},E=n(94);r.prototype.parse=function(t,e,n){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),i=-1!==r&&r<t.indexOf("#")?"?":"#",o=t.split(i),s=/\\/g;o[0]=o[0].replace(s,"/"),t=o.join(i);var a=t;if(a=a.trim(),!n&&1===t.split("#").length){var f=l.exec(a);if(f)return this.path=a,this.href=a,this.pathname=f[1],f[2]?(this.search=f[2],this.query=e?E.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var p=h.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 k="//"===a.substr(0,2);!k||p&&w[p]||(a=a.substr(2),this.slashes=!0)}if(!w[p]&&(k||p&&!S[p])){for(var I=-1,A=0;A<b.length;A++){var x=a.indexOf(b[A]);-1!==x&&(-1===I||x<I)&&(I=x)}var T,C;C=-1===I?a.lastIndexOf("@"):a.lastIndexOf("@",I),-1!==C&&(T=a.slice(0,C),a=a.slice(C+1),this.auth=decodeURIComponent(T)),I=-1;for(var A=0;A<v.length;A++){var x=a.indexOf(v[A]);-1!==x&&(-1===I||x<I)&&(I=x)}-1===I&&(I=a.length),this.host=a.slice(0,I),a=a.slice(I),this.parseHost(),this.hostname=this.hostname||"";var B="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!B)for(var O=this.hostname.split(/\./),A=0,R=O.length;A<R;A++){var M=O[A];if(M&&!M.match(y)){for(var P="",N=0,L=M.length;N<L;N++)M.charCodeAt(N)>127?P+="x":P+=M[N];if(!P.match(y)){var j=O.slice(0,A),D=O.slice(A+1),U=M.match(_);U&&(j.push(U[1]),D.unshift(U[2])),D.length&&(a="/"+D.join(".")+a),this.hostname=j.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=c.toASCII(this.hostname));var H=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+H,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!m[d])for(var A=0,R=g.length;A<R;A++){var z=g[A];if(-1!==a.indexOf(z)){var F=encodeURIComponent(z);F===z&&(F=escape(z)),a=a.split(z).join(F)}}var W=a.indexOf("#");-1!==W&&(this.hash=a.substr(W),a=a.slice(0,W));var K=a.indexOf("?");if(-1!==K?(this.search=a.substr(K),this.query=a.substr(K+1),e&&(this.query=E.parse(this.query)),a=a.slice(0,K)):e&&(this.search="",this.query={}),a&&(this.pathname=a),S[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var H=this.pathname||"",Y=this.search||"";this.path=H+Y}return this.href=this.format(),this},r.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",i=!1,o="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&u.isObject(this.query)&&Object.keys(this.query).length&&(o=E.stringify(this.query));var s=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||S[e])&&!1!==i?(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(t){return encodeURIComponent(t)}),s=s.replace("#","%23"),e+i+n+s+r},r.prototype.resolve=function(t){return this.resolveObject(i(t,!1,!0)).format()},r.prototype.resolveObject=function(t){if(u.isString(t)){var e=new r;e.parse(t,!1,!0),t=e}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=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),c=0;c<a.length;c++){var h=a[c];"protocol"!==h&&(n[h]=t[h])}return S[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!S[t.protocol]){for(var f=Object.keys(t),l=0;l<f.length;l++){var p=f[l];n[p]=t[p]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||w[t.protocol])n.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var g=n.pathname||"",v=n.search||"";n.path=g+v}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),y=t.host||t.pathname&&"/"===t.pathname.charAt(0),_=y||b||n.host&&t.pathname,m=_,E=n.pathname&&n.pathname.split("/")||[],d=t.pathname&&t.pathname.split("/")||[],k=n.protocol&&!S[n.protocol];if(k&&(n.hostname="",n.port=null,n.host&&(""===E[0]?E[0]=n.host:E.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),_=_&&(""===d[0]||""===E[0])),y)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,E=d;else if(d.length)E||(E=[]),E.pop(),E=E.concat(d),n.search=t.search,n.query=t.query;else if(!u.isNullOrUndefined(t.search)){if(k){n.hostname=n.host=E.shift();var I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");I&&(n.auth=I.shift(),n.host=n.hostname=I.shift())}return n.search=t.search,n.query=t.query,u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var A=E.slice(-1)[0],x=(n.host||t.host||E.length>1)&&("."===A||".."===A)||""===A,T=0,C=E.length;C>=0;C--)A=E[C],"."===A?E.splice(C,1):".."===A?(E.splice(C,1),T++):T&&(E.splice(C,1),T--);if(!_&&!m)for(;T--;T)E.unshift("..");!_||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),x&&"/"!==E.join("/").substr(-1)&&E.push("");var B=""===E[0]||E[0]&&"/"===E[0].charAt(0);if(k){n.hostname=n.host=B?"":E.length?E.shift():"";var I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");I&&(n.auth=I.shift(),n.host=n.hostname=I.shift())}return _=_||n.host&&E.length,_&&!B&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=f.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,n){"use strict";(function(e,r){function i(t,n,r){var i=new s({objectMode:t.objectMode});return i._write=n,i._flush=r,i._destroy=function(t,n){var r=this;this.push(null),this.end(),e.nextTick(function(){n(t),r.emit("close")})},i}function o(t,n,o){function s(t,e,n){if(_.readyState!==_.OPEN)return void n();A&&"string"==typeof t&&(t=new u(t,"utf8")),_.send(t,n)}function h(t,e,n){if(_.bufferedAmount>k)return void setTimeout(h,I,t,e,n);A&&"string"==typeof t&&(t=new u(t,"utf8"));try{_.send(t)}catch(t){return n(t)}n()}function f(t){_.close(),t()}function l(){y.setReadable(E),y.setWritable(E),y.emit("connect")}function p(){y.end(),y.destroy()}function d(t){y.destroy(t)}function g(t){var e=t.data;e=e instanceof ArrayBuffer?u.from(e):u.from(e,"utf8"),E.push(e)}function v(){_.close()}function b(t,e){for(var n=new Array(t.length),r=0;r<t.length;r++)"string"==typeof t[r].chunk?n[r]=u.from(t[r],"utf8"):n[r]=t[r].chunk;this._write(u.concat(n),"binary",e)}var y,_,m="browser"===e.title,w=!!r.WebSocket,S=m?h:s;n&&!Array.isArray(n)&&"object"==typeof n&&(o=n,n=null,("string"==typeof o.protocol||Array.isArray(o.protocol))&&(n=o.protocol)),o||(o={}),void 0===o.objectMode&&(o.objectMode=!(!0===o.binary||void 0===o.binary));var E=i(o,S,f);o.objectMode||(E._writev=b);var k=o.browserBufferSize||524288,I=o.browserBufferTimeout||1e3;"object"==typeof t?_=t:(_=w&&m?new c(t,n):new c(t,n,o),_.binaryType="arraybuffer"),_.readyState===_.OPEN?y=E:(y=a.obj(),_.onopen=l),y.socket=_,_.onclose=p,_.onerror=d,_.onmessage=g,E.on("close",v);var A=!o.objectMode;return y}var s=n(16).Transform,a=n(78),c=n(107),u=n(5).Buffer;t.exports=o}).call(e,n(2),n(3))},function(t,e){function n(){for(var t={},e=0;e<arguments.length;e++){var n=arguments[e];for(var i in n)r.call(n,i)&&(t[i]=n[i])}return t}t.exports=n;var r=Object.prototype.hasOwnProperty},function(t,e,n){!function(r,i){t.exports=e=i(n(0))}(0,function(t){return function(e){var n=t,r=n.lib,i=r.WordArray,o=r.Hasher,s=n.algo,a=[],c=[];!function(){function t(t){return 4294967296*(t-(0|t))|0}for(var n=2,r=0;r<64;)(function(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0})(n)&&(r<8&&(a[r]=t(e.pow(n,.5))),c[r]=t(e.pow(n,1/3)),r++),n++}();var u=[],h=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],h=n[5],f=n[6],l=n[7],p=0;p<64;p++){if(p<16)u[p]=0|t[e+p];else{var d=u[p-15],g=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,v=u[p-2],b=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;u[p]=g+u[p-7]+b+u[p-16]}var y=a&h^~a&f,_=r&i^r&o^i&o,m=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),S=l+w+y+c[p]+u[p],E=m+_;l=f,f=h,h=a,a=s+S|0,s=o,o=i,i=r,r=S+E|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+h|0,n[6]=n[6]+f|0,n[7]=n[7]+l|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=o._createHelper(h),n.HmacSHA256=o._createHmacHelper(h)}(Math),t.SHA256})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(14))}(0,function(t){return function(){function e(){return s.create.apply(s,arguments)}var n=t,r=n.lib,i=r.Hasher,o=n.x64,s=o.Word,a=o.WordArray,c=n.algo,u=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],h=[];!function(){for(var t=0;t<80;t++)h[t]=e()}();var f=c.SHA512=i.extend({_doReset:function(){this._hash=new a.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],c=n[5],f=n[6],l=n[7],p=r.high,d=r.low,g=i.high,v=i.low,b=o.high,y=o.low,_=s.high,m=s.low,w=a.high,S=a.low,E=c.high,k=c.low,I=f.high,A=f.low,x=l.high,T=l.low,C=p,B=d,O=g,R=v,M=b,P=y,N=_,L=m,j=w,D=S,U=E,H=k,q=I,z=A,F=x,W=T,K=0;K<80;K++){var Y=h[K];if(K<16)var V=Y.high=0|t[e+2*K],Q=Y.low=0|t[e+2*K+1];else{var $=h[K-15],G=$.high,X=$.low,J=(G>>>1|X<<31)^(G>>>8|X<<24)^G>>>7,Z=(X>>>1|G<<31)^(X>>>8|G<<24)^(X>>>7|G<<25),tt=h[K-2],et=tt.high,nt=tt.low,rt=(et>>>19|nt<<13)^(et<<3|nt>>>29)^et>>>6,it=(nt>>>19|et<<13)^(nt<<3|et>>>29)^(nt>>>6|et<<26),ot=h[K-7],st=ot.high,at=ot.low,ct=h[K-16],ut=ct.high,ht=ct.low,Q=Z+at,V=J+st+(Q>>>0<Z>>>0?1:0),Q=Q+it,V=V+rt+(Q>>>0<it>>>0?1:0),Q=Q+ht,V=V+ut+(Q>>>0<ht>>>0?1:0);Y.high=V,Y.low=Q}var ft=j&U^~j&q,lt=D&H^~D&z,pt=C&O^C&M^O&M,dt=B&R^B&P^R&P,gt=(C>>>28|B<<4)^(C<<30|B>>>2)^(C<<25|B>>>7),vt=(B>>>28|C<<4)^(B<<30|C>>>2)^(B<<25|C>>>7),bt=(j>>>14|D<<18)^(j>>>18|D<<14)^(j<<23|D>>>9),yt=(D>>>14|j<<18)^(D>>>18|j<<14)^(D<<23|j>>>9),_t=u[K],mt=_t.high,wt=_t.low,St=W+yt,Et=F+bt+(St>>>0<W>>>0?1:0),St=St+lt,Et=Et+ft+(St>>>0<lt>>>0?1:0),St=St+wt,Et=Et+mt+(St>>>0<wt>>>0?1:0),St=St+Q,Et=Et+V+(St>>>0<Q>>>0?1:0),kt=vt+dt,It=gt+pt+(kt>>>0<vt>>>0?1:0);F=q,W=z,q=U,z=H,U=j,H=D,D=L+St|0,j=N+Et+(D>>>0<L>>>0?1:0)|0,N=M,L=P,M=O,P=R,O=C,R=B,B=St+kt|0,C=Et+It+(B>>>0<St>>>0?1:0)|0}d=r.low=d+B,r.high=p+C+(d>>>0<B>>>0?1:0),v=i.low=v+R,i.high=g+O+(v>>>0<R>>>0?1:0),y=o.low=y+P,o.high=b+M+(y>>>0<P>>>0?1:0),m=s.low=m+L,s.high=_+N+(m>>>0<L>>>0?1:0),S=a.low=S+D,a.high=w+j+(S>>>0<D>>>0?1:0),k=c.low=k+H,c.high=E+U+(k>>>0<H>>>0?1:0),A=f.low=A+z,f.high=I+q+(A>>>0<z>>>0?1:0),T=l.low=T+W,l.high=x+F+(T>>>0<W>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(r+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});n.SHA512=i._createHelper(f),n.HmacSHA512=i._createHmacHelper(f)}(),t.SHA512})},function(t,e,n){var r=n(89),i=function(){},o=function(t){return t.setHeader&&"function"==typeof t.abort},s=function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length},a=function(t,e,n){if("function"==typeof e)return a(t,null,e);e||(e={}),n=r(n||i);var c=t._writableState,u=t._readableState,h=e.readable||!1!==e.readable&&t.readable,f=e.writable||!1!==e.writable&&t.writable,l=function(){t.writable||p()},p=function(){f=!1,h||n.call(t)},d=function(){h=!1,f||n.call(t)},g=function(e){n.call(t,e?new Error("exited with error code: "+e):null)},v=function(e){n.call(t,e)},b=function(){return(!h||u&&u.ended)&&(!f||c&&c.ended)?void 0:n.call(t,new Error("premature close"))},y=function(){t.req.on("finish",p)};return o(t)?(t.on("complete",p),t.on("abort",b),t.req?y():t.on("request",y)):f&&!c&&(t.on("end",l),t.on("close",l)),s(t)&&t.on("exit",g),t.on("end",d),t.on("finish",p),!1!==e.error&&t.on("error",v),t.on("close",b),function(){t.removeListener("complete",p),t.removeListener("abort",b),t.removeListener("request",y),t.req&&t.req.removeListener("finish",p),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",p),t.removeListener("exit",g),t.removeListener("end",d),t.removeListener("error",v),t.removeListener("close",b)}};t.exports=a},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";function r(t){return[0,1,2].map(function(e){return[0,1].map(function(n){return[0,1].map(function(r){var s=new i(1);return s.writeUInt8(o.codes[t]<<o.CMD_SHIFT|(n?o.DUP_MASK:0)|e<<o.QOS_SHIFT|r,0,!0),s})})})}var i=n(5).Buffer,o=t.exports;o.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"reserved"},o.codes={};for(var s in o.types){var a=o.types[s];o.codes[a]=s}o.CMD_SHIFT=4,o.CMD_MASK=240,o.DUP_MASK=8,o.QOS_MASK=3,o.QOS_SHIFT=1,o.RETAIN_MASK=1,o.LENGTH_MASK=127,o.LENGTH_FIN_MASK=128,o.SESSIONPRESENT_MASK=1,o.SESSIONPRESENT_HEADER=i.from([o.SESSIONPRESENT_MASK]),o.CONNACK_HEADER=i.from([o.codes.connack<<o.CMD_SHIFT]),o.USERNAME_MASK=128,o.PASSWORD_MASK=64,o.WILL_RETAIN_MASK=32,o.WILL_QOS_MASK=24,o.WILL_QOS_SHIFT=3,o.WILL_FLAG_MASK=4,o.CLEAN_SESSION_MASK=2,o.CONNECT_HEADER=i.from([o.codes.connect<<o.CMD_SHIFT]),o.PUBLISH_HEADER=r("publish"),o.SUBSCRIBE_HEADER=r("subscribe"),o.UNSUBSCRIBE_HEADER=r("unsubscribe"),o.ACKS={unsuback:r("unsuback"),puback:r("puback"),pubcomp:r("pubcomp"),pubrel:r("pubrel"),pubrec:r("pubrec")},o.SUBACK_HEADER=i.from([o.codes.suback<<o.CMD_SHIFT]),o.VERSION3=i.from([3]),o.VERSION4=i.from([4]),o.QOS=[0,1,2].map(function(t){return i.from([t])}),o.EMPTY={pingreq:i.from([o.codes.pingreq<<4,0]),pingresp:i.from([o.codes.pingresp<<4,0]),disconnect:i.from([o.codes.disconnect<<4,0])}},function(t,e,n){"use strict";function r(t,e){switch(e.cork&&(e.cork(),A(i,e)),O&&(O=!1,C()),t.cmd){case"connect":return o(t,e);case"connack":return s(t,e);case"publish":return a(t,e);case"puback":case"pubrec":case"pubrel":case"pubcomp":case"unsuback":return c(t,e);case"subscribe":return u(t,e);case"suback":return h(t,e);case"unsubscribe":return f(t,e);case"pingreq":case"pingresp":case"disconnect":return l(t,e);default:return e.emit("error",new Error("Unknown command")),!1}}function i(t){t.uncork()}function o(t,e){var n=t||{},r=n.protocolId||"MQTT",i=n.protocolVersion||4,o=n.will,s=n.clean,a=n.keepalive||0,c=n.clientId||"",u=n.username,h=n.password;void 0===s&&(s=!0);var f=0;if(!r||"string"!=typeof r&&!S.isBuffer(r))return e.emit("error",new Error("Invalid protocolId")),!1;if(f+=r.length+2,3!==i&&4!==i)return e.emit("error",new Error("Invalid protocol version")),!1;if(f+=1,"string"!=typeof c&&!S.isBuffer(c)||!c&&4!==i||!c&&!s){if(i<4)return e.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*s==0)return e.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}else f+=c.length+2;if("number"!=typeof a||a<0||a>65535||a%1!=0)return e.emit("error",new Error("Invalid keepalive")),!1;if(f+=2,f+=1,o){if("object"!=typeof o)return e.emit("error",new Error("Invalid will")),!1;if(!o.topic||"string"!=typeof o.topic)return e.emit("error",new Error("Invalid will topic")),!1;if(f+=S.byteLength(o.topic)+2,o.payload&&o.payload){if(!(o.payload.length>=0))return e.emit("error",new Error("Invalid will payload")),!1;"string"==typeof o.payload?f+=S.byteLength(o.payload)+2:f+=o.payload.length+2}else f+=2}if(u){if(!u.length)return e.emit("error",new Error("Invalid username")),!1;f+=S.byteLength(u)+2}if(h){if(!h.length)return e.emit("error",new Error("Invalid password")),!1;f+=m(h)+2}e.write(w.CONNECT_HEADER),g(e,f),_(e,r),e.write(4===i?w.VERSION4:w.VERSION3);var l=0;return l|=u?w.USERNAME_MASK:0,l|=h?w.PASSWORD_MASK:0,l|=o&&o.retain?w.WILL_RETAIN_MASK:0,l|=o&&o.qos?o.qos<<w.WILL_QOS_SHIFT:0,l|=o?w.WILL_FLAG_MASK:0,l|=s?w.CLEAN_SESSION_MASK:0,e.write(S.from([l])),B(e,a),_(e,c),o&&(v(e,o.topic),_(e,o.payload)),u&&_(e,u),h&&_(e,h),!0}function s(t,e){var n=t||{},r=n.returnCode;return"number"!=typeof r?(e.emit("error",new Error("Invalid return code")),!1):(e.write(w.CONNACK_HEADER),g(e,2),e.write(t.sessionPresent?w.SESSIONPRESENT_HEADER:k),e.write(S.from([r])))}function a(t,e){var n=t||{},r=n.qos||0,i=n.retain?w.RETAIN_MASK:0,o=n.topic,s=n.payload||E,a=n.messageId,c=0;if("string"==typeof o)c+=S.byteLength(o)+2;else{if(!S.isBuffer(o))return e.emit("error",new Error("Invalid topic")),!1;c+=o.length+2}return S.isBuffer(s)?c+=s.length:c+=S.byteLength(s),r&&"number"!=typeof a?(e.emit("error",new Error("Invalid messageId")),!1):(r&&(c+=2),e.write(w.PUBLISH_HEADER[r][t.dup?1:0][i?1:0]),g(e,c),B(e,m(o)),e.write(o),r>0&&B(e,a),e.write(s))}function c(t,e){var n=t||{},r=n.cmd||"puback",i=n.messageId,o=n.dup&&"pubrel"===r?w.DUP_MASK:0,s=0;return"pubrel"===r&&(s=1),"number"!=typeof i?(e.emit("error",new Error("Invalid messageId")),!1):(e.write(w.ACKS[r][s][o][0]),g(e,2),B(e,i))}function u(t,e){var n=t||{},r=n.dup?w.DUP_MASK:0,i=n.messageId,o=n.subscriptions,s=0;if("number"!=typeof i)return e.emit("error",new Error("Invalid messageId")),!1;if(s+=2,"object"!=typeof o||!o.length)return e.emit("error",new Error("Invalid subscriptions")),!1;for(var a=0;a<o.length;a+=1){var c=o[a].topic,u=o[a].qos;if("string"!=typeof c)return e.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof u)return e.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;s+=S.byteLength(c)+2+1}e.write(w.SUBSCRIBE_HEADER[1][r?1:0][0]),g(e,s),B(e,i);for(var h=!0,f=0;f<o.length;f++){var l=o[f],p=l.topic,d=l.qos;v(e,p),h=e.write(w.QOS[d])}return h}function h(t,e){var n=t||{},r=n.messageId,i=n.granted,o=0;if("number"!=typeof r)return e.emit("error",new Error("Invalid messageId")),!1;if(o+=2,"object"!=typeof i||!i.length)return e.emit("error",new Error("Invalid qos vector")),!1;for(var s=0;s<i.length;s+=1){if("number"!=typeof i[s])return e.emit("error",new Error("Invalid qos vector")),!1;o+=1}return e.write(w.SUBACK_HEADER),g(e,o),B(e,r),e.write(S.from(i))}function f(t,e){var n=t||{},r=n.messageId,i=n.dup?w.DUP_MASK:0,o=n.unsubscriptions,s=0;if("number"!=typeof r)return e.emit("error",new Error("Invalid messageId")),!1;if(s+=2,"object"!=typeof o||!o.length)return e.emit("error",new Error("Invalid unsubscriptions")),!1;for(var a=0;a<o.length;a+=1){if("string"!=typeof o[a])return e.emit("error",new Error("Invalid unsubscriptions")),!1;s+=S.byteLength(o[a])+2}e.write(w.UNSUBSCRIBE_HEADER[1][i?1:0][0]),g(e,s),B(e,r);for(var c=!0,u=0;u<o.length;u++)c=v(e,o[u]);return c}function l(t,e){return e.write(w.EMPTY[t.cmd])}function p(t){return t>=0&&t<128?1:t>=128&&t<16384?2:t>=16384&&t<2097152?3:t>=2097152&&t<268435456?4:0}function d(t){var e=0,n=0,r=S.allocUnsafe(p(t));do{e=t%128|0,t=t/128|0,t>0&&(e|=128),r.writeUInt8(e,n++,!0)}while(t>0);return r}function g(t,e){var n=R[e];n||(n=d(e),e<16384&&(R[e]=n)),t.write(n)}function v(t,e){var n=S.byteLength(e);B(t,n),t.write(e,"utf8")}function b(t,e){return t.write(x[e])}function y(t,e){return t.write(T(e))}function _(t,e){e&&"string"==typeof e?v(t,e):e?(B(t,e.length),t.write(e)):B(t,0)}function m(t){return t?S.isBuffer(t)?t.length:S.byteLength(t):0}var w=n(30),S=n(5).Buffer,E=S.allocUnsafe(0),k=S.from([0]),I=n(83),A=n(82),x=I.cache,T=I.generateNumber,C=I.generateCache,B=b,O=!0;Object.defineProperty(r,"cacheNumbers",{get:function(){return B===b},set:function(t){t?(x&&0!==Object.keys(x).length||(O=!0),B=b):(O=!1,B=y)}});var R={};t.exports=r},function(t,e,n){"use strict";function r(t,e){var n,r;return e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost",n=e.port,r=e.hostname,i.createConnection(n,r)}var i=n(109);t.exports=r},function(t,e,n){"use strict";(function(e){function r(t,e){var n=t.protocol+"://"+t.hostname+":"+t.port+t.path;return"function"==typeof t.transformWsUrl&&(n=t.transformWsUrl(n,t,e)),n}function i(t){t.hostname||(t.hostname="localhost"),t.port||("wss"===t.protocol?t.port=443:t.port=80),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={}),f||"wss"!==t.protocol||h.forEach(function(e){t.hasOwnProperty(e)&&!t.wsOptions.hasOwnProperty(e)&&(t.wsOptions[e]=t[e])})}function o(t,e){var n="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt";i(e);var o=r(e,t);return c(o,[n],e.wsOptions)}function s(t,e){return o(t,e)}function a(t,e){if(e.hostname||(e.hostname=e.host),!e.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");var n=u.parse(document.URL);e.hostname=n.hostname,e.port||(e.port=n.port)}return o(t,e)}var c=n(24),u=n(23),h=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],f="browser"===e.title;t.exports=f?a:s}).call(e,n(2))},function(t,e,n){"use strict";function r(t){u?wx.sendSocketMessage({data:t}):h.push(t)}function i(t,e){var n={OPEN:1,CLOSING:2,CLOSED:3,readyState:u?1:0,send:r,close:wx.closeSocket,onopen:null,onmessage:null,onclose:null,onerror:null};return wx.connectSocket({url:t,protocols:e}),wx.onSocketOpen(function(t){n.readyState=n.OPEN,u=!0;for(var e=0;e<h.length;e++)r(h[e]);h=[],n.onopen&&n.onopen.apply(n,arguments)}),wx.onSocketMessage(function(t){n.onmessage&&n.onmessage.apply(n,arguments)}),wx.onSocketClose(function(){n.onclose&&n.onclose.apply(n,arguments),n.readyState=n.CLOSED,u=!1}),wx.onSocketError(function(){n.onerror&&n.onerror.apply(n,arguments),n.readyState=n.CLOSED,u=!1}),n}function o(t,e){var n="wxs"===t.protocol?"wss":"ws",r=n+"://"+t.hostname+":"+t.port+t.path;return"function"==typeof t.transformWsUrl&&(r=t.transformWsUrl(r,t,e)),r}function s(t){t.hostname||(t.hostname="localhost"),t.port||("wss"===t.protocol?t.port=443:t.port=80),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function a(t,e){var n="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt";s(e);var r=o(e,t);return f(i(r,[n]))}function c(t,e){if(e.hostname||(e.hostname=e.host),!e.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");var n=l.parse(document.URL);e.hostname=n.hostname,e.port||(e.port=n.port)}return a(t,e)}var u=!1,h=[],f=n(24),l=n(23);t.exports=c},function(t,e,n){"use strict";(function(e){function r(t){if(!(this instanceof r))return new r(t);this.options=t||{},this.options=i(a,t),this._inflights={}}var i=n(25),o=n(16).Readable,s={objectMode:!0},a={clean:!0};r.prototype.put=function(t,e){return this._inflights[t.messageId]=t,e&&e(),this},r.prototype.createStream=function(){var t=new o(s),n=this._inflights,r=Object.keys(this._inflights),i=!1,a=0;return t._read=function(){!i&&a<r.length?this.push(n[r[a++]]):this.push(null)},t.destroy=function(){if(!i){var t=this;i=!0,e.nextTick(function(){t.emit("close")})}},t},r.prototype.del=function(t,e){return t=this._inflights[t.messageId],t?(delete this._inflights[t.messageId],e(null,t)):e&&e(new Error("missing packet")),this},r.prototype.get=function(t,e){return t=this._inflights[t.messageId],t?e(null,t):e&&e(new Error("missing packet")),this},r.prototype.close=function(t){this.options.clean&&(this._inflights=null),t&&t()},t.exports=r}).call(e,n(2))},function(t,e,n){"use strict";(function(e,r){function i(t){return j.from(t)}function o(t){return j.isBuffer(t)||t instanceof D}function s(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?P(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}function a(t,e){M=M||n(7),t=t||{};var r=e instanceof M;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new F,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.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(z||(z=n(41).StringDecoder),this.decoder=new z(t.encoding),this.encoding=t.encoding)}function c(t){if(M=M||n(7),!(this instanceof c))return new c(t);this._readableState=new a(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),L.call(this)}function u(t,e,n,r,o){var s=t._readableState;if(null===e)s.reading=!1,g(t,s);else{var a;o||(a=f(s,e)),a?t.emit("error",a):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===j.prototype||(e=i(e)),r?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):h(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(e=s.decoder.write(e),s.objectMode||0!==e.length?h(t,s,e,!1):y(t,s)):h(t,s,e,!1))):r||(s.reading=!1)}return l(s)}function h(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&v(t)),y(t,e)}function f(t,e){var n;return o(e)||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}function p(t){return t>=Y?t=Y:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function d(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=p(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function g(t,e){if(!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,v(t)}}function v(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(q("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?R(b,t):b(t))}function b(t){q("emit readable"),t.emit("readable"),k(t)}function y(t,e){e.readingMore||(e.readingMore=!0,R(_,t,e))}function _(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(q("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function m(t){return function(){var e=t._readableState;q("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&N(t,"data")&&(e.flowing=!0,k(t))}}function w(t){q("readable nexttick read 0"),t.read(0)}function S(t,e){e.resumeScheduled||(e.resumeScheduled=!0,R(E,t,e))}function E(t,e){e.reading||(q("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),k(t),e.flowing&&!e.reading&&t.read(0)}function k(t){var e=t._readableState;for(q("flow",e.flowing);e.flowing&&null!==t.read(););}function I(t,e){if(0===e.length)return null;var n;return e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=A(t,e.buffer,e.decoder),n}function A(t,e,n){var r;return t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?x(t,e):T(t,e),r}function x(t,e){var n=e.head,r=1,i=n.data;for(t-=i.length;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++r}return e.length-=r,i}function T(t,e){var n=j.allocUnsafe(t),r=e.head,i=1;for(r.data.copy(n),t-=r.data.length;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,s),0===(t-=s)){s===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++i}return e.length-=i,n}function C(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,R(B,e,t))}function B(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function O(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}var R=n(15).nextTick;t.exports=c;var M,P=n(29);c.ReadableState=a;var N=(n(6).EventEmitter,function(t,e){return t.listeners(e).length}),L=n(40),j=n(5).Buffer,D=e.Uint8Array||function(){},U=n(12);U.inherits=n(4);var H=n(111),q=void 0;q=H&&H.debuglog?H.debuglog("stream"):function(){};var z,F=n(97),W=n(39);U.inherits(c,L);var K=["error","close","destroy","pause","resume"];Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),c.prototype.destroy=W.destroy,c.prototype._undestroy=W.undestroy,c.prototype._destroy=function(t,e){this.push(null),e(t)},c.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=j.from(t,e),e=""),n=!0),u(this,t,e,!1,n)},c.prototype.unshift=function(t){return u(this,t,null,!0,!1)},c.prototype.isPaused=function(){return!1===this._readableState.flowing},c.prototype.setEncoding=function(t){return z||(z=n(41).StringDecoder),this._readableState.decoder=new z(t),this._readableState.encoding=t,this};var Y=8388608;c.prototype.read=function(t){q("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return q("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):v(this),null;if(0===(t=d(t,e))&&e.ended)return 0===e.length&&C(this),null;var r=e.needReadable;q("need readable",r),(0===e.length||e.length-t<e.highWaterMark)&&(r=!0,q("length less than watermark",r)),e.ended||e.reading?(r=!1,q("reading or ended",r)):r&&(q("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=d(n,e)));var i;return i=t>0?I(t,e):null,null===i?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&C(this)),null!==i&&this.emit("data",i),i},c.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},c.prototype.pipe=function(t,e){function n(t,e){q("onunpipe"),t===l&&e&&!1===e.hasUnpiped&&(e.hasUnpiped=!0,o())}function i(){q("onend"),t.end()}function o(){q("cleanup"),t.removeListener("close",u),t.removeListener("finish",h),t.removeListener("drain",v),t.removeListener("error",c),t.removeListener("unpipe",n),l.removeListener("end",i),l.removeListener("end",f),l.removeListener("data",a),b=!0,!p.awaitDrain||t._writableState&&!t._writableState.needDrain||v()}function a(e){q("ondata"),y=!1,!1!==t.write(e)||y||((1===p.pipesCount&&p.pipes===t||p.pipesCount>1&&-1!==O(p.pipes,t))&&!b&&(q("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++,y=!0),l.pause())}function c(e){q("onerror",e),f(),t.removeListener("error",c),0===N(t,"error")&&t.emit("error",e)}function u(){t.removeListener("finish",h),f()}function h(){q("onfinish"),t.removeListener("close",u),f()}function f(){q("unpipe"),l.unpipe(t)}var l=this,p=this._readableState;switch(p.pipesCount){case 0:p.pipes=t;break;case 1:p.pipes=[p.pipes,t];break;default:p.pipes.push(t)}p.pipesCount+=1,q("pipe count=%d opts=%j",p.pipesCount,e);var d=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr,g=d?i:f;p.endEmitted?R(g):l.once("end",g),t.on("unpipe",n);var v=m(l);t.on("drain",v);var b=!1,y=!1;return l.on("data",a),s(t,"error",c),t.once("close",u),t.once("finish",h),t.emit("pipe",l),p.flowing||(q("pipe resume"),l.resume()),t},c.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n),this);if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,n);return this}var s=O(e.pipes,t);return-1===s?this:(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n),this)},c.prototype.on=function(t,e){var n=L.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&v(this):R(w,this))}return n},c.prototype.addListener=c.prototype.on,c.prototype.resume=function(){var t=this._readableState;return t.flowing||(q("resume"),t.flowing=!0,S(this,t)),this},c.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},c.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;t.on("end",function(){if(q("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){if(q("wrapped data"),n.decoder&&(i=n.decoder.write(i)),(!n.objectMode||null!==i&&void 0!==i)&&(n.objectMode||i&&i.length)){e.push(i)||(r=!0,t.pause())}});for(var i in t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<K.length;o++)t.on(K[o],this.emit.bind(this,K[o]));return this._read=function(e){q("wrapped _read",e),r&&(r=!1,t.resume())},this},c._fromList=I}).call(e,n(3),n(2))},function(t,e,n){"use strict";function r(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function i(t){if(!(this instanceof i))return new i(t);a.call(this,t),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",o)}function o(){var t=this;"function"==typeof this._flush?this._flush(function(e,n){s(t,e,n)}):s(this,null,null)}function s(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}t.exports=i;var a=n(7),c=n(12);c.inherits=n(4),c.inherits(i,a),i.prototype.push=function(t,e){return this._transformState.needTransform=!1,a.prototype.push.call(this,t,e)},i.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},i.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},i.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},i.prototype._destroy=function(t,e){var n=this;a.prototype._destroy.call(this,t,function(t){e(t),n.emit("close")})}},function(t,e,n){"use strict";(function(e,r,i){function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){x(e,t)}}function s(t){return P.from(t)}function a(t){return P.isBuffer(t)||t instanceof N}function c(){}function u(t,e){C=C||n(7),t=t||{};var r=e instanceof C;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,s=t.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===t.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){y(e,t)},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 o(this)}function h(t){if(C=C||n(7),!(j.call(h,this)||this instanceof C))return new h(t);this._writableState=new u(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),M.call(this)}function f(t,e){var n=new Error("write after end");t.emit("error",n),T(e,n)}function l(t,e,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),T(r,o),i=!1),i}function p(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=P.from(e,n)),e}function d(t,e,n,r,i,o){if(!n){var s=p(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var c=e.length<e.highWaterMark;if(c||(e.needDrain=!0),e.writing||e.corked){var u=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},u?u.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else g(t,e,!1,a,r,i,o);return c}function g(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function v(t,e,n,r,i){--e.pendingcb,n?(T(i,r),T(I,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(i(r),t._writableState.errorEmitted=!0,t.emit("error",r),I(t,e))}function b(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function y(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(b(n),e)v(t,n,r,e,i);else{var o=S(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||w(t,n),r?B(_,t,n,o,i):_(t,n,o,i)}}function _(t,e,n,r){n||m(t,e),e.pendingcb--,r(),I(t,e)}function m(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function w(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,c=!0;n;)i[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;i.allBuffers=c,g(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,h=n.encoding,f=n.callback;if(g(t,e,!1,e.objectMode?1:u.length,u,h,f),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function S(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function E(t,e){t._final(function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),I(t,e)})}function k(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,T(E,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function I(t,e){var n=S(e);return n&&(k(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}function A(t,e,n){e.ending=!0,I(t,e),n&&(e.finished?T(n):t.once("finish",n)),e.ended=!0,t.writable=!1}function x(t,e,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}var T=n(15).nextTick;t.exports=h;var C,B=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?r:T;h.WritableState=u;var O=n(12);O.inherits=n(4);var R={deprecate:n(103)},M=n(40),P=n(5).Buffer,N=i.Uint8Array||function(){},L=n(39);O.inherits(h,M),u.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(u.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}();var j;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(j=Function.prototype[Symbol.hasInstance],Object.defineProperty(h,Symbol.hasInstance,{value:function(t){return!!j.call(this,t)||this===h&&(t&&t._writableState instanceof u)}})):j=function(t){return t instanceof this},h.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},h.prototype.write=function(t,e,n){var r=this._writableState,i=!1,o=!r.objectMode&&a(t);return o&&!P.isBuffer(t)&&(t=s(t)),"function"==typeof e&&(n=e,e=null),o?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=c),r.ended?f(this,n):(o||l(this,r,t,n))&&(r.pendingcb++,i=d(this,r,o,t,e,n)),i},h.prototype.cork=function(){this._writableState.corked++},h.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||w(this,t))},h.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},h.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},h.prototype._writev=null,h.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||A(this,r,n)},Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),h.prototype.destroy=L.destroy,h.prototype._undestroy=L.undestroy,h.prototype._destroy=function(t,e){this.end(),e(t)}}).call(e,n(2),n(101).setImmediate,n(3))},function(t,e,n){"use strict";function r(t,e){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||s(o,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(s(o,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)}),this)}function i(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o(t,e){t.emit("error",e)}var s=n(15).nextTick;t.exports={destroy:r,undestroy:i}},function(t,e,n){t.exports=n(6).EventEmitter},function(t,e,n){"use strict";function r(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function i(t){var e=r(t);if("string"!=typeof e&&(y.isEncoding===_||!_(t)))throw new Error("Unknown encoding: "+t);return e||t}function o(t){this.encoding=i(t);var e;switch(this.encoding){case"utf16le":this.text=l,this.end=p,e=4;break;case"utf8":this.fillLast=u,e=4;break;case"base64":this.text=d,this.end=g,e=3;break;default:return this.write=v,void(this.end=b)}this.lastNeed=0,this.lastTotal=0,this.lastChar=y.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:-1}function a(t,e,n){var r=e.length-1;if(r<n)return 0;var i=s(e[r]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--r<n?0:(i=s(e[r]))>=0?(i>0&&(t.lastNeed=i-2),i):--r<n?0:(i=s(e[r]),i>=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0)}function c(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�".repeat(n);if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�".repeat(n+1);if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�".repeat(n+2)}}function u(t){var e=this.lastTotal-this.lastNeed,n=c(this,t,e);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function h(t,e){var n=a(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�".repeat(this.lastTotal-this.lastNeed):e}function l(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function p(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function d(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function g(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function v(t){return t.toString(this.encoding)}function b(t){return t&&t.length?this.write(t):""}var y=n(5).Buffer,_=y.isEncoding||function(t){switch((t=""+t)&&t.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}};e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},o.prototype.end=f,o.prototype.text=h,o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){t.exports.device=n(18),t.exports.thingShadow=n(51),t.exports.jobs=n(49)},function(t,e,n){const r=n(42);t.exports={AWSIoTData:r}},function(t,e){t.exports={NO_KEY_OPTION:'No "keyPath" or "privateKey" option supplied.',NO_CERT_OPTION:'No "certPath" or "clientCert" option supplied.',NO_CA_OPTION:'No "caPath" or "caCert" option supplied.',INVALID_KEY_PATH_OPTION:'Invalid "keyPath" option supplied.',INVALID_CERT_PATH_OPTION:'Invalid "certPath" option supplied.',INVALID_CA_PATH_OPTION:'Invalid "caPath" option supplied.',INVALID_CLIENT_CERT_OPTION:'Invalid "clientCert" option supplied.',INVALID_PRIVATE_KEY_OPTION:'Invalid "privateKey" option supplied.',INVALID_CA_CERT_OPTION:'Invalid "caCert" option supplied.'}},function(t,e,n){(function(e){var r=n(22),i=n(13),o=n(44);t.exports=function(t){if(i(t.keyPath)&&i(t.privateKey))throw new Error(o.NO_KEY_OPTION);if(i(t.certPath)&&i(t.clientCert))throw new Error(o.NO_CERT_OPTION);if(i(t.caPath)&&i(t.caCert))throw new Error(o.NO_CA_OPTION);if(!i(t.caCert))if(e.isBuffer(t.caCert))t.ca=t.caCert;else{if(!r.existsSync(t.caCert))throw new Error(o.INVALID_CA_CERT_OPTION);t.ca=r.readFileSync(t.caCert)}if(!i(t.privateKey))if(e.isBuffer(t.privateKey))t.key=t.privateKey;else{if(!r.existsSync(t.privateKey))throw new Error(o.INVALID_PRIVATE_KEY_OPTION);t.key=r.readFileSync(t.privateKey)}if(!i(t.clientCert))if(e.isBuffer(t.clientCert))t.cert=t.clientCert;else{if(!r.existsSync(t.clientCert))throw new Error(o.INVALID_CLIENT_CERT_OPTION);t.cert=r.readFileSync(t.clientCert)}if(r.existsSync(t.keyPath))t.key=r.readFileSync(t.keyPath);else if(!i(t.keyPath))throw new Error(o.INVALID_KEY_PATH_OPTION);if(r.existsSync(t.certPath))t.cert=r.readFileSync(t.certPath);else if(!i(t.certPath))throw new Error(o.INVALID_CERT_PATH_OPTION);if(r.existsSync(t.caPath))t.ca=r.readFileSync(t.caPath);else if(!i(t.caPath))throw new Error(o.INVALID_CA_PATH_OPTION);t.requestCert=!0,t.rejectUnauthorized=!0}}).call(e,n(11).Buffer)},function(t,e){t.exports={INVALID_CONNECT_OPTIONS:"Invalid connect options supplied.",INVALID_CLIENT_ID_OPTION:'Invalid "clientId" (mqtt client id) option supplied.',INVALID_RECONNECT_TIMING:"Invalid reconnect timing options supplied.",INVALID_OFFLINE_QUEUEING_PARAMETERS:"Invalid offline queueing options supplied."}},function(t,e,n){function r(t,e){function n(e){t.emit("error",e),r.end()}var r;return r=i.connect(e),r.on("secureConnect",function(){r.authorized?r.removeListener("error",n):r.emit("error",new Error("TLS not authorized"))}),r.on("error",n),r}var i=n(22);t.exports=r},function(t,e,n){function r(t,e){return i(e.url,["mqttv3.1"],e.websocketOptions)}const i=n(24);t.exports=r},function(t,e,n){function r(t){return"$aws"===t[0]&&"things"===t[1]&&"jobs"===t[3]}function i(t,e,n){var r="$aws/things/"+t+"/jobs/";return u(n)?n=e:r+=e.toString()+"/",r+=n}function o(t){if(!(this instanceof o))return new o(t);var e=this,n=[],s=c.DeviceClient(t);this._updateJobStatus=function(e,n,r,o,a){"function"==typeof o&&(a=o,o=void 0),!u(t)&&t.debug,s.publish(i(e,n.id,"update"),JSON.stringify({status:r,statusDetails:o}),null,function(t){u(t)&&(n.status={status:r,statusDetails:o}),u(a)||a(t)})},this._buildJobObject=function(t,n){if(u(n)||u(n.jobId))return null;var r={};return r.id=n.jobId,r.document=n.jobDocument,r.operation=r.document.operation,r.status={status:n.status,statusDetails:n.statusDetails},r.inProgress=function(n,i){e._updateJobStatus(t,r,"IN_PROGRESS",n,i)},r.failed=function(n,i){e._updateJobStatus(t,r,"FAILED",n,i)},r.succeeded=function(n,i){e._updateJobStatus(t,r,"SUCCEEDED",n,i)},r},this._handleMessages=function(i,o){var s=i.split("/");if(!r(s))return void e.emit("message",i,o);var a=s[2],c=n.find(function(t){return t.thingName===a});if(!u(c)){var h={};try{h=JSON.parse(o.toString())}catch(e){return void t.debug}if(!(u(h.execution)||u(h.execution.jobId)||u(h.execution.jobDocument))){var f=h.execution.jobDocument.operation,l=c.operations.find(function(t){return u(f)?u(t.operationName):f===t.operationName});u(l)&&(l=c.operations.find(function(t){return u(t.operationName)}),u(l))||l.callback(null,e._buildJobObject(a,h.execution))}}},this.subscribeToJobs=function(e,r,o){u(o)&&(o=r,r=null),!u(t)&&t.debug;var a=n.find(function(t){return t.thingName===e});u(a)&&(a={thingName:e,operations:[]},n.push(a),s.subscribe([i(e,"$next/get/accepted"),i(e,"notify-next")],function(t,e){u(t)||o(t)}));var c=a.operations.find(function(t){return u(r)?u(t.operationName):r===t.operationName});u(c)?(c={operationName:r,callback:o},a.operations.push(c)):c.callback=o},this.unsubscribeFromJobs=function(e,r,o){u(o)&&(o=r,r=null),!u(t)&&t.debug;var a=n.findIndex(function(t){return t.thingName===e}),c=new Error("subscription not found for given thing");if(a<0)return void o(c);var h=n[a].operations.findIndex(function(t){return u(r)?u(t.operationName):r===t.operationName});return h<0?void o(c):(n[a].operations.splice(h,1),0===n[a].operations.length?(n.splice(a,1),void s.unsubscribe([i(e,"$next/get/accepted"),i(e,"notify-next")],o)):void o())},this.startJobNotifications=function(e,n){!u(t)&&t.debug,s.publish(i(e,"$next","get"),"{}",n)},s.on("connect",function(){e.emit("connect")}),s.on("close",function(){e.emit("close")}),s.on("reconnect",function(){e.emit("reconnect")}),s.on("offline",function(){e.emit("offline")}),s.on("error",function(t){e.emit("error",t)}),s.on("message",e._handleMessages),this.publish=s.publish,this.subscribe=s.subscribe,this.unsubscribe=s.unsubscribe,this.end=s.end,this.handleMessage=s.handleMessage,this.updateWebSocketCredentials=s.updateWebSocketCredentials,this.simulateNetworkFailure=s.simulateNetworkFailure}var s=n(6),a=n(17).inherits,c=n(18),u=n(13);a(o,s.EventEmitter),t.exports=o},function(t,e){t.exports={_args:[["aws-iot-device-sdk@2.2.1","/Users/asperger/dev/pro1/app/react-native-aws-iot-device-shadows"]],_from:"aws-iot-device-sdk@2.2.1",_id:"aws-iot-device-sdk@2.2.1",_inBundle:!1,_integrity:"sha1-Dff6i0xSBNJNil9yoSzkMwGwnFM=",_location:"/aws-iot-device-sdk",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"aws-iot-device-sdk@2.2.1",name:"aws-iot-device-sdk",escapedName:"aws-iot-device-sdk",rawSpec:"2.2.1",saveSpec:null,fetchSpec:"2.2.1"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/aws-iot-device-sdk/-/aws-iot-device-sdk-2.2.1.tgz",_spec:"2.2.1",_where:"/Users/asperger/dev/pro1/app/react-native-aws-iot-device-shadows",author:{name:"Amazon Web Services",url:"http://aws.amazon.com"},bugs:{url:"http://github.com/aws/aws-iot-device-sdk-js/issues"},dependencies:{"crypto-js":"3.1.6",minimist:"1.2.0",mqtt:"2.15.1","websocket-stream":"^5.0.1"},description:"AWS IoT Node.js SDK for Embedded Devices",devDependencies:{gulp:"^3.9.0","gulp-beautify":"^2.0.0","gulp-concat":"^2.6.0","gulp-coverage":"^0.3.38","gulp-jscs":"^4.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^3.0.1",jshint:"^2.9.1","jshint-stylish":"^2.2.1",rewire:"^2.5.1",sinon:"^1.17.3"},engines:{node:">=4.0.0"},homepage:"https://github.com/aws/aws-iot-device-sdk-js",keywords:["api","amazon","aws","iot","mqtt"],license:"Apache-2.0",main:"index.js",name:"aws-iot-device-sdk",repository:{type:"git",url:"git://github.com/aws/aws-iot-device-sdk-js.git"},scripts:{beautify:"node ./node_modules/gulp/bin/gulp.js beautify",browserize:"./scripts/browserize.sh",test:"node ./node_modules/gulp/bin/gulp.js test --verbose"},version:"2.2.1"}},function(t,e,n){function r(t,e,n){return h(n)?"$aws/things/"+t+"/shadow/"+e:"$aws/things/"+t+"/shadow/"+e+"/"+n}function i(t){return"$aws/things/"===t.substring(0,12)}function o(t,e){var n=!1;return"$aws"===t[0]&&("things"!==t[1]||"shadow"!==t[3]||"update"!==t[4]&&"get"!==t[4]&&"delete"!==t[4]||("subscribe"===e?"accepted"!==t[5]&&"rejected"!==t[5]&&"delta"!==t[5]||6!==t.length||(n=!0):5===t.length&&(n=!0))),n}function s(t,e){if(!(this instanceof s))return new s(t,e);var n=this,c=[{}],f=0,l=1e4,p=!0,d=u.DeviceClient(t);h(e)||h(e.operationTimeout)||(l=e.operationTimeout),this._handleSubscriptions=function(t,e,n,i){for(var o=[],s=0,a=e.length;s<a;s++)for(var u=0,f=e[s].operations.length;u<f;u++)for(var l=0,p=e[s].statii.length;l<p;l++)o.push(r(t,e[s].operations[u],e[s].statii[l]));c[t].debug;var g=[];g.push(o),"subscribe"===n?(g.push({qos:c[t].qos}),g.push(function(t,e){if(!h(i)){if(t)return void i(t);for(var n=[],r=0,o=e.length;r<o;r++)128===e[r].qos&&n.push(e[r]);if(n.length>0)return void i("Not all subscriptions were granted",n);i()}})):h(i)||g.push(i),d[n].apply(d,g)},this._handleMessages=function(e,n,r,i){var o={};try{o=JSON.parse(i.toString())}catch(e){return void t.debug}var s=o.clientToken,a=o.version;if(delete o.clientToken,!h(a)&&"rejected"!==r)if(h(c[e].version)||a>=c[e].version)c[e].version=a;else if("delete"!==n&&!0===c[e].discardStale)return void t.debug;return"delta"===r?void this.emit("delta",e,o):h(c[e].clientToken)||c[e].clientToken!==s?void("accepted"===r&&"get"!==n&&this.emit("foreignStateChange",e,n,o)):(clearTimeout(c[e].timeout),delete c[e].timeout,delete c[e].clientToken,c[e].pending=!1,!1===c[e].persistentSubscribe&&this._handleSubscriptions(e,[{operations:[n],statii:["accepted","rejected"]}],"unsubscribe"),void this.emit("status",e,r,s,o))},d.on("connect",function(){n.emit("connect")}),d.on("close",function(){n.emit("close")}),d.on("reconnect",function(){n.emit("reconnect")}),d.on("offline",function(){n.emit("offline")}),d.on("error",function(t){n.emit("error",t)}),d.on("packetsend",function(t){n.emit("packetsend",t)}),d.on("packetreceive",function(t){n.emit("packetreceive",t)}),d.on("message",function(t,e){if(!0===p){var r=t.split("/");o(r,"subscribe")?c.hasOwnProperty(r[2])&&n._handleMessages(r[2],r[4],r[5],e):n.emit("message",t,e)}}),this._thingOperation=function(e,i,o){var s=null;if(c.hasOwnProperty(e))if(!1===c[e].pending){c[e].pending=!0;var a;if(h(o.clientToken)){var u=t.clientId.length;a=u>48?t.clientId.substr(u-48)+"-"+f++:t.clientId+"-"+f++}else a=o.clientToken;c[e].clientToken=a;var p=r(e,i);c[e].timeout=setTimeout(function(t,e){!1===c[t].persistentSubscribe&&n._handleSubscriptions(t,[{operations:[i],statii:["accepted","rejected"]}],"unsubscribe"),c[t].pending=!1,n.emit("timeout",t,e),delete c[t].timeout,delete c[t].clientToken},l,e,a),!1===c[e].persistentSubscribe?this._handleSubscriptions(e,[{operations:[i],statii:["accepted","rejected"]}],"subscribe",function(t,n){h(t)&&h(n)&&(h(o)||(!h(c[e].version)&&c[e].enableVersioning&&(o.version=c[e].version),o.clientToken=a,d.publish(p,JSON.stringify(o),{qos:c[e].qos}),!h(c[e])&&c[e].debug))}):(!h(c[e].version)&&c[e].enableVersioning&&(o.version=c[e].version),o.clientToken=a,d.publish(p,JSON.stringify(o),{qos:c[e].qos}),c[e].debug),s=a}else t.debug;else t.debug;return s},this.register=function(e,n,r){if(c.hasOwnProperty(e))t.debug;else{var i=!1,o=[];c[e]={persistentSubscribe:!0,debug:!1,discardStale:!0,enableVersioning:!0,qos:0,pending:!0},"function"==typeof n&&(r=n,n=null),h(n)||(h(n.ignoreDeltas)||(i=n.ignoreDeltas),h(n.persistentSubscribe)||(c[e].persistentSubscribe=n.persistentSubscribe),h(n.debug)||(c[e].debug=n.debug),h(n.discardStale)||(c[e].discardStale=n.discardStale),h(n.enableVersioning)||(c[e].enableVersioning=n.enableVersioning),h(n.qos)||(c[e].qos=n.qos)),!1===i&&o.push({operations:["update"],statii:["delta"]}),!0===c[e].persistentSubscribe&&o.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),o.length>0?this._handleSubscriptions(e,o,"subscribe",function(t,n){h(t)&&h(n)&&(c[e].pending=!1),h(r)||r(t,n)}):(c[e].pending=!1,h(r)||r())}},this.unregister=function(e){if(c.hasOwnProperty(e)){var n=[];n.push({operations:["update"],statii:["delta"]}),!0===c[e].persistentSubscribe&&n.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),this._handleSubscriptions(e,n,"unsubscribe"),h(c[e].timeout)||clearTimeout(c[e].timeout),delete c[e]}else t.debug},this.update=function(t,e){var r=null;return h(e.version)&&(r=n._thingOperation(t,"update",e)),r},this.get=function(t,e){var r={};return h(e)||(r.clientToken=e),n._thingOperation(t,"get",r)},this.delete=function(t,e){var r={};return h(e)||(r.clientToken=e),n._thingOperation(t,"delete",r)},this.publish=function(t,e,n,r){if(i(t))throw"cannot publish to reserved topic '"+t+"'";d.publish(t,e,n,r)},this.subscribe=function(t,e,n){var r=[];"string"==typeof t?r.push(t):"object"==typeof t&&t.length&&(r=t);for(var o=0;o<r.length;o++)if(i(r[o]))throw"cannot subscribe to topic array since one of them is a reserved topic '"+r[o]+"'";d.subscribe(r,e,n)},this.unsubscribe=function(t,e){var n=[];"string"==typeof t?n.push(t):"object"==typeof t&&t.length&&(n=t);for(var r=0;r<n.length;r++)if(i(n[r]))throw"cannot unsubscribe from topic array since one of them is a reserved topic '"+n[r]+"'";d.unsubscribe(n,e)},this.end=function(t,e){d.end(t,e)},this.updateWebSocketCredentials=function(t,e,n,r){d.updateWebSocketCredentials(t,e,n,r)},this.updateCustomAuthHeaders=function(t){d.updateCustomAuthHeaders(t)},this.setConnectionStatus=function(t){p=t},a.EventEmitter.call(this)}var a=n(6),c=n(17).inherits,u=n(18),h=n(13);c(s,a.EventEmitter),t.exports=s},function(t,e,n){(function(e){function r(t){if(!(this instanceof r))return new r(t);if(this._bufs=[],this.length=0,"function"==typeof t){this._callback=t;var e=function(t){this._callback&&(this._callback(t),this._callback=null)}.bind(this);this.on("pipe",function(t){t.on("error",e)}),this.on("unpipe",function(t){t.removeListener("error",e)})}else this.append(t);i.call(this)}var i=n(95);n(17).inherits(r,i),r.prototype._offset=function(t){var e,n=0,r=0;if(0===t)return[0,0];for(;r<this._bufs.length;r++){if(e=n+this._bufs[r].length,t<e||r==this._bufs.length-1)return[r,t-n];n=e}},r.prototype.append=function(t){var n=0;if(e.isBuffer(t))this._appendBuffer(t);else if(Array.isArray(t))for(;n<t.length;n++)this.append(t[n]);else if(t instanceof r)for(;n<t._bufs.length;n++)this.append(t._bufs[n]);else null!=t&&("number"==typeof t&&(t=t.toString()),this._appendBuffer(new e(t)));return this},r.prototype._appendBuffer=function(t){this._bufs.push(t),this.length+=t.length},r.prototype._write=function(t,e,n){this._appendBuffer(t),"function"==typeof n&&n()},r.prototype._read=function(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)},r.prototype.end=function(t){i.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},r.prototype.get=function(t){return this.slice(t,t+1)[0]},r.prototype.slice=function(t,e){return"number"==typeof t&&t<0&&(t+=this.length),"number"==typeof e&&e<0&&(e+=this.length),this.copy(null,0,t,e)},r.prototype.copy=function(t,n,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return t||new e(0);if(i<=0)return t||new e(0);var o,s,a=!!t,c=this._offset(r),u=i-r,h=u,f=a&&n||0,l=c[1];if(0===r&&i==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:e.concat(this._bufs,this.length);for(s=0;s<this._bufs.length;s++)this._bufs[s].copy(t,f),f+=this._bufs[s].length;return t}if(h<=this._bufs[c[0]].length-l)return a?this._bufs[c[0]].copy(t,n,l,l+h):this._bufs[c[0]].slice(l,l+h);for(a||(t=new e(u)),s=c[0];s<this._bufs.length;s++){if(o=this._bufs[s].length-l,!(h>o)){this._bufs[s].copy(t,f,l,l+h);break}this._bufs[s].copy(t,f,l),f+=o,h-=o,l&&(l=0)}return t},r.prototype.shallowSlice=function(t,e){t=t||0,e=e||this.length,t<0&&(t+=this.length),e<0&&(e+=this.length);var n=this._offset(t),i=this._offset(e),o=this._bufs.slice(n[0],i[0]+1);return 0==i[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,i[1]),0!=n[1]&&(o[0]=o[0].slice(n[1])),new r(o)},r.prototype.toString=function(t,e,n){return this.slice(e,n).toString(t)},r.prototype.consume=function(t){for(;this._bufs.length;){if(!(t>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},r.prototype.duplicate=function(){for(var t=0,e=new r;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},r.prototype.destroy=function(){this._bufs.length=0,this.length=0,this.push(null)},function(){var t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1};for(var e in t)!function(e){r.prototype[e]=function(n){return this.slice(n,n+t[e])[e](0)}}(e)}(),t.exports=r}).call(e,n(11).Buffer)},function(t,e,n){"use strict";function r(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-r(t)}function o(t){var e,n,i,o,s,a=t.length;o=r(t),s=new f(3*a/4-o),n=o>0?a-4:a;var c=0;for(e=0;e<n;e+=4)i=h[t.charCodeAt(e)]<<18|h[t.charCodeAt(e+1)]<<12|h[t.charCodeAt(e+2)]<<6|h[t.charCodeAt(e+3)],s[c++]=i>>16&255,s[c++]=i>>8&255,s[c++]=255&i;return 2===o?(i=h[t.charCodeAt(e)]<<2|h[t.charCodeAt(e+1)]>>4,s[c++]=255&i):1===o&&(i=h[t.charCodeAt(e)]<<10|h[t.charCodeAt(e+1)]<<4|h[t.charCodeAt(e+2)]>>2,s[c++]=i>>8&255,s[c++]=255&i),s}function s(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function a(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(s(r));return i.join("")}function c(t){for(var e,n=t.length,r=n%3,i="",o=[],s=0,c=n-r;s<c;s+=16383)o.push(a(t,s,s+16383>c?c:s+16383));return 1===r?(e=t[n-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=i,e.toByteArray=o,e.fromByteArray=c;for(var u=[],h=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,d=l.length;p<d;++p)u[p]=l[p],h[l.charCodeAt(p)]=p;h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(8),n(10),n(9),n(1))}(0,function(t){return function(){var e=t,n=e.lib,r=n.BlockCipher,i=e.algo,o=[],s=[],a=[],c=[],u=[],h=[],f=[],l=[],p=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var n=0,r=0,e=0;e<256;e++){var i=r^r<<1^r<<2^r<<3^r<<4;i=i>>>8^255&i^99,o[n]=i,s[i]=n;var g=t[n],v=t[g],b=t[v],y=257*t[i]^16843008*i;a[n]=y<<24|y>>>8,c[n]=y<<16|y>>>16,u[n]=y<<8|y>>>24,h[n]=y;var y=16843009*b^65537*v^257*g^16843008*n;f[i]=y<<24|y>>>8,l[i]=y<<16|y>>>16,p[i]=y<<8|y>>>24,d[i]=y,n?(n=g^t[t[t[b^g]]],r^=t[t[r]]):n=r=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],v=i.AES=r.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes/4,r=this._nRounds=n+6,i=4*(r+1),s=this._keySchedule=[],a=0;a<i;a++)if(a<n)s[a]=e[a];else{var c=s[a-1];a%n?n>6&&a%n==4&&(c=o[c>>>24]<<24|o[c>>>16&255]<<16|o[c>>>8&255]<<8|o[255&c]):(c=c<<8|c>>>24,c=o[c>>>24]<<24|o[c>>>16&255]<<16|o[c>>>8&255]<<8|o[255&c],c^=g[a/n|0]<<24),s[a]=s[a-n]^c}for(var u=this._invKeySchedule=[],h=0;h<i;h++){var a=i-h;if(h%4)var c=s[a];else var c=s[a-4];u[h]=h<4||a<=4?c:f[o[c>>>24]]^l[o[c>>>16&255]]^p[o[c>>>8&255]]^d[o[255&c]]}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,c,u,h,o)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,f,l,p,d,s);var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,r,i,o,s,a){for(var c=this._nRounds,u=t[e]^n[0],h=t[e+1]^n[1],f=t[e+2]^n[2],l=t[e+3]^n[3],p=4,d=1;d<c;d++){var g=r[u>>>24]^i[h>>>16&255]^o[f>>>8&255]^s[255&l]^n[p++],v=r[h>>>24]^i[f>>>16&255]^o[l>>>8&255]^s[255&u]^n[p++],b=r[f>>>24]^i[l>>>16&255]^o[u>>>8&255]^s[255&h]^n[p++],y=r[l>>>24]^i[u>>>16&255]^o[h>>>8&255]^s[255&f]^n[p++];u=g,h=v,f=b,l=y}var g=(a[u>>>24]<<24|a[h>>>16&255]<<16|a[f>>>8&255]<<8|a[255&l])^n[p++],v=(a[h>>>24]<<24|a[f>>>16&255]<<16|a[l>>>8&255]<<8|a[255&u])^n[p++],b=(a[f>>>24]<<24|a[l>>>16&255]<<16|a[u>>>8&255]<<8|a[255&h])^n[p++],y=(a[l>>>24]<<24|a[u>>>16&255]<<16|a[h>>>8&255]<<8|a[255&f])^n[p++];t[e]=g,t[e+1]=v,t[e+2]=b,t[e+3]=y},keySize:8});e.AES=r._createHelper(v)}(),t.AES})},function(t,e,n){!function(r,i){t.exports=e=i(n(0))}(0,function(t){return function(){function e(t){return t<<8&4278255360|t>>>8&16711935}var n=t,r=n.lib,i=r.WordArray,o=n.enc;o.Utf16=o.Utf16BE={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i+=2){var o=e[i>>>2]>>>16-i%4*8&65535;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>1]|=t.charCodeAt(r)<<16-r%2*16;return i.create(n,2*e)}};o.Utf16LE={stringify:function(t){for(var n=t.words,r=t.sigBytes,i=[],o=0;o<r;o+=2){var s=e(n[o>>>2]>>>16-o%4*8&65535);i.push(String.fromCharCode(s))}return i.join("")},parse:function(t){for(var n=t.length,r=[],o=0;o<n;o++)r[o>>>1]|=e(t.charCodeAt(o)<<16-o%2*16);return i.create(r,2*n)}}}(),t.enc.Utf16})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){return function(e){var n=t,r=n.lib,i=r.CipherParams,o=n.enc,s=o.Hex,a=n.format;a.Hex={stringify:function(t){return t.ciphertext.toString(s)},parse:function(t){var e=s.parse(t);return i.create({ciphertext:e})}}}(),t.format.Hex})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(14),n(58),n(55),n(8),n(10),n(20),n(26),n(74),n(27),n(76),n(75),n(73),n(19),n(69),n(9),n(1),n(59),n(61),n(60),n(63),n(62),n(64),n(65),n(66),n(68),n(67),n(56),n(54),n(77),n(72),n(71),n(70))}(0,function(t){return t})},function(t,e,n){!function(r,i){t.exports=e=i(n(0))}(0,function(t){return function(){if("function"==typeof ArrayBuffer){var e=t,n=e.lib,r=n.WordArray,i=r.init;(r.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var e=t.byteLength,n=[],r=0;r<e;r++)n[r>>>2]|=t[r]<<24-r%4*8;i.call(this,n,e)}else i.apply(this,arguments)}).prototype=r}}(),t.lib.WordArray})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){return t.mode.CFB=function(){function e(t,e,n,r){var i=this._iv;if(i){var o=i.slice(0);this._iv=void 0}else var o=this._prevBlock;r.encryptBlock(o,0);for(var s=0;s<n;s++)t[e+s]^=o[s]}var n=t.lib.BlockCipherMode.extend();return n.Encryptor=n.extend({processBlock:function(t,n){var r=this._cipher,i=r.blockSize;e.call(this,t,n,i,r),this._prevBlock=t.slice(n,n+i)}}),n.Decryptor=n.extend({processBlock:function(t,n){var r=this._cipher,i=r.blockSize,o=t.slice(n,n+i);e.call(this,t,n,i,r),this._prevBlock=o}}),n}(),t.mode.CFB})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){/** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*/
return t.mode.CTRGladman=function(){function e(t){if(255==(t>>24&255)){var e=t>>16&255,n=t>>8&255,r=255&t;255===e?(e=0,255===n?(n=0,255===r?r=0:++r):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=r}else t+=1<<24;return t}function n(t){return 0===(t[0]=e(t[0]))&&(t[1]=e(t[1])),t}var r=t.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(t,e){var r=this._cipher,i=r.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),n(s);var a=s.slice(0);r.encryptBlock(a,0);for(var c=0;c<i;c++)t[e+c]^=a[c]}});return r.Decryptor=i,r}(),t.mode.CTRGladman})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){return t.mode.CTR=function(){var e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize,i=this._iv,o=this._counter;i&&(o=this._counter=i.slice(0),this._iv=void 0);var s=o.slice(0);n.encryptBlock(s,0),o[r-1]=o[r-1]+1|0;for(var a=0;a<r;a++)t[e+a]^=s[a]}});return e.Decryptor=n,e}(),t.mode.CTR})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){return t.mode.ECB=function(){var e=t.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e}(),t.mode.ECB})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){return t.mode.OFB=function(){var e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize,i=this._iv,o=this._keystream;i&&(o=this._keystream=i.slice(0),this._iv=void 0),n.encryptBlock(o,0);for(var s=0;s<r;s++)t[e+s]^=o[s]}});return e.Decryptor=n,e}(),t.mode.OFB})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){return t.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,r=4*e,i=r-n%r,o=n+i-1;t.clamp(),t.words[o>>>2]|=i<<24-o%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){return t.pad.Iso10126={pad:function(e,n){var r=4*n,i=r-e.sigBytes%r;e.concat(t.lib.WordArray.random(i-1)).concat(t.lib.WordArray.create([i<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(1))}(0,function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){for(var e=t.words,n=t.sigBytes-1;!(e[n>>>2]>>>24-n%4*8&255);)n--;t.sigBytes=n+1}},t.pad.ZeroPadding})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(20),n(19))}(0,function(t){return function(){var e=t,n=e.lib,r=n.Base,i=n.WordArray,o=e.algo,s=o.SHA1,a=o.HMAC,c=o.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:s,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,r=a.create(n.hasher,t),o=i.create(),s=i.create([1]),c=o.words,u=s.words,h=n.keySize,f=n.iterations;c.length<h;){var l=r.update(e).finalize(s);r.reset();for(var p=l.words,d=p.length,g=l,v=1;v<f;v++){g=r.finalize(g),r.reset();for(var b=g.words,y=0;y<d;y++)p[y]^=b[y]}o.concat(l),u[0]++}return o.sigBytes=4*h,o}});e.PBKDF2=function(t,e,n){return c.create(n).compute(t,e)}}(),t.PBKDF2})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(8),n(10),n(9),n(1))}(0,function(t){return function(){function e(){for(var t=this._X,e=this._C,n=0;n<8;n++)a[n]=e[n];e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<a[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<a[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<a[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<a[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<a[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<a[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<a[6]>>>0?1:0)|0,this._b=e[7]>>>0<a[7]>>>0?1:0;for(var n=0;n<8;n++){var r=t[n]+e[n],i=65535&r,o=r>>>16,s=((i*i>>>17)+i*o>>>15)+o*o,u=((4294901760&r)*r|0)+((65535&r)*r|0);c[n]=s^u}t[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,t[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,t[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,t[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,t[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,t[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,t[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,t[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}var n=t,r=n.lib,i=r.StreamCipher,o=n.algo,s=[],a=[],c=[],u=o.RabbitLegacy=i.extend({_doReset:function(){var t=this._key.words,n=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var o=0;o<4;o++)e.call(this);for(var o=0;o<8;o++)i[o]^=r[o+4&7];if(n){var s=n.words,a=s[0],c=s[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=u>>>16|4294901760&h,l=h<<16|65535&u;i[0]^=u,i[1]^=f,i[2]^=h,i[3]^=l,i[4]^=u,i[5]^=f,i[6]^=h,i[7]^=l;for(var o=0;o<4;o++)e.call(this)}},_doProcessBlock:function(t,n){var r=this._X;e.call(this),s[0]=r[0]^r[5]>>>16^r[3]<<16,s[1]=r[2]^r[7]>>>16^r[5]<<16,s[2]=r[4]^r[1]>>>16^r[7]<<16,s[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)s[i]=16711935&(s[i]<<8|s[i]>>>24)|4278255360&(s[i]<<24|s[i]>>>8),t[n+i]^=s[i]},blockSize:4,ivSize:2});n.RabbitLegacy=i._createHelper(u)}(),t.RabbitLegacy})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(8),n(10),n(9),n(1))}(0,function(t){return function(){function e(){for(var t=this._X,e=this._C,n=0;n<8;n++)a[n]=e[n];e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<a[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<a[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<a[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<a[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<a[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<a[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<a[6]>>>0?1:0)|0,this._b=e[7]>>>0<a[7]>>>0?1:0;for(var n=0;n<8;n++){var r=t[n]+e[n],i=65535&r,o=r>>>16,s=((i*i>>>17)+i*o>>>15)+o*o,u=((4294901760&r)*r|0)+((65535&r)*r|0);c[n]=s^u}t[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,t[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,t[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,t[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,t[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,t[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,t[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,t[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}var n=t,r=n.lib,i=r.StreamCipher,o=n.algo,s=[],a=[],c=[],u=o.Rabbit=i.extend({_doReset:function(){for(var t=this._key.words,n=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var i=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],o=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var r=0;r<4;r++)e.call(this);for(var r=0;r<8;r++)o[r]^=i[r+4&7];if(n){var s=n.words,a=s[0],c=s[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=u>>>16|4294901760&h,l=h<<16|65535&u;o[0]^=u,o[1]^=f,o[2]^=h,o[3]^=l,o[4]^=u,o[5]^=f,o[6]^=h,o[7]^=l;for(var r=0;r<4;r++)e.call(this)}},_doProcessBlock:function(t,n){var r=this._X;e.call(this),s[0]=r[0]^r[5]>>>16^r[3]<<16,s[1]=r[2]^r[7]>>>16^r[5]<<16,s[2]=r[4]^r[1]>>>16^r[7]<<16,s[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)s[i]=16711935&(s[i]<<8|s[i]>>>24)|4278255360&(s[i]<<24|s[i]>>>8),t[n+i]^=s[i]},blockSize:4,ivSize:2});n.Rabbit=i._createHelper(u)}(),t.Rabbit})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(8),n(10),n(9),n(1))}(0,function(t){return function(){function e(){for(var t=this._S,e=this._i,n=this._j,r=0,i=0;i<4;i++){e=(e+1)%256,n=(n+t[e])%256;var o=t[e];t[e]=t[n],t[n]=o,r|=t[(t[e]+t[n])%256]<<24-8*i}return this._i=e,this._j=n,r}var n=t,r=n.lib,i=r.StreamCipher,o=n.algo,s=o.RC4=i.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,r=this._S=[],i=0;i<256;i++)r[i]=i;for(var i=0,o=0;i<256;i++){var s=i%n,a=e[s>>>2]>>>24-s%4*8&255;o=(o+r[i]+a)%256;var c=r[i];r[i]=r[o],r[o]=c}this._i=this._j=0},_doProcessBlock:function(t,n){t[n]^=e.call(this)},keySize:8,ivSize:0});n.RC4=i._createHelper(s);var a=o.RC4Drop=s.extend({cfg:s.cfg.extend({drop:192}),_doReset:function(){s._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)e.call(this)}});n.RC4Drop=i._createHelper(a)}(),t.RC4})},function(t,e,n){!function(r,i){t.exports=e=i(n(0))}(0,function(t){/** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
return function(e){function n(t,e,n){return t^e^n}function r(t,e,n){return t&e|~t&n}function i(t,e,n){return(t|~e)^n}function o(t,e,n){return t&n|e&~n}function s(t,e,n){return t^(e|~n)}function a(t,e){return t<<e|t>>>32-e}var c=t,u=c.lib,h=u.WordArray,f=u.Hasher,l=c.algo,p=h.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=h.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),g=h.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),v=h.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),b=h.create([0,1518500249,1859775393,2400959708,2840853838]),y=h.create([1352829926,1548603684,1836072691,2053994217,0]),_=l.RIPEMD160=f.extend({_doReset:function(){this._hash=h.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var c=0;c<16;c++){var u=e+c,h=t[u];t[u]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}var f,l,_,m,w,S,E,k,I,A,x=this._hash.words,T=b.words,C=y.words,B=p.words,O=d.words,R=g.words,M=v.words;S=f=x[0],E=l=x[1],k=_=x[2],I=m=x[3],A=w=x[4];for(var P,c=0;c<80;c+=1)P=f+t[e+B[c]]|0,P+=c<16?n(l,_,m)+T[0]:c<32?r(l,_,m)+T[1]:c<48?i(l,_,m)+T[2]:c<64?o(l,_,m)+T[3]:s(l,_,m)+T[4],P|=0,P=a(P,R[c]),P=P+w|0,f=w,w=m,m=a(_,10),_=l,l=P,P=S+t[e+O[c]]|0,P+=c<16?s(E,k,I)+C[0]:c<32?o(E,k,I)+C[1]:c<48?i(E,k,I)+C[2]:c<64?r(E,k,I)+C[3]:n(E,k,I)+C[4],P|=0,P=a(P,M[c]),P=P+A|0,S=A,A=I,I=a(k,10),k=E,E=P;P=x[1]+_+I|0,x[1]=x[2]+m+A|0,x[2]=x[3]+w+S|0,x[3]=x[4]+f+E|0,x[4]=x[0]+l+k|0,x[0]=P},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,o=i.words,s=0;s<5;s++){var a=o[s];o[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var t=f.clone.call(this);return t._hash=this._hash.clone(),t}});c.RIPEMD160=f._createHelper(_),c.HmacRIPEMD160=f._createHmacHelper(_)}(Math),t.RIPEMD160})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(26))}(0,function(t){return function(){var e=t,n=e.lib,r=n.WordArray,i=e.algo,o=i.SHA256,s=i.SHA224=o.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=o._doFinalize.call(this);return t.sigBytes-=4,t}});e.SHA224=o._createHelper(s),e.HmacSHA224=o._createHmacHelper(s)}(),t.SHA224})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(14))}(0,function(t){return function(e){var n=t,r=n.lib,i=r.WordArray,o=r.Hasher,s=n.x64,a=s.Word,c=n.algo,u=[],h=[],f=[];!function(){for(var t=1,e=0,n=0;n<24;n++){u[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,i=(2*t+3*e)%5;t=r,e=i}for(var t=0;t<5;t++)for(var e=0;e<5;e++)h[t+5*e]=e+(2*t+3*e)%5*5;for(var o=1,s=0;s<24;s++){for(var c=0,l=0,p=0;p<7;p++){if(1&o){var d=(1<<p)-1;d<32?l^=1<<d:c^=1<<d-32}128&o?o=o<<1^113:o<<=1}f[s]=a.create(c,l)}}();var l=[];!function(){for(var t=0;t<25;t++)l[t]=a.create()}();var p=c.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,i=0;i<r;i++){var o=t[e+2*i],s=t[e+2*i+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8);var a=n[i];a.high^=s,a.low^=o}for(var c=0;c<24;c++){for(var p=0;p<5;p++){for(var d=0,g=0,v=0;v<5;v++){var a=n[p+5*v];d^=a.high,g^=a.low}var b=l[p];b.high=d,b.low=g}for(var p=0;p<5;p++)for(var y=l[(p+4)%5],_=l[(p+1)%5],m=_.high,w=_.low,d=y.high^(m<<1|w>>>31),g=y.low^(w<<1|m>>>31),v=0;v<5;v++){var a=n[p+5*v];a.high^=d,a.low^=g}for(var S=1;S<25;S++){var a=n[S],E=a.high,k=a.low,I=u[S];if(I<32)var d=E<<I|k>>>32-I,g=k<<I|E>>>32-I;else var d=k<<I-32|E>>>64-I,g=E<<I-32|k>>>64-I;var A=l[h[S]];A.high=d,A.low=g}var x=l[0],T=n[0];x.high=T.high,x.low=T.low;for(var p=0;p<5;p++)for(var v=0;v<5;v++){var S=p+5*v,a=n[S],C=l[S],B=l[(p+1)%5+5*v],O=l[(p+2)%5+5*v];a.high=C.high^~B.high&O.high,a.low=C.low^~B.low&O.low}var a=n[0],R=f[c];a.high^=R.high,a.low^=R.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,c=a/8,u=[],h=0;h<c;h++){var f=s[h],l=f.high,p=f.low;l=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),u.push(p),u.push(l)}return new i.init(u,a)},clone:function(){for(var t=o.clone.call(this),e=t._state=this._state.slice(0),n=0;n<25;n++)e[n]=e[n].clone();return t}});n.SHA3=o._createHelper(p),n.HmacSHA3=o._createHmacHelper(p)}(Math),t.SHA3})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(14),n(27))}(0,function(t){return function(){var e=t,n=e.x64,r=n.Word,i=n.WordArray,o=e.algo,s=o.SHA512,a=o.SHA384=s.extend({_doReset:function(){this._hash=new i.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var t=s._doFinalize.call(this);return t.sigBytes-=16,t}});e.SHA384=s._createHelper(a),e.HmacSHA384=s._createHmacHelper(a)}(),t.SHA384})},function(t,e,n){!function(r,i,o){t.exports=e=i(n(0),n(8),n(10),n(9),n(1))}(0,function(t){return function(){function e(t,e){var n=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=n,this._lBlock^=n<<t}function n(t,e){var n=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=n,this._rBlock^=n<<t}var r=t,i=r.lib,o=i.WordArray,s=i.BlockCipher,a=r.algo,c=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],u=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],f=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],p=a.DES=s.extend({_doReset:function(){for(var t=this._key,e=t.words,n=[],r=0;r<56;r++){var i=c[r]-1;n[r]=e[i>>>5]>>>31-i%32&1}for(var o=this._subKeys=[],s=0;s<16;s++){for(var a=o[s]=[],f=h[s],r=0;r<24;r++)a[r/6|0]|=n[(u[r]-1+f)%28]<<31-r%6,a[4+(r/6|0)]|=n[28+(u[r+24]-1+f)%28]<<31-r%6;a[0]=a[0]<<1|a[0]>>>31;for(var r=1;r<7;r++)a[r]=a[r]>>>4*(r-1)+3;a[7]=a[7]<<5|a[7]>>>27}for(var l=this._invSubKeys=[],r=0;r<16;r++)l[r]=o[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,r,i){this._lBlock=t[r],this._rBlock=t[r+1],e.call(this,4,252645135),e.call(this,16,65535),n.call(this,2,858993459),n.call(this,8,16711935),e.call(this,1,1431655765);for(var o=0;o<16;o++){for(var s=i[o],a=this._lBlock,c=this._rBlock,u=0,h=0;h<8;h++)u|=f[h][((c^s[h])&l[h])>>>0];this._lBlock=c,this._rBlock=a^u}var p=this._lBlock;this._lBlock=this._rBlock,this._rBlock=p,e.call(this,1,1431655765),n.call(this,8,16711935),n.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),t[r]=this._lBlock,t[r+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=s._createHelper(p);var d=a.TripleDES=s.extend({_doReset:function(){var t=this._key,e=t.words;this._des1=p.createEncryptor(o.create(e.slice(0,2))),this._des2=p.createEncryptor(o.create(e.slice(2,4))),this._des3=p.createEncryptor(o.create(e.slice(4,6)))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});r.TripleDES=s._createHelper(d)}(),t.TripleDES})},function(t,e,n){(function(e,r){var i=n(16),o=n(28),s=n(4),a=n(100),c=new e([0]),u=function(t,e){t._corked?t.once("uncork",e):e()},h=function(t,e){return function(n){n?t._destroyInterval(n):e&&!t._ended&&t.end()}},f=function(t,e){return t?t._writableState&&t._writableState.finished?e():t._writableState?t.end(e):(t.end(),void e()):e()},l=function(t){return new i.Readable({objectMode:!0,highWaterMark:16}).wrap(t)},p=function(t,e,n){if(!(this instanceof p))return new p(t,e,n);i.Duplex.call(this,n),this._writable=null,this._readable=null,this._readable2=null,this._forwardDestroy=!n||!1!==n.destroy,this._forwardEnd=!n||!1!==n.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this._error=null,this._preferError=!1,this.destroyed=!1,t&&this.setWritable(t),e&&this.setReadable(e)};s(p,i.Duplex),p.obj=function(t,e,n){return n||(n={}),n.objectMode=!0,n.highWaterMark=16,new p(t,e,n)},p.prototype.cork=function(){1==++this._corked&&this.emit("cork")},p.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},p.prototype.setWritable=function(t){if(this._unwrite&&this._unwrite(),this.destroyed)return void(t&&t.destroy&&t.destroy());if(null===t||!1===t)return void this.end();var e=this,n=o(t,{writable:!0,readable:!1},h(this,this._forwardEnd)),i=function(){var t=e._ondrain;e._ondrain=null,t&&t()},s=function(){e._writable.removeListener("drain",i),n()};this._unwrite&&r.nextTick(i),this._writable=t,this._writable.on("drain",i),this._unwrite=s,this.uncork()},p.prototype.setReadable=function(t){if(this._unread&&this._unread(),this.destroyed)return void(t&&t.destroy&&t.destroy());if(null===t||!1===t)return this.push(null),void this.resume();var e=this,n=o(t,{writable:!1,readable:!0},h(this)),r=function(){e._forward()},i=function(){e.push(null)},s=function(){e._readable2.removeListener("readable",r),e._readable2.removeListener("end",i),n()};this._drained=!0,this._readable=t,this._readable2=t._readableState?t:l(t),this._readable2.on("readable",r),this._readable2.on("end",i),this._unread=s,this._forward()},p.prototype._read=function(){this._drained=!0,this._forward()},p.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){this._forwarding=!0;for(var t;this._drained&&null!==(t=a(this._readable2));)this.destroyed||(this._drained=this.push(t));this._forwarding=!1}},p.prototype.destroy=function(t){if(this._preferError&&!this._error&&t&&(this._error=t),!this.destroyed){this.destroyed=!0;var e=this;r.nextTick(function(){e._destroy(e._preferError?e._error:t)})}},p.prototype._destroyInterval=function(t){if(!this.destroyed){if("premature close"!==t.message)return this.destroy(t);this._preferError=!0,this.destroy(null)}},p.prototype._destroy=function(t){if(t){var e=this._ondrain;this._ondrain=null,e?e(t):this.emit("error",t)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},p.prototype._write=function(t,e,n){return this.destroyed?n():this._corked?u(this,this._write.bind(this,t,e,n)):t===c?this._finish(n):this._writable?void(!1===this._writable.write(t)?this._ondrain=n:n()):n()},p.prototype._finish=function(t){var e=this;this.emit("preend"),u(this,function(){f(e._forwardEnd&&e._writable,function(){!1===e._writableState.prefinished&&(e._writableState.prefinished=!0),e.emit("prefinish"),u(e,t)})})},p.prototype.end=function(t,e,n){return"function"==typeof t?this.end(null,null,t):"function"==typeof e?this.end(t,null,e):(this._ended=!0,t&&this.write(t),this._writableState.ending||this.write(c),i.Writable.prototype.end.call(this,n))},t.exports=p}).call(e,n(11).Buffer,n(2))},function(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,h=-7,f=n?i-1:0,l=n?-1:1,p=t[e+f];for(f+=l,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+f],f+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+f],f+=l,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,h=(1<<u)-1,f=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),e+=s+f>=1?l/c:l*Math.pow(2,1-f),e*c>=2&&(s++,c/=2),s+f>=h?(a=0,s=h):s+f>=1?(a=(e*c-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+p]=255&s,p+=d,s/=256,u-=8);t[n+p-d]|=128*g}},function(t,e,n){"use strict";function r(t){var e=new i;return s(t,e),e.concat()}function i(){this._array=new Array(20),this._i=0}var o=n(5).Buffer,s=n(31),a=n(6).EventEmitter;n(4)(i,a),i.prototype.write=function(t){return this._array[this._i++]=t,!0},i.prototype.concat=function(){var t,e,n=0,r=new Array(this._array.length),i=this._array,s=0;for(t=0;t<i.length&&i[t];t++)"string"!=typeof i[t]?r[t]=i[t].length:r[t]=o.byteLength(i[t]),n+=r[t];for(e=o.allocUnsafe(n),t=0;t<i.length&&i[t];t++)"string"!=typeof i[t]?(i[t].copy(e,s),s+=r[t]):(e.write(i[t],s),s+=r[t]);return e},t.exports=r},function(t,e,n){"use strict";e.parser=n(85),e.generate=n(80),e.writeToStream=n(31)},function(t,e,n){"use strict";(function(e){function n(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return e.nextTick(function(){t.apply(null,o)})}}!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports=n:t.exports=e.nextTick}).call(e,n(2))},function(t,e,n){"use strict";function r(t){var e=o.allocUnsafe(2);return e.writeUInt8(t>>8,0,!0),e.writeUInt8(255&t,1,!0),e}function i(){for(var t=0;t<s;t++)a[t]=r(t)}var o=n(5).Buffer,s=65536,a={};t.exports={cache:a,generateCache:i,generateNumber:r}},function(t,e){function n(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}t.exports=n},function(t,e,n){"use strict";function r(){if(!(this instanceof r))return new r;this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState()}var i=n(52),o=n(4),s=n(6).EventEmitter,a=n(84),c=n(30);o(r,s),r.prototype._resetState=function(){this.packet=new a,this.error=null,this._list=i(),this._stateCounter=0},r.prototype.parse=function(t){for(this.error&&this._resetState(),this._list.append(t);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)++this._stateCounter>=this._states.length&&(this._stateCounter=0);return this._list.length},r.prototype._parseHeader=function(){var t=this._list.readUInt8(0);return this.packet.cmd=c.types[t>>c.CMD_SHIFT],this.packet.retain=0!=(t&c.RETAIN_MASK),this.packet.qos=t>>c.QOS_SHIFT&c.QOS_MASK,this.packet.dup=0!=(t&c.DUP_MASK),this._list.consume(1),!0},r.prototype._parseLength=function(){for(var t,e=0,n=1,r=0,i=!0;e<5&&(t=this._list.readUInt8(e++),r+=n*(t&c.LENGTH_MASK),n*=128,0!=(t&c.LENGTH_FIN_MASK));)if(this._list.length<=e){i=!1;break}return i&&(this.packet.length=r,this._list.consume(e)),i},r.prototype._parsePayload=function(){var t=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseMessageId();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":case"disconnect":break;default:this._emitError(new Error("Not supported"))}t=!0}return t},r.prototype._parseConnect=function(){var t,e,n,r,i,o,s={},a=this.packet;if(null===(t=this._parseString()))return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==t&&"MQIsdp"!==t)return this._emitError(new Error("Invalid protocolId"));if(a.protocolId=t,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(a.protocolVersion=this._list.readUInt8(this._pos),3!==a.protocolVersion&&4!==a.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(++this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.username=this._list.readUInt8(this._pos)&c.USERNAME_MASK,s.password=this._list.readUInt8(this._pos)&c.PASSWORD_MASK,s.will=this._list.readUInt8(this._pos)&c.WILL_FLAG_MASK,s.will&&(a.will={},a.will.retain=0!=(this._list.readUInt8(this._pos)&c.WILL_RETAIN_MASK),a.will.qos=(this._list.readUInt8(this._pos)&c.WILL_QOS_MASK)>>c.WILL_QOS_SHIFT),a.clean=0!=(this._list.readUInt8(this._pos)&c.CLEAN_SESSION_MASK),this._pos++,a.keepalive=this._parseNum(),-1===a.keepalive)return this._emitError(new Error("Packet too short"));if(null===(e=this._parseString()))return this._emitError(new Error("Packet too short"));if(a.clientId=e,s.will){if(null===(n=this._parseString()))return this._emitError(new Error("Cannot parse will topic"));if(a.will.topic=n,null===(r=this._parseBuffer()))return this._emitError(new Error("Cannot parse will payload"));a.will.payload=r}if(s.username){if(null===(o=this._parseString()))return this._emitError(new Error("Cannot parse username"));a.username=o}if(s.password){if(null===(i=this._parseBuffer()))return this._emitError(new Error("Cannot parse password"));a.password=i}return a},r.prototype._parseConnack=function(){var t=this.packet;return this._list.length<2?null:(t.sessionPresent=!!(this._list.readUInt8(this._pos++)&c.SESSIONPRESENT_MASK),t.returnCode=this._list.readUInt8(this._pos),-1===t.returnCode?this._emitError(new Error("Cannot parse return code")):void 0)},r.prototype._parsePublish=function(){var t=this.packet;if(t.topic=this._parseString(),null===t.topic)return this._emitError(new Error("Cannot parse topic"));t.qos>0&&!this._parseMessageId()||(t.payload=this._list.slice(this._pos,t.length))},r.prototype._parseSubscribe=function(){var t,e,n=this.packet;if(1!==n.qos)return this._emitError(new Error("Wrong subscribe header"));if(n.subscriptions=[],this._parseMessageId())for(;this._pos<n.length;){if(null===(t=this._parseString()))return this._emitError(new Error("Cannot parse topic"));e=this._list.readUInt8(this._pos++),n.subscriptions.push({topic:t,qos:e})}},r.prototype._parseSuback=function(){if(this.packet.granted=[],this._parseMessageId())for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))},r.prototype._parseUnsubscribe=function(){var t=this.packet;if(t.unsubscriptions=[],this._parseMessageId())for(;this._pos<t.length;){var e;if(null===(e=this._parseString()))return this._emitError(new Error("Cannot parse topic"));t.unsubscriptions.push(e)}},r.prototype._parseUnsuback=function(){if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"))},r.prototype._parseMessageId=function(){var t=this.packet;return t.messageId=this._parseNum(),null!==t.messageId||(this._emitError(new Error("Cannot parse messageId")),!1)},r.prototype._parseString=function(t){var e,n=this._parseNum(),r=n+this._pos;return-1===n||r>this._list.length||r>this.packet.length?null:(e=this._list.toString("utf8",this._pos,r),this._pos+=n,e)},r.prototype._parseBuffer=function(){var t,e=this._parseNum(),n=e+this._pos;return-1===e||n>this._list.length||n>this.packet.length?null:(t=this._list.slice(this._pos,n),this._pos+=e,t)},r.prototype._parseNum=function(){if(this._list.length-this._pos<2)return-1;var t=this._list.readUInt16BE(this._pos);return this._pos+=2,t},r.prototype._newPacket=function(){return this.packet&&(this._list.consume(this.packet.length),this.emit("packet",this.packet)),this.packet=new a,!0},r.prototype._emitError=function(t){this.error=t,this.emit("error",t)},t.exports=r},function(t,e,n){"use strict";(function(e,r){function i(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function o(t,e,n){t.emit("packetsend",e),!l.writeToStream(e,t.stream)&&n?t.stream.once("drain",n):n&&n()}function s(t,e,n){t.outgoingStore.put(e,function(r){if(r)return n&&n(r);o(t,e,n)})}function a(){}function c(t,e){var n,r=this;if(!(this instanceof c))return new c(t,e);this.options=e||{};for(n in _)void 0===this.options[n]?this.options[n]=_[n]:this.options[n]=e[n];this.options.clientId="string"==typeof this.options.clientId?this.options.clientId:i(),this.streamBuilder=t,this.outgoingStore=this.options.outgoingStore||new h,this.incomingStore=this.options.incomingStore||new h,this.queueQoSZero=void 0===this.options.queueQoSZero||this.options.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this.nextId=Math.floor(65535*Math.random()),this.outgoing={},this.on("connect",function(){if(!this.disconnected){this.connected=!0;var t=null;t=this.outgoingStore.createStream(),t.once("readable",function(){function e(){var n,i=t.read(1);i&&(!r.disconnecting&&!r.reconnectTimer&&r.options.reconnectPeriod>0?(t.read(0),n=r.outgoing[i.messageId],r.outgoing[i.messageId]=function(t,r){n&&n(t,r),e()},r._sendPacket(i)):t.destroy&&t.destroy())}e()}).on("error",this.emit.bind(this,"error"))}}),this.on("close",function(){this.connected=!1,clearTimeout(this.connackTimer)}),this.on("connect",this._setupPingTimer),this.on("connect",function(){function t(){var n=e.shift(),i=null;n&&(i=n.packet,r._sendPacket(i,function(e){n.cb&&n.cb(e),t()}))}var e=this.queue;t()});var o=!0;this.on("connect",function(){!o&&this.options.clean&&Object.keys(this._resubscribeTopics).length>0&&(this.options.resubscribe?(this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics)):this._resubscribeTopics={}),o=!1}),this.on("close",function(){null!==r.pingTimer&&(r.pingTimer.clear(),r.pingTimer=null)}),this.on("close",this._setupReconnect),u.EventEmitter.call(this),this._setupStream()}var u=n(6),h=n(35),f=n(28),l=n(81),p=n(16).Writable,d=n(4),g=n(98),v=n(88),b=n(25),y=e.setImmediate||function(t){r.nextTick(t)},_={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0};d(c,u.EventEmitter),c.prototype._setupStream=function(){function t(){r.nextTick(e)}function e(){var e=h.shift(),n=u;e?i._handlePacket(e,t):(u=null,n())}var n,i=this,s=new p,c=l.parser(this.options),u=null,h=[];this._clearReconnect(),this.stream=this.streamBuilder(this),c.on("packet",function(t){h.push(t)}),s._write=function(t,n,r){u=r,c.parse(t),e()},this.stream.pipe(s),this.stream.on("error",a),f(this.stream,this.emit.bind(this,"close")),n=Object.create(this.options),n.cmd="connect",o(this,n),c.on("error",this.emit.bind(this,"error")),this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){i._cleanUp(!0)},this.options.connectTimeout)},c.prototype._handlePacket=function(t,e){switch(this.emit("packetreceive",t),t.cmd){case"publish":this._handlePublish(t,e);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(t),e();break;case"pubrel":this._handlePubrel(t,e);break;case"connack":this._handleConnack(t),e();break;case"pingresp":this._handlePingresp(t),e()}},c.prototype._checkDisconnecting=function(t){return this.disconnecting&&(t?t(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},c.prototype.publish=function(t,e,n,r){var i;if("function"==typeof n&&(r=n,n=null),n=b({qos:0,retain:!1,dup:!1},n),this._checkDisconnecting(r))return this;switch(i={cmd:"publish",topic:t,payload:e,qos:n.qos,retain:n.retain,messageId:this._nextId(),dup:n.dup},n.qos){case 1:case 2:this.outgoing[i.messageId]=r||a,this._sendPacket(i);break;default:this._sendPacket(i,r)}return this},c.prototype.subscribe=function(){var t,e,n=Array.prototype.slice.call(arguments),r=[],i=n.shift(),o=i.resubscribe,s=n.pop()||a,c=n.pop(),u=this;if(delete i.resubscribe,"string"==typeof i&&(i=[i]),"function"!=typeof s&&(c=s,s=a),null!==(e=v.validateTopics(i)))return y(s,new Error("Invalid topic "+e)),this;if(this._checkDisconnecting(s))return this;if(c=b({qos:0},c),Array.isArray(i)?i.forEach(function(t){(u._resubscribeTopics[t]<c.qos||!u._resubscribeTopics.hasOwnProperty(t)||o)&&r.push({topic:t,qos:c.qos})}):Object.keys(i).forEach(function(t){(u._resubscribeTopics[t]<i[t]||!u._resubscribeTopics.hasOwnProperty(t)||o)&&r.push({topic:t,qos:i[t]})}),t={cmd:"subscribe",subscriptions:r,qos:1,retain:!1,dup:!1,messageId:this._nextId()},!r.length)return void s(null,[]);if(this.options.resubscribe){var h=[];r.forEach(function(t){u.options.reconnectPeriod>0&&(u._resubscribeTopics[t.topic]=t.qos,h.push(t.topic))}),u.messageIdToTopic[t.messageId]=h}return this.outgoing[t.messageId]=function(t,e){if(!t)for(var n=e.granted,i=0;i<n.length;i+=1)r[i].qos=n[i];s(t,r)},this._sendPacket(t),this},c.prototype.unsubscribe=function(t,e){var n={cmd:"unsubscribe",qos:1,messageId:this._nextId()},r=this;return e=e||a,this._checkDisconnecting(e)?this:("string"==typeof t?n.unsubscriptions=[t]:"object"==typeof t&&t.length&&(n.unsubscriptions=t),this.options.resubscribe&&n.unsubscriptions.forEach(function(t){delete r._resubscribeTopics[t]}),this.outgoing[n.messageId]=e,this._sendPacket(n),this)},c.prototype.end=function(t,e){function n(){i.disconnected=!0,i.incomingStore.close(function(){i.outgoingStore.close(e)}),i._deferredReconnect&&i._deferredReconnect()}function r(){i._cleanUp(t,y.bind(null,n))}var i=this;return"function"==typeof t&&(e=t,t=!1),this.disconnecting?this:(this._clearReconnect(),this.disconnecting=!0,!t&&Object.keys(this.outgoing).length>0?this.once("outgoingEmpty",setTimeout.bind(null,r,10)):r(),this)},c.prototype.removeOutgoingMessage=function(t){var e=this.outgoing[t];return delete this.outgoing[t],this.outgoingStore.del({messageId:t},function(){e(new Error("Message removed"))}),this},c.prototype.reconnect=function(t){var e=this,n=function(){t?(e.options.incomingStore=t.incomingStore,e.options.outgoingStore=t.outgoingStore):(e.options.incomingStore=null,e.options.outgoingStore=null),e.incomingStore=e.options.incomingStore||new h,e.outgoingStore=e.options.outgoingStore||new h,e.disconnecting=!1,e.disconnected=!1,e._deferredReconnect=null,e._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=n:n(),this},c.prototype._reconnect=function(){this.emit("reconnect"),this._setupStream()},c.prototype._setupReconnect=function(){var t=this;!t.disconnecting&&!t.reconnectTimer&&t.options.reconnectPeriod>0&&(this.reconnecting||(this.emit("offline"),this.reconnecting=!0),t.reconnectTimer=setInterval(function(){t._reconnect()},t.options.reconnectPeriod))},c.prototype._clearReconnect=function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},c.prototype._cleanUp=function(t,e){e&&this.stream.on("close",e),t?this.stream.destroy():this._sendPacket({cmd:"disconnect"},y.bind(null,this.stream.end.bind(this.stream))),this.disconnecting||(this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null)},c.prototype._sendPacket=function(t,e){if(!this.connected)return void(0===(t.qos||0)&&this.queueQoSZero||"publish"!==t.cmd?this.queue.push({packet:t,cb:e}):t.qos>0?(e=this.outgoing[t.messageId],this.outgoingStore.put(t,function(t){if(t)return e&&e(t)})):e&&e(new Error("No connection to broker")));if(this._shiftPingInterval(),"publish"!==t.cmd)return void o(this,t,e);switch(t.qos){case 2:case 1:s(this,t,e);break;case 0:default:o(this,t,e)}},c.prototype._setupPingTimer=function(){var t=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=g(function(){t._checkPing()},1e3*this.options.keepalive))},c.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},c.prototype._checkPing=function(){this.pingResp?(this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):this._cleanUp(!0)},c.prototype._handlePingresp=function(){this.pingResp=!0},c.prototype._handleConnack=function(t){var e=t.returnCode,n=["","Unacceptable protocol version","Identifier rejected","Server unavailable","Bad username or password","Not authorized"];if(clearTimeout(this.connackTimer),0===e)this.reconnecting=!1,this.emit("connect",t);else if(e>0){var r=new Error("Connection refused: "+n[e]);r.code=e,this.emit("error",r)}},c.prototype._handlePublish=function(t,e){var n=t.topic.toString(),r=t.payload,i=t.qos,o=t.messageId,s=this;switch(i){case 2:this.incomingStore.put(t,function(){s._sendPacket({cmd:"pubrec",messageId:o},e)});break;case 1:this.emit("message",n,r,t),this.handleMessage(t,function(t){if(t)return e&&e(t);s._sendPacket({cmd:"puback",messageId:o},e)});break;case 0:this.emit("message",n,r,t),this.handleMessage(t,e)}},c.prototype.handleMessage=function(t,e){e()},c.prototype._handleAck=function(t){var e=t.messageId,n=t.cmd,r=null,i=this.outgoing[e],o=this;if(i){switch(n){case"pubcomp":case"puback":delete this.outgoing[e],this.outgoingStore.del(t,i);break;case"pubrec":r={cmd:"pubrel",qos:2,messageId:e},this._sendPacket(r);break;case"suback":if(delete this.outgoing[e],1===t.granted.length&&0!=(128&t.granted[0])){var s=this.messageIdToTopic[e];s&&s.forEach(function(t){delete o._resubscribeTopics[t]})}i(null,t);break;case"unsuback":delete this.outgoing[e],i(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}},c.prototype._handlePubrel=function(t,e){var n=t.messageId,r=this,i={cmd:"pubcomp",messageId:n};r.incomingStore.get(t,function(n,o){n||"pubrel"===o.cmd?r._sendPacket(i,e):(r.emit("message",o.topic,o.payload,o),r.incomingStore.put(t),r.handleMessage(o,function(t){if(t)return e&&e(t);r._sendPacket(i,e)}))})},c.prototype._nextId=function(){var t=this.nextId++;return 65535===t&&(this.nextId=1),t},c.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},t.exports=c}).call(e,n(3),n(2))},function(t,e,n){"use strict";(function(e){function r(t){var e;t.auth&&(e=t.auth.match(/^(.+):(.+)$/),e?(t.username=e[1],t.password=e[2]):t.username=t.auth)}function i(t,e){function n(t){return e.servers&&(t._reconnectCount&&t._reconnectCount!==e.servers.length||(t._reconnectCount=0),e.host=e.servers[t._reconnectCount].host,e.port=e.servers[t._reconnectCount].port,e.hostname=e.host,t._reconnectCount++),u[e.protocol](t,e)}if("object"!=typeof t||e||(e=t,t=null),e=e||{},t){var i=a.parse(t,!0);if(null!=i.port&&(i.port=Number(i.port)),e=c(i,e),null===e.protocol)throw new Error("Missing protocol");e.protocol=e.protocol.replace(/:$/,"")}if(r(e),e.query&&"string"==typeof e.query.clientId&&(e.clientId=e.query.clientId),e.cert&&e.key){if(!e.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs"].indexOf(e.protocol))switch(e.protocol){case"mqtt":e.protocol="mqtts";break;case"ws":e.protocol="wss";break;case"wx":e.protocol="wxs";break;default:throw new Error('Unknown protocol for secure connection: "'+e.protocol+'"!')}}if(!u[e.protocol]){var s=-1!==["mqtts","wss"].indexOf(e.protocol);e.protocol=["mqtt","mqtts","ws","wss","wx","wxs"].filter(function(t,e){return(!s||e%2!=0)&&"function"==typeof u[t]})[0]}if(!1===e.clean&&!e.clientId)throw new Error("Missing clientId for unclean clients");return new o(n,e)}var o=n(86),s=n(35),a=n(23),c=n(25),u={};"browser"!==e.title?(u.mqtt=n(32),u.tcp=n(32),u.ssl=n(21),u.tls=n(21),u.mqtts=n(21)):(u.wx=n(34),u.wxs=n(34)),u.ws=n(33),u.wss=n(33),t.exports=i,t.exports.connect=i,t.exports.MqttClient=o,t.exports.Store=s}).call(e,n(2))},function(t,e,n){"use strict";function r(t){for(var e=t.split("/"),n=0;n<e.length;n++)if("+"!==e[n]){if("#"===e[n])return n===e.length-1;if(-1!==e[n].indexOf("+")||-1!==e[n].indexOf("#"))return!1}return!0}function i(t){if(0===t.length)return"empty_topic_list";for(var e=0;e<t.length;e++)if(!r(t[e]))return t[e];return null}t.exports={validateTopics:i}},function(t,e,n){function r(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function i(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},n=t.name||"Function wrapped with `once`";return e.onceError=n+" shouldn't be called more than once",e.called=!1,e}var o=n(108);t.exports=o(r),t.exports.strict=o(i),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})})},function(t,e,n){(function(t){function n(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(t){return i.exec(t).slice(1)};e.resolve=function(){for(var e="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s=o>=0?arguments[o]:t.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(e=s+"/"+e,i="/"===s.charAt(0))}return e=n(r(e.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+e||"."},e.normalize=function(t){var i=e.isAbsolute(t),o="/"===s(t,-1);return t=n(r(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(r(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,n){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var i=r(t.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,c=0;c<s;c++)if(i[c]!==o[c]){a=c;break}for(var u=[],c=a;c<i.length;c++)u.push("..");return u=u.concat(o.slice(a)),u.join("/")},e.sep="/",e.delimiter=":",e.dirname=function(t){var e=o(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},e.basename=function(t,e){var n=o(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},e.extname=function(t){return o(t)[3]};var s="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(e,n(2))},function(t,e,n){(function(t,r){var i;!function(o){function s(t){throw RangeError(R[t])}function a(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function c(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(O,"."),r+a(t.split("."),e).join(".")}function u(t){for(var e,n,r=[],i=0,o=t.length;i<o;)e=t.charCodeAt(i++),e>=55296&&e<=56319&&i<o?(n=t.charCodeAt(i++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),i--)):r.push(e);return r}function h(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=N(t>>>10&1023|55296),t=56320|1023&t),e+=N(t)}).join("")}function f(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:w}function l(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function p(t,e,n){var r=0;for(t=n?P(t/I):t>>1,t+=P(t/e);t>M*E>>1;r+=w)t=P(t/M);return P(r+(M+1)*t/(t+k))}function d(t){var e,n,r,i,o,a,c,u,l,d,g=[],v=t.length,b=0,y=x,_=A;for(n=t.lastIndexOf(T),n<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&s("not-basic"),g.push(t.charCodeAt(r));for(i=n>0?n+1:0;i<v;){for(o=b,a=1,c=w;i>=v&&s("invalid-input"),u=f(t.charCodeAt(i++)),(u>=w||u>P((m-b)/a))&&s("overflow"),b+=u*a,l=c<=_?S:c>=_+E?E:c-_,!(u<l);c+=w)d=w-l,a>P(m/d)&&s("overflow"),a*=d;e=g.length+1,_=p(b-o,e,0==o),P(b/e)>m-y&&s("overflow"),y+=P(b/e),b%=e,g.splice(b++,0,y)}return h(g)}function g(t){var e,n,r,i,o,a,c,h,f,d,g,v,b,y,_,k=[];for(t=u(t),v=t.length,e=x,n=0,o=A,a=0;a<v;++a)(g=t[a])<128&&k.push(N(g));for(r=i=k.length,i&&k.push(T);r<v;){for(c=m,a=0;a<v;++a)(g=t[a])>=e&&g<c&&(c=g);for(b=r+1,c-e>P((m-n)/b)&&s("overflow"),n+=(c-e)*b,e=c,a=0;a<v;++a)if(g=t[a],g<e&&++n>m&&s("overflow"),g==e){for(h=n,f=w;d=f<=o?S:f>=o+E?E:f-o,!(h<d);f+=w)_=h-d,y=w-d,k.push(N(l(d+_%y,0))),h=P(_/y);k.push(N(l(h,0))),o=p(n,b,r==i),n=0,++r}++n,++e}return k.join("")}function v(t){return c(t,function(t){return C.test(t)?d(t.slice(4).toLowerCase()):t})}function b(t){return c(t,function(t){return B.test(t)?"xn--"+g(t):t})}var y=("object"==typeof e&&e&&e.nodeType,"object"==typeof t&&t&&t.nodeType,"object"==typeof r&&r);var _,m=2147483647,w=36,S=1,E=26,k=38,I=700,A=72,x=128,T="-",C=/^xn--/,B=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=w-S,P=Math.floor,N=String.fromCharCode;_={version:"1.3.2",ucs2:{decode:u,encode:h},decode:d,encode:g,toASCII:b,toUnicode:v},void 0!==(i=function(){return _}.call(e,n,e,t))&&(t.exports=i)}()}).call(e,n(106)(t),n(3))},function(t,e,n){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,o){e=e||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var c=1e3;o&&"number"==typeof o.maxKeys&&(c=o.maxKeys);var u=t.length;c>0&&u>c&&(u=c);for(var h=0;h<u;++h){var f,l,p,d,g=t[h].replace(a,"%20"),v=g.indexOf(n);v>=0?(f=g.substr(0,v),l=g.substr(v+1)):(f=g,l=""),p=decodeURIComponent(f),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(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";function r(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r<t.length;r++)n.push(e(t[r],r));return n}var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,n,a){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?r(s(t),function(s){var a=encodeURIComponent(i(s))+n;return o(t[s])?r(t[s],function(t){return a+encodeURIComponent(i(t))}).join(e):a+encodeURIComponent(i(t[s]))}).join(e):a?encodeURIComponent(i(a))+n+encodeURIComponent(i(t)):""};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},s=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}},function(t,e,n){"use strict";e.decode=e.parse=n(92),e.encode=e.stringify=n(93)},function(t,e,n){t.exports=n(7)},function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);i.call(this,t)}t.exports=r;var i=n(37),o=n(12);o.inherits=n(4),o.inherits(r,i),r.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){t.copy(e,n)}var o=n(5).Buffer,s=n(112);t.exports=function(){function t(){r(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return o.alloc(0);if(1===this.length)return this.head.data;for(var e=o.allocUnsafe(t>>>0),n=this.head,r=0;n;)i(n.data,e,r),r+=n.data.length,n=n.next;return e},t}(),s&&s.inspect&&s.inspect.custom&&(t.exports.prototype[s.inspect.custom]=function(){var t=s.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e,n){"use strict";function r(t,e,n){var r=this;this._callback=t,this._args=n,this._interval=setInterval(t,e,this._args),this.reschedule=function(t){t||(t=r._interval),r._interval&&clearInterval(r._interval),r._interval=setInterval(r._callback,t,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 t;if(arguments.length>0){t=new Array(arguments.length-2);for(var e=0;e<t.length;e++)t[e]=arguments[e+2]}return new r(arguments[0],arguments[1],t)}t.exports=i},function(t,e,n){(function(t,e){!function(t,n){"use strict";function r(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return u[c]=r,a(c),c++}function i(t){delete u[t]}function o(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}function s(t){if(h)setTimeout(s,0,t);else{var e=u[t];if(e){h=!0;try{o(e)}finally{i(t),h=!1}}}}if(!t.setImmediate){var a,c=1,u={},h=!1,f=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?function(){a=function(t){e.nextTick(function(){s(t)})}}():function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&s(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),a=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){s(t.data)},a=function(e){t.port2.postMessage(e)}}():f&&"onreadystatechange"in f.createElement("script")?function(){var t=f.documentElement;a=function(e){var n=f.createElement("script");n.onreadystatechange=function(){s(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():function(){a=function(t){setTimeout(s,0,t)}}(),l.setImmediate=r,l.clearImmediate=i}}("undefined"==typeof self?void 0===t?this:t:self)}).call(e,n(3),n(2))},function(t,e){function n(t){var e=t._readableState;return e?e.objectMode?t.read():t.read(r(e)):null}function r(t){return t.buffer.length?t.buffer.head?t.buffer.head.data.length:t.buffer[0].length:t.length}t.exports=n},function(t,e,n){(function(t){function r(t,e){this._id=t,this._clearFn=e}var i=Function.prototype.apply;e.setTimeout=function(){return new r(i.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new r(i.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(99),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(e,n(3))},function(t,e,n){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,n){(function(e){function n(t,e){function n(){if(!i){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation"),i=!0}return t.apply(this,arguments)}if(r("noDeprecation"))return t;var i=!1;return n}function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=n}).call(e,n(3))},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){var n=null;"undefined"!=typeof WebSocket?n=WebSocket:"undefined"!=typeof MozWebSocket?n=MozWebSocket:"undefined"!=typeof window&&(n=window.WebSocket||window.MozWebSocket),t.exports=n},function(t,e){function n(t,e){function r(){for(var e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];var r=t.apply(this,e),i=e[e.length-1];return"function"==typeof r&&r!==i&&Object.keys(i).forEach(function(t){r[t]=i[t]}),r}if(t&&e)return n(t)(e);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(e){r[e]=t[e]}),r}t.exports=n},function(t,e){},function(t,e){},function(t,e){},function(t,e){}])});