!function(){return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[s]={exports:{}};t[s][0].call(f.exports,function(e){return i(t[s][1][e]||e)},f,f.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}}()({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=s(e("url-template")),o=s(e("./lib/apiGatewayCore/apiGatewayClient"));
/*
                                                                                                                                                                                                                                                                               * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
                                                                                                                                                                                                                                                                               *
                                                                                                                                                                                                                                                                               * Licensed under the Apache License, Version 2.0 (the "License").
                                                                                                                                                                                                                                                                               * You may not use this file except in compliance with the License.
                                                                                                                                                                                                                                                                               * A copy of the License is located at
                                                                                                                                                                                                                                                                               *
                                                                                                                                                                                                                                                                               *  http://aws.amazon.com/apache2.0
                                                                                                                                                                                                                                                                               *
                                                                                                                                                                                                                                                                               * or in the "license" file accompanying this file. This file is distributed
                                                                                                                                                                                                                                                                               * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
                                                                                                                                                                                                                                                                               * express or implied. See the License for the specific language governing
                                                                                                                                                                                                                                                                               * permissions and limitations under the License.
                                                                                                                                                                                                                                                                               */function s(e){return e&&e.__esModule?e:{default:e}}var a={};a.newClient=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={},n=(e=Object.assign({accessKey:"",secretKey:"",sessionToken:"",region:"",apiKey:"",invokeUrl:"",service:"execute-api",defaultContentType:"application/json",defaultAcceptType:"application/json",systemClockOffset:0,headers:{}},function e(t){return Object.keys(t).forEach(function(n){return t[n]&&"object"===r(t[n])&&e(t[n])||void 0===t[n]&&delete t[n]}),t}(e))).invokeUrl,s=/(^https?:\/\/[^\/]+)/g.exec(n)[1],a=n.substring(s.length),c={accessKey:e.accessKey,secretKey:e.secretKey,sessionToken:e.sessionToken,serviceName:e.service,region:e.region,endpoint:s,defaultContentType:e.defaultContentType,defaultAcceptType:e.defaultAcceptType,systemClockOffset:e.systemClockOffset,retries:e.retries,retryCondition:e.retryCondition},u="NONE";void 0!==c.accessKey&&""!==c.accessKey&&void 0!==c.secretKey&&""!==c.secretKey&&(u="AWS_IAM");var f={endpoint:s,defaultContentType:e.defaultContentType,defaultAcceptType:e.defaultAcceptType,retries:e.retries,retryCondition:e.retryCondition,headers:e.headers},l=o.default.newClient(f,c);return t.invokeApi=function(t,n,r,o,s){void 0===o&&(o={}),void 0===s&&(s="");var c={verb:r.toUpperCase(),path:a+i.default.parse(n).expand(t),headers:o.headers||{},queryParams:o.queryParams,body:s};return l.makeRequest(c,u,o,e.apiKey)},t},n.default=a},{"./lib/apiGatewayCore/apiGatewayClient":2,"url-template":168}],2:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=s(e("./utils")),i=s(e("./sigV4Client.js")),o=s(e("./simpleHttpClient.js"));function s(e){return e&&e.__esModule?e:{default:e}}var a={
/*
                                   * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
                                   *
                                   * Licensed under the Apache License, Version 2.0 (the "License").
                                   * You may not use this file except in compliance with the License.
                                   * A copy of the License is located at
                                   *
                                   *  http://aws.amazon.com/apache2.0
                                   *
                                   * or in the "license" file accompanying this file. This file is distributed
                                   * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
                                   * express or implied. See the License for the specific language governing
                                   * permissions and limitations under the License.
                                   */
newClient:function(e,t){var n={},s=i.default.newClient(t),a=o.default.newClient(e);return n.makeRequest=function(e,t,n,i){var o=a;return void 0!==i&&""!==i&&null!==i&&(e.headers["x-api-key"]=i),void 0!==e.body&&""!==e.body&&null!==e.body&&0!==Object.keys(e.body).length||(e.body=void 0),e.headers=r.default.mergeInto(e.headers,n.headers),e.queryParams=r.default.mergeInto(e.queryParams,n.queryParams),"AWS_IAM"===t&&(o=s),o.makeRequest(e)},n}};n.default=a},{"./sigV4Client.js":3,"./simpleHttpClient.js":4,"./utils":5}],3:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=f(e("axios")),i=f(e("axios-retry")),o=f(e("crypto-js/sha256")),s=f(e("crypto-js/enc-hex")),a=f(e("crypto-js/hmac-sha256")),c=f(e("url")),u=f(e("./utils"));function f(e){return e&&e.__esModule?e:{default:e}}var l={};
/*
                              * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
                              *
                              * Licensed under the Apache License, Version 2.0 (the "License").
                              * You may not use this file except in compliance with the License.
                              * A copy of the License is located at
                              *
                              *  http://aws.amazon.com/apache2.0
                              *
                              * or in the "license" file accompanying this file. This file is distributed
                              * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
                              * express or implied. See the License for the specific language governing
                              * permissions and limitations under the License.
                              */l.newClient=function(e){var t="AWS4-HMAC-SHA256",n="aws4_request",f="AWS4";function l(e){return(0,o.default)(e)}function h(e){return e.toString(s.default)}function d(e,t){return(0,a.default)(t,e,{asBytes:!0})}function p(e,t,n,r,i){return e+"\n"+encodeURI(t)+"\n"+_(n)+"\n"+function(e){var t="",n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(r);n.sort();for(var i=0;i<n.length;i++)t+=n[i].toLowerCase()+":"+e[n[i]]+"\n";return t}(r)+"\n"+g(r)+"\n"+h(l(i))}function _(e){if(Object.keys(e).length<1)return"";var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);t.sort();for(var r,i="",o=0;o<t.length;o++)i+=t[o]+"="+(r=e[t[o]],encodeURIComponent(r).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16)}))+"&";return i.substr(0,i.length-1)}function g(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n.toLowerCase());return t.sort(),t.join(";")}var v={};return void 0===e.accessKey||void 0===e.secretKey?v:(v.accessKey=u.default.assertDefined(e.accessKey,"accessKey"),v.secretKey=u.default.assertDefined(e.secretKey,"secretKey"),v.sessionToken=e.sessionToken,v.serviceName=u.default.assertDefined(e.serviceName,"serviceName"),v.region=u.default.assertDefined(e.region,"region"),v.endpoint=u.default.assertDefined(e.endpoint,"endpoint"),v.retries=e.retries,v.retryCondition=e.retryCondition,v.makeRequest=function(o){var s=u.default.assertDefined(o.verb,"verb"),a=u.default.assertDefined(o.path,"path"),m=u.default.copy(o.queryParams);void 0===m&&(m={});var y=u.default.copy(o.headers);void 0===y&&(y={}),void 0===y["Content-Type"]&&(y["Content-Type"]=e.defaultContentType),void 0===y.Accept&&(y.Accept=e.defaultAcceptType);var E=u.default.copy(o.body);E&&(E=JSON.stringify(E)),""!==E&&void 0!==E&&null!==E||delete y["Content-Type"];var b=new Date((new Date).getTime()+e.systemClockOffset).toISOString().replace(/\.\d{3}Z$/,"Z").replace(/[:\-]|\.\d{3}/g,"");y["x-amz-date"]=b;var C=c.default.parse(v.endpoint);y.host=C.hostname;var w=function(e){return h(l(e))}(p(s,a,m,y,E)),T=function(e,t,r){return e.substr(0,8)+"/"+t+"/"+r+"/"+n}(b,v.region,v.serviceName),R=function(e,n,r){return t+"\n"+e+"\n"+n+"\n"+r}(b,T,w),S=function(e,t){return h(d(e,t))}(function(e,t,r,i){return d(d(d(d(f+e,t.substr(0,8)),r),i),n)}(v.secretKey,b,v.region,v.serviceName),R);y.Authorization=function(e,n,r,i){return t+" Credential="+e+"/"+n+", SignedHeaders="+g(r)+", Signature="+i}(v.accessKey,T,y,S),void 0!==v.sessionToken&&""!==v.sessionToken&&(y["x-amz-security-token"]=v.sessionToken),delete y.host;var I=e.endpoint+a,N=_(m);""!==N&&(I+="?"+N),void 0===y["Content-Type"]&&(y["Content-Type"]=e.defaultContentType);var O={headers:y,data:E};if(void 0!==e.retries){O.baseURL=I;var A=r.default.create(O);return(0,i.default)(A,{retries:e.retries,retryCondition:e.retryCondition}),A.request({method:s})}return O.method=s,O.url=I,(0,r.default)(O)},v)},n.default=l},{"./utils":5,axios:21,"axios-retry":19,"crypto-js/enc-hex":7,"crypto-js/hmac-sha256":8,"crypto-js/sha256":10,url:169}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=a(e("axios")),o=a(e("axios-retry")),s=a(e("./utils"));
/*
                                                                                                                                                                                                                                                                   * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
                                                                                                                                                                                                                                                                   *
                                                                                                                                                                                                                                                                   * Licensed under the Apache License, Version 2.0 (the "License").
                                                                                                                                                                                                                                                                   * You may not use this file except in compliance with the License.
                                                                                                                                                                                                                                                                   * A copy of the License is located at
                                                                                                                                                                                                                                                                   *
                                                                                                                                                                                                                                                                   *  http://aws.amazon.com/apache2.0
                                                                                                                                                                                                                                                                   *
                                                                                                                                                                                                                                                                   * or in the "license" file accompanying this file. This file is distributed
                                                                                                                                                                                                                                                                   * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
                                                                                                                                                                                                                                                                   * express or implied. See the License for the specific language governing
                                                                                                                                                                                                                                                                   * permissions and limitations under the License.
                                                                                                                                                                                                                                                                   */function a(e){return e&&e.__esModule?e:{default:e}}var c={};c.newClient=function(e){var t={};return t.endpoint=s.default.assertDefined(e.endpoint,"endpoint"),t.makeRequest=function(t){var n=s.default.assertDefined(t.verb,"verb"),a=s.default.assertDefined(t.path,"path"),c=s.default.copy(t.queryParams);void 0===c&&(c={});var u=r({},s.default.copy(t.headers),e.headers);void 0===u["Content-Type"]&&(u["Content-Type"]=e.defaultContentType),void 0===u.Accept&&(u.Accept=e.defaultAcceptType);var f=s.default.copy(t.body),l=e.endpoint+a,h=function(e){if(Object.keys(e).length<1)return"";var t="";for(var n in e)e.hasOwnProperty(n)&&(t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n])+"&");return t.substr(0,t.length-1)}(c);""!==h&&(l+="?"+h);var d={headers:u,data:f};if(void 0!==e.retries){d.baseURL=l;var p=i.default.create(d);return(0,o.default)(p,{retries:e.retries,retryCondition:e.retryCondition}),p.request({method:n})}return d.method=n,d.url=l,(0,i.default)(d)},t},n.default=c},{"./utils":5,axios:21,"axios-retry":19}],5:[function(e,t,n){(function(e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r={assertDefined:function(e,t){if(void 0===e)throw new Error(t+" must be defined");return e},assertParametersDefined:function(e,t,n){if(void 0!==t){t.length>0&&void 0===e&&(e={});for(var i=0;i<t.length;i++)r.contains(n,t[i])||r.assertDefined(e[t[i]],t[i])}},parseParametersToObject:function(e,t){if(void 0===e)return{};for(var n={},r=0;r<t.length;r++)n[t[r]]=e[t[r]];return n},contains:function(e,t){if(void 0===e)return!1;for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},copy:function(n){if(null===n||"object"!==(void 0===n?"undefined":t(n)))return n;if(e.isBuffer(n))return e.from(n);var r=n.constructor(),i=null;for(i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);return r},mergeInto:function(e,n){if(null===e||"object"!==(void 0===e?"undefined":t(e)))return e;var r=e.constructor(),i=null;for(i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);if(null==n||"object"!=(void 0===n?"undefined":t(n)))return e;for(i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);return r}};
/*
 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */n.default=r}).call(this,e("buffer").Buffer)},{buffer:51}],6:[function(e,t,n){var r,i;r=this,i=function(){var e=e||function(e,t){var n=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),r={},i=r.lib={},o=i.Base={extend:function(e){var t=n(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=i.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(o=0;o<i;o+=4)t[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,r=[],i=function(t){t=t;var n=987654321,r=4294967295;return function(){var i=((n=36969*(65535&n)+(n>>16)&r)<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},o=0;o<t;o+=4){var a=i(4294967296*(n||e.random()));n=987654071*a(),r.push(4294967296*a()|0)}return new s.init(r,t)}}),a=r.enc={},c=a.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(n,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(n,t)}},f=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},l=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,o=this.blockSize,a=i/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,u=e.min(4*c,i);if(c){for(var f=0;f<c;f+=o)this._doProcessBlock(r,f);var l=r.splice(0,c);n.sigBytes-=u}return new s.init(l,u)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),h=(i.Hasher=l.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new h.HMAC.init(e,n).finalize(t)}}}),r.algo={});return r}(Math);return e},"object"==typeof n?t.exports=n=i():"function"==typeof define&&define.amd?define([],i):r.CryptoJS=i()},{}],7:[function(e,t,n){var r,i;r=this,i=function(e){return e.enc.Hex},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":6}],8:[function(e,t,n){var r,i;r=this,i=function(e){return e.HmacSHA256},"object"==typeof n?t.exports=n=i(e("./core"),e("./sha256"),e("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha256","./hmac"],i):i(r.CryptoJS)},{"./core":6,"./hmac":9,"./sha256":10}],9:[function(e,t,n){var r,i;r=this,i=function(e){var t,n,r;n=(t=e).lib.Base,r=t.enc.Utf8,t.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,c=s.words,u=0;u<n;u++)a[u]^=1549556828,c[u]^=909522486;o.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":6}],10:[function(e,t,n){var r,i;r=this,i=function(e){return function(t){var n=e,r=n.lib,i=r.WordArray,o=r.Hasher,s=n.algo,a=[],c=[];!function(){function e(e){for(var n=t.sqrt(e),r=2;r<=n;r++)if(!(e%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)e(r)&&(i<8&&(a[i]=n(t.pow(r,.5))),c[i]=n(t.pow(r,1/3)),i++),r++}();var u=[],f=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],f=n[5],l=n[6],h=n[7],d=0;d<64;d++){if(d<16)u[d]=0|e[t+d];else{var p=u[d-15],_=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,g=u[d-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;u[d]=_+u[d-7]+v+u[d-16]}var m=r&i^r&o^i&o,y=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),E=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&f^~a&l)+c[d]+u[d];h=l,l=f,f=a,a=s+E|0,s=o,o=i,i=r,r=E+(y+m)|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]+f|0,n[6]=n[6]+l|0,n[7]=n[7]+h|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=t.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});n.SHA256=o._createHelper(f),n.HmacSHA256=o._createHmacHelper(f)}(Math),e.SHA256},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":6}],11:[function(e,t,n){
/*
 * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
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.'}},{}],12:[function(e,t,n){
/*
 * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
t.exports=function(e){return void 0===e||null===e}},{}],13:[function(e,t,n){(function(n){
/*
 * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
var r=e("fs"),i=e("./is-undefined"),o=e("./exceptions");t.exports=function(e){if(i(e.keyPath)&&i(e.privateKey))throw new Error(o.NO_KEY_OPTION);if(i(e.certPath)&&i(e.clientCert))throw new Error(o.NO_CERT_OPTION);if(i(e.caPath)&&i(e.caCert))throw new Error(o.NO_CA_OPTION);if(!i(e.caCert))if(n.isBuffer(e.caCert))e.ca=e.caCert;else{if(!r.existsSync(e.caCert))throw new Error(o.INVALID_CA_CERT_OPTION);e.ca=r.readFileSync(e.caCert)}if(!i(e.privateKey))if(n.isBuffer(e.privateKey))e.key=e.privateKey;else{if(!r.existsSync(e.privateKey))throw new Error(o.INVALID_PRIVATE_KEY_OPTION);e.key=r.readFileSync(e.privateKey)}if(!i(e.clientCert))if(n.isBuffer(e.clientCert))e.cert=e.clientCert;else{if(!r.existsSync(e.clientCert))throw new Error(o.INVALID_CLIENT_CERT_OPTION);e.cert=r.readFileSync(e.clientCert)}if(r.existsSync(e.keyPath))e.key=r.readFileSync(e.keyPath);else if(!i(e.keyPath))throw new Error(o.INVALID_KEY_PATH_OPTION);if(r.existsSync(e.certPath))e.cert=r.readFileSync(e.certPath);else if(!i(e.certPath))throw new Error(o.INVALID_CERT_PATH_OPTION);if(r.existsSync(e.caPath))e.ca=r.readFileSync(e.caPath);else if(!i(e.caPath))throw new Error(o.INVALID_CA_PATH_OPTION);e.requestCert=!0,e.rejectUnauthorized=!0}}).call(this,{isBuffer:e("../../../is-buffer/index.js")})},{"../../../is-buffer/index.js":119,"./exceptions":11,"./is-undefined":12,fs:50}],14:[function(e,t,n){(function(n){
/*
 * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
var r=e("events"),i=e("util").inherits,o=e("mqtt"),s=e("crypto-js"),a=e("./lib/exceptions"),c=e("../common/lib/is-undefined"),u=e("../common/lib/tls-reader"),f=e("path"),l=e("fs");function h(e){return e>9?e:"0"+e}function d(e,t,n,r,i,o,a,u,f,l,h,d,p,_){var g=e+"\n"+r+"\n"+i+"\n"+("host:"+n.toLowerCase()+"\n")+"\nhost\n"+s.SHA256(l,{asBytes:!0});!0===p&&console.log("canonical request: "+g+"\n");var v=s.SHA256(g,{asBytes:!0});!0===p&&console.log("hashed canonical request: "+v+"\n");var m="AWS4-HMAC-SHA256\n"+d+"\n"+h+"/"+u+"/"+f+"/aws4_request\n"+v;!0===p&&console.log("string to sign: "+m+"\n");var y=function(e,t,n,r){var i=s.HmacSHA256(t,"AWS4"+e,{asBytes:!0}),o=s.HmacSHA256(n,i,{asBytes:!0}),a=s.HmacSHA256(r,o,{asBytes:!0});return s.HmacSHA256("aws4_request",a,{asBytes:!0})}(a,h,u,f);!0===p&&console.log("signing key: "+y+"\n");var E=s.HmacSHA256(m,y,{asBytes:!0});!0===p&&console.log("signature: "+E+"\n");var b=i+"&X-Amz-Signature="+E;c(_)||(b+="&X-Amz-Security-Token="+encodeURIComponent(_));var C=t+n+r+"?"+b;return!0===p&&console.log("url: "+C+"\n"),C}function p(e,t,n,r){var i,o,s=(i=new Date).getUTCFullYear()+""+h(i.getUTCMonth()+1)+h(i.getUTCDate())+"T"+h(i.getUTCHours())+h(i.getUTCMinutes())+h(i.getUTCSeconds())+"Z",a=(o=s).substring(0,o.indexOf("T")),u="X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential="+t+"%2F"+a+"%2F"+e.region+"%2Fiotdevicegateway%2Faws4_request&X-Amz-Date="+s+"&X-Amz-SignedHeaders=host",f=e.host;return c(e.port)||443===e.port||(f=e.host+":"+e.port),d("GET","wss://",f,"/mqtt",u,0,n,e.region,"iotdevicegateway","",a,s,e.debug,r)}function _(e){var t=e.host;return c(e.port)||443===e.port||(t=e.host+":"+e.port),"wss://"+t+"/mqtt"}function g(e){var t={},n={};return function(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(this,e[n],parseInt(n,10))}(e.split(/\r?\n/),function(e){var r=(e=e.split(/(^|\s)[;#]/)[0]).match(/^\s*\[([^\[\]]+)\]\s*$/);if(r)n=r[1];else if(n){var i=e.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);i&&(t[n]=t[n]||{},t[n][i[1]]=i[2])}}),t}function v(t){if(!(this instanceof v))return new v(t);var r=this,i=[],s=!0,h=0,d="oldest";i.length=0;var m=[];m.length=0;var y=[],E=!0;y.length=0;var b=[];b.length=0;var C,w,T,R,S,I="inactive",N=null,O=250,A=1e3,B=2e4,k=128e3,x=null,D="?SDK=JavaScript&Version="+e("../package.json").version;if(c(t)||0===Object.keys(t).length)throw new Error(a.INVALID_CONNECT_OPTIONS);if(c(t.keepalive)&&(t.keepalive=300),(c(t.enableMetrics)||!0===t.enableMetrics)&&(c(t.username)?t.username=D:t.username+=D),c(t.baseReconnectTimeMs)||(A=t.baseReconnectTimeMs),c(t.minimumConnectionTimeMs)||(B=t.minimumConnectionTimeMs),c(t.maximumReconnectTimeMs)||(k=t.maximumReconnectTimeMs),c(t.drainTimeMs)||(O=t.drainTimeMs),c(t.autoResubscribe)||(E=t.autoResubscribe),c(t.offlineQueueing)||(s=t.offlineQueueing),c(t.offlineQueueMaxSize)||(h=t.offlineQueueMaxSize),c(t.offlineQueueDropBehavior)||(d=t.offlineQueueDropBehavior),C=A,t.reconnectPeriod=C,t.fastDisconnectDetection=!0,t.resubscribe=!1,t.baseReconnectTimeMs<=0)throw new Error(a.INVALID_RECONNECT_TIMING);if(k<A)throw new Error(a.INVALID_RECONNECT_TIMING);if(B<A)throw new Error(a.INVALID_RECONNECT_TIMING);if("newest"!==d&&"oldest"!==d)throw new Error(a.INVALID_OFFLINE_QUEUEING_PARAMETERS);if(h<0)throw new Error(a.INVALID_OFFLINE_QUEUEING_PARAMETERS);if(c(t.protocol)&&(t.protocol="mqtts"),c(t.host))throw new Error(a.INVALID_CONNECT_OPTIONS);if("mqtts"===t.protocol)c(t.port)&&(t.port=8883),u(t);else if("wss"===t.protocol||"wss-custom-auth"===t.protocol){if("wss"===t.protocol){var P;if(w=c(t.accessKeyId)?n.env.AWS_ACCESS_KEY_ID:t.accessKeyId,T=c(t.secretKey)?n.env.AWS_SECRET_ACCESS_KEY:t.secretKey,R=c(t.sessionToken)?n.env.AWS_SESSION_TOKEN:t.sessionToken,c(w)||c(T))try{c(t.filename)?(S=n.env.HOME||n.env.USERPROFILE||(n.env.HOMEPATH?(n.env.HOMEDRIVE||"C:/")+n.env.HOMEPATH:null),P=f.join(S,".aws","credentials")):P=t.filename;var W=t.profile||n.env.AWS_PROFILE||"default",L=g(l.readFileSync(P,"utf-8"))[W];w=L.aws_access_key_id,T=L.aws_secret_access_key,R=L.aws_session_token}catch(e){console.log(e),console.log("Failed to read credentials from "+P)}if(c(w)||c(T))throw console.log("To connect via WebSocket/SigV4, AWS Access Key ID and AWS Secret Key must be passed either in options or as environment variables; see README.md"),new Error(a.INVALID_CONNECT_OPTIONS)}else if(c(t.customAuthHeaders))throw console.log("To authenticate with a custom authorizer, you must provide the required HTTP headers; see README.md"),new Error(a.INVALID_CONNECT_OPTIONS);if(!c(t.host)&&c(t.region)){var M=/[a-zA-Z0-9]+\.iot\.([a-z]+-[a-z]+-[0-9]+)\.amazonaws\..+/.exec(t.host);if(null===M)throw console.log("Host endpoint is not valid"),new Error(a.INVALID_CONNECT_OPTIONS);t.region=M[1]}c(t.port)&&(t.port=443),c(t.websocketOptions)?t.websocketOptions={protocol:"mqttv3.1"}:t.websocketOptions.protocol="mqttv3.1","wss-custom-auth"===t.protocol&&(t.websocketOptions.headers=t.customAuthHeaders)}c(t)||!0!==t.debug||(console.log(t),console.log("attempting new mqtt connection..."));var j={};function U(e,t){0===y.filter(function(t){return t.topic===e}).length&&y.push({topic:e,options:t})}function F(e,t){var n=y.filter(function(t){return t.topic!==e});y=n}function H(e,t,n){var r=null;!1!==E&&("subscribe"===e?r=U:"unsubscribe"===e&&(r=F),"[object Array]"===Object.prototype.toString.call(t)?t.forEach(function(e,t,i){r(e,n)}):r(t,n))}function G(){return"inactive"===I}j.mqtts=e("./lib/tls"),j.wss=e("./lib/ws");var q=new o.MqttClient(function(e){var n,r=t.protocol;return"wss"===r?(n=""===w||""===T?"wss://no-credentials-available":p(t,w,T,R),!0===t.debug&&console.log("using websockets, will connect to '"+n+"'..."),t.url=n):"wss-custom-auth"===r&&(t.url=_(t),!0===t.debug&&console.log("using websockets custom auth, will connect to '"+t.url+"'..."),r="wss"),j[r](e,t)},t);function z(){C=A,q.options.reconnectPeriod=C,x=null,I="stable"}function V(){var e=b.shift();if(c(e)){var t=m.shift();if(c(t)){var n=i.shift();c(n)||q.publish(n.topic,n.message,n.options,n.callback),0===i.length&&(clearInterval(N),N=null)}else H(t.type,t.topics,t.options),"subscribe"===t.type?c(t.callback)?q.subscribe(t.topics,t.options):q.subscribe(t.topics,t.options,t.callback):"unsubscribe"===t.type&&q.unsubscribe(t.topics,t.callback)}else c(e.callback)?q.subscribe(e.topic,e.options):q.subscribe(e.topic,e.options,e.callback)}q.on("connect",function(e){null===x&&(x=setTimeout(z,B)),I="established",null===N&&(b=y.slice(0),N=setInterval(V,O)),r.emit("connect",e)}),q.on("close",function(e){c(e)||r.emit("error",e),c(t)||!0!==t.debug||console.log("connection lost - will attempt reconnection in "+q.options.reconnectPeriod/1e3+" seconds..."),clearTimeout(x),x=null,clearInterval(N),N=null,I="inactive",r.emit("close")}),q.on("reconnect",function(){C*=2,C=Math.min(k,C),q.options.reconnectPeriod=C,r.emit("reconnect")}),q.on("offline",function(){r.emit("offline")}),q.on("error",function(e){r.emit("error",e)}),q.on("packetsend",function(e){r.emit("packetsend",e)}),q.on("packetreceive",function(e){r.emit("packetreceive",e)}),q.on("message",function(e,t,n){r.emit("message",e,t,n)}),this.publish=function(e,t,n,r){var o;!0!==s||!G()&&null===N?!0!==s&&G()||q.publish(e,t,n,r):(o=!0,h>0&&i.length>=h&&("oldest"===d?i.shift():o=!1),o&&i.push({topic:e,message:t,options:n,callback:r}))},this.subscribe=function(e,t,n){G()&&!1!==E?m.length<50?m.push({type:"subscribe",topics:e,options:t,callback:n}):r.emit("error",new Error("Maximum queued offline subscription reached")):(H("subscribe",e,t),c(n)?q.subscribe(e,t):q.subscribe(e,t,n))},this.unsubscribe=function(e,n){G()&&!1!==E?m.length<50&&m.push({type:"unsubscribe",topics:e,options:t,callback:n}):(H("unsubscribe",e),q.unsubscribe(e,n))},this.end=function(e,t){q.end(e,t)},this.handleMessage=q.handleMessage.bind(q),q.handleMessage=function(e,t){r.handleMessage(e,t)},this.updateWebSocketCredentials=function(e,t,n,r){w=e,T=t,R=n},this.getWebsocketHeaders=function(){return t.websocketOptions.headers},this.updateCustomAuthHeaders=function(e){t.websocketOptions.headers=e},this.simulateNetworkFailure=function(){q.stream.emit("error",new Error("simulated connection error")),q.stream.end()}}i(v,r.EventEmitter),t.exports=v,t.exports.DeviceClient=v,t.exports.prepareWebSocketUrl=p,t.exports.prepareWebSocketCustomAuthUrl=_}).call(this,e("_process"))},{"../common/lib/is-undefined":12,"../common/lib/tls-reader":13,"../package.json":18,"./lib/exceptions":15,"./lib/tls":16,"./lib/ws":17,_process:144,"crypto-js":86,events:116,fs:50,mqtt:130,path:142,util:173}],15:[function(e,t,n){
/*
 * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
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."}},{}],16:[function(e,t,n){
/*
 * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
var r=e("tls");t.exports=function(e,t){var n;function i(t){e.emit("error",t),n.end()}return(n=r.connect(t)).on("secureConnect",function(){n.authorized?n.removeListener("error",i):n.emit("error",new Error("TLS not authorized"))}),n.on("error",i),n}},{tls:50}],17:[function(e,t,n){
/*
 * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
const r=e("websocket-stream");t.exports=function(e,t){return r(t.url,["mqttv3.1"],t.websocketOptions)}},{"websocket-stream":184}],18:[function(e,t,n){t.exports={name:"aws-iot-device-sdk",description:"AWS IoT Node.js SDK for Embedded Devices",version:"2.2.1",author:{name:"Amazon Web Services",email:"",url:"http://aws.amazon.com"},homepage:"https://github.com/aws/aws-iot-device-sdk-js",main:"index.js",engines:{node:">=4.0.0"},repository:{type:"git",url:"git://github.com/aws/aws-iot-device-sdk-js"},bugs:{url:"http://github.com/aws/aws-iot-device-sdk-js/issues"},license:"Apache-2.0",keywords:["api","amazon","aws","iot","mqtt"],dependencies:{mqtt:"2.15.1",minimist:"1.2.0","websocket-stream":"^5.0.1","crypto-js":"3.1.6"},devDependencies:{gulp:"^3.9.0","gulp-concat":"^2.6.0","gulp-jscs":"^4.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^3.0.1",jshint:"^2.9.1","jshint-stylish":"^2.2.1","gulp-coverage":"^0.3.38","gulp-beautify":"^2.0.0",sinon:"^1.17.3",rewire:"^2.5.1"},scripts:{test:"node ./node_modules/gulp/bin/gulp.js test --verbose",browserize:"./scripts/browserize.sh",beautify:"node ./node_modules/gulp/bin/gulp.js beautify"}}},{}],19:[function(e,t,n){t.exports=e("./lib/index").default},{"./lib/index":20}],20:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isNetworkError=a,n.isRetryableError=f,n.isSafeRequestError=l,n.isIdempotentRequestError=h,n.isNetworkOrIdempotentRequestError=d,n.exponentialDelay=_,n.default=v;var r,i=e("is-retry-allowed"),o=(r=i)&&r.__esModule?r:{default:r};var s="axios-retry";function a(e){return!e.response&&Boolean(e.code)&&"ECONNABORTED"!==e.code&&(0,o.default)(e)}var c=["get","head","options"],u=c.concat(["put","delete"]);function f(e){return"ECONNABORTED"!==e.code&&(!e.response||e.response.status>=500&&e.response.status<=599)}function l(e){return!!e.config&&(f(e)&&-1!==c.indexOf(e.config.method))}function h(e){return!!e.config&&(f(e)&&-1!==u.indexOf(e.config.method))}function d(e){return a(e)||h(e)}function p(){return 0}function _(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=100*Math.pow(2,e);return t+.2*t*Math.random()}function g(e){var t=e[s]||{};return t.retryCount=t.retryCount||0,e[s]=t,t}function v(e,t){e.interceptors.request.use(function(e){return g(e).lastRequestTime=Date.now(),e}),e.interceptors.response.use(null,function(n){var r=n.config;if(!r)return Promise.reject(n);var i=function(e,t){return Object.assign({},t,e[s])}(r,t),o=i.retries,a=void 0===o?3:o,c=i.retryCondition,u=void 0===c?d:c,f=i.retryDelay,l=void 0===f?p:f,h=i.shouldResetTimeout,_=void 0!==h&&h,v=g(r);if(u(n)&&v.retryCount<a){v.retryCount+=1;var m=l(v.retryCount,n);if(function(e,t){e.defaults.agent===t.agent&&delete t.agent,e.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,e.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}(e,r),!_&&r.timeout&&v.lastRequestTime){var y=Date.now()-v.lastRequestTime;r.timeout=Math.max(r.timeout-y-m,1)}return r.transformRequest=[function(e){return e}],new Promise(function(t){return setTimeout(function(){return t(e(r))},m)})}return Promise.reject(n)})}v.isNetworkError=a,v.isSafeRequestError=l,v.isIdempotentRequestError=h,v.isNetworkOrIdempotentRequestError=d,v.exponentialDelay=_,v.isRetryableError=f},{"is-retry-allowed":120}],21:[function(e,t,n){t.exports=e("./lib/axios")},{"./lib/axios":23}],22:[function(e,t,n){(function(n){"use strict";var r=e("./../utils"),i=e("./../core/settle"),o=e("./../helpers/buildURL"),s=e("./../helpers/parseHeaders"),a=e("./../helpers/isURLSameOrigin"),c=e("../core/createError"),u="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||e("./../helpers/btoa");t.exports=function(t){return new Promise(function(f,l){var h=t.data,d=t.headers;r.isFormData(h)&&delete d["Content-Type"];var p=new XMLHttpRequest,_="onreadystatechange",g=!1;if("test"===n.env.NODE_ENV||"undefined"==typeof window||!window.XDomainRequest||"withCredentials"in p||a(t.url)||(p=new window.XDomainRequest,_="onload",g=!0,p.onprogress=function(){},p.ontimeout=function(){}),t.auth){var v=t.auth.username||"",m=t.auth.password||"";d.Authorization="Basic "+u(v+":"+m)}if(p.open(t.method.toUpperCase(),o(t.url,t.params,t.paramsSerializer),!0),p.timeout=t.timeout,p[_]=function(){if(p&&(4===p.readyState||g)&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var e="getAllResponseHeaders"in p?s(p.getAllResponseHeaders()):null,n={data:t.responseType&&"text"!==t.responseType?p.response:p.responseText,status:1223===p.status?204:p.status,statusText:1223===p.status?"No Content":p.statusText,headers:e,config:t,request:p};i(f,l,n),p=null}},p.onerror=function(){l(c("Network Error",t,null,p)),p=null},p.ontimeout=function(){l(c("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var y=e("./../helpers/cookies"),E=(t.withCredentials||a(t.url))&&t.xsrfCookieName?y.read(t.xsrfCookieName):void 0;E&&(d[t.xsrfHeaderName]=E)}if("setRequestHeader"in p&&r.forEach(d,function(e,t){void 0===h&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)}),t.withCredentials&&(p.withCredentials=!0),t.responseType)try{p.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&p.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(e){p&&(p.abort(),l(e),p=null)}),void 0===h&&(h=null),p.send(h)})}}).call(this,e("_process"))},{"../core/createError":29,"./../core/settle":32,"./../helpers/btoa":36,"./../helpers/buildURL":37,"./../helpers/cookies":39,"./../helpers/isURLSameOrigin":41,"./../helpers/parseHeaders":43,"./../utils":45,_process:144}],23:[function(e,t,n){"use strict";var r=e("./utils"),i=e("./helpers/bind"),o=e("./core/Axios"),s=e("./defaults");function a(e){var t=new o(e),n=i(o.prototype.request,t);return r.extend(n,o.prototype,t),r.extend(n,t),n}var c=a(s);c.Axios=o,c.create=function(e){return a(r.merge(s,e))},c.Cancel=e("./cancel/Cancel"),c.CancelToken=e("./cancel/CancelToken"),c.isCancel=e("./cancel/isCancel"),c.all=function(e){return Promise.all(e)},c.spread=e("./helpers/spread"),t.exports=c,t.exports.default=c},{"./cancel/Cancel":24,"./cancel/CancelToken":25,"./cancel/isCancel":26,"./core/Axios":27,"./defaults":34,"./helpers/bind":35,"./helpers/spread":44,"./utils":45}],24:[function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,t.exports=r},{}],25:[function(e,t,n){"use strict";var r=e("./Cancel");function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new r(e),t(n.reason))})}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i(function(t){e=t}),cancel:e}},t.exports=i},{"./Cancel":24}],26:[function(e,t,n){"use strict";t.exports=function(e){return!(!e||!e.__CANCEL__)}},{}],27:[function(e,t,n){"use strict";var r=e("./../defaults"),i=e("./../utils"),o=e("./InterceptorManager"),s=e("./dispatchRequest");function a(e){this.defaults=e,this.interceptors={request:new o,response:new o}}a.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),(e=i.merge(r,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[s,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},i.forEach(["delete","get","head","options"],function(e){a.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){a.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))}}),t.exports=a},{"./../defaults":34,"./../utils":45,"./InterceptorManager":28,"./dispatchRequest":30}],28:[function(e,t,n){"use strict";var r=e("./../utils");function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,function(t){null!==t&&e(t)})},t.exports=i},{"./../utils":45}],29:[function(e,t,n){"use strict";var r=e("./enhanceError");t.exports=function(e,t,n,i,o){var s=new Error(e);return r(s,t,n,i,o)}},{"./enhanceError":31}],30:[function(e,t,n){"use strict";var r=e("./../utils"),i=e("./transformData"),o=e("../cancel/isCancel"),s=e("../defaults"),a=e("./../helpers/isAbsoluteURL"),c=e("./../helpers/combineURLs");function u(e){e.cancelToken&&e.cancelToken.throwIfRequested()}t.exports=function(e){return u(e),e.baseURL&&!a(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||s.adapter)(e).then(function(t){return u(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},{"../cancel/isCancel":26,"../defaults":34,"./../helpers/combineURLs":38,"./../helpers/isAbsoluteURL":40,"./../utils":45,"./transformData":33}],31:[function(e,t,n){"use strict";t.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e}},{}],32:[function(e,t,n){"use strict";var r=e("./createError");t.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},{"./createError":29}],33:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},{"./../utils":45}],34:[function(e,t,n){(function(n){"use strict";var r=e("./utils"),i=e("./helpers/normalizeHeaderName"),o={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,c={adapter:("undefined"!=typeof XMLHttpRequest?a=e("./adapters/xhr"):void 0!==n&&(a=e("./adapters/http")),a),transformRequest:[function(e,t){return i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)?(s(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(e){c.headers[e]={}}),r.forEach(["post","put","patch"],function(e){c.headers[e]=r.merge(o)}),t.exports=c}).call(this,e("_process"))},{"./adapters/http":22,"./adapters/xhr":22,"./helpers/normalizeHeaderName":42,"./utils":45,_process:144}],35:[function(e,t,n){"use strict";t.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},{}],36:[function(e,t,n){"use strict";var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function i(){this.message="String contains an invalid character"}i.prototype=new Error,i.prototype.code=5,i.prototype.name="InvalidCharacterError",t.exports=function(e){for(var t,n,o=String(e),s="",a=0,c=r;o.charAt(0|a)||(c="=",a%1);s+=c.charAt(63&t>>8-a%1*8)){if((n=o.charCodeAt(a+=.75))>255)throw new i;t=t<<8|n}return s}},{}],37:[function(e,t,n){"use strict";var r=e("./../utils");function i(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(r.isURLSearchParams(t))o=t.toString();else{var s=[];r.forEach(t,function(e,t){null!==e&&void 0!==e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))}))}),o=s.join("&")}return o&&(e+=(-1===e.indexOf("?")?"?":"&")+o),e}},{"./../utils":45}],38:[function(e,t,n){"use strict";t.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},{}],39:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},{"./../utils":45}],40:[function(e,t,n){"use strict";t.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},{}],41:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},{"./../utils":45}],42:[function(e,t,n){"use strict";var r=e("../utils");t.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},{"../utils":45}],43:[function(e,t,n){"use strict";var r=e("./../utils"),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(e){var t,n,o,s={};return e?(r.forEach(e.split("\n"),function(e){if(o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}}),s):s}},{"./../utils":45}],44:[function(e,t,n){"use strict";t.exports=function(e){return function(t){return e.apply(null,t)}}},{}],45:[function(e,t,n){"use strict";var r=e("./helpers/bind"),i=e("is-buffer"),o=Object.prototype.toString;function s(e){return"[object Array]"===o.call(e)}function a(e){return null!==e&&"object"==typeof e}function c(e){return"[object Function]"===o.call(e)}function u(e,t){if(null!==e&&void 0!==e)if("object"!=typeof e&&(e=[e]),s(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}t.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:i,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:c,isStream:function(e){return a(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:u,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,i=arguments.length;r<i;r++)u(arguments[r],n);return t},extend:function(e,t,n){return u(t,function(t,i){e[i]=n&&"function"==typeof t?r(t,n):t}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},{"./helpers/bind":35,"is-buffer":119}],46:[function(e,t,n){"use strict";n.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},n.toByteArray=function(e){for(var t,n=u(e),r=n[0],s=n[1],a=new o(function(e,t,n){return 3*(t+n)/4-n}(0,r,s)),c=0,f=s>0?r-4:r,l=0;l<f;l+=4)t=i[e.charCodeAt(l)]<<18|i[e.charCodeAt(l+1)]<<12|i[e.charCodeAt(l+2)]<<6|i[e.charCodeAt(l+3)],a[c++]=t>>16&255,a[c++]=t>>8&255,a[c++]=255&t;2===s&&(t=i[e.charCodeAt(l)]<<2|i[e.charCodeAt(l+1)]>>4,a[c++]=255&t);1===s&&(t=i[e.charCodeAt(l)]<<10|i[e.charCodeAt(l+1)]<<4|i[e.charCodeAt(l+2)]>>2,a[c++]=t>>8&255,a[c++]=255&t);return a},n.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(f(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function f(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],47:[function(e,t,n){var r=e("readable-stream/duplex"),i=e("util"),o=e("safe-buffer").Buffer;function s(e){if(!(this instanceof s))return new s(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)})}else this.append(e);r.call(this)}i.inherits(s,r),s.prototype._offset=function(e){var t,n=0,r=0;if(0===e)return[0,0];for(;r<this._bufs.length;r++){if(e<(t=n+this._bufs[r].length)||r==this._bufs.length-1)return[r,e-n];n=t}},s.prototype.append=function(e){var t=0;if(o.isBuffer(e))this._appendBuffer(e);else if(Array.isArray(e))for(;t<e.length;t++)this.append(e[t]);else if(e instanceof s)for(;t<e._bufs.length;t++)this.append(e._bufs[t]);else null!=e&&("number"==typeof e&&(e=e.toString()),this._appendBuffer(o.from(e)));return this},s.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},s.prototype._write=function(e,t,n){this._appendBuffer(e),"function"==typeof n&&n()},s.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},s.prototype.end=function(e){r.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},s.prototype.get=function(e){return this.slice(e,e+1)[0]},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,t,n,r){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof r||r>this.length)&&(r=this.length),n>=this.length)return e||o.alloc(0);if(r<=0)return e||o.alloc(0);var i,s,a=!!e,c=this._offset(n),u=r-n,f=u,l=a&&t||0,h=c[1];if(0===n&&r==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:o.concat(this._bufs,this.length);for(s=0;s<this._bufs.length;s++)this._bufs[s].copy(e,l),l+=this._bufs[s].length;return e}if(f<=this._bufs[c[0]].length-h)return a?this._bufs[c[0]].copy(e,t,h,h+f):this._bufs[c[0]].slice(h,h+f);for(a||(e=o.allocUnsafe(u)),s=c[0];s<this._bufs.length;s++){if(!(f>(i=this._bufs[s].length-h))){this._bufs[s].copy(e,l,h,h+f);break}this._bufs[s].copy(e,l,h),l+=i,f-=i,h&&(h=0)}return e},s.prototype.shallowSlice=function(e,t){e=e||0,t=t||this.length,e<0&&(e+=this.length),t<0&&(t+=this.length);var n=this._offset(e),r=this._offset(t),i=this._bufs.slice(n[0],r[0]+1);return 0==r[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,r[1]),0!=n[1]&&(i[0]=i[0].slice(n[1])),new s(i)},s.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},s.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){for(var e=0,t=new s;e<this._bufs.length;e++)t.append(this._bufs[e]);return t},s.prototype.destroy=function(){this._bufs.length=0,this.length=0,this.push(null)},function(){var e={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 t in e)!function(t){s.prototype[t]=function(n){return this.slice(n,n+e[t])[t](0)}}(t)}(),t.exports=s},{"readable-stream/duplex":150,"safe-buffer":48,util:173}],48:[function(e,t,n){var r=e("buffer"),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,n),n.Buffer=s),o(i,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},{buffer:51}],49:[function(e,t,n){},{}],50:[function(e,t,n){arguments[4][49][0].apply(n,arguments)},{dup:49}],51:[function(e,t,n){
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
"use strict";var r=e("base64-js"),i=e("ieee754");n.Buffer=a,n.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},n.INSPECT_MAX_BYTES=50;var o=2147483647;function s(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=a.prototype,t}function a(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return c(e,t,n)}function c(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|d(e,t),r=s(n),i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(U(e,ArrayBuffer)||e&&U(e.buffer,ArrayBuffer))return function(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n);return r.__proto__=a.prototype,r}(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return a.from(r,t,n);var i=function(e){if(a.isBuffer(e)){var t=0|h(e.length),n=s(t);return 0===n.length?n:(e.copy(n,0,0,t),n)}if(void 0!==e.length)return"number"!=typeof e.length||F(e.length)?s(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return u(e),s(e<0?0:0|h(e))}function l(e){for(var t=e.length<0?0:0|h(e.length),n=s(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function d(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||U(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return L(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return M(e).length;default:if(i)return r?-1:L(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),F(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:g(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):g(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,n,r,i){var o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var f=-1;for(o=n;o<a;o++)if(u(e,o)===u(t,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===c)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var l=!0,h=0;h<c;h++)if(u(e,o+h)!==u(t,h)){l=!1;break}if(l)return o}return-1}function v(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(F(a))return s;e[n+s]=a}return s}function m(e,t,n,r){return j(L(t,e.length-n),e,n,r)}function y(e,t,n,r){return j(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function E(e,t,n,r){return y(e,t,n,r)}function b(e,t,n,r){return j(M(t),e,n,r)}function C(e,t,n,r){return j(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function w(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,c,u=e[i],f=null,l=u>239?4:u>223?3:u>191?2:1;if(i+l<=n)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,l=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),i+=l}return function(e){var t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=R));return n}(r)}n.kMaxLength=o,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(e,t,n){return c(e,t,n)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(e,t,n){return function(e,t,n){return u(e),e<=0?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)}(e,t,n)},a.allocUnsafe=function(e){return f(e)},a.allocUnsafeSlow=function(e){return f(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(U(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),U(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=a.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(U(o,Uint8Array)&&(o=a.from(o)),!a.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},a.byteLength=d,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)p(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)p(this,t,t+3),p(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)p(this,t,t+7),p(this,t+1,t+6),p(this,t+2,t+5),p(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):function(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return S(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return w(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},a.prototype.compare=function(e,t,n,r,i){if(U(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,c=Math.min(o,s),u=this.slice(r,i),f=e.slice(t,n),l=0;l<c;++l)if(u[l]!==f[l]){o=u[l],s=f[l];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},a.prototype.indexOf=function(e,t,n){return _(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return _(this,e,t,n,!1)},a.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return m(this,e,t,n);case"ascii":return y(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return b(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function S(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function I(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function N(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=W(e[o]);return i}function O(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function A(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function k(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function x(e,t,n,r,o){return t=+t,n>>>=0,o||k(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function D(e,t,n,r,o){return t=+t,n>>>=0,o||k(e,0,n,8),i.write(e,t,n,r,52,8),n+8}a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return r.__proto__=a.prototype,r},a.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},a.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||B(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},a.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||B(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);B(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);B(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,n){return x(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return x(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,r);else if(this===e&&n<t&&t<r)for(var o=i-1;o>=0;--o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),t);return i},a.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){var i=e.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(e=i)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=a.isBuffer(e)?e:a.from(e,r),c=s.length;if(0===c)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=s[o%c]}return this};var P=/[^+/0-9A-Za-z-_]/g;function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function L(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function M(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function U(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}},{"base64-js":46,ieee754:117}],52:[function(e,t,n){"use strict";t.exports={DATA_CHANNEL_SEND_REQUEST_TIMEOUT:6e4,DATA_CHANNEL_OPEN_TIMEOUT:3e4,WAIT_FOR_NEW_ICE_CANDIDATES_DELAY:500,DEFAULT_API_CHANNEL_NAME:"api"}},{}],53:[function(e,t,n){t.exports={WEBRTC_CLOSED:"WEBRTC_CLOSED",WEBRTC_CONNECTED:"WEBRTC_CONNECTED",WEBRTC_CONNECTION_ERROR:"WEBRTC_CONNECTION_ERROR",WEBRTC_CREATE_ANSWER:"WEBRTC_CREATE_ANSWER",WEBRTC_CREATE_ANSWER_ERROR:"WEBRTC_CREATE_ANSWER_ERROR",WEBRTC_CREATE_OFFER:"WEBRTC_CREATE_OFFER",WEBRTC_CREATE_OFFER_ERROR:"WEBRTC_CREATE_OFFER_ERROR",WEBRTC_DATA_CHANNELS_OPEN:"WEBRTC_DATA_CHANNELS_OPEN",WEBRTC_DEVICE_OFFLINE:"WEBRTC_DEVICE_OFFLINE",WEBRTC_DISCONNECTED:"WEBRTC_DISCONNECTED",WEBRTC_INITIALIZED:"WEBRTC_INITIALIZED",WEBRTC_RECONNECTING:"WEBRTC_RECONNECTING",WEBRTC_RETRY_CONNECTION:"WEBRTC_RETRY_CONNECTION",WEBRTC_SDP_RECEIVED:"WEBRTC_SDP_RECEIVED",WEBRTC_SDP_RECEIVING_ERROR:"WEBRTC_SDP_RECEIVING_ERROR",WEBRTC_SDP_REQUESTING:"WEBRTC_SDP_REQUESTING",WEBRTC_SDP_SENDING:"WEBRTC_SDP_SENDING",WEBRTC_SDP_SENDING_ERROR:"WEBRTC_SDP_SENDING_ERROR",WEBRTC_SDP_SENT:"WEBRTC_SDP_SENT",WEBRTC_SET_LOCAL_DESCRIPTION:"WEBRTC_SET_LOCAL_DESCRIPTION",WEBRTC_SET_LOCAL_DESCRIPTION_ERROR:"WEBRTC_SET_LOCAL_DESCRIPTION_ERROR",WEBRTC_SET_REMOTE_DESCRIPTION:"WEBRTC_SET_REMOTE_DESCRIPTION",WEBRTC_SET_REMOTE_DESCRIPTION_ERROR:"WEBRTC_SET_REMOTE_DESCRIPTION_ERROR",WEBRTC_WS_CLOSED:"WEBRTC_WS_CLOSED",WEBRTC_WS_CONNECTED:"WEBRTC_WS_CONNECTED",WEBRTC_WS_OPENING:"WEBRTC_WS_OPENING",WEBRTC_WS_OPENING_ERROR:"WEBRTC_WS_OPENING_ERROR",WEBRTC_CREATING_API_GATEWAY_CLIENT:"WEBRTC_CREATING_API_GATEWAY_CLIENT",WEBRTC_AWS_CLOSED:"WEBRTC_AWS_CLOSED",WEBRTC_AWS_CONNECTED:"WEBRTC_AWS_CONNECTED",WEBRTC_AWS_OPENING:"WEBRTC_AWS_OPENING",WEBRTC_AWS_OPENING_ERROR:"WEBRTC_AWS_OPENING_ERROR",WEBRTC_AWS_IOT_CONNECTING:"WEBRTC_AWS_IOT_CONNECTING"}},{}],54:[function(e,t,n){t.exports={WEBRTC_API_CHANNEL_CONFLICT:"WEBRTC_API_CHANNEL_CONFLICT",WEBRTC_DATA_CHANNEL_CLOSE:"WEBRTC_DATA_CHANNEL_CLOSE",WEBRTC_DATA_CHANNEL_ERROR:"WEBRTC_DATA_CHANNEL_ERROR",WEBRTC_DATA_CHANNEL_NOT_AVAILABLE:"WEBRTC_DATA_CHANNEL_NOT_AVAILABLE",WEBRTC_DATA_CHANNEL_OPENING:"WEBRTC_DATA_CHANNEL_OPENING",WEBRTC_DATA_CHANNEL_READY:"WEBRTC_DATA_CHANNEL_READY",WEBRTC_DATA_CHANNEL_SEND_REQUEST_TIMEOUT:"WEBRTC_DATA_CHANNEL_SEND_REQUEST_TIMEOUT",WEBRTC_DATA_CHANNEL_SEND_REQUEST_ERROR:"WEBRTC_DATA_CHANNEL_SEND_REQUEST_ERROR",WEBRTC_DATA_CHANNEL_TIMEOUT:"WEBRTC_DATA_CHANNEL_TIMEOUT",WEBRTC_HTTPS_RESPONSE_ERROR:"WEBRTC_HTTPS_RESPONSE_ERROR",WEBRTC_HTTPS_SENDING:"WEBRTC_HTTPS_SENDING",WEBRTC_HTTPS_SEND_ERROR:"WEBRTC_HTTPS_SEND_ERROR",WEBRTC_ICE_CANDIDATE:"WEBRTC_ICE_CANDIDATE",WEBRTC_ICE_CANDIDATE_SEND_UNSUPPORTED:"WEBRTC_ICE_CANDIDATE_SEND_UNSUPPORTED",WEBRTC_ICE_CANDIDATE_SENDING:"WEBRTC_ICE_CANDIDATE_SENDING",WEBRTC_ICE_CANDIDATES_GATHERED:"WEBRTC_ICE_CANDIDATES_GATHERED",WEBRTC_ICE_CONNECTION_STATE:"WEBRTC_ICE_CONNECTION_STATE",WEBRTC_ICE_CONNECTION_STATE_ERROR:"WEBRTC_ICE_CONNECTION_STATE_ERROR",WEBRTC_ICE_GATHERING_STATE:"WEBRTC_ICE_GATHERING_STATE",WEBRTC_NEGOTIATION_NEEDED:"WEBRTC_NEGOTIATION_NEEDED",WEBRTC_NOT_CONNECTED:"WEBRTC_NOT_CONNECTED",WEBRTC_NOT_INITIALIZED:"WEBRTC_NOT_INITIALIZED",WEBRTC_TURN_CREDENTIALS:"WEBRTC_TURN_CREDENTIALS",WEBRTC_WS_ACTION_TIMEOUT:"WEBRTC_WS_ACTION_TIMEOUT",WEBRTC_WS_SENDING:"WEBRTC_WS_SENDING",WEBRTC_CLOSED:"WEBRTC_CLOSED",WEBRTC_AWS_SENDING:"WEBRTC_AWS_SENDING",WEBRTC_AWS_ACTION_TIMEOUT:"WEBRTC_AWS_ACTION_TIMEOUT",WEBRTC_AWS_SUBSCRIBE_ERROR:"WEBRTC_AWS_SUBSCRIBE_ERROR",WEBRTC_DATA_BEGINNING:"WEBRTC_DATA_BEGINNING",WEBRTC_DATA_BUFFER_WRITE:"WEBRTC_DATA_BUFFER_WRITE",WEBRTC_DATA_EVENT:"WEBRTC_DATA_EVENT",WEBRTC_DATA_EVENT_PROCESS:"WEBRTC_DATA_EVENT_PROCESS",WEBRTC_DATA_RECEIVED:"WEBRTC_DATA_RECEIVED",WEBRTC_DATA_RECEIVE_ERROR:"WEBRTC_DATA_RECEIVE_ERROR",WEBRTC_DATA_RECEIVED_API_RESPONSE:"WEBRTC_DATA_RECEIVED_API_RESPONSE",WEBRTC_DATA_RECEIVED_MESSAGE:"WEBRTC_DATA_RECEIVED_MESSAGE",WEBRTC_DATA_SENDING:"WEBRTC_DATA_SENDING",WEBRTC_DATA_SENDING_API_REQUEST:"WEBRTC_DATA_SENDING_API_REQUEST",WEBRTC_DATA_NO_PENDING_PROMISE_OR_ONMESSAGE_CALLBACK:"WEBRTC_DATA_NO_PENDING_PROMISE_OR_ONMESSAGE_CALLBACK"}},{}],55:[function(e,t,n){"use strict";t.exports={REQUEST_TIMEOUT:6e4,PING_INTERVAL:45e3,PONG_TIMEOUT:2e4}},{}],56:[function(e,t,n){"use strict";t.exports={convert:function(e){for(var t=new DataView(e),n=new Uint8Array(e.byteLength),r=n.length,i=0;i<r;i++)n[i]=t.getUint8(i);return n}}},{}],57:[function(e,t,n){"use strict";t.exports={convert:function(e){for(var t=0,n=0;n<e.length;n++)t+=Math.pow(256,e.length-n-1)*e[n];return t}}},{}],58:[function(e,t,n){"use strict";t.exports={convert:function e(t){if(!function(e){return null!==e&&"object"==typeof e}(t))return null===t?"":t.toString();var n,r,i,o,s,a,c="";for(n in t)if(t.hasOwnProperty(n))if((r=t[n])instanceof Array)for(a in r)r.hasOwnProperty(a)&&(o=r[a],(s={})[n+"["+a+"]"]=o,c+=e(s)+"&");else if(r instanceof Object)for(i in r)r.hasOwnProperty(i)&&(o=r[i],(s={})[n+"["+i+"]"]=o,c+=e(s)+"&");else void 0!==r&&null!==r&&(c+=encodeURIComponent(n)+"="+encodeURIComponent(r)+"&");return c.length?c.substr(0,c.length-1):c}}},{}],59:[function(e,t,n){"use strict";t.exports={convert:function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}}},{}],60:[function(e,t,n){"use strict";t.exports={convert:function(e){return(new TextDecoder).decode(e)}}},{}],61:[function(e,t,n){"use strict";t.exports={convert:function(e,t){for(var n=new ArrayBuffer(t),r=new Uint8Array(n),i=e,o=t-1;o>=0;--o){r[o]=255&i;for(var s=0;s<8;++s)i/=2}return r}}},{}],62:[function(e,t,n){"use strict";t.exports=function(){if("undefined"!=typeof Promise&&Promise.defer)return Promise.defer();this.resolve=null,this.reject=null,this.promise=new Promise(function(e,t){this.resolve=e,this.reject=t}.bind(this)),Object.freeze(this)}},{}],63:[function(e,t,n){"use strict";t.exports=function(e,t){e.forEach(function(e){if(void 0===t[e]){var n="Option `"+e+"` is required.";throw console.error(n),new Error(n)}})}},{}],64:[function(e,t,n){"use strict";t.exports={uuid:function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)}}},{}],65:[function(e,t,n){"use strict";t.exports={factory:function(){var t=e("./SignallingChannelAWSConnector"),n=e("./SignallingChannelWsConnector"),r=e("./SignallingChannelHttpsConnector");function i(e){this.config=e,this.connector=null}return i.connectorFactory=function(e){switch(e.type){case"WS":return new n(e);case"HTTPS":return new r(e);case"AWS":return new t(e);default:var i="Unknown connector type: "+e.type;throw console.error(i),new Error(i)}},i.prototype.open=function(e){return this.connector||(this.connector=i.connectorFactory(this.config)),this.connector.connect(e)},i.prototype.close=function(){this.connector.close()},i.prototype.requestSdpOffer=function(e){return this.sendActionRequest("sdp_exchange",{device_id:e.deviceId,payload:{password:e.turnCredentials.credential,stunUri:e.stunUri,ttl:e.turnCredentials.ttl,turnUri:e.turnUri,type:"OFFER",username:e.turnCredentials.username}})},i.prototype.sendSdpOffer=function(e){return this.sendActionRequest("sdp_exchange",{device_id:e.deviceId,payload:{password:e.turnCredentials.credential,sdpOffer:e.sdp,stunUri:e.stunUri,ttl:e.turnCredentials.ttl,turnUri:e.turnUri,type:"OFFER",username:e.turnCredentials.username}})},i.prototype.sendSdpAnswer=function(e){return this.sendActionRequest("sdp_exchange",{device_id:e.deviceId,payload:{sdpAnswer:e.sdp,type:"ANSWER",webRtcId:e.webRtcId}})},i.prototype.sendActionRequest=function(e,t){return this.connector.sendActionRequest(e,t)},i.prototype.sendIceCandidate=function(e,t){throw console.error("Not implemented yet."),new Error("Not implemented yet.")},i.prototype.closeSession=function(e){this.connector.close()},i}}},{"./SignallingChannelAWSConnector":66,"./SignallingChannelHttpsConnector":67,"./SignallingChannelWsConnector":68}],66:[function(e,t,n){"use strict";var r=e("../deferred"),i=e("../../constants/webrtcEvents"),o=e("../../constants/webrtcMessages"),s=e("../../constants/ws"),a=e("../../service/provider"),c=a.get("eventBusService"),u=a.get("loggerService"),f=e("../uuidGenerator"),l=e("aws-iot-device-sdk/device"),h=e("aws-api-gateway-client").default,d=function(){this.pendingRequests={},this.init()};d.prototype.init=function(){this.apigClient=null,this.awsIotClient=null,this.identityId=null,this.credentials=null,this.connectivityDetails=null},d.prototype.makeSureIsConnected=function(){return this.awsIotClient||this.close(),this.connect()},d.prototype.connect=function(e){return this.awsIotClient?window.Promise.resolve(this):(c.emit(i.WEBRTC_AWS_OPENING),u.info(i.WEBRTC_AWS_OPENING),this.configure(e),this.createApiGatewayClient(),this.mqttConnect())},d.prototype.configure=function(e){this.connectivityDetails=e.connectivityDetails,this.identityId=e.credentials.identityId,this.credentials={AccessKeyId:e.credentials.accessKeyId,SecretAccessKey:e.credentials.secretKey,SessionToken:e.credentials.sessionToken}},d.prototype.createApiGatewayClient=function(){c.emit(i.WEBRTC_CREATING_API_GATEWAY_CLIENT),u.info(i.WEBRTC_CREATING_API_GATEWAY_CLIENT),this.apigClient=h.newClient({accessKey:this.credentials.AccessKeyId,secretKey:this.credentials.SecretAccessKey,sessionToken:this.credentials.SessionToken,region:this.connectivityDetails.unifiCloudAccess.region,invokeUrl:this.connectivityDetails.unifiCloudAccess.apiGateway.url})},d.prototype.mqttConnect=function(){var e=new r;return c.emit(i.WEBRTC_AWS_IOT_CONNECTING),u.info(i.WEBRTC_AWS_IOT_CONNECTING),this.awsIotClient=l({region:this.connectivityDetails.unifiCloudAccess.region,host:this.connectivityDetails.unifiCloudAccess.iot.host,protocol:"wss",accessKeyId:this.credentials.AccessKeyId,secretKey:this.credentials.SecretAccessKey,sessionToken:this.credentials.SessionToken}),this.awsIotClient.on("connect",function(){c.emit(i.WEBRTC_AWS_CONNECTED,this.connectivityDetails.unifiCloudAccess.iot.host),u.info(i.WEBRTC_AWS_CONNECTED,this.connectivityDetails.unifiCloudAccess.iot.host),e.resolve(this)}.bind(this)),this.awsIotClient.on("close",function(){c.emit(i.WEBRTC_AWS_CLOSED),u.info(i.WEBRTC_AWS_CLOSED),this.close()}.bind(this)),this.awsIotClient.on("error",function(t){c.emit(i.WEBRTC_AWS_OPENING_ERROR,t),u.error(i.WEBRTC_AWS_OPENING_ERROR,t),e.reject(i.WEBRTC_AWS_OPENING_ERROR),this.close()}.bind(this)),this.awsIotClient.on("offline",function(t){c.emit(i.WEBRTC_AWS_OPENING_ERROR,t),u.error(i.WEBRTC_AWS_OPENING_ERROR,t),e.reject(i.WEBRTC_AWS_OPENING_ERROR),this.close()}.bind(this)),this.awsIotClient.on("message",this.onMessage.bind(this)),e.promise},d.prototype.send=function(e){return this.makeSureIsConnected().then(function(){var t="client/"+this.identityId+"/"+e.deviceId;return this.awsIotClient.subscribe(t,{},function(e){e&&u.warn(o.WEBRTC_AWS_SUBSCRIBE_ERROR,e)}),u.debug(o.WEBRTC_AWS_SENDING,e),this.apigClient.invokeApi({},"/post-message","POST",{},e)}.bind(this))},d.prototype.sendAction=function(e,t,n){var i=f.uuid(),a=new r,c=Object.assign({cmd:e,deviceId:t.device_id,requestId:i},t);return this.pendingRequests[i]={requiresResponse:n,deferred:a,timeout:setTimeout(function(){u.warn(o.WEBRTC_AWS_ACTION_TIMEOUT,c),a.reject(o.WEBRTC_AWS_ACTION_TIMEOUT)}.bind(this),s.REQUEST_TIMEOUT)},this.send(c).then(function(){return a.promise})},d.prototype.sendActionRequest=function(e,t){return this.sendAction(e,t,!0)},d.prototype.onMessage=function(e,t){var n=new TextDecoder("utf-8").decode(t),r=JSON.parse(n),i=r.requestId,o=this.pendingRequests[i];o&&(clearTimeout(o.timeout),o.deferred.resolve(r),delete this.pendingRequests[i])},d.prototype.close=function(){this.awsIotClient&&(this.awsIotClient.end(),this.awsIotClient=null)},t.exports=d},{"../../constants/webrtcEvents":53,"../../constants/webrtcMessages":54,"../../constants/ws":55,"../../service/provider":75,"../deferred":62,"../uuidGenerator":64,"aws-api-gateway-client":1,"aws-iot-device-sdk/device":14}],67:[function(e,t,n){"use strict";var r=e("../deferred"),i=e("../../constants/webrtcMessages"),o=e("../../service/provider").get("loggerService"),s=e("../utils/checkRequiredOptions"),a=function(e){s(a.REQUIRED_CONFIG_OPTIONS,e),this.uri=e.host+e.endpoint};a.REQUIRED_CONFIG_OPTIONS=["host","endpoint"],a.prototype.connect=function(){return window.Promise.resolve(this)},a.prototype.close=function(){},a.prototype.send=function(e){o.debug(i.WEBRTC_HTTPS_SENDING,e);var t=new r,n=new XMLHttpRequest;return n.addEventListener("load",function(e){try{var n=JSON.parse(e.currentTarget.response);n.error?t.reject(n.error):t.resolve(n)}catch(e){o.warn(i.WEBRTC_HTTPS_RESPONSE_ERROR,e),t.reject(i.WEBRTC_HTTPS_RESPONSE_ERROR)}},!1),n.addEventListener("error",function(e,n,r){o.error(i.WEBRTC_HTTPS_SEND_ERROR,r),t.reject(i.WEBRTC_HTTPS_SEND_ERROR)},!1),n.open("POST",this.uri),n.withCredentials=!0,n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify(e)),t.promise},a.prototype.sendActionRequest=function(e,t){var n=Object.assign({action:e},t);return this.send(n)},t.exports=a},{"../../constants/webrtcMessages":54,"../../service/provider":75,"../deferred":62,"../utils/checkRequiredOptions":63}],68:[function(e,t,n){"use strict";var r=e("../deferred"),i=e("../../constants/webrtcEvents"),o=e("../../constants/webrtcMessages"),s=e("../../constants/ws"),a=e("../../service/provider"),c=a.get("eventBusService"),u=a.get("loggerService"),f=e("../utils/checkRequiredOptions"),l=e("../uuidGenerator"),h=function(e){f(h.REQUIRED_CONFIG_OPTIONS,e),this.actions={},this.uri=e.host+e.endpoint,this.pingTimer=null,this.pongTimer=null,this.ws=null};h.REQUIRED_CONFIG_OPTIONS=["host","endpoint"],h.prototype.makeSureIsConnected=function(){return this.ws&&-1!==[this.ws.CLOSING,this.ws.CLOSED].indexOf(this.ws.readyState)&&this.close(),this.connect()},h.prototype.connect=function(){if(this.ws)return window.Promise.resolve(this);var e=new r;return c.emit(i.WEBRTC_WS_OPENING,this.uri),u.info(i.WEBRTC_WS_OPENING,this.uri),this.ws=new WebSocket(this.uri),this.ws.onmessage=this.onMessage.bind(this),this.ws.onopen=function(){c.emit(i.WEBRTC_WS_CONNECTED,this.uri),u.info(i.WEBRTC_WS_CONNECTED,this.uri),setTimeout(this.ping.bind(this),s.PING_INTERVAL),e.resolve(this)}.bind(this),this.ws.onclose=function(){c.emit(i.WEBRTC_WS_CLOSED),u.info(i.WEBRTC_WS_CLOSED),this.close()}.bind(this),this.ws.onerror=function(t){c.emit(i.WEBRTC_WS_OPENING_ERROR,t),u.error(i.WEBRTC_WS_OPENING_ERROR,t),e.reject(i.WEBRTC_WS_OPENING_ERROR),this.close()}.bind(this),e.promise},h.prototype.close=function(){this.ws&&(this.ws.close(),this.ws=null),clearTimeout(this.pongTimer),clearTimeout(this.pingTimer)},h.prototype.send=function(e){return this.makeSureIsConnected().then(function(){return u.debug(o.WEBRTC_WS_SENDING,e),this.ws.send(JSON.stringify(e)),!0}.bind(this))},h.prototype.sendAction=function(e,t,n){var i=l.uuid(),a=new r,c={message:"action:request",action:e,action_id:i,args:t};return this.actions[i]={requiresResponse:n,deferred:a,timeout:setTimeout(function(){u.warn(o.WEBRTC_WS_ACTION_TIMEOUT,c),a.reject(o.WEBRTC_WS_ACTION_TIMEOUT)}.bind(this),s.REQUEST_TIMEOUT)},this.send(c).then(function(){return a.promise})},h.prototype.sendActionRequest=function(e,t){return this.sendAction(e,t,!0)},h.prototype.ping=function(){this.makeSureIsConnected().then(function(){this.ws.send("ping"),this.pongTimer=setTimeout(this.makeSureIsConnected.bind(this),s.PONG_TIMEOUT)}.bind(this))},h.prototype.onActionMessage=function(e){var t=this.actions[e.action_id];"action:response"!==e.message&&"action:validation"!==e.message&&"action:error"!==e.message&&this.actions[e.action_id].requiresResponse||("action:response"===e.message?(delete this.actions[e.action_id],clearTimeout(t.timeout),t.deferred.resolve(e.response)):"action:validation"===e.message?e.errors&&(delete this.actions[e.action_id],clearTimeout(t.timeout),t.deferred.reject(e.errors)):"action:error"===e.message?(delete this.actions[e.action_id],clearTimeout(t.timeout),t.deferred.reject(e.error)):(delete this.actions[e.action_id],clearTimeout(t.timeout),t.deferred.resolve()))},h.prototype.onMessage=function(e){var t;if("pong"===e.data)return clearTimeout(this.pongTimer),void(this.pingTimer=setTimeout(this.ping.bind(this),s.PING_INTERVAL));(t=JSON.parse(e.data)).message&&this.actions[t.action_id]&&this.onActionMessage(t)},t.exports=h},{"../../constants/webrtcEvents":53,"../../constants/webrtcMessages":54,"../../constants/ws":55,"../../service/provider":75,"../deferred":62,"../utils/checkRequiredOptions":63,"../uuidGenerator":64}],69:[function(e,t,n){"use strict";var r=e("../deferred"),i=e("../../service/provider"),o=i.get("timeoutService"),s=i.get("loggerService"),a=e("../../constants/webrtc"),c=e("../../constants/webrtcMessages"),u=65450;u-=u%3;var f=e("../converters/arrayBufferToUint8Array"),l=e("../converters/byteArrayToValue"),h=e("../converters/params"),d=e("../converters/stringToUTF8Array"),p=e("../converters/uint8ArrayToBinary"),_=e("../converters/valueToUint8Array");function g(e,t){if(void 0===e)throw new Error("RTCDataChannel cannot be undefined.");this.channelLabel=e.label+"_"+e.id,this.rtcDataChannel=e,this.parser=t,this.pendingRequests={},this.WEBRTC_MESSAGE_ID=1,this._messageOffset=0,this._messageSize=0,this._messageBuffer=null,this.onmessageCallback=null,this.oncloseCallback=null,this.promiseQueue=[],this.deferredCloseChannel=null,this.init()}g.prototype.init=function(){this.rtcDataChannel.onmessage=this.handleChannelMessage.bind(this),this.rtcDataChannel.onclose=this.handleChannelClose.bind(this)},g.prototype.close=function(){return this.deferredCloseChannel=new r,"closed"!==this.rtcDataChannel.readyState&&this.rtcDataChannel.close(),this.deferredCloseChannel.promise},g.prototype.handleChannelMessage=function(e){this.scheduleMessageHandling(this.handleMessageChain.bind(this,e))},g.prototype.scheduleMessageHandling=function(e){var t=this.promiseQueue[this.promiseQueue.length-1];t||(t=window.Promise.resolve());var n=t.then(function(){return e()}).then(function(){this.promiseQueue.shift()}.bind(this));return this.promiseQueue.push(n),n},g.prototype.handleMessageChain=function(e){var t=e.target.label+"_"+e.target.id,n=new r;return this.convertEventToData(e).then(function(e){this.parser?this.customHandleChannelMessageData(t,e):this.handleChannelMessageData(t,e)}.bind(this)).then(function(){n.resolve()}),n.promise},g.prototype.customHandleChannelMessageData=function(e,t){var n=this.parser(e,t);this.onmessageCallback&&this.onmessageCallback(n)},g.prototype.handleChannelClose=function(e){s.debug(c.WEBRTC_DATA_CHANNEL_CLOSE,"channel:"+this.channelLabel,e),Object.keys(this.pendingRequests).forEach(function(e){this.pendingRequests[e].reject(c.WEBRTC_DATA_CHANNEL_SEND_REQUEST_ERROR)}.bind(this)),this.onmessageCallback=null,this.oncloseCallback&&(this.oncloseCallback(e),this.oncloseCallback=null),this.deferredCloseChannel&&this.deferredCloseChannel.resolve(c.WEBRTC_DATA_CHANNEL_CLOSE,"channel:"+this.channelLabel,e)},g.prototype.convertEventToData=function(e){var t=new r;if(e.data instanceof Blob){var n=new FileReader;n.onload=function(){t.resolve(this.result)},n.onerror=function(e){t.reject(e)},n.readAsArrayBuffer(e.data)}else t.resolve(e.data);return t.promise},g.prototype.handleChannelMessageData=function(e,t){var n=t.byteLength?t.byteLength:t.size||0,r=0;for(s.debug(c.WEBRTC_DATA_EVENT,"channel:"+this.channelLabel,"event size: "+n);r<n;){s.debug(c.WEBRTC_DATA_EVENT_PROCESS,"channel:"+this.channelLabel,"event data offset: "+r,"event data size: "+n),this._messageBuffer||(this._messageSize=l.convert(new Uint8Array(t,0,4)),this._messageOffset=0,this._messageBuffer=new Uint8Array(this._messageSize),r+=4);var i=Math.min(this._messageSize-this._messageOffset,n-r),o=new Uint8Array(t,r,i);try{if(s.debug(c.WEBRTC_DATA_BUFFER_WRITE,"channel:"+this.channelLabel,"message size: "+this._messageSize,"message offset: "+this._messageOffset,"message chunk size: "+i,"buffer capacity: "+this._messageBuffer.byteLength),this._messageBuffer.set(o,this._messageOffset),this._messageOffset+=i,r+=i,s.debug(c.WEBRTC_DATA_RECEIVED,"channel:"+this.channelLabel,"message size: "+this._messageSize,"message received: "+this._messageSize,"message left: "+(this._messageSize-this._messageOffset)),this._messageOffset>=this._messageSize)this.handleWebRtcResponse(this._messageBuffer),this._messageBuffer=null;else{var a=this.parseWebRtcResponseId(this._messageBuffer);this.setRequestTimeout(this.pendingRequests[a])}}catch(e){this._messageBuffer=null,this.close();break}}},g.prototype.setRequestTimeout=function(e){e&&(e.timeout&&o.cancel(e.timeout),e.timeout=o(function(){s.error(c.WEBRTC_DATA_CHANNEL_SEND_REQUEST_TIMEOUT,"messageId:"+e.id,"channel:"+this.channelLabel),e.reject(c.WEBRTC_DATA_CHANNEL_SEND_REQUEST_TIMEOUT),this.close()}.bind(this),e.timeoutParam||a.DATA_CHANNEL_SEND_REQUEST_TIMEOUT))},g.prototype.sendBinaryApiRequest=function(e,t,n,r){var i,a,l,h,p,g,v,m,y=JSON.stringify(t),E=y.length,b=0,C=u;!n||n instanceof ArrayBuffer||"string"==typeof n||(n=JSON.stringify(n)),l=typeof n,r||"string"!==l||(n=Array.from(n||"").reduce(function(e,t){return e.concat(d.convert(t))},[])),r&&(n=atob(n.slice(n.indexOf(",")+1))),a=n?n.length||n.byteLength:0;var w=function(){var t=this.pendingRequests[e];for(this.setRequestTimeout(t),v=n?n.slice(b,b+C):null,m=v?v.length||v.byteLength:0,h=12+E+a,p=new ArrayBuffer(4+(12+E+m)),(g=new Uint8Array(p)).set(_.convert(h,4),0),g.set(_.convert(e,8),4),g.set(_.convert(E,4),12),i=0;i<E;i++)g[i+16]=y.charCodeAt(i);if(v)if(r)for(i=0;i<a;i++)g[i+16+E]=v.charCodeAt(i);else if("string"===l)for(i=0;i<a;i++)g[i+16+E]=v[i];else g.set(f.convert(v),16+E);s.debug(c.WEBRTC_DATA_SENDING,"messageId:"+e,"channel:"+this.channelLabel,"bytes to send "+h),this.send(p),a-=m,b+=m,T()}.bind(this),T=function(e){(e||a>0)&&o(w,15)}.bind(this);T(!0)},g.prototype.send=function(e){return this.rtcDataChannel.send(e),window.Promise.resolve()},g.prototype.sendApiRequest=function(e,t){var n=Object.assign({},t);e.startsWith("/upload")&&(n.data=null,delete n.data);var i,o=this.WEBRTC_MESSAGE_ID++,a=new r,u=(t=t||{}).type||t.method;i={path:e,method:u?u.toUpperCase():"GET",contentType:t.contentType};var f=function(r){this.pendingRequests[o]={id:o,resolve:a.resolve,reject:a.reject,success:t.success,error:t.error,timeoutParam:t.timeout,headers:i},i["Accept-Encoding"]="gzip",s.debug(c.WEBRTC_DATA_SENDING_API_REQUEST,this.channelLabel,o,i.method,e,"length: "+(r&&r.length?r.length:0),n),this.sendBinaryApiRequest(o,i,r,t.convertToBinary)}.bind(this);switch(i.method){case"GET":case"DELETE":var l=e.split("?");l.length>1?(i.path=l[0],i.queryString=l[1]):t.data&&(i.queryString=h.convert(t.data)),f();break;default:if(t.data&&f(t.data),t.file){var d=new FileReader;d.readAsArrayBuffer(t.file),d.onload=function(){f(d.result)}}}return a.promise},g.prototype.parseWebRtcResponseId=function(e){return l.convert(e.subarray(0,8))},g.prototype.parseWebRtcResponse=function(e){var t=l.convert(e.subarray(8,12)),n=JSON.parse(String.fromCharCode.apply(null,e.subarray(12,12+t)));return n.id=l.convert(e.subarray(0,8)),n.content=e.subarray(12+t),n},g.prototype.handleWebRtcResponse=function(e){var t=this.parseWebRtcResponse(e);"gzip"===t["Content-Encoding"]&&(t.content=window.pako.inflate(t.content));var n,r,i=this.pendingRequests[t.id];switch(t.contentType){case"application/json":var a=Object.assign({},t);delete a.content,delete a.headers,delete a.contentType,delete a.statusCode,delete a.contentType,delete a["content-type"],r=n={contentType:t.contentType,"content-type":t["content-type"],headers:t.headers,status:t.statusCode,data:{data:JSON.parse(p.convert(t.content)),meta:a},msg:t.msg};break;case"application/octet-stream":n={arraybuffer:t.content};break;default:var u=new Blob([t.content],{type:t.contentType});n=window.URL.createObjectURL(u)}i?(delete this.pendingRequests[t.id],o.cancel(i.timeout),s.debug(c.WEBRTC_DATA_RECEIVED_API_RESPONSE,"channel:"+this.channelLabel,"responseId:"+t.id,i?"for "+i.headers.method+" "+i.headers.path:"","length "+(t.content&&t.content.length?t.content.length:0)+" bytes.",r),200===t.statusCode?i.resolve(n):i.reject(n)):this.onmessageCallback?(this.onmessageCallback(n),s.debug(c.WEBRTC_DATA_RECEIVED_MESSAGE,"channel:"+this.channelLabel," length "+(t.content&&t.content.length?t.content.length:0)+" bytes.",r)):s.error(c.WEBRTC_DATA_NO_PENDING_PROMISE_OR_ONMESSAGE_CALLBACK,"channel:"+this.channelLabel,"responseId:"+t.id,r)},t.exports=g},{"../../constants/webrtc":52,"../../constants/webrtcMessages":54,"../../service/provider":75,"../converters/arrayBufferToUint8Array":56,"../converters/byteArrayToValue":57,"../converters/params":58,"../converters/stringToUTF8Array":59,"../converters/uint8ArrayToBinary":60,"../converters/valueToUint8Array":61,"../deferred":62}],70:[function(e,t,n){"use strict";t.exports={factory:function(t){var n=(t=t||{}).provider||e("../../service/provider"),r=n.get("eventBusService"),i=n.get("loggerService"),o=t.checkRequiredOptions||e("./../utils/checkRequiredOptions"),s=t.WebRtcPeer||e("./WebRtcPeer"),a=t.WEBRTC_EVENTS||e("../../constants/webrtcEvents"),c=t.WEBRTC_MESSAGES||e("../../constants/webrtcMessages");function u(e){this.reconfigure(e)}return u.REQUIRED_CONFIG_OPTIONS=["signallingChannel","startAsCaller"],u.prototype.reconfigure=function(e){o(u.REQUIRED_CONFIG_OPTIONS,e),this.config=e,this.signallingChannel&&this.signallingChannel.close(),this.signallingChannel=e.signallingChannel,this.eventBusService=e.eventBusService||r,this.p2pConnector&&this.p2pConnector.close(),this.connected=!1,this.onMessageCallbacks={}},u.prototype.establishConnection=function(e){return this.tryOpenConnection(e,this.config.numberOfRetries)},u.prototype.tryOpenConnection=function(e,t){return this.openConnection(e).catch(function(n){return t>0?(this.eventBusService.emit(a.WEBRTC_RETRY_CONNECTION,t),i.warn(a.WEBRTC_RETRY_CONNECTION,t),t--,this.tryOpenConnection(e,t)):window.Promise.reject(n)}.bind(this))},u.prototype.openConnection=function(e){return o(u.REQUIRED_CONNECTION_OPTIONS,e),this.p2pConnector=new s(this.signallingChannel,this.eventBusService,{channelNames:e.channelNames&&e.channelNames.length>0?e.channelNames:["__empty__"],turnCredentials:Object.assign({},e.turnCredentials),ondatachannel:this.config.ondatachannel,dataChannelOptions:e.dataChannelOptions,oncloseCallback:this.config.autoReconnect?function(){this.eventBusService.emit(a.WEBRTC_RECONNECTING),i.warn(a.WEBRTC_RECONNECTING),this.establishConnection(e).then(this.reassignOnMessageCallbacks.bind(this))}.bind(this):function(){}}),this.signallingChannel.open(e).then(function(){var t=this.config.startAsCaller?"startAsCaller":"startAsCalled";return this.p2pConnector[t](e.deviceId)}.bind(this)).then(function(){return this.eventBusService.emit(a.WEBRTC_CONNECTED,this.p2pConnector),i.info(a.WEBRTC_CONNECTED,this.p2pConnector),this.signallingChannel.close(),this.connected=!0,this.p2pConnector}.bind(this)).catch(this.mapOfflineError.bind(this,e.deviceId)).catch(function(e){return this.eventBusService.emit(a.WEBRTC_CONNECTION_ERROR,e),i.error(a.WEBRTC_CONNECTION_ERROR,e),this.signallingChannel.close(),this.connected=!1,window.Promise.reject(e)}.bind(this))},u.REQUIRED_CONNECTION_OPTIONS=["deviceId","turnCredentials"],u.prototype.mapOfflineError=function(e,t){if(t){var n=t[0]&&"device_offline"===t[0].error_code,r=t.response&&t.response.data&&"Device offline"===t.response.data.exception;if("offline"===t||n||r)return this.eventBusService.emit(a.WEBRTC_DEVICE_OFFLINE,e),i.error(a.WEBRTC_DEVICE_OFFLINE,e),window.Promise.reject(a.WEBRTC_DEVICE_OFFLINE)}return window.Promise.reject(t)},u.prototype.sendApiRequest=function(e,t){return this.connected?this.p2pConnector.sendApiRequest(e,t):window.Promise.reject(c.WEBRTC_NOT_CONNECTED)},u.prototype.send=function(e,t){return this.connected?this.p2pConnector.send(e,t):window.Promise.reject(c.WEBRTC_NOT_CONNECTED)},u.prototype.openChannel=function(e,t){return this.p2pConnector?this.p2pConnector.openChannel(e,t):window.Promise.reject(c.WEBRTC_NOT_INITIALIZED)},u.prototype.closeChannel=function(e){return this.p2pConnector?this.p2pConnector.closeChannel(e):c.WEBRTC_NOT_INITIALIZED},u.prototype.on=function(e,t){return this.onMessageCallbacks[e]=t,this.p2pConnector?(this.p2pConnector.on(e,t),!0):c.WEBRTC_NOT_INITIALIZED},u.prototype.reassignOnMessageCallbacks=function(){Object.keys(this.onMessageCallbacks).forEach(function(e){this.on(e,this.onMessageCallbacks[e])}.bind(this))},u.prototype.getLogger=function(){return i},u.prototype.sendSignallingAction=function(e,t){return this.signallingChannel.open().then(function(){return this.signallingChannel.sendActionRequest(e,t)}.bind(this))},u.prototype.close=function(){this.signallingChannel.closeSession(),this.p2pConnector.close()},u}}},{"../../constants/webrtcEvents":53,"../../constants/webrtcMessages":54,"../../service/provider":75,"./../utils/checkRequiredOptions":63,"./WebRtcPeer":71}],71:[function(e,t,n){"use strict";var r=e("../deferred"),i=e("../../constants/webrtc"),o=e("../../constants/webrtcEvents"),s=e("../../constants/webrtcMessages"),a=e("../../service/provider"),c=a.get("loggerService"),u=a.get("timeoutService"),f=e("./WebRtcChannel"),l=e("./../utils/checkRequiredOptions"),h=function(e,t,n){l(h.REQUIRED_CONFIG_OPTIONS,n),this.channels={},this.apiChannels=[],this.apiChannelsCounter=0,this.config=n,this.deferredConnection=null,this.deferredGatheringIceCandidates=null,this.deviceId=null,this.signallingChannel=e,this.eventBusService=t,this.stunHost=null,this.turnHost=null,this.init()};function d(e){return e.label+"_"+e.id}h.REQUIRED_CONFIG_OPTIONS=["turnCredentials"],h.prototype.init=function(){this.printMaskedTurnCredentials(this.config.turnCredentials),this.config.turnCredentials&&(this.config.turnCredentials.uris&&(this.config.turnCredentials.urls=[],this.config.turnCredentials.uris.forEach(function(e){e.match("^stun:")&&(this.stunHost=e,this.config.turnCredentials.urls.push(e)),e.match("^turn:")&&e.match("\\?transport=udp")&&(this.turnHost||(this.turnHost=e,this.config.turnCredentials.urls.push(e)))}.bind(this)),delete this.config.turnCredentials.uris),this.config.turnCredentials.password&&(this.config.turnCredentials.credential=this.config.turnCredentials.password,delete this.config.turnCredentials.password)),this.initPeerConnection([this.config.turnCredentials])},h.prototype.printMaskedTurnCredentials=function(e){var t,n=["username","password"];e&&(t=Object.keys(e).reduce(function(t,r){return t[r]=-1!==n.indexOf(r)?"XXXXXXXX":e[r],t},{})),c.info(s.WEBRTC_TURN_CREDENTIALS,t)},h.prototype.initPeerConnection=function(e){this.pc=new window.RTCPeerConnection({iceServers:e},null),this.pc.onicecandidate=this.onIceCandidate.bind(this),this.pc.oniceconnectionstatechange=this.onIceConnectionStateChange.bind(this),this.pc.negotiationneeded=this.onNegotiationNeeded.bind(this),this.pc.ondatachannel=this.config.ondatachannel||this.onDataChannel.bind(this)},h.prototype.onDataChannel=function(e){var t=e.channel,n=t.label,r=this.channels[n];r||(r=new f(t),this.channels[n]=r);var i=this.config.dataChannelOptions;if(i)return i.onMessageCallback&&(r.onmessageCallback=i.onMessageCallback),i.onCloseCallback&&(r.oncloseCallback=i.onCloseCallback),i.parser&&(r.parser=i.parser),i.deferred&&i.deferred.resolve({channel:r,options:i})},h.prototype.onIceCandidate=function(e){c.info(s.WEBRTC_ICE_CANDIDATE,e.candidate),c.info(s.WEBRTC_ICE_GATHERING_STATE,this.pc.iceGatheringState),this.deferredGatheringIceCandidates&&this.delayedCheckIceGatheringState()},h.prototype.isIceCandidateUdp=function(e){return e&&-1===e.candidate.indexOf(" tcp ")},h.prototype.delayedCheckIceGatheringState=function(){u(function(){this.checkIceGatheringState()}.bind(this),i.WAIT_FOR_NEW_ICE_CANDIDATES_DELAY)},h.prototype.checkIceGatheringState=function(){"complete"===this.pc.iceGatheringState&&this.deferredGatheringIceCandidates&&(c.info(s.WEBRTC_ICE_CANDIDATES_GATHERED),this.deferredGatheringIceCandidates.resolve())},h.prototype.onNegotiationNeeded=function(e){c.info(s.WEBRTC_NEGOTIATION_NEEDED,e)},h.prototype.onIceConnectionStateChange=function(e){var t=(this.pc||e.target).iceConnectionState;switch(t){case"new":case"checking":case"closed":case"completed":c.info(s.WEBRTC_ICE_CONNECTION_STATE,t);break;case"connected":c.info(s.WEBRTC_ICE_CONNECTION_STATE,t),this.printStats("debug"),this.deferredConnection&&this.deferredConnection.resolve(t);break;case"disconnected":c.error(s.WEBRTC_ICE_CONNECTION_STATE,t),this.eventBusService.emit(o.WEBRTC_DISCONNECTED),this.close();break;default:this.printStats("info"),c.error(s.WEBRTC_ICE_CONNECTION_STATE_ERROR,t),this.deferredGatheringIceCandidates&&this.deferredGatheringIceCandidates.reject(t),this.deferredConnection&&this.deferredConnection.reject(t)}},h.prototype.printStats=function(e){try{this.pc.getStats().then(function(t){Object.keys(t).forEach(function(n){var r=t[n],i=r.names?r.names():Object.keys(r);c[e]("  "+n+":"),i.forEach(function(t){c[e]("    "+t+" = "+JSON.stringify(r.stat?r.stat(t):r[t]))})})})}catch(e){c.warn("cannot create webrtc stats: "+e)}},h.prototype.onStart=function(e){this.deviceId=e,this.deferredConnection=new r,this.deferredGatheringIceCandidates=new r},h.prototype.startAsCalled=function(e){return this.onStart(e),window.Promise.all([this.waitForConnection(),this.requestSdpOffer().then(this.setRemoteDescription.bind(this)).then(this.createSdpAnswer.bind(this)).then(this.setLocalDescription.bind(this)).then(this.waitForIceCandidates.bind(this)).then(this.sendSdpAnswer.bind(this)).then(this.openChannels.bind(this))])},h.prototype.startAsCaller=function(e){return this.onStart(e),window.Promise.all([this.waitForConnection(),this.openChannels(),this.createSdpOffer().then(this.setLocalDescription.bind(this)).then(this.waitForIceCandidates.bind(this)).then(this.sendSdpOffer.bind(this)).then(this.setRemoteDescription.bind(this))])},h.prototype.requestSdpOffer=function(){return this.eventBusService.emit(o.WEBRTC_SDP_REQUESTING),c.info(o.WEBRTC_SDP_REQUESTING),this.signallingChannel.requestSdpOffer({deviceId:this.deviceId,stunUri:this.stunHost,turnUri:this.turnHost,turnCredentials:this.config.turnCredentials}).then(function(e){return this.eventBusService.emit(o.WEBRTC_SDP_RECEIVED,e),c.info(o.WEBRTC_SDP_RECEIVED,e),this.webRtcId=e.webRtcId,new window.RTCSessionDescription({sdp:e.sdp,type:"offer"})}.bind(this)).catch(function(e){return this.eventBusService.emit(o.WEBRTC_SDP_RECEIVING_ERROR,e),c.info(o.WEBRTC_SDP_RECEIVING_ERROR,e),window.Promise.reject(e)}.bind(this))},h.prototype.setRemoteDescription=function(e){return this.pc.setRemoteDescription(e).then(function(){this.eventBusService.emit(o.WEBRTC_SET_REMOTE_DESCRIPTION,e),c.info(o.WEBRTC_SET_REMOTE_DESCRIPTION,e)}.bind(this)).catch(function(e){return this.eventBusService.emit(o.WEBRTC_SET_REMOTE_DESCRIPTION_ERROR,e),c.error(o.WEBRTC_SET_REMOTE_DESCRIPTION_ERROR,e),window.Promise.reject(e)}.bind(this))},h.prototype.createSdpAnswer=function(){return this.pc.createAnswer().then(function(e){return this.eventBusService.emit(o.WEBRTC_CREATE_ANSWER,e),c.info(o.WEBRTC_CREATE_ANSWER,e),e}.bind(this)).catch(function(e){return this.eventBusService.emit(o.WEBRTC_CREATE_ANSWER_ERROR,e),c.error(o.WEBRTC_CREATE_ANSWER_ERROR,e),window.Promise.reject(e)}.bind(this))},h.prototype.sendSdpAnswer=function(){var e=this.filterOutTcpCandidates(this.pc.localDescription.sdp);return this.eventBusService.emit(o.WEBRTC_SDP_SENDING,e),c.info(o.WEBRTC_SDP_SENDING,e),this.signallingChannel.sendSdpAnswer({deviceId:this.deviceId,sdp:e,stunUri:this.stunHost,turnCredentials:this.config.turnCredentials,turnUri:this.turnHost,webRtcId:this.webRtcId}).then(function(e){this.eventBusService.emit(o.WEBRTC_SDP_SENT,e),c.info(o.WEBRTC_SDP_SENT,e)}.bind(this)).catch(function(e){return this.eventBusService.emit(o.WEBRTC_SDP_SENDING_ERROR),c.error(o.WEBRTC_SDP_SENDING_ERROR,e),window.Promise.reject(e)}.bind(this))},h.prototype.createSdpOffer=function(){return this.pc.createOffer().then(function(e){return this.eventBusService.emit(o.WEBRTC_CREATE_OFFER,e),c.info(o.WEBRTC_CREATE_OFFER,e),e}.bind(this)).catch(function(e){return this.eventBusService.emit(o.WEBRTC_CREATE_OFFER_ERROR,e),c.error(o.WEBRTC_CREATE_OFFER_ERROR,e),window.Promise.reject(e)}.bind(this))},h.prototype.setLocalDescription=function(e){return this.pc.setLocalDescription(e).then(function(){this.eventBusService.emit(o.WEBRTC_SET_LOCAL_DESCRIPTION,e),c.info(o.WEBRTC_SET_LOCAL_DESCRIPTION,e)}.bind(this)).catch(function(e){return this.eventBusService.emit(o.WEBRTC_SET_LOCAL_DESCRIPTION_ERROR,e),c.error(o.WEBRTC_SET_LOCAL_DESCRIPTION_ERROR,e),window.Promise.reject(e)}.bind(this))},h.prototype.waitForIceCandidates=function(){return this.deferredGatheringIceCandidates.promise.then(function(){this.deferredGatheringIceCandidates=null}.bind(this)).catch(function(e){return this.deferredGatheringIceCandidates=null,window.Promise.reject(e)}.bind(this))},h.prototype.sendSdpOffer=function(){var e=this.filterOutTcpCandidates(this.pc.localDescription.sdp);return this.eventBusService.emit(o.WEBRTC_SDP_SENDING,e),c.info(o.WEBRTC_SDP_SENDING,e),this.signallingChannel.sendSdpOffer({deviceId:this.deviceId,sdp:e,stunUri:this.stunHost,turnCredentials:this.config.turnCredentials,turnUri:this.turnHost}).then(function(e){return this.eventBusService.emit(o.WEBRTC_SDP_RECEIVED,e),c.info(o.WEBRTC_SDP_RECEIVED,e),new window.RTCSessionDescription({sdp:e.sdp,type:"answer"})}.bind(this)).catch(function(e){return this.eventBusService.emit(o.WEBRTC_SDP_RECEIVING_ERROR),c.error(o.WEBRTC_SDP_RECEIVING_ERROR,e),window.Promise.reject(e)}.bind(this))},h.prototype.filterOutTcpCandidates=function(e){return e.replace(/a=candidate[^\n]*tcp[^\n]*\n/g,"")},h.prototype.waitForConnection=function(){return this.deferredConnection.promise.then(function(){this.deferredConnection=null}.bind(this)).catch(function(e){return this.deferredConnection=null,window.Promise.reject(e)}.bind(this))},h.prototype.openChannels=function(){this.eventBusService.emit(o.WEBRTC_DATA_CHANNELS_OPEN,this.config.channelNames),c.info(o.WEBRTC_DATA_CHANNELS_OPEN,this.config.channelNames);var e=this.config.channelNames.map(function(e){return this.openChannel(e)}.bind(this));return window.Promise.all(e).then(function(){this.eventBusService.emit(o.WEBRTC_INITIALIZED),c.info(o.WEBRTC_INITIALIZED)}.bind(this))},h.prototype.sendApiRequest=function(e,t){return this.getAvailableApiChannel().then(function(n){return n.sendApiRequest(e,t).then(function(e){return n.isBusy--,e}).catch(function(e){return n.isBusy--,window.Promise.reject(e)})})},h.prototype.send=function(e,t){var n=this.channels[e];return n?n.send(t):window.Promise.reject(new Error("Channel name `"+e+"` is not available."))},h.prototype.createNewApiChannel=function(){var e=this.config.apiChannelName||i.DEFAULT_API_CHANNEL_NAME;return this.apiChannelsCounter++,this.createChannel(e).then(function(e){return this.apiChannels.push(e),e.oncloseCallback=function(t){c.debug(s.WEBRTC_DATA_CHANNEL_CLOSE,e.channelLabel,t);var n=this.apiChannels.indexOf(e);n>=0&&(this.apiChannels.splice(n,1),this.apiChannelsCounter--)}.bind(this),e}.bind(this)).catch(function(e){return this.apiChannelsCounter--,window.Promise.reject(e)}.bind(this))},h.prototype.getAvailableApiChannel=function(){var e=this.getLeastBusyChannel();return!e||e.isBusy&&this.apiChannelsCounter<256?this.createNewApiChannel().then(function(e){return e.isBusy=1,e}):(e.isBusy++,window.Promise.resolve(e))},h.prototype.getLeastBusyChannel=function(){return this.apiChannels.reduce(function(e,t){return!e||t.isBusy<e.isBusy?t:e},null)},h.prototype.closeChannel=function(e){var t=this.channels[e];return t?(delete this.channels[e],t.close()):window.Promise.reject(new Error("Channel name `"+e+"` does not exist."))},h.prototype.openChannel=function(e,t){var n=this.config.apiChannelName||i.DEFAULT_API_CHANNEL_NAME;if(e===n)return c.error(s.WEBRTC_API_CHANNEL_CONFLICT,e),window.Promise.reject(new Error("Channel name `"+e+"` is reserved for API usage."));var r=this.channels[e];return r?window.Promise.resolve(r):this.createChannel(e,t).then(function(t){return this.channels[e]=t,t}.bind(this))},h.prototype.createChannel=function(e,t){c.info(s.WEBRTC_DATA_CHANNEL_OPENING,e);var n=new r;if("closed"===this.pc.signalingState)return c.error(s.WEBRTC_CLOSED,this.pc.signalingState,e),window.Promise.reject(s.WEBRTC_CLOSED);var o=this.pc.createDataChannel(e,{}),a=u(function(){"open"!==o.readyState&&(n.reject(s.WEBRTC_DATA_CHANNEL_TIMEOUT,d(o)),c.error(s.WEBRTC_DATA_CHANNEL_TIMEOUT,d(o)))},i.DATA_CHANNEL_OPEN_TIMEOUT);return o.onopen=function(){u.cancel(a),n.resolve(new f(o,t)),c.info(s.WEBRTC_DATA_CHANNEL_READY,d(o))}.bind(this),o.onerror=function(e){n.reject(s.WEBRTC_DATA_CHANNEL_ERROR,d(o),e),c.error(s.WEBRTC_DATA_CHANNEL_ERROR,d(o),e)},o.onclose=function(e){n.reject(s.WEBRTC_DATA_CHANNEL_CLOSE,d(o),e),c.error(s.WEBRTC_DATA_CHANNEL_CLOSE,d(o),e)},n.promise},h.prototype.on=function(e,t){var n=this.channels[e];n&&(n.onmessageCallback=t)},h.prototype.close=function(){this.pc&&"closed"!==this.pc.signalingState&&(this.eventBusService.emit(o.WEBRTC_CLOSED),c.info(o.WEBRTC_CLOSED),this.pc.close()),this.pc=null,this.config.oncloseCallback&&this.config.oncloseCallback()},t.exports=h},{"../../constants/webrtc":52,"../../constants/webrtcEvents":53,"../../constants/webrtcMessages":54,"../../service/provider":75,"../deferred":62,"./../utils/checkRequiredOptions":63,"./WebRtcChannel":69}],72:[function(e,t,n){"use strict";e("webrtc-adapter");var r=e("./service/provider");function i(){}i.prototype.withTimeoutService=function(e){return this.timeoutService=e,this},i.prototype.withLoggerService=function(e){return this.loggerService=e,this},i.prototype.withEventBusService=function(e){return this.eventBusService=e,this},i.prototype.build=function(){return r.service("timeoutService",this.timeoutService||e("./service/timeout")),r.service("loggerService",this.loggerService||e("./service/logger")),r.service("eventBusService",this.eventBusService||e("./service/eventBus")),{WebRtcConnector:e("./lib/webrtc/WebRtcConnector").factory(),SignallingChannel:e("./lib/webrtc/SignallingChannel").factory()}},t.exports={WEBRTC_EVENTS:e("./constants/webrtcEvents"),WEBRTC_MESSAGES:e("./constants/webrtcMessages"),builder:function(){return new i}}},{"./constants/webrtcEvents":53,"./constants/webrtcMessages":54,"./lib/webrtc/SignallingChannel":65,"./lib/webrtc/WebRtcConnector":70,"./service/eventBus":73,"./service/logger":74,"./service/provider":75,"./service/timeout":76,"webrtc-adapter":174}],73:[function(e,t,n){"use strict";function r(){}r.prototype.emit=function(e,t){},t.exports=new r},{}],74:[function(e,t,n){"use strict";function r(){if(!(this instanceof r))return new r;this.setLevel("info")}r.prototype.debug=function(){this._log("debug",arguments)},r.prototype.info=function(){this._log("info",arguments)},r.prototype.warn=function(){this._log("warn",arguments)},r.prototype.error=function(){this._log("error",arguments)},r.prototype.setLevel=function(e){this._level=e},r.prototype._log=function(e,t){if(r.LEVEL_PRIORITY[e]>=r.LEVEL_PRIORITY[this._level]){var n=this._serializeMessages(Array.prototype.slice.call(t));n.unshift((new Date).toUTCString()),n.unshift(performance.now().toFixed(4)+"ms"),this._print(e,n)}},r.prototype._serializeMessages=function(e){return e.map(function(e){if(e&&("object"!=typeof e||e instanceof Event))return e;if(void 0!==e)try{return JSON.parse(JSON.stringify(e))}catch(e){}})},r.prototype._print=function(e,t){console[e].apply(console,t)},r.LEVEL_PRIORITY={debug:0,info:1,warn:2,error:3},t.exports=new r},{}],75:[function(e,t,n){"use strict";function r(){this.services={}}r.prototype.service=function(e,t){return this.services[e]=t,t},r.prototype.get=function(e){var t=this.services[e];if(void 0===t)throw new Error("Service "+e+" is undefined.");return t},t.exports=new r},{}],76:[function(e,t,n){"use strict";var r=function(){return window.setTimeout.apply(window,arguments)};r.cancel=function(){window.clearTimeout.apply(window,arguments)},t.exports=r},{}],77:[function(e,t,n){(function(e){function t(e){return Object.prototype.toString.call(e)}n.isArray=
// distribute, sublicense, and/or sell copies of the Software, and to permit
function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},n.isBoolean=function(e){return"boolean"==typeof e},n.isNull=function(e){return null===e},n.isNullOrUndefined=function(e){return null==e},n.isNumber=function(e){return"number"==typeof e},n.isString=function(e){return"string"==typeof e},n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=function(e){return void 0===e},n.isRegExp=function(e){return"[object RegExp]"===t(e)},n.isObject=function(e){return"object"==typeof e&&null!==e},n.isDate=function(e){return"[object Date]"===t(e)},n.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},n.isFunction=function(e){return"function"==typeof e},n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":119}],78:[function(e,t,n){var r,i;r=this,i=function(e){return function(){var t=e,n=t.lib.BlockCipher,r=t.algo,i=[],o=[],s=[],a=[],c=[],u=[],f=[],l=[],h=[],d=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var p=r^r<<1^r<<2^r<<3^r<<4;p=p>>>8^255&p^99,i[n]=p,o[p]=n;var _=e[n],g=e[_],v=e[g],m=257*e[p]^16843008*p;s[n]=m<<24|m>>>8,a[n]=m<<16|m>>>16,c[n]=m<<8|m>>>24,u[n]=m;m=16843009*v^65537*g^257*_^16843008*n;f[p]=m<<24|m>>>8,l[p]=m<<16|m>>>16,h[p]=m<<8|m>>>24,d[p]=m,n?(n=_^e[e[e[v^_]]],r^=e[e[r]]):n=r=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],_=r.AES=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),o=this._keySchedule=[],s=0;s<r;s++)if(s<n)o[s]=t[s];else{var a=o[s-1];s%n?n>6&&s%n==4&&(a=i[a>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a]):(a=i[(a=a<<8|a>>>24)>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a],a^=p[s/n|0]<<24),o[s]=o[s-n]^a}for(var c=this._invKeySchedule=[],u=0;u<r;u++){s=r-u;if(u%4)a=o[s];else a=o[s-4];c[u]=u<4||s<=4?a:f[i[a>>>24]]^l[i[a>>>16&255]]^h[i[a>>>8&255]]^d[i[255&a]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,u,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,f,l,h,d,o);n=e[t+1];e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,o,s,a){for(var c=this._nRounds,u=e[t]^n[0],f=e[t+1]^n[1],l=e[t+2]^n[2],h=e[t+3]^n[3],d=4,p=1;p<c;p++){var _=r[u>>>24]^i[f>>>16&255]^o[l>>>8&255]^s[255&h]^n[d++],g=r[f>>>24]^i[l>>>16&255]^o[h>>>8&255]^s[255&u]^n[d++],v=r[l>>>24]^i[h>>>16&255]^o[u>>>8&255]^s[255&f]^n[d++],m=r[h>>>24]^i[u>>>16&255]^o[f>>>8&255]^s[255&l]^n[d++];u=_,f=g,l=v,h=m}_=(a[u>>>24]<<24|a[f>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[d++],g=(a[f>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&u])^n[d++],v=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[u>>>8&255]<<8|a[255&f])^n[d++],m=(a[h>>>24]<<24|a[u>>>16&255]<<16|a[f>>>8&255]<<8|a[255&l])^n[d++];e[t]=_,e[t+1]=g,e[t+2]=v,e[t+3]=m},keySize:8});t.AES=n._createHelper(_)}(),e.AES},"object"==typeof n?t.exports=n=i(e("./core"),e("./enc-base64"),e("./md5"),e("./evpkdf"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80,"./enc-base64":81,"./evpkdf":83,"./md5":88}],79:[function(e,t,n){var r,i;r=this,i=function(e){e.lib.Cipher||function(t){var n=e,r=n.lib,i=r.Base,o=r.WordArray,s=r.BufferedBlockAlgorithm,a=n.enc,c=(a.Utf8,a.Base64),u=n.algo.EvpKDF,f=r.Cipher=s.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?y:v}return function(t){return{encrypt:function(n,r,i){return e(r).encrypt(t,n,r,i)},decrypt:function(n,r,i){return e(r).decrypt(t,n,r,i)}}}}()}),l=(r.StreamCipher=f.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),n.mode={}),h=r.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),d=l.CBC=function(){var e=h.extend();function n(e,n,r){var i=this._iv;if(i){var o=i;this._iv=t}else o=this._prevBlock;for(var s=0;s<r;s++)e[n+s]^=o[s]}return e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize;n.call(this,e,t,i),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),e.Decryptor=e.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,o=e.slice(t,t+i);r.decryptBlock(e,t),n.call(this,e,t,i),this._prevBlock=o}}),e}(),p=(n.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,r=n-e.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);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},_=(r.BlockCipher=f.extend({cfg:f.cfg.extend({mode:d,padding:p}),reset:function(){f.reset.call(this);var e=this.cfg,t=e.iv,n=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=n.createEncryptor;else{r=n.createDecryptor;this._minBufferSize=1}this._mode=r.call(n,this,t&&t.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else{t=this._process(!0);e.unpad(t)}return t},blockSize:4}),r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),g=(n.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;if(n)var r=o.create([1398893684,1701076831]).concat(n).concat(t);else r=t;return r.toString(c)},parse:function(e){var t=c.parse(e),n=t.words;if(1398893684==n[0]&&1701076831==n[1]){var r=o.create(n.slice(2,4));n.splice(0,4),t.sigBytes-=16}return _.create({ciphertext:t,salt:r})}},v=r.SerializableCipher=i.extend({cfg:i.extend({format:g}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r),o=i.finalize(t),s=i.cfg;return _.create({ciphertext:o,key:n,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),m=(n.kdf={}).OpenSSL={execute:function(e,t,n,r){r||(r=o.random(8));var i=u.create({keySize:t+n}).compute(e,r),s=o.create(i.words.slice(t),4*n);return i.sigBytes=4*t,_.create({key:i,iv:s,salt:r})}},y=r.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:m}),encrypt:function(e,t,n,r){var i=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize);r.iv=i.iv;var o=v.encrypt.call(this,e,t,i.key,r);return o.mixIn(i),o},decrypt:function(e,t,n,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var i=r.kdf.execute(n,e.keySize,e.ivSize,t.salt);return r.iv=i.iv,v.decrypt.call(this,e,t,i.key,r)}})}()},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":80}],80:[function(e,t,n){var r,i;r=this,i=function(){var e=e||function(e,t){var n={},r=n.lib={},i=r.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(o=0;o<i;o+=4)t[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,r=[],i=function(t){t=t;var n=987654321,r=4294967295;return function(){var i=((n=36969*(65535&n)+(n>>16)&r)<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},s=0;s<t;s+=4){var a=i(4294967296*(n||e.random()));n=987654071*a(),r.push(4294967296*a()|0)}return new o.init(r,t)}}),s=n.enc={},a=s.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new o.init(n,t/2)}},c=s.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new o.init(n,t)}},u=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,s=this.blockSize,a=i/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,u=e.min(4*c,i);if(c){for(var f=0;f<c;f+=s)this._doProcessBlock(r,f);var l=r.splice(0,c);n.sigBytes-=u}return new o.init(l,u)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),l=(r.Hasher=f.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new l.HMAC.init(e,n).finalize(t)}}}),n.algo={});return n}(Math);return e},"object"==typeof n?t.exports=n=i():"function"==typeof define&&define.amd?define([],i):r.CryptoJS=i()},{}],81:[function(e,t,n){var r,i;r=this,i=function(e){var t,n;return n=(t=e).lib.WordArray,t.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var c=r.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=r.charAt(64);if(i){var o=e.indexOf(i);-1!=o&&(t=o)}for(var s=[],a=0,c=0;c<t;c++)if(c%4){var u=r.indexOf(e.charAt(c-1))<<c%4*2|r.indexOf(e.charAt(c))>>>6-c%4*2;s[a>>>2]|=u<<24-a%4*8,a++}return n.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.enc.Base64},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":80}],82:[function(e,t,n){var r,i;r=this,i=function(e){return function(){var t=e,n=t.lib.WordArray,r=t.enc;r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i+=2){var o=t[i>>>2]>>>16-i%4*8&65535;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return n.create(r,2*t)}};function i(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o+=2){var s=i(t[o>>>2]>>>16-o%4*8&65535);r.push(String.fromCharCode(s))}return r.join("")},parse:function(e){for(var t=e.length,r=[],o=0;o<t;o++)r[o>>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return n.create(r,2*t)}}}(),e.enc.Utf16},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":80}],83:[function(e,t,n){var r,i;r=this,i=function(e){var t,n,r,i,o,s,a;return n=(t=e).lib,r=n.Base,i=n.WordArray,o=t.algo,s=o.MD5,a=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){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(e).finalize(t);r.reset();for(var f=1;f<c;f++)u=r.finalize(u),r.reset();o.concat(u)}return o.sigBytes=4*a,o}}),t.EvpKDF=function(e,t,n){return a.create(n).compute(e,t)},e.EvpKDF},"object"==typeof n?t.exports=n=i(e("./core"),e("./sha1"),e("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],i):i(r.CryptoJS)},{"./core":80,"./hmac":85,"./sha1":104}],84:[function(e,t,n){var r,i;r=this,i=function(e){var t,n,r;return n=(t=e).lib.CipherParams,r=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var t=r.parse(e);return n.create({ciphertext:t})}},e.format.Hex},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],85:[function(e,t,n){arguments[4][9][0].apply(n,arguments)},{"./core":80,dup:9}],86:[function(e,t,n){var r,i;r=this,i=function(e){return e},"object"==typeof n?t.exports=n=i(e("./core"),e("./x64-core"),e("./lib-typedarrays"),e("./enc-utf16"),e("./enc-base64"),e("./md5"),e("./sha1"),e("./sha256"),e("./sha224"),e("./sha512"),e("./sha384"),e("./sha3"),e("./ripemd160"),e("./hmac"),e("./pbkdf2"),e("./evpkdf"),e("./cipher-core"),e("./mode-cfb"),e("./mode-ctr"),e("./mode-ctr-gladman"),e("./mode-ofb"),e("./mode-ecb"),e("./pad-ansix923"),e("./pad-iso10126"),e("./pad-iso97971"),e("./pad-zeropadding"),e("./pad-nopadding"),e("./format-hex"),e("./aes"),e("./tripledes"),e("./rc4"),e("./rabbit"),e("./rabbit-legacy")):"function"==typeof define&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy"],i):r.CryptoJS=i(r.CryptoJS)},{"./aes":78,"./cipher-core":79,"./core":80,"./enc-base64":81,"./enc-utf16":82,"./evpkdf":83,"./format-hex":84,"./hmac":85,"./lib-typedarrays":87,"./md5":88,"./mode-cfb":89,"./mode-ctr":91,"./mode-ctr-gladman":90,"./mode-ecb":92,"./mode-ofb":93,"./pad-ansix923":94,"./pad-iso10126":95,"./pad-iso97971":96,"./pad-nopadding":97,"./pad-zeropadding":98,"./pbkdf2":99,"./rabbit":101,"./rabbit-legacy":100,"./rc4":102,"./ripemd160":103,"./sha1":104,"./sha224":105,"./sha256":106,"./sha3":107,"./sha384":108,"./sha512":109,"./tripledes":110,"./x64-core":111}],87:[function(e,t,n){var r,i;r=this,i=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,n=t.init;(t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,r=[],i=0;i<t;i++)r[i>>>2]|=e[i]<<24-i%4*8;n.call(this,r,t)}else n.apply(this,arguments)}).prototype=t}}(),e.lib.WordArray},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":80}],88:[function(e,t,n){var r,i;r=this,i=function(e){return function(t){var n=e,r=n.lib,i=r.WordArray,o=r.Hasher,s=n.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,i=e[r];e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=e[t+0],c=e[t+1],d=e[t+2],p=e[t+3],_=e[t+4],g=e[t+5],v=e[t+6],m=e[t+7],y=e[t+8],E=e[t+9],b=e[t+10],C=e[t+11],w=e[t+12],T=e[t+13],R=e[t+14],S=e[t+15],I=o[0],N=o[1],O=o[2],A=o[3];N=h(N=h(N=h(N=h(N=l(N=l(N=l(N=l(N=f(N=f(N=f(N=f(N=u(N=u(N=u(N=u(N,O=u(O,A=u(A,I=u(I,N,O,A,s,7,a[0]),N,O,c,12,a[1]),I,N,d,17,a[2]),A,I,p,22,a[3]),O=u(O,A=u(A,I=u(I,N,O,A,_,7,a[4]),N,O,g,12,a[5]),I,N,v,17,a[6]),A,I,m,22,a[7]),O=u(O,A=u(A,I=u(I,N,O,A,y,7,a[8]),N,O,E,12,a[9]),I,N,b,17,a[10]),A,I,C,22,a[11]),O=u(O,A=u(A,I=u(I,N,O,A,w,7,a[12]),N,O,T,12,a[13]),I,N,R,17,a[14]),A,I,S,22,a[15]),O=f(O,A=f(A,I=f(I,N,O,A,c,5,a[16]),N,O,v,9,a[17]),I,N,C,14,a[18]),A,I,s,20,a[19]),O=f(O,A=f(A,I=f(I,N,O,A,g,5,a[20]),N,O,b,9,a[21]),I,N,S,14,a[22]),A,I,_,20,a[23]),O=f(O,A=f(A,I=f(I,N,O,A,E,5,a[24]),N,O,R,9,a[25]),I,N,p,14,a[26]),A,I,y,20,a[27]),O=f(O,A=f(A,I=f(I,N,O,A,T,5,a[28]),N,O,d,9,a[29]),I,N,m,14,a[30]),A,I,w,20,a[31]),O=l(O,A=l(A,I=l(I,N,O,A,g,4,a[32]),N,O,y,11,a[33]),I,N,C,16,a[34]),A,I,R,23,a[35]),O=l(O,A=l(A,I=l(I,N,O,A,c,4,a[36]),N,O,_,11,a[37]),I,N,m,16,a[38]),A,I,b,23,a[39]),O=l(O,A=l(A,I=l(I,N,O,A,T,4,a[40]),N,O,s,11,a[41]),I,N,p,16,a[42]),A,I,v,23,a[43]),O=l(O,A=l(A,I=l(I,N,O,A,E,4,a[44]),N,O,w,11,a[45]),I,N,S,16,a[46]),A,I,d,23,a[47]),O=h(O,A=h(A,I=h(I,N,O,A,s,6,a[48]),N,O,m,10,a[49]),I,N,R,15,a[50]),A,I,g,21,a[51]),O=h(O,A=h(A,I=h(I,N,O,A,w,6,a[52]),N,O,p,10,a[53]),I,N,b,15,a[54]),A,I,c,21,a[55]),O=h(O,A=h(A,I=h(I,N,O,A,y,6,a[56]),N,O,S,10,a[57]),I,N,v,15,a[58]),A,I,T,21,a[59]),O=h(O,A=h(A,I=h(I,N,O,A,_,6,a[60]),N,O,C,10,a[61]),I,N,d,15,a[62]),A,I,E,21,a[63]),o[0]=o[0]+I|0,o[1]=o[1]+N|0,o[2]=o[2]+O|0,o[3]=o[3]+A|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;n[i>>>5]|=128<<24-i%32;var o=t.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),e.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var f=c[u];c[u]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,r,i,o,s){var a=e+(t&n|~t&r)+i+s;return(a<<o|a>>>32-o)+t}function f(e,t,n,r,i,o,s){var a=e+(t&r|n&~r)+i+s;return(a<<o|a>>>32-o)+t}function l(e,t,n,r,i,o,s){var a=e+(t^n^r)+i+s;return(a<<o|a>>>32-o)+t}function h(e,t,n,r,i,o,s){var a=e+(n^(t|~r))+i+s;return(a<<o|a>>>32-o)+t}n.MD5=o._createHelper(c),n.HmacMD5=o._createHmacHelper(c)}(Math),e.MD5},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":80}],89:[function(e,t,n){var r,i;r=this,i=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function n(e,t,n,r){var i=this._iv;if(i){var o=i.slice(0);this._iv=void 0}else o=this._prevBlock;r.encryptBlock(o,0);for(var s=0;s<n;s++)e[t+s]^=o[s]}return t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize;n.call(this,e,t,i,r),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,o=e.slice(t,t+i);n.call(this,e,t,i,r),this._prevBlock=o}}),t}(),e.mode.CFB},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],90:[function(e,t,n){var r,i;r=this,i=function(e){
/** @preserve
	 * Counter block mode compatible with  Dr Brian Gladman fileenc.c
	 * derived from CryptoJS.mode.CTR
	 * Jan Hruby jhruby.web@gmail.com
	 */
return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function n(e){if(255==(e>>24&255)){var t=e>>16&255,n=e>>8&255,r=255&e;255===t?(t=0,255===n?(n=0,255===r?r=0:++r):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=r}else e+=1<<24;return e}var r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),function(e){0===(e[0]=n(e[0]))&&(e[1]=n(e[1]))}(s);var a=s.slice(0);r.encryptBlock(a,0);for(var c=0;c<i;c++)e[t+c]^=a[c]}});return t.Decryptor=r,t}(),e.mode.CTRGladman},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],91:[function(e,t,n){var r,i;r=this,i=function(e){var t,n;return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),n=t.Encryptor=t.extend({processBlock:function(e,t){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++)e[t+a]^=s[a]}}),t.Decryptor=n,t),e.mode.CTR},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],92:[function(e,t,n){var r,i;r=this,i=function(e){var t;return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],93:[function(e,t,n){var r,i;r=this,i=function(e){var t,n;return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),n=t.Encryptor=t.extend({processBlock:function(e,t){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++)e[t+s]^=o[s]}}),t.Decryptor=n,t),e.mode.OFB},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],94:[function(e,t,n){var r,i;r=this,i=function(e){return e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,r=4*t,i=r-n%r,o=n+i-1;e.clamp(),e.words[o>>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],95:[function(e,t,n){var r,i;r=this,i=function(e){return e.pad.Iso10126={pad:function(t,n){var r=4*n,i=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(i-1)).concat(e.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],96:[function(e,t,n){var r,i;r=this,i=function(e){return e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],97:[function(e,t,n){var r,i;r=this,i=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],98:[function(e,t,n){var r,i;r=this,i=function(e){return e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){for(var t=e.words,n=e.sigBytes-1;!(t[n>>>2]>>>24-n%4*8&255);)n--;e.sigBytes=n+1}},e.pad.ZeroPadding},"object"==typeof n?t.exports=n=i(e("./core"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80}],99:[function(e,t,n){var r,i;r=this,i=function(e){var t,n,r,i,o,s,a,c;return n=(t=e).lib,r=n.Base,i=n.WordArray,o=t.algo,s=o.SHA1,a=o.HMAC,c=o.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,r=a.create(n.hasher,e),o=i.create(),s=i.create([1]),c=o.words,u=s.words,f=n.keySize,l=n.iterations;c.length<f;){var h=r.update(t).finalize(s);r.reset();for(var d=h.words,p=d.length,_=h,g=1;g<l;g++){_=r.finalize(_),r.reset();for(var v=_.words,m=0;m<p;m++)d[m]^=v[m]}o.concat(h),u[0]++}return o.sigBytes=4*f,o}}),t.PBKDF2=function(e,t,n){return c.create(n).compute(e,t)},e.PBKDF2},"object"==typeof n?t.exports=n=i(e("./core"),e("./sha1"),e("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],i):i(r.CryptoJS)},{"./core":80,"./hmac":85,"./sha1":104}],100:[function(e,t,n){var r,i;r=this,i=function(e){return function(){var t=e,n=t.lib.StreamCipher,r=[],i=[],o=[],s=t.algo.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)a.call(this);for(i=0;i<8;i++)r[i]^=n[i+4&7];if(t){var o=t.words,s=o[0],c=o[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),l=u>>>16|4294901760&f,h=f<<16|65535&u;r[0]^=u,r[1]^=l,r[2]^=f,r[3]^=h,r[4]^=u,r[5]^=l,r[6]^=f,r[7]^=h;for(i=0;i<4;i++)a.call(this)}},_doProcessBlock:function(e,t){var n=this._X;a.call(this),r[0]=n[0]^n[5]>>>16^n[3]<<16,r[1]=n[2]^n[7]>>>16^n[5]<<16,r[2]=n[4]^n[1]>>>16^n[7]<<16,r[3]=n[6]^n[3]>>>16^n[1]<<16;for(var i=0;i<4;i++)r[i]=16711935&(r[i]<<8|r[i]>>>24)|4278255360&(r[i]<<24|r[i]>>>8),e[t+i]^=r[i]},blockSize:4,ivSize:2});function a(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0;for(n=0;n<8;n++){var r=e[n]+t[n],s=65535&r,a=r>>>16,c=((s*s>>>17)+s*a>>>15)+a*a,u=((4294901760&r)*r|0)+((65535&r)*r|0);o[n]=c^u}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.RabbitLegacy=n._createHelper(s)}(),e.RabbitLegacy},"object"==typeof n?t.exports=n=i(e("./core"),e("./enc-base64"),e("./md5"),e("./evpkdf"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80,"./enc-base64":81,"./evpkdf":83,"./md5":88}],101:[function(e,t,n){var r,i;r=this,i=function(e){return function(){var t=e,n=t.lib.StreamCipher,r=[],i=[],o=[],s=t.algo.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(n=0;n<4;n++)a.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var o=t.words,s=o[0],c=o[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),l=u>>>16|4294901760&f,h=f<<16|65535&u;i[0]^=u,i[1]^=l,i[2]^=f,i[3]^=h,i[4]^=u,i[5]^=l,i[6]^=f,i[7]^=h;for(n=0;n<4;n++)a.call(this)}},_doProcessBlock:function(e,t){var n=this._X;a.call(this),r[0]=n[0]^n[5]>>>16^n[3]<<16,r[1]=n[2]^n[7]>>>16^n[5]<<16,r[2]=n[4]^n[1]>>>16^n[7]<<16,r[3]=n[6]^n[3]>>>16^n[1]<<16;for(var i=0;i<4;i++)r[i]=16711935&(r[i]<<8|r[i]>>>24)|4278255360&(r[i]<<24|r[i]>>>8),e[t+i]^=r[i]},blockSize:4,ivSize:2});function a(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0;for(n=0;n<8;n++){var r=e[n]+t[n],s=65535&r,a=r>>>16,c=((s*s>>>17)+s*a>>>15)+a*a,u=((4294901760&r)*r|0)+((65535&r)*r|0);o[n]=c^u}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.Rabbit=n._createHelper(s)}(),e.Rabbit},"object"==typeof n?t.exports=n=i(e("./core"),e("./enc-base64"),e("./md5"),e("./evpkdf"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80,"./enc-base64":81,"./evpkdf":83,"./md5":88}],102:[function(e,t,n){var r,i;r=this,i=function(e){return function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=r.RC4=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,r=this._S=[],i=0;i<256;i++)r[i]=i;i=0;for(var o=0;i<256;i++){var s=i%n,a=t[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(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,n=this._j,r=0,i=0;i<4;i++){n=(n+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[n],e[n]=o,r|=e[(e[t]+e[n])%256]<<24-8*i}return this._i=t,this._j=n,r}t.RC4=n._createHelper(i);var s=r.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});t.RC4Drop=n._createHelper(s)}(),e.RC4},"object"==typeof n?t.exports=n=i(e("./core"),e("./enc-base64"),e("./md5"),e("./evpkdf"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80,"./enc-base64":81,"./evpkdf":83,"./md5":88}],103:[function(e,t,n){var r,i;r=this,i=function(e){
/** @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(t){var n=e,r=n.lib,i=r.WordArray,o=r.Hasher,s=n.algo,a=i.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]),c=i.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]),u=i.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]),f=i.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]),l=i.create([0,1518500249,1859775393,2400959708,2840853838]),h=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=s.RIPEMD160=o.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,i=e[r];e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,s,d,E,b,C,w,T,R,S,I,N=this._hash.words,O=l.words,A=h.words,B=a.words,k=c.words,x=u.words,D=f.words;C=o=N[0],w=s=N[1],T=d=N[2],R=E=N[3],S=b=N[4];for(n=0;n<80;n+=1)I=o+e[t+B[n]]|0,I+=n<16?p(s,d,E)+O[0]:n<32?_(s,d,E)+O[1]:n<48?g(s,d,E)+O[2]:n<64?v(s,d,E)+O[3]:m(s,d,E)+O[4],I=(I=y(I|=0,x[n]))+b|0,o=b,b=E,E=y(d,10),d=s,s=I,I=C+e[t+k[n]]|0,I+=n<16?m(w,T,R)+A[0]:n<32?v(w,T,R)+A[1]:n<48?g(w,T,R)+A[2]:n<64?_(w,T,R)+A[3]:p(w,T,R)+A[4],I=(I=y(I|=0,D[n]))+S|0,C=S,S=R,R=y(T,10),T=w,w=I;I=N[1]+d+R|0,N[1]=N[2]+E+S|0,N[2]=N[3]+b+C|0,N[3]=N[4]+o+w|0,N[4]=N[0]+s+T|0,N[0]=I},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.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 e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,n){return e^t^n}function _(e,t,n){return e&t|~e&n}function g(e,t,n){return(e|~t)^n}function v(e,t,n){return e&n|t&~n}function m(e,t,n){return e^(t|~n)}function y(e,t){return e<<t|e>>>32-t}n.RIPEMD160=o._createHelper(d),n.HmacRIPEMD160=o._createHmacHelper(d)}(Math),e.RIPEMD160},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":80}],104:[function(e,t,n){var r,i;r=this,i=function(e){var t,n,r,i,o,s;return n=(t=e).lib,r=n.WordArray,i=n.Hasher,o=[],s=t.algo.SHA1=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],s=n[2],a=n[3],c=n[4],u=0;u<80;u++){if(u<16)o[u]=0|e[t+u];else{var f=o[u-3]^o[u-8]^o[u-14]^o[u-16];o[u]=f<<1|f>>>31}var l=(r<<5|r>>>27)+c+o[u];l+=u<20?1518500249+(i&s|~i&a):u<40?1859775393+(i^s^a):u<60?(i&s|i&a|s&a)-1894007588:(i^s^a)-899497514,c=a,a=s,s=i<<30|i>>>2,i=r,r=l}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+s|0,n[3]=n[3]+a|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=i._createHelper(s),t.HmacSHA1=i._createHmacHelper(s),e.SHA1},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":80}],105:[function(e,t,n){var r,i;r=this,i=function(e){var t,n,r,i,o;return n=(t=e).lib.WordArray,r=t.algo,i=r.SHA256,o=r.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=i._createHelper(o),t.HmacSHA224=i._createHmacHelper(o),e.SHA224},"object"==typeof n?t.exports=n=i(e("./core"),e("./sha256")):"function"==typeof define&&define.amd?define(["./core","./sha256"],i):i(r.CryptoJS)},{"./core":80,"./sha256":106}],106:[function(e,t,n){arguments[4][10][0].apply(n,arguments)},{"./core":80,dup:10}],107:[function(e,t,n){var r,i;r=this,i=function(e){return function(t){var n=e,r=n.lib,i=r.WordArray,o=r.Hasher,s=n.x64.Word,a=n.algo,c=[],u=[],f=[];!function(){for(var e=1,t=0,n=0;n<24;n++){c[e+5*t]=(n+1)*(n+2)/2%64;var r=(2*e+3*t)%5;e=t%5,t=r}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var a=0,l=0,h=0;h<7;h++){if(1&i){var d=(1<<h)-1;d<32?l^=1<<d:a^=1<<d-32}128&i?i=i<<1^113:i<<=1}f[o]=s.create(a,l)}}();var l=[];!function(){for(var e=0;e<25;e++)l[e]=s.create()}();var h=a.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var n=this._state,r=this.blockSize/2,i=0;i<r;i++){var o=e[t+2*i],s=e[t+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),(N=n[i]).high^=s,N.low^=o}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var d=0,p=0,_=0;_<5;_++){d^=(N=n[h+5*_]).high,p^=N.low}var g=l[h];g.high=d,g.low=p}for(h=0;h<5;h++){var v=l[(h+4)%5],m=l[(h+1)%5],y=m.high,E=m.low;for(d=v.high^(y<<1|E>>>31),p=v.low^(E<<1|y>>>31),_=0;_<5;_++){(N=n[h+5*_]).high^=d,N.low^=p}}for(var b=1;b<25;b++){var C=(N=n[b]).high,w=N.low,T=c[b];if(T<32)d=C<<T|w>>>32-T,p=w<<T|C>>>32-T;else d=w<<T-32|C>>>64-T,p=C<<T-32|w>>>64-T;var R=l[u[b]];R.high=d,R.low=p}var S=l[0],I=n[0];S.high=I.high,S.low=I.low;for(h=0;h<5;h++)for(_=0;_<5;_++){var N=n[b=h+5*_],O=l[b],A=l[(h+1)%5+5*_],B=l[(h+2)%5+5*_];N.high=O.high^~A.high&B.high,N.low=O.low^~A.low&B.low}N=n[0];var k=f[a];N.high^=k.high,N.low^=k.low}},_doFinalize:function(){var e=this._data,n=e.words,r=(this._nDataBytes,8*e.sigBytes),o=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(t.ceil((r+1)/o)*o>>>5)-1]|=128,e.sigBytes=4*n.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,c=a/8,u=[],f=0;f<c;f++){var l=s[f],h=l.high,d=l.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),u.push(d),u.push(h)}return new i.init(u,a)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),n=0;n<25;n++)t[n]=t[n].clone();return e}});n.SHA3=o._createHelper(h),n.HmacSHA3=o._createHmacHelper(h)}(Math),e.SHA3},"object"==typeof n?t.exports=n=i(e("./core"),e("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],i):i(r.CryptoJS)},{"./core":80,"./x64-core":111}],108:[function(e,t,n){var r,i;r=this,i=function(e){var t,n,r,i,o,s,a;return n=(t=e).x64,r=n.Word,i=n.WordArray,o=t.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 e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=s._createHelper(a),t.HmacSHA384=s._createHmacHelper(a),e.SHA384},"object"==typeof n?t.exports=n=i(e("./core"),e("./x64-core"),e("./sha512")):"function"==typeof define&&define.amd?define(["./core","./x64-core","./sha512"],i):i(r.CryptoJS)},{"./core":80,"./sha512":109,"./x64-core":111}],109:[function(e,t,n){var r,i;r=this,i=function(e){return function(){var t=e,n=t.lib.Hasher,r=t.x64,i=r.Word,o=r.WordArray,s=t.algo;function a(){return i.create.apply(i,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=a()}();var f=s.SHA512=n.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],f=n[5],l=n[6],h=n[7],d=r.high,p=r.low,_=i.high,g=i.low,v=o.high,m=o.low,y=s.high,E=s.low,b=a.high,C=a.low,w=f.high,T=f.low,R=l.high,S=l.low,I=h.high,N=h.low,O=d,A=p,B=_,k=g,x=v,D=m,P=y,W=E,L=b,M=C,j=w,U=T,F=R,H=S,G=I,q=N,z=0;z<80;z++){var V=u[z];if(z<16)var K=V.high=0|e[t+2*z],J=V.low=0|e[t+2*z+1];else{var Q=u[z-15],Y=Q.high,X=Q.low,Z=(Y>>>1|X<<31)^(Y>>>8|X<<24)^Y>>>7,$=(X>>>1|Y<<31)^(X>>>8|Y<<24)^(X>>>7|Y<<25),ee=u[z-2],te=ee.high,ne=ee.low,re=(te>>>19|ne<<13)^(te<<3|ne>>>29)^te>>>6,ie=(ne>>>19|te<<13)^(ne<<3|te>>>29)^(ne>>>6|te<<26),oe=u[z-7],se=oe.high,ae=oe.low,ce=u[z-16],ue=ce.high,fe=ce.low;K=(K=(K=Z+se+((J=$+ae)>>>0<$>>>0?1:0))+re+((J=J+ie)>>>0<ie>>>0?1:0))+ue+((J=J+fe)>>>0<fe>>>0?1:0);V.high=K,V.low=J}var le,he=L&j^~L&F,de=M&U^~M&H,pe=O&B^O&x^B&x,_e=A&k^A&D^k&D,ge=(O>>>28|A<<4)^(O<<30|A>>>2)^(O<<25|A>>>7),ve=(A>>>28|O<<4)^(A<<30|O>>>2)^(A<<25|O>>>7),me=(L>>>14|M<<18)^(L>>>18|M<<14)^(L<<23|M>>>9),ye=(M>>>14|L<<18)^(M>>>18|L<<14)^(M<<23|L>>>9),Ee=c[z],be=Ee.high,Ce=Ee.low,we=G+me+((le=q+ye)>>>0<q>>>0?1:0),Te=ve+_e;G=F,q=H,F=j,H=U,j=L,U=M,L=P+(we=(we=(we=we+he+((le=le+de)>>>0<de>>>0?1:0))+be+((le=le+Ce)>>>0<Ce>>>0?1:0))+K+((le=le+J)>>>0<J>>>0?1:0))+((M=W+le|0)>>>0<W>>>0?1:0)|0,P=x,W=D,x=B,D=k,B=O,k=A,O=we+(ge+pe+(Te>>>0<ve>>>0?1:0))+((A=le+Te|0)>>>0<le>>>0?1:0)|0}p=r.low=p+A,r.high=d+O+(p>>>0<A>>>0?1:0),g=i.low=g+k,i.high=_+B+(g>>>0<k>>>0?1:0),m=o.low=m+D,o.high=v+x+(m>>>0<D>>>0?1:0),E=s.low=E+W,s.high=y+P+(E>>>0<W>>>0?1:0),C=a.low=C+M,a.high=b+L+(C>>>0<M>>>0?1:0),T=f.low=T+U,f.high=w+j+(T>>>0<U>>>0?1:0),S=l.low=S+H,l.high=R+F+(S>>>0<H>>>0?1:0),N=h.low=N+q,h.high=I+G+(N>>>0<q>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(r+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=n._createHelper(f),t.HmacSHA512=n._createHmacHelper(f)}(),e.SHA512},"object"==typeof n?t.exports=n=i(e("./core"),e("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],i):i(r.CryptoJS)},{"./core":80,"./x64-core":111}],110:[function(e,t,n){var r,i;r=this,i=function(e){return function(){var t=e,n=t.lib,r=n.WordArray,i=n.BlockCipher,o=t.algo,s=[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],a=[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],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{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}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;n<56;n++){var r=s[n]-1;t[n]=e[r>>>5]>>>31-r%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var u=i[o]=[],f=c[o];for(n=0;n<24;n++)u[n/6|0]|=t[(a[n]-1+f)%28]<<31-n%6,u[4+(n/6|0)]|=t[28+(a[n+24]-1+f)%28]<<31-n%6;u[0]=u[0]<<1|u[0]>>>31;for(n=1;n<7;n++)u[n]=u[n]>>>4*(n-1)+3;u[7]=u[7]<<5|u[7]>>>27}var l=this._invSubKeys=[];for(n=0;n<16;n++)l[n]=i[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,n){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),h.call(this,1,1431655765);for(var r=0;r<16;r++){for(var i=n[r],o=this._lBlock,s=this._rBlock,a=0,c=0;c<8;c++)a|=u[c][((s^i[c])&f[c])>>>0];this._lBlock=s,this._rBlock=o^a}var l=this._lBlock;this._lBlock=this._rBlock,this._rBlock=l,h.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<<e}function d(e,t){var n=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<<e}t.DES=i._createHelper(l);var p=o.TripleDES=i.extend({_doReset:function(){var e=this._key.words;this._des1=l.createEncryptor(r.create(e.slice(0,2))),this._des2=l.createEncryptor(r.create(e.slice(2,4))),this._des3=l.createEncryptor(r.create(e.slice(4,6)))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=i._createHelper(p)}(),e.TripleDES},"object"==typeof n?t.exports=n=i(e("./core"),e("./enc-base64"),e("./md5"),e("./evpkdf"),e("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],i):i(r.CryptoJS)},{"./cipher-core":79,"./core":80,"./enc-base64":81,"./evpkdf":83,"./md5":88}],111:[function(e,t,n){var r,i;r=this,i=function(e){var t,n,r,i,o;return n=(t=e).lib,r=n.Base,i=n.WordArray,(o=t.x64={}).Word=r.extend({init:function(e,t){this.high=e,this.low=t}}),o.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,n=[],r=0;r<t;r++){var o=e[r];n.push(o.high),n.push(o.low)}return i.create(n,this.sigBytes)},clone:function(){for(var e=r.clone.call(this),t=e.words=this.words.slice(0),n=t.length,i=0;i<n;i++)t[i]=t[i].clone();return e}}),e},"object"==typeof n?t.exports=n=i(e("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)},{"./core":80}],112:[function(e,t,n){(function(n,r){var i=e("readable-stream"),o=e("end-of-stream"),s=e("inherits"),a=e("stream-shift"),c=r.from&&r.from!==Uint8Array.from?r.from([0]):new r([0]),u=function(e,t){e._corked?e.once("uncork",t):t()},f=function(e,t){return function(n){n?function(e,t){e._autoDestroy&&e.destroy(t)}(e,"premature close"===n.message?null:n):t&&!e._ended&&e.end()}},l=function(e,t,n){if(!(this instanceof l))return new l(e,t,n);i.Duplex.call(this,n),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!n||!1!==n.autoDestroy,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.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};s(l,i.Duplex),l.obj=function(e,t,n){return n||(n={}),n.objectMode=!0,n.highWaterMark=16,new l(e,t,n)},l.prototype.cork=function(){1==++this._corked&&this.emit("cork")},l.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},l.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed)e&&e.destroy&&e.destroy();else if(null!==e&&!1!==e){var t=this,r=o(e,{writable:!0,readable:!1},f(this,this._forwardEnd)),i=function(){var e=t._ondrain;t._ondrain=null,e&&e()};this._unwrite&&n.nextTick(i),this._writable=e,this._writable.on("drain",i),this._unwrite=function(){t._writable.removeListener("drain",i),r()},this.uncork()}else this.end()},l.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed)e&&e.destroy&&e.destroy();else{if(null===e||!1===e)return this.push(null),void this.resume();var t,n=this,r=o(e,{writable:!1,readable:!0},f(this)),s=function(){n._forward()},a=function(){n.push(null)};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:(t=e,new i.Readable({objectMode:!0,highWaterMark:16}).wrap(t)),this._readable2.on("readable",s),this._readable2.on("end",a),this._unread=function(){n._readable2.removeListener("readable",s),n._readable2.removeListener("end",a),r()},this._forward()}},l.prototype._read=function(){this._drained=!0,this._forward()},l.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var e;for(this._forwarding=!0;this._drained&&null!==(e=a(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},l.prototype.destroy=function(e){if(!this.destroyed){this.destroyed=!0;var t=this;n.nextTick(function(){t._destroy(e)})}},l.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},l.prototype._write=function(e,t,n){return this.destroyed?n():this._corked?u(this,this._write.bind(this,e,t,n)):e===c?this._finish(n):this._writable?void(!1===this._writable.write(e)?this._ondrain=n:n()):n()},l.prototype._finish=function(e){var t=this;this.emit("preend"),u(this,function(){var n,r;n=t._forwardEnd&&t._writable,r=function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),u(t,e)},n?n._writableState&&n._writableState.finished?r():n._writableState?n.end(r):(n.end(),r()):r()})},l.prototype.end=function(e,t,n){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this.write(c),i.Writable.prototype.end.call(this,n))},t.exports=l}).call(this,e("_process"),e("buffer").Buffer)},{_process:144,buffer:51,"end-of-stream":113,inherits:118,"readable-stream":161,"stream-shift":166}],113:[function(e,t,n){var r=e("once"),i=function(){},o=function(e,t,n){if("function"==typeof t)return o(e,null,t);t||(t={}),n=r(n||i);var s=e._writableState,a=e._readableState,c=t.readable||!1!==t.readable&&e.readable,u=t.writable||!1!==t.writable&&e.writable,f=function(){e.writable||l()},l=function(){u=!1,c||n.call(e)},h=function(){c=!1,u||n.call(e)},d=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},p=function(t){n.call(e,t)},_=function(){return(!c||a&&a.ended)&&(!u||s&&s.ended)?void 0:n.call(e,new Error("premature close"))},g=function(){e.req.on("finish",l)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?u&&!s&&(e.on("end",f),e.on("close",f)):(e.on("complete",l),e.on("abort",_),e.req?g():e.on("request",g)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",d),e.on("end",h),e.on("finish",l),!1!==t.error&&e.on("error",p),e.on("close",_),function(){e.removeListener("complete",l),e.removeListener("abort",_),e.removeListener("request",g),e.req&&e.req.removeListener("finish",l),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",l),e.removeListener("exit",d),e.removeListener("end",h),e.removeListener("error",p),e.removeListener("close",_)}};t.exports=o},{once:141}],114:[function(e,t,n){(function(n){"use strict";var r=n.Promise||e("es6-promise").Promise;t.exports=function(){this.promise=new r(function(e,t){this.resolve=e,this.reject=t}.bind(this)),this.then=this.promise.then.bind(this.promise),this.catch=this.promise.catch.bind(this.promise)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"es6-promise":115}],115:[function(e,t,n){(function(n,r,i){
/*!
 * @overview es6-promise - a tiny implementation of Promises/A+.
 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
 * @license   Licensed under MIT license
 *            See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
 * @version   2.3.0
 */
(function(){"use strict";function o(e){return"function"==typeof e}var s,a,c=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},u=0,f=function(e,t){T[u]=e,T[u+1]=t,2===(u+=2)&&(a?a(R):v())};var l="undefined"!=typeof window?window:void 0,h=l||{},d=h.MutationObserver||h.WebKitMutationObserver,p=void 0!==n&&"[object process]"==={}.toString.call(n),_="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){setTimeout(R,1)}}var v,m,y,E,b,C,w,T=new Array(1e3);function R(){for(var e=0;e<u;e+=2){(0,T[e])(T[e+1]),T[e]=void 0,T[e+1]=void 0}u=0}function S(){}p?(C=n.nextTick,w=n.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/),Array.isArray(w)&&"0"===w[1]&&"10"===w[2]&&(C=i),v=function(){C(R)}):d?(y=0,E=new d(R),b=document.createTextNode(""),E.observe(b,{characterData:!0}),v=function(){b.data=y=++y%2}):_?((m=new MessageChannel).port1.onmessage=R,v=function(){m.port2.postMessage(0)}):v=void 0===l&&"function"==typeof e?function(){try{var t=e("vertx");return s=t.runOnLoop||t.runOnContext,function(){s(R)}}catch(e){return g()}}():g();var I=void 0,N=1,O=2,A=new M;function B(e,t){if(t.constructor===e.constructor)!function(e,t){t._state===N?D(e,t._result):t._state===O?P(e,t._result):W(t,void 0,function(t){k(e,t)},function(t){P(e,t)})}(e,t);else{var n=function(e){try{return e.then}catch(e){return A.error=e,A}}(t);n===A?P(e,A.error):void 0===n?D(e,t):o(n)?function(e,t,n){f(function(e){var r=!1,i=function(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}(n,t,function(n){r||(r=!0,t!==n?k(e,n):D(e,n))},function(t){r||(r=!0,P(e,t))},e._label);!r&&i&&(r=!0,P(e,i))},e)}(e,t,n):D(e,t)}}function k(e,t){var n;e===t?P(e,new TypeError("You cannot resolve a promise with itself")):"function"==typeof(n=t)||"object"==typeof n&&null!==n?B(e,t):D(e,t)}function x(e){e._onerror&&e._onerror(e._result),L(e)}function D(e,t){e._state===I&&(e._result=t,e._state=N,0!==e._subscribers.length&&f(L,e))}function P(e,t){e._state===I&&(e._state=O,e._result=t,f(x,e))}function W(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+N]=n,i[o+O]=r,0===o&&e._state&&f(L,e)}function L(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,o=e._result,s=0;s<t.length;s+=3)r=t[s],i=t[s+n],r?U(n,r,i,o):i(o);e._subscribers.length=0}}function M(){this.error=null}var j=new M;function U(e,t,n,r){var i,s,a,c,u=o(n);if(u){if((i=function(e,t){try{return e(t)}catch(e){return j.error=e,j}}(n,r))===j?(c=!0,s=i.error,i=null):a=!0,t===i)return void P(t,new TypeError("A promises callback cannot return that same promise."))}else i=r,a=!0;t._state!==I||(u&&a?k(t,i):c?P(t,s):e===N?D(t,i):e===O&&P(t,i))}function F(e,t){this._instanceConstructor=e,this.promise=new e(S),this._validateInput(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._init(),0===this.length?D(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&D(this.promise,this._result))):P(this.promise,this._validationError())}F.prototype._validateInput=function(e){return c(e)},F.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},F.prototype._init=function(){this._result=new Array(this.length)};var H=F;F.prototype._enumerate=function(){for(var e=this.length,t=this.promise,n=this._input,r=0;t._state===I&&r<e;r++)this._eachEntry(n[r],r)},F.prototype._eachEntry=function(e,t){var n,r=this._instanceConstructor;"object"==typeof(n=e)&&null!==n?e.constructor===r&&e._state!==I?(e._onerror=null,this._settledAt(e._state,t,e._result)):this._willSettleAt(r.resolve(e),t):(this._remaining--,this._result[t]=e)},F.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===I&&(this._remaining--,e===O?P(r,n):this._result[t]=n),0===this._remaining&&D(r,this._result)},F.prototype._willSettleAt=function(e,t){var n=this;W(e,void 0,function(e){n._settledAt(N,t,e)},function(e){n._settledAt(O,t,e)})};var G=function(e){return new H(this,e).promise};var q=function(e){var t=new this(S);if(!c(e))return P(t,new TypeError("You must pass an array to race.")),t;var n=e.length;function r(e){k(t,e)}function i(e){P(t,e)}for(var o=0;t._state===I&&o<n;o++)W(this.resolve(e[o]),void 0,r,i);return t};var z=function(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(S);return k(t,e),t};var V=function(e){var t=new this(S);return P(t,e),t},K=0;var J=Q;function Q(e){this._id=K++,this._state=void 0,this._result=void 0,this._subscribers=[],S!==e&&(o(e)||function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof Q||function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}(),function(e,t){try{t(function(t){k(e,t)},function(t){P(e,t)})}catch(t){P(e,t)}}(this,e))}Q.all=G,Q.race=q,Q.resolve=z,Q.reject=V,Q._setScheduler=function(e){a=e},Q._setAsap=function(e){f=e},Q._asap=f,Q.prototype={constructor:Q,then:function(e,t){var n=this._state;if(n===N&&!e||n===O&&!t)return this;var r=new this.constructor(S),i=this._result;if(n){var o=arguments[n-1];f(function(){U(n,r,o,i)})}else W(this,r,e,t);return r},catch:function(e){return this.then(null,e)}};var Y=function(){var e;if(void 0!==r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;t&&"[object Promise]"===Object.prototype.toString.call(t.resolve())&&!t.cast||(e.Promise=J)},X={Promise:J,polyfill:Y};"function"==typeof define&&define.amd?define(function(){return X}):void 0!==t&&t.exports?t.exports=X:void 0!==this&&(this.ES6Promise=X),Y()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{_process:144,timers:167}],116:[function(e,t,n){
// distribute, sublicense, and/or sell copies of the Software, and to permit
var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},o=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var a,c=10;try{var u={};Object.defineProperty&&Object.defineProperty(u,"x",{value:0}),a=0===u.x}catch(e){a=!1}function f(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,n,i){var o,s,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),a=s[t]):(s=e._events=r(null),e._eventsCount=0),a){if("function"==typeof a?a=s[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),!a.warned&&(o=f(e))&&o>0&&a.length>o){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",c.name,c.message)}}else a=s[t]=n,++e._eventsCount;return e}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=o.call(h,r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(!r)return[];var i=r[t];return i?"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):g(i,i.length):[]}function _(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function g(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}a?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');c=e}}):s.defaultMaxListeners=c,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return f(this)},s.prototype.emit=function(e){var t,n,r,i,o,s,a="error"===e;if(s=this._events)a=a&&null==s.error;else if(!a)return!1;if(a){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var c=new Error('Unhandled "error" event. ('+t+")");throw c.context=t,c}if(!(n=s[e]))return!1;var u="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=g(e,r),o=0;o<r;++o)i[o].call(n)}(n,u,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=g(e,i),s=0;s<i;++s)o[s].call(n,r)}(n,u,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,s=g(e,o),a=0;a<o;++a)s[a].call(n,r,i)}(n,u,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var s=e.length,a=g(e,s),c=0;c<s;++c)a[c].call(n,r,i,o)}(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=g(e,i),s=0;s<i;++s)o[s].apply(n,r)}(n,u,this,i)}return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,d(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,d(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,i,o,s,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=r(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){a=n[s].listener,o=s;break}if(o<0)return this;0===o?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,o),1===n.length&&(i[e]=n[0]),i.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.removeAllListeners=function(e){var t,n,o;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=r(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=r(null):delete n[e]),this;if(0===arguments.length){var s,a=i(n);for(o=0;o<a.length;++o)"removeListener"!==(s=a[o])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=r(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):_.call(e,t)},s.prototype.listenerCount=_,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],117:[function(e,t,n){n.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,f=-7,l=n?i-1:0,h=n?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=256*s+e[t+l],l+=h,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=u}return(d?-1:1)*s*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var s,a,c,u=8*o-i-1,f=(1<<u)-1,l=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*c-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+d]=255&s,d+=p,s/=256,u-=8);e[n+d-p]|=128*_}},{}],118:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],119:[function(e,t,n){function r(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}
/*!
 * Determine if an object is a Buffer
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
t.exports=function(e){return null!=e&&(r(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&r(e.slice(0,0))}(e)||!!e._isBuffer)}},{}],120:[function(e,t,n){"use strict";var r=["ETIMEDOUT","ECONNRESET","EADDRINUSE","ESOCKETTIMEDOUT","ECONNREFUSED","EPIPE"],i=["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED"];t.exports=function(e){return!e||!e.code||(-1!==r.indexOf(e.code)||-1===i.indexOf(e.code))}},{}],121:[function(e,t,n){
/*!
 * js-logger - http://github.com/jonnyreeves/js-logger
 * Jonny Reeves, http://jonnyreeves.co.uk/
 * js-logger may be freely distributed under the MIT license.
 */
!function(e){"use strict";var n,r={};r.VERSION="1.3.0";var i={},o=function(e,t){return function(){return t.apply(e,arguments)}},s=function(){var e,t,n=arguments,r=n[0];for(t=1;t<n.length;t++)for(e in n[t])e in r||!n[t].hasOwnProperty(e)||(r[e]=n[t][e]);return r},a=function(e,t){return{value:e,name:t}};r.DEBUG=a(1,"DEBUG"),r.INFO=a(2,"INFO"),r.TIME=a(3,"TIME"),r.WARN=a(4,"WARN"),r.ERROR=a(8,"ERROR"),r.OFF=a(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},debug:function(){this.invoke(r.DEBUG,arguments)},info:function(){this.invoke(r.INFO,arguments)},warn:function(){this.invoke(r.WARN,arguments)},error:function(){this.invoke(r.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(r.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(r.TIME,[e,"end"])},invoke:function(e,t){n&&this.enabledFor(e)&&n(t,s({level:e},this.context))}};var u,f=new c({filterLevel:r.OFF});(u=r).enabledFor=o(f,f.enabledFor),u.debug=o(f,f.debug),u.time=o(f,f.time),u.timeEnd=o(f,f.timeEnd),u.info=o(f,f.info),u.warn=o(f,f.warn),u.error=o(f,f.error),u.log=u.info,r.setHandler=function(e){n=e},r.setLevel=function(e){for(var t in f.setLevel(e),i)i.hasOwnProperty(t)&&i[t].setLevel(e)},r.getLevel=function(){return f.getLevel()},r.get=function(e){return i[e]||(i[e]=new c(s({name:e},f.context)))},r.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},n=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(i,o){i=Array.prototype.slice.call(i);var s,a=console.log;o.level===r.TIME?(s=(o.name?"["+o.name+"] ":"")+i[0],"start"===i[1]?console.time?console.time(s):t[s]=(new Date).getTime():console.timeEnd?console.timeEnd(s):n(a,[s+": "+((new Date).getTime()-t[s])+"ms"])):(o.level===r.WARN&&console.warn?a=console.warn:o.level===r.ERROR&&console.error?a=console.error:o.level===r.INFO&&console.info?a=console.info:o.level===r.DEBUG&&console.debug&&(a=console.debug),e.formatter(i,o),n(a,i))}},r.useDefaults=function(e){r.setLevel(e&&e.defaultLevel||r.DEBUG),r.setHandler(r.createDefaultHandler(e))},"function"==typeof define&&define.amd?define(r):void 0!==t&&t.exports?t.exports=r:(r._prevLogger=e.Logger,r.noConflict=function(){return e.Logger=r._prevLogger,r},e.Logger=r)}(this)},{}],122:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=t.exports;for(var o in i.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"},i.codes={},i.types){var s=i.types[o];i.codes[s]=o}function a(e){return[0,1,2].map(function(t){return[0,1].map(function(n){return[0,1].map(function(o){var s=new r(1);return s.writeUInt8(i.codes[e]<<i.CMD_SHIFT|(n?i.DUP_MASK:0)|t<<i.QOS_SHIFT|o,0,!0),s})})})}i.CMD_SHIFT=4,i.CMD_MASK=240,i.DUP_MASK=8,i.QOS_MASK=3,i.QOS_SHIFT=1,i.RETAIN_MASK=1,i.LENGTH_MASK=127,i.LENGTH_FIN_MASK=128,i.SESSIONPRESENT_MASK=1,i.SESSIONPRESENT_HEADER=r.from([i.SESSIONPRESENT_MASK]),i.CONNACK_HEADER=r.from([i.codes.connack<<i.CMD_SHIFT]),i.USERNAME_MASK=128,i.PASSWORD_MASK=64,i.WILL_RETAIN_MASK=32,i.WILL_QOS_MASK=24,i.WILL_QOS_SHIFT=3,i.WILL_FLAG_MASK=4,i.CLEAN_SESSION_MASK=2,i.CONNECT_HEADER=r.from([i.codes.connect<<i.CMD_SHIFT]),i.PUBLISH_HEADER=a("publish"),i.SUBSCRIBE_HEADER=a("subscribe"),i.UNSUBSCRIBE_HEADER=a("unsubscribe"),i.ACKS={unsuback:a("unsuback"),puback:a("puback"),pubcomp:a("pubcomp"),pubrel:a("pubrel"),pubrec:a("pubrec")},i.SUBACK_HEADER=r.from([i.codes.suback<<i.CMD_SHIFT]),i.VERSION3=r.from([3]),i.VERSION4=r.from([4]),i.QOS=[0,1,2].map(function(e){return r.from([e])}),i.EMPTY={pingreq:r.from([i.codes.pingreq<<4,0]),pingresp:r.from([i.codes.pingresp<<4,0]),disconnect:r.from([i.codes.disconnect<<4,0])}},{"safe-buffer":164}],123:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=e("./writeToStream"),o=e("events").EventEmitter;function s(){this._array=new Array(20),this._i=0}e("inherits")(s,o),s.prototype.write=function(e){return this._array[this._i++]=e,!0},s.prototype.concat=function(){var e,t,n=0,i=new Array(this._array.length),o=this._array,s=0;for(e=0;e<o.length&&void 0!==o[e];e++)"string"!=typeof o[e]?i[e]=o[e].length:i[e]=r.byteLength(o[e]),n+=i[e];for(t=r.allocUnsafe(n),e=0;e<o.length&&void 0!==o[e];e++)"string"!=typeof o[e]?(o[e].copy(t,s),s+=i[e]):(t.write(o[e],s),s+=i[e]);return t},t.exports=function(e){var t=new s;return i(e,t),t.concat()}},{"./writeToStream":128,events:116,inherits:118,"safe-buffer":164}],124:[function(e,t,n){"use strict";n.parser=e("./parser"),n.generate=e("./generate"),n.writeToStream=e("./writeToStream")},{"./generate":123,"./parser":127,"./writeToStream":128}],125:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=65536,o={};function s(e){var t=r.allocUnsafe(2);return t.writeUInt8(e>>8,0),t.writeUInt8(255&e,1),t}t.exports={cache:o,generateCache:function(){for(var e=0;e<i;e++)o[e]=s(e)},generateNumber:s}},{"safe-buffer":164}],126:[function(e,t,n){t.exports=function(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}},{}],127:[function(e,t,n){"use strict";var r=e("bl"),i=e("inherits"),o=e("events").EventEmitter,s=e("./packet"),a=e("./constants");function c(){if(!(this instanceof c))return new c;this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState()}i(c,o),c.prototype._resetState=function(){this.packet=new s,this.error=null,this._list=r(),this._stateCounter=0},c.prototype.parse=function(e){for(this.error&&this._resetState(),this._list.append(e);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,this._stateCounter>=this._states.length&&(this._stateCounter=0);return this._list.length},c.prototype._parseHeader=function(){var e=this._list.readUInt8(0);return this.packet.cmd=a.types[e>>a.CMD_SHIFT],this.packet.retain=0!=(e&a.RETAIN_MASK),this.packet.qos=e>>a.QOS_SHIFT&a.QOS_MASK,this.packet.dup=0!=(e&a.DUP_MASK),this._list.consume(1),!0},c.prototype._parseLength=function(){for(var e,t=0,n=1,r=0,i=!0;t<5&&(r+=n*((e=this._list.readUInt8(t++))&a.LENGTH_MASK),n*=128,0!=(e&a.LENGTH_FIN_MASK));)if(this._list.length<=t){i=!1;break}return i&&(this.packet.length=r,this._list.consume(t)),i},c.prototype._parsePayload=function(){var e=!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"))}e=!0}return e},c.prototype._parseConnect=function(){var e,t,n,r,i,o,s={},c=this.packet;if(null===(e=this._parseString()))return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==e&&"MQIsdp"!==e)return this._emitError(new Error("Invalid protocolId"));if(c.protocolId=e,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(c.protocolVersion=this._list.readUInt8(this._pos),3!==c.protocolVersion&&4!==c.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.username=this._list.readUInt8(this._pos)&a.USERNAME_MASK,s.password=this._list.readUInt8(this._pos)&a.PASSWORD_MASK,s.will=this._list.readUInt8(this._pos)&a.WILL_FLAG_MASK,s.will&&(c.will={},c.will.retain=0!=(this._list.readUInt8(this._pos)&a.WILL_RETAIN_MASK),c.will.qos=(this._list.readUInt8(this._pos)&a.WILL_QOS_MASK)>>a.WILL_QOS_SHIFT),c.clean=0!=(this._list.readUInt8(this._pos)&a.CLEAN_SESSION_MASK),this._pos++,c.keepalive=this._parseNum(),-1===c.keepalive)return this._emitError(new Error("Packet too short"));if(null===(t=this._parseString()))return this._emitError(new Error("Packet too short"));if(c.clientId=t,s.will){if(null===(n=this._parseString()))return this._emitError(new Error("Cannot parse will topic"));if(c.will.topic=n,null===(r=this._parseBuffer()))return this._emitError(new Error("Cannot parse will payload"));c.will.payload=r}if(s.username){if(null===(o=this._parseString()))return this._emitError(new Error("Cannot parse username"));c.username=o}if(s.password){if(null===(i=this._parseBuffer()))return this._emitError(new Error("Cannot parse password"));c.password=i}return c},c.prototype._parseConnack=function(){var e=this.packet;return this._list.length<2?null:(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&a.SESSIONPRESENT_MASK),e.returnCode=this._list.readUInt8(this._pos),-1===e.returnCode?this._emitError(new Error("Cannot parse return code")):void 0)},c.prototype._parsePublish=function(){var e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));e.qos>0&&!this._parseMessageId()||(e.payload=this._list.slice(this._pos,e.length))},c.prototype._parseSubscribe=function(){var e,t,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===(e=this._parseString()))return this._emitError(new Error("Cannot parse topic"));t=this._list.readUInt8(this._pos++),n.subscriptions.push({topic:e,qos:t})}},c.prototype._parseSuback=function(){if(this.packet.granted=[],this._parseMessageId())for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))},c.prototype._parseUnsubscribe=function(){var e=this.packet;if(e.unsubscriptions=[],this._parseMessageId())for(;this._pos<e.length;){var t;if(null===(t=this._parseString()))return this._emitError(new Error("Cannot parse topic"));e.unsubscriptions.push(t)}},c.prototype._parseUnsuback=function(){if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"))},c.prototype._parseMessageId=function(){var e=this.packet;return e.messageId=this._parseNum(),null!==e.messageId||(this._emitError(new Error("Cannot parse messageId")),!1)},c.prototype._parseString=function(e){var t,n=this._parseNum(),r=n+this._pos;return-1===n||r>this._list.length||r>this.packet.length?null:(t=this._list.toString("utf8",this._pos,r),this._pos+=n,t)},c.prototype._parseBuffer=function(){var e,t=this._parseNum(),n=t+this._pos;return-1===t||n>this._list.length||n>this.packet.length?null:(e=this._list.slice(this._pos,n),this._pos+=t,e)},c.prototype._parseNum=function(){if(this._list.length-this._pos<2)return-1;var e=this._list.readUInt16BE(this._pos);return this._pos+=2,e},c.prototype._newPacket=function(){return this.packet&&(this._list.consume(this.packet.length),this.emit("packet",this.packet)),this.packet=new s,!0},c.prototype._emitError=function(e){this.error=e,this.emit("error",e)},t.exports=c},{"./constants":122,"./packet":126,bl:47,events:116,inherits:118}],128:[function(e,t,n){"use strict";var r=e("./constants"),i=e("safe-buffer").Buffer,o=i.allocUnsafe(0),s=i.from([0]),a=e("./numbers"),c=e("process-nextick-args").nextTick,u=a.cache,f=a.generateNumber,l=a.generateCache,h=y,d=!0;function p(e,t){switch(t.cork&&(t.cork(),c(_,t)),d&&(d=!1,l()),e.cmd){case"connect":return function(e,t){var n=e||{},o=n.protocolId||"MQTT",s=n.protocolVersion||4,a=n.will,c=n.clean,u=n.keepalive||0,f=n.clientId||"",l=n.username,d=n.password;void 0===c&&(c=!0);var p=0;if(!o||"string"!=typeof o&&!i.isBuffer(o))return t.emit("error",new Error("Invalid protocolId")),!1;p+=o.length+2;if(3!==s&&4!==s)return t.emit("error",new Error("Invalid protocol version")),!1;p+=1;if("string"!=typeof f&&!i.isBuffer(f)||!f&&4!==s||!f&&!c){if(s<4)return t.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*c==0)return t.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}else p+=f.length+2;if("number"!=typeof u||u<0||u>65535||u%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;p+=2;if(p+=1,a){if("object"!=typeof a)return t.emit("error",new Error("Invalid will")),!1;if(!a.topic||"string"!=typeof a.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(p+=i.byteLength(a.topic)+2,a.payload&&a.payload){if(!(a.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof a.payload?p+=i.byteLength(a.payload)+2:p+=a.payload.length+2}else p+=2}var _=!1;if(null!=l){if(!w(l))return t.emit("error",new Error("Invalid username")),!1;_=!0,p+=i.byteLength(l)+2}if(null!=d){if(!_)return t.emit("error",new Error("Username is required to use password")),!1;if(!w(d))return t.emit("error",new Error("Invalid password")),!1;p+=C(d)+2}t.write(r.CONNECT_HEADER),v(t,p),b(t,o),t.write(4===s?r.VERSION4:r.VERSION3);var g=0;g|=null!=l?r.USERNAME_MASK:0,g|=null!=d?r.PASSWORD_MASK:0,g|=a&&a.retain?r.WILL_RETAIN_MASK:0,g|=a&&a.qos?a.qos<<r.WILL_QOS_SHIFT:0,g|=a?r.WILL_FLAG_MASK:0,g|=c?r.CLEAN_SESSION_MASK:0,t.write(i.from([g])),h(t,u),b(t,f),a&&(m(t,a.topic),b(t,a.payload));null!=l&&b(t,l);null!=d&&b(t,d);return!0}(e,t);case"connack":return function(e,t){var n=(e||{}).returnCode;if("number"!=typeof n)return t.emit("error",new Error("Invalid return code")),!1;return t.write(r.CONNACK_HEADER),v(t,2),t.write(e.sessionPresent?r.SESSIONPRESENT_HEADER:s),t.write(i.from([n]))}(e,t);case"publish":return function(e,t){var n=e||{},s=n.qos||0,a=n.retain?r.RETAIN_MASK:0,c=n.topic,u=n.payload||o,f=n.messageId,l=0;if("string"==typeof c)l+=i.byteLength(c)+2;else{if(!i.isBuffer(c))return t.emit("error",new Error("Invalid topic")),!1;l+=c.length+2}i.isBuffer(u)?l+=u.length:l+=i.byteLength(u);if(s&&"number"!=typeof f)return t.emit("error",new Error("Invalid messageId")),!1;s&&(l+=2);t.write(r.PUBLISH_HEADER[s][e.dup?1:0][a?1:0]),v(t,l),h(t,C(c)),t.write(c),s>0&&h(t,f);return t.write(u)}(e,t);case"puback":case"pubrec":case"pubrel":case"pubcomp":case"unsuback":return function(e,t){var n=e||{},i=n.cmd||"puback",o=n.messageId,s=n.dup&&"pubrel"===i?r.DUP_MASK:0,a=0;"pubrel"===i&&(a=1);if("number"!=typeof o)return t.emit("error",new Error("Invalid messageId")),!1;return t.write(r.ACKS[i][a][s][0]),v(t,2),h(t,o)}(e,t);case"subscribe":return function(e,t){var n=e||{},o=n.dup?r.DUP_MASK:0,s=n.messageId,a=n.subscriptions,c=0;if("number"!=typeof s)return t.emit("error",new Error("Invalid messageId")),!1;c+=2;if("object"!=typeof a||!a.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(var u=0;u<a.length;u+=1){var f=a[u].topic,l=a[u].qos;if("string"!=typeof f)return t.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof l)return t.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;c+=i.byteLength(f)+2+1}t.write(r.SUBSCRIBE_HEADER[1][o?1:0][0]),v(t,c),h(t,s);for(var d=!0,p=0;p<a.length;p++){var _=a[p],g=_.topic,y=_.qos;m(t,g),d=t.write(r.QOS[y])}return d}(e,t);case"suback":return function(e,t){var n=e||{},o=n.messageId,s=n.granted,a=0;if("number"!=typeof o)return t.emit("error",new Error("Invalid messageId")),!1;a+=2;if("object"!=typeof s||!s.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(var c=0;c<s.length;c+=1){if("number"!=typeof s[c])return t.emit("error",new Error("Invalid qos vector")),!1;a+=1}return t.write(r.SUBACK_HEADER),v(t,a),h(t,o),t.write(i.from(s))}(e,t);case"unsubscribe":return function(e,t){var n=e||{},o=n.messageId,s=n.dup?r.DUP_MASK:0,a=n.unsubscriptions,c=0;if("number"!=typeof o)return t.emit("error",new Error("Invalid messageId")),!1;c+=2;if("object"!=typeof a||!a.length)return t.emit("error",new Error("Invalid unsubscriptions")),!1;for(var u=0;u<a.length;u+=1){if("string"!=typeof a[u])return t.emit("error",new Error("Invalid unsubscriptions")),!1;c+=i.byteLength(a[u])+2}t.write(r.UNSUBSCRIBE_HEADER[1][s?1:0][0]),v(t,c),h(t,o);for(var f=!0,l=0;l<a.length;l++)f=m(t,a[l]);return f}(e,t);case"pingreq":case"pingresp":case"disconnect":return function(e,t){return t.write(r.EMPTY[e.cmd])}(e,t);default:return t.emit("error",new Error("Unknown command")),!1}}function _(e){e.uncork()}Object.defineProperty(p,"cacheNumbers",{get:function(){return h===y},set:function(e){e?(u&&0!==Object.keys(u).length||(d=!0),h=y):(d=!1,h=E)}});var g={};function v(e,t){var n=g[t];n||(n=function(e){var t=0,n=0,r=i.allocUnsafe(function(e){return e>=0&&e<128?1:e>=128&&e<16384?2:e>=16384&&e<2097152?3:e>=2097152&&e<268435456?4:0}(e));do{t=e%128|0,(e=e/128|0)>0&&(t|=128),r.writeUInt8(t,n++)}while(e>0);return r}(t),t<16384&&(g[t]=n)),e.write(n)}function m(e,t){var n=i.byteLength(t);h(e,n),e.write(t,"utf8")}function y(e,t){return e.write(u[t])}function E(e,t){return e.write(f(t))}function b(e,t){"string"==typeof t?m(e,t):t?(h(e,t.length),e.write(t)):h(e,0)}function C(e){return e?e instanceof i?e.length:i.byteLength(e):0}function w(e){return"string"==typeof e||e instanceof i}t.exports=p},{"./constants":122,"./numbers":125,"process-nextick-args":143,"safe-buffer":164}],129:[function(e,t,n){(function(n,r){"use strict";var i=e("events"),o=e("./store"),s=e("end-of-stream"),a=e("mqtt-packet"),c=e("readable-stream").Writable,u=e("inherits"),f=e("reinterval"),l=e("./validations"),h=e("xtend"),d=r.setImmediate||function(e){n.nextTick(e)},p={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0};function _(e,t,n){e.emit("packetsend",t),!a.writeToStream(t,e.stream)&&n?e.stream.once("drain",n):n&&n()}function g(){}function v(e,t){var n,r=this;if(!(this instanceof v))return new v(e,t);for(n in this.options=t||{},p)void 0===this.options[n]?this.options[n]=p[n]:this.options[n]=t[n];this.options.clientId="string"==typeof this.options.clientId?this.options.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),this.streamBuilder=e,this.outgoingStore=this.options.outgoingStore||new o,this.incomingStore=this.options.incomingStore||new o,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 e=null;(e=this.outgoingStore.createStream()).once("readable",function(){!function t(){var n,i=e.read(1);i&&(!r.disconnecting&&!r.reconnectTimer&&r.options.reconnectPeriod>0?(e.read(0),n=r.outgoing[i.messageId],r.outgoing[i.messageId]=function(e,r){n&&n(e,r),t()},r._sendPacket(i)):e.destroy&&e.destroy())}()}).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(){var e=this.queue;!function t(){var n,i=e.shift();i&&(n=i.packet,r._sendPacket(n,function(e){i.cb&&i.cb(e),t()}))}()});var s=!0;this.on("connect",function(){!s&&this.options.clean&&Object.keys(this._resubscribeTopics).length>0&&(this.options.resubscribe?(this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics)):this._resubscribeTopics={}),s=!1}),this.on("close",function(){null!==r.pingTimer&&(r.pingTimer.clear(),r.pingTimer=null)}),this.on("close",this._setupReconnect),i.EventEmitter.call(this),this._setupStream()}u(v,i.EventEmitter),v.prototype._setupStream=function(){var e,t=this,r=new c,i=a.parser(this.options),o=null,u=[];function f(){n.nextTick(l)}function l(){var e=u.shift(),n=o;e?t._handlePacket(e,f):(o=null,n())}this._clearReconnect(),this.stream=this.streamBuilder(this),i.on("packet",function(e){u.push(e)}),r._write=function(e,t,n){o=n,i.parse(e),l()},this.stream.pipe(r),this.stream.on("error",g),s(this.stream,this.emit.bind(this,"close")),(e=Object.create(this.options)).cmd="connect",_(this,e),i.on("error",this.emit.bind(this,"error")),this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){t._cleanUp(!0)},this.options.connectTimeout)},v.prototype._handlePacket=function(e,t){switch(this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"pingresp":this._handlePingresp(e),t()}},v.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},v.prototype.publish=function(e,t,n,r){var i;"function"==typeof n&&(r=n,n=null);if(n=h({qos:0,retain:!1,dup:!1},n),this._checkDisconnecting(r))return this;switch(i={cmd:"publish",topic:e,payload:t,qos:n.qos,retain:n.retain,messageId:this._nextId(),dup:n.dup},n.qos){case 1:case 2:this.outgoing[i.messageId]=r||g,this._sendPacket(i);break;default:this._sendPacket(i,r)}return this},v.prototype.subscribe=function(){var e,t,n=Array.prototype.slice.call(arguments),r=[],i=n.shift(),o=i.resubscribe,s=n.pop()||g,a=n.pop(),c=this;if(delete i.resubscribe,"string"==typeof i&&(i=[i]),"function"!=typeof s&&(a=s,s=g),null!==(t=l.validateTopics(i)))return d(s,new Error("Invalid topic "+t)),this;if(this._checkDisconnecting(s))return this;if(a=h({qos:0},a),Array.isArray(i)?i.forEach(function(e){(c._resubscribeTopics[e]<a.qos||!c._resubscribeTopics.hasOwnProperty(e)||o)&&r.push({topic:e,qos:a.qos})}):Object.keys(i).forEach(function(e){(c._resubscribeTopics[e]<i[e]||!c._resubscribeTopics.hasOwnProperty(e)||o)&&r.push({topic:e,qos:i[e]})}),e={cmd:"subscribe",subscriptions:r,qos:1,retain:!1,dup:!1,messageId:this._nextId()},r.length){if(this.options.resubscribe){var u=[];r.forEach(function(e){c.options.reconnectPeriod>0&&(c._resubscribeTopics[e.topic]=e.qos,u.push(e.topic))}),c.messageIdToTopic[e.messageId]=u}return this.outgoing[e.messageId]=function(e,t){if(!e)for(var n=t.granted,i=0;i<n.length;i+=1)r[i].qos=n[i];s(e,r)},this._sendPacket(e),this}s(null,[])},v.prototype.unsubscribe=function(e,t){var n={cmd:"unsubscribe",qos:1,messageId:this._nextId()},r=this;return t=t||g,this._checkDisconnecting(t)?this:("string"==typeof e?n.unsubscriptions=[e]:"object"==typeof e&&e.length&&(n.unsubscriptions=e),this.options.resubscribe&&n.unsubscriptions.forEach(function(e){delete r._resubscribeTopics[e]}),this.outgoing[n.messageId]=t,this._sendPacket(n),this)},v.prototype.end=function(e,t){var n=this;function r(){n.disconnected=!0,n.incomingStore.close(function(){n.outgoingStore.close(t)}),n._deferredReconnect&&n._deferredReconnect()}function i(){n._cleanUp(e,d.bind(null,r))}return"function"==typeof e&&(t=e,e=!1),this.disconnecting?this:(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?this.once("outgoingEmpty",setTimeout.bind(null,i,10)):i(),this)},v.prototype.removeOutgoingMessage=function(e){var t=this.outgoing[e];return delete this.outgoing[e],this.outgoingStore.del({messageId:e},function(){t(new Error("Message removed"))}),this},v.prototype.reconnect=function(e){var t=this,n=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new o,t.outgoingStore=t.options.outgoingStore||new o,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=n:n(),this},v.prototype._reconnect=function(){this.emit("reconnect"),this._setupStream()},v.prototype._setupReconnect=function(){var e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0&&(this.reconnecting||(this.emit("offline"),this.reconnecting=!0),e.reconnectTimer=setInterval(function(){e._reconnect()},e.options.reconnectPeriod))},v.prototype._clearReconnect=function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},v.prototype._cleanUp=function(e,t){t&&this.stream.on("close",t),e?this.stream.destroy():this._sendPacket({cmd:"disconnect"},d.bind(null,this.stream.end.bind(this.stream))),this.disconnecting||(this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null)},v.prototype._sendPacket=function(e,t){if(this.connected)if(this._shiftPingInterval(),"publish"===e.cmd)switch(e.qos){case 2:case 1:!function(e,t,n){e.outgoingStore.put(t,function(r){if(r)return n&&n(r);_(e,t,n)})}(this,e,t);break;case 0:default:_(this,e,t)}else _(this,e,t);else 0===(e.qos||0)&&this.queueQoSZero||"publish"!==e.cmd?this.queue.push({packet:e,cb:t}):e.qos>0?(t=this.outgoing[e.messageId],this.outgoingStore.put(e,function(e){if(e)return t&&t(e)})):t&&t(new Error("No connection to broker"))},v.prototype._setupPingTimer=function(){var e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=f(function(){e._checkPing()},1e3*this.options.keepalive))},v.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},v.prototype._checkPing=function(){this.pingResp?(this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):this._cleanUp(!0)},v.prototype._handlePingresp=function(){this.pingResp=!0},v.prototype._handleConnack=function(e){var t=e.returnCode;if(clearTimeout(this.connackTimer),0===t)this.reconnecting=!1,this.emit("connect",e);else if(t>0){var n=new Error("Connection refused: "+["","Unacceptable protocol version","Identifier rejected","Server unavailable","Bad username or password","Not authorized"][t]);n.code=t,this.emit("error",n)}},v.prototype._handlePublish=function(e,t){var n=e.topic.toString(),r=e.payload,i=e.qos,o=e.messageId,s=this;switch(i){case 2:this.incomingStore.put(e,function(){s._sendPacket({cmd:"pubrec",messageId:o},t)});break;case 1:this.emit("message",n,r,e),this.handleMessage(e,function(e){if(e)return t&&t(e);s._sendPacket({cmd:"puback",messageId:o},t)});break;case 0:this.emit("message",n,r,e),this.handleMessage(e,t)}},v.prototype.handleMessage=function(e,t){t()},v.prototype._handleAck=function(e){var t=e.messageId,n=e.cmd,r=null,i=this.outgoing[t],o=this;if(i){switch(n){case"pubcomp":case"puback":delete this.outgoing[t],this.outgoingStore.del(e,i);break;case"pubrec":r={cmd:"pubrel",qos:2,messageId:t},this._sendPacket(r);break;case"suback":if(delete this.outgoing[t],1===e.granted.length&&0!=(128&e.granted[0])){var s=this.messageIdToTopic[t];s&&s.forEach(function(e){delete o._resubscribeTopics[e]})}i(null,e);break;case"unsuback":delete this.outgoing[t],i(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}},v.prototype._handlePubrel=function(e,t){var n=this,r={cmd:"pubcomp",messageId:e.messageId};n.incomingStore.get(e,function(i,o){i||"pubrel"===o.cmd?n._sendPacket(r,t):(n.emit("message",o.topic,o.payload,o),n.incomingStore.put(e),n.handleMessage(o,function(e){if(e)return t&&t(e);n._sendPacket(r,t)}))})},v.prototype._nextId=function(){var e=this.nextId++;return 65535===e&&(this.nextId=1),e},v.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},t.exports=v}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./store":135,"./validations":136,_process:144,"end-of-stream":113,events:116,inherits:118,"mqtt-packet":124,"readable-stream":161,reinterval:162,xtend:187}],130:[function(e,t,n){(function(n){"use strict";var r=e("../client"),i=e("../store"),o=e("url"),s=e("xtend"),a={};function c(e,t){if("object"!=typeof e||t||(t=e,e=null),t=t||{},e){var n=o.parse(e,!0);if(null!=n.port&&(n.port=Number(n.port)),null===(t=s(n,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(function(e){var t;e.auth&&((t=e.auth.match(/^(.+):(.+)$/))?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!a[t.protocol]){var i=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs"].filter(function(e,t){return(!i||t%2!=0)&&"function"==typeof a[e]})[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");return new r(function(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.hostname=t.host,e._reconnectCount++),a[t.protocol](e,t)},t)}"browser"!==n.title?(a.mqtt=e("./tcp"),a.tcp=e("./tcp"),a.ssl=e("./tls"),a.tls=e("./tls"),a.mqtts=e("./tls")):(a.wx=e("./wx"),a.wxs=e("./wx")),a.ws=e("./ws"),a.wss=e("./ws"),t.exports=c,t.exports.connect=c,t.exports.MqttClient=r,t.exports.Store=i}).call(this,e("_process"))},{"../client":129,"../store":135,"./tcp":131,"./tls":132,"./ws":133,"./wx":134,_process:144,url:169,xtend:187}],131:[function(e,t,n){"use strict";var r=e("net");t.exports=function(e,t){var n,i;return t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost",n=t.port,i=t.hostname,r.createConnection(n,i)}},{net:49}],132:[function(e,t,n){"use strict";var r=e("tls");t.exports=function(e,t){var n;function i(r){t.rejectUnauthorized&&e.emit("error",r),n.end()}return t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,(n=r.connect(t)).on("secureConnect",function(){t.rejectUnauthorized&&!n.authorized?n.emit("error",new Error("TLS not authorized")):n.removeListener("error",i)}),n.on("error",i),n}},{tls:49}],133:[function(e,t,n){(function(n){"use strict";var r=e("websocket-stream"),i=e("url"),o=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],s="browser"===n.title;function a(e,t){var n="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.port||("wss"===e.protocol?e.port=443:e.port=80),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={}),s||"wss"!==e.protocol||o.forEach(function(t){e.hasOwnProperty(t)&&!e.wsOptions.hasOwnProperty(t)&&(e.wsOptions[t]=e[t])})}(t);var i=function(e,t){var n=e.protocol+"://"+e.hostname+":"+e.port+e.path;return"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return r(i,[n],t.wsOptions)}t.exports=s?function(e,t){if(t.hostname||(t.hostname=t.host),!t.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");var n=i.parse(document.URL);t.hostname=n.hostname,t.port||(t.port=n.port)}return a(e,t)}:function(e,t){return a(e,t)}}).call(this,e("_process"))},{_process:144,url:169,"websocket-stream":184}],134:[function(e,t,n){"use strict";var r=!1,i=[];function o(e){r?wx.sendSocketMessage({data:e}):i.push(e)}var s=e("websocket-stream"),a=e("url");function c(e,t){var n="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.port||("wss"===e.protocol?e.port=443:e.port=80),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);var a=function(e,t){var n=("wxs"===e.protocol?"wss":"ws")+"://"+e.hostname+":"+e.port+e.path;return"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return s(function(e,t){var n={OPEN:1,CLOSING:2,CLOSED:3,readyState:r?1:0,send:o,close:wx.closeSocket,onopen:null,onmessage:null,onclose:null,onerror:null};return wx.connectSocket({url:e,protocols:t}),wx.onSocketOpen(function(e){n.readyState=n.OPEN,r=!0;for(var t=0;t<i.length;t++)o(i[t]);i=[],n.onopen&&n.onopen.apply(n,arguments)}),wx.onSocketMessage(function(e){n.onmessage&&n.onmessage.apply(n,arguments)}),wx.onSocketClose(function(){n.onclose&&n.onclose.apply(n,arguments),n.readyState=n.CLOSED,r=!1}),wx.onSocketError(function(){n.onerror&&n.onerror.apply(n,arguments),n.readyState=n.CLOSED,r=!1}),n}(a,[n]))}t.exports=function(e,t){if(t.hostname||(t.hostname=t.host),!t.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");var n=a.parse(document.URL);t.hostname=n.hostname,t.port||(t.port=n.port)}return c(e,t)}},{url:169,"websocket-stream":184}],135:[function(e,t,n){(function(n){"use strict";var r=e("xtend"),i=e("readable-stream").Readable,o={objectMode:!0},s={clean:!0};function a(e){if(!(this instanceof a))return new a(e);this.options=e||{},this.options=r(s,e),this._inflights={}}a.prototype.put=function(e,t){return this._inflights[e.messageId]=e,t&&t(),this},a.prototype.createStream=function(){var e=new i(o),t=this._inflights,r=Object.keys(this._inflights),s=!1,a=0;return e._read=function(){!s&&a<r.length?this.push(t[r[a++]]):this.push(null)},e.destroy=function(){if(!s){var e=this;s=!0,n.nextTick(function(){e.emit("close")})}},e},a.prototype.del=function(e,t){return(e=this._inflights[e.messageId])?(delete this._inflights[e.messageId],t(null,e)):t&&t(new Error("missing packet")),this},a.prototype.get=function(e,t){return(e=this._inflights[e.messageId])?t(null,e):t&&t(new Error("missing packet")),this},a.prototype.close=function(e){this.options.clean&&(this._inflights=null),e&&e()},t.exports=a}).call(this,e("_process"))},{_process:144,"readable-stream":161,xtend:187}],136:[function(e,t,n){"use strict";function r(e){for(var t=e.split("/"),n=0;n<t.length;n++)if("+"!==t[n]){if("#"===t[n])return n===t.length-1;if(-1!==t[n].indexOf("+")||-1!==t[n].indexOf("#"))return!1}return!0}t.exports={validateTopics:function(e){if(0===e.length)return"empty_topic_list";for(var t=0;t<e.length;t++)if(!r(e[t]))return e[t];return null}}},{}],137:[function(e,t,n){function r(e,t){if(!e)throw new Error(t||"AssertionError")}r.notEqual=function(e,t,n){r(e!=t,n)},r.notOk=function(e,t){r(!e,t)},r.equal=function(e,t,n){r(e==t,n)},r.ok=r,t.exports=r},{}],138:[function(e,t,n){var r=e("remove-array-items"),i=e("nanotiming"),o=e("assert");function s(e){if(!(this instanceof s))return new s(e);this._name=e||"nanobus",this._starListeners=[],this._listeners={}}t.exports=s,s.prototype.emit=function(e){o.equal(typeof e,"string","nanobus.emit: eventName should be type string");for(var t=[],n=1,r=arguments.length;n<r;n++)t.push(arguments[n]);var s=i(this._name+"('"+e+"')"),a=this._listeners[e];return a&&a.length>0&&this._emit(this._listeners[e],t),this._starListeners.length>0&&this._emit(this._starListeners,e,t,s.uuid),s(),this},s.prototype.on=s.prototype.addListener=function(e,t){return o.equal(typeof e,"string","nanobus.on: eventName should be type string"),o.equal(typeof t,"function","nanobus.on: listener should be type function"),"*"===e?this._starListeners.push(t):(this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)),this},s.prototype.prependListener=function(e,t){return o.equal(typeof e,"string","nanobus.prependListener: eventName should be type string"),o.equal(typeof t,"function","nanobus.prependListener: listener should be type function"),"*"===e?this._starListeners.unshift(t):(this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].unshift(t)),this},s.prototype.once=function(e,t){o.equal(typeof e,"string","nanobus.once: eventName should be type string"),o.equal(typeof t,"function","nanobus.once: listener should be type function");var n=this;return this.on(e,function r(){t.apply(n,arguments);n.removeListener(e,r)}),this},s.prototype.prependOnceListener=function(e,t){o.equal(typeof e,"string","nanobus.prependOnceListener: eventName should be type string"),o.equal(typeof t,"function","nanobus.prependOnceListener: listener should be type function");var n=this;return this.prependListener(e,function r(){t.apply(n,arguments);n.removeListener(e,r)}),this},s.prototype.removeListener=function(e,t){return o.equal(typeof e,"string","nanobus.removeListener: eventName should be type string"),o.equal(typeof t,"function","nanobus.removeListener: listener should be type function"),"*"===e?(this._starListeners=this._starListeners.slice(),n(this._starListeners,t)):(void 0!==this._listeners[e]&&(this._listeners[e]=this._listeners[e].slice()),n(this._listeners[e],t));function n(e,t){if(e){var n=e.indexOf(t);return-1!==n?(r(e,n,1),!0):void 0}}},s.prototype.removeAllListeners=function(e){return e?"*"===e?this._starListeners=[]:this._listeners[e]=[]:(this._starListeners=[],this._listeners={}),this},s.prototype.listeners=function(e){var t="*"!==e?this._listeners[e]:this._starListeners,n=[];if(t)for(var r=t.length,i=0;i<r;i++)n.push(t[i]);return n},s.prototype._emit=function(e,t,n,r){if(void 0!==e&&0!==e.length){void 0===n&&(n=t,t=null),t&&(n=void 0!==r?[t].concat(n,r):[t].concat(n));for(var i=e.length,o=0;o<i;o++){var s=e[o];s.apply(s,n)}}}},{assert:137,nanotiming:140,"remove-array-items":163}],139:[function(e,t,n){var r=e("assert"),i="undefined"!=typeof window;function o(e){this.hasWindow=e,this.hasIdle=this.hasWindow&&window.requestIdleCallback,this.method=this.hasIdle?window.requestIdleCallback.bind(window):this.setTimeout,this.scheduled=!1,this.queue=[]}o.prototype.push=function(e){r.equal(typeof e,"function","nanoscheduler.push: cb should be type function"),this.queue.push(e),this.schedule()},o.prototype.schedule=function(){if(!this.scheduled){this.scheduled=!0;var e=this;this.method(function(t){for(;e.queue.length&&t.timeRemaining()>0;)e.queue.shift()(t);e.scheduled=!1,e.queue.length&&e.schedule()})}},o.prototype.setTimeout=function(e){setTimeout(e,0,{timeRemaining:function(){return 1}})},t.exports=function(){var e;return i?(window._nanoScheduler||(window._nanoScheduler=new o(!0)),e=window._nanoScheduler):e=new o,e}},{assert:137}],140:[function(e,t,n){var r,i=e("nanoscheduler")(),o=e("assert");s.disabled=!0;try{r=window.performance,s.disabled="true"===window.localStorage.DISABLE_NANOTIMING||!r.mark}catch(e){}function s(e){if(o.equal(typeof e,"string","nanotiming: name should be type string"),s.disabled)return a;var t=(1e4*r.now()).toFixed()%Number.MAX_SAFE_INTEGER,n="start-"+t+"-"+e;function c(o){var s="end-"+t+"-"+e;r.mark(s),i.push(function(){var i=null;try{var a=e+" ["+t+"]";r.measure(a,n,s),r.clearMarks(n),r.clearMarks(s)}catch(e){i=e}o&&o(i,e)})}return r.mark(n),c.uuid=t,c}function a(e){e&&i.push(function(){e(new Error("nanotiming: performance API unavailable"))})}t.exports=s},{assert:137,nanoscheduler:139}],141:[function(e,t,n){var r=e("wrappy");function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}t.exports=r(i),t.exports.strict=r(o),i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})})},{wrappy:186}],142:[function(e,t,n){(function(e){
// distribute, sublicense, and/or sell copies of the Software, and to permit
function t(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}n.resolve=function(){for(var n="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(n=s+"/"+n,i="/"===s.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var o=n.isAbsolute(e),s="/"===i(e,-1);return(e=t(r(e.split("/"),function(e){return!!e}),!o).join("/"))||o||(e="."),e&&s&&(e+="/"),(o?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),o=r(t.split("/")),s=Math.min(i.length,o.length),a=s,c=0;c<s;c++)if(i[c]!==o[c]){a=c;break}var u=[];for(c=a;c<i.length;c++)u.push("..");return(u=u.concat(o.slice(a))).join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,r=-1,i=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},n.basename=function(e,t){var n=function(e){"string"!=typeof e&&(e+="");var t,n=0,r=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){n=t+1;break}}else-1===r&&(i=!1,r=t+1);return-1===r?"":e.slice(n,r)}(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===r&&(i=!1,r=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){n=s+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===n+1?"":e.slice(t,r)};var i="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,e("_process"))},{_process:144}],143:[function(e,t,n){(function(e){"use strict";!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(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)})}}}:t.exports=e}).call(this,e("_process"))},{_process:144}],144:[function(e,t,n){var r,i,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var u,f=[],l=!1,h=-1;function d(){l&&u&&(l=!1,u.length?f=u.concat(f):h=-1,f.length&&p())}function p(){if(!l){var e=c(d);l=!0;for(var t=f.length;t;){for(u=f,f=[];++h<t;)u&&u[h].run();h=-1,t=f.length}u=null,l=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function _(e,t){this.fun=e,this.array=t}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new _(e,t)),1!==f.length||l||c(p)},_.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],145:[function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty;function i(e,t){return Array.isArray(e)?function(e,t){for(var n,r="",o="",s=Array.isArray(t),a=0;a<e.length;a++)(n=i(e[a]))&&(s&&t[a]&&(n=c(n)),r=r+o+n,o=" ");return r}(e,t):e&&"object"==typeof e?function(e){var t="",n="";for(var i in e)i&&e[i]&&r.call(e,i)&&(t=t+n+i,n=" ");return t}(e):e||""}function o(e){if(!e)return"";if("object"==typeof e){var t="";for(var n in e)r.call(e,n)&&(t=t+n+":"+e[n]+";");return t}return e+""}function s(e,t,n,r){return!1!==t&&null!=t&&(t||"class"!==e&&"style"!==e)?!0===t?" "+(r?e:e+'="'+e+'"'):("function"==typeof t.toJSON&&(t=t.toJSON()),"string"==typeof t||(t=JSON.stringify(t),n||-1===t.indexOf('"'))?(n&&(t=c(t))," "+e+'="'+t+'"'):" "+e+"='"+t.replace(/'/g,"&#39;")+"'"):""}n.merge=function e(t,n){if(1===arguments.length){for(var r=t[0],i=1;i<t.length;i++)r=e(r,t[i]);return r}for(var s in n)if("class"===s){var a=t[s]||[];t[s]=(Array.isArray(a)?a:[a]).concat(n[s]||[])}else if("style"===s){var a=o(t[s]);a=a&&";"!==a[a.length-1]?a+";":a;var c=o(n[s]);c=c&&";"!==c[c.length-1]?c+";":c,t[s]=a+c}else t[s]=n[s];return t},n.classes=i,n.style=o,n.attr=s,n.attrs=function(e,t){var n="";for(var a in e)if(r.call(e,a)){var c=e[a];if("class"===a){c=i(c),n=s(a,c,!1,t)+n;continue}"style"===a&&(c=o(c)),n+=s(a,c,!1,t)}return n};var a=/["&<>]/;function c(e){var t=""+e,n=a.exec(t);if(!n)return e;var r,i,o,s="";for(r=n.index,i=0;r<t.length;r++){switch(t.charCodeAt(r)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;case 62:o="&gt;";break;default:continue}i!==r&&(s+=t.substring(i,r)),i=r+1,s+=o}return i!==r?s+t.substring(i,r):s}n.escape=c,n.rethrow=function t(n,r,i,o){if(!(n instanceof Error))throw n;if(!("undefined"==typeof window&&r||o))throw n.message+=" on line "+i,n;try{o=o||e("fs").readFileSync(r,"utf8")}catch(e){t(n,null,i)}var s=3,a=o.split("\n"),c=Math.max(i-s,0),u=Math.min(a.length,i+s);var s=a.slice(c,u).map(function(e,t){var n=t+c+1;return(n==i?"  > ":"    ")+n+"| "+e}).join("\n");n.path=r;n.message=(r||"Pug")+":"+i+"\n"+s+"\n\n"+n.message;throw n}},{fs:49}],146:[function(e,t,n){(function(e){!function(r){var i="object"==typeof n&&n&&!n.nodeType&&n,o="object"==typeof t&&t&&!t.nodeType&&t,s="object"==typeof e&&e;s.global!==s&&s.window!==s&&s.self!==s||(r=s);var a,c,u=2147483647,f=36,l=1,h=26,d=38,p=700,_=72,g=128,v="-",m=/^xn--/,y=/[^\x20-\x7E]/,E=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=f-l,w=Math.floor,T=String.fromCharCode;function R(e){throw RangeError(b[e])}function S(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function I(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+S((e=e.replace(E,".")).split("."),t).join(".")}function N(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function O(e){return S(e,function(e){var t="";return e>65535&&(t+=T((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=T(e)}).join("")}function A(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function B(e,t,n){var r=0;for(e=n?w(e/p):e>>1,e+=w(e/t);e>C*h>>1;r+=f)e=w(e/C);return w(r+(C+1)*e/(e+d))}function k(e){var t,n,r,i,o,s,a,c,d,p,m,y=[],E=e.length,b=0,C=g,T=_;for((n=e.lastIndexOf(v))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&R("not-basic"),y.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<E;){for(o=b,s=1,a=f;i>=E&&R("invalid-input"),((c=(m=e.charCodeAt(i++))-48<10?m-22:m-65<26?m-65:m-97<26?m-97:f)>=f||c>w((u-b)/s))&&R("overflow"),b+=c*s,!(c<(d=a<=T?l:a>=T+h?h:a-T));a+=f)s>w(u/(p=f-d))&&R("overflow"),s*=p;T=B(b-o,t=y.length+1,0==o),w(b/t)>u-C&&R("overflow"),C+=w(b/t),b%=t,y.splice(b++,0,C)}return O(y)}function x(e){var t,n,r,i,o,s,a,c,d,p,m,y,E,b,C,S=[];for(y=(e=N(e)).length,t=g,n=0,o=_,s=0;s<y;++s)(m=e[s])<128&&S.push(T(m));for(r=i=S.length,i&&S.push(v);r<y;){for(a=u,s=0;s<y;++s)(m=e[s])>=t&&m<a&&(a=m);for(a-t>w((u-n)/(E=r+1))&&R("overflow"),n+=(a-t)*E,t=a,s=0;s<y;++s)if((m=e[s])<t&&++n>u&&R("overflow"),m==t){for(c=n,d=f;!(c<(p=d<=o?l:d>=o+h?h:d-o));d+=f)C=c-p,b=f-p,S.push(T(A(p+C%b,0))),c=w(C/b);S.push(T(A(c,0))),o=B(n,E,r==i),n=0,++r}++n,++t}return S.join("")}if(a={version:"1.3.2",ucs2:{decode:N,encode:O},decode:k,encode:x,toASCII:function(e){return I(e,function(e){return y.test(e)?"xn--"+x(e):e})},toUnicode:function(e){return I(e,function(e){return m.test(e)?k(e.slice(4).toLowerCase()):e})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return a});else if(i&&o)if(t.exports==i)o.exports=a;else for(c in a)a.hasOwnProperty(c)&&(i[c]=a[c]);else r.punycode=a}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],147:[function(e,t,n){
// distribute, sublicense, and/or sell copies of the Software, and to permit
"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var c=1e3;o&&"number"==typeof o.maxKeys&&(c=o.maxKeys);var u=e.length;c>0&&u>c&&(u=c);for(var f=0;f<u;++f){var l,h,d,p,_=e[f].replace(a,"%20"),g=_.indexOf(n);g>=0?(l=_.substr(0,g),h=_.substr(g+1)):(l=_,h=""),d=decodeURIComponent(l),p=decodeURIComponent(h),r(s,d)?i(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],148:[function(e,t,n){
// distribute, sublicense, and/or sell copies of the Software, and to permit
"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(r(e))}).join(t):a+encodeURIComponent(r(e[s]))}).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},{}],149:[function(e,t,n){"use strict";n.decode=n.parse=e("./decode"),n.encode=n.stringify=e("./encode")},{"./decode":147,"./encode":148}],150:[function(e,t,n){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":151}],151:[function(e,t,n){
// distribute, sublicense, and/or sell copies of the Software, and to permit
"use strict";var r=e("process-nextick-args"),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=l;var o=e("core-util-is");o.inherits=e("inherits");var s=e("./_stream_readable"),a=e("./_stream_writable");o.inherits(l,s);for(var c=i(a.prototype),u=0;u<c.length;u++){var f=c[u];l.prototype[f]||(l.prototype[f]=a.prototype[f])}function l(e){if(!(this instanceof l))return new l(e);s.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",h)}function h(){this.allowHalfOpen||this._writableState.ended||r.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),l.prototype._destroy=function(e,t){this.push(null),this.end(),r.nextTick(t,e)}},{"./_stream_readable":153,"./_stream_writable":155,"core-util-is":77,inherits:118,"process-nextick-args":143}],152:[function(e,t,n){
// distribute, sublicense, and/or sell copies of the Software, and to permit
"use strict";t.exports=o;var r=e("./_stream_transform"),i=e("core-util-is");function o(e){if(!(this instanceof o))return new o(e);r.call(this,e)}i.inherits=e("inherits"),i.inherits(o,r),o.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":154,"core-util-is":77,inherits:118}],153:[function(e,t,n){(function(n,r){
// distribute, sublicense, and/or sell copies of the Software, and to permit
"use strict";var i=e("process-nextick-args");t.exports=y;var o,s=e("isarray");y.ReadableState=m;e("events").EventEmitter;var a=function(e,t){return e.listeners(t).length},c=e("./internal/streams/stream"),u=e("safe-buffer").Buffer,f=r.Uint8Array||function(){};var l=e("core-util-is");l.inherits=e("inherits");var h=e("util"),d=void 0;d=h&&h.debuglog?h.debuglog("stream"):function(){};var p,_=e("./internal/streams/BufferList"),g=e("./internal/streams/destroy");l.inherits(y,c);var v=["error","close","destroy","pause","resume"];function m(t,n){o=o||e("./_stream_duplex"),t=t||{};var r=n instanceof o;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,s=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new _,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&&(p||(p=e("string_decoder/").StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function y(t){if(o=o||e("./_stream_duplex"),!(this instanceof y))return new y(t);this._readableState=new m(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),c.call(this)}function E(e,t,n,r,i){var o,s=e._readableState;null===t?(s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,T(e)}(e,s)):(i||(o=function(e,t){var n;r=t,u.isBuffer(r)||r instanceof f||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(s,t)),o?e.emit("error",o):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):b(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?b(e,s,t,!1):S(e,s)):b(e,s,t,!1))):r||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(s)}function b(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&T(e)),S(e,t)}Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),y.prototype.destroy=g.destroy,y.prototype._undestroy=g.undestroy,y.prototype._destroy=function(e,t){this.push(null),t(e)},y.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=u.from(e,t),t=""),n=!0),E(this,e,t,!1,n)},y.prototype.unshift=function(e){return E(this,e,null,!0,!1)},y.prototype.isPaused=function(){return!1===this._readableState.flowing},y.prototype.setEncoding=function(t){return p||(p=e("string_decoder/").StringDecoder),this._readableState.decoder=new p(t),this._readableState.encoding=t,this};var C=8388608;function w(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=C?e=C:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function T(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(R,e):R(e))}function R(e){d("emit readable"),e.emit("readable"),A(e)}function S(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(I,e,t))}function I(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(d("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function N(e){d("readable nexttick read 0"),e.read(0)}function O(e,t){t.reading||(d("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),A(e),t.flowing&&!t.reading&&e.read(0)}function A(e){var t=e._readableState;for(d("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;e-=i.length;for(;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=u.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),0===(e-=s)){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function k(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(x,t,e))}function x(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function D(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}y.prototype.read=function(e){d("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?k(this):T(this),null;if(0===(e=w(e,t))&&t.ended)return 0===t.length&&k(this),null;var r,i=t.needReadable;return d("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&d("length less than watermark",i=!0),t.ended||t.reading?d("reading or ended",i=!1):i&&(d("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=w(n,t))),null===(r=e>0?B(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&k(this)),null!==r&&this.emit("data",r),r},y.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,d("pipe count=%d opts=%j",o.pipesCount,t);var c=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?f:y;function u(t,n){d("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,d("cleanup"),e.removeListener("close",v),e.removeListener("finish",m),e.removeListener("drain",l),e.removeListener("error",g),e.removeListener("unpipe",u),r.removeListener("end",f),r.removeListener("end",y),r.removeListener("data",_),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function f(){d("onend"),e.end()}o.endEmitted?i.nextTick(c):r.once("end",c),e.on("unpipe",u);var l=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,A(e))}}(r);e.on("drain",l);var h=!1;var p=!1;function _(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==D(o.pipes,e))&&!h&&(d("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function g(t){d("onerror",t),y(),e.removeListener("error",g),0===a(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",m),y()}function m(){d("onfinish"),e.removeListener("close",v),y()}function y(){d("unpipe"),r.unpipe(e)}return r.on("data",_),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",g),e.once("close",v),e.once("finish",m),e.emit("pipe",r),o.flowing||(d("pipe resume"),r.resume()),e},y.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,n);return this}var s=D(t.pipes,e);return-1===s?this:(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)},y.prototype.on=function(e,t){var n=c.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&T(this):i.nextTick(N,this))}return n},y.prototype.addListener=y.prototype.on,y.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(O,e,t))}(this,e)),this},y.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this},y.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(d("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(d("wrapped data"),n.decoder&&(i=n.decoder.write(i)),!n.objectMode||null!==i&&void 0!==i)&&((n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause())))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<v.length;o++)e.on(v[o],this.emit.bind(this,v[o]));return this._read=function(t){d("wrapped _read",t),r&&(r=!1,e.resume())},this},Object.defineProperty(y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),y._fromList=B}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":151,"./internal/streams/BufferList":156,"./internal/streams/destroy":157,"./internal/streams/stream":158,_process:144,"core-util-is":77,events:116,inherits:118,isarray:159,"process-nextick-args":143,"safe-buffer":164,"string_decoder/":160,util:49}],154:[function(e,t,n){
// distribute, sublicense, and/or sell copies of the Software, and to permit
"use strict";t.exports=o;var r=e("./_stream_duplex"),i=e("core-util-is");function o(e){if(!(this instanceof o))return new o(e);r.call(this,e),this._transformState={afterTransform:function(e,t){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!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",s)}function s(){var e=this;"function"==typeof this._flush?this._flush(function(t,n){a(e,t,n)}):a(this,null,null)}function a(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}i.inherits=e("inherits"),i.inherits(o,r),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,r.prototype.push.call(this,e,t)},o.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},o.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},o.prototype._destroy=function(e,t){var n=this;r.prototype._destroy.call(this,e,function(e){t(e),n.emit("close")})}},{"./_stream_duplex":151,"core-util-is":77,inherits:118}],155:[function(e,t,n){(function(n,r,i){
// distribute, sublicense, and/or sell copies of the Software, and to permit
"use strict";var o=e("process-nextick-args");function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}t.exports=m;var a,c=!n.browser&&["v0.10","v0.9."].indexOf(n.version.slice(0,5))>-1?i:o.nextTick;m.WritableState=v;var u=e("core-util-is");u.inherits=e("inherits");var f={deprecate:e("util-deprecate")},l=e("./internal/streams/stream"),h=e("safe-buffer").Buffer,d=r.Uint8Array||function(){};var p,_=e("./internal/streams/destroy");function g(){}function v(t,n){a=a||e("./_stream_duplex"),t=t||{};var r=n instanceof a;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,u=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(u||0===u)?u:f,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 l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(o.nextTick(i,r),o.nextTick(T,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),T(e,t))}(e,n,r,t,i);else{var s=C(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||b(e,n),r?c(E,e,n,s,i):E(e,n,s,i)}}(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function m(t){if(a=a||e("./_stream_duplex"),!(p.call(m,this)||this instanceof a))return new m(t);this._writableState=new v(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)),l.call(this)}function y(e,t,n,r,i,o,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function E(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),T(e,t)}function b(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0,c=!0;n;)i[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;i.allBuffers=c,y(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,f=n.encoding,l=n.callback;if(y(e,t,!1,t.objectMode?1:u.length,u,f,l),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function C(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function w(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),T(e,t)})}function T(e,t){var n=C(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(w,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}u.inherits(m,l),v.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(v.prototype,"buffer",{get:f.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===m&&(e&&e._writableState instanceof v)}})):p=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,n){var r,i=this._writableState,s=!1,a=!i.objectMode&&(r=e,h.isBuffer(r)||r instanceof d);return a&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=g),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),o.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var i=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),o.nextTick(r,s),i=!1),i}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,n,r,i,o){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else y(e,t,!1,a,r,i,o);return c}(this,i,a,e,t,n)),s},m.prototype.cork=function(){this._writableState.corked++},m.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||b(this,e))},m.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,T(e,t),n&&(t.finished?o.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=_.destroy,m.prototype._undestroy=_.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{"./_stream_duplex":151,"./internal/streams/destroy":157,"./internal/streams/stream":158,_process:144,"core-util-is":77,inherits:118,"process-nextick-args":143,"safe-buffer":164,timers:167,"util-deprecate":171}],156:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=e("util");t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,i,o=r.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=o,i=a,t.copy(n,i),a+=s.data.length,s=s.next;return o},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":164,util:49}],157:[function(e,t,n){"use strict";var r=e("process-nextick-args");function i(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var n=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(i,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){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)}}},{"process-nextick-args":143}],158:[function(e,t,n){t.exports=e("events").EventEmitter},{events:116}],159:[function(e,t,n){var r={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},{}],160:[function(e,t,n){
// distribute, sublicense, and/or sell copies of the Software, and to permit
"use strict";var r=e("safe-buffer").Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=f,this.end=l,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function f(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}n.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var i=s(t[r]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if((i=s(t[r]))>=0)return i>0&&(e.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if((i=s(t[r]))>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":164}],161:[function(e,t,n){(n=t.exports=e("./lib/_stream_readable.js")).Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":151,"./lib/_stream_passthrough.js":152,"./lib/_stream_readable.js":153,"./lib/_stream_transform.js":154,"./lib/_stream_writable.js":155}],162:[function(e,t,n){"use strict";t.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new function(e,t,n){var r=this;this._callback=e,this._args=n,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=r._interval),r._interval&&clearInterval(r._interval),r._interval=setInterval(r._callback,e,r._args)},this.clear=function(){r._interval&&(clearInterval(r._interval),r._interval=void 0)},this.destroy=function(){r._interval&&clearInterval(r._interval),r._callback=void 0,r._interval=void 0,r._args=void 0}}(arguments[0],arguments[1],e)}},{}],163:[function(e,t,n){"use strict";t.exports=function(e,t,n){var r,i=e.length;if(!(t>=i||0===n)){var o=i-(n=t+n>i?i-t:n);for(r=t;r<o;++r)e[r]=e[r+n];e.length=o}}},{}],164:[function(e,t,n){arguments[4][48][0].apply(n,arguments)},{buffer:51,dup:48}],165:[function(e,t,n){"use strict";var r={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},r.splitSections=function(e){return e.split("\nm=").map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})},r.matchPrefix=function(e,t){return r.splitLines(e).filter(function(e){return 0===e.indexOf(t)})},r.parseCandidate=function(e){for(var t,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;default:n[t[r]]=t[r+1]}return n},r.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),"candidate:"+t.join(" ")},r.parseIceOptions=function(e){return e.substr(14).split(" ")},r.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.numChannels=3===t.length?parseInt(t[2],10):1,n},r.writeRtpMap=function(e){var t=e.payloadType;return void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType),"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==e.numChannels?"/"+e.numChannels:"")+"\r\n"},r.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},r.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},r.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach(function(t){r.push(t+"="+e.parameters[t])}),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},r.writeRtcpFb=function(e){var t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},r.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},r.getMid=function(e){var t=r.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},r.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},r.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:r.matchPrefix(e+t,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},r.getIceParameters=function(e,t){var n=r.splitLines(e);return{usernameFragment:(n=n.concat(r.splitLines(t))).filter(function(e){return 0===e.indexOf("a=ice-ufrag:")})[0].substr(12),password:n.filter(function(e){return 0===e.indexOf("a=ice-pwd:")})[0].substr(10)}},r.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},r.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=r.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],s=r.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){var a=r.parseRtpMap(s),c=r.matchPrefix(e,"a=fmtp:"+o+" ");switch(a.parameters=c.length?r.parseFmtp(c[0]):{},a.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(r.parseRtcpFb),t.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(a.name.toUpperCase())}}}return r.matchPrefix(e,"a=extmap:").forEach(function(e){t.headerExtensions.push(r.parseExtmap(e))}),t},r.writeRtpDescription=function(e,t){var n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=t.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(function(e){n+=r.writeRtpMap(e),n+=r.writeFmtp(e),n+=r.writeRtcpFb(e)});var i=0;return t.codecs.forEach(function(e){e.maxptime>i&&(i=e.maxptime)}),i>0&&(n+="a=maxptime:"+i+"\r\n"),n+="a=rtcp-mux\r\n",t.headerExtensions.forEach(function(e){n+=r.writeExtmap(e)}),n},r.parseRtpEncodingParameters=function(e){var t,n=[],i=r.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),s=-1!==i.fecMechanisms.indexOf("ULPFEC"),a=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),c=a.length>0&&a[0].ssrc,u=r.matchPrefix(e,"a=ssrc-group:FID").map(function(e){var t=e.split(" ");return t.shift(),t.map(function(e){return parseInt(e,10)})});u.length>0&&u[0].length>1&&u[0][0]===c&&(t=u[0][1]),i.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var r={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10),rtx:{ssrc:t}};n.push(r),o&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:t,mechanism:s?"red+ulpfec":"red"},n.push(r))}}),0===n.length&&c&&n.push({ssrc:c});var f=r.matchPrefix(e,"b=");return f.length&&(0===f[0].indexOf("b=TIAS:")?f=parseInt(f[0].substr(7),10):0===f[0].indexOf("b=AS:")&&(f=parseInt(f[0].substr(5),10)),n.forEach(function(e){e.maxBitrate=f})),n},r.parseRtcpParameters=function(e){var t={},n=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);var i=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=i.length>0,t.compound=0===i.length;var o=r.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},r.parseMsid=function(e){var t,n=r.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(t=n[0].substr(7).split(" "))[0],track:t[1]};var i=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return i.length>0?{stream:(t=i[0].value.split(" "))[0],track:t[1]}:void 0},r.writeSessionBoilerplate=function(){return"v=0\r\no=thisisadapterortc 8169639915646943137 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.writeMediaSection=function(e,t,n,i){var o=r.writeRtpDescription(e.kind,t);if(o+=r.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var s="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+r.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+r.localCName+"\r\n"),o},r.getDirection=function(e,t){for(var n=r.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return t?r.getDirection(t):"sendrecv"},r.getKind=function(e){return r.splitLines(e)[0].split(" ")[0].substr(2)},r.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.exports=r},{}],166:[function(e,t,n){t.exports=function(e){var t=e._readableState;return t?t.objectMode?e.read():e.read((n=t,n.buffer.length?n.buffer.head?n.buffer.head.data.length:n.buffer[0].length:n.length)):null;var n}},{}],167:[function(e,t,n){(function(t,r){var i=e("process/browser.js").nextTick,o=Function.prototype.apply,s=Array.prototype.slice,a={},c=0;function u(e,t){this._id=e,this._clearFn=t}n.setTimeout=function(){return new u(o.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new u(o.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},u.prototype.unref=u.prototype.ref=function(){},u.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=c++,r=!(arguments.length<2)&&s.call(arguments,1);return a[t]=!0,i(function(){a[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof r?r:function(e){delete a[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":144,timers:167}],168:[function(e,t,n){var r,i;r=this,i=function(){function e(){}return e.prototype.encodeReserved=function(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(e){return/%[0-9A-Fa-f]/.test(e)||(e=encodeURI(e).replace(/%5B/g,"[").replace(/%5D/g,"]")),e}).join("")},e.prototype.encodeUnreserved=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})},e.prototype.encodeValue=function(e,t,n){return t="+"===e||"#"===e?this.encodeReserved(t):this.encodeUnreserved(t),n?this.encodeUnreserved(n)+"="+t:t},e.prototype.isDefined=function(e){return void 0!==e&&null!==e},e.prototype.isKeyOperator=function(e){return";"===e||"&"===e||"?"===e},e.prototype.getValues=function(e,t,n,r){var i=e[n],o=[];if(this.isDefined(i)&&""!==i)if("string"==typeof i||"number"==typeof i||"boolean"==typeof i)i=i.toString(),r&&"*"!==r&&(i=i.substring(0,parseInt(r,10))),o.push(this.encodeValue(t,i,this.isKeyOperator(t)?n:null));else if("*"===r)Array.isArray(i)?i.filter(this.isDefined).forEach(function(e){o.push(this.encodeValue(t,e,this.isKeyOperator(t)?n:null))},this):Object.keys(i).forEach(function(e){this.isDefined(i[e])&&o.push(this.encodeValue(t,i[e],e))},this);else{var s=[];Array.isArray(i)?i.filter(this.isDefined).forEach(function(e){s.push(this.encodeValue(t,e))},this):Object.keys(i).forEach(function(e){this.isDefined(i[e])&&(s.push(this.encodeUnreserved(e)),s.push(this.encodeValue(t,i[e].toString())))},this),this.isKeyOperator(t)?o.push(this.encodeUnreserved(n)+"="+s.join(",")):0!==s.length&&o.push(s.join(","))}else";"===t?this.isDefined(i)&&o.push(this.encodeUnreserved(n)):""!==i||"&"!==t&&"?"!==t?""===i&&o.push(""):o.push(this.encodeUnreserved(n)+"=");return o},e.prototype.parse=function(e){var t=this,n=["+","#",".","/",";","?","&"];return{expand:function(r){return e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(e,i,o){if(i){var s=null,a=[];if(-1!==n.indexOf(i.charAt(0))&&(s=i.charAt(0),i=i.substr(1)),i.split(/,/g).forEach(function(e){var n=/([^:\*]*)(?::(\d+)|(\*))?/.exec(e);a.push.apply(a,t.getValues(r,s,n[1],n[2]||n[3]))}),s&&"+"!==s){var c=",";return"?"===s?c="&":"#"!==s&&(c=s),(0!==a.length?s:"")+a.join(c)}return a.join(",")}return t.encodeReserved(o)})}}},new e},"object"==typeof n?t.exports=i():"function"==typeof define&&define.amd?define([],i):r.urltemplate=i()},{}],169:[function(e,t,n){
// distribute, sublicense, and/or sell copies of the Software, and to permit
"use strict";var r=e("punycode"),i=e("./util");function o(){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}n.parse=y,n.resolve=function(e,t){return y(e,!1,!0).resolve(t)},n.resolveObject=function(e,t){return e?y(e,!1,!0).resolveObject(t):t},n.format=function(e){i.isString(e)&&(e=y(e));return e instanceof o?e.format():o.prototype.format.call(e)},n.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),f=["'"].concat(u),l=["%","/","?",";","#"].concat(f),h=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=e("querystring");function y(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",u=e.split(a);u[0]=u[0].replace(/\\/g,"/");var y=e=u.join(a);if(y=y.trim(),!n&&1===e.split("#").length){var E=c.exec(y);if(E)return this.path=y,this.href=y,this.pathname=E[1],E[2]?(this.search=E[2],this.query=t?m.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var b=s.exec(y);if(b){var C=(b=b[0]).toLowerCase();this.protocol=C,y=y.substr(b.length)}if(n||b||y.match(/^\/\/[^@\/]+@[^@\/]+/)){var w="//"===y.substr(0,2);!w||b&&g[b]||(y=y.substr(2),this.slashes=!0)}if(!g[b]&&(w||b&&!v[b])){for(var T,R,S=-1,I=0;I<h.length;I++){-1!==(N=y.indexOf(h[I]))&&(-1===S||N<S)&&(S=N)}-1!==(R=-1===S?y.lastIndexOf("@"):y.lastIndexOf("@",S))&&(T=y.slice(0,R),y=y.slice(R+1),this.auth=decodeURIComponent(T)),S=-1;for(I=0;I<l.length;I++){var N;-1!==(N=y.indexOf(l[I]))&&(-1===S||N<S)&&(S=N)}-1===S&&(S=y.length),this.host=y.slice(0,S),y=y.slice(S),this.parseHost(),this.hostname=this.hostname||"";var O="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!O)for(var A=this.hostname.split(/\./),B=(I=0,A.length);I<B;I++){var k=A[I];if(k&&!k.match(d)){for(var x="",D=0,P=k.length;D<P;D++)k.charCodeAt(D)>127?x+="x":x+=k[D];if(!x.match(d)){var W=A.slice(0,I),L=A.slice(I+1),M=k.match(p);M&&(W.push(M[1]),L.unshift(M[2])),L.length&&(y="/"+L.join(".")+y),this.hostname=W.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),O||(this.hostname=r.toASCII(this.hostname));var j=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+j,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!_[C])for(I=0,B=f.length;I<B;I++){var F=f[I];if(-1!==y.indexOf(F)){var H=encodeURIComponent(F);H===F&&(H=escape(F)),y=y.split(F).join(H)}}var G=y.indexOf("#");-1!==G&&(this.hash=y.substr(G),y=y.slice(0,G));var q=y.indexOf("?");if(-1!==q?(this.search=y.substr(q),this.query=y.substr(q+1),t&&(this.query=m.parse(this.query)),y=y.slice(0,q)):t&&(this.search="",this.query={}),y&&(this.pathname=y),v[C]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){j=this.pathname||"";var z=this.search||"";this.path=j+z}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,s="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=m.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||v[t])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),t+o+(n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}))+(a=a.replace("#","%23"))+r},o.prototype.resolve=function(e){return this.resolveObject(y(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var n=new o,r=Object.keys(this),s=0;s<r.length;s++){var a=r[s];n[a]=this[a]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var c=Object.keys(e),u=0;u<c.length;u++){var f=c[u];"protocol"!==f&&(n[f]=e[f])}return v[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!v[e.protocol]){for(var l=Object.keys(e),h=0;h<l.length;h++){var d=l[h];n[d]=e[d]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||g[e.protocol])n.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),n.pathname=p.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var _=n.pathname||"",m=n.search||"";n.path=_+m}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var y=n.pathname&&"/"===n.pathname.charAt(0),E=e.host||e.pathname&&"/"===e.pathname.charAt(0),b=E||y||n.host&&e.pathname,C=b,w=n.pathname&&n.pathname.split("/")||[],T=(p=e.pathname&&e.pathname.split("/")||[],n.protocol&&!v[n.protocol]);if(T&&(n.hostname="",n.port=null,n.host&&(""===w[0]?w[0]=n.host:w.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),b=b&&(""===p[0]||""===w[0])),E)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,w=p;else if(p.length)w||(w=[]),w.pop(),w=w.concat(p),n.search=e.search,n.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(T)n.hostname=n.host=w.shift(),(O=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=O.shift(),n.host=n.hostname=O.shift());return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var R=w.slice(-1)[0],S=(n.host||e.host||w.length>1)&&("."===R||".."===R)||""===R,I=0,N=w.length;N>=0;N--)"."===(R=w[N])?w.splice(N,1):".."===R?(w.splice(N,1),I++):I&&(w.splice(N,1),I--);if(!b&&!C)for(;I--;I)w.unshift("..");!b||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),S&&"/"!==w.join("/").substr(-1)&&w.push("");var O,A=""===w[0]||w[0]&&"/"===w[0].charAt(0);T&&(n.hostname=n.host=A?"":w.length?w.shift():"",(O=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=O.shift(),n.host=n.hostname=O.shift()));return(b=b||n.host&&w.length)&&!A&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":170,punycode:146,querystring:149}],170:[function(e,t,n){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],171:[function(e,t,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],172:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],173:[function(e,t,n){(function(t,r){
// distribute, sublicense, and/or sell copies of the Software, and to permit
var i=/%[sdj%]/g;n.format=function(e){if(!v(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(a(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,o=r.length,s=String(e).replace(i,function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),c=r[n];n<o;c=r[++n])_(c)||!E(c)?s+=" "+c:s+=" "+a(c);return s},n.deprecate=function(e,i){if(m(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(!0===t.noDeprecation)return e;var o=!1;return function(){if(!o){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),o=!0}return e.apply(this,arguments)}};var o,s={};function a(e,t){var r={seen:[],stylize:u};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),p(t)?r.showHidden=t:t&&n._extend(r,t),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=c),f(r,e,r.depth)}function c(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function u(e,t){return e}function f(e,t,r){if(e.customInspect&&t&&w(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return v(i)||(i=f(e,i,r)),i}var o=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(_(t))return e.stylize("null","null")}(e,t);if(o)return o;var s=Object.keys(t),a=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),C(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(t);if(0===s.length){if(w(t)){var c=t.name?": "+t.name:"";return e.stylize("[Function"+c+"]","special")}if(y(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(b(t))return e.stylize(Date.prototype.toString.call(t),"date");if(C(t))return l(t)}var u,E="",T=!1,R=["{","}"];(d(t)&&(T=!0,R=["[","]"]),w(t))&&(E=" [Function"+(t.name?": "+t.name:"")+"]");return y(t)&&(E=" "+RegExp.prototype.toString.call(t)),b(t)&&(E=" "+Date.prototype.toUTCString.call(t)),C(t)&&(E=" "+l(t)),0!==s.length||T&&0!=t.length?r<0?y(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=T?function(e,t,n,r,i){for(var o=[],s=0,a=t.length;s<a;++s)I(t,String(s))?o.push(h(e,t,n,r,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(h(e,t,n,r,i,!0))}),o}(e,t,r,a,s):s.map(function(n){return h(e,t,r,a,n,T)}),e.seen.pop(),function(e,t,n){if(e.reduce(function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n  ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(u,E,R)):R[0]+E+R[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,i,o){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),I(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(c.value)<0?(a=_(n)?f(e,c.value,null):f(e,c.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return"  "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return"   "+e}).join("\n")):a=e.stylize("[Circular]","special")),m(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function _(e){return null===e}function g(e){return"number"==typeof e}function v(e){return"string"==typeof e}function m(e){return void 0===e}function y(e){return E(e)&&"[object RegExp]"===T(e)}function E(e){return"object"==typeof e&&null!==e}function b(e){return E(e)&&"[object Date]"===T(e)}function C(e){return E(e)&&("[object Error]"===T(e)||e instanceof Error)}function w(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function R(e){return e<10?"0"+e.toString(10):e.toString(10)}n.debuglog=function(e){if(m(o)&&(o=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!s[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var r=t.pid;s[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else s[e]=function(){};return s[e]},n.inspect=a,a.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]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=d,n.isBoolean=p,n.isNull=_,n.isNullOrUndefined=function(e){return null==e},n.isNumber=g,n.isString=v,n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=m,n.isRegExp=y,n.isObject=E,n.isDate=b,n.isError=C,n.isFunction=w,n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e("./support/isBuffer");var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.log=function(){var e,t;console.log("%s - %s",(e=new Date,t=[R(e.getHours()),R(e.getMinutes()),R(e.getSeconds())].join(":"),[e.getDate(),S[e.getMonth()],t].join(" ")),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!E(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":172,_process:144,inherits:118}],174:[function(e,t,n){
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
"use strict";!function(){var n=e("./utils").log,r=e("./utils").browserDetails;t.exports.browserDetails=r,t.exports.extractVersion=e("./utils").extractVersion,t.exports.disableLog=e("./utils").disableLog;var i=e("./chrome/chrome_shim")||null,o=e("./edge/edge_shim")||null,s=e("./firefox/firefox_shim")||null,a=e("./safari/safari_shim")||null;switch(r.browser){case"opera":case"chrome":if(!i||!i.shimPeerConnection)return void n("Chrome shim is not included in this adapter release.");n("adapter.js shimming chrome."),t.exports.browserShim=i,i.shimGetUserMedia(),i.shimMediaStream(),i.shimSourceObject(),i.shimPeerConnection(),i.shimOnTrack();break;case"firefox":if(!s||!s.shimPeerConnection)return void n("Firefox shim is not included in this adapter release.");n("adapter.js shimming firefox."),t.exports.browserShim=s,s.shimGetUserMedia(),s.shimSourceObject(),s.shimPeerConnection(),s.shimOnTrack();break;case"edge":if(!o||!o.shimPeerConnection)return void n("MS edge shim is not included in this adapter release.");n("adapter.js shimming edge."),t.exports.browserShim=o,o.shimGetUserMedia(),o.shimPeerConnection();break;case"safari":if(!a)return void n("Safari shim is not included in this adapter release.");n("adapter.js shimming safari."),t.exports.browserShim=a,a.shimGetUserMedia();break;default:n("Unsupported browser!")}}()},{"./chrome/chrome_shim":175,"./edge/edge_shim":177,"./firefox/firefox_shim":179,"./safari/safari_shim":181,"./utils":182}],175:[function(e,t,n){
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
"use strict";var r=e("../utils.js").log,i=e("../utils.js").browserDetails,o={shimMediaStream:function(){window.MediaStream=window.MediaStream||window.webkitMediaStream},shimOnTrack:function(){"object"!=typeof window||!window.RTCPeerConnection||"ontrack"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){var t=this;this._ontrack&&(this.removeEventListener("track",this._ontrack),this.removeEventListener("addstream",this._ontrackpoly)),this.addEventListener("track",this._ontrack=e),this.addEventListener("addstream",this._ontrackpoly=function(e){e.stream.addEventListener("addtrack",function(n){var r=new Event("track");r.track=n.track,r.receiver={track:n.track},r.streams=[e.stream],t.dispatchEvent(r)}),e.stream.getTracks().forEach(function(t){var n=new Event("track");n.track=t,n.receiver={track:t},n.streams=[e.stream],this.dispatchEvent(n)}.bind(this))}.bind(this))}})},shimSourceObject:function(){"object"==typeof window&&(!window.HTMLMediaElement||"srcObject"in window.HTMLMediaElement.prototype||Object.defineProperty(window.HTMLMediaElement.prototype,"srcObject",{get:function(){return this._srcObject},set:function(e){var t=this;this._srcObject=e,this.src&&URL.revokeObjectURL(this.src),e?(this.src=URL.createObjectURL(e),e.addEventListener("addtrack",function(){t.src&&URL.revokeObjectURL(t.src),t.src=URL.createObjectURL(e)}),e.addEventListener("removetrack",function(){t.src&&URL.revokeObjectURL(t.src),t.src=URL.createObjectURL(e)})):this.src=""}}))},shimPeerConnection:function(){window.RTCPeerConnection=function(e,t){r("PeerConnection"),e&&e.iceTransportPolicy&&(e.iceTransports=e.iceTransportPolicy);var n=new webkitRTCPeerConnection(e,t),i=n.getStats.bind(n);return n.getStats=function(e,t,n){var r=this,o=arguments;if(arguments.length>0&&"function"==typeof e)return i(e,t);var s=function(e){var t={};return e.result().forEach(function(e){var n={id:e.id,timestamp:e.timestamp,type:e.type};e.names().forEach(function(t){n[t]=e.stat(t)}),t[n.id]=n}),t},a=function(e,t){var n=new Map(Object.keys(e).map(function(t){return[t,e[t]]}));return t=t||e,Object.keys(t).forEach(function(e){n[e]=t[e]}),n};if(arguments.length>=2){return i.apply(this,[function(e){o[1](a(s(e)))},arguments[0]])}return new Promise(function(t,n){1===o.length&&"object"==typeof e?i.apply(r,[function(e){t(a(s(e)))},n]):i.apply(r,[function(e){t(a(s(e),e.result()))},n])}).then(t,n)},n},window.RTCPeerConnection.prototype=webkitRTCPeerConnection.prototype,webkitRTCPeerConnection.generateCertificate&&Object.defineProperty(window.RTCPeerConnection,"generateCertificate",{get:function(){return webkitRTCPeerConnection.generateCertificate}}),["createOffer","createAnswer"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){var e=this;if(arguments.length<1||1===arguments.length&&"object"==typeof arguments[0]){var n=1===arguments.length?arguments[0]:void 0;return new Promise(function(r,i){t.apply(e,[r,i,n])})}return t.apply(this,arguments)}}),i.version<51&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){var e=arguments,n=this,r=new Promise(function(r,i){t.apply(n,[e[0],r,i])});return e.length<2?r:r.then(function(){e[1].apply(null,[])},function(t){e.length>=3&&e[2].apply(null,[t])})}});var e=RTCPeerConnection.prototype.addIceCandidate;RTCPeerConnection.prototype.addIceCandidate=function(){return null===arguments[0]?Promise.resolve():e.apply(this,arguments)},["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){return arguments[0]=new("addIceCandidate"===e?RTCIceCandidate:RTCSessionDescription)(arguments[0]),t.apply(this,arguments)}})},attachMediaStream:function(e,t){r("DEPRECATED, attachMediaStream will soon be removed."),i.version>=43?e.srcObject=t:void 0!==e.src?e.src=URL.createObjectURL(t):r("Error attaching stream to element.")},reattachMediaStream:function(e,t){r("DEPRECATED, reattachMediaStream will soon be removed."),i.version>=43?e.srcObject=t.srcObject:e.src=t.src}};t.exports={shimMediaStream:o.shimMediaStream,shimOnTrack:o.shimOnTrack,shimSourceObject:o.shimSourceObject,shimPeerConnection:o.shimPeerConnection,shimGetUserMedia:e("./getusermedia"),attachMediaStream:o.attachMediaStream,reattachMediaStream:o.reattachMediaStream}},{"../utils.js":182,"./getusermedia":176}],176:[function(e,t,n){
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
"use strict";var r=e("../utils.js").log;t.exports=function(){var e=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var o={};"number"==typeof r.ideal?(o[i("min",n)]=r.ideal,t.optional.push(o),(o={})[i("max",n)]=r.ideal,t.optional.push(o)):(o[i("",n)]=r.ideal,t.optional.push(o))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},t=function(t,n){if((t=JSON.parse(JSON.stringify(t)))&&t.audio&&(t.audio=e(t.audio)),t&&"object"==typeof t.video){var i=t.video.facingMode;if((i=i&&("object"==typeof i?i:{ideal:i}))&&("user"===i.exact||"environment"===i.exact||"user"===i.ideal||"environment"===i.ideal)&&(!navigator.mediaDevices.getSupportedConstraints||!navigator.mediaDevices.getSupportedConstraints().facingMode)&&(delete t.video.facingMode,"environment"===i.exact||"environment"===i.ideal))return navigator.mediaDevices.enumerateDevices().then(function(o){var s=(o=o.filter(function(e){return"videoinput"===e.kind})).find(function(e){return-1!==e.label.toLowerCase().indexOf("back")})||o.length&&o[o.length-1];return s&&(t.video.deviceId=i.exact?{exact:s.deviceId}:{ideal:s.deviceId}),t.video=e(t.video),r("chrome: "+JSON.stringify(t)),n(t)});t.video=e(t.video)}return r("chrome: "+JSON.stringify(t)),n(t)},n=function(e){return{name:{PermissionDeniedError:"NotAllowedError",ConstraintNotSatisfiedError:"OverconstrainedError"}[e.name]||e.name,message:e.message,constraint:e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};navigator.getUserMedia=function(e,r,i){t(e,function(e){navigator.webkitGetUserMedia(e,r,function(e){i(n(e))})})};var i=function(e){return new Promise(function(t,n){navigator.getUserMedia(e,t,n)})};if(navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:i,enumerateDevices:function(){return new Promise(function(e){var t={audio:"audioinput",video:"videoinput"};return MediaStreamTrack.getSources(function(n){e(n.map(function(e){return{label:e.label,kind:t[e.kind],deviceId:e.id,groupId:""}}))})})}}),navigator.mediaDevices.getUserMedia){var o=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(e){return t(e,function(e){return o(e).catch(function(e){return Promise.reject(n(e))})})}}else navigator.mediaDevices.getUserMedia=function(e){return i(e)};void 0===navigator.mediaDevices.addEventListener&&(navigator.mediaDevices.addEventListener=function(){r("Dummy mediaDevices.addEventListener called.")}),void 0===navigator.mediaDevices.removeEventListener&&(navigator.mediaDevices.removeEventListener=function(){r("Dummy mediaDevices.removeEventListener called.")})}},{"../utils.js":182}],177:[function(e,t,n){
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
"use strict";var r=e("sdp"),i=e("../utils").log,o={shimPeerConnection:function(){window.RTCIceGatherer&&(window.RTCIceCandidate||(window.RTCIceCandidate=function(e){return e}),window.RTCSessionDescription||(window.RTCSessionDescription=function(e){return e})),window.RTCPeerConnection=function(e){var t=this,n=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){t[e]=n[e].bind(n)}),this.onicecandidate=null,this.onaddstream=null,this.ontrack=null,this.onremovestream=null,this.onsignalingstatechange=null,this.oniceconnectionstatechange=null,this.onnegotiationneeded=null,this.ondatachannel=null,this.localStreams=[],this.remoteStreams=[],this.getLocalStreams=function(){return t.localStreams},this.getRemoteStreams=function(){return t.remoteStreams},this.localDescription=new RTCSessionDescription({type:"",sdp:""}),this.remoteDescription=new RTCSessionDescription({type:"",sdp:""}),this.signalingState="stable",this.iceConnectionState="new",this.iceGatheringState="new",this.iceOptions={gatherPolicy:"all",iceServers:[]},e&&e.iceTransportPolicy)switch(e.iceTransportPolicy){case"all":case"relay":this.iceOptions.gatherPolicy=e.iceTransportPolicy;break;case"none":throw new TypeError('iceTransportPolicy "none" not supported')}if(this.usingBundle=e&&"max-bundle"===e.bundlePolicy,e&&e.iceServers){var r=JSON.parse(JSON.stringify(e.iceServers));this.iceOptions.iceServers=r.filter(function(e){if(e&&e.urls){var t=e.urls;return"string"==typeof t&&(t=[t]),!!(t=t.filter(function(e){return 0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")})[0])}return!1})}this.transceivers=[],this._localIceCandidatesBuffer=[]},window.RTCPeerConnection.prototype._emitBufferedCandidates=function(){var e=this,t=r.splitSections(e.localDescription.sdp);this._localIceCandidatesBuffer.forEach(function(n){if(!n.candidate||0===Object.keys(n.candidate).length)for(var r=1;r<t.length;r++)-1===t[r].indexOf("\r\na=end-of-candidates\r\n")&&(t[r]+="a=end-of-candidates\r\n");else-1===n.candidate.candidate.indexOf("typ endOfCandidates")&&(t[n.candidate.sdpMLineIndex+1]+="a="+n.candidate.candidate+"\r\n");(e.localDescription.sdp=t.join(""),e.dispatchEvent(n),null!==e.onicecandidate&&e.onicecandidate(n),n.candidate||"complete"===e.iceGatheringState)||e.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state})&&(e.iceGatheringState="complete")}),this._localIceCandidatesBuffer=[]},window.RTCPeerConnection.prototype.addStream=function(e){this.localStreams.push(e.clone()),this._maybeFireNegotiationNeeded()},window.RTCPeerConnection.prototype.removeStream=function(e){var t=this.localStreams.indexOf(e);t>-1&&(this.localStreams.splice(t,1),this._maybeFireNegotiationNeeded())},window.RTCPeerConnection.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},window.RTCPeerConnection.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},window.RTCPeerConnection.prototype._getCommonCapabilities=function(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]};return e.codecs.forEach(function(e){for(var r=0;r<t.codecs.length;r++){var i=t.codecs[r];if(e.name.toLowerCase()===i.name.toLowerCase()&&e.clockRate===i.clockRate&&e.numChannels===i.numChannels){n.codecs.push(i);break}}}),e.headerExtensions.forEach(function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}}),n},window.RTCPeerConnection.prototype._createIceAndDtlsTransports=function(e,t){var n=this,i=new RTCIceGatherer(n.iceOptions),o=new RTCIceTransport(i);i.onlocalcandidate=function(s){var a=new Event("icecandidate");a.candidate={sdpMid:e,sdpMLineIndex:t};var c=s.candidate,u=!c||0===Object.keys(c).length;u?(void 0===i.state&&(i.state="completed"),a.candidate.candidate="candidate:1 1 udp 1 0.0.0.0 9 typ endOfCandidates"):(c.component="RTCP"===o.component?2:1,a.candidate.candidate=r.writeCandidate(c));var f=r.splitSections(n.localDescription.sdp);-1===a.candidate.candidate.indexOf("typ endOfCandidates")?f[a.candidate.sdpMLineIndex+1]+="a="+a.candidate.candidate+"\r\n":f[a.candidate.sdpMLineIndex+1]+="a=end-of-candidates\r\n",n.localDescription.sdp=f.join("");var l=n.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});switch(n.iceGatheringState){case"new":n._localIceCandidatesBuffer.push(a),u&&l&&n._localIceCandidatesBuffer.push(new Event("icecandidate"));break;case"gathering":n._emitBufferedCandidates(),n.dispatchEvent(a),null!==n.onicecandidate&&n.onicecandidate(a),l&&(n.dispatchEvent(new Event("icecandidate")),null!==n.onicecandidate&&n.onicecandidate(new Event("icecandidate")),n.iceGatheringState="complete")}},o.onicestatechange=function(){n._updateConnectionState()};var s=new RTCDtlsTransport(o);return s.ondtlsstatechange=function(){n._updateConnectionState()},s.onerror=function(){s.state="failed",n._updateConnectionState()},{iceGatherer:i,iceTransport:o,dtlsTransport:s}},window.RTCPeerConnection.prototype._transceive=function(e,t,n){var i=this._getCommonCapabilities(e.localCapabilities,e.remoteCapabilities);t&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:r.localCName},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),n&&e.rtpReceiver&&(i.encodings=e.recvEncodingParameters,i.rtcp={cname:e.cname},e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},window.RTCPeerConnection.prototype.setLocalDescription=function(e){var t,n,i=this;if("offer"===e.type)this._pendingOffer&&(t=r.splitSections(e.sdp),n=t.shift(),t.forEach(function(e,t){var n=r.parseRtpParameters(e);i._pendingOffer[t].localCapabilities=n}),this.transceivers=this._pendingOffer,delete this._pendingOffer);else if("answer"===e.type){t=r.splitSections(i.remoteDescription.sdp),n=t.shift();var o=r.matchPrefix(n,"a=ice-lite").length>0;t.forEach(function(e,t){var s=i.transceivers[t],a=s.iceGatherer,c=s.iceTransport,u=s.dtlsTransport,f=s.localCapabilities,l=s.remoteCapabilities;if(!("0"===e.split("\n",1)[0].split(" ",2)[1])){var h=r.getIceParameters(e,n);if(o){var d=r.matchPrefix(e,"a=candidate:").map(function(e){return r.parseCandidate(e)}).filter(function(e){return"1"===e.component});d.length&&c.setRemoteCandidates(d)}var p=r.getDtlsParameters(e,n);o&&(p.role="server"),i.usingBundle&&0!==t||(c.start(a,h,o?"controlling":"controlled"),u.start(p));var _=i._getCommonCapabilities(f,l);i._transceive(s,_.codecs.length>0,!1)}})}switch(this.localDescription={type:e.type,sdp:e.sdp},e.type){case"offer":this._updateSignalingState("have-local-offer");break;case"answer":this._updateSignalingState("stable");break;default:throw new TypeError('unsupported type "'+e.type+'"')}var s=arguments.length>1&&"function"==typeof arguments[1];if(s){var a=arguments[1];window.setTimeout(function(){a(),"new"===i.iceGatheringState&&(i.iceGatheringState="gathering"),i._emitBufferedCandidates()},0)}var c=Promise.resolve();return c.then(function(){s||("new"===i.iceGatheringState&&(i.iceGatheringState="gathering"),window.setTimeout(i._emitBufferedCandidates.bind(i),500))}),c},window.RTCPeerConnection.prototype.setRemoteDescription=function(e){var t=this,n=new MediaStream,i=[],o=r.splitSections(e.sdp),s=o.shift(),a=r.matchPrefix(s,"a=ice-lite").length>0;switch(this.usingBundle=r.matchPrefix(s,"a=group:BUNDLE ").length>0,o.forEach(function(o,c){var u,f,l,h,d,p,_,g,v,m,y,E,b=r.splitLines(o)[0].substr(2).split(" "),C=b[0],w="0"===b[1],T=r.getDirection(o,s),R=r.parseRtpParameters(o);w||(y=r.getIceParameters(o,s),(E=r.getDtlsParameters(o,s)).role="client"),g=r.parseRtpEncodingParameters(o);var S,I=r.matchPrefix(o,"a=mid:");I=I.length?I[0].substr(6):r.generateIdentifier();var N=r.matchPrefix(o,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];N&&(S=N.value);var O=r.matchPrefix(o,"a=end-of-candidates").length>0,A=r.matchPrefix(o,"a=candidate:").map(function(e){return r.parseCandidate(e)}).filter(function(e){return"1"===e.component});if("offer"!==e.type||w)"answer"!==e.type||w||(f=(u=t.transceivers[c]).iceGatherer,l=u.iceTransport,h=u.dtlsTransport,d=u.rtpSender,p=u.rtpReceiver,_=u.sendEncodingParameters,v=u.localCapabilities,t.transceivers[c].recvEncodingParameters=g,t.transceivers[c].remoteCapabilities=R,t.transceivers[c].cname=S,(a||O)&&A.length&&l.setRemoteCandidates(A),t.usingBundle&&0!==c||(l.start(f,y,"controlling"),h.start(E)),t._transceive(u,"sendrecv"===T||"recvonly"===T,"sendrecv"===T||"sendonly"===T),!p||"sendrecv"!==T&&"sendonly"!==T?delete u.rtpReceiver:(m=p.track,i.push([m,p]),n.addTrack(m)));else{var B=t.usingBundle&&c>0?{iceGatherer:t.transceivers[0].iceGatherer,iceTransport:t.transceivers[0].iceTransport,dtlsTransport:t.transceivers[0].dtlsTransport}:t._createIceAndDtlsTransports(I,c);if(O&&B.iceTransport.setRemoteCandidates(A),v=RTCRtpReceiver.getCapabilities(C),_=[{ssrc:1001*(2*c+2)}],m=(p=new RTCRtpReceiver(B.dtlsTransport,C)).track,i.push([m,p]),n.addTrack(m),t.localStreams.length>0&&t.localStreams[0].getTracks().length>=c){var k=t.localStreams[0].getTracks()[c];d=new RTCRtpSender(k,B.dtlsTransport)}t.transceivers[c]={iceGatherer:B.iceGatherer,iceTransport:B.iceTransport,dtlsTransport:B.dtlsTransport,localCapabilities:v,remoteCapabilities:R,rtpSender:d,rtpReceiver:p,kind:C,mid:I,cname:S,sendEncodingParameters:_,recvEncodingParameters:g},t._transceive(t.transceivers[c],!1,"sendrecv"===T||"sendonly"===T)}}),this.remoteDescription={type:e.type,sdp:e.sdp},e.type){case"offer":this._updateSignalingState("have-remote-offer");break;case"answer":this._updateSignalingState("stable");break;default:throw new TypeError('unsupported type "'+e.type+'"')}return n.getTracks().length&&(t.remoteStreams.push(n),window.setTimeout(function(){var e=new Event("addstream");e.stream=n,t.dispatchEvent(e),null!==t.onaddstream&&window.setTimeout(function(){t.onaddstream(e)},0),i.forEach(function(r){var i=r[0],o=r[1],s=new Event("track");s.track=i,s.receiver=o,s.streams=[n],t.dispatchEvent(e),null!==t.ontrack&&window.setTimeout(function(){t.ontrack(s)},0)})},0)),arguments.length>1&&"function"==typeof arguments[1]&&window.setTimeout(arguments[1],0),Promise.resolve()},window.RTCPeerConnection.prototype.close=function(){this.transceivers.forEach(function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()}),this._updateSignalingState("closed")},window.RTCPeerConnection.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this.dispatchEvent(t),null!==this.onsignalingstatechange&&this.onsignalingstatechange(t)},window.RTCPeerConnection.prototype._maybeFireNegotiationNeeded=function(){var e=new Event("negotiationneeded");this.dispatchEvent(e),null!==this.onnegotiationneeded&&this.onnegotiationneeded(e)},window.RTCPeerConnection.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,checking:0,connected:0,completed:0,failed:0};if(this.transceivers.forEach(function(e){t[e.iceTransport.state]++,t[e.dtlsTransport.state]++}),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0||t.checking>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":(t.connected>0||t.completed>0)&&(e="connected"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this.dispatchEvent(n),null!==this.oniceconnectionstatechange&&this.oniceconnectionstatechange(n)}},window.RTCPeerConnection.prototype.createOffer=function(){var e,t=this;if(this._pendingOffer)throw new Error("createOffer called while there is a pending offer.");1===arguments.length&&"function"!=typeof arguments[0]?e=arguments[0]:3===arguments.length&&(e=arguments[2]);var n=[],i=0,o=0;if(this.localStreams.length&&(i=this.localStreams[0].getAudioTracks().length,o=this.localStreams[0].getVideoTracks().length),e){if(e.mandatory||e.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==e.offerToReceiveAudio&&(i=e.offerToReceiveAudio),void 0!==e.offerToReceiveVideo&&(o=e.offerToReceiveVideo)}for(this.localStreams.length&&this.localStreams[0].getTracks().forEach(function(e){n.push({kind:e.kind,track:e,wantReceive:"audio"===e.kind?i>0:o>0}),"audio"===e.kind?i--:"video"===e.kind&&o--});i>0||o>0;)i>0&&(n.push({kind:"audio",wantReceive:!0}),i--),o>0&&(n.push({kind:"video",wantReceive:!0}),o--);var s=r.writeSessionBoilerplate(),a=[];n.forEach(function(e,n){var i,o,s=e.track,c=e.kind,u=r.generateIdentifier(),f=t.usingBundle&&n>0?{iceGatherer:a[0].iceGatherer,iceTransport:a[0].iceTransport,dtlsTransport:a[0].dtlsTransport}:t._createIceAndDtlsTransports(u,n),l=RTCRtpSender.getCapabilities(c),h=[{ssrc:1001*(2*n+1)}];s&&(i=new RTCRtpSender(s,f.dtlsTransport)),e.wantReceive&&(o=new RTCRtpReceiver(f.dtlsTransport,c)),a[n]={iceGatherer:f.iceGatherer,iceTransport:f.iceTransport,dtlsTransport:f.dtlsTransport,localCapabilities:l,remoteCapabilities:null,rtpSender:i,rtpReceiver:o,kind:c,mid:u,sendEncodingParameters:h,recvEncodingParameters:null}}),this.usingBundle&&(s+="a=group:BUNDLE "+a.map(function(e){return e.mid}).join(" ")+"\r\n"),n.forEach(function(e,n){var i=a[n];s+=r.writeMediaSection(i,i.localCapabilities,"offer",t.localStreams[0])}),this._pendingOffer=a;var c=new RTCSessionDescription({type:"offer",sdp:s});return arguments.length&&"function"==typeof arguments[0]&&window.setTimeout(arguments[0],0,c),Promise.resolve(c)},window.RTCPeerConnection.prototype.createAnswer=function(){var e=this,t=r.writeSessionBoilerplate();this.usingBundle&&(t+="a=group:BUNDLE "+this.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),this.transceivers.forEach(function(n){var i=e._getCommonCapabilities(n.localCapabilities,n.remoteCapabilities);t+=r.writeMediaSection(n,i,"answer",e.localStreams[0])});var n=new RTCSessionDescription({type:"answer",sdp:t});return arguments.length&&"function"==typeof arguments[0]&&window.setTimeout(arguments[0],0,n),Promise.resolve(n)},window.RTCPeerConnection.prototype.addIceCandidate=function(e){if(null===e)this.transceivers.forEach(function(e){e.iceTransport.addRemoteCandidate({})});else{var t=e.sdpMLineIndex;if(e.sdpMid)for(var n=0;n<this.transceivers.length;n++)if(this.transceivers[n].mid===e.sdpMid){t=n;break}var i=this.transceivers[t];if(i){var o=Object.keys(e.candidate).length>0?r.parseCandidate(e.candidate):{};if("tcp"===o.protocol&&0===o.port)return;if("1"!==o.component)return;"endOfCandidates"===o.type&&(o={}),i.iceTransport.addRemoteCandidate(o);var s=r.splitSections(this.remoteDescription.sdp);s[t+1]+=(o.type?e.candidate.trim():"a=end-of-candidates")+"\r\n",this.remoteDescription.sdp=s.join("")}}return arguments.length>1&&"function"==typeof arguments[1]&&window.setTimeout(arguments[1],0),Promise.resolve()},window.RTCPeerConnection.prototype.getStats=function(){var e=[];this.transceivers.forEach(function(t){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(n){t[n]&&e.push(t[n].getStats())})});var t=arguments.length>1&&"function"==typeof arguments[1]&&arguments[1];return new Promise(function(n){var r=new Map;Promise.all(e).then(function(e){e.forEach(function(e){Object.keys(e).forEach(function(t){r.set(t,e[t]),r[t]=e[t]})}),t&&window.setTimeout(t,0,r),n(r)})})}},attachMediaStream:function(e,t){i("DEPRECATED, attachMediaStream will soon be removed."),e.srcObject=t},reattachMediaStream:function(e,t){i("DEPRECATED, reattachMediaStream will soon be removed."),e.srcObject=t.srcObject}};t.exports={shimPeerConnection:o.shimPeerConnection,shimGetUserMedia:e("./getusermedia"),attachMediaStream:o.attachMediaStream,reattachMediaStream:o.reattachMediaStream}},{"../utils":182,"./getusermedia":178,sdp:165}],178:[function(e,t,n){
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
"use strict";t.exports=function(){var e=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(t){return e(t).catch(function(e){return Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}}(e))})}}},{}],179:[function(e,t,n){
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
"use strict";var r=e("../utils").log,i=e("../utils").browserDetails,o={shimOnTrack:function(){"object"!=typeof window||!window.RTCPeerConnection||"ontrack"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&(this.removeEventListener("track",this._ontrack),this.removeEventListener("addstream",this._ontrackpoly)),this.addEventListener("track",this._ontrack=e),this.addEventListener("addstream",this._ontrackpoly=function(e){e.stream.getTracks().forEach(function(t){var n=new Event("track");n.track=t,n.receiver={track:t},n.streams=[e.stream],this.dispatchEvent(n)}.bind(this))}.bind(this))}})},shimSourceObject:function(){"object"==typeof window&&(!window.HTMLMediaElement||"srcObject"in window.HTMLMediaElement.prototype||Object.defineProperty(window.HTMLMediaElement.prototype,"srcObject",{get:function(){return this.mozSrcObject},set:function(e){this.mozSrcObject=e}}))},shimPeerConnection:function(){if("object"==typeof window&&(window.RTCPeerConnection||window.mozRTCPeerConnection)){window.RTCPeerConnection||(window.RTCPeerConnection=function(e,t){if(i.version<38&&e&&e.iceServers){for(var n=[],r=0;r<e.iceServers.length;r++){var o=e.iceServers[r];if(o.hasOwnProperty("urls"))for(var s=0;s<o.urls.length;s++){var a={url:o.urls[s]};0===o.urls[s].indexOf("turn")&&(a.username=o.username,a.credential=o.credential),n.push(a)}else n.push(e.iceServers[r])}e.iceServers=n}return new mozRTCPeerConnection(e,t)},window.RTCPeerConnection.prototype=mozRTCPeerConnection.prototype,mozRTCPeerConnection.generateCertificate&&Object.defineProperty(window.RTCPeerConnection,"generateCertificate",{get:function(){return mozRTCPeerConnection.generateCertificate}}),window.RTCSessionDescription=mozRTCSessionDescription,window.RTCIceCandidate=mozRTCIceCandidate),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=RTCPeerConnection.prototype[e];RTCPeerConnection.prototype[e]=function(){return arguments[0]=new("addIceCandidate"===e?RTCIceCandidate:RTCSessionDescription)(arguments[0]),t.apply(this,arguments)}});var e=RTCPeerConnection.prototype.addIceCandidate;RTCPeerConnection.prototype.addIceCandidate=function(){return null===arguments[0]?Promise.resolve():e.apply(this,arguments)};var t=RTCPeerConnection.prototype.getStats;RTCPeerConnection.prototype.getStats=function(e,n,r){return t.apply(this,[e||null]).then(function(e){return function(e){var t=new Map;return Object.keys(e).forEach(function(n){t.set(n,e[n]),t[n]=e[n]}),t}(e)}).then(n,r)}}},attachMediaStream:function(e,t){r("DEPRECATED, attachMediaStream will soon be removed."),e.srcObject=t},reattachMediaStream:function(e,t){r("DEPRECATED, reattachMediaStream will soon be removed."),e.srcObject=t.srcObject}};t.exports={shimOnTrack:o.shimOnTrack,shimSourceObject:o.shimSourceObject,shimPeerConnection:o.shimPeerConnection,shimGetUserMedia:e("./getusermedia"),attachMediaStream:o.attachMediaStream,reattachMediaStream:o.reattachMediaStream}},{"../utils":182,"./getusermedia":180}],180:[function(e,t,n){
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
"use strict";var r=e("../utils").log,i=e("../utils").browserDetails;t.exports=function(){var e=function(e){return{name:{SecurityError:"NotAllowedError",PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:{"The operation is insecure.":"The request is not allowed by the user agent or the platform in the current context."}[e.message]||e.message,constraint:e.constraint,toString:function(){return this.name+(this.message&&": ")+this.message}}},t=function(t,n,o){var s=function(e){if("object"!=typeof e||e.require)return e;var t=[];return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r=e[n]="object"==typeof e[n]?e[n]:{ideal:e[n]};if(void 0===r.min&&void 0===r.max&&void 0===r.exact||t.push(n),void 0!==r.exact&&("number"==typeof r.exact?r.min=r.max=r.exact:e[n]=r.exact,delete r.exact),void 0!==r.ideal){e.advanced=e.advanced||[];var i={};"number"==typeof r.ideal?i[n]={min:r.ideal,max:r.ideal}:i[n]=r.ideal,e.advanced.push(i),delete r.ideal,Object.keys(r).length||delete e[n]}}}),t.length&&(e.require=t),e};return t=JSON.parse(JSON.stringify(t)),i.version<38&&(r("spec: "+JSON.stringify(t)),t.audio&&(t.audio=s(t.audio)),t.video&&(t.video=s(t.video)),r("ff37: "+JSON.stringify(t))),navigator.mozGetUserMedia(t,n,function(t){o(e(t))})};if(navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:function(e){return new Promise(function(n,r){t(e,n,r)})},addEventListener:function(){},removeEventListener:function(){}}),navigator.mediaDevices.enumerateDevices=navigator.mediaDevices.enumerateDevices||function(){return new Promise(function(e){e([{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}])})},i.version<41){var n=navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);navigator.mediaDevices.enumerateDevices=function(){return n().then(void 0,function(e){if("NotFoundError"===e.name)return[];throw e})}}if(i.version<49){var o=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(t){return o(t).catch(function(t){return Promise.reject(e(t))})}}navigator.getUserMedia=function(e,n,r){if(i.version<44)return t(e,n,r);console.warn("navigator.getUserMedia has been replaced by navigator.mediaDevices.getUserMedia"),navigator.mediaDevices.getUserMedia(e).then(n,r)}}},{"../utils":182}],181:[function(e,t,n){
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
"use strict";var r={shimGetUserMedia:function(){navigator.getUserMedia=navigator.webkitGetUserMedia}};t.exports={shimGetUserMedia:r.shimGetUserMedia}},{}],182:[function(e,t,n){
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
"use strict";var r=!0,i={disableLog:function(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(r=e,e?"adapter.js logging disabled":"adapter.js logging enabled")},log:function(){if("object"==typeof window){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},extractVersion:function(e,t,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)},detectBrowser:function(){var e={browser:null,version:null,minVersion:null};if("undefined"==typeof window||!window.navigator)return e.browser="Not a browser.",e;if(navigator.mozGetUserMedia)e.browser="firefox",e.version=this.extractVersion(navigator.userAgent,/Firefox\/([0-9]+)\./,1),e.minVersion=31;else if(navigator.webkitGetUserMedia)if(window.webkitRTCPeerConnection)e.browser="chrome",e.version=this.extractVersion(navigator.userAgent,/Chrom(e|ium)\/([0-9]+)\./,2),e.minVersion=38;else{if(!navigator.userAgent.match(/Version\/(\d+).(\d+)/))return e.browser="Unsupported webkit-based browser with GUM support but no WebRTC support.",e;e.browser="safari",e.version=this.extractVersion(navigator.userAgent,/AppleWebKit\/([0-9]+)\./,1),e.minVersion=602}else{if(!navigator.mediaDevices||!navigator.userAgent.match(/Edge\/(\d+).(\d+)$/))return e.browser="Not a supported browser.",e;e.browser="edge",e.version=this.extractVersion(navigator.userAgent,/Edge\/(\d+).(\d+)$/,2),e.minVersion=10547}return e.version<e.minVersion&&i.log("Browser: "+e.browser+" Version: "+e.version+" < minimum supported version: "+e.minVersion+"\n some things might not work!"),e}};t.exports={log:i.log,disableLog:i.disableLog,browserDetails:i.detectBrowser(),extractVersion:i.extractVersion}},{}],183:[function(e,t,n){arguments[4][48][0].apply(n,arguments)},{buffer:51,dup:48}],184:[function(e,t,n){(function(n,r){"use strict";var i=e("readable-stream").Transform,o=e("duplexify"),s=e("ws"),a=e("safe-buffer").Buffer;t.exports=function(e,t,c){var u,f,l="browser"===n.title,h=!!r.WebSocket,d=l?function e(t,n,r){if(f.bufferedAmount>_)return void setTimeout(e,g,t,n,r);v&&"string"==typeof t&&(t=a.from(t,"utf8"));try{f.send(t)}catch(e){return r(e)}r()}:function(e,t,n){if(f.readyState!==f.OPEN)return void n();v&&"string"==typeof e&&(e=a.from(e,"utf8"));f.send(e,n)};t&&!Array.isArray(t)&&"object"==typeof t&&(c=t,t=null,("string"==typeof c.protocol||Array.isArray(c.protocol))&&(t=c.protocol));c||(c={});void 0===c.objectMode&&(c.objectMode=!(!0===c.binary||void 0===c.binary));var p=function(e,t,n){var r=new i({objectMode:e.objectMode});return r._write=t,r._flush=n,r}(c,d,function(e){f.close(),e()});c.objectMode||(p._writev=function(e,t){for(var n=new Array(e.length),r=0;r<e.length;r++)"string"==typeof e[r].chunk?n[r]=a.from(e[r],"utf8"):n[r]=e[r].chunk;this._write(a.concat(n),"binary",t)});var _=c.browserBufferSize||524288,g=c.browserBufferTimeout||1e3;"object"==typeof e?f=e:(f=h&&l?new s(e,t):new s(e,t,c)).binaryType="arraybuffer";f.readyState===f.OPEN?u=p:(u=o.obj(),f.onopen=function(){u.setReadable(p),u.setWritable(p),u.emit("connect")});u.socket=f,f.onclose=function(){u.end(),u.destroy()},f.onerror=function(e){u.destroy(e)},f.onmessage=function(e){var t=e.data;t=t instanceof ArrayBuffer?a.from(t):a.from(t,"utf8");p.push(t)},p.on("close",function(){f.close()});var v=!c.objectMode;return u}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:144,duplexify:112,"readable-stream":161,"safe-buffer":183,ws:185}],185:[function(e,t,n){var r=null;"undefined"!=typeof WebSocket?r=WebSocket:"undefined"!=typeof MozWebSocket?r=MozWebSocket:"undefined"!=typeof window&&(r=window.WebSocket||window.MozWebSocket),t.exports=r},{}],186:[function(e,t,n){t.exports=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw new TypeError("need wrapper function");Object.keys(t).forEach(function(e){r[e]=t[e]});return r;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(e){r[e]=i[e]}),r}}},{}],187:[function(e,t,n){t.exports=function(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var i in n)r.call(n,i)&&(e[i]=n[i])}return e};var r=Object.prototype.hasOwnProperty},{}],188:[function(e,t,n){"use strict";var r=e("./initial/services/commonWebRtc"),i=e("./initial/main"),o=e("common-webrtc").WEBRTC_EVENTS,s=i.analytics,a=i.logger,c=i.preferencesRawReader,u=i.unifiWebRtcConnector,f=i.webRtcConnectionStatus,l=i.webRtcEventBus,h=i.webRtcConnectorCloud,d=i.webRtcDevice,p=i.UNIFI_WEBRTC_ERROR,_=i.UNIFI_WEBRTC_EVENTS,g=i.WEBRTC_EVENTS_PROGRESS,v=i.WEBRTC_EVENTS_TRANSLATION_KEYS;window.analytics=s,window.logger=a,window.preferencesRawReader=c,window.webrtc={commonWebRtc:r,unifiWebRtcConnector:u,webRtcConnectionStatus:f,webRtcConnectorCloud:h,webRtcDevice:d,webRtcEventBus:l,UNIFI_WEBRTC_ERROR:p,UNIFI_WEBRTC_EVENTS:_,WEBRTC_EVENTS:o,WEBRTC_EVENTS_PROGRESS:g,WEBRTC_EVENTS_TRANSLATION_KEYS:v}},{"./initial/main":200,"./initial/services/commonWebRtc":203,"common-webrtc":72}],189:[function(e,t,n){"use strict";var r=e("./webRtcConnectionStatus");t.exports={webRtcConnectionStatus:r}},{"./webRtcConnectionStatus":190}],190:[function(e,t,n){"use strict";t.exports=e("./webRtcConnectionStatus")},{"./webRtcConnectionStatus":191}],191:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=e("../../services/webRtcEventBus"),o=e("../../constants/UNIFI_WEBRTC_EVENTS"),s=e("common-webrtc").WEBRTC_EVENTS,a=e("../../locales/webrtc.json"),c=e("../../constants/WEBRTC_EVENTS_PROGRESS"),u=e("../../constants/WEBRTC_EVENTS_TRANSLATION_KEYS"),f=function(){function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.document=n,this.element=null,this.template=e("./webRtcConnectionStatus.pug")(),this.listeners=[],this.progress=0,this.status="Starting up...",this.addEventListeners(o),this.addEventListeners(s)}var n,f,l;return n=t,(f=[{key:"render",value:function(){this.element=document.createElement("div"),this.element.innerHTML=this.template,this.document.body.appendChild(this.element),this.updateProgress(this.progress),this.updateStatus(this.status)}},{key:"addEventListeners",value:function(e){var t=this;Object.keys(e).forEach(function(n){var r=e[n],o=function(){var e=u[r];void 0!==e&&t.updateStatus(a[e]);var n=c[r];void 0!==n&&t.updateProgress(n)};i.on(r,o),t.listeners.push({event:r,listener:o})})}},{key:"unregisterAllEventListeners",value:function(){this.listeners.forEach(function(e){i.removeListener(e.event,e.listener)}),this.listeners=[]}},{key:"updateProgress",value:function(e){(this.progress=e,this.element)&&(this.element.querySelector(".ubntStatusBar__status").style.width=e+"%")}},{key:"updateStatus",value:function(e){(this.status=e,this.element)&&(this.element.querySelector(".unifiConnectionStatus__text").innerText=e)}},{key:"destroy",value:function(){this.unregisterAllEventListeners(),this.element&&this.element.remove()}}])&&r(n.prototype,f),l&&r(n,l),t}();t.exports=new f(document)},{"../../constants/UNIFI_WEBRTC_EVENTS":195,"../../constants/WEBRTC_EVENTS_PROGRESS":196,"../../constants/WEBRTC_EVENTS_TRANSLATION_KEYS":197,"../../locales/webrtc.json":199,"../../services/webRtcEventBus":209,"./webRtcConnectionStatus.pug":192,"common-webrtc":72}],192:[function(e,t,n){e("pug-runtime");t.exports=function(e){var t="";return t+='<div class="whiteout"><div class="appSpinner appSpinner--medium appSpinner--dark"></div><div class="unifiConnectionStatus appContainer appContainer--smash mt-3"><div class="stackCenter"><div class="unifiConnectionStatus__text mb-3"></div><div class="ubntStatusBar ubntStatusBar--success" style="width: 100px"><div class="ubntStatusBar__status" style="width: 0%"></div></div></div></div></div>'}},{"pug-runtime":145}],193:[function(e,t,n){"use strict";t.exports={UNIFI_WEBRTC_APP_CONTEXT_CHANGE:"UNIFI_WEBRTC_APP_CONTEXT_CHANGE"}},{}],194:[function(e,t,n){"use strict";t.exports={DEVICE_OFFLINE:"DEVICE_OFFLINE",DEVICE_VERSION_INCOMPATIBLE:"DEVICE_VERSION_INCOMPATIBLE",ERROR_CONTROLLER_NOT_FOUND:"ERROR_CONTROLLER_NOT_FOUND",ERROR_ESTABLISH_CONNECTION:"ERROR_ESTABLISH_CONNECTION",ERROR_NOT_LOGGED_INTO_SSO:"ERROR_NOT_LOGGED_INTO_SSO"}},{}],195:[function(e,t,n){"use strict";t.exports={UNIFI_WEBRTC_VALIDATING_SSO:"UNIFI_WEBRTC_VALIDATING_SSO",UNIFI_WEBRTC_OBTAINING_CONTROLLER_INFO:"UNIFI_WEBRTC_OBTAINING_CONTROLLER_INFO",UNIFI_WEBRTC_ESTABLISHING_COMMUNICATION:"UNIFI_WEBRTC_ESTABLISHING_COMMUNICATION",UNIFI_WEBRTC_INITIALIZING_APPLICATION:"UNIFI_WEBRTC_INITIALIZING_APPLICATION"}},{}],196:[function(e,t,n){"use strict";t.exports={UNIFI_WEBRTC_OBTAINING_CONTROLLER_INFO:5,UNIFI_WEBRTC_ESTABLISHING_COMMUNICATION:10,WEBRTC_WS_OPENING:40,WEBRTC_WS_CONNECTED:45,WEBRTC_CREATING_API_GATEWAY_CLIENT:20,WEBRTC_AWS_IOT_CONNECTING:30,WEBRTC_AWS_OPENING:40,WEBRTC_AWS_CONNECTED:45,WEBRTC_CREATE_OFFER:50,WEBRTC_SDP_REQUESTING:50,WEBRTC_SDP_RECEIVED:55,WEBRTC_CREATE_ANSWER:70,WEBRTC_SDP_SENDING:70,WEBRTC_INITIALIZED:80,WEBRTC_CONNECTED:90,UNIFI_WEBRTC_INITIALIZING_APPLICATION:95}},{}],197:[function(e,t,n){"use strict";t.exports={UNIFI_WEBRTC_OBTAINING_CONTROLLER_INFO:"CONNECTION_UNIFI_WEBRTC_OBTAINING_CONTROLLER_INFO",UNIFI_WEBRTC_ESTABLISHING_COMMUNICATION:"CONNECTION_UNIFI_WEBRTC_ESTABLISHING_COMMUNICATION",WEBRTC_CREATING_API_GATEWAY_CLIENT:"CONNECTION_WEBRTC_CREATING_API_GATEWAY_CLIENT",WEBRTC_AWS_IOT_CONNECTING:"CONNECTION_WEBRTC_AWS_IOT_CONNECTING",WEBRTC_WS_OPENING:"CONNECTION_WEBRTC_WS_OPENING",WEBRTC_WS_OPENING_ERROR:"CONNECTION_WEBRTC_WS_OPENING_ERROR",WEBRTC_WS_CONNECTED:"CONNECTION_WEBRTC_WS_CONNECTED",WEBRTC_AWS_OPENING:"CONNECTION_WEBRTC_AWS_OPENING",WEBRTC_AWS_OPENING_ERROR:"CONNECTION_WEBRTC_AWS_OPENING_ERROR",WEBRTC_AWS_CONNECTED:"CONNECTION_WEBRTC_AWS_CONNECTED",WEBRTC_CREATE_ANSWER:"CONNECTION_WEBRTC_CREATE_ANSWER",WEBRTC_CREATE_ANSWER_ERROR:"CONNECTION_WEBRTC_CREATE_ANSWER_ERROR",WEBRTC_CREATE_OFFER:"CONNECTION_WEBRTC_CREATE_OFFER",WEBRTC_CREATE_OFFER_ERROR:"CONNECTION_WEBRTC_CREATE_OFFER_ERROR",WEBRTC_SDP_REQUESTING:"CONNECTION_WEBRTC_SDP_REQUESTING",WEBRTC_SDP_RECEIVED:"CONNECTION_WEBRTC_SDP_RECEIVED",WEBRTC_SDP_SENDING:"CONNECTION_WEBRTC_SDP_SENDING",WEBRTC_INITIALIZED:"CONNECTION_WEBRTC_INITIALIZED",WEBRTC_CONNECTED:"CONNECTION_WEBRTC_CONNECTED",WEBRTC_CONNECTION_ERROR:"CONNECTION_WEBRTC_CONNECTION_ERROR",UNIFI_WEBRTC_INITIALIZING_APPLICATION:"CONNECTION_UNIFI_WEBRTC_INITIALIZING_APPLICATION"}},{}],198:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=window.unifiConstant.GoogleAnalyticsDemoKey,o=window.unifiConstant.GoogleAnalyticsCloudKey,s=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.document=t,this.UseWebrtc=n.webrtcConfig.UseWebrtc,this.loaded=!1}var t,n,s;return t=e,(n=[{key:"loadOnce",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.loaded&&(this.UseWebrtc||e)){var t=e?i:o,n=this.document.createElement("script");n.setAttribute("type","text/javascript"),n.text='(function (i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function (){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,"script","//www.google-analytics.com/analytics.js","ga");ga("create", "'+t+'", "auto");ga("set", "anonymizeIp", true);',this.document.head.appendChild(n),this.loaded=!0}}}])&&r(t.prototype,n),s&&r(t,s),e}();t.exports=s},{}],199:[function(e,t,n){t.exports={CONNECTION_UNIFI_WEBRTC_OBTAINING_CONTROLLER_INFO:"Verifying Your Account",CONNECTION_UNIFI_WEBRTC_ESTABLISHING_COMMUNICATION:"Establishing Cloud Access",CONNECTION_WEBRTC_CREATING_API_GATEWAY_CLIENT:"Verifying Cloud Access",CONNECTION_WEBRTC_AWS_IOT_CONNECTING:"Syncing with Cloud",CONNECTION_WEBRTC_WS_OPENING:"Opening Cloud Connection",CONNECTION_WEBRTC_WS_OPENING_ERROR:"Opening Cloud Connection error",CONNECTION_WEBRTC_WS_CONNECTED:"Connected to Cloud",CONNECTION_WEBRTC_AWS_OPENING:"Opening Cloud Connection",CONNECTION_WEBRTC_AWS_OPENING_ERROR:"Opening Cloud Connection error",CONNECTION_WEBRTC_AWS_CONNECTED:"Connected to Cloud",CONNECTION_WEBRTC_CREATE_ANSWER:"Checking Your Network",CONNECTION_WEBRTC_CREATE_ANSWER_ERROR:"Checking Your Network error",CONNECTION_WEBRTC_CREATE_OFFER:"Checking Your Network",CONNECTION_WEBRTC_CREATE_OFFER_ERROR:"Checking Your Network error",CONNECTION_WEBRTC_SDP_REQUESTING:"Checking Controller Network",CONNECTION_WEBRTC_SDP_SENDING_ERROR:"Checking Controller Network error",CONNECTION_WEBRTC_SDP_RECEIVED:"Controller Network checked",CONNECTION_WEBRTC_SDP_SENDING:"Syncing with Controller",CONNECTION_WEBRTC_INITIALIZED:"Cloud Access Initialized",CONNECTION_WEBRTC_CONNECTED:"Connected to Controller",CONNECTION_WEBRTC_CONNECTION_ERROR:"Connection error",CONNECTION_UNIFI_WEBRTC_INITIALIZING_APPLICATION:"Initializing application"}},{}],200:[function(e,t,n){"use strict";var r=e("./services/analytics"),i=e("../unifi-logger"),o=e("./utils/preferencesRawReader"),s=e("./services/unifiWebRtcConnector"),a=e("./services/webRtcConnectorCloud"),c=e("./services/webRtcDevice"),u=e("./services/webRtcEventBus"),f=e("./constants/UNIFI_WEBRTC_ERROR"),l=e("./constants/UNIFI_WEBRTC_EVENTS"),h=e("./constants/WEBRTC_EVENTS_PROGRESS"),d=e("./constants/WEBRTC_EVENTS_TRANSLATION_KEYS"),p=e("./components").webRtcConnectionStatus;e("./run/logger"),t.exports={analytics:r,logger:i,preferencesRawReader:o,unifiWebRtcConnector:s,webRtcConnectionStatus:p,webRtcConnectorCloud:a,webRtcDevice:c,webRtcEventBus:u,UNIFI_WEBRTC_ERROR:f,UNIFI_WEBRTC_EVENTS:l,WEBRTC_EVENTS_PROGRESS:h,WEBRTC_EVENTS_TRANSLATION_KEYS:d}},{"../unifi-logger":212,"./components":189,"./constants/UNIFI_WEBRTC_ERROR":194,"./constants/UNIFI_WEBRTC_EVENTS":195,"./constants/WEBRTC_EVENTS_PROGRESS":196,"./constants/WEBRTC_EVENTS_TRANSLATION_KEYS":197,"./run/logger":201,"./services/analytics":202,"./services/unifiWebRtcConnector":206,"./services/webRtcConnectorCloud":207,"./services/webRtcDevice":208,"./services/webRtcEventBus":209,"./utils/preferencesRawReader":210}],201:[function(e,t,n){"use strict";var r=e("../../initial/utils/preferencesRawReader"),i=e("../../unifi-logger"),o=r.readKey("browserLogLevel");i.setLevel(i[o]||i.INFO)},{"../../initial/utils/preferencesRawReader":210,"../../unifi-logger":212}],202:[function(e,t,n){"use strict";var r=e("../factories/Analytics");t.exports=new r(document,window)},{"../factories/Analytics":198}],203:[function(e,t,n){"use strict";var r=e("common-webrtc"),i=e("../../unifi-logger"),o=e("./webRtcEventBus");t.exports=r.builder().withLoggerService(i).withEventBusService({emit:function(e){o.emit(e)}}).build()},{"../../unifi-logger":212,"./webRtcEventBus":209,"common-webrtc":72}],204:[function(e,t,n){"use strict";var r=e("axios");t.exports=r.create()},{axios:21}],205:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t.split("/"),r=n.indexOf("site");this.site=r>=0&&n[r+1]?n[r+1]:null}var t,n,i;return t=e,(n=[{key:"getActiveSite",value:function(){return this.site}}])&&r(t.prototype,n),i&&r(t,i),e}();t.exports=new i(window.location.pathname)},{}],206:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=e("../../initial/services/analytics"),o=e("../../unifi-logger/services/loggerHandlerAggregator"),s=e("./site"),a=e("./webRtcConnectorCloud"),c=e("./webRtcEventBus"),u=e("./httpClient"),f=e("es6-deferred"),l=e("../constants/UNIFI_WEBRTC_EVENTS"),h=e("../constants/UNIFI_WEBRTC_APP_EVENTS"),d=e("../constants/UNIFI_WEBRTC_ERROR"),p=e("common-webrtc").WEBRTC_EVENTS,_=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.connectionDefered=null,this.connecting=!1,this.eventHandlers={},this.logsEventHandlers={},this.connectivityDetails={}}var t,n,_;return t=e,(n=[{key:"connect",value:function(e){return i.loadOnce(),this.init().then(this.getConnectivityDetails.bind(this)).then(this.establishConnection.bind(this,e)).then(this.finalize.bind(this,e)).catch(function(){})}},{key:"waitForCurrentConnection",value:function(){return this.connectionDefered?this.connectionDefered.promise:void 0}},{key:"isConnecting",value:function(){return!!this.connecting}},{key:"init",value:function(){return this.connectionDefered=new f,this.connecting=!0,Promise.resolve()}},{key:"getConnectivityDetails",value:function(){return this.connectivityDetails=window.ubntConfig,Promise.resolve(this.connectivityDetails)}},{key:"establishConnection",value:function(e){var t=this;return c.emit(l.UNIFI_WEBRTC_OBTAINING_CONTROLLER_INFO),this.createCredentials(e).then(function(n){return t.tryOpenConnection(e,n)}).catch(function(){var n=d.ERROR_ESTABLISH_CONNECTION;return t.connectionDefered.reject({message:n,deviceId:e}),Promise.reject(n)})}},{key:"createCredentials",value:function(e){var t=this;return u.post(this.connectivityDetails.unifiCloudAccess.apiGateway.url+"/create-credentials",{withTurn:!0},{withCredentials:!0}).then(function(e){return e.data}).catch(function(){var n=d.ERROR_NOT_LOGGED_INTO_SSO;return t.connectionDefered.reject({message:n,deviceId:e}),Promise.reject(n)})}},{key:"tryOpenConnection",value:function(e,t){var n=this;return this.openConnection(e,t).catch(function(r){return r===p.WEBRTC_DEVICE_OFFLINE?(n.connectionDefered.reject({message:d.DEVICE_OFFLINE,deviceId:e}),Promise.reject(d.DEVICE_OFFLINE)):(n.connectionDefered.reject({message:d.ERROR_ESTABLISH_CONNECTION,deviceId:e,credentials:t}),Promise.reject(d.ERROR_ESTABLISH_CONNECTION))})}},{key:"openConnection",value:function(e,t){var n=this;c.emit(l.UNIFI_WEBRTC_ESTABLISHING_COMMUNICATION);var r=null;return s.getActiveSite()&&(r="update_"+s.getActiveSite()),o.clear(),o.enable(),a.establishConnection({deviceId:e,turnCredentials:t.turnCredentials,credentials:t,connectivityDetails:this.connectivityDetails,channelNames:r?[r]:[]}).then(function(){o.clear(),o.disable(),r&&a.on(r,n.onmessage.bind(n)),c.on(h.UNIFI_WEBRTC_APP_CONTEXT_CHANGE,function(e,t){var i=r?r.substring(r.indexOf("_")+1):null;t&&t!==i&&a.closeChannel(r).catch(function(){}).then(function(){return r="update_"+t,n.openChannel(r)}).then(function(){a.on(r,n.onmessage.bind(n))})})})}},{key:"finalize",value:function(e){c.emit(l.UNIFI_WEBRTC_INITIALIZING_APPLICATION),this.connectionDefered.resolve(e),this.connecting=!1}},{key:"onmessage",value:function(e){var t=e.data.meta.message;if(this.eventHandlers[t]){var n=Object.assign({},e.data.meta,e.data);this.eventHandlers[t].forEach(function(e){e(n)})}}},{key:"onLogsMessage",value:function(e){var t=e.data.meta.message;if(this.logsEventHandlers[t]){var n=Object.assign({},e.data.meta,e.data);this.logsEventHandlers[t](n)}}},{key:"getBrowserLog",value:function(){return o.dumpToJsonFile()}},{key:"getControllerLog",value:function(e){return a.sendSignallingAction("get_webrtc_logs",{device_id:e}).then(function(e){return e.debug_log})}},{key:"send",value:function(e,t){return a.sendApiRequest(e,{method:"POST",contentType:"application/json",data:t})}},{key:"registerHandler",value:function(e,t){this.eventHandlers[e]=this.eventHandlers[e]||[],this.eventHandlers[e].push(t)}},{key:"unregisterHandler",value:function(e){this.eventHandlers[e]&&delete this.eventHandlers[e]}},{key:"registerLogsHandler",value:function(e,t){this.logsEventHandlers[e]=t}},{key:"openChannel",value:function(e){var t=this;a.openChannel(e).then(function(){a.on(e,t.onmessage.bind(t))})}}])&&r(t.prototype,n),_&&r(t,_),e}();t.exports=new _},{"../../initial/services/analytics":202,"../../unifi-logger/services/loggerHandlerAggregator":215,"../constants/UNIFI_WEBRTC_APP_EVENTS":193,"../constants/UNIFI_WEBRTC_ERROR":194,"../constants/UNIFI_WEBRTC_EVENTS":195,"./httpClient":204,"./site":205,"./webRtcConnectorCloud":207,"./webRtcEventBus":209,"common-webrtc":72,"es6-deferred":114}],207:[function(e,t,n){"use strict";var r=e("./commonWebRtc"),i=window.webrtcConfig,o=i.SignallingChannelType,s=i.WebRtcStartAsCaller;t.exports=new r.WebRtcConnector({signallingChannel:new r.SignallingChannel({type:o}),startAsCaller:s})},{"./commonWebRtc":203}],208:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n={};t.search.substring(1).split("&").forEach(function(e){var t=e.split("=");n[decodeURIComponent(t[0])]=decodeURIComponent(t[1])}),n.d&&(this.activeDevice=n.d)}var t,n,i;return t=e,(n=[{key:"getActiveDevice",value:function(){return this.activeDevice}}])&&r(t.prototype,n),i&&r(t,i),e}();t.exports=new i(document.location)},{}],209:[function(e,t,n){"use strict";var r=e("nanobus");t.exports=r("webrtc")},{nanobus:138}],210:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,i;return t=e,(n=[{key:"readKey",value:function(e){if(window.localStorage){var t=localStorage.getItem("unifi-preferences"),n=localStorage.getItem("unifi-preferences-"+t);try{return n&&JSON.parse(n)[e]}catch(e){}}}}])&&r(t.prototype,n),i&&r(t,i),e}();t.exports=new i},{}],211:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._storage=[],this._enabled=!0}var t,n,i;return t=e,(n=[{key:"clear",value:function(){this._storage=[]}},{key:"get",value:function(){return this._storage}},{key:"dumpToJsonFile",value:function(){var e=JSON.stringify(this.get(),null,4);return new Blob([e],{type:"application/json"})}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this._enabled=!1}},{key:"handle",value:function(e){this._enabled&&this._storage.push(e)}}])&&r(t.prototype,n),i&&r(t,i),e}();t.exports=i},{}],212:[function(e,t,n){"use strict";t.exports=e("./services/logger")},{"./services/logger":213}],213:[function(e,t,n){"use strict";var r=e("js-logger"),i=e("./loggerHandlerAggregator"),o=e("./loggerHandlerConsole");r.setHandler(function(e,t){i.handle(e,t),o.handle(e,t)}),r.aggregator=i,t.exports=r},{"./loggerHandlerAggregator":215,"./loggerHandlerConsole":216,"js-logger":121}],214:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){if(e&&("object"!==r(e)||e instanceof Event))return e;if(void 0!==e)try{return JSON.parse(JSON.stringify(e))}catch(e){return}}t.exports=function(e){for(var t=0;t<e.length;++t)e[t]=i(e[t]);e.unshift((new Date).toUTCString()),e.unshift(window.performance.now().toFixed(4)+"ms")}},{}],215:[function(e,t,n){"use strict";var r=e("../factories/LoggerHandlerAggregator");t.exports=new r},{"../factories/LoggerHandlerAggregator":211}],216:[function(e,t,n){"use strict";var r=e("js-logger"),i=e("./loggerFormatter");t.exports=new function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.handle=r.createDefaultHandler({formatter:i})}},{"./loggerFormatter":214,"js-logger":121}]},{},[188]);