diff --git a/.pubnub.yml b/.pubnub.yml index 7ed353c07..5605b9add 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,11 +1,16 @@ name: javascript -version: 4.21.5 +version: 4.21.6 schema: 1 scm: github.com/pubnub/javascript files: - dist/web/pubnub.js - dist/web/pubnub.min.js changelog: + - version: v4.21.6 + date: 2018-10-04 + changes: + - type: bug + text: fix POST for nativescript adapter over android - version: v4.21.5 date: 2018-08-06 changes: diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d60c9750..5cb502aae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## [v4.21.6](https://github.com/pubnub/javascript/tree/v4.21.6) + October-04-2018 + + + [Full Changelog](https://github.com/pubnub/javascript/compare/v4.21.5...v4.21.6) + + + +- 🐛fix POST for nativescript adapter over android + + + ## [v4.21.5](https://github.com/pubnub/javascript/tree/v4.21.5) August-06-2018 diff --git a/README.md b/README.md index c2c339ecd..e726724bd 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,5 @@ please use the [master_3x](https://github.com/pubnub/javascript/tree/master_3x) ## CDN Links -* https://cdn.pubnub.com/sdk/javascript/pubnub.4.21.5.min.js -* https://cdn.pubnub.com/sdk/javascript/pubnub.4.21.5.js +* https://cdn.pubnub.com/sdk/javascript/pubnub.4.21.6.min.js +* https://cdn.pubnub.com/sdk/javascript/pubnub.4.21.6.js diff --git a/dist/titanium/pubnub.js b/dist/titanium/pubnub.js index 4909efcfa..0c3184624 100644 --- a/dist/titanium/pubnub.js +++ b/dist/titanium/pubnub.js @@ -1,4 +1,4 @@ -/*! 4.21.5 / Consumer */ +/*! 4.21.6 / Consumer */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -586,7 +586,7 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: 'getVersion', value: function getVersion() { - return '4.21.5'; + return '4.21.6'; } }, { key: '_decideUUID', diff --git a/dist/titanium/pubnub.min.js b/dist/titanium/pubnub.min.js index ee5ba46f8..9b2046252 100644 --- a/dist/titanium/pubnub.min.js +++ b/dist/titanium/pubnub.min.js @@ -1,3 +1,3 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PubNub=t():e.PubNub=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=n(1),u=r(a),c=n(39),l=r(c),f=n(40),h=r(f),d=n(41),p=(n(5),function(e){function t(e){return i(this,t),e.db=new h.default,e.sdkFamily="TitaniumSDK",e.networking=new l.default({del:d.del,get:d.get,post:d.post}),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return s(t,e),t}(u.default));t.default=p,e.exports=t.default},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535>>2]=n[i>>>2];else t.push.apply(t,n);return this.sigBytes+=e,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=0;r>>2]>>>24-r%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(n,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.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),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*o,i=e.min(4*t,i),t){for(var u=0;ul;){var f;e:{f=c;for(var h=e.sqrt(f),d=2;d<=h;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(8>l&&(s[l]=u(e.pow(c,.5))),a[l]=u(e.pow(c,1/3)),l++),c++}var p=[],r=r.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],u=n[4],c=n[5],l=n[6],f=n[7],h=0;64>h;h++){if(16>h)p[h]=0|e[t+h];else{var d=p[h-15],g=p[h-2];p[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+p[h-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+p[h-16]}d=f+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+a[h]+p[h],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&o^i&o),f=l,l=c,c=u,u=s+d|0,s=o,o=i,i=r,r=d+g|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]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+f|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(r),t.HmacSHA256=o._createHmacHelper(r)}(Math),function(){var e=n,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,i=4*r;n.sigBytes>i&&(n=e.finalize(n)),n.clamp();for(var o=this._oKey=n.clone(),s=this._iKey=n.clone(),a=o.words,u=s.words,c=0;c>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;4>s&&i+.75*s>>6*(3-s)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var n=e.length,r=this._map,i=r.charAt(64);i&&-1!=(i=e.indexOf(i))&&(n=i);for(var i=[],o=0,s=0;s>>6-s%4*2;i[o>>>2]|=(a|u)<<24-o%4*8,o++}return t.create(i,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,n,r,i,o,s){return((e=e+(t&n|~t&r)+i+s)<>>32-o)+t}function r(e,t,n,r,i,o,s){return((e=e+(t&r|n&~r)+i+s)<>>32-o)+t}function i(e,t,n,r,i,o,s){return((e=e+(t^n^r)+i+s)<>>32-o)+t}function o(e,t,n,r,i,o,s){return((e=e+(n^(t|~r))+i+s)<>>32-o)+t}for(var s=n,a=s.lib,u=a.WordArray,c=a.Hasher,a=s.algo,l=[],f=0;64>f;f++)l[f]=4294967296*e.abs(e.sin(f+1))|0;a=a.MD5=c.extend({_doReset:function(){this._hash=new u.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,n){for(var s=0;16>s;s++){var a=n+s,u=e[a];e[a]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}var s=this._hash.words,a=e[n+0],u=e[n+1],c=e[n+2],f=e[n+3],h=e[n+4],d=e[n+5],p=e[n+6],g=e[n+7],y=e[n+8],b=e[n+9],v=e[n+10],_=e[n+11],m=e[n+12],k=e[n+13],P=e[n+14],S=e[n+15],O=s[0],C=s[1],M=s[2],T=s[3],O=t(O,C,M,T,a,7,l[0]),T=t(T,O,C,M,u,12,l[1]),M=t(M,T,O,C,c,17,l[2]),C=t(C,M,T,O,f,22,l[3]),O=t(O,C,M,T,h,7,l[4]),T=t(T,O,C,M,d,12,l[5]),M=t(M,T,O,C,p,17,l[6]),C=t(C,M,T,O,g,22,l[7]),O=t(O,C,M,T,y,7,l[8]),T=t(T,O,C,M,b,12,l[9]),M=t(M,T,O,C,v,17,l[10]),C=t(C,M,T,O,_,22,l[11]),O=t(O,C,M,T,m,7,l[12]),T=t(T,O,C,M,k,12,l[13]),M=t(M,T,O,C,P,17,l[14]),C=t(C,M,T,O,S,22,l[15]),O=r(O,C,M,T,u,5,l[16]),T=r(T,O,C,M,p,9,l[17]),M=r(M,T,O,C,_,14,l[18]),C=r(C,M,T,O,a,20,l[19]),O=r(O,C,M,T,d,5,l[20]),T=r(T,O,C,M,v,9,l[21]),M=r(M,T,O,C,S,14,l[22]),C=r(C,M,T,O,h,20,l[23]),O=r(O,C,M,T,b,5,l[24]),T=r(T,O,C,M,P,9,l[25]),M=r(M,T,O,C,f,14,l[26]),C=r(C,M,T,O,y,20,l[27]),O=r(O,C,M,T,k,5,l[28]),T=r(T,O,C,M,c,9,l[29]),M=r(M,T,O,C,g,14,l[30]),C=r(C,M,T,O,m,20,l[31]),O=i(O,C,M,T,d,4,l[32]),T=i(T,O,C,M,y,11,l[33]),M=i(M,T,O,C,_,16,l[34]),C=i(C,M,T,O,P,23,l[35]),O=i(O,C,M,T,u,4,l[36]),T=i(T,O,C,M,h,11,l[37]),M=i(M,T,O,C,g,16,l[38]),C=i(C,M,T,O,v,23,l[39]),O=i(O,C,M,T,k,4,l[40]),T=i(T,O,C,M,a,11,l[41]),M=i(M,T,O,C,f,16,l[42]),C=i(C,M,T,O,p,23,l[43]),O=i(O,C,M,T,b,4,l[44]),T=i(T,O,C,M,m,11,l[45]),M=i(M,T,O,C,S,16,l[46]),C=i(C,M,T,O,c,23,l[47]),O=o(O,C,M,T,a,6,l[48]),T=o(T,O,C,M,g,10,l[49]),M=o(M,T,O,C,P,15,l[50]),C=o(C,M,T,O,d,21,l[51]),O=o(O,C,M,T,m,6,l[52]),T=o(T,O,C,M,f,10,l[53]),M=o(M,T,O,C,v,15,l[54]),C=o(C,M,T,O,u,21,l[55]),O=o(O,C,M,T,y,6,l[56]),T=o(T,O,C,M,S,10,l[57]),M=o(M,T,O,C,p,15,l[58]),C=o(C,M,T,O,k,21,l[59]),O=o(O,C,M,T,h,6,l[60]),T=o(T,O,C,M,_,10,l[61]),M=o(M,T,O,C,c,15,l[62]),C=o(C,M,T,O,b,21,l[63]);s[0]=s[0]+O|0,s[1]=s[1]+C|0,s[2]=s[2]+M|0,s[3]=s[3]+T|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var o=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process(),t=this._hash,n=t.words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var e=c.clone.call(this);return e._hash=this._hash.clone(),e}}),s.MD5=c._createHelper(a),s.HmacMD5=c._createHmacHelper(a)}(Math),function(){var e=n,t=e.lib,r=t.Base,i=t.WordArray,t=e.algo,o=t.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:t.MD5,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,n=n.iterations;s.length>>2]}},r.BlockCipher=c.extend({cfg:c.cfg.extend({mode:l,padding:h}),reset:function(){c.reset.call(this);var e=this.cfg,t=e.iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=e.createEncryptor;else n=e.createDecryptor,this._minBufferSize=1;this._mode=n.call(e,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});var d=r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),l=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return e=e.salt,(e?o.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){e=a.parse(e);var t=e.words;if(1398893684==t[0]&&1701076831==t[1]){var n=o.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return d.create({ciphertext:e,salt:n})}},p=r.SerializableCipher=i.extend({cfg:i.extend({format:l}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,d.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.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}}),t=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){return r||(r=o.random(8)),e=u.create({keySize:t+n}).compute(e,r),n=o.create(e.words.slice(t),4*n),e.sigBytes=4*t,d.create({key:e,iv:n,salt:r})}},g=r.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:t}),encrypt:function(e,t,n,r){return r=this.cfg.extend(r),n=r.kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,e=p.encrypt.call(this,e,t,n.key,r),e.mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,p.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],o=[],s=[],a=[],u=[],c=[],l=[],f=[],h=[],d=[],p=[],g=0;256>g;g++)p[g]=128>g?g<<1:g<<1^283;for(var y=0,b=0,g=0;256>g;g++){var v=b^b<<1^b<<2^b<<3^b<<4,v=v>>>8^255&v^99;i[y]=v,o[v]=y;var _=p[y],m=p[_],k=p[m],P=257*p[v]^16843008*v;s[y]=P<<24|P>>>8,a[y]=P<<16|P>>>16,u[y]=P<<8|P>>>24,c[y]=P,P=16843009*k^65537*m^257*_^16843008*y,l[v]=P<<24|P>>>8,f[v]=P<<16|P>>>16,h[v]=P<<8|P>>>24,d[v]=P,y?(y=_^p[p[p[k^_]]],b^=p[p[b]]):y=b=1}var S=[0,1,2,4,8,16,32,64,128,27,54],r=r.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes/4,e=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s]):(s=s<<8|s>>>24,s=i[s>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s],s^=S[o/n|0]<<24),r[o]=r[o-n]^s}for(t=this._invKeySchedule=[],n=0;nn||4>=o?s:l[i[s>>>24]]^f[i[s>>>16&255]]^h[i[s>>>8&255]]^d[i[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,u,c,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,l,f,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 u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],h=e[t+3]^n[3],d=4,p=1;p>>24]^i[l>>>16&255]^o[f>>>8&255]^s[255&h]^n[d++],y=r[l>>>24]^i[f>>>16&255]^o[h>>>8&255]^s[255&c]^n[d++],b=r[f>>>24]^i[h>>>16&255]^o[c>>>8&255]^s[255&l]^n[d++],h=r[h>>>24]^i[c>>>16&255]^o[l>>>8&255]^s[255&f]^n[d++],c=g,l=y,f=b;g=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&h])^n[d++],y=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^n[d++],b=(a[f>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],h=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^n[d++],e[t]=g,e[t+1]=y,e[t+2]=b,e[t+3]=h},keySize:8});e.AES=t._createHelper(r)}(),n.mode.ECB=function(){var e=n.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e}(),e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535>>2]=n[i>>>2];else t.push.apply(t,n);return this.sigBytes+=e,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=0;r>>2]>>>24-r%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(n,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.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),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*o,i=e.min(4*t,i),t){for(var u=0;ul;){var f;e:{f=c;for(var h=e.sqrt(f),d=2;d<=h;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(8>l&&(s[l]=u(e.pow(c,.5))),a[l]=u(e.pow(c,1/3)),l++),c++}var p=[],r=r.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],u=n[4],c=n[5],l=n[6],f=n[7],h=0;64>h;h++){if(16>h)p[h]=0|e[t+h];else{var d=p[h-15],g=p[h-2];p[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+p[h-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+p[h-16]}d=f+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+a[h]+p[h],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&o^i&o),f=l,l=c,c=u,u=s+d|0,s=o,o=i,i=r,r=d+g|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]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+f|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(r),t.HmacSHA256=o._createHmacHelper(r)}(Math),function(){var e=n,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,i=4*r;n.sigBytes>i&&(n=e.finalize(n)),n.clamp();for(var o=this._oKey=n.clone(),s=this._iKey=n.clone(),a=o.words,u=s.words,c=0;c>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;4>s&&i+.75*s>>6*(3-s)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var n=e.length,r=this._map,i=r.charAt(64);i&&-1!=(i=e.indexOf(i))&&(n=i);for(var i=[],o=0,s=0;s>>6-s%4*2;i[o>>>2]|=(a|u)<<24-o%4*8,o++}return t.create(i,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,n,r,i,o,s){return((e=e+(t&n|~t&r)+i+s)<>>32-o)+t}function r(e,t,n,r,i,o,s){return((e=e+(t&r|n&~r)+i+s)<>>32-o)+t}function i(e,t,n,r,i,o,s){return((e=e+(t^n^r)+i+s)<>>32-o)+t}function o(e,t,n,r,i,o,s){return((e=e+(n^(t|~r))+i+s)<>>32-o)+t}for(var s=n,a=s.lib,u=a.WordArray,c=a.Hasher,a=s.algo,l=[],f=0;64>f;f++)l[f]=4294967296*e.abs(e.sin(f+1))|0;a=a.MD5=c.extend({_doReset:function(){this._hash=new u.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,n){for(var s=0;16>s;s++){var a=n+s,u=e[a];e[a]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}var s=this._hash.words,a=e[n+0],u=e[n+1],c=e[n+2],f=e[n+3],h=e[n+4],d=e[n+5],p=e[n+6],g=e[n+7],y=e[n+8],b=e[n+9],v=e[n+10],_=e[n+11],m=e[n+12],k=e[n+13],P=e[n+14],S=e[n+15],O=s[0],C=s[1],M=s[2],T=s[3],O=t(O,C,M,T,a,7,l[0]),T=t(T,O,C,M,u,12,l[1]),M=t(M,T,O,C,c,17,l[2]),C=t(C,M,T,O,f,22,l[3]),O=t(O,C,M,T,h,7,l[4]),T=t(T,O,C,M,d,12,l[5]),M=t(M,T,O,C,p,17,l[6]),C=t(C,M,T,O,g,22,l[7]),O=t(O,C,M,T,y,7,l[8]),T=t(T,O,C,M,b,12,l[9]),M=t(M,T,O,C,v,17,l[10]),C=t(C,M,T,O,_,22,l[11]),O=t(O,C,M,T,m,7,l[12]),T=t(T,O,C,M,k,12,l[13]),M=t(M,T,O,C,P,17,l[14]),C=t(C,M,T,O,S,22,l[15]),O=r(O,C,M,T,u,5,l[16]),T=r(T,O,C,M,p,9,l[17]),M=r(M,T,O,C,_,14,l[18]),C=r(C,M,T,O,a,20,l[19]),O=r(O,C,M,T,d,5,l[20]),T=r(T,O,C,M,v,9,l[21]),M=r(M,T,O,C,S,14,l[22]),C=r(C,M,T,O,h,20,l[23]),O=r(O,C,M,T,b,5,l[24]),T=r(T,O,C,M,P,9,l[25]),M=r(M,T,O,C,f,14,l[26]),C=r(C,M,T,O,y,20,l[27]),O=r(O,C,M,T,k,5,l[28]),T=r(T,O,C,M,c,9,l[29]),M=r(M,T,O,C,g,14,l[30]),C=r(C,M,T,O,m,20,l[31]),O=i(O,C,M,T,d,4,l[32]),T=i(T,O,C,M,y,11,l[33]),M=i(M,T,O,C,_,16,l[34]),C=i(C,M,T,O,P,23,l[35]),O=i(O,C,M,T,u,4,l[36]),T=i(T,O,C,M,h,11,l[37]),M=i(M,T,O,C,g,16,l[38]),C=i(C,M,T,O,v,23,l[39]),O=i(O,C,M,T,k,4,l[40]),T=i(T,O,C,M,a,11,l[41]),M=i(M,T,O,C,f,16,l[42]),C=i(C,M,T,O,p,23,l[43]),O=i(O,C,M,T,b,4,l[44]),T=i(T,O,C,M,m,11,l[45]),M=i(M,T,O,C,S,16,l[46]),C=i(C,M,T,O,c,23,l[47]),O=o(O,C,M,T,a,6,l[48]),T=o(T,O,C,M,g,10,l[49]),M=o(M,T,O,C,P,15,l[50]),C=o(C,M,T,O,d,21,l[51]),O=o(O,C,M,T,m,6,l[52]),T=o(T,O,C,M,f,10,l[53]),M=o(M,T,O,C,v,15,l[54]),C=o(C,M,T,O,u,21,l[55]),O=o(O,C,M,T,y,6,l[56]),T=o(T,O,C,M,S,10,l[57]),M=o(M,T,O,C,p,15,l[58]),C=o(C,M,T,O,k,21,l[59]),O=o(O,C,M,T,h,6,l[60]),T=o(T,O,C,M,_,10,l[61]),M=o(M,T,O,C,c,15,l[62]),C=o(C,M,T,O,b,21,l[63]);s[0]=s[0]+O|0,s[1]=s[1]+C|0,s[2]=s[2]+M|0,s[3]=s[3]+T|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var o=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process(),t=this._hash,n=t.words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var e=c.clone.call(this);return e._hash=this._hash.clone(),e}}),s.MD5=c._createHelper(a),s.HmacMD5=c._createHmacHelper(a)}(Math),function(){var e=n,t=e.lib,r=t.Base,i=t.WordArray,t=e.algo,o=t.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:t.MD5,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,n=n.iterations;s.length>>2]}},r.BlockCipher=c.extend({cfg:c.cfg.extend({mode:l,padding:h}),reset:function(){c.reset.call(this);var e=this.cfg,t=e.iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=e.createEncryptor;else n=e.createDecryptor,this._minBufferSize=1;this._mode=n.call(e,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});var d=r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),l=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return e=e.salt,(e?o.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){e=a.parse(e);var t=e.words;if(1398893684==t[0]&&1701076831==t[1]){var n=o.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return d.create({ciphertext:e,salt:n})}},p=r.SerializableCipher=i.extend({cfg:i.extend({format:l}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,d.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.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}}),t=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){return r||(r=o.random(8)),e=u.create({keySize:t+n}).compute(e,r),n=o.create(e.words.slice(t),4*n),e.sigBytes=4*t,d.create({key:e,iv:n,salt:r})}},g=r.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:t}),encrypt:function(e,t,n,r){return r=this.cfg.extend(r),n=r.kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,e=p.encrypt.call(this,e,t,n.key,r),e.mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,p.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],o=[],s=[],a=[],u=[],c=[],l=[],f=[],h=[],d=[],p=[],g=0;256>g;g++)p[g]=128>g?g<<1:g<<1^283;for(var y=0,b=0,g=0;256>g;g++){var v=b^b<<1^b<<2^b<<3^b<<4,v=v>>>8^255&v^99;i[y]=v,o[v]=y;var _=p[y],m=p[_],k=p[m],P=257*p[v]^16843008*v;s[y]=P<<24|P>>>8,a[y]=P<<16|P>>>16,u[y]=P<<8|P>>>24,c[y]=P,P=16843009*k^65537*m^257*_^16843008*y,l[v]=P<<24|P>>>8,f[v]=P<<16|P>>>16,h[v]=P<<8|P>>>24,d[v]=P,y?(y=_^p[p[p[k^_]]],b^=p[p[b]]):y=b=1}var S=[0,1,2,4,8,16,32,64,128,27,54],r=r.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes/4,e=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s]):(s=s<<8|s>>>24,s=i[s>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s],s^=S[o/n|0]<<24),r[o]=r[o-n]^s}for(t=this._invKeySchedule=[],n=0;nn||4>=o?s:l[i[s>>>24]]^f[i[s>>>16&255]]^h[i[s>>>8&255]]^d[i[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,u,c,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,l,f,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 u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],h=e[t+3]^n[3],d=4,p=1;p>>24]^i[l>>>16&255]^o[f>>>8&255]^s[255&h]^n[d++],y=r[l>>>24]^i[f>>>16&255]^o[h>>>8&255]^s[255&c]^n[d++],b=r[f>>>24]^i[h>>>16&255]^o[c>>>8&255]^s[255&l]^n[d++],h=r[h>>>24]^i[c>>>16&255]^o[l>>>8&255]^s[255&f]^n[d++],c=g,l=y,f=b;g=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&h])^n[d++],y=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^n[d++],b=(a[f>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],h=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^n[d++],e[t]=g,e[t+1]=y,e[t+2]=b,e[t+3]=h},keySize:8});e.AES=t._createHelper(r)}(),n.mode.ECB=function(){var e=n.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e}(),e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n=s){var u={};u.category=y.default.PNRequestMessageCountExceededCategory,u.operation=e.operation,this._listenerManager.announceStatus(u)}i.forEach(function(e){var t=e.channel,r=e.subscriptionMatch,i=e.publishMetaData;if(t===r&&(r=null),a){if(n._dedupingManager.isDuplicate(e))return;n._dedupingManager.addEntry(e)}if(p.default.endsWith(e.channel,"-pnpres")){var o={};o.channel=null,o.subscription=null,o.actualChannel=null!=r?t:null,o.subscribedChannel=null!=r?r:t,t&&(o.channel=t.substring(0,t.lastIndexOf("-pnpres"))),r&&(o.subscription=r.substring(0,r.lastIndexOf("-pnpres"))),o.action=e.payload.action,o.state=e.payload.data,o.timetoken=i.publishTimetoken,o.occupancy=e.payload.occupancy,o.uuid=e.payload.uuid,o.timestamp=e.payload.timestamp,e.payload.join&&(o.join=e.payload.join),e.payload.leave&&(o.leave=e.payload.leave),e.payload.timeout&&(o.timeout=e.payload.timeout),n._listenerManager.announcePresence(o)}else{var s={};s.channel=null,s.subscription=null,s.actualChannel=null!=r?t:null,s.subscribedChannel=null!=r?r:t,s.channel=t,s.subscription=r,s.timetoken=i.publishTimetoken,s.publisher=e.issuingClientId,e.userMetadata&&(s.userMetadata=e.userMetadata),n._config.cipherKey?s.message=n._crypto.decrypt(e.payload):s.message=e.payload,n._listenerManager.announceMessage(s)}}),this._region=t.metadata.region,this._startSubscribeLoop()}},{key:"_stopSubscribeLoop",value:function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)}}]),e}();t.default=b,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n=this._config.maximumCacheSize&&this.hashHistory.shift(),this.hashHistory.push(this.getKey(e))}},{key:"clearHistory",value:function(){this.hashHistory=[]}}]),e}();t.default=a,e.exports=t.default},function(e,t){"use strict";function n(e){var t=[];return Object.keys(e).forEach(function(e){return t.push(e)}),t}function r(e){return encodeURIComponent(e).replace(/[!~*'()]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}function i(e){return n(e).sort()}function o(e){return i(e).map(function(t){return t+"="+r(e[t])}).join("&")}function s(e,t){return-1!==e.indexOf(t,this.length-t.length)}function a(){var e=void 0,t=void 0;return{promise:new Promise(function(n,r){e=n,t=r}),reject:t,fulfill:e}}e.exports={signPamFromParams:o,endsWith:s,createPromise:a,encodeString:r}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){return e.type=t,e.error=!0,e}function u(e){return a({message:e},"validationError")}function c(e,t,n){return e.usePost&&e.usePost(t,n)?e.postURL(t,n):e.getURL(t,n)}function l(e){if(e.sdkName)return e.sdkName;var t="PubNub-JS-"+e.sdkFamily;return e.partnerId&&(t+="-"+e.partnerId),t+="/"+e.getVersion()}function f(e,t,n){var r=e.config,i=e.crypto;n.timestamp=Math.floor((new Date).getTime()/1e3);var o=r.subscribeKey+"\n"+r.publishKey+"\n"+t+"\n";o+=g.default.signPamFromParams(n);var s=i.HMACSHA256(o);s=s.replace(/\+/g,"-"),s=s.replace(/\//g,"_"),n.signature=s}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=e.networking,r=e.config,i=null,o=null,s={};t.getOperation()===v.default.PNTimeOperation||t.getOperation()===v.default.PNChannelGroupsOperation?i=arguments.length<=2?void 0:arguments[2]:(s=arguments.length<=2?void 0:arguments[2],i=arguments.length<=3?void 0:arguments[3]),"undefined"==typeof Promise||i||(o=g.default.createPromise());var a=t.validateParams(e,s);if(!a){var h=t.prepareParams(e,s),p=c(t,e,s),y=void 0,b={url:p,operation:t.getOperation(),timeout:t.getRequestTimeout(e)};h.uuid=r.UUID,h.pnsdk=l(r),r.useInstanceId&&(h.instanceid=r.instanceId),r.useRequestId&&(h.requestid=d.default.createUUID()),t.isAuthSupported()&&r.getAuthKey()&&(h.auth=r.getAuthKey()),r.secretKey&&f(e,p,h);var m=function(n,r){if(n.error)return void(i?i(n):o&&o.reject(new _("PubNub call failed, check status for details",n)));var a=t.handleResponse(e,r,s);i?i(n,a):o&&o.fulfill(a)};if(t.usePost&&t.usePost(e,s)){var k=t.postPayload(e,s);y=n.POST(h,k,b,m)}else y=t.useDelete&&t.useDelete()?n.DELETE(h,b,m):n.GET(h,b,m);return t.getOperation()===v.default.PNSubscribeOperation?y:o?o.promise:void 0}return i?i(u(a)):o?(o.reject(new _("Validation failed, check status for details",u(a))),o.promise):void 0};var h=n(3),d=r(h),p=(n(5),n(15)),g=r(p),y=n(2),b=(r(y),n(13)),v=r(b),_=function(e){function t(e,n){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.name=r.constructor.name,r.status=n,r.message=e,r}return s(t,e),t}(Error);e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return h.default.PNAddChannelsToGroupOperation}function o(e,t){var n=t.channels,r=t.channelGroup,i=e.config;return r?n&&0!==n.length?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"}function s(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+p.default.encodeString(n)}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.channels;return{add:(void 0===n?[]:n).join(",")}}function l(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.getURL=s,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var f=(n(5),n(13)),h=r(f),d=n(15),p=r(d)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return h.default.PNRemoveChannelsFromGroupOperation}function o(e,t){var n=t.channels,r=t.channelGroup,i=e.config;return r?n&&0!==n.length?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"}function s(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+p.default.encodeString(n)}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.channels;return{remove:(void 0===n?[]:n).join(",")}}function l(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.getURL=s,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var f=(n(5),n(13)),h=r(f),d=n(15),p=r(d)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return h.default.PNRemoveGroupOperation}function o(e,t){var n=t.channelGroup,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"}function s(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+p.default.encodeString(n)+"/remove"}function a(){return!0}function u(e){return e.config.getTransactionTimeout()}function c(){return{}}function l(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.getURL=s,t.isAuthSupported=a,t.getRequestTimeout=u,t.prepareParams=c,t.handleResponse=l;var f=(n(5),n(13)),h=r(f),d=n(15),p=r(d)},function(e,t,n){"use strict";function r(){return f.default.PNChannelGroupsOperation}function i(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function o(e){return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group"}function s(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(){return{}}function c(e,t){return{groups:t.payload.groups}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=o,t.getRequestTimeout=s,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),f=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return h.default.PNChannelsForGroupOperation}function o(e,t){var n=t.channelGroup,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"}function s(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+p.default.encodeString(n)}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(){return{}}function l(e,t){return{channels:t.payload.channels}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.getURL=s,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var f=(n(5),n(13)),h=r(f),d=n(15),p=r(d)},function(e,t,n){"use strict";function r(){return f.default.PNPushNotificationEnabledChannelsOperation}function i(e,t){var n=t.device,r=t.pushGateway,i=t.channels,o=e.config;return n?r?i&&0!==i.length?o.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"}function o(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n}function s(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(e,t){var n=t.pushGateway,r=t.channels;return{type:n,add:(void 0===r?[]:r).join(",")}}function c(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=o,t.getRequestTimeout=s,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),f=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(){return f.default.PNPushNotificationEnabledChannelsOperation}function i(e,t){var n=t.device,r=t.pushGateway,i=t.channels,o=e.config;return n?r?i&&0!==i.length?o.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"}function o(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n}function s(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(e,t){var n=t.pushGateway,r=t.channels;return{type:n,remove:(void 0===r?[]:r).join(",")}}function c(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=o,t.getRequestTimeout=s,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),f=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(){return f.default.PNPushNotificationEnabledChannelsOperation}function i(e,t){var n=t.device,r=t.pushGateway,i=e.config;return n?r?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"}function o(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n}function s(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(e,t){return{type:t.pushGateway}}function c(e,t){return{channels:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=o,t.getRequestTimeout=s,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),f=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(){return f.default.PNRemoveAllPushNotificationsOperation}function i(e,t){var n=t.device,r=t.pushGateway,i=e.config;return n?r?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"}function o(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n+"/remove"}function s(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(e,t){return{type:t.pushGateway}}function c(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=o,t.getRequestTimeout=s,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),f=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return h.default.PNUnsubscribeOperation}function o(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function s(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+p.default.encodeString(o)+"/leave"}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};return r.length>0&&(i["channel-group"]=r.join(",")),i}function l(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.getURL=s,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var f=(n(5),n(13)),h=r(f),d=n(15),p=r(d)},function(e,t,n){"use strict";function r(){return f.default.PNWhereNowOperation}function i(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function o(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r;return"/v2/presence/sub-key/"+n.subscribeKey+"/uuid/"+i}function s(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(){return{}}function c(e,t){return t.payload?{channels:t.payload.channels}:{channels:[]}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=o,t.getRequestTimeout=s,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),f=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return h.default.PNHeartbeatOperation}function o(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function s(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+p.default.encodeString(o)+"/heartbeat"}function a(){return!0}function u(e){return e.config.getTransactionTimeout()}function c(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.state,o=void 0===i?{}:i,s=e.config,a={};return r.length>0&&(a["channel-group"]=r.join(",")),a.state=JSON.stringify(o),a.heartbeat=s.getPresenceTimeout(),a}function l(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.getURL=s,t.isAuthSupported=a,t.getRequestTimeout=u,t.prepareParams=c,t.handleResponse=l;var f=(n(5),n(13)),h=r(f),d=n(15),p=r(d)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return h.default.PNGetStateOperation}function o(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function s(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r,o=t.channels,s=void 0===o?[]:o,a=s.length>0?s.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+p.default.encodeString(a)+"/uuid/"+i}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};return r.length>0&&(i["channel-group"]=r.join(",")),i}function l(e,t,n){var r=n.channels,i=void 0===r?[]:r,o=n.channelGroups,s=void 0===o?[]:o,a={};return 1===i.length&&0===s.length?a[i[0]]=t.payload:a=t.payload,{channels:a}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.getURL=s,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var f=(n(5),n(13)),h=r(f),d=n(15),p=r(d)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return h.default.PNSetStateOperation}function o(e,t){var n=e.config,r=t.state,i=t.channels,o=void 0===i?[]:i,s=t.channelGroups,a=void 0===s?[]:s;return r?n.subscribeKey?0===o.length&&0===a.length?"Please provide a list of channels and/or channel-groups":void 0:"Missing Subscribe Key":"Missing State"}function s(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+p.default.encodeString(o)+"/uuid/"+n.UUID+"/data"}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.state,r=t.channelGroups,i=void 0===r?[]:r,o={};return o.state=JSON.stringify(n),i.length>0&&(o["channel-group"]=i.join(",")),o}function l(e,t){return{state:t.payload}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.getURL=s,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var f=(n(5),n(13)),h=r(f),d=n(15),p=r(d)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return h.default.PNHereNowOperation}function o(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function s(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=t.channelGroups,s=void 0===o?[]:o,a="/v2/presence/sub-key/"+n.subscribeKey;if(i.length>0||s.length>0){var u=i.length>0?i.join(","):",";a+="/channel/"+p.default.encodeString(u)}return a}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.includeUUIDs,o=void 0===i||i,s=t.includeState,a=void 0!==s&&s,u={};return o||(u.disable_uuids=1),a&&(u.state=1),r.length>0&&(u["channel-group"]=r.join(",")),u}function l(e,t,n){var r=n.channels,i=void 0===r?[]:r,o=n.channelGroups,s=void 0===o?[]:o,a=n.includeUUIDs,u=void 0===a||a,c=n.includeState,l=void 0!==c&&c;return i.length>1||s.length>0||0===s.length&&0===i.length?function(){var e={};return e.totalChannels=t.payload.total_channels,e.totalOccupancy=t.payload.total_occupancy,e.channels={},Object.keys(t.payload.channels).forEach(function(n){var r=t.payload.channels[n],i=[];return e.channels[n]={occupants:i,name:n,occupancy:r.occupancy},u&&r.uuids.forEach(function(e){l?i.push({state:e.state,uuid:e.uuid}):i.push({state:null,uuid:e})}),e}),e}():function(){var e={},n=[];return e.totalChannels=1,e.totalOccupancy=t.occupancy,e.channels={},e.channels[i[0]]={occupants:n,name:i[0],occupancy:t.occupancy},u&&t.uuids&&t.uuids.forEach(function(e){l?n.push({state:e.state,uuid:e.uuid}):n.push({state:null,uuid:e})}),e}()}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.getURL=s,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var f=(n(5),n(13)),h=r(f),d=n(15),p=r(d)},function(e,t,n){"use strict";function r(){return f.default.PNAccessManagerAudit}function i(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function o(e){return"/v2/auth/audit/sub-key/"+e.config.subscribeKey}function s(e){return e.config.getTransactionTimeout()}function a(){return!1}function u(e,t){var n=t.channel,r=t.channelGroup,i=t.authKeys,o=void 0===i?[]:i,s={};return n&&(s.channel=n),r&&(s["channel-group"]=r),o.length>0&&(s.auth=o.join(",")),s}function c(e,t){return t.payload}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=o,t.getRequestTimeout=s,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),f=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(){return f.default.PNAccessManagerGrant}function i(e){var t=e.config;return t.subscribeKey?t.publishKey?t.secretKey?void 0:"Missing Secret Key":"Missing Publish Key":"Missing Subscribe Key"}function o(e){return"/v2/auth/grant/sub-key/"+e.config.subscribeKey}function s(e){return e.config.getTransactionTimeout()}function a(){return!1}function u(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.channelGroups,o=void 0===i?[]:i,s=t.ttl,a=t.read,u=void 0!==a&&a,c=t.write,l=void 0!==c&&c,f=t.manage,h=void 0!==f&&f,d=t.authKeys,p=void 0===d?[]:d,g={};return g.r=u?"1":"0",g.w=l?"1":"0",g.m=h?"1":"0",r.length>0&&(g.channel=r.join(",")),o.length>0&&(g["channel-group"]=o.join(",")),p.length>0&&(g.auth=p.join(",")),(s||0===s)&&(g.ttl=s),g}function c(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=o,t.getRequestTimeout=s,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),f=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=e.crypto,r=e.config,i=JSON.stringify(t);return r.cipherKey&&(i=n.encrypt(i), i=JSON.stringify(i)),i}function o(){return b.default.PNPublishOperation}function s(e,t){var n=e.config,r=t.message;return t.channel?r?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing Message":"Missing Channel"}function a(e,t){var n=t.sendByPost;return void 0!==n&&n}function u(e,t){var n=e.config,r=t.channel,o=t.message,s=i(e,o);return"/publish/"+n.publishKey+"/"+n.subscribeKey+"/0/"+_.default.encodeString(r)+"/0/"+_.default.encodeString(s)}function c(e,t){var n=e.config,r=t.channel;return"/publish/"+n.publishKey+"/"+n.subscribeKey+"/0/"+_.default.encodeString(r)+"/0"}function l(e){return e.config.getTransactionTimeout()}function f(){return!0}function h(e,t){return i(e,t.message)}function d(e,t){var n=t.meta,r=t.replicate,i=void 0===r||r,o=t.storeInHistory,s=t.ttl,a={};return null!=o&&(a.store=o?"1":"0"),s&&(a.ttl=s),!1===i&&(a.norep="true"),n&&"object"===(void 0===n?"undefined":g(n))&&(a.meta=JSON.stringify(n)),a}function p(e,t){return{timetoken:t[2]}}Object.defineProperty(t,"__esModule",{value:!0});var g="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};t.getOperation=o,t.validateParams=s,t.usePost=a,t.getURL=u,t.postURL=c,t.getRequestTimeout=l,t.isAuthSupported=f,t.postPayload=h,t.prepareParams=d,t.handleResponse=p;var y=(n(5),n(13)),b=r(y),v=n(15),_=r(v)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}function o(){return d.default.PNHistoryOperation}function s(e,t){var n=t.channel,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"}function a(e,t){var n=t.channel;return"/v2/history/sub-key/"+e.config.subscribeKey+"/channel/"+g.default.encodeString(n)}function u(e){return e.config.getTransactionTimeout()}function c(){return!0}function l(e,t){var n=t.start,r=t.end,i=t.reverse,o=t.count,s=void 0===o?100:o,a=t.stringifiedTimeToken,u=void 0!==a&&a,c={include_token:"true"};return c.count=s,n&&(c.start=n),r&&(c.end=r),u&&(c.string_message_token="true"),null!=i&&(c.reverse=i.toString()),c}function f(e,t){var n={messages:[],startTimeToken:t[1],endTimeToken:t[2]};return t[0].forEach(function(t){var r={timetoken:t.timetoken,entry:i(e,t.message)};n.messages.push(r)}),n}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=o,t.validateParams=s,t.getURL=a,t.getRequestTimeout=u,t.isAuthSupported=c,t.prepareParams=l,t.handleResponse=f;var h=(n(5),n(13)),d=r(h),p=n(15),g=r(p)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return d.default.PNDeleteMessagesOperation}function o(e,t){var n=t.channel,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"}function s(){return!0}function a(e,t){var n=t.channel;return"/v3/history/sub-key/"+e.config.subscribeKey+"/channel/"+g.default.encodeString(n)}function u(e){return e.config.getTransactionTimeout()}function c(){return!0}function l(e,t){var n=t.start,r=t.end,i={};return n&&(i.start=n),r&&(i.end=r),i}function f(e,t){return t.payload}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.useDelete=s,t.getURL=a,t.getRequestTimeout=u,t.isAuthSupported=c,t.prepareParams=l,t.handleResponse=f;var h=(n(5),n(13)),d=r(h),p=n(15),g=r(p)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}function o(){return d.default.PNFetchMessagesOperation}function s(e,t){var n=t.channels,r=e.config;return n&&0!==n.length?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channels"}function a(e,t){var n=t.channels,r=void 0===n?[]:n,i=e.config,o=r.length>0?r.join(","):",";return"/v3/history/sub-key/"+i.subscribeKey+"/channel/"+g.default.encodeString(o)}function u(e){return e.config.getTransactionTimeout()}function c(){return!0}function l(e,t){var n=t.start,r=t.end,i=t.count,o=t.stringifiedTimeToken,s=void 0!==o&&o,a={};return i&&(a.max=i),n&&(a.start=n),r&&(a.end=r),s&&(a.string_message_token="true"),a}function f(e,t){var n={channels:{}};return Object.keys(t.channels||{}).forEach(function(r){n.channels[r]=[],(t.channels[r]||[]).forEach(function(t){var o={};o.channel=r,o.subscription=null,o.timetoken=t.timetoken,o.message=i(e,t.message),n.channels[r].push(o)})}),n}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=o,t.validateParams=s,t.getURL=a,t.getRequestTimeout=u,t.isAuthSupported=c,t.prepareParams=l,t.handleResponse=f;var h=(n(5),n(13)),d=r(h),p=n(15),g=r(p)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return h.default.PNSubscribeOperation}function o(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function s(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/subscribe/"+n.subscribeKey+"/"+p.default.encodeString(o)+"/0"}function a(e){return e.config.getSubscribeTimeout()}function u(){return!0}function c(e,t){var n=e.config,r=t.channelGroups,i=void 0===r?[]:r,o=t.timetoken,s=t.filterExpression,a=t.region,u={heartbeat:n.getPresenceTimeout()};return i.length>0&&(u["channel-group"]=i.join(",")),s&&s.length>0&&(u["filter-expr"]=s),o&&(u.tt=o),a&&(u.tr=a),u}function l(e,t){var n=[];t.m.forEach(function(e){var t={publishTimetoken:e.p.t,region:e.p.r},r={shard:parseInt(e.a,10),subscriptionMatch:e.b,channel:e.c,payload:e.d,flags:e.f,issuingClientId:e.i,subscribeKey:e.k,originationTimetoken:e.o,userMetadata:e.u,publishMetaData:t};n.push(r)});var r={timetoken:t.t.t,region:t.t.r};return{messages:n,metadata:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=o,t.getURL=s,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var f=(n(5),n(13)),h=r(f),d=n(15),p=r(d)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n=this._maxSubDomain&&(this._currentSubDomain=1),e=this._currentSubDomain.toString(),this._providedFQDN.replace("pubsub","ps"+e)}},{key:"hasModule",value:function(e){return e in this._modules}},{key:"shiftStandardOrigin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._standardOrigin=this.nextOrigin(e),this._standardOrigin}},{key:"getStandardOrigin",value:function(){return this._standardOrigin}},{key:"POST",value:function(e,t,n,r){return this._modules.post(e,t,n,r)}},{key:"GET",value:function(e,t,n){return this._modules.get(e,t,n)}},{key:"DELETE",value:function(e,t,n){return this._modules.del(e,t,n)}},{key:"_detectErrorCategory",value:function(e){if("ENOTFOUND"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNREFUSED"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNRESET"===e.code)return u.default.PNNetworkIssuesCategory;if("EAI_AGAIN"===e.code)return u.default.PNNetworkIssuesCategory;if(0===e.status||e.hasOwnProperty("status")&&void 0===e.status)return u.default.PNNetworkIssuesCategory;if(e.timeout)return u.default.PNTimeoutCategory;if("ETIMEDOUT"===e.code)return u.default.PNNetworkIssuesCategory;if(e.response){if(e.response.badRequest)return u.default.PNBadRequestCategory;if(e.response.forbidden)return u.default.PNAccessDeniedCategory}return u.default.PNUnknownCategory}}]),e}());t.default=c,e.exports=t.default},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n>>>>>"),o.log("["+u+" / "+a+"]","\n",e,"\n",t,"\n",n),o.log("-----")}function i(){return"mobileweb"===Ti.Platform.osname?new XMLHttpRequest:Ti.Network.createHTTPClient()}function o(e){"mobileweb"!==Ti.Platform.osname&&this._config.keepAlive&&(e.enableKeepAlive=!0)}function s(e,t,n,i,s,a,u){var c=this,f={};f.operation=a.operation,e.open(t,(0,l.buildUrl)(n,i),!0),o.call(this,e),e.onload=function(){f.error=!1,e.status&&(f.statusCode=e.status);var t=JSON.parse(e.responseText);return c._config.logVerbosity&&r(n,i,e.responseText),u(f,t)},e.onerror=function(e){return f.error=!0,f.errorData=e.error,f.category=c._detectErrorCategory(e.error),u(f,null)},e.timeout="android"===Ti.Platform.osname?2147483647:1/0,e.send(s)}function a(e,t,n){var r=i(),o=this.getStandardOrigin()+t.url;return s.call(this,r,"GET",o,e,{},t,n)}function u(e,t,n,r){var o=i(),a=this.getStandardOrigin()+n.url;return s.call(this,o,"POST",a,e,JSON.parse(t),n,r)}function c(e,t,n){var r=i(),o=this.getStandardOrigin()+t.url;return s.call(this,r,"DELETE",o,e,{},t,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.get=a,t.post=u,t.del=c;var l=(n(5),n(42))},function(e,t){"use strict";function n(e,t,r){null!=r?Array.isArray(r)?r.forEach(function(r){n(e,t,r)}):"object"===(void 0===r?"undefined":i(r))?Object.keys(r).forEach(function(i){n(e,t+"["+i+"]",r[i])}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r)):null===r&&e.push(encodeURIComponent(""+encodeURIComponent(t)))}function r(e,t){var r=[];return Object.keys(t).forEach(function(e){n(r,e,t[e])}),e+"?"+r.join("&")}Object.defineProperty(t,"__esModule",{value:!0});var i="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};t.encodedKeyValuePair=n,t.buildUrl=r}])}); \ No newline at end of file diff --git a/dist/web/pubnub.js b/dist/web/pubnub.js index 3154a5364..2583001a6 100644 --- a/dist/web/pubnub.js +++ b/dist/web/pubnub.js @@ -1,4 +1,4 @@ -/*! 4.21.5 / Consumer */ +/*! 4.21.6 / Consumer */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -608,7 +608,7 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: 'getVersion', value: function getVersion() { - return '4.21.5'; + return '4.21.6'; } }, { key: '_decideUUID', diff --git a/dist/web/pubnub.min.js b/dist/web/pubnub.min.js index d866be13f..5a09f4bdc 100644 --- a/dist/web/pubnub.min.js +++ b/dist/web/pubnub.min.js @@ -1,3 +1,3 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PubNub=t():e.PubNub=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){if(!navigator||!navigator.sendBeacon)return!1;navigator.sendBeacon(e)}Object.defineProperty(t,"__esModule",{value:!0});var u=n(1),c=r(u),l=n(39),h=r(l),f=n(40),p=r(f),d=n(41),y=(n(5),function(e){function t(e){i(this,t);var n=e.listenToBrowserNetworkEvents,r=void 0===n||n;e.db=p.default,e.sdkFamily="Web",e.networking=new h.default({del:d.del,get:d.get,post:d.post,sendBeacon:a});var o=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r&&(window.addEventListener("offline",function(){o.networkDownDetected()}),window.addEventListener("online",function(){o.networkUpDetected()})),o}return o(t,e),t}(c.default));t.default=y,e.exports=t.default},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535>>2]=n[i>>>2];else t.push.apply(t,n);return this.sigBytes+=e,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=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r>>2]>>>24-r%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new o.init(n,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new o.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},h=r.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.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),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*s,i=e.min(4*t,i),t){for(var u=0;ul;){var h;e:{h=c;for(var f=e.sqrt(h),p=2;p<=f;p++)if(!(h%p)){h=!1;break e}h=!0}h&&(8>l&&(o[l]=u(e.pow(c,.5))),a[l]=u(e.pow(c,1/3)),l++),c++}var d=[],r=r.SHA256=s.extend({_doReset:function(){this._hash=new i.init(o.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],s=n[2],o=n[3],u=n[4],c=n[5],l=n[6],h=n[7],f=0;64>f;f++){if(16>f)d[f]=0|e[t+f];else{var p=d[f-15],y=d[f-2];d[f]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+d[f-7]+((y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10)+d[f-16]}p=h+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+a[f]+d[f],y=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&s^i&s),h=l,l=c,c=u,u=o+p|0,o=s,s=i,i=r,r=p+y|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+h|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(r),t.HmacSHA256=s._createHmacHelper(r)}(Math),function(){var e=n,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,i=4*r;n.sigBytes>i&&(n=e.finalize(n)),n.clamp();for(var s=this._oKey=n.clone(),o=this._iKey=n.clone(),a=s.words,u=o.words,c=0;c>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,o=0;4>o&&i+.75*o>>6*(3-o)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var n=e.length,r=this._map,i=r.charAt(64);i&&-1!=(i=e.indexOf(i))&&(n=i);for(var i=[],s=0,o=0;o>>6-o%4*2;i[s>>>2]|=(a|u)<<24-s%4*8,s++}return t.create(i,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,n,r,i,s,o){return((e=e+(t&n|~t&r)+i+o)<>>32-s)+t}function r(e,t,n,r,i,s,o){return((e=e+(t&r|n&~r)+i+o)<>>32-s)+t}function i(e,t,n,r,i,s,o){return((e=e+(t^n^r)+i+o)<>>32-s)+t}function s(e,t,n,r,i,s,o){return((e=e+(n^(t|~r))+i+o)<>>32-s)+t}for(var o=n,a=o.lib,u=a.WordArray,c=a.Hasher,a=o.algo,l=[],h=0;64>h;h++)l[h]=4294967296*e.abs(e.sin(h+1))|0;a=a.MD5=c.extend({_doReset:function(){this._hash=new u.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,n){for(var o=0;16>o;o++){var a=n+o,u=e[a];e[a]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}var o=this._hash.words,a=e[n+0],u=e[n+1],c=e[n+2],h=e[n+3],f=e[n+4],p=e[n+5],d=e[n+6],y=e[n+7],g=e[n+8],b=e[n+9],_=e[n+10],v=e[n+11],m=e[n+12],k=e[n+13],P=e[n+14],O=e[n+15],w=o[0],T=o[1],S=o[2],C=o[3],w=t(w,T,S,C,a,7,l[0]),C=t(C,w,T,S,u,12,l[1]),S=t(S,C,w,T,c,17,l[2]),T=t(T,S,C,w,h,22,l[3]),w=t(w,T,S,C,f,7,l[4]),C=t(C,w,T,S,p,12,l[5]),S=t(S,C,w,T,d,17,l[6]),T=t(T,S,C,w,y,22,l[7]),w=t(w,T,S,C,g,7,l[8]),C=t(C,w,T,S,b,12,l[9]),S=t(S,C,w,T,_,17,l[10]),T=t(T,S,C,w,v,22,l[11]),w=t(w,T,S,C,m,7,l[12]),C=t(C,w,T,S,k,12,l[13]),S=t(S,C,w,T,P,17,l[14]),T=t(T,S,C,w,O,22,l[15]),w=r(w,T,S,C,u,5,l[16]),C=r(C,w,T,S,d,9,l[17]),S=r(S,C,w,T,v,14,l[18]),T=r(T,S,C,w,a,20,l[19]),w=r(w,T,S,C,p,5,l[20]),C=r(C,w,T,S,_,9,l[21]),S=r(S,C,w,T,O,14,l[22]),T=r(T,S,C,w,f,20,l[23]),w=r(w,T,S,C,b,5,l[24]),C=r(C,w,T,S,P,9,l[25]),S=r(S,C,w,T,h,14,l[26]),T=r(T,S,C,w,g,20,l[27]),w=r(w,T,S,C,k,5,l[28]),C=r(C,w,T,S,c,9,l[29]),S=r(S,C,w,T,y,14,l[30]),T=r(T,S,C,w,m,20,l[31]),w=i(w,T,S,C,p,4,l[32]),C=i(C,w,T,S,g,11,l[33]),S=i(S,C,w,T,v,16,l[34]),T=i(T,S,C,w,P,23,l[35]),w=i(w,T,S,C,u,4,l[36]),C=i(C,w,T,S,f,11,l[37]),S=i(S,C,w,T,y,16,l[38]),T=i(T,S,C,w,_,23,l[39]),w=i(w,T,S,C,k,4,l[40]),C=i(C,w,T,S,a,11,l[41]),S=i(S,C,w,T,h,16,l[42]),T=i(T,S,C,w,d,23,l[43]),w=i(w,T,S,C,b,4,l[44]),C=i(C,w,T,S,m,11,l[45]),S=i(S,C,w,T,O,16,l[46]),T=i(T,S,C,w,c,23,l[47]),w=s(w,T,S,C,a,6,l[48]),C=s(C,w,T,S,y,10,l[49]),S=s(S,C,w,T,P,15,l[50]),T=s(T,S,C,w,p,21,l[51]),w=s(w,T,S,C,m,6,l[52]),C=s(C,w,T,S,h,10,l[53]),S=s(S,C,w,T,_,15,l[54]),T=s(T,S,C,w,u,21,l[55]),w=s(w,T,S,C,g,6,l[56]),C=s(C,w,T,S,O,10,l[57]),S=s(S,C,w,T,d,15,l[58]),T=s(T,S,C,w,k,21,l[59]),w=s(w,T,S,C,f,6,l[60]),C=s(C,w,T,S,v,10,l[61]),S=s(S,C,w,T,c,15,l[62]),T=s(T,S,C,w,b,21,l[63]);o[0]=o[0]+w|0,o[1]=o[1]+T|0,o[2]=o[2]+S|0,o[3]=o[3]+C|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var s=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process(),t=this._hash,n=t.words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var e=c.clone.call(this);return e._hash=this._hash.clone(),e}}),o.MD5=c._createHelper(a),o.HmacMD5=c._createHmacHelper(a)}(Math),function(){var e=n,t=e.lib,r=t.Base,i=t.WordArray,t=e.algo,s=t.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:t.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,r=n.hasher.create(),s=i.create(),o=s.words,a=n.keySize,n=n.iterations;o.length>>2]}},r.BlockCipher=c.extend({cfg:c.cfg.extend({mode:l,padding:f}),reset:function(){c.reset.call(this);var e=this.cfg,t=e.iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=e.createEncryptor;else n=e.createDecryptor,this._minBufferSize=1;this._mode=n.call(e,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});var p=r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),l=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return e=e.salt,(e?s.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){e=a.parse(e);var t=e.words;if(1398893684==t[0]&&1701076831==t[1]){var n=s.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:n})}},d=r.SerializableCipher=i.extend({cfg:i.extend({format:l}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,p.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.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}}),t=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){return r||(r=s.random(8)),e=u.create({keySize:t+n}).compute(e,r),n=s.create(e.words.slice(t),4*n),e.sigBytes=4*t,p.create({key:e,iv:n,salt:r})}},y=r.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:t}),encrypt:function(e,t,n,r){return r=this.cfg.extend(r),n=r.kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,e=d.encrypt.call(this,e,t,n.key,r),e.mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,d.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],s=[],o=[],a=[],u=[],c=[],l=[],h=[],f=[],p=[],d=[],y=0;256>y;y++)d[y]=128>y?y<<1:y<<1^283;for(var g=0,b=0,y=0;256>y;y++){var _=b^b<<1^b<<2^b<<3^b<<4,_=_>>>8^255&_^99;i[g]=_,s[_]=g;var v=d[g],m=d[v],k=d[m],P=257*d[_]^16843008*_;o[g]=P<<24|P>>>8,a[g]=P<<16|P>>>16,u[g]=P<<8|P>>>24,c[g]=P,P=16843009*k^65537*m^257*v^16843008*g,l[_]=P<<24|P>>>8,h[_]=P<<16|P>>>16,f[_]=P<<8|P>>>24,p[_]=P,g?(g=v^d[d[d[k^v]]],b^=d[d[b]]):g=b=1}var O=[0,1,2,4,8,16,32,64,128,27,54],r=r.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes/4,e=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],s=0;s>>24]<<24|i[o>>>16&255]<<16|i[o>>>8&255]<<8|i[255&o]):(o=o<<8|o>>>24,o=i[o>>>24]<<24|i[o>>>16&255]<<16|i[o>>>8&255]<<8|i[255&o],o^=O[s/n|0]<<24),r[s]=r[s-n]^o}for(t=this._invKeySchedule=[],n=0;nn||4>=s?o:l[i[o>>>24]]^h[i[o>>>16&255]]^f[i[o>>>8&255]]^p[i[255&o]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,u,c,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,l,h,f,p,s),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,s,o,a){for(var u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],h=e[t+2]^n[2],f=e[t+3]^n[3],p=4,d=1;d>>24]^i[l>>>16&255]^s[h>>>8&255]^o[255&f]^n[p++],g=r[l>>>24]^i[h>>>16&255]^s[f>>>8&255]^o[255&c]^n[p++],b=r[h>>>24]^i[f>>>16&255]^s[c>>>8&255]^o[255&l]^n[p++],f=r[f>>>24]^i[c>>>16&255]^s[l>>>8&255]^o[255&h]^n[p++],c=y,l=g,h=b;y=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&f])^n[p++],g=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[f>>>8&255]<<8|a[255&c])^n[p++],b=(a[h>>>24]<<24|a[f>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[p++],f=(a[f>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[p++],e[t]=y,e[t+1]=g,e[t+2]=b,e[t+3]=f},keySize:8});e.AES=t._createHelper(r)}(),n.mode.ECB=function(){var e=n.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e}(),e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535>>2]=n[i>>>2];else t.push.apply(t,n);return this.sigBytes+=e,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=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r>>2]>>>24-r%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new o.init(n,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new o.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},h=r.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.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),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*s,i=e.min(4*t,i),t){for(var u=0;ul;){var h;e:{h=c;for(var f=e.sqrt(h),p=2;p<=f;p++)if(!(h%p)){h=!1;break e}h=!0}h&&(8>l&&(o[l]=u(e.pow(c,.5))),a[l]=u(e.pow(c,1/3)),l++),c++}var d=[],r=r.SHA256=s.extend({_doReset:function(){this._hash=new i.init(o.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],s=n[2],o=n[3],u=n[4],c=n[5],l=n[6],h=n[7],f=0;64>f;f++){if(16>f)d[f]=0|e[t+f];else{var p=d[f-15],y=d[f-2];d[f]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+d[f-7]+((y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10)+d[f-16]}p=h+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+a[f]+d[f],y=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&s^i&s),h=l,l=c,c=u,u=o+p|0,o=s,s=i,i=r,r=p+y|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+h|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(r),t.HmacSHA256=s._createHmacHelper(r)}(Math),function(){var e=n,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,i=4*r;n.sigBytes>i&&(n=e.finalize(n)),n.clamp();for(var s=this._oKey=n.clone(),o=this._iKey=n.clone(),a=s.words,u=o.words,c=0;c>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,o=0;4>o&&i+.75*o>>6*(3-o)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var n=e.length,r=this._map,i=r.charAt(64);i&&-1!=(i=e.indexOf(i))&&(n=i);for(var i=[],s=0,o=0;o>>6-o%4*2;i[s>>>2]|=(a|u)<<24-s%4*8,s++}return t.create(i,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,n,r,i,s,o){return((e=e+(t&n|~t&r)+i+o)<>>32-s)+t}function r(e,t,n,r,i,s,o){return((e=e+(t&r|n&~r)+i+o)<>>32-s)+t}function i(e,t,n,r,i,s,o){return((e=e+(t^n^r)+i+o)<>>32-s)+t}function s(e,t,n,r,i,s,o){return((e=e+(n^(t|~r))+i+o)<>>32-s)+t}for(var o=n,a=o.lib,u=a.WordArray,c=a.Hasher,a=o.algo,l=[],h=0;64>h;h++)l[h]=4294967296*e.abs(e.sin(h+1))|0;a=a.MD5=c.extend({_doReset:function(){this._hash=new u.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,n){for(var o=0;16>o;o++){var a=n+o,u=e[a];e[a]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}var o=this._hash.words,a=e[n+0],u=e[n+1],c=e[n+2],h=e[n+3],f=e[n+4],p=e[n+5],d=e[n+6],y=e[n+7],g=e[n+8],b=e[n+9],_=e[n+10],v=e[n+11],m=e[n+12],k=e[n+13],P=e[n+14],O=e[n+15],w=o[0],T=o[1],S=o[2],C=o[3],w=t(w,T,S,C,a,7,l[0]),C=t(C,w,T,S,u,12,l[1]),S=t(S,C,w,T,c,17,l[2]),T=t(T,S,C,w,h,22,l[3]),w=t(w,T,S,C,f,7,l[4]),C=t(C,w,T,S,p,12,l[5]),S=t(S,C,w,T,d,17,l[6]),T=t(T,S,C,w,y,22,l[7]),w=t(w,T,S,C,g,7,l[8]),C=t(C,w,T,S,b,12,l[9]),S=t(S,C,w,T,_,17,l[10]),T=t(T,S,C,w,v,22,l[11]),w=t(w,T,S,C,m,7,l[12]),C=t(C,w,T,S,k,12,l[13]),S=t(S,C,w,T,P,17,l[14]),T=t(T,S,C,w,O,22,l[15]),w=r(w,T,S,C,u,5,l[16]),C=r(C,w,T,S,d,9,l[17]),S=r(S,C,w,T,v,14,l[18]),T=r(T,S,C,w,a,20,l[19]),w=r(w,T,S,C,p,5,l[20]),C=r(C,w,T,S,_,9,l[21]),S=r(S,C,w,T,O,14,l[22]),T=r(T,S,C,w,f,20,l[23]),w=r(w,T,S,C,b,5,l[24]),C=r(C,w,T,S,P,9,l[25]),S=r(S,C,w,T,h,14,l[26]),T=r(T,S,C,w,g,20,l[27]),w=r(w,T,S,C,k,5,l[28]),C=r(C,w,T,S,c,9,l[29]),S=r(S,C,w,T,y,14,l[30]),T=r(T,S,C,w,m,20,l[31]),w=i(w,T,S,C,p,4,l[32]),C=i(C,w,T,S,g,11,l[33]),S=i(S,C,w,T,v,16,l[34]),T=i(T,S,C,w,P,23,l[35]),w=i(w,T,S,C,u,4,l[36]),C=i(C,w,T,S,f,11,l[37]),S=i(S,C,w,T,y,16,l[38]),T=i(T,S,C,w,_,23,l[39]),w=i(w,T,S,C,k,4,l[40]),C=i(C,w,T,S,a,11,l[41]),S=i(S,C,w,T,h,16,l[42]),T=i(T,S,C,w,d,23,l[43]),w=i(w,T,S,C,b,4,l[44]),C=i(C,w,T,S,m,11,l[45]),S=i(S,C,w,T,O,16,l[46]),T=i(T,S,C,w,c,23,l[47]),w=s(w,T,S,C,a,6,l[48]),C=s(C,w,T,S,y,10,l[49]),S=s(S,C,w,T,P,15,l[50]),T=s(T,S,C,w,p,21,l[51]),w=s(w,T,S,C,m,6,l[52]),C=s(C,w,T,S,h,10,l[53]),S=s(S,C,w,T,_,15,l[54]),T=s(T,S,C,w,u,21,l[55]),w=s(w,T,S,C,g,6,l[56]),C=s(C,w,T,S,O,10,l[57]),S=s(S,C,w,T,d,15,l[58]),T=s(T,S,C,w,k,21,l[59]),w=s(w,T,S,C,f,6,l[60]),C=s(C,w,T,S,v,10,l[61]),S=s(S,C,w,T,c,15,l[62]),T=s(T,S,C,w,b,21,l[63]);o[0]=o[0]+w|0,o[1]=o[1]+T|0,o[2]=o[2]+S|0,o[3]=o[3]+C|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var s=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process(),t=this._hash,n=t.words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var e=c.clone.call(this);return e._hash=this._hash.clone(),e}}),o.MD5=c._createHelper(a),o.HmacMD5=c._createHmacHelper(a)}(Math),function(){var e=n,t=e.lib,r=t.Base,i=t.WordArray,t=e.algo,s=t.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:t.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,r=n.hasher.create(),s=i.create(),o=s.words,a=n.keySize,n=n.iterations;o.length>>2]}},r.BlockCipher=c.extend({cfg:c.cfg.extend({mode:l,padding:f}),reset:function(){c.reset.call(this);var e=this.cfg,t=e.iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=e.createEncryptor;else n=e.createDecryptor,this._minBufferSize=1;this._mode=n.call(e,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});var p=r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),l=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return e=e.salt,(e?s.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){e=a.parse(e);var t=e.words;if(1398893684==t[0]&&1701076831==t[1]){var n=s.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:n})}},d=r.SerializableCipher=i.extend({cfg:i.extend({format:l}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,p.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.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}}),t=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){return r||(r=s.random(8)),e=u.create({keySize:t+n}).compute(e,r),n=s.create(e.words.slice(t),4*n),e.sigBytes=4*t,p.create({key:e,iv:n,salt:r})}},y=r.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:t}),encrypt:function(e,t,n,r){return r=this.cfg.extend(r),n=r.kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,e=d.encrypt.call(this,e,t,n.key,r),e.mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,d.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],s=[],o=[],a=[],u=[],c=[],l=[],h=[],f=[],p=[],d=[],y=0;256>y;y++)d[y]=128>y?y<<1:y<<1^283;for(var g=0,b=0,y=0;256>y;y++){var _=b^b<<1^b<<2^b<<3^b<<4,_=_>>>8^255&_^99;i[g]=_,s[_]=g;var v=d[g],m=d[v],k=d[m],P=257*d[_]^16843008*_;o[g]=P<<24|P>>>8,a[g]=P<<16|P>>>16,u[g]=P<<8|P>>>24,c[g]=P,P=16843009*k^65537*m^257*v^16843008*g,l[_]=P<<24|P>>>8,h[_]=P<<16|P>>>16,f[_]=P<<8|P>>>24,p[_]=P,g?(g=v^d[d[d[k^v]]],b^=d[d[b]]):g=b=1}var O=[0,1,2,4,8,16,32,64,128,27,54],r=r.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes/4,e=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],s=0;s>>24]<<24|i[o>>>16&255]<<16|i[o>>>8&255]<<8|i[255&o]):(o=o<<8|o>>>24,o=i[o>>>24]<<24|i[o>>>16&255]<<16|i[o>>>8&255]<<8|i[255&o],o^=O[s/n|0]<<24),r[s]=r[s-n]^o}for(t=this._invKeySchedule=[],n=0;nn||4>=s?o:l[i[o>>>24]]^h[i[o>>>16&255]]^f[i[o>>>8&255]]^p[i[255&o]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,u,c,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,l,h,f,p,s),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,s,o,a){for(var u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],h=e[t+2]^n[2],f=e[t+3]^n[3],p=4,d=1;d>>24]^i[l>>>16&255]^s[h>>>8&255]^o[255&f]^n[p++],g=r[l>>>24]^i[h>>>16&255]^s[f>>>8&255]^o[255&c]^n[p++],b=r[h>>>24]^i[f>>>16&255]^s[c>>>8&255]^o[255&l]^n[p++],f=r[f>>>24]^i[c>>>16&255]^s[l>>>8&255]^o[255&h]^n[p++],c=y,l=g,h=b;y=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&f])^n[p++],g=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[f>>>8&255]<<8|a[255&c])^n[p++],b=(a[h>>>24]<<24|a[f>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[p++],f=(a[f>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[p++],e[t]=y,e[t+1]=g,e[t+2]=b,e[t+3]=f},keySize:8});e.AES=t._createHelper(r)}(),n.mode.ECB=function(){var e=n.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e}(),e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n=o){var u={};u.category=g.default.PNRequestMessageCountExceededCategory,u.operation=e.operation,this._listenerManager.announceStatus(u)}i.forEach(function(e){var t=e.channel,r=e.subscriptionMatch,i=e.publishMetaData;if(t===r&&(r=null),a){if(n._dedupingManager.isDuplicate(e))return;n._dedupingManager.addEntry(e)}if(d.default.endsWith(e.channel,"-pnpres")){var s={};s.channel=null,s.subscription=null,s.actualChannel=null!=r?t:null,s.subscribedChannel=null!=r?r:t,t&&(s.channel=t.substring(0,t.lastIndexOf("-pnpres"))),r&&(s.subscription=r.substring(0,r.lastIndexOf("-pnpres"))),s.action=e.payload.action,s.state=e.payload.data,s.timetoken=i.publishTimetoken,s.occupancy=e.payload.occupancy,s.uuid=e.payload.uuid,s.timestamp=e.payload.timestamp,e.payload.join&&(s.join=e.payload.join),e.payload.leave&&(s.leave=e.payload.leave),e.payload.timeout&&(s.timeout=e.payload.timeout),n._listenerManager.announcePresence(s)}else{var o={};o.channel=null,o.subscription=null,o.actualChannel=null!=r?t:null,o.subscribedChannel=null!=r?r:t,o.channel=t,o.subscription=r,o.timetoken=i.publishTimetoken,o.publisher=e.issuingClientId,e.userMetadata&&(o.userMetadata=e.userMetadata),n._config.cipherKey?o.message=n._crypto.decrypt(e.payload):o.message=e.payload,n._listenerManager.announceMessage(o)}}),this._region=t.metadata.region,this._startSubscribeLoop()}},{key:"_stopSubscribeLoop",value:function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)}}]),e}();t.default=b,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n=this._config.maximumCacheSize&&this.hashHistory.shift(),this.hashHistory.push(this.getKey(e))}},{key:"clearHistory",value:function(){this.hashHistory=[]}}]),e}();t.default=a,e.exports=t.default},function(e,t){"use strict";function n(e){var t=[];return Object.keys(e).forEach(function(e){return t.push(e)}),t}function r(e){return encodeURIComponent(e).replace(/[!~*'()]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}function i(e){return n(e).sort()}function s(e){return i(e).map(function(t){return t+"="+r(e[t])}).join("&")}function o(e,t){return-1!==e.indexOf(t,this.length-t.length)}function a(){var e=void 0,t=void 0;return{promise:new Promise(function(n,r){e=n,t=r}),reject:t,fulfill:e}}e.exports={signPamFromParams:s,endsWith:o,createPromise:a,encodeString:r}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){return e.type=t,e.error=!0,e}function u(e){return a({message:e},"validationError")}function c(e,t,n){return e.usePost&&e.usePost(t,n)?e.postURL(t,n):e.getURL(t,n)}function l(e){if(e.sdkName)return e.sdkName;var t="PubNub-JS-"+e.sdkFamily;return e.partnerId&&(t+="-"+e.partnerId),t+="/"+e.getVersion()}function h(e,t,n){var r=e.config,i=e.crypto;n.timestamp=Math.floor((new Date).getTime()/1e3);var s=r.subscribeKey+"\n"+r.publishKey+"\n"+t+"\n";s+=y.default.signPamFromParams(n);var o=i.HMACSHA256(s);o=o.replace(/\+/g,"-"),o=o.replace(/\//g,"_"),n.signature=o}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=e.networking,r=e.config,i=null,s=null,o={};t.getOperation()===_.default.PNTimeOperation||t.getOperation()===_.default.PNChannelGroupsOperation?i=arguments.length<=2?void 0:arguments[2]:(o=arguments.length<=2?void 0:arguments[2],i=arguments.length<=3?void 0:arguments[3]),"undefined"==typeof Promise||i||(s=y.default.createPromise());var a=t.validateParams(e,o);if(!a){var f=t.prepareParams(e,o),d=c(t,e,o),g=void 0,b={url:d,operation:t.getOperation(),timeout:t.getRequestTimeout(e)};f.uuid=r.UUID,f.pnsdk=l(r),r.useInstanceId&&(f.instanceid=r.instanceId),r.useRequestId&&(f.requestid=p.default.createUUID()),t.isAuthSupported()&&r.getAuthKey()&&(f.auth=r.getAuthKey()),r.secretKey&&h(e,d,f);var m=function(n,r){if(n.error)return void(i?i(n):s&&s.reject(new v("PubNub call failed, check status for details",n)));var a=t.handleResponse(e,r,o);i?i(n,a):s&&s.fulfill(a)};if(t.usePost&&t.usePost(e,o)){var k=t.postPayload(e,o);g=n.POST(f,k,b,m)}else g=t.useDelete&&t.useDelete()?n.DELETE(f,b,m):n.GET(f,b,m);return t.getOperation()===_.default.PNSubscribeOperation?g:s?s.promise:void 0}return i?i(u(a)):s?(s.reject(new v("Validation failed, check status for details",u(a))),s.promise):void 0};var f=n(3),p=r(f),d=(n(5),n(15)),y=r(d),g=n(2),b=(r(g),n(13)),_=r(b),v=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.name=r.constructor.name,r.status=n,r.message=e,r}return o(t,e),t}(Error);e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f.default.PNAddChannelsToGroupOperation}function s(e,t){var n=t.channels,r=t.channelGroup,i=e.config;return r?n&&0!==n.length?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"}function o(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+d.default.encodeString(n)}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.channels;return{add:(void 0===n?[]:n).join(",")}}function l(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.getURL=o,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var h=(n(5),n(13)),f=r(h),p=n(15),d=r(p)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f.default.PNRemoveChannelsFromGroupOperation}function s(e,t){var n=t.channels,r=t.channelGroup,i=e.config;return r?n&&0!==n.length?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"}function o(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+d.default.encodeString(n)}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.channels;return{remove:(void 0===n?[]:n).join(",")}}function l(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.getURL=o,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var h=(n(5),n(13)),f=r(h),p=n(15),d=r(p)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f.default.PNRemoveGroupOperation}function s(e,t){var n=t.channelGroup,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"}function o(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+d.default.encodeString(n)+"/remove"}function a(){return!0}function u(e){return e.config.getTransactionTimeout()}function c(){return{}}function l(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.getURL=o,t.isAuthSupported=a,t.getRequestTimeout=u,t.prepareParams=c,t.handleResponse=l;var h=(n(5),n(13)),f=r(h),p=n(15),d=r(p)},function(e,t,n){"use strict";function r(){return h.default.PNChannelGroupsOperation}function i(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function s(e){return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group"}function o(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(){return{}}function c(e,t){return{groups:t.payload.groups}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=s,t.getRequestTimeout=o,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),h=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f.default.PNChannelsForGroupOperation}function s(e,t){var n=t.channelGroup,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"}function o(e,t){var n=t.channelGroup;return"/v1/channel-registration/sub-key/"+e.config.subscribeKey+"/channel-group/"+d.default.encodeString(n)}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(){return{}}function l(e,t){return{channels:t.payload.channels}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.getURL=o,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var h=(n(5),n(13)),f=r(h),p=n(15),d=r(p)},function(e,t,n){"use strict";function r(){return h.default.PNPushNotificationEnabledChannelsOperation}function i(e,t){var n=t.device,r=t.pushGateway,i=t.channels,s=e.config;return n?r?i&&0!==i.length?s.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"}function s(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n}function o(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(e,t){var n=t.pushGateway,r=t.channels;return{type:n,add:(void 0===r?[]:r).join(",")}}function c(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=s,t.getRequestTimeout=o,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),h=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(){return h.default.PNPushNotificationEnabledChannelsOperation}function i(e,t){var n=t.device,r=t.pushGateway,i=t.channels,s=e.config;return n?r?i&&0!==i.length?s.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"}function s(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n}function o(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(e,t){var n=t.pushGateway,r=t.channels;return{type:n,remove:(void 0===r?[]:r).join(",")}}function c(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=s,t.getRequestTimeout=o,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),h=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(){return h.default.PNPushNotificationEnabledChannelsOperation}function i(e,t){var n=t.device,r=t.pushGateway,i=e.config;return n?r?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"}function s(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n}function o(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(e,t){return{type:t.pushGateway}}function c(e,t){return{channels:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=s,t.getRequestTimeout=o,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),h=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(){return h.default.PNRemoveAllPushNotificationsOperation}function i(e,t){var n=t.device,r=t.pushGateway,i=e.config;return n?r?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing GW Type (pushGateway: gcm or apns)":"Missing Device ID (device)"}function s(e,t){var n=t.device;return"/v1/push/sub-key/"+e.config.subscribeKey+"/devices/"+n+"/remove"}function o(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(e,t){return{type:t.pushGateway}}function c(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=s,t.getRequestTimeout=o,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),h=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f.default.PNUnsubscribeOperation}function s(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function o(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,s=i.length>0?i.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+d.default.encodeString(s)+"/leave"}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};return r.length>0&&(i["channel-group"]=r.join(",")),i}function l(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.getURL=o,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var h=(n(5),n(13)),f=r(h),p=n(15),d=r(p)},function(e,t,n){"use strict";function r(){return h.default.PNWhereNowOperation}function i(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function s(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r;return"/v2/presence/sub-key/"+n.subscribeKey+"/uuid/"+i}function o(e){return e.config.getTransactionTimeout()}function a(){return!0}function u(){return{}}function c(e,t){return t.payload?{channels:t.payload.channels}:{channels:[]}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=s,t.getRequestTimeout=o,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),h=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f.default.PNHeartbeatOperation}function s(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function o(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,s=i.length>0?i.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+d.default.encodeString(s)+"/heartbeat"}function a(){return!0}function u(e){return e.config.getTransactionTimeout()}function c(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.state,s=void 0===i?{}:i,o=e.config,a={};return r.length>0&&(a["channel-group"]=r.join(",")),a.state=JSON.stringify(s),a.heartbeat=o.getPresenceTimeout(),a}function l(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.getURL=o,t.isAuthSupported=a,t.getRequestTimeout=u,t.prepareParams=c,t.handleResponse=l;var h=(n(5),n(13)),f=r(h),p=n(15),d=r(p)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f.default.PNGetStateOperation}function s(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function o(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r,s=t.channels,o=void 0===s?[]:s,a=o.length>0?o.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+d.default.encodeString(a)+"/uuid/"+i}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};return r.length>0&&(i["channel-group"]=r.join(",")),i}function l(e,t,n){var r=n.channels,i=void 0===r?[]:r,s=n.channelGroups,o=void 0===s?[]:s,a={};return 1===i.length&&0===o.length?a[i[0]]=t.payload:a=t.payload,{channels:a}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.getURL=o,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var h=(n(5),n(13)),f=r(h),p=n(15),d=r(p)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f.default.PNSetStateOperation}function s(e,t){var n=e.config,r=t.state,i=t.channels,s=void 0===i?[]:i,o=t.channelGroups,a=void 0===o?[]:o;return r?n.subscribeKey?0===s.length&&0===a.length?"Please provide a list of channels and/or channel-groups":void 0:"Missing Subscribe Key":"Missing State"}function o(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,s=i.length>0?i.join(","):",";return"/v2/presence/sub-key/"+n.subscribeKey+"/channel/"+d.default.encodeString(s)+"/uuid/"+n.UUID+"/data"}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.state,r=t.channelGroups,i=void 0===r?[]:r,s={};return s.state=JSON.stringify(n),i.length>0&&(s["channel-group"]=i.join(",")),s}function l(e,t){return{state:t.payload}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.getURL=o,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var h=(n(5),n(13)),f=r(h),p=n(15),d=r(p)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f.default.PNHereNowOperation}function s(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function o(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,s=t.channelGroups,o=void 0===s?[]:s,a="/v2/presence/sub-key/"+n.subscribeKey;if(i.length>0||o.length>0){var u=i.length>0?i.join(","):",";a+="/channel/"+d.default.encodeString(u)}return a}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.includeUUIDs,s=void 0===i||i,o=t.includeState,a=void 0!==o&&o,u={};return s||(u.disable_uuids=1),a&&(u.state=1),r.length>0&&(u["channel-group"]=r.join(",")),u}function l(e,t,n){var r=n.channels,i=void 0===r?[]:r,s=n.channelGroups,o=void 0===s?[]:s,a=n.includeUUIDs,u=void 0===a||a,c=n.includeState,l=void 0!==c&&c;return i.length>1||o.length>0||0===o.length&&0===i.length?function(){var e={};return e.totalChannels=t.payload.total_channels,e.totalOccupancy=t.payload.total_occupancy,e.channels={},Object.keys(t.payload.channels).forEach(function(n){var r=t.payload.channels[n],i=[];return e.channels[n]={occupants:i,name:n,occupancy:r.occupancy},u&&r.uuids.forEach(function(e){l?i.push({state:e.state,uuid:e.uuid}):i.push({state:null,uuid:e})}),e}),e}():function(){var e={},n=[];return e.totalChannels=1,e.totalOccupancy=t.occupancy,e.channels={},e.channels[i[0]]={occupants:n,name:i[0],occupancy:t.occupancy},u&&t.uuids&&t.uuids.forEach(function(e){l?n.push({state:e.state,uuid:e.uuid}):n.push({state:null,uuid:e})}),e}()}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.getURL=o,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var h=(n(5),n(13)),f=r(h),p=n(15),d=r(p)},function(e,t,n){"use strict";function r(){return h.default.PNAccessManagerAudit}function i(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function s(e){return"/v2/auth/audit/sub-key/"+e.config.subscribeKey}function o(e){return e.config.getTransactionTimeout()}function a(){return!1}function u(e,t){var n=t.channel,r=t.channelGroup,i=t.authKeys,s=void 0===i?[]:i,o={};return n&&(o.channel=n),r&&(o["channel-group"]=r),s.length>0&&(o.auth=s.join(",")),o}function c(e,t){return t.payload}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=s,t.getRequestTimeout=o,t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),h=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(){return h.default.PNAccessManagerGrant}function i(e){var t=e.config;return t.subscribeKey?t.publishKey?t.secretKey?void 0:"Missing Secret Key":"Missing Publish Key":"Missing Subscribe Key"}function s(e){return"/v2/auth/grant/sub-key/"+e.config.subscribeKey}function o(e){return e.config.getTransactionTimeout()}function a(){return!1}function u(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.channelGroups,s=void 0===i?[]:i,o=t.ttl,a=t.read,u=void 0!==a&&a,c=t.write,l=void 0!==c&&c,h=t.manage,f=void 0!==h&&h,p=t.authKeys,d=void 0===p?[]:p,y={};return y.r=u?"1":"0",y.w=l?"1":"0",y.m=f?"1":"0",r.length>0&&(y.channel=r.join(",")),s.length>0&&(y["channel-group"]=s.join(",")),d.length>0&&(y.auth=d.join(",")),(o||0===o)&&(y.ttl=o),y}function c(){return{}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=r,t.validateParams=i,t.getURL=s,t.getRequestTimeout=o, t.isAuthSupported=a,t.prepareParams=u,t.handleResponse=c;var l=(n(5),n(13)),h=function(e){return e&&e.__esModule?e:{default:e}}(l)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=e.crypto,r=e.config,i=JSON.stringify(t);return r.cipherKey&&(i=n.encrypt(i),i=JSON.stringify(i)),i}function s(){return b.default.PNPublishOperation}function o(e,t){var n=e.config,r=t.message;return t.channel?r?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing Message":"Missing Channel"}function a(e,t){var n=t.sendByPost;return void 0!==n&&n}function u(e,t){var n=e.config,r=t.channel,s=t.message,o=i(e,s);return"/publish/"+n.publishKey+"/"+n.subscribeKey+"/0/"+v.default.encodeString(r)+"/0/"+v.default.encodeString(o)}function c(e,t){var n=e.config,r=t.channel;return"/publish/"+n.publishKey+"/"+n.subscribeKey+"/0/"+v.default.encodeString(r)+"/0"}function l(e){return e.config.getTransactionTimeout()}function h(){return!0}function f(e,t){return i(e,t.message)}function p(e,t){var n=t.meta,r=t.replicate,i=void 0===r||r,s=t.storeInHistory,o=t.ttl,a={};return null!=s&&(a.store=s?"1":"0"),o&&(a.ttl=o),!1===i&&(a.norep="true"),n&&"object"===(void 0===n?"undefined":y(n))&&(a.meta=JSON.stringify(n)),a}function d(e,t){return{timetoken:t[2]}}Object.defineProperty(t,"__esModule",{value:!0});var y="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};t.getOperation=s,t.validateParams=o,t.usePost=a,t.getURL=u,t.postURL=c,t.getRequestTimeout=l,t.isAuthSupported=h,t.postPayload=f,t.prepareParams=p,t.handleResponse=d;var g=(n(5),n(13)),b=r(g),_=n(15),v=r(_)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}function s(){return p.default.PNHistoryOperation}function o(e,t){var n=t.channel,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"}function a(e,t){var n=t.channel;return"/v2/history/sub-key/"+e.config.subscribeKey+"/channel/"+y.default.encodeString(n)}function u(e){return e.config.getTransactionTimeout()}function c(){return!0}function l(e,t){var n=t.start,r=t.end,i=t.reverse,s=t.count,o=void 0===s?100:s,a=t.stringifiedTimeToken,u=void 0!==a&&a,c={include_token:"true"};return c.count=o,n&&(c.start=n),r&&(c.end=r),u&&(c.string_message_token="true"),null!=i&&(c.reverse=i.toString()),c}function h(e,t){var n={messages:[],startTimeToken:t[1],endTimeToken:t[2]};return t[0].forEach(function(t){var r={timetoken:t.timetoken,entry:i(e,t.message)};n.messages.push(r)}),n}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=s,t.validateParams=o,t.getURL=a,t.getRequestTimeout=u,t.isAuthSupported=c,t.prepareParams=l,t.handleResponse=h;var f=(n(5),n(13)),p=r(f),d=n(15),y=r(d)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return p.default.PNDeleteMessagesOperation}function s(e,t){var n=t.channel,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"}function o(){return!0}function a(e,t){var n=t.channel;return"/v3/history/sub-key/"+e.config.subscribeKey+"/channel/"+y.default.encodeString(n)}function u(e){return e.config.getTransactionTimeout()}function c(){return!0}function l(e,t){var n=t.start,r=t.end,i={};return n&&(i.start=n),r&&(i.end=r),i}function h(e,t){return t.payload}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.useDelete=o,t.getURL=a,t.getRequestTimeout=u,t.isAuthSupported=c,t.prepareParams=l,t.handleResponse=h;var f=(n(5),n(13)),p=r(f),d=n(15),y=r(d)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}function s(){return p.default.PNFetchMessagesOperation}function o(e,t){var n=t.channels,r=e.config;return n&&0!==n.length?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channels"}function a(e,t){var n=t.channels,r=void 0===n?[]:n,i=e.config,s=r.length>0?r.join(","):",";return"/v3/history/sub-key/"+i.subscribeKey+"/channel/"+y.default.encodeString(s)}function u(e){return e.config.getTransactionTimeout()}function c(){return!0}function l(e,t){var n=t.start,r=t.end,i=t.count,s=t.stringifiedTimeToken,o=void 0!==s&&s,a={};return i&&(a.max=i),n&&(a.start=n),r&&(a.end=r),o&&(a.string_message_token="true"),a}function h(e,t){var n={channels:{}};return Object.keys(t.channels||{}).forEach(function(r){n.channels[r]=[],(t.channels[r]||[]).forEach(function(t){var s={};s.channel=r,s.subscription=null,s.timetoken=t.timetoken,s.message=i(e,t.message),n.channels[r].push(s)})}),n}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=s,t.validateParams=o,t.getURL=a,t.getRequestTimeout=u,t.isAuthSupported=c,t.prepareParams=l,t.handleResponse=h;var f=(n(5),n(13)),p=r(f),d=n(15),y=r(d)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f.default.PNSubscribeOperation}function s(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"}function o(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,s=i.length>0?i.join(","):",";return"/v2/subscribe/"+n.subscribeKey+"/"+d.default.encodeString(s)+"/0"}function a(e){return e.config.getSubscribeTimeout()}function u(){return!0}function c(e,t){var n=e.config,r=t.channelGroups,i=void 0===r?[]:r,s=t.timetoken,o=t.filterExpression,a=t.region,u={heartbeat:n.getPresenceTimeout()};return i.length>0&&(u["channel-group"]=i.join(",")),o&&o.length>0&&(u["filter-expr"]=o),s&&(u.tt=s),a&&(u.tr=a),u}function l(e,t){var n=[];t.m.forEach(function(e){var t={publishTimetoken:e.p.t,region:e.p.r},r={shard:parseInt(e.a,10),subscriptionMatch:e.b,channel:e.c,payload:e.d,flags:e.f,issuingClientId:e.i,subscribeKey:e.k,originationTimetoken:e.o,userMetadata:e.u,publishMetaData:t};n.push(r)});var r={timetoken:t.t.t,region:t.t.r};return{messages:n,metadata:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=i,t.validateParams=s,t.getURL=o,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var h=(n(5),n(13)),f=r(h),p=n(15),d=r(p)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n=this._maxSubDomain&&(this._currentSubDomain=1),e=this._currentSubDomain.toString(),this._providedFQDN.replace("pubsub","ps"+e)}},{key:"hasModule",value:function(e){return e in this._modules}},{key:"shiftStandardOrigin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._standardOrigin=this.nextOrigin(e),this._standardOrigin}},{key:"getStandardOrigin",value:function(){return this._standardOrigin}},{key:"POST",value:function(e,t,n,r){return this._modules.post(e,t,n,r)}},{key:"GET",value:function(e,t,n){return this._modules.get(e,t,n)}},{key:"DELETE",value:function(e,t,n){return this._modules.del(e,t,n)}},{key:"_detectErrorCategory",value:function(e){if("ENOTFOUND"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNREFUSED"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNRESET"===e.code)return u.default.PNNetworkIssuesCategory;if("EAI_AGAIN"===e.code)return u.default.PNNetworkIssuesCategory;if(0===e.status||e.hasOwnProperty("status")&&void 0===e.status)return u.default.PNNetworkIssuesCategory;if(e.timeout)return u.default.PNTimeoutCategory;if("ETIMEDOUT"===e.code)return u.default.PNNetworkIssuesCategory;if(e.response){if(e.response.badRequest)return u.default.PNBadRequestCategory;if(e.response.forbidden)return u.default.PNAccessDeniedCategory}return u.default.PNUnknownCategory}}]),e}());t.default=c,e.exports=t.default},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={get:function(e){try{return localStorage.getItem(e)}catch(e){return null}},set:function(e,t){try{return localStorage.setItem(e,t)}catch(e){return null}}},e.exports=t.default},function(e,t,n){"use strict";function r(e){var t=(new Date).getTime(),n=(new Date).toISOString(),r=function(){return console&&console.log?console:window&&window.console&&window.console.log?window.console:console}();r.log("<<<<<"),r.log("["+n+"]","\n",e.url,"\n",e.qs),r.log("-----"),e.on("response",function(n){var i=(new Date).getTime(),s=i-t,o=(new Date).toISOString();r.log(">>>>>>"),r.log("["+o+" / "+s+"]","\n",e.url,"\n",e.qs,"\n",n.text),r.log("-----")})}function i(e,t,n){var i=this;return this._config.logVerbosity&&(e=e.use(r)),this._config.proxy&&this._modules.proxy&&(e=this._modules.proxy.call(this,e)),this._config.keepAlive&&this._modules.keepAlive&&(e=this._modules.keepAlive(e)),e.timeout(t.timeout).end(function(e,r){var s={};if(s.error=null!==e,s.operation=t.operation,r&&r.status&&(s.statusCode=r.status),e){if(e.response&&e.response.text&&!i._config.logVerbosity)try{s.errorData=JSON.parse(e.response.text)}catch(t){s.errorData=e}else s.errorData=e;return s.category=i._detectErrorCategory(e),n(s,null)}var o=JSON.parse(r.text);return o.error&&1===o.error&&o.status&&o.message&&o.service?(s.errorData=o,s.statusCode=o.status,s.error=!0,s.category=i._detectErrorCategory(s),n(s,null)):n(s,o)})}function s(e,t,n){var r=c.default.get(this.getStandardOrigin()+t.url).query(e);return i.call(this,r,t,n)}function o(e,t,n,r){var s=c.default.post(this.getStandardOrigin()+n.url).query(e).send(t);return i.call(this,s,n,r)}function a(e,t,n){var r=c.default.delete(this.getStandardOrigin()+t.url).query(e);return i.call(this,r,t,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.get=s,t.post=o,t.del=a;var u=n(42),c=function(e){return e&&e.__esModule?e:{default:e}}(u);n(5)},function(e,t,n){function r(){}function i(e){if(!y(e))return e;var t=[];for(var n in e)s(t,n,e[n]);return t.join("&")}function s(e,t,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){s(e,t,n)});else if(y(n))for(var r in n)s(e,t+"["+r+"]",n[r]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(n));else null===n&&e.push(encodeURIComponent(t))}function o(e){for(var t,n,r={},i=e.split("&"),s=0,o=i.length;s=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==n){var r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var r=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.onprogress=r.bind(null,"download"),t.upload&&(t.upload.onprogress=r.bind(null,"upload"))}catch(e){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof n&&!this._isHost(n)){var i=this._header["content-type"],s=this._serializer||_.serialize[i?i.split(";")[0]:""];!s&&u(i)&&(s=_.serialize["application/json"]),s&&(n=s(n))}for(var o in this.header)null!=this.header[o]&&this.header.hasOwnProperty(o)&&t.setRequestHeader(o,this.header[o]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0!==n?n:null),this},_.agent=function(){return new b},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(e){b.prototype[e.toLowerCase()]=function(t,n){var r=new _.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}}),b.prototype.del=b.prototype.delete,_.get=function(e,t,n){var r=_("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},_.head=function(e,t,n){var r=_("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},_.options=function(e,t,n){var r=_("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},_.del=h,_.delete=h,_.patch=function(e,t,n){var r=_("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},_.post=function(e,t,n){var r=_("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},_.put=function(e,t,n){var r=_("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},function(e,t,n){function r(e){if(e)return i(e)}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r,i=0;i=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&t.status>=500&&501!=t.status)return!0;if(e){if(e.code&&~o.indexOf(e.code))return!0;if(e.timeout&&"ECONNABORTED"==e.code)return!0;if(e.crossDomain)return!0}return!1},r.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},r.prototype.then=function(e,t){if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(e,t){n.end(function(n,r){n?t(n):e(r)})})}return this._fullfilledPromise.then(e,t)},r.prototype.catch=function(e){return this.then(void 0,e)},r.prototype.use=function(e){return e(this),this},r.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},r.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},r.prototype.get=function(e){return this._header[e.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(e,t){if(s(e)){for(var n in e)this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},r.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},r.prototype.field=function(e,t){if(null===e||void 0===e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),s(e)){for(var n in e)this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)this.field(e,t[r]);return this}if(null===t||void 0===t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},r.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.prototype._auth=function(e,t,n,r){switch(n.type){case"basic":this.set("Authorization","Basic "+r(e+":"+t));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer "+e)}return this},r.prototype.withCredentials=function(e){return void 0==e&&(e=!0),this._withCredentials=e,this},r.prototype.redirects=function(e){return this._maxRedirects=e,this},r.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw TypeError("Invalid argument");return this._maxResponseSize=e,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(e){var t=s(e),n=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&s(this._data))for(var r in e)this._data[r]=e[r];else"string"==typeof e?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"==n?this._data?this._data+"&"+e:e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(n||this.type("json"),this)},r.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},r.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.substring(t+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,t)+"?"+n.join("&")}}},r.prototype._appendQueryString=function(){console.trace("Unsupported")},r.prototype._timeoutError=function(e,t,n){if(!this._aborted){var r=new Error(e+t+"ms exceeded");r.timeout=t,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.abort(),this.callback(r)}},r.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},function(e,t){"use strict";function n(e){return null!==e&&"object"==typeof e}e.exports=n},function(e,t,n){"use strict";function r(e){if(e)return i(e)}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}var s=n(47);e.exports=r,r.prototype.get=function(e){return this.header[e.toLowerCase()]},r.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=s.type(t);var n=s.params(t);for(var r in n)this[r]=n[r];this.links={};try{e.link&&(this.links=s.parseLinks(e.link))}catch(e){}},r.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.created=201==e,this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e,this.unprocessableEntity=422==e}},function(e,t){"use strict";t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){return e.split(/ *; */).reduce(function(e,t){var n=t.split(/ *= */),r=n.shift(),i=n.shift();return r&&i&&(e[r]=i),e},{})},t.parseLinks=function(e){return e.split(/ *, */).reduce(function(e,t){var n=t.split(/ *; */),r=n[0].slice(1,-1);return e[n[1].split(/ *= */)[1].slice(1,-1)]=r,e},{})},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e}},function(e,t){function n(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach(function(e){n.prototype[e]=function(){return this._defaults.push({fn:e,arguments:arguments}),this}}),n.prototype._setDefaults=function(e){this._defaults.forEach(function(t){e[t.fn].apply(e,t.arguments)})},e.exports=n}])}); \ No newline at end of file diff --git a/lib/core/components/config.js b/lib/core/components/config.js index 77d50bc19..d1eafa272 100644 --- a/lib/core/components/config.js +++ b/lib/core/components/config.js @@ -178,7 +178,7 @@ var _class = function () { }, { key: 'getVersion', value: function getVersion() { - return '4.21.5'; + return '4.21.6'; } }, { key: '_decideUUID', diff --git a/lib/core/components/config.js.map b/lib/core/components/config.js.map index d10647063..54a2712cb 100644 --- a/lib/core/components/config.js.map +++ b/lib/core/components/config.js.map @@ -1 +1 @@ -{"version":3,"sources":["core/components/config.js"],"names":["setup","db","_db","instanceId","createUUID","secretKey","secret_key","subscribeKey","subscribe_key","publishKey","publish_key","sdkName","sdkFamily","partnerId","setAuthKey","authKey","setCipherKey","cipherKey","setFilterExpression","filterExpression","origin","secure","ssl","restore","proxy","keepAlive","keepAliveSettings","autoNetworkDetection","dedupeOnSubscribe","maximumCacheSize","customEncrypt","customDecrypt","location","protocol","logVerbosity","suppressLeaveEvents","announceFailedHeartbeats","announceSuccessfulHeartbeats","useInstanceId","useRequestId","requestMessageCountThreshold","setTransactionTimeout","transactionalRequestTimeout","setSubscribeTimeout","subscribeRequestTimeout","setSendBeaconConfig","useSendBeacon","setPresenceTimeout","presenceTimeout","heartbeatInterval","setHeartbeatInterval","setUUID","_decideUUID","uuid","val","UUID","set","_presenceTimeout","_heartbeatInterval","_subscribeRequestTimeout","_transactionalRequestTimeout","_useSendBeacon","providedUUID","get"],"mappings":"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","file":"config.js","sourcesContent":["/* @flow */\n/* global location */\n\nimport uuidGenerator from './uuid';\nimport { InternalSetupStruct, DatabaseInterface, KeepAliveStruct, ProxyStruct } from '../flow_interfaces';\n\ntype ConfigConstructArgs = {\n setup: InternalSetupStruct,\n db: DatabaseInterface\n}\n\nexport default class {\n\n _db: DatabaseInterface;\n\n subscribeKey: string;\n publishKey: string;\n secretKey: string;\n cipherKey: string;\n authKey: string;\n UUID: string;\n\n proxy: ProxyStruct;\n\n /*\n if _useInstanceId is true, this instanceId will be added to all requests\n */\n instanceId: string;\n\n /*\n If the SDK is running as part of another SDK built atop of it, allow a custom pnsdk with name and version.\n */\n sdkName: string;\n\n /*\n keep track of the SDK family for identifier generator\n */\n sdkFamily: string;\n\n /*\n If the SDK is operated by a partner, allow a custom pnsdk item for them.\n */\n partnerId: string;\n\n /*\n filter expression to pass along when subscribing.\n */\n filterExpression: string;\n /*\n configuration to supress leave events; when a presence leave is performed\n this configuration will disallow the leave event from happening\n */\n suppressLeaveEvents: boolean;\n\n /*\n use SSL for http requests?\n */\n secure: boolean;\n\n // Custom optional origin.\n origin: string;\n\n // log verbosity: true to output lots of info\n logVerbosity: boolean;\n\n // if instanceId config is true, the SDK will pass the unique instance identifier to the server as instanceId=\n useInstanceId: boolean;\n\n // if requestId config is true, the SDK will pass a unique request identifier with each request as request_id=\n useRequestId: boolean;\n\n // use connection keep-alive for http requests\n keepAlive: ?boolean;\n\n keepAliveSettings: ?KeepAliveStruct;\n\n // if autoNetworkDetection config is true, the SDK will emit NetworkUp and NetworkDown when there changes in the networking\n autoNetworkDetection: ?boolean;\n\n // alert when a heartbeat works out.\n announceSuccessfulHeartbeats: boolean;\n announceFailedHeartbeats: boolean;\n\n /*\n how long the server will wait before declaring that the client is gone.\n */\n _presenceTimeout: number;\n\n /*\n how often (in seconds) the client should announce its presence to server\n */\n _heartbeatInterval: number;\n\n /*\n how long to wait for the server when running the subscribe loop\n */\n _subscribeRequestTimeout: number;\n /*\n how long to wait for the server when making transactional requests\n */\n _transactionalRequestTimeout: number;\n /*\n use send beacon API when unsubscribing.\n https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon\n */\n _useSendBeacon: boolean;\n\n /*\n if set, the SDK will alert if more messages arrive in one subscribe than the theshold\n */\n requestMessageCountThreshold: number;\n\n /*\n Restore subscription list on disconnection.\n */\n restore: boolean;\n\n\n /*\n support for client deduping\n */\n dedupeOnSubscribe: boolean\n maximumCacheSize: number\n\n /*\n support customp encryption and decryption functions.\n */\n customEncrypt: Function // function to support custome encryption of messages\n customDecrypt: Function // function used to decrypt old version messages\n\n constructor({ setup, db } : ConfigConstructArgs) {\n this._db = db;\n\n this.instanceId = `pn-${uuidGenerator.createUUID()}`;\n this.secretKey = setup.secretKey || setup.secret_key;\n this.subscribeKey = setup.subscribeKey || setup.subscribe_key;\n this.publishKey = setup.publishKey || setup.publish_key;\n this.sdkName = setup.sdkName;\n this.sdkFamily = setup.sdkFamily;\n this.partnerId = setup.partnerId;\n this.setAuthKey(setup.authKey);\n this.setCipherKey(setup.cipherKey);\n\n this.setFilterExpression(setup.filterExpression);\n\n this.origin = setup.origin || 'pubsub.pndsn.com';\n this.secure = setup.ssl || false;\n this.restore = setup.restore || false;\n this.proxy = setup.proxy;\n this.keepAlive = setup.keepAlive;\n this.keepAliveSettings = setup.keepAliveSettings;\n this.autoNetworkDetection = setup.autoNetworkDetection || false;\n\n this.dedupeOnSubscribe = setup.dedupeOnSubscribe || false;\n this.maximumCacheSize = setup.maximumCacheSize || 100;\n\n this.customEncrypt = setup.customEncrypt;\n this.customDecrypt = setup.customDecrypt;\n\n // if location config exist and we are in https, force secure to true.\n if (typeof location !== 'undefined' && location.protocol === 'https:') {\n this.secure = true;\n }\n\n this.logVerbosity = setup.logVerbosity || false;\n this.suppressLeaveEvents = setup.suppressLeaveEvents || false;\n\n this.announceFailedHeartbeats = setup.announceFailedHeartbeats || true;\n this.announceSuccessfulHeartbeats = setup.announceSuccessfulHeartbeats || false;\n\n this.useInstanceId = setup.useInstanceId || false;\n this.useRequestId = setup.useRequestId || false;\n\n this.requestMessageCountThreshold = setup.requestMessageCountThreshold;\n\n // set timeout to how long a transaction request will wait for the server (default 15 seconds)\n this.setTransactionTimeout(setup.transactionalRequestTimeout || 15 * 1000);\n // set timeout to how long a subscribe event loop will run (default 310 seconds)\n this.setSubscribeTimeout(setup.subscribeRequestTimeout || 310 * 1000);\n // set config on beacon (https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon) usage\n this.setSendBeaconConfig(setup.useSendBeacon || true);\n // how long the SDK will report the client to be alive before issuing a timeout\n this.setPresenceTimeout(setup.presenceTimeout || 300);\n\n if (setup.heartbeatInterval != null) {\n this.setHeartbeatInterval(setup.heartbeatInterval);\n }\n\n this.setUUID(this._decideUUID(setup.uuid)); // UUID decision depends on subKey.\n }\n\n // exposed setters\n getAuthKey(): string { return this.authKey; }\n setAuthKey(val: string): this { this.authKey = val; return this; }\n setCipherKey(val: string): this { this.cipherKey = val; return this; }\n getUUID(): string { return this.UUID; }\n setUUID(val: string): this {\n if (this._db && this._db.set) this._db.set(`${this.subscribeKey}uuid`, val);\n this.UUID = val;\n return this;\n }\n\n getFilterExpression(): string { return this.filterExpression; }\n setFilterExpression(val: string): this { this.filterExpression = val; return this; }\n\n getPresenceTimeout(): number { return this._presenceTimeout; }\n setPresenceTimeout(val: number): this {\n this._presenceTimeout = val;\n this.setHeartbeatInterval((this._presenceTimeout / 2) - 1);\n return this;\n }\n\n setProxy(proxy: ProxyStruct) {\n this.proxy = proxy;\n }\n\n getHeartbeatInterval(): number { return this._heartbeatInterval; }\n setHeartbeatInterval(val: number): this { this._heartbeatInterval = val; return this; }\n\n // deprecated setters.\n getSubscribeTimeout(): number { return this._subscribeRequestTimeout; }\n setSubscribeTimeout(val: number): this { this._subscribeRequestTimeout = val; return this; }\n\n getTransactionTimeout(): number { return this._transactionalRequestTimeout; }\n setTransactionTimeout(val: number): this { this._transactionalRequestTimeout = val; return this; }\n\n isSendBeaconEnabled(): boolean { return this._useSendBeacon; }\n setSendBeaconConfig(val: boolean): this { this._useSendBeacon = val; return this; }\n\n getVersion(): string {\n return '4.21.5';\n }\n\n _decideUUID(providedUUID: string): string {\n // if the uuid was provided by setup, use this UUID.\n if (providedUUID) {\n return providedUUID;\n }\n\n // if the database module is enabled and we have something saved, use this.\n if (this._db && this._db.get && this._db.get(`${this.subscribeKey}uuid`)) {\n return this._db.get(`${this.subscribeKey}uuid`);\n }\n\n // randomize the UUID and push to storage\n return `pn-${uuidGenerator.createUUID()}`;\n }\n}\n"]} \ No newline at end of file +{"version":3,"sources":["core/components/config.js"],"names":["setup","db","_db","instanceId","createUUID","secretKey","secret_key","subscribeKey","subscribe_key","publishKey","publish_key","sdkName","sdkFamily","partnerId","setAuthKey","authKey","setCipherKey","cipherKey","setFilterExpression","filterExpression","origin","secure","ssl","restore","proxy","keepAlive","keepAliveSettings","autoNetworkDetection","dedupeOnSubscribe","maximumCacheSize","customEncrypt","customDecrypt","location","protocol","logVerbosity","suppressLeaveEvents","announceFailedHeartbeats","announceSuccessfulHeartbeats","useInstanceId","useRequestId","requestMessageCountThreshold","setTransactionTimeout","transactionalRequestTimeout","setSubscribeTimeout","subscribeRequestTimeout","setSendBeaconConfig","useSendBeacon","setPresenceTimeout","presenceTimeout","heartbeatInterval","setHeartbeatInterval","setUUID","_decideUUID","uuid","val","UUID","set","_presenceTimeout","_heartbeatInterval","_subscribeRequestTimeout","_transactionalRequestTimeout","_useSendBeacon","providedUUID","get"],"mappings":"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","file":"config.js","sourcesContent":["/* @flow */\n/* global location */\n\nimport uuidGenerator from './uuid';\nimport { InternalSetupStruct, DatabaseInterface, KeepAliveStruct, ProxyStruct } from '../flow_interfaces';\n\ntype ConfigConstructArgs = {\n setup: InternalSetupStruct,\n db: DatabaseInterface\n}\n\nexport default class {\n\n _db: DatabaseInterface;\n\n subscribeKey: string;\n publishKey: string;\n secretKey: string;\n cipherKey: string;\n authKey: string;\n UUID: string;\n\n proxy: ProxyStruct;\n\n /*\n if _useInstanceId is true, this instanceId will be added to all requests\n */\n instanceId: string;\n\n /*\n If the SDK is running as part of another SDK built atop of it, allow a custom pnsdk with name and version.\n */\n sdkName: string;\n\n /*\n keep track of the SDK family for identifier generator\n */\n sdkFamily: string;\n\n /*\n If the SDK is operated by a partner, allow a custom pnsdk item for them.\n */\n partnerId: string;\n\n /*\n filter expression to pass along when subscribing.\n */\n filterExpression: string;\n /*\n configuration to supress leave events; when a presence leave is performed\n this configuration will disallow the leave event from happening\n */\n suppressLeaveEvents: boolean;\n\n /*\n use SSL for http requests?\n */\n secure: boolean;\n\n // Custom optional origin.\n origin: string;\n\n // log verbosity: true to output lots of info\n logVerbosity: boolean;\n\n // if instanceId config is true, the SDK will pass the unique instance identifier to the server as instanceId=\n useInstanceId: boolean;\n\n // if requestId config is true, the SDK will pass a unique request identifier with each request as request_id=\n useRequestId: boolean;\n\n // use connection keep-alive for http requests\n keepAlive: ?boolean;\n\n keepAliveSettings: ?KeepAliveStruct;\n\n // if autoNetworkDetection config is true, the SDK will emit NetworkUp and NetworkDown when there changes in the networking\n autoNetworkDetection: ?boolean;\n\n // alert when a heartbeat works out.\n announceSuccessfulHeartbeats: boolean;\n announceFailedHeartbeats: boolean;\n\n /*\n how long the server will wait before declaring that the client is gone.\n */\n _presenceTimeout: number;\n\n /*\n how often (in seconds) the client should announce its presence to server\n */\n _heartbeatInterval: number;\n\n /*\n how long to wait for the server when running the subscribe loop\n */\n _subscribeRequestTimeout: number;\n /*\n how long to wait for the server when making transactional requests\n */\n _transactionalRequestTimeout: number;\n /*\n use send beacon API when unsubscribing.\n https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon\n */\n _useSendBeacon: boolean;\n\n /*\n if set, the SDK will alert if more messages arrive in one subscribe than the theshold\n */\n requestMessageCountThreshold: number;\n\n /*\n Restore subscription list on disconnection.\n */\n restore: boolean;\n\n\n /*\n support for client deduping\n */\n dedupeOnSubscribe: boolean\n maximumCacheSize: number\n\n /*\n support customp encryption and decryption functions.\n */\n customEncrypt: Function // function to support custome encryption of messages\n customDecrypt: Function // function used to decrypt old version messages\n\n constructor({ setup, db } : ConfigConstructArgs) {\n this._db = db;\n\n this.instanceId = `pn-${uuidGenerator.createUUID()}`;\n this.secretKey = setup.secretKey || setup.secret_key;\n this.subscribeKey = setup.subscribeKey || setup.subscribe_key;\n this.publishKey = setup.publishKey || setup.publish_key;\n this.sdkName = setup.sdkName;\n this.sdkFamily = setup.sdkFamily;\n this.partnerId = setup.partnerId;\n this.setAuthKey(setup.authKey);\n this.setCipherKey(setup.cipherKey);\n\n this.setFilterExpression(setup.filterExpression);\n\n this.origin = setup.origin || 'pubsub.pndsn.com';\n this.secure = setup.ssl || false;\n this.restore = setup.restore || false;\n this.proxy = setup.proxy;\n this.keepAlive = setup.keepAlive;\n this.keepAliveSettings = setup.keepAliveSettings;\n this.autoNetworkDetection = setup.autoNetworkDetection || false;\n\n this.dedupeOnSubscribe = setup.dedupeOnSubscribe || false;\n this.maximumCacheSize = setup.maximumCacheSize || 100;\n\n this.customEncrypt = setup.customEncrypt;\n this.customDecrypt = setup.customDecrypt;\n\n // if location config exist and we are in https, force secure to true.\n if (typeof location !== 'undefined' && location.protocol === 'https:') {\n this.secure = true;\n }\n\n this.logVerbosity = setup.logVerbosity || false;\n this.suppressLeaveEvents = setup.suppressLeaveEvents || false;\n\n this.announceFailedHeartbeats = setup.announceFailedHeartbeats || true;\n this.announceSuccessfulHeartbeats = setup.announceSuccessfulHeartbeats || false;\n\n this.useInstanceId = setup.useInstanceId || false;\n this.useRequestId = setup.useRequestId || false;\n\n this.requestMessageCountThreshold = setup.requestMessageCountThreshold;\n\n // set timeout to how long a transaction request will wait for the server (default 15 seconds)\n this.setTransactionTimeout(setup.transactionalRequestTimeout || 15 * 1000);\n // set timeout to how long a subscribe event loop will run (default 310 seconds)\n this.setSubscribeTimeout(setup.subscribeRequestTimeout || 310 * 1000);\n // set config on beacon (https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon) usage\n this.setSendBeaconConfig(setup.useSendBeacon || true);\n // how long the SDK will report the client to be alive before issuing a timeout\n this.setPresenceTimeout(setup.presenceTimeout || 300);\n\n if (setup.heartbeatInterval != null) {\n this.setHeartbeatInterval(setup.heartbeatInterval);\n }\n\n this.setUUID(this._decideUUID(setup.uuid)); // UUID decision depends on subKey.\n }\n\n // exposed setters\n getAuthKey(): string { return this.authKey; }\n setAuthKey(val: string): this { this.authKey = val; return this; }\n setCipherKey(val: string): this { this.cipherKey = val; return this; }\n getUUID(): string { return this.UUID; }\n setUUID(val: string): this {\n if (this._db && this._db.set) this._db.set(`${this.subscribeKey}uuid`, val);\n this.UUID = val;\n return this;\n }\n\n getFilterExpression(): string { return this.filterExpression; }\n setFilterExpression(val: string): this { this.filterExpression = val; return this; }\n\n getPresenceTimeout(): number { return this._presenceTimeout; }\n setPresenceTimeout(val: number): this {\n this._presenceTimeout = val;\n this.setHeartbeatInterval((this._presenceTimeout / 2) - 1);\n return this;\n }\n\n setProxy(proxy: ProxyStruct) {\n this.proxy = proxy;\n }\n\n getHeartbeatInterval(): number { return this._heartbeatInterval; }\n setHeartbeatInterval(val: number): this { this._heartbeatInterval = val; return this; }\n\n // deprecated setters.\n getSubscribeTimeout(): number { return this._subscribeRequestTimeout; }\n setSubscribeTimeout(val: number): this { this._subscribeRequestTimeout = val; return this; }\n\n getTransactionTimeout(): number { return this._transactionalRequestTimeout; }\n setTransactionTimeout(val: number): this { this._transactionalRequestTimeout = val; return this; }\n\n isSendBeaconEnabled(): boolean { return this._useSendBeacon; }\n setSendBeaconConfig(val: boolean): this { this._useSendBeacon = val; return this; }\n\n getVersion(): string {\n return '4.21.6';\n }\n\n _decideUUID(providedUUID: string): string {\n // if the uuid was provided by setup, use this UUID.\n if (providedUUID) {\n return providedUUID;\n }\n\n // if the database module is enabled and we have something saved, use this.\n if (this._db && this._db.get && this._db.get(`${this.subscribeKey}uuid`)) {\n return this._db.get(`${this.subscribeKey}uuid`);\n }\n\n // randomize the UUID and push to storage\n return `pn-${uuidGenerator.createUUID()}`;\n }\n}\n"]} \ No newline at end of file diff --git a/lib/networking/modules/nativescript.js b/lib/networking/modules/nativescript.js index 63c8cad14..8fe5aefb3 100644 --- a/lib/networking/modules/nativescript.js +++ b/lib/networking/modules/nativescript.js @@ -41,12 +41,17 @@ function xdr(method, url, params, body, endpoint, callback) { var status = {}; status.operation = endpoint.operation; - return (0, _http.request)({ + var httpConfig = { method: method, url: (0, _utils.buildUrl)(url, params), - content: body, timeout: endpoint.timeout - }).then(function (response) { + }; + + if (method === 'GET') { + httpConfig.content = body; + } + + return (0, _http.request)(httpConfig).then(function (response) { status.error = false; if (response.statusCode) { diff --git a/lib/networking/modules/nativescript.js.map b/lib/networking/modules/nativescript.js.map index 6e7f5e37f..917755833 100644 --- a/lib/networking/modules/nativescript.js.map +++ b/lib/networking/modules/nativescript.js.map @@ -1 +1 @@ -{"version":3,"sources":["networking/modules/nativescript.js"],"names":["get","post","del","log","url","qs","res","_pickLogger","console","start","Date","getTime","timestamp","toISOString","logger","now","elapsed","timestampDone","xdr","method","params","body","endpoint","callback","status","operation","content","timeout","then","response","error","statusCode","toJSON","resp","_config","logVerbosity","catch","e","errorData","category","_detectErrorCategory","getStandardOrigin","call"],"mappings":"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","file":"nativescript.js","sourcesContent":["/* @flow */\n\nimport { request as HttpRequest } from 'http';\nimport { EndpointDefinition, StatusAnnouncement } from '../../core/flow_interfaces';\nimport { buildUrl } from '../utils';\n\nfunction log(url, qs, res) {\n let _pickLogger = () => {\n if (console && console.log) return console; // eslint-disable-line no-console\n return console;\n };\n\n let start = new Date().getTime();\n let timestamp = new Date().toISOString();\n let logger = _pickLogger();\n logger.log('<<<<<'); // eslint-disable-line no-console\n logger.log(`[${timestamp}]`, '\\n', url, '\\n', qs); // eslint-disable-line no-console\n logger.log('-----'); // eslint-disable-line no-console\n\n let now = new Date().getTime();\n let elapsed = now - start;\n let timestampDone = new Date().toISOString();\n\n logger.log('>>>>>>'); // eslint-disable-line no-console\n logger.log(`[${timestampDone} / ${elapsed}]`, '\\n', url, '\\n', qs, '\\n', res); // eslint-disable-line no-console\n logger.log('-----'); // eslint-disable-line no-console\n}\n\nfunction xdr(method: string, url: string, params: Object, body: string, endpoint: EndpointDefinition, callback: Function): void {\n let status: StatusAnnouncement = {};\n status.operation = endpoint.operation;\n\n // $FlowFixMe\n return HttpRequest({\n method,\n url: buildUrl(url, params),\n content: body,\n timeout: endpoint.timeout\n }).then((response) => {\n status.error = false;\n\n if (response.statusCode) {\n status.statusCode = response.statusCode;\n }\n\n return response.content.toJSON();\n }).then((response) => {\n let resp = response;\n\n if (this._config.logVerbosity) {\n log(url, params, resp);\n }\n\n callback(status, resp);\n }).catch((e) => {\n status.error = true;\n status.errorData = e;\n status.category = this._detectErrorCategory(e);\n callback(status, null);\n });\n}\n\nexport function get(params: Object, endpoint: EndpointDefinition, callback: Function) {\n let url = this.getStandardOrigin() + endpoint.url;\n return xdr.call(this, 'GET', url, params, '', endpoint, callback);\n}\n\nexport function post(params: Object, body: string, endpoint: EndpointDefinition, callback: Function) {\n let url = this.getStandardOrigin() + endpoint.url;\n return xdr.call(this, 'POST', url, params, body, endpoint, callback);\n}\n\nexport function del(params: Object, endpoint: EndpointDefinition, callback: Function) {\n let url = this.getStandardOrigin() + endpoint.url;\n return xdr.call(this, 'DELETE', url, params, '', endpoint, callback);\n}\n"]} \ No newline at end of file +{"version":3,"sources":["networking/modules/nativescript.js"],"names":["get","post","del","log","url","qs","res","_pickLogger","console","start","Date","getTime","timestamp","toISOString","logger","now","elapsed","timestampDone","xdr","method","params","body","endpoint","callback","status","operation","httpConfig","timeout","content","then","response","error","statusCode","toJSON","resp","_config","logVerbosity","catch","e","errorData","category","_detectErrorCategory","getStandardOrigin","call"],"mappings":"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","file":"nativescript.js","sourcesContent":["/* @flow */\n\nimport { request as HttpRequest } from 'http';\nimport { EndpointDefinition, StatusAnnouncement } from '../../core/flow_interfaces';\nimport { buildUrl } from '../utils';\n\nfunction log(url, qs, res) {\n let _pickLogger = () => {\n if (console && console.log) return console; // eslint-disable-line no-console\n return console;\n };\n\n let start = new Date().getTime();\n let timestamp = new Date().toISOString();\n let logger = _pickLogger();\n logger.log('<<<<<'); // eslint-disable-line no-console\n logger.log(`[${timestamp}]`, '\\n', url, '\\n', qs); // eslint-disable-line no-console\n logger.log('-----'); // eslint-disable-line no-console\n\n let now = new Date().getTime();\n let elapsed = now - start;\n let timestampDone = new Date().toISOString();\n\n logger.log('>>>>>>'); // eslint-disable-line no-console\n logger.log(`[${timestampDone} / ${elapsed}]`, '\\n', url, '\\n', qs, '\\n', res); // eslint-disable-line no-console\n logger.log('-----'); // eslint-disable-line no-console\n}\n\nfunction xdr(method: string, url: string, params: Object, body: string, endpoint: EndpointDefinition, callback: Function): void {\n let status: StatusAnnouncement = {};\n status.operation = endpoint.operation;\n\n const httpConfig = {\n method,\n url: buildUrl(url, params),\n timeout: endpoint.timeout\n };\n\n if (method === 'GET') {\n httpConfig.content = body;\n }\n\n // $FlowFixMe\n return HttpRequest(httpConfig).then((response) => {\n status.error = false;\n\n if (response.statusCode) {\n status.statusCode = response.statusCode;\n }\n\n return response.content.toJSON();\n }).then((response) => {\n let resp = response;\n\n if (this._config.logVerbosity) {\n log(url, params, resp);\n }\n\n callback(status, resp);\n }).catch((e) => {\n status.error = true;\n status.errorData = e;\n status.category = this._detectErrorCategory(e);\n callback(status, null);\n });\n}\n\nexport function get(params: Object, endpoint: EndpointDefinition, callback: Function) {\n let url = this.getStandardOrigin() + endpoint.url;\n return xdr.call(this, 'GET', url, params, '', endpoint, callback);\n}\n\nexport function post(params: Object, body: string, endpoint: EndpointDefinition, callback: Function) {\n let url = this.getStandardOrigin() + endpoint.url;\n return xdr.call(this, 'POST', url, params, body, endpoint, callback);\n}\n\nexport function del(params: Object, endpoint: EndpointDefinition, callback: Function) {\n let url = this.getStandardOrigin() + endpoint.url;\n return xdr.call(this, 'DELETE', url, params, '', endpoint, callback);\n}\n"]} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4c4efa2e1..a89c6553d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pubnub", - "version": "4.21.4", + "version": "4.21.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 588d56be1..0a7317bd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pubnub", - "version": "4.21.5", + "version": "4.21.6", "author": "PubNub ", "description": "Publish & Subscribe Real-time Messaging with PubNub", "bin": {}, diff --git a/src/core/components/config.js b/src/core/components/config.js index 9977f6c32..7dc8452ab 100644 --- a/src/core/components/config.js +++ b/src/core/components/config.js @@ -228,7 +228,7 @@ export default class { setSendBeaconConfig(val: boolean): this { this._useSendBeacon = val; return this; } getVersion(): string { - return '4.21.5'; + return '4.21.6'; } _decideUUID(providedUUID: string): string { diff --git a/src/networking/modules/nativescript.js b/src/networking/modules/nativescript.js index 957608b30..7d1f223bd 100644 --- a/src/networking/modules/nativescript.js +++ b/src/networking/modules/nativescript.js @@ -30,13 +30,18 @@ function xdr(method: string, url: string, params: Object, body: string, endpoint let status: StatusAnnouncement = {}; status.operation = endpoint.operation; - // $FlowFixMe - return HttpRequest({ + const httpConfig = { method, url: buildUrl(url, params), - content: body, timeout: endpoint.timeout - }).then((response) => { + }; + + if (method === 'GET') { + httpConfig.content = body; + } + + // $FlowFixMe + return HttpRequest(httpConfig).then((response) => { status.error = false; if (response.statusCode) {