diff --git a/.gitignore b/.gitignore index eb0ca32..2ce74b2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,13 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +# No bundled stuff in git +dist +lib + +# No rollup stuff +.rts2_cache* + # Runtime data pids *.pid diff --git a/.npmignore b/.npmignore index 3ceeb38..7a4dc08 100644 --- a/.npmignore +++ b/.npmignore @@ -9,3 +9,14 @@ coverage/ *.iml .babelrc + +# No rollup cache +.rts2_cache* + +# No source or test needed +src +test + +# No build specifics needed +.pubnub.yml +.travis.yml diff --git a/dist/pubnub-react.js b/dist/pubnub-react.js deleted file mode 100644 index 883d837..0000000 --- a/dist/pubnub-react.js +++ /dev/null @@ -1,1273 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["PubNubReact"] = factory(); - else - root["PubNubReact"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _pubnub = __webpack_require__(1); - - var _pubnub2 = _interopRequireDefault(_pubnub); - - var _immutabilityHelper = __webpack_require__(2); - - var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - - var _wrapper = __webpack_require__(5); - - var _wrapper2 = _interopRequireDefault(_wrapper); - - var _autoload = __webpack_require__(7); - - var _autoload2 = _interopRequireDefault(_autoload); - - var _broadcast = __webpack_require__(8); - - var _modules = __webpack_require__(9); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var PubNubReact = function () { - function PubNubReact(config) { - _classCallCheck(this, PubNubReact); - - var instance = new _pubnub2.default(config); - (0, _wrapper2.default)(instance, this); - - this._pubnubInstance = instance; - this._autoload = new _autoload2.default(); - } - - _createClass(PubNubReact, [{ - key: 'init', - value: function init(component) { - if (!component.state) { - component.state = { pn_messages: {}, pn_status: {}, pn_presence: {} }; - } else { - component.state = (0, _immutabilityHelper2.default)(component.state, { $merge: { pn_status: {}, pn_messages: {}, pn_presence: {} } }); - } - - this._component = component; - this._broadcast = new _broadcast.Broadcast(); - this._listener = {}; - this._keepMessages = {}; - - this.addListener(this._listener); - this._autoload.initialize(this); - - this.getPresence = _modules.getPresence.bind(this); - this.getMessage = _modules.getMessage.bind(this); - this.getStatus = _modules.getStatus.bind(this); - this.clean = _modules.clean.bind(this); - this.release = _modules.release.bind(this); - } - }, { - key: 'subscribe', - value: function subscribe(args) { - this._pubnubInstance.subscribe(args); - this._autoload.enableLoad(args); - } - }, { - key: 'unsubscribe', - value: function unsubscribe(args) { - this._pubnubInstance.unsubscribe(args); - this._autoload.disableLoad(args); - } - }, { - key: 'getOriginalInstance', - value: function getOriginalInstance() { - if (this._pubnubInstance) { - return this._pubnubInstance; - } else { - throw new ReferenceError('Pubnub default instance is not initialized yet. Invoke #init() method first.'); - } - } - }]); - - return PubNubReact; - }(); - - exports.default = PubNubReact; - module.exports = exports['default']; - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - - !function(e,t){ true?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(40),h=r(l),f=n(41),p=r(f),d=n(42),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],v=e[n+10],_=e[n+11],m=e[n+12],k=e[n+13],P=e[n+14],O=e[n+15],T=o[0],S=o[1],w=o[2],C=o[3],T=t(T,S,w,C,a,7,l[0]),C=t(C,T,S,w,u,12,l[1]),w=t(w,C,T,S,c,17,l[2]),S=t(S,w,C,T,h,22,l[3]),T=t(T,S,w,C,f,7,l[4]),C=t(C,T,S,w,p,12,l[5]),w=t(w,C,T,S,d,17,l[6]),S=t(S,w,C,T,y,22,l[7]),T=t(T,S,w,C,g,7,l[8]),C=t(C,T,S,w,b,12,l[9]),w=t(w,C,T,S,v,17,l[10]),S=t(S,w,C,T,_,22,l[11]),T=t(T,S,w,C,m,7,l[12]),C=t(C,T,S,w,k,12,l[13]),w=t(w,C,T,S,P,17,l[14]),S=t(S,w,C,T,O,22,l[15]),T=r(T,S,w,C,u,5,l[16]),C=r(C,T,S,w,d,9,l[17]),w=r(w,C,T,S,_,14,l[18]),S=r(S,w,C,T,a,20,l[19]),T=r(T,S,w,C,p,5,l[20]),C=r(C,T,S,w,v,9,l[21]),w=r(w,C,T,S,O,14,l[22]),S=r(S,w,C,T,f,20,l[23]),T=r(T,S,w,C,b,5,l[24]),C=r(C,T,S,w,P,9,l[25]),w=r(w,C,T,S,h,14,l[26]),S=r(S,w,C,T,g,20,l[27]),T=r(T,S,w,C,k,5,l[28]),C=r(C,T,S,w,c,9,l[29]),w=r(w,C,T,S,y,14,l[30]),S=r(S,w,C,T,m,20,l[31]),T=i(T,S,w,C,p,4,l[32]),C=i(C,T,S,w,g,11,l[33]),w=i(w,C,T,S,_,16,l[34]),S=i(S,w,C,T,P,23,l[35]),T=i(T,S,w,C,u,4,l[36]),C=i(C,T,S,w,f,11,l[37]),w=i(w,C,T,S,y,16,l[38]),S=i(S,w,C,T,v,23,l[39]),T=i(T,S,w,C,k,4,l[40]),C=i(C,T,S,w,a,11,l[41]),w=i(w,C,T,S,h,16,l[42]),S=i(S,w,C,T,d,23,l[43]),T=i(T,S,w,C,b,4,l[44]),C=i(C,T,S,w,m,11,l[45]),w=i(w,C,T,S,O,16,l[46]),S=i(S,w,C,T,c,23,l[47]),T=s(T,S,w,C,a,6,l[48]),C=s(C,T,S,w,y,10,l[49]),w=s(w,C,T,S,P,15,l[50]),S=s(S,w,C,T,p,21,l[51]),T=s(T,S,w,C,m,6,l[52]),C=s(C,T,S,w,h,10,l[53]),w=s(w,C,T,S,v,15,l[54]),S=s(S,w,C,T,u,21,l[55]),T=s(T,S,w,C,g,6,l[56]),C=s(C,T,S,w,O,10,l[57]),w=s(w,C,T,S,d,15,l[58]),S=s(S,w,C,T,k,21,l[59]),T=s(T,S,w,C,f,6,l[60]),C=s(C,T,S,w,_,10,l[61]),w=s(w,C,T,S,c,15,l[62]),S=s(S,w,C,T,b,21,l[63]);o[0]=o[0]+T|0,o[1]=o[1]+S|0,o[2]=o[2]+w|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 v=b^b<<1^b<<2^b<<3^b<<4,v=v>>>8^255&v^99;i[g]=v,s[v]=g;var _=d[g],m=d[_],k=d[m],P=257*d[v]^16843008*v;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*_^16843008*g,l[v]=P<<24|P>>>8,h[v]=P<<16|P>>>16,f[v]=P<<8|P>>>24,p[v]=P,g?(g=_^d[d[d[k^_]]],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()===v.default.PNTimeOperation||t.getOperation()===v.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 _("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()===v.default.PNSubscribeOperation?g:s?s.promise:void 0}return i?i(u(a)):s?(s.reject(new _("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)),v=r(b),_=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/"+_.default.encodeString(r)+"/0/"+_.default.encodeString(o)}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 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),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 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(){return p.default.PNMessageCounts}function s(e,t){var n=t.channels,r=t.timetoken,i=t.channelTimetokens,s=e.config;return n?r&&i?"timetoken and channelTimetokens are incompatible together":r&&i&&i.length>1&&n.length!==i.length?"Length of channelTimetokens and channels do not match":s.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"}function o(e,t){var n=t.channels,r=e.config,i=n.join(",");return"/v3/history/sub-key/"+r.subscribeKey+"/message-counts/"+y.default.encodeString(i)}function a(e){return e.config.getTransactionTimeout()}function u(){return!0}function c(e,t){var n=t.timetoken,r=t.channelTimetokens,i={};if(r&&1===r.length){var s=h(r,1),o=s[0];i.timetoken=o}else r?i.channelsTimetoken=r.join(","):n&&(i.timetoken=n);return i}function l(e,t){return{channels:t.channels}}Object.defineProperty(t,"__esModule",{value:!0});var h=function(){function e(e,t){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,s=e}finally{try{!r&&a.return&&a.return()}finally{if(i)throw s}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.getOperation=i,t.validateParams=s,t.getURL=o,t.getRequestTimeout=a,t.isAuthSupported=u,t.prepareParams=c,t.handleResponse=l;var f=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.state,i=t.channelGroups,s=void 0===i?[]:i,o=t.timetoken,a=t.filterExpression,u=t.region,c={heartbeat:n.getPresenceTimeout()};return s.length>0&&(c["channel-group"]=s.join(",")),a&&a.length>0&&(c["filter-expr"]=a),Object.keys(r).length&&(c.state=JSON.stringify(r)),o&&(c.tt=o),u&&(c.tr=u),c}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("ps.","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=void 0,o={};if(o.error=null!==e,o.operation=t.operation,r&&r.status&&(o.statusCode=r.status),e){if(e.response&&e.response.text&&!i._config.logVerbosity)try{o.errorData=JSON.parse(e.response.text)}catch(t){o.errorData=e}else o.errorData=e;return o.category=i._detectErrorCategory(e),n(o,null)}try{s=JSON.parse(r.text)}catch(e){return o.errorData=r,o.error=!0,n(o,null)}return s.error&&1===s.error&&s.status&&s.message&&s.service?(o.errorData=s,o.statusCode=s.status,o.error=!0,o.category=i._detectErrorCategory(o),n(o,null)):n(o,s)})}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(43),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||v.serialize[i?i.split(";")[0]:""];!s&&u(i)&&(s=v.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},v.agent=function(){return new b},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(e){b.prototype[e.toLowerCase()]=function(t,n){var r=new v.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}}),b.prototype.del=b.prototype.delete,v.get=function(e,t,n){var r=v("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},v.head=function(e,t,n){var r=v("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},v.options=function(e,t,n){var r=v("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},v.del=h,v.delete=h,v.patch=function(e,t,n){var r=v("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},v.post=function(e,t,n){var r=v("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},v.put=function(e,t,n){var r=v("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(48);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}])}); - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - - var invariant = __webpack_require__(3); - - var hasOwnProperty = Object.prototype.hasOwnProperty; - var splice = Array.prototype.splice; - - var toString = Object.prototype.toString - var type = function(obj) { - return toString.call(obj).slice(8, -1); - } - - var assign = Object.assign || /* istanbul ignore next */ function assign(target, source) { - getAllKeys(source).forEach(function(key) { - if (hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - }); - return target; - }; - - var getAllKeys = typeof Object.getOwnPropertySymbols === 'function' ? - function(obj) { return Object.keys(obj).concat(Object.getOwnPropertySymbols(obj)) } : - /* istanbul ignore next */ function(obj) { return Object.keys(obj) }; - - /* istanbul ignore next */ - function copy(object) { - if (Array.isArray(object)) { - return assign(object.constructor(object.length), object) - } else if (type(object) === 'Map') { - return new Map(object) - } else if (type(object) === 'Set') { - return new Set(object) - } else if (object && typeof object === 'object') { - var prototype = Object.getPrototypeOf(object); - return assign(Object.create(prototype), object); - } else { - return object; - } - } - - function newContext() { - var commands = assign({}, defaultCommands); - update.extend = function(directive, fn) { - commands[directive] = fn; - }; - update.isEquals = function(a, b) { return a === b; }; - - return update; - - function update(object, spec) { - if (typeof spec === 'function') { - spec = { $apply: spec }; - } - - if (!(Array.isArray(object) && Array.isArray(spec))) { - invariant( - !Array.isArray(spec), - 'update(): You provided an invalid spec to update(). The spec may ' + - 'not contain an array except as the value of $set, $push, $unshift, ' + - '$splice or any custom command allowing an array value.' - ); - } - - invariant( - typeof spec === 'object' && spec !== null, - 'update(): You provided an invalid spec to update(). The spec and ' + - 'every included key path must be plain objects containing one of the ' + - 'following commands: %s.', - Object.keys(commands).join(', ') - ); - - var nextObject = object; - var index, key; - getAllKeys(spec).forEach(function(key) { - if (hasOwnProperty.call(commands, key)) { - var objectWasNextObject = object === nextObject; - nextObject = commands[key](spec[key], nextObject, spec, object); - if (objectWasNextObject && update.isEquals(nextObject, object)) { - nextObject = object; - } - } else { - var nextValueForKey = - type(object) === 'Map' - ? update(object.get(key), spec[key]) - : update(object[key], spec[key]); - var nextObjectValue = - type(nextObject) === 'Map' - ? nextObject.get(key) - : nextObject[key]; - if (!update.isEquals(nextValueForKey, nextObjectValue) || typeof nextValueForKey === 'undefined' && !hasOwnProperty.call(object, key)) { - if (nextObject === object) { - nextObject = copy(object); - } - if (type(nextObject) === 'Map') { - nextObject.set(key, nextValueForKey); - } else { - nextObject[key] = nextValueForKey; - } - } - } - }) - return nextObject; - } - - } - - var defaultCommands = { - $push: function(value, nextObject, spec) { - invariantPushAndUnshift(nextObject, spec, '$push'); - return value.length ? nextObject.concat(value) : nextObject; - }, - $unshift: function(value, nextObject, spec) { - invariantPushAndUnshift(nextObject, spec, '$unshift'); - return value.length ? value.concat(nextObject) : nextObject; - }, - $splice: function(value, nextObject, spec, originalObject) { - invariantSplices(nextObject, spec); - value.forEach(function(args) { - invariantSplice(args); - if (nextObject === originalObject && args.length) nextObject = copy(originalObject); - splice.apply(nextObject, args); - }); - return nextObject; - }, - $set: function(value, nextObject, spec) { - invariantSet(spec); - return value; - }, - $toggle: function(targets, nextObject) { - invariantSpecArray(targets, '$toggle'); - var nextObjectCopy = targets.length ? copy(nextObject) : nextObject; - - targets.forEach(function(target) { - nextObjectCopy[target] = !nextObject[target]; - }); - - return nextObjectCopy; - }, - $unset: function(value, nextObject, spec, originalObject) { - invariantSpecArray(value, '$unset'); - value.forEach(function(key) { - if (Object.hasOwnProperty.call(nextObject, key)) { - if (nextObject === originalObject) nextObject = copy(originalObject); - delete nextObject[key]; - } - }); - return nextObject; - }, - $add: function(value, nextObject, spec, originalObject) { - invariantMapOrSet(nextObject, '$add'); - invariantSpecArray(value, '$add'); - if (type(nextObject) === 'Map') { - value.forEach(function(pair) { - var key = pair[0]; - var value = pair[1]; - if (nextObject === originalObject && nextObject.get(key) !== value) nextObject = copy(originalObject); - nextObject.set(key, value); - }); - } else { - value.forEach(function(value) { - if (nextObject === originalObject && !nextObject.has(value)) nextObject = copy(originalObject); - nextObject.add(value); - }); - } - return nextObject; - }, - $remove: function(value, nextObject, spec, originalObject) { - invariantMapOrSet(nextObject, '$remove'); - invariantSpecArray(value, '$remove'); - value.forEach(function(key) { - if (nextObject === originalObject && nextObject.has(key)) nextObject = copy(originalObject); - nextObject.delete(key); - }); - return nextObject; - }, - $merge: function(value, nextObject, spec, originalObject) { - invariantMerge(nextObject, value); - getAllKeys(value).forEach(function(key) { - if (value[key] !== nextObject[key]) { - if (nextObject === originalObject) nextObject = copy(originalObject); - nextObject[key] = value[key]; - } - }); - return nextObject; - }, - $apply: function(value, original) { - invariantApply(value); - return value(original); - } - }; - - var contextForExport = newContext(); - - module.exports = contextForExport; - module.exports.default = contextForExport; - module.exports.newContext = newContext; - - // invariants - - function invariantPushAndUnshift(value, spec, command) { - invariant( - Array.isArray(value), - 'update(): expected target of %s to be an array; got %s.', - command, - value - ); - invariantSpecArray(spec[command], command) - } - - function invariantSpecArray(spec, command) { - invariant( - Array.isArray(spec), - 'update(): expected spec of %s to be an array; got %s. ' + - 'Did you forget to wrap your parameter in an array?', - command, - spec - ); - } - - function invariantSplices(value, spec) { - invariant( - Array.isArray(value), - 'Expected $splice target to be an array; got %s', - value - ); - invariantSplice(spec['$splice']); - } - - function invariantSplice(value) { - invariant( - Array.isArray(value), - 'update(): expected spec of $splice to be an array of arrays; got %s. ' + - 'Did you forget to wrap your parameters in an array?', - value - ); - } - - function invariantApply(fn) { - invariant( - typeof fn === 'function', - 'update(): expected spec of $apply to be a function; got %s.', - fn - ); - } - - function invariantSet(spec) { - invariant( - Object.keys(spec).length === 1, - 'Cannot have more than one key in an object with $set' - ); - } - - function invariantMerge(target, specValue) { - invariant( - specValue && typeof specValue === 'object', - 'update(): $merge expects a spec of type \'object\'; got %s', - specValue - ); - invariant( - target && typeof target === 'object', - 'update(): $merge expects a target of type \'object\'; got %s', - target - ); - } - - function invariantMapOrSet(target, command) { - var typeOfTarget = type(target); - invariant( - typeOfTarget === 'Map' || typeOfTarget === 'Set', - 'update(): %s expects a target of type Set or Map; got %s', - command, - typeOfTarget - ); - } - - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - 'use strict'; - - /** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - - var invariant = function(condition, format, a, b, c, d, e, f) { - if (process.env.NODE_ENV !== 'production') { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - } - - if (!condition) { - var error; - if (format === undefined) { - error = new Error( - 'Minified exception occurred; use the non-minified dev environment ' + - 'for the full error message and additional helpful warnings.' - ); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error( - format.replace(/%s/g, function() { return args[argIndex++]; }) - ); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } - }; - - module.exports = invariant; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - - // shim for using process in browser - var process = module.exports = {}; - - // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. - - var cachedSetTimeout; - var cachedClearTimeout; - - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); - } - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - } ()) - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - - } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - - } - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } - } - - function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; - - // v8 likes predictible objects - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - process.versions = {}; - - function noop() {} - - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - process.prependListener = noop; - process.prependOnceListener = noop; - - process.listeners = function (name) { return [] } - - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; - - process.cwd = function () { return '/' }; - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - process.umask = function() { return 0; }; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - exports.default = function (originalInstance, wrappedInstance) { - _config2.default.attributes_to_delegate.forEach(function (attribute) { - wrapAttribute(originalInstance, wrappedInstance, attribute); - }); - - _config2.default.methods_to_delegate.forEach(function (method) { - wrapMethod(originalInstance, wrappedInstance, method); - }); - }; - - var _config = __webpack_require__(6); - - var _config2 = _interopRequireDefault(_config); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function wrapAttribute(originalInstance, wrappedInstance, attributeName) { - wrappedInstance[attributeName] = originalInstance[attributeName]; - } - - function wrapMethod(OriginalInstance, wrappedInstance, methodName) { - wrappedInstance[methodName] = function () { - return OriginalInstance[methodName].apply(wrappedInstance, arguments); - }; - } - - module.exports = exports['default']; - -/***/ }), -/* 6 */ -/***/ (function(module, exports) { - - module.exports = {"pubnub_prefix":"pubnub","attributes_to_delegate":["channelGroups","push"],"methods_to_delegate":["addListener","removeListener","removeAllListeners","hereNow","whereNow","getState","setState","grant","audit","publish","fire","history","deleteMessages","fetchMessages","time","reconnect","stop","unsubscribeAll","getSubscribedChannels","getSubscribedChannelGroups","encrypt","decrypt","getAuthKey","setAuthKey","setCipherKey","getUUID","setUUID","getFilterExpression","setFilterExpression","messageCounts"],"common_callbacks_to_wrap":["callback","error"],"subscribe_listener_events_to_broadcast":["message","presence","status"],"history_sort_attribute":"timetoken"} - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _immutabilityHelper = __webpack_require__(2); - - var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var _class = function () { - function _class() { - _classCallCheck(this, _class); - - this.count = {}; - this.instance = undefined; - } - - _createClass(_class, [{ - key: 'initialize', - value: function initialize(instance) { - this.instance = instance; - } - }, { - key: 'enableLoad', - value: function enableLoad(args) { - var _this = this; - - if (this.instance && args.autoload && typeof args.autoload === 'number') { - this.count[args.channels] = args.autoload; - - args.channels.forEach(function (channel) { - _this.count[channel] = args.autoload; - }); - } - } - }, { - key: 'getHistory', - value: function getHistory(channel, callback) { - var _this2 = this; - - if (this.count[channel]) { - this.instance.history({ channel: channel, count: this.count[channel] }).then(function (response) { - response.messages.forEach(function (m) { - m.message = m.entry; - m.channel = channel; - - _this2.instance._component.setState(function (prevState) { - return { - pn_messages: (0, _immutabilityHelper2.default)(prevState.pn_messages, _defineProperty({}, channel, { $push: [m] })) - }; - }); - }); - - if (callback) { - callback(); - } - }).catch(function () {}); - } - } - }, { - key: 'disableLoad', - value: function disableLoad(args) { - var _this3 = this; - - if (Array.isArray(args.channels)) { - args.channels.forEach(function (ch) { - if (_this3.count[ch]) delete _this3.count[ch]; - }); - } else if (this.count[args.channels]) { - delete this.count[args.channels]; - } - } - }]); - - return _class; - }(); - - exports.default = _class; - module.exports = exports['default']; - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Broadcast = undefined; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _config = __webpack_require__(6); - - var _config2 = _interopRequireDefault(_config); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function subscribeChannel(event, channel, callback) { - if (!event[channel]) { - event[channel] = callback || {}; - } else if (event[channel] === {} && callback) { - event[channel] = callback; - } - } - - function unsubscribeChannel(event, channel) { - if (event[channel]) { - delete event[channel]; - } - } - - var Broadcast = exports.Broadcast = function () { - function Broadcast() { - _classCallCheck(this, Broadcast); - - this._message = {}; - this._presence = {}; - this._status = null; - } - - _createClass(Broadcast, [{ - key: 'message', - value: function message(channel, callback) { - subscribeChannel(this._message, channel, callback); - } - }, { - key: 'presence', - value: function presence(channel, callback) { - subscribeChannel(this._presence, channel, callback); - } - }, { - key: 'status', - value: function status(callback) { - if (!this._status) { - this._status = callback || {}; - } else if (this._status === {} && callback) { - this._status = callback; - } - } - }, { - key: 'isSubscribe', - value: function isSubscribe(event, channel) { - var subscriber = '_' + event; - - if (subscriber === '_status') { - return this[subscriber]; - } else { - return this[subscriber] && this[subscriber][channel]; - } - } - }, { - key: 'emit', - value: function emit(event, channel, args) { - var subscriber = '_' + event; - - if (this[subscriber] && this[subscriber][channel] && typeof this[subscriber][channel] === 'function') { - this[subscriber][channel].call(null, args); - } - } - }, { - key: 'emitStatus', - value: function emitStatus(args) { - if (this._status && typeof this._status === 'function') { - this._status.call(null, args); - } - } - }, { - key: 'error', - value: function error(callback) { - this._error = callback; - } - }, { - key: 'emitError', - value: function emitError(args) { - if (this._error) { - this._error.call(null, args); - } - } - }, { - key: 'unsubscribe', - value: function unsubscribe(channel) { - var _this = this; - - _config2.default.subscribe_listener_events_to_broadcast.forEach(function (event) { - var subscriber = '_' + event; - - unsubscribeChannel(_this[subscriber], channel); - }); - } - }]); - - return Broadcast; - }(); - -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _getMessage = __webpack_require__(10); - - Object.defineProperty(exports, 'getMessage', { - enumerable: true, - get: function get() { - return _getMessage.getMessage; - } - }); - - var _getPresence = __webpack_require__(11); - - Object.defineProperty(exports, 'getPresence', { - enumerable: true, - get: function get() { - return _getPresence.getPresence; - } - }); - - var _getStatus = __webpack_require__(12); - - Object.defineProperty(exports, 'getStatus', { - enumerable: true, - get: function get() { - return _getStatus.getStatus; - } - }); - - var _clean = __webpack_require__(13); - - Object.defineProperty(exports, 'clean', { - enumerable: true, - get: function get() { - return _clean.clean; - } - }); - - var _release = __webpack_require__(14); - - Object.defineProperty(exports, 'release', { - enumerable: true, - get: function get() { - return _release.release; - } - }); - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.getMessage = getMessage; - - var _immutabilityHelper = __webpack_require__(2); - - var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - - function init(component, channel) { - if (component.state.pn_messages[channel]) { - return false; - } else { - component.setState(function (prevState) { - return { - pn_messages: (0, _immutabilityHelper2.default)(prevState.pn_messages, { $merge: _defineProperty({}, channel, []) }) - }; - }); - - return true; - } - } - - function emit(instance, channel, message) { - var messages = instance._component.state.pn_messages[channel]; - var keepMessages = instance._keepMessages[channel]; - - messages.push(message); - - if (keepMessages && messages.length > keepMessages) { - messages = messages.slice(messages.length - keepMessages); - } - - instance._component.setState(function (prevState) { - return { - pn_messages: (0, _immutabilityHelper2.default)(prevState.pn_messages, _defineProperty({}, channel, { $set: messages })) - }; - }); - - instance._broadcast.emit('message', channel, message); - } - - function getMessage(channel) { - var _this = this; - - var component = this._component; - var callback = void 0; - var keepMessages = 100; - - if (arguments.length === 2 && typeof arguments[1] === 'function') { - callback = arguments[1]; - } else if (arguments.length === 2 && typeof arguments[1] === 'number') { - keepMessages = arguments[1]; - } else if (arguments.length === 3) { - callback = arguments[1]; - keepMessages = arguments[2]; - } - - if (init(component, channel)) { - this._keepMessages[channel] = keepMessages; - this._autoload.getHistory(channel, callback); - } - - this._broadcast.message(channel, callback); - - if (!this._listener.message) { - this._listener.message = function (message) { - if (message.subscription && _this._broadcast.isSubscribe('message', message.subscription)) { - emit(_this, message.subscription, message); - } - - if (message.channel && _this._broadcast.isSubscribe('message', message.channel)) { - emit(_this, message.channel, message); - } - }; - } - - if (component.state && component.state.pn_messages && component.state.pn_messages[channel]) { - return component.state.pn_messages[channel]; - } else { - return []; - } - } - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.getPresence = getPresence; - - var _immutabilityHelper = __webpack_require__(2); - - var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - - function init(instance, channel) { - if (instance._component.state.pn_presence[channel]) { - return false; - } - - instance._component.setState(function (prevState) { - return { - pn_presence: (0, _immutabilityHelper2.default)(prevState.pn_presence, { $merge: _defineProperty({}, channel, {}) }) - }; - }); - - return true; - } - - function emit(instance, channel, presence) { - instance._component.setState(function (prevState) { - return { - pn_presence: (0, _immutabilityHelper2.default)(prevState.pn_presence, _defineProperty({}, channel, { $set: presence })) - }; - }); - - instance._broadcast.emit('presence', presence.channel, presence); - } - - function getPresence(channel, callback) { - var _this = this; - - this._broadcast.presence(channel, callback); - - init(this, channel); - - if (!this._listener.presence) { - this._listener.presence = function (ps) { - if (ps.subscription && _this._broadcast.isSubscribe('presence', ps.subscription)) { - emit(_this, ps.subscription, ps); - } - - if (ps.channel && _this._broadcast.isSubscribe('presence', ps.channel)) { - emit(_this, ps.channel, ps); - } - }; - } - - if (this._component.state && this._component.state.pn_presence) { - return this._component.state.pn_presence[channel]; - } else { - return {}; - } - } - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.getStatus = getStatus; - - var _immutabilityHelper = __webpack_require__(2); - - var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function getStatus(callback) { - var _this = this; - - this._broadcast.status(callback); - - if (!this._listener.status) { - this._listener.status = function (st) { - if (!_this._broadcast.isSubscribe('status')) { - return true; - } - - _this._component.setState(function (prevState) { - return { - pn_status: (0, _immutabilityHelper2.default)(prevState.pn_status, { $set: st }) - }; - }); - - _this._broadcast.emitStatus(st); - }; - } - - if (this._component.state && this._component.state.pn_status) { - return this._component.state.pn_status; - } else { - return {}; - } - } - -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.clean = clean; - - var _immutabilityHelper = __webpack_require__(2); - - var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - - function clean(channel) { - if (this._broadcast.isSubscribe('message', channel)) { - this._component.setState(function (prevState) { - return { - pn_messages: (0, _immutabilityHelper2.default)(prevState.pn_messages, _defineProperty({}, channel, { $set: [] })) - }; - }); - } - - if (this._broadcast.isSubscribe('presence', channel)) { - this._component.setState(function (prevState) { - return { - pn_presence: (0, _immutabilityHelper2.default)(prevState.pn_presence, _defineProperty({}, channel, { $set: [] })) - }; - }); - } - } - -/***/ }), -/* 14 */ -/***/ (function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.release = release; - function release(channel) { - if (this._broadcast.isSubscribe('message', channel)) { - var pnMessages = this._component.state.pn_messages; - - delete pnMessages[channel]; - - this._component.setState({ pn_messages: pnMessages }); - } - - if (this._broadcast.isSubscribe('presence', channel)) { - var pnPresence = this._component.state.pn_presence; - - delete pnPresence[channel]; - - this._component.setState({ pn_presence: pnPresence }); - } - - this._broadcast.unsubscribe(channel); - } - -/***/ }) -/******/ ]) -}); -; \ No newline at end of file diff --git a/dist/pubnub-react.min.js b/dist/pubnub-react.min.js deleted file mode 100644 index 5028641..0000000 --- a/dist/pubnub-react.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PubNubReact=t():e.PubNubReact=t()}(this,function(){return i={},n.m=r=[function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e};function i(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 e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=a.ceil(t/4)},clone:function(){var e=r.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n>>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 u.init(n,t/2)}},o=i.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 u.init(n,t)}},c=i.Utf8={stringify:function(e){try{return decodeURIComponent(escape(o.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return o.parse(unescape(encodeURIComponent(e)))}},l=t.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,n=t.words,r=t.sigBytes,i=this.blockSize,s=r/(4*i);if(e=(s=e?a.ceil(s):a.max((0|s)-this._minBufferSize,0))*i,r=a.min(4*e,r),e){for(var o=0;o>>7)^(f<<14|f>>>18)^f>>>3)+y[h-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+y[h-16]}f=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&c)+d[h]+y[h],p=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&s^i&s),l=c,c=u,u=a,a=o+f|0,o=s,s=i,i=r,r=f+p|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]+a|0,n[5]=n[5]+u|0,n[6]=n[6]+c|0,n[7]=n[7]+l|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(64+r>>>9<<4)]=i.floor(n/4294967296),t[15+(64+r>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=n._createHelper(r),e.HmacSHA256=n._createHmacHelper(r)}(Math),h=(l=M).enc.Utf8,l.algo.HMAC=l.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=h.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),s=this._iKey=t.clone(),o=i.words,a=s.words,u=0;u>>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;o<4&&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 t=e.length,n=this._map;(r=n.charAt(64))&&-1!=(r=e.indexOf(r))&&(t=r);for(var r=[],i=0,s=0;s>>6-s%4*2;r[i>>>2]|=(o|a)<<24-i%4*8,i++}return u.create(r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(s){function O(e,t,n,r,i,s,o){return((e=e+(t&n|~t&r)+i+o)<>>32-s)+t}function w(e,t,n,r,i,s,o){return((e=e+(t&r|n&~r)+i+o)<>>32-s)+t}function S(e,t,n,r,i,s,o){return((e=e+(t^n^r)+i+o)<>>32-s)+t}function T(e,t,n,r,i,s,o){return((e=e+(n^(t|~r))+i+o)<>>32-s)+t}for(var e=M,t=(r=e.lib).WordArray,n=r.Hasher,r=e.algo,C=[],i=0;i<64;i++)C[i]=4294967296*s.abs(s.sin(i+1))|0;r=r.MD5=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=e[o=t+n];e[o]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}n=this._hash.words;var i,s,o=e[t+0],a=(r=e[t+1],e[t+2]),u=e[t+3],c=e[t+4],l=e[t+5],h=e[t+6],f=e[t+7],p=e[t+8],d=e[t+9],y=e[t+10],g=e[t+11],b=e[t+12],_=e[t+13],v=e[t+14],m=e[t+15],k=n[0],P=T(P=T(P=T(P=T(P=S(P=S(P=S(P=S(P=w(P=w(P=w(P=w(P=O(P=O(P=O(P=O(P=n[1],s=O(s=n[2],i=O(i=n[3],k=O(k,P,s,i,o,7,C[0]),P,s,r,12,C[1]),k,P,a,17,C[2]),i,k,u,22,C[3]),s=O(s,i=O(i,k=O(k,P,s,i,c,7,C[4]),P,s,l,12,C[5]),k,P,h,17,C[6]),i,k,f,22,C[7]),s=O(s,i=O(i,k=O(k,P,s,i,p,7,C[8]),P,s,d,12,C[9]),k,P,y,17,C[10]),i,k,g,22,C[11]),s=O(s,i=O(i,k=O(k,P,s,i,b,7,C[12]),P,s,_,12,C[13]),k,P,v,17,C[14]),i,k,m,22,C[15]),s=w(s,i=w(i,k=w(k,P,s,i,r,5,C[16]),P,s,h,9,C[17]),k,P,g,14,C[18]),i,k,o,20,C[19]),s=w(s,i=w(i,k=w(k,P,s,i,l,5,C[20]),P,s,y,9,C[21]),k,P,m,14,C[22]),i,k,c,20,C[23]),s=w(s,i=w(i,k=w(k,P,s,i,d,5,C[24]),P,s,v,9,C[25]),k,P,u,14,C[26]),i,k,p,20,C[27]),s=w(s,i=w(i,k=w(k,P,s,i,_,5,C[28]),P,s,a,9,C[29]),k,P,f,14,C[30]),i,k,b,20,C[31]),s=S(s,i=S(i,k=S(k,P,s,i,l,4,C[32]),P,s,p,11,C[33]),k,P,g,16,C[34]),i,k,v,23,C[35]),s=S(s,i=S(i,k=S(k,P,s,i,r,4,C[36]),P,s,c,11,C[37]),k,P,f,16,C[38]),i,k,y,23,C[39]),s=S(s,i=S(i,k=S(k,P,s,i,_,4,C[40]),P,s,o,11,C[41]),k,P,u,16,C[42]),i,k,h,23,C[43]),s=S(s,i=S(i,k=S(k,P,s,i,d,4,C[44]),P,s,b,11,C[45]),k,P,m,16,C[46]),i,k,a,23,C[47]),s=T(s,i=T(i,k=T(k,P,s,i,o,6,C[48]),P,s,f,10,C[49]),k,P,v,15,C[50]),i,k,l,21,C[51]),s=T(s,i=T(i,k=T(k,P,s,i,b,6,C[52]),P,s,u,10,C[53]),k,P,y,15,C[54]),i,k,r,21,C[55]),s=T(s,i=T(i,k=T(k,P,s,i,p,6,C[56]),P,s,m,10,C[57]),k,P,h,15,C[58]),i,k,_,21,C[59]),s=T(s,i=T(i,k=T(k,P,s,i,c,6,C[60]),P,s,g,10,C[61]),k,P,a,15,C[62]),i,k,d,21,C[63]);n[0]=n[0]+k|0,n[1]=n[1]+P|0,n[2]=n[2]+s|0,n[3]=n[3]+i|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32;var i=s.floor(n/4294967296);for(t[15+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process(),t=(e=this._hash).words,n=0;n<4;n++)r=t[n],t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return e},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),e.MD5=n._createHelper(r),e.HmacMD5=n._createHmacHelper(r)}(Math),s=(r=(i=M).lib).Base,c=r.WordArray,o=(r=i.algo).EvpKDF=s.extend({cfg:s.extend({keySize:4,hasher:r.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=(o=this.cfg).hasher.create(),r=c.create(),i=r.words,s=o.keySize,o=o.iterations;i.length>>2]}},e.BlockCipher=s.extend({cfg:s.cfg.extend({mode:u,padding:c}),reset:function(){s.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.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 l=e.CipherParams=t.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),h=(u=(f.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?o.create([1398893684,1701076831]).concat(e).concat(t):t).toString(r)},parse:function(e){var t=(e=r.parse(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 l.create({ciphertext:e,salt:n})}},e.SerializableCipher=t.extend({cfg:t.extend({format:u}),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,l.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}})),f=(f.kdf={}).OpenSSL={execute:function(e,t,n,r){return r=r||o.random(8),e=i.create({keySize:t+n}).compute(e,r),n=o.create(e.words.slice(t),4*n),e.sigBytes=4*t,l.create({key:e,iv:n,salt:r})}},p=e.PasswordBasedCipher=h.extend({cfg:h.cfg.extend({kdf:f}),encrypt:function(e,t,n,r){return n=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,(e=h.encrypt.call(this,e,t,n.key,r)).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,h.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=M,t=e.lib.BlockCipher,n=e.algo,o=[],r=[],i=[],s=[],a=[],u=[],c=[],l=[],h=[],f=[],p=[],d=0;d<256;d++)p[d]=d<128?d<<1:d<<1^283;var y=0,g=0;for(d=0;d<256;d++){var b=(b=g^g<<1^g<<2^g<<3^g<<4)>>>8^255&b^99;o[y]=b;var _=p[r[b]=y],v=p[_],m=p[v],k=257*p[b]^16843008*b;i[y]=k<<24|k>>>8,s[y]=k<<16|k>>>16,a[y]=k<<8|k>>>24,u[y]=k,k=16843009*m^65537*v^257*_^16843008*y,c[b]=k<<24|k>>>8,l[b]=k<<16|k>>>16,h[b]=k<<8|k>>>24,f[b]=k,y?(y=_^p[p[p[m^_]]],g^=p[p[g]]):y=g=1}var P=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=t.extend({_doReset:function(){for(var e=(n=this._key).words,t=n.sigBytes/4,n=4*((this._nRounds=t+6)+1),r=this._keySchedule=[],i=0;i>>24]<<24|o[s>>>16&255]<<16|o[s>>>8&255]<<8|o[255&s]):(s=o[(s=s<<8|s>>>24)>>>24]<<24|o[s>>>16&255]<<16|o[s>>>8&255]<<8|o[255&s],s^=P[i/t|0]<<24),r[i]=r[i-t]^s}for(e=this._invKeySchedule=[],t=0;t>>24]]^l[o[s>>>16&255]]^h[o[s>>>8&255]]^f[o[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,i,s,a,u,o)},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,c,l,h,f,r),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(n)}(),M.mode.ECB=((n=M.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),n.Decryptor=n.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),n),e.exports=M},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e},c=r((r((r((r(n(6)),n(2))),n(9))),n(11))),l=r(n(14)),h=r(n(15)),f=r((n(5),n(10))),s=(i(p,[{key:"adaptStateChange",value:function(e,t){var n=this,r=e.state,i=e.channels,s=void 0===i?[]:i,o=e.channelGroups,a=void 0===o?[]:o;return s.forEach(function(e){e in n._channels&&(n._channels[e].state=r)}),a.forEach(function(e){e in n._channelGroups&&(n._channelGroups[e].state=r)}),this._setStateEndpoint({state:r,channels:s,channelGroups:a},t)}},{key:"adaptPresenceChange",value:function(e){var t=this,n=e.connected,r=e.channels,i=void 0===r?[]:r,s=e.channelGroups,o=void 0===s?[]:s;n?(i.forEach(function(e){t._heartbeatChannels[e]={state:{}}}),o.forEach(function(e){t._heartbeatChannelGroups[e]={state:{}}})):(i.forEach(function(e){e in t._heartbeatChannels&&delete t._heartbeatChannels[e]}),o.forEach(function(e){e in t._heartbeatChannelGroups&&delete t._heartbeatChannelGroups[e]}),!1===this._config.suppressLeaveEvents&&this._leaveEndpoint({channels:i,channelGroups:o},function(e){t._listenerManager.announceStatus(e)})),this.reconnect()}},{key:"adaptSubscribeChange",value:function(e){var t=this,n=e.timetoken,r=e.channels,i=void 0===r?[]:r,s=e.channelGroups,o=void 0===s?[]:s,a=e.withPresence,u=void 0!==a&&a,c=e.withHeartbeats,l=void 0!==c&&c;this._config.subscribeKey&&""!==this._config.subscribeKey?(n&&(this._lastTimetoken=this._currentTimetoken,this._currentTimetoken=n),"0"!==this._currentTimetoken&&0!==this._currentTimetoken&&(this._storedTimetoken=this._currentTimetoken,this._currentTimetoken=0),i.forEach(function(e){t._channels[e]={state:{}},u&&(t._presenceChannels[e]={}),l&&(t._heartbeatChannels[e]={}),t._pendingChannelSubscriptions.push(e)}),o.forEach(function(e){t._channelGroups[e]={state:{}},u&&(t._presenceChannelGroups[e]={}),l&&(t._heartbeatChannelGroups[e]={}),t._pendingChannelGroupSubscriptions.push(e)}),this._subscriptionStatusAnnounced=!1,this.reconnect()):console&&console.log&&console.log("subscribe key missing; aborting subscribe")}},{key:"adaptUnsubscribeChange",value:function(e,t){var n=this,r=e.channels,i=void 0===r?[]:r,s=e.channelGroups,o=void 0===s?[]:s,a=[],u=[];i.forEach(function(e){e in n._channels&&(delete n._channels[e],a.push(e),e in n._heartbeatChannels&&delete n._heartbeatChannels[e]),e in n._presenceChannels&&(delete n._presenceChannels[e],a.push(e))}),o.forEach(function(e){e in n._channelGroups&&(delete n._channelGroups[e],u.push(e),e in n._heartbeatChannelGroups&&delete n._heartbeatChannelGroups[e]),e in n._presenceChannelGroups&&(delete n._channelGroups[e],u.push(e))}),0===a.length&&0===u.length||(!1!==this._config.suppressLeaveEvents||t||this._leaveEndpoint({channels:a,channelGroups:u},function(e){e.affectedChannels=a,e.affectedChannelGroups=u,e.currentTimetoken=n._currentTimetoken,e.lastTimetoken=n._lastTimetoken,n._listenerManager.announceStatus(e)}),0===Object.keys(this._channels).length&&0===Object.keys(this._presenceChannels).length&&0===Object.keys(this._channelGroups).length&&0===Object.keys(this._presenceChannelGroups).length&&(this._lastTimetoken=0,this._currentTimetoken=0,this._storedTimetoken=null,this._region=null,this._reconnectionManager.stopPolling()),this.reconnect())}},{key:"unsubscribeAll",value:function(e){this.adaptUnsubscribeChange({channels:this.getSubscribedChannels(),channelGroups:this.getSubscribedChannelGroups()},e)}},{key:"getHeartbeatChannels",value:function(){return Object.keys(this._heartbeatChannels)}},{key:"getHeartbeatChannelGroups",value:function(){return Object.keys(this._heartbeatChannelGroups)}},{key:"getSubscribedChannels",value:function(){return Object.keys(this._channels)}},{key:"getSubscribedChannelGroups",value:function(){return Object.keys(this._channelGroups)}},{key:"reconnect",value:function(){this._startSubscribeLoop(),this._registerHeartbeatTimer()}},{key:"disconnect",value:function(){this._stopSubscribeLoop(),this._stopHeartbeatTimer(),this._reconnectionManager.stopPolling()}},{key:"_registerHeartbeatTimer",value:function(){this._stopHeartbeatTimer(),0!==this._config.getHeartbeatInterval()&&(this._performHeartbeatLoop(),this._heartbeatTimer=setInterval(this._performHeartbeatLoop.bind(this),1e3*this._config.getHeartbeatInterval()))}},{key:"_stopHeartbeatTimer",value:function(){this._heartbeatTimer&&(clearInterval(this._heartbeatTimer),this._heartbeatTimer=null)}},{key:"_performHeartbeatLoop",value:function(){var n=this,e=this.getHeartbeatChannels(),t=this.getHeartbeatChannelGroups(),r={};0===e.length&&0===t.length||(this.getSubscribedChannels().forEach(function(e){var t=n._channels[e].state;Object.keys(t).length&&(r[e]=t)}),this.getSubscribedChannelGroups().forEach(function(e){var t=n._channelGroups[e].state;Object.keys(t).length&&(r[e]=t)}),this._heartbeatEndpoint({channels:e,channelGroups:t,state:r},function(e){e.error&&n._config.announceFailedHeartbeats&&n._listenerManager.announceStatus(e),e.error&&n._config.autoNetworkDetection&&n._isOnline&&(n._isOnline=!1,n.disconnect(),n._listenerManager.announceNetworkDown(),n.reconnect()),!e.error&&n._config.announceSuccessfulHeartbeats&&n._listenerManager.announceStatus(e)}.bind(this)))}},{key:"_startSubscribeLoop",value:function(){var n=this;this._stopSubscribeLoop();var r={},i=[],s=[];if(Object.keys(this._channels).forEach(function(e){var t=n._channels[e].state;Object.keys(t).length&&(r[e]=t),i.push(e)}),Object.keys(this._presenceChannels).forEach(function(e){i.push(e+"-pnpres")}),Object.keys(this._channelGroups).forEach(function(e){var t=n._channelGroups[e].state;Object.keys(t).length&&(r[e]=t),s.push(e)}),Object.keys(this._presenceChannelGroups).forEach(function(e){s.push(e+"-pnpres")}),0!==i.length||0!==s.length){var e={channels:i,channelGroups:s,state:r,timetoken:this._currentTimetoken,filterExpression:this._config.filterExpression,region:this._region};this._subscribeCall=this._subscribeEndpoint(e,this._processSubscribeResponse.bind(this))}}},{key:"_processSubscribeResponse",value:function(t,e){var o=this;if(t.error)t.category===f.default.PNTimeoutCategory?this._startSubscribeLoop():(t.category===f.default.PNNetworkIssuesCategory?(this.disconnect(),t.error&&this._config.autoNetworkDetection&&this._isOnline&&(this._isOnline=!1,this._listenerManager.announceNetworkDown()),this._reconnectionManager.onReconnection(function(){o._config.autoNetworkDetection&&!o._isOnline&&(o._isOnline=!0,o._listenerManager.announceNetworkUp()),o.reconnect(),o._subscriptionStatusAnnounced=!0;var e={category:f.default.PNReconnectedCategory,operation:t.operation,lastTimetoken:o._lastTimetoken,currentTimetoken:o._currentTimetoken};o._listenerManager.announceStatus(e)}),this._reconnectionManager.startPolling()):t.category===f.default.PNBadRequestCategory&&this._stopHeartbeatTimer(),this._listenerManager.announceStatus(t));else{if(this._storedTimetoken?(this._currentTimetoken=this._storedTimetoken,this._storedTimetoken=null):(this._lastTimetoken=this._currentTimetoken,this._currentTimetoken=e.metadata.timetoken),!this._subscriptionStatusAnnounced){var n={};n.category=f.default.PNConnectedCategory,n.operation=t.operation,n.affectedChannels=this._pendingChannelSubscriptions,n.subscribedChannels=this.getSubscribedChannels(),n.affectedChannelGroups=this._pendingChannelGroupSubscriptions,n.lastTimetoken=this._lastTimetoken,n.currentTimetoken=this._currentTimetoken,this._subscriptionStatusAnnounced=!0,this._listenerManager.announceStatus(n),this._pendingChannelSubscriptions=[],this._pendingChannelGroupSubscriptions=[]}var r=e.messages||[],i=this._config,s=i.requestMessageCountThreshold,a=i.dedupeOnSubscribe;if(s&&r.length>=s){var u={};u.category=f.default.PNRequestMessageCountExceededCategory,u.operation=t.operation,this._listenerManager.announceStatus(u)}r.forEach(function(e){var t=e.channel,n=e.subscriptionMatch,r=e.publishMetaData;if(t===n&&(n=null),a){if(o._dedupingManager.isDuplicate(e))return;o._dedupingManager.addEntry(e)}if(h.default.endsWith(e.channel,"-pnpres")){var i={channel:null,subscription:null};i.actualChannel=null!=n?t:null,i.subscribedChannel=null!=n?n:t,t&&(i.channel=t.substring(0,t.lastIndexOf("-pnpres"))),n&&(i.subscription=n.substring(0,n.lastIndexOf("-pnpres"))),i.action=e.payload.action,i.state=e.payload.data,i.timetoken=r.publishTimetoken,i.occupancy=e.payload.occupancy,i.uuid=e.payload.uuid,i.timestamp=e.payload.timestamp,e.payload.join&&(i.join=e.payload.join),e.payload.leave&&(i.leave=e.payload.leave),e.payload.timeout&&(i.timeout=e.payload.timeout),o._listenerManager.announcePresence(i)}else{var s={channel:null,subscription:null};s.actualChannel=null!=n?t:null,s.subscribedChannel=null!=n?n:t,s.channel=t,s.subscription=n,s.timetoken=r.publishTimetoken,s.publisher=e.issuingClientId,e.userMetadata&&(s.userMetadata=e.userMetadata),o._config.cipherKey?s.message=o._crypto.decrypt(e.payload):s.message=e.payload,o._listenerManager.announceMessage(s)}}),this._region=e.metadata.region,this._startSubscribeLoop()}}},{key:"_stopSubscribeLoop",value:function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)}}]),p);function p(e){var t=e.subscribeEndpoint,n=e.leaveEndpoint,r=e.heartbeatEndpoint,i=e.setStateEndpoint,s=e.timeEndpoint,o=e.config,a=e.crypto,u=e.listenerManager;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,p),this._listenerManager=u,this._config=o,this._leaveEndpoint=n,this._heartbeatEndpoint=r,this._setStateEndpoint=i,this._subscribeEndpoint=t,this._crypto=a,this._channels={},this._presenceChannels={},this._heartbeatChannels={},this._heartbeatChannelGroups={},this._channelGroups={},this._presenceChannelGroups={},this._pendingChannelSubscriptions=[],this._pendingChannelGroupSubscriptions=[],this._currentTimetoken=0,this._lastTimetoken=0,this._storedTimetoken=null,this._subscriptionStatusAnnounced=!1,this._isOnline=!0,this._reconnectionManager=new c.default({timeEndpoint:s}),this._dedupingManager=new l.default({config:o})}function o(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=[]}}]),a);function a(e){var t=e.config;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,a),this.hashHistory=[],this._config=t}function u(e,t){for(var n=0;n=this._maxSubDomain&&(this._currentSubDomain=1),e=this._currentSubDomain.toString(),this._providedFQDN.replace("ps.","ps"+e+"."));var e}},{key:"hasModule",value:function(e){return e in this._modules}},{key:"shiftStandardOrigin",value:function(){var e=0>>>>>"),s.log("["+n+" / "+t+"]","\n",r.url,"\n",r.qs,"\n",e.text),s.log("-----")})}function s(e,i,s){var o=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(i.timeout).end(function(t,e){var n=void 0,r={};if(r.error=null!==t,r.operation=i.operation,e&&e.status&&(r.statusCode=e.status),t){if(t.response&&t.response.text&&!o._config.logVerbosity)try{r.errorData=JSON.parse(t.response.text)}catch(e){r.errorData=t}else r.errorData=t;return r.category=o._detectErrorCategory(t),s(r,null)}try{n=JSON.parse(e.text)}catch(t){return r.errorData=e,r.error=!0,s(r,null)}return n.error&&1===n.error&&n.status&&n.message&&n.service?(r.errorData=n,r.statusCode=n.status,r.error=!0,r.category=o._detectErrorCategory(r),s(r,null)):s(r,n)})}Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e,t,n){var r=a.default.get(this.getStandardOrigin()+t.url).query(e);return s.call(this,r,t,n)},t.post=function(e,t,n,r){var i=a.default.post(this.getStandardOrigin()+n.url).query(e).send(t);return s.call(this,i,n,r)},t.del=function(e,t,n){var r=a.default.delete(this.getStandardOrigin()+t.url).query(e);return s.call(this,r,t,n)};var i,o=n(43),a=(i=o)&&i.__esModule?i:{default:i};n(5)},function(e,n,t){function r(){}function i(e){if(!d(e))return e;var t=[];for(var n in e)s(t,n,e[n]);return t.join("&")}function s(t,n,e){if(null!=e)if(Array.isArray(e))e.forEach(function(e){s(t,n,e)});else if(d(e))for(var r in e)s(t,n+"["+r+"]",e[r]);else t.push(encodeURIComponent(n)+"="+encodeURIComponent(e));else null===e&&t.push(encodeURIComponent(n))}function o(e){for(var t,n,r={},i=e.split("&"),s=0,o=i.length;s=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&&500<=t.status&&501!=t.status)return!0;if(e){if(e.code&&~s.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 i=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(n,r){i.end(function(e,t){e?r(e):n(t)})})}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):200<=e.status&&e.status<300)},r.prototype.getHeader=r.prototype.get=function(e){return this._header[e.toLowerCase()]},r.prototype.set=function(e,t){if(i(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)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()"),i(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)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._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 null==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=i(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&&i(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)||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+=(0<=this.url.indexOf("?")?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(0<=t){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";e.exports=function(e){return null!==e&&"object"==typeof e}},function(e,t,n){"use strict";function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}var i=n(48);(e.exports=r).prototype.get=function(e){return this.header[e.toLowerCase()]},r.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=i.type(t);var n=i.params(t);for(var r in n)this[r]=n[r];this.links={};try{e.link&&(this.links=i.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(t){this._defaults.forEach(function(e){t[e.fn].apply(t,e.arguments)})},e.exports=n}],n.c=i,n.p="",n(0);function n(e){if(i[e])return i[e].exports;var t=i[e]={exports:{},id:e,loaded:!1};return r[e].call(t.exports,t,t.exports,n),t.loaded=!0,t.exports}var r,i},e.exports=r()},function(e,t,n){var c=n(3),l=Object.prototype.hasOwnProperty,i=Array.prototype.splice,r=Object.prototype.toString,h=function(e){return r.call(e).slice(8,-1)},s=Object.assign||function(t,n){return f(n).forEach(function(e){l.call(n,e)&&(t[e]=n[e])}),t},f="function"==typeof Object.getOwnPropertySymbols?function(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.keys(e)};function p(e){if(Array.isArray(e))return s(e.constructor(e.length),e);if("Map"===h(e))return new Map(e);if("Set"===h(e))return new Set(e);if(e&&"object"==typeof e){var t=Object.getPrototypeOf(e);return s(Object.create(t),e)}return e}function o(){var a=s({},d);return u.extend=function(e,t){a[e]=t},u.isEquals=function(e,t){return e===t},u;function u(i,s){"function"==typeof s&&(s={$apply:s}),Array.isArray(i)&&Array.isArray(s)||c(!Array.isArray(s),"update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."),c("object"==typeof s&&null!==s,"update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the following commands: %s.",Object.keys(a).join(", "));var o=i;return f(s).forEach(function(e){if(l.call(a,e)){var t=i===o;o=a[e](s[e],o,s,i),t&&u.isEquals(o,i)&&(o=i)}else{var n="Map"===h(i)?u(i.get(e),s[e]):u(i[e],s[e]),r="Map"===h(o)?o.get(e):o[e];u.isEquals(n,r)&&(void 0!==n||l.call(i,e))||(o===i&&(o=p(i)),"Map"===h(o)?o.set(e,n):o[e]=n)}}),o}}var d={$push:function(e,t,n){return u(t,n,"$push"),e.length?t.concat(e):t},$unshift:function(e,t,n){return u(t,n,"$unshift"),e.length?e.concat(t):t},$splice:function(e,t,n,r){return function(e,t){c(Array.isArray(e),"Expected $splice target to be an array; got %s",e),g(t.$splice)}(t,n),e.forEach(function(e){g(e),t===r&&e.length&&(t=p(r)),i.apply(t,e)}),t},$set:function(e,t,n){return function(e){c(1===Object.keys(e).length,"Cannot have more than one key in an object with $set")}(n),e},$toggle:function(e,t){y(e,"$toggle");var n=e.length?p(t):t;return e.forEach(function(e){n[e]=!t[e]}),n},$unset:function(e,t,n,r){return y(e,"$unset"),e.forEach(function(e){Object.hasOwnProperty.call(t,e)&&(t===r&&(t=p(r)),delete t[e])}),t},$add:function(e,r,t,i){return b(r,"$add"),y(e,"$add"),"Map"===h(r)?e.forEach(function(e){var t=e[0],n=e[1];r===i&&r.get(t)!==n&&(r=p(i)),r.set(t,n)}):e.forEach(function(e){r!==i||r.has(e)||(r=p(i)),r.add(e)}),r},$remove:function(e,t,n,r){return b(t,"$remove"),y(e,"$remove"),e.forEach(function(e){t===r&&t.has(e)&&(t=p(r)),t.delete(e)}),t},$merge:function(t,n,e,r){return function(e,t){c(t&&"object"==typeof t,"update(): $merge expects a spec of type 'object'; got %s",t),c(e&&"object"==typeof e,"update(): $merge expects a target of type 'object'; got %s",e)}(n,t),f(t).forEach(function(e){t[e]!==n[e]&&(n===r&&(n=p(r)),n[e]=t[e])}),n},$apply:function(e,t){return function(e){c("function"==typeof e,"update(): expected spec of $apply to be a function; got %s.",e)}(e),e(t)}},a=o();function u(e,t,n){c(Array.isArray(e),"update(): expected target of %s to be an array; got %s.",n,e),y(t[n],n)}function y(e,t){c(Array.isArray(e),"update(): expected spec of %s to be an array; got %s. Did you forget to wrap your parameter in an array?",t,e)}function g(e){c(Array.isArray(e),"update(): expected spec of $splice to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?",e)}function b(e,t){var n=h(e);c("Map"===n||"Set"===n,"update(): %s expects a target of type Set or Map; got %s",t,n)}e.exports=a,e.exports.default=a,e.exports.newContext=o},function(e,t,n){(function(h){"use strict";e.exports=function(e,t,n,r,i,s,o,a){if("production"!==h.env.NODE_ENV&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,s,o,a],l=0;(u=new Error(t.replace(/%s/g,function(){return c[l++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}}}).call(t,n(4))},function(e,t){var n,r,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&p())}function p(){if(!l){var e=a(f);l=!0;for(var t=c.length;t;){for(u=c,c=[];++hi&&(r=r.slice(r.length-i)),e._component.setState(function(e){return{pn_messages:(0,s.default)(e.pn_messages,o({},t,{$set:r}))}}),e._broadcast.emit("message",t,n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPresence=function(e,t){var n=this;this._broadcast.presence(e,t),function(e,t){if(e._component.state.pn_presence[t])return;e._component.setState(function(e){return{pn_presence:(0,s.default)(e.pn_presence,{$merge:o({},t,{})})}})}(this,e),this._listener.presence||(this._listener.presence=function(e){e.subscription&&n._broadcast.isSubscribe("presence",e.subscription)&&a(n,e.subscription,e),e.channel&&n._broadcast.isSubscribe("presence",e.channel)&&a(n,e.channel,e)});return this._component.state&&this._component.state.pn_presence?this._component.state.pn_presence[e]:{}};var r,i=n(2),s=(r=i)&&r.__esModule?r:{default:r};function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t,n){e._component.setState(function(e){return{pn_presence:(0,s.default)(e.pn_presence,o({},t,{$set:n}))}}),e._broadcast.emit("presence",n.channel,n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getStatus=function(e){var n=this;this._broadcast.status(e),this._listener.status||(this._listener.status=function(t){if(!n._broadcast.isSubscribe("status"))return!0;n._component.setState(function(e){return{pn_status:(0,s.default)(e.pn_status,{$set:t})}}),n._broadcast.emitStatus(t)});return this._component.state&&this._component.state.pn_status?this._component.state.pn_status:{}};var r,i=n(2),s=(r=i)&&r.__esModule?r:{default:r}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clean=function(t){this._broadcast.isSubscribe("message",t)&&this._component.setState(function(e){return{pn_messages:(0,s.default)(e.pn_messages,o({},t,{$set:[]}))}});this._broadcast.isSubscribe("presence",t)&&this._component.setState(function(e){return{pn_presence:(0,s.default)(e.pn_presence,o({},t,{$set:[]}))}})};var r,i=n(2),s=(r=i)&&r.__esModule?r:{default:r};function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.release=function(e){if(this._broadcast.isSubscribe("message",e)){var t=this._component.state.pn_messages;delete t[e],this._component.setState({pn_messages:t})}if(this._broadcast.isSubscribe("presence",e)){var n=this._component.state.pn_presence;delete n[e],this._component.setState({pn_presence:n})}this._broadcast.unsubscribe(e)}}],n.c=i,n.p="",n(0);function n(e){if(i[e])return i[e].exports;var t=i[e]={exports:{},id:e,loaded:!1};return r[e].call(t.exports,t,t.exports,n),t.loaded=!0,t.exports}var r,i}); \ No newline at end of file diff --git a/dist/stats.json b/dist/stats.json deleted file mode 100644 index dacc096..0000000 --- a/dist/stats.json +++ /dev/null @@ -1 +0,0 @@ -{"errors":[],"warnings":[],"version":"1.15.0","hash":"c81f0ac245adb1774e36","publicPath":"","assetsByChunkName":{"main":"pubnub-react.js"},"assets":[{"name":"pubnub-react.js","size":131925,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":128126,"names":["main"],"files":["pubnub-react.js"],"hash":"c53fe2ce89ac1dcf74f3","parents":[],"modules":[],"filteredModules":15,"origins":[{"moduleId":0,"module":"/Users/david.lin/code/sdk/react/node_modules/babel-loader/lib/index.js!/Users/david.lin/code/sdk/react/src/pubnub-react.js","moduleIdentifier":"/Users/david.lin/code/sdk/react/node_modules/babel-loader/lib/index.js!/Users/david.lin/code/sdk/react/src/pubnub-react.js","moduleName":"./src/pubnub-react.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":15,"children":[]} \ No newline at end of file diff --git a/lib/autoload.js b/lib/autoload.js deleted file mode 100644 index 13f1d09..0000000 --- a/lib/autoload.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _immutabilityHelper = require('immutability-helper'); - -var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _class = function () { - function _class() { - _classCallCheck(this, _class); - - this.count = {}; - this.instance = undefined; - } - - _createClass(_class, [{ - key: 'initialize', - value: function initialize(instance) { - this.instance = instance; - } - }, { - key: 'enableLoad', - value: function enableLoad(args) { - var _this = this; - - if (this.instance && args.autoload && typeof args.autoload === 'number') { - this.count[args.channels] = args.autoload; - - args.channels.forEach(function (channel) { - _this.count[channel] = args.autoload; - }); - } - } - }, { - key: 'getHistory', - value: function getHistory(channel, callback) { - var _this2 = this; - - if (this.count[channel]) { - this.instance.history({ channel: channel, count: this.count[channel] }).then(function (response) { - response.messages.forEach(function (m) { - m.message = m.entry; - m.channel = channel; - - _this2.instance._component.setState(function (prevState) { - return { - pn_messages: (0, _immutabilityHelper2.default)(prevState.pn_messages, _defineProperty({}, channel, { $push: [m] })) - }; - }); - }); - - if (callback) { - callback(); - } - }).catch(function () {}); - } - } - }, { - key: 'disableLoad', - value: function disableLoad(args) { - var _this3 = this; - - if (Array.isArray(args.channels)) { - args.channels.forEach(function (ch) { - if (_this3.count[ch]) delete _this3.count[ch]; - }); - } else if (this.count[args.channels]) { - delete this.count[args.channels]; - } - } - }]); - - return _class; -}(); - -exports.default = _class; -module.exports = exports['default']; -//# sourceMappingURL=autoload.js.map diff --git a/lib/autoload.js.map b/lib/autoload.js.map deleted file mode 100644 index 27f64da..0000000 --- a/lib/autoload.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["autoload.js"],"names":["count","instance","undefined","args","autoload","channels","forEach","channel","callback","history","then","response","messages","m","message","entry","_component","setState","pn_messages","prevState","$push","catch","Array","isArray","ch"],"mappings":";;;;;;;;AAAA;;;;;;;;;;;AAGE,oBAAc;AAAA;;AACZ,SAAKA,KAAL,GAAa,EAAb;AACA,SAAKC,QAAL,GAAgBC,SAAhB;AACD;;;;+BAOUD,Q,EAAU;AACnB,WAAKA,QAAL,GAAgBA,QAAhB;AACD;;;+BAOUE,I,EAAM;AAAA;;AACf,UAAI,KAAKF,QAAL,IAAiBE,KAAKC,QAAtB,IAAkC,OAAOD,KAAKC,QAAZ,KAAyB,QAA/D,EAAyE;AACvE,aAAKJ,KAAL,CAAWG,KAAKE,QAAhB,IAA4BF,KAAKC,QAAjC;;AAEAD,aAAKE,QAAL,CAAcC,OAAd,CAAsB,UAACC,OAAD,EAAa;AACjC,gBAAKP,KAAL,CAAWO,OAAX,IAAsBJ,KAAKC,QAA3B;AACD,SAFD;AAGD;AACF;;;+BAQUG,O,EAASC,Q,EAAU;AAAA;;AAC5B,UAAI,KAAKR,KAAL,CAAWO,OAAX,CAAJ,EAAyB;AACvB,aAAKN,QAAL,CAAcQ,OAAd,CAAsB,EAAEF,SAASA,OAAX,EAAoBP,OAAO,KAAKA,KAAL,CAAWO,OAAX,CAA3B,EAAtB,EAAwEG,IAAxE,CAA6E,UAACC,QAAD,EAAc;AACzFA,mBAASC,QAAT,CAAkBN,OAAlB,CAA0B,UAACO,CAAD,EAAO;AAC/BA,cAAEC,OAAF,GAAYD,EAAEE,KAAd;AACAF,cAAEN,OAAF,GAAYA,OAAZ;;AAEA,mBAAKN,QAAL,CAAce,UAAd,CAAyBC,QAAzB,CAAkC;AAAA,qBAAc;AAC9CC,6BAAa,kCAAOC,UAAUD,WAAjB,sBAAiCX,OAAjC,EAA2C,EAAEa,OAAO,CAACP,CAAD,CAAT,EAA3C;AADiC,eAAd;AAAA,aAAlC;AAGD,WAPD;;AASA,cAAIL,QAAJ,EAAc;AACZA;AACD;AACF,SAbD,EAaGa,KAbH,CAaS,YAAM,CAAE,CAbjB;AAcD;AACF;;;gCAOWlB,I,EAAM;AAAA;;AAChB,UAAImB,MAAMC,OAAN,CAAcpB,KAAKE,QAAnB,CAAJ,EAAkC;AAChCF,aAAKE,QAAL,CAAcC,OAAd,CAAsB,UAACkB,EAAD,EAAQ;AAC5B,cAAI,OAAKxB,KAAL,CAAWwB,EAAX,CAAJ,EAAoB,OAAO,OAAKxB,KAAL,CAAWwB,EAAX,CAAP;AACrB,SAFD;AAGD,OAJD,MAIO,IAAI,KAAKxB,KAAL,CAAWG,KAAKE,QAAhB,CAAJ,EAA+B;AACpC,eAAO,KAAKL,KAAL,CAAWG,KAAKE,QAAhB,CAAP;AACD;AACF","file":"autoload.js","sourcesContent":["import update from 'immutability-helper';\n\nexport default class {\n constructor() {\n this.count = {};\n this.instance = undefined;\n }\n\n /**\n * Initialize the autoload with a wrapper instance\n *\n * @param instance\n */\n initialize(instance) {\n this.instance = instance;\n }\n\n /**\n * Enable the autoload for a channel or a set of channels subscribed\n *\n * @param args\n */\n enableLoad(args) {\n if (this.instance && args.autoload && typeof args.autoload === 'number') {\n this.count[args.channels] = args.autoload;\n\n args.channels.forEach((channel) => {\n this.count[channel] = args.autoload;\n });\n }\n }\n\n /**\n * Get history of a channel or a set of channels.\n *\n * @param {string|[string]} channel\n * @param callback\n */\n getHistory(channel, callback) {\n if (this.count[channel]) {\n this.instance.history({ channel: channel, count: this.count[channel] }).then((response) => {\n response.messages.forEach((m) => {\n m.message = m.entry;\n m.channel = channel;\n\n this.instance._component.setState(prevState => ({\n pn_messages: update(prevState.pn_messages, { [channel]: { $push: [m] } })\n }));\n });\n\n if (callback) {\n callback();\n }\n }).catch(() => {});\n }\n }\n\n /**\n * Disable the autoload for a channel or set of channels\n *\n * @param args\n */\n disableLoad(args) {\n if (Array.isArray(args.channels)) {\n args.channels.forEach((ch) => {\n if (this.count[ch]) delete this.count[ch];\n });\n } else if (this.count[args.channels]) {\n delete this.count[args.channels];\n }\n }\n}\n"]} \ No newline at end of file diff --git a/lib/broadcast.js b/lib/broadcast.js deleted file mode 100644 index 9953593..0000000 --- a/lib/broadcast.js +++ /dev/null @@ -1,114 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Broadcast = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _config = require('../config.json'); - -var _config2 = _interopRequireDefault(_config); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function subscribeChannel(event, channel, callback) { - if (!event[channel]) { - event[channel] = callback || {}; - } else if (event[channel] === {} && callback) { - event[channel] = callback; - } -} - -function unsubscribeChannel(event, channel) { - if (event[channel]) { - delete event[channel]; - } -} - -var Broadcast = exports.Broadcast = function () { - function Broadcast() { - _classCallCheck(this, Broadcast); - - this._message = {}; - this._presence = {}; - this._status = null; - } - - _createClass(Broadcast, [{ - key: 'message', - value: function message(channel, callback) { - subscribeChannel(this._message, channel, callback); - } - }, { - key: 'presence', - value: function presence(channel, callback) { - subscribeChannel(this._presence, channel, callback); - } - }, { - key: 'status', - value: function status(callback) { - if (!this._status) { - this._status = callback || {}; - } else if (this._status === {} && callback) { - this._status = callback; - } - } - }, { - key: 'isSubscribe', - value: function isSubscribe(event, channel) { - var subscriber = '_' + event; - - if (subscriber === '_status') { - return this[subscriber]; - } else { - return this[subscriber] && this[subscriber][channel]; - } - } - }, { - key: 'emit', - value: function emit(event, channel, args) { - var subscriber = '_' + event; - - if (this[subscriber] && this[subscriber][channel] && typeof this[subscriber][channel] === 'function') { - this[subscriber][channel].call(null, args); - } - } - }, { - key: 'emitStatus', - value: function emitStatus(args) { - if (this._status && typeof this._status === 'function') { - this._status.call(null, args); - } - } - }, { - key: 'error', - value: function error(callback) { - this._error = callback; - } - }, { - key: 'emitError', - value: function emitError(args) { - if (this._error) { - this._error.call(null, args); - } - } - }, { - key: 'unsubscribe', - value: function unsubscribe(channel) { - var _this = this; - - _config2.default.subscribe_listener_events_to_broadcast.forEach(function (event) { - var subscriber = '_' + event; - - unsubscribeChannel(_this[subscriber], channel); - }); - } - }]); - - return Broadcast; -}(); -//# sourceMappingURL=broadcast.js.map diff --git a/lib/broadcast.js.map b/lib/broadcast.js.map deleted file mode 100644 index 4a84da9..0000000 --- a/lib/broadcast.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["broadcast.js"],"names":["subscribeChannel","event","channel","callback","unsubscribeChannel","Broadcast","_message","_presence","_status","subscriber","args","call","_error","config","subscribe_listener_events_to_broadcast","forEach"],"mappings":";;;;;;;;;AAAA;;;;;;;;AASA,SAASA,gBAAT,CAA0BC,KAA1B,EAAiCC,OAAjC,EAA0CC,QAA1C,EAAoD;AAClD,MAAI,CAACF,MAAMC,OAAN,CAAL,EAAqB;AACnBD,UAAMC,OAAN,IAAiBC,YAAY,EAA7B;AACD,GAFD,MAEO,IAAIF,MAAMC,OAAN,MAAmB,EAAnB,IAAyBC,QAA7B,EAAuC;AAC5CF,UAAMC,OAAN,IAAiBC,QAAjB;AACD;AACF;;AAQD,SAASC,kBAAT,CAA4BH,KAA5B,EAAmCC,OAAnC,EAA4C;AAC1C,MAAID,MAAMC,OAAN,CAAJ,EAAoB;AAClB,WAAOD,MAAMC,OAAN,CAAP;AACD;AACF;;IAEYG,S,WAAAA,S;AACX,uBAAc;AAAA;;AACZ,SAAKC,QAAL,GAAgB,EAAhB;AACA,SAAKC,SAAL,GAAiB,EAAjB;AACA,SAAKC,OAAL,GAAe,IAAf;AACD;;;;4BAQON,O,EAASC,Q,EAAU;AACzBH,uBAAiB,KAAKM,QAAtB,EAAgCJ,OAAhC,EAAyCC,QAAzC;AACD;;;6BAQQD,O,EAASC,Q,EAAU;AAC1BH,uBAAiB,KAAKO,SAAtB,EAAiCL,OAAjC,EAA0CC,QAA1C;AACD;;;2BAOMA,Q,EAAU;AACf,UAAI,CAAC,KAAKK,OAAV,EAAmB;AACjB,aAAKA,OAAL,GAAeL,YAAY,EAA3B;AACD,OAFD,MAEO,IAAI,KAAKK,OAAL,KAAiB,EAAjB,IAAuBL,QAA3B,EAAqC;AAC1C,aAAKK,OAAL,GAAeL,QAAf;AACD;AACF;;;gCASWF,K,EAAOC,O,EAAS;AAC1B,UAAIO,mBAAiBR,KAArB;;AAEA,UAAIQ,eAAe,SAAnB,EAA8B;AAC5B,eAAO,KAAKA,UAAL,CAAP;AACD,OAFD,MAEO;AACL,eAAQ,KAAKA,UAAL,KAAoB,KAAKA,UAAL,EAAiBP,OAAjB,CAA5B;AACD;AACF;;;yBASID,K,EAAOC,O,EAASQ,I,EAAM;AACzB,UAAID,mBAAiBR,KAArB;;AAEA,UAAI,KAAKQ,UAAL,KAAoB,KAAKA,UAAL,EAAiBP,OAAjB,CAApB,IAAiD,OAAO,KAAKO,UAAL,EAAiBP,OAAjB,CAAP,KAAqC,UAA1F,EAAsG;AACpG,aAAKO,UAAL,EAAiBP,OAAjB,EAA0BS,IAA1B,CAA+B,IAA/B,EAAqCD,IAArC;AACD;AACF;;;+BAOUA,I,EAAM;AACf,UAAI,KAAKF,OAAL,IAAgB,OAAO,KAAKA,OAAZ,KAAwB,UAA5C,EAAwD;AACtD,aAAKA,OAAL,CAAaG,IAAb,CAAkB,IAAlB,EAAwBD,IAAxB;AACD;AACF;;;0BAOKP,Q,EAAU;AACd,WAAKS,MAAL,GAAcT,QAAd;AACD;;;8BAOSO,I,EAAM;AACd,UAAI,KAAKE,MAAT,EAAiB;AACf,aAAKA,MAAL,CAAYD,IAAZ,CAAiB,IAAjB,EAAuBD,IAAvB;AACD;AACF;;;gCAOWR,O,EAAS;AAAA;;AACnBW,uBAAOC,sCAAP,CAA8CC,OAA9C,CAAsD,UAACd,KAAD,EAAW;AAC/D,YAAIQ,mBAAiBR,KAArB;;AAEAG,2BAAmB,MAAKK,UAAL,CAAnB,EAAqCP,OAArC;AACD,OAJD;AAKD","file":"broadcast.js","sourcesContent":["import config from '../config.json';\n\n/**\n * Subscribe a channel to a trigger event\n *\n * @param {string} event - (message, presence, status)\n * @param {string|[string]} channel\n * @param {function} callback to execute.\n */\nfunction subscribeChannel(event, channel, callback) {\n if (!event[channel]) {\n event[channel] = callback || {};\n } else if (event[channel] === {} && callback) {\n event[channel] = callback;\n }\n}\n\n/**\n * Unsubscribe a channel of a trigger event\n *\n * @param {string} event - (message, presence, status)\n * @param {string|[string]} channel\n */\nfunction unsubscribeChannel(event, channel) {\n if (event[channel]) {\n delete event[channel];\n }\n}\n\nexport class Broadcast {\n constructor() {\n this._message = {};\n this._presence = {};\n this._status = null;\n }\n\n /**\n * Subscribe a callback to a channel through the message event\n *\n * @param {string} channel\n * @param {function} callback\n */\n message(channel, callback) {\n subscribeChannel(this._message, channel, callback);\n }\n\n /**\n * Subscribe a callback to a channel through the presence event\n *\n * @param {string} channel\n * @param {function} callback\n */\n presence(channel, callback) {\n subscribeChannel(this._presence, channel, callback);\n }\n\n /**\n * Subscribe a callback through the status event\n *\n * @param callback\n */\n status(callback) {\n if (!this._status) {\n this._status = callback || {};\n } else if (this._status === {} && callback) {\n this._status = callback;\n }\n }\n\n /**\n * Validate if a channel is subscribe to an event\n *\n * @param {string} event\n * @param {string} channel\n * @returns {boolean}\n */\n isSubscribe(event, channel) {\n let subscriber = `_${event}`;\n\n if (subscriber === '_status') {\n return this[subscriber];\n } else {\n return (this[subscriber] && this[subscriber][channel]);\n }\n }\n\n /**\n * Emit a message to a channel through an event\n *\n * @param {string} event - (message, presence)\n * @param {string} channel\n * @param {object} args\n */\n emit(event, channel, args) {\n let subscriber = `_${event}`;\n\n if (this[subscriber] && this[subscriber][channel] && typeof this[subscriber][channel] === 'function') {\n this[subscriber][channel].call(null, args);\n }\n }\n\n /**\n * Emit the status event through the callback subscribed\n *\n * @param {object} args\n */\n emitStatus(args) {\n if (this._status && typeof this._status === 'function') {\n this._status.call(null, args);\n }\n }\n\n /**\n * Subscribe or unsubscribe for catching errors from trigger events\n *\n * @param {function|null} callback\n */\n error(callback) {\n this._error = callback;\n }\n\n /**\n * Emit an error to the callback subscribed\n *\n * @param {object} args\n */\n emitError(args) {\n if (this._error) {\n this._error.call(null, args);\n }\n }\n\n /**\n * Unsubscribe a channel of all events\n *\n * @param {string} channel\n */\n unsubscribe(channel) {\n config.subscribe_listener_events_to_broadcast.forEach((event) => {\n let subscriber = `_${event}`;\n\n unsubscribeChannel(this[subscriber], channel);\n });\n }\n}\n"]} \ No newline at end of file diff --git a/lib/modules/clean.js b/lib/modules/clean.js deleted file mode 100644 index e7352c0..0000000 --- a/lib/modules/clean.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.clean = clean; - -var _immutabilityHelper = require('immutability-helper'); - -var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function clean(channel) { - if (this._broadcast.isSubscribe('message', channel)) { - this._component.setState(function (prevState) { - return { - pn_messages: (0, _immutabilityHelper2.default)(prevState.pn_messages, _defineProperty({}, channel, { $set: [] })) - }; - }); - } - - if (this._broadcast.isSubscribe('presence', channel)) { - this._component.setState(function (prevState) { - return { - pn_presence: (0, _immutabilityHelper2.default)(prevState.pn_presence, _defineProperty({}, channel, { $set: [] })) - }; - }); - } -} -//# sourceMappingURL=clean.js.map diff --git a/lib/modules/clean.js.map b/lib/modules/clean.js.map deleted file mode 100644 index 29def5f..0000000 --- a/lib/modules/clean.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["modules/clean.js"],"names":["clean","channel","_broadcast","isSubscribe","_component","setState","pn_messages","prevState","$set","pn_presence"],"mappings":";;;;;QAOgBA,K,GAAAA,K;;AAPhB;;;;;;;;AAOO,SAASA,KAAT,CAAeC,OAAf,EAAwB;AAC7B,MAAI,KAAKC,UAAL,CAAgBC,WAAhB,CAA4B,SAA5B,EAAuCF,OAAvC,CAAJ,EAAqD;AACnD,SAAKG,UAAL,CAAgBC,QAAhB,CAAyB;AAAA,aAAc;AACrCC,qBAAa,kCAAOC,UAAUD,WAAjB,sBAAiCL,OAAjC,EAA2C,EAAEO,MAAM,EAAR,EAA3C;AADwB,OAAd;AAAA,KAAzB;AAGD;;AAED,MAAI,KAAKN,UAAL,CAAgBC,WAAhB,CAA4B,UAA5B,EAAwCF,OAAxC,CAAJ,EAAsD;AACpD,SAAKG,UAAL,CAAgBC,QAAhB,CAAyB;AAAA,aAAc;AACrCI,qBAAa,kCAAOF,UAAUE,WAAjB,sBAAiCR,OAAjC,EAA2C,EAAEO,MAAM,EAAR,EAA3C;AADwB,OAAd;AAAA,KAAzB;AAGD;AACF","file":"clean.js","sourcesContent":["import update from 'immutability-helper';\n\n/**\n * Clean the stack of messages for a channel or a set of channels\n *\n * @param {string|[string]} channel\n */\nexport function clean(channel) {\n if (this._broadcast.isSubscribe('message', channel)) {\n this._component.setState(prevState => ({\n pn_messages: update(prevState.pn_messages, { [channel]: { $set: [] } })\n }));\n }\n\n if (this._broadcast.isSubscribe('presence', channel)) {\n this._component.setState(prevState => ({\n pn_presence: update(prevState.pn_presence, { [channel]: { $set: [] } })\n }));\n }\n}\n"]} \ No newline at end of file diff --git a/lib/modules/getMessage.js b/lib/modules/getMessage.js deleted file mode 100644 index d1378ad..0000000 --- a/lib/modules/getMessage.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getMessage = getMessage; - -var _immutabilityHelper = require('immutability-helper'); - -var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function init(component, channel) { - if (component.state.pn_messages[channel]) { - return false; - } else { - component.setState(function (prevState) { - return { - pn_messages: (0, _immutabilityHelper2.default)(prevState.pn_messages, { $merge: _defineProperty({}, channel, []) }) - }; - }); - - return true; - } -} - -function emit(instance, channel, message) { - var messages = instance._component.state.pn_messages[channel]; - var keepMessages = instance._keepMessages[channel]; - - messages.push(message); - - if (keepMessages && messages.length > keepMessages) { - messages = messages.slice(messages.length - keepMessages); - } - - instance._component.setState(function (prevState) { - return { - pn_messages: (0, _immutabilityHelper2.default)(prevState.pn_messages, _defineProperty({}, channel, { $set: messages })) - }; - }); - - instance._broadcast.emit('message', channel, message); -} - -function getMessage(channel) { - var _this = this; - - var component = this._component; - var callback = void 0; - var keepMessages = 100; - - if (arguments.length === 2 && typeof arguments[1] === 'function') { - callback = arguments[1]; - } else if (arguments.length === 2 && typeof arguments[1] === 'number') { - keepMessages = arguments[1]; - } else if (arguments.length === 3) { - callback = arguments[1]; - keepMessages = arguments[2]; - } - - if (init(component, channel)) { - this._keepMessages[channel] = keepMessages; - this._autoload.getHistory(channel, callback); - } - - this._broadcast.message(channel, callback); - - if (!this._listener.message) { - this._listener.message = function (message) { - if (message.subscription && _this._broadcast.isSubscribe('message', message.subscription)) { - emit(_this, message.subscription, message); - } - - if (message.channel && _this._broadcast.isSubscribe('message', message.channel)) { - emit(_this, message.channel, message); - } - }; - } - - if (component.state && component.state.pn_messages && component.state.pn_messages[channel]) { - return component.state.pn_messages[channel]; - } else { - return []; - } -} -//# sourceMappingURL=getMessage.js.map diff --git a/lib/modules/getMessage.js.map b/lib/modules/getMessage.js.map deleted file mode 100644 index a3d3e7b..0000000 --- a/lib/modules/getMessage.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["modules/getMessage.js"],"names":["getMessage","init","component","channel","state","pn_messages","setState","prevState","$merge","emit","instance","message","messages","_component","keepMessages","_keepMessages","push","length","slice","$set","_broadcast","callback","arguments","_autoload","getHistory","_listener","subscription","isSubscribe"],"mappings":";;;;;QAoDgBA,U,GAAAA,U;;AApDhB;;;;;;;;AASA,SAASC,IAAT,CAAcC,SAAd,EAAyBC,OAAzB,EAAkC;AAChC,MAAID,UAAUE,KAAV,CAAgBC,WAAhB,CAA4BF,OAA5B,CAAJ,EAA0C;AACxC,WAAO,KAAP;AACD,GAFD,MAEO;AACLD,cAAUI,QAAV,CAAmB;AAAA,aAAc;AAC/BD,qBAAa,kCAAOE,UAAUF,WAAjB,EAA8B,EAAEG,4BAAWL,OAAX,EAAqB,EAArB,CAAF,EAA9B;AADkB,OAAd;AAAA,KAAnB;;AAIA,WAAO,IAAP;AACD;AACF;;AASD,SAASM,IAAT,CAAcC,QAAd,EAAwBP,OAAxB,EAAiCQ,OAAjC,EAA0C;AACxC,MAAIC,WAAWF,SAASG,UAAT,CAAoBT,KAApB,CAA0BC,WAA1B,CAAsCF,OAAtC,CAAf;AACA,MAAIW,eAAeJ,SAASK,aAAT,CAAuBZ,OAAvB,CAAnB;;AAEAS,WAASI,IAAT,CAAcL,OAAd;;AAEA,MAAIG,gBAAgBF,SAASK,MAAT,GAAkBH,YAAtC,EAAoD;AAClDF,eAAWA,SAASM,KAAT,CAAeN,SAASK,MAAT,GAAkBH,YAAjC,CAAX;AACD;;AAEDJ,WAASG,UAAT,CAAoBP,QAApB,CAA6B;AAAA,WAAc;AACzCD,mBAAa,kCAAOE,UAAUF,WAAjB,sBAAiCF,OAAjC,EAA2C,EAAEgB,MAAMP,QAAR,EAA3C;AAD4B,KAAd;AAAA,GAA7B;;AAIAF,WAASU,UAAT,CAAoBX,IAApB,CAAyB,SAAzB,EAAoCN,OAApC,EAA6CQ,OAA7C;AACD;;AASM,SAASX,UAAT,CAAoBG,OAApB,EAA6B;AAAA;;AAClC,MAAID,YAAY,KAAKW,UAArB;AACA,MAAIQ,iBAAJ;AACA,MAAIP,eAAe,GAAnB;;AAEA,MAAIQ,UAAUL,MAAV,KAAqB,CAArB,IAA0B,OAAOK,UAAU,CAAV,CAAP,KAAwB,UAAtD,EAAkE;AAChED,eAAWC,UAAU,CAAV,CAAX;AACD,GAFD,MAEO,IAAIA,UAAUL,MAAV,KAAqB,CAArB,IAA0B,OAAOK,UAAU,CAAV,CAAP,KAAwB,QAAtD,EAAgE;AACrER,mBAAeQ,UAAU,CAAV,CAAf;AACD,GAFM,MAEA,IAAIA,UAAUL,MAAV,KAAqB,CAAzB,EAA4B;AACjCI,eAAWC,UAAU,CAAV,CAAX;AACAR,mBAAeQ,UAAU,CAAV,CAAf;AACD;;AAED,MAAIrB,KAAKC,SAAL,EAAgBC,OAAhB,CAAJ,EAA8B;AAC5B,SAAKY,aAAL,CAAmBZ,OAAnB,IAA8BW,YAA9B;AACA,SAAKS,SAAL,CAAeC,UAAf,CAA0BrB,OAA1B,EAAmCkB,QAAnC;AACD;;AAED,OAAKD,UAAL,CAAgBT,OAAhB,CAAwBR,OAAxB,EAAiCkB,QAAjC;;AAEA,MAAI,CAAC,KAAKI,SAAL,CAAed,OAApB,EAA6B;AAC3B,SAAKc,SAAL,CAAed,OAAf,GAAyB,UAACA,OAAD,EAAa;AACpC,UAAIA,QAAQe,YAAR,IAAwB,MAAKN,UAAL,CAAgBO,WAAhB,CAA4B,SAA5B,EAAuChB,QAAQe,YAA/C,CAA5B,EAA0F;AACxFjB,aAAK,KAAL,EAAWE,QAAQe,YAAnB,EAAiCf,OAAjC;AACD;;AAED,UAAIA,QAAQR,OAAR,IAAmB,MAAKiB,UAAL,CAAgBO,WAAhB,CAA4B,SAA5B,EAAuChB,QAAQR,OAA/C,CAAvB,EAAgF;AAC9EM,aAAK,KAAL,EAAWE,QAAQR,OAAnB,EAA4BQ,OAA5B;AACD;AACF,KARD;AASD;;AAED,MAAIT,UAAUE,KAAV,IAAmBF,UAAUE,KAAV,CAAgBC,WAAnC,IAAkDH,UAAUE,KAAV,CAAgBC,WAAhB,CAA4BF,OAA5B,CAAtD,EAA4F;AAC1F,WAAOD,UAAUE,KAAV,CAAgBC,WAAhB,CAA4BF,OAA5B,CAAP;AACD,GAFD,MAEO;AACL,WAAO,EAAP;AACD;AACF","file":"getMessage.js","sourcesContent":["import update from 'immutability-helper';\n\n/**\n * Add a channel to the state pn_messages\n *\n * @param {PubNubReact} instance\n * @param {string} channel\n * @returns {boolean}\n */\nfunction init(component, channel) {\n if (component.state.pn_messages[channel]) {\n return false;\n } else {\n component.setState(prevState => ({\n pn_messages: update(prevState.pn_messages, { $merge: { [channel]: [] } })\n }));\n\n return true;\n }\n}\n\n/**\n * Emit a message through a callback and update the state\n *\n * @param {PubNubReact} instance\n * @param {string} channel\n * @param {object} message\n */\nfunction emit(instance, channel, message) {\n let messages = instance._component.state.pn_messages[channel];\n let keepMessages = instance._keepMessages[channel];\n\n messages.push(message);\n\n if (keepMessages && messages.length > keepMessages) {\n messages = messages.slice(messages.length - keepMessages);\n }\n\n instance._component.setState(prevState => ({\n pn_messages: update(prevState.pn_messages, { [channel]: { $set: messages } })\n }));\n\n instance._broadcast.emit('message', channel, message);\n}\n\n/**\n * Get to receive messages from a channel through a callback\n *\n * @param {string} channel\n * @param {function} callback\n * @returns {[]}\n */\nexport function getMessage(channel) {\n let component = this._component;\n let callback;\n let keepMessages = 100;\n\n if (arguments.length === 2 && typeof arguments[1] === 'function') {\n callback = arguments[1];\n } else if (arguments.length === 2 && typeof arguments[1] === 'number') {\n keepMessages = arguments[1];\n } else if (arguments.length === 3) {\n callback = arguments[1];\n keepMessages = arguments[2];\n }\n\n if (init(component, channel)) {\n this._keepMessages[channel] = keepMessages;\n this._autoload.getHistory(channel, callback);\n }\n\n this._broadcast.message(channel, callback);\n\n if (!this._listener.message) {\n this._listener.message = (message) => {\n if (message.subscription && this._broadcast.isSubscribe('message', message.subscription)) {\n emit(this, message.subscription, message);\n }\n\n if (message.channel && this._broadcast.isSubscribe('message', message.channel)) {\n emit(this, message.channel, message);\n }\n };\n }\n\n if (component.state && component.state.pn_messages && component.state.pn_messages[channel]) {\n return component.state.pn_messages[channel];\n } else {\n return [];\n }\n}\n"]} \ No newline at end of file diff --git a/lib/modules/getPresence.js b/lib/modules/getPresence.js deleted file mode 100644 index 41ac108..0000000 --- a/lib/modules/getPresence.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getPresence = getPresence; - -var _immutabilityHelper = require('immutability-helper'); - -var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function init(instance, channel) { - if (instance._component.state.pn_presence[channel]) { - return false; - } - - instance._component.setState(function (prevState) { - return { - pn_presence: (0, _immutabilityHelper2.default)(prevState.pn_presence, { $merge: _defineProperty({}, channel, {}) }) - }; - }); - - return true; -} - -function emit(instance, channel, presence) { - instance._component.setState(function (prevState) { - return { - pn_presence: (0, _immutabilityHelper2.default)(prevState.pn_presence, _defineProperty({}, channel, { $set: presence })) - }; - }); - - instance._broadcast.emit('presence', presence.channel, presence); -} - -function getPresence(channel, callback) { - var _this = this; - - this._broadcast.presence(channel, callback); - - init(this, channel); - - if (!this._listener.presence) { - this._listener.presence = function (ps) { - if (ps.subscription && _this._broadcast.isSubscribe('presence', ps.subscription)) { - emit(_this, ps.subscription, ps); - } - - if (ps.channel && _this._broadcast.isSubscribe('presence', ps.channel)) { - emit(_this, ps.channel, ps); - } - }; - } - - if (this._component.state && this._component.state.pn_presence) { - return this._component.state.pn_presence[channel]; - } else { - return {}; - } -} -//# sourceMappingURL=getPresence.js.map diff --git a/lib/modules/getPresence.js.map b/lib/modules/getPresence.js.map deleted file mode 100644 index c4a50dc..0000000 --- a/lib/modules/getPresence.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["modules/getPresence.js"],"names":["getPresence","init","instance","channel","_component","state","pn_presence","setState","prevState","$merge","emit","presence","$set","_broadcast","callback","_listener","ps","subscription","isSubscribe"],"mappings":";;;;;QA4CgBA,W,GAAAA,W;;AA5ChB;;;;;;;;AASA,SAASC,IAAT,CAAcC,QAAd,EAAwBC,OAAxB,EAAiC;AAC/B,MAAID,SAASE,UAAT,CAAoBC,KAApB,CAA0BC,WAA1B,CAAsCH,OAAtC,CAAJ,EAAoD;AAClD,WAAO,KAAP;AACD;;AAEDD,WAASE,UAAT,CAAoBG,QAApB,CAA6B;AAAA,WAAc;AACzCD,mBAAa,kCAAOE,UAAUF,WAAjB,EAA8B,EAAEG,4BAAWN,OAAX,EAAqB,EAArB,CAAF,EAA9B;AAD4B,KAAd;AAAA,GAA7B;;AAIA,SAAO,IAAP;AACD;;AASD,SAASO,IAAT,CAAcR,QAAd,EAAwBC,OAAxB,EAAiCQ,QAAjC,EAA2C;AACzCT,WAASE,UAAT,CAAoBG,QAApB,CAA6B;AAAA,WAAc;AACzCD,mBAAa,kCAAOE,UAAUF,WAAjB,sBAAiCH,OAAjC,EAA2C,EAAES,MAAMD,QAAR,EAA3C;AAD4B,KAAd;AAAA,GAA7B;;AAIAT,WAASW,UAAT,CAAoBH,IAApB,CAAyB,UAAzB,EAAqCC,SAASR,OAA9C,EAAuDQ,QAAvD;AACD;;AAUM,SAASX,WAAT,CAAqBG,OAArB,EAA8BW,QAA9B,EAAwC;AAAA;;AAC7C,OAAKD,UAAL,CAAgBF,QAAhB,CAAyBR,OAAzB,EAAkCW,QAAlC;;AAEAb,OAAK,IAAL,EAAWE,OAAX;;AAEA,MAAI,CAAC,KAAKY,SAAL,CAAeJ,QAApB,EAA8B;AAC5B,SAAKI,SAAL,CAAeJ,QAAf,GAA0B,UAACK,EAAD,EAAQ;AAChC,UAAIA,GAAGC,YAAH,IAAmB,MAAKJ,UAAL,CAAgBK,WAAhB,CAA4B,UAA5B,EAAwCF,GAAGC,YAA3C,CAAvB,EAAiF;AAC/EP,aAAK,KAAL,EAAWM,GAAGC,YAAd,EAA4BD,EAA5B;AACD;;AAED,UAAIA,GAAGb,OAAH,IAAc,MAAKU,UAAL,CAAgBK,WAAhB,CAA4B,UAA5B,EAAwCF,GAAGb,OAA3C,CAAlB,EAAuE;AACrEO,aAAK,KAAL,EAAWM,GAAGb,OAAd,EAAuBa,EAAvB;AACD;AACF,KARD;AASD;;AAED,MAAI,KAAKZ,UAAL,CAAgBC,KAAhB,IAAyB,KAAKD,UAAL,CAAgBC,KAAhB,CAAsBC,WAAnD,EAAgE;AAC9D,WAAO,KAAKF,UAAL,CAAgBC,KAAhB,CAAsBC,WAAtB,CAAkCH,OAAlC,CAAP;AACD,GAFD,MAEO;AACL,WAAO,EAAP;AACD;AACF","file":"getPresence.js","sourcesContent":["import update from 'immutability-helper';\n\n/**\n * Add a channel to the state pn_presence\n *\n * @param {PubNubReact} instance\n * @param {string} channel\n * @returns {boolean}\n */\nfunction init(instance, channel) {\n if (instance._component.state.pn_presence[channel]) {\n return false;\n }\n\n instance._component.setState(prevState => ({\n pn_presence: update(prevState.pn_presence, { $merge: { [channel]: {} } })\n }));\n\n return true;\n}\n\n/**\n * Emit a presence information through a callback and update the state\n *\n * @param {PubNubReact} instance\n * @param {string} channel\n * @param {object} presence\n */\nfunction emit(instance, channel, presence) {\n instance._component.setState(prevState => ({\n pn_presence: update(prevState.pn_presence, { [channel]: { $set: presence } })\n }));\n\n instance._broadcast.emit('presence', presence.channel, presence);\n}\n\n\n/**\n * Get to receive presence information from a channel through a callback\n *\n * @param {string} channel\n * @param {function} callback\n * @returns {object}\n */\nexport function getPresence(channel, callback) {\n this._broadcast.presence(channel, callback);\n\n init(this, channel);\n\n if (!this._listener.presence) {\n this._listener.presence = (ps) => {\n if (ps.subscription && this._broadcast.isSubscribe('presence', ps.subscription)) {\n emit(this, ps.subscription, ps);\n }\n\n if (ps.channel && this._broadcast.isSubscribe('presence', ps.channel)) {\n emit(this, ps.channel, ps);\n }\n };\n }\n\n if (this._component.state && this._component.state.pn_presence) {\n return this._component.state.pn_presence[channel];\n } else {\n return {};\n }\n}\n"]} \ No newline at end of file diff --git a/lib/modules/getStatus.js b/lib/modules/getStatus.js deleted file mode 100644 index 32c25fc..0000000 --- a/lib/modules/getStatus.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getStatus = getStatus; - -var _immutabilityHelper = require('immutability-helper'); - -var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function getStatus(callback) { - var _this = this; - - this._broadcast.status(callback); - - if (!this._listener.status) { - this._listener.status = function (st) { - if (!_this._broadcast.isSubscribe('status')) { - return true; - } - - _this._component.setState(function (prevState) { - return { - pn_status: (0, _immutabilityHelper2.default)(prevState.pn_status, { $set: st }) - }; - }); - - _this._broadcast.emitStatus(st); - }; - } - - if (this._component.state && this._component.state.pn_status) { - return this._component.state.pn_status; - } else { - return {}; - } -} -//# sourceMappingURL=getStatus.js.map diff --git a/lib/modules/getStatus.js.map b/lib/modules/getStatus.js.map deleted file mode 100644 index f2a4935..0000000 --- a/lib/modules/getStatus.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["modules/getStatus.js"],"names":["getStatus","callback","_broadcast","status","_listener","st","isSubscribe","_component","setState","pn_status","prevState","$set","emitStatus","state"],"mappings":";;;;;QAQgBA,S,GAAAA,S;;AARhB;;;;;;AAQO,SAASA,SAAT,CAAmBC,QAAnB,EAA6B;AAAA;;AAClC,OAAKC,UAAL,CAAgBC,MAAhB,CAAuBF,QAAvB;;AAEA,MAAI,CAAC,KAAKG,SAAL,CAAeD,MAApB,EAA4B;AAC1B,SAAKC,SAAL,CAAeD,MAAf,GAAwB,UAACE,EAAD,EAAQ;AAC9B,UAAI,CAAC,MAAKH,UAAL,CAAgBI,WAAhB,CAA4B,QAA5B,CAAL,EAA4C;AAC1C,eAAO,IAAP;AACD;;AAED,YAAKC,UAAL,CAAgBC,QAAhB,CAAyB;AAAA,eAAc;AACrCC,qBAAW,kCAAOC,UAAUD,SAAjB,EAA4B,EAAEE,MAAMN,EAAR,EAA5B;AAD0B,SAAd;AAAA,OAAzB;;AAIA,YAAKH,UAAL,CAAgBU,UAAhB,CAA2BP,EAA3B;AACD,KAVD;AAWD;;AAED,MAAI,KAAKE,UAAL,CAAgBM,KAAhB,IAAyB,KAAKN,UAAL,CAAgBM,KAAhB,CAAsBJ,SAAnD,EAA8D;AAC5D,WAAO,KAAKF,UAAL,CAAgBM,KAAhB,CAAsBJ,SAA7B;AACD,GAFD,MAEO;AACL,WAAO,EAAP;AACD;AACF","file":"getStatus.js","sourcesContent":["import update from 'immutability-helper';\n\n/**\n * Get to receive status information from a channel through a callback\n *\n * @param {function} callback\n * @returns {object}\n */\nexport function getStatus(callback) {\n this._broadcast.status(callback);\n\n if (!this._listener.status) {\n this._listener.status = (st) => {\n if (!this._broadcast.isSubscribe('status')) {\n return true;\n }\n\n this._component.setState(prevState => ({\n pn_status: update(prevState.pn_status, { $set: st })\n }));\n\n this._broadcast.emitStatus(st);\n };\n }\n\n if (this._component.state && this._component.state.pn_status) {\n return this._component.state.pn_status;\n } else {\n return {};\n }\n}\n"]} \ No newline at end of file diff --git a/lib/modules/index.js b/lib/modules/index.js deleted file mode 100644 index ebadd95..0000000 --- a/lib/modules/index.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _getMessage = require('./getMessage'); - -Object.defineProperty(exports, 'getMessage', { - enumerable: true, - get: function get() { - return _getMessage.getMessage; - } -}); - -var _getPresence = require('./getPresence'); - -Object.defineProperty(exports, 'getPresence', { - enumerable: true, - get: function get() { - return _getPresence.getPresence; - } -}); - -var _getStatus = require('./getStatus'); - -Object.defineProperty(exports, 'getStatus', { - enumerable: true, - get: function get() { - return _getStatus.getStatus; - } -}); - -var _clean = require('./clean'); - -Object.defineProperty(exports, 'clean', { - enumerable: true, - get: function get() { - return _clean.clean; - } -}); - -var _release = require('./release'); - -Object.defineProperty(exports, 'release', { - enumerable: true, - get: function get() { - return _release.release; - } -}); -//# sourceMappingURL=index.js.map diff --git a/lib/modules/index.js.map b/lib/modules/index.js.map deleted file mode 100644 index 5fd1303..0000000 --- a/lib/modules/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["modules/index.js"],"names":["getMessage","getPresence","getStatus","clean","release"],"mappings":";;;;;;;;;;;uBAASA,U;;;;;;;;;wBACAC,W;;;;;;;;;sBACAC,S;;;;;;;;;kBACAC,K;;;;;;;;;oBACAC,O","file":"index.js","sourcesContent":["export { getMessage } from './getMessage';\nexport { getPresence } from './getPresence';\nexport { getStatus } from './getStatus';\nexport { clean } from './clean';\nexport { release } from './release';\n"]} \ No newline at end of file diff --git a/lib/modules/release.js b/lib/modules/release.js deleted file mode 100644 index de4f68d..0000000 --- a/lib/modules/release.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.release = release; -function release(channel) { - if (this._broadcast.isSubscribe('message', channel)) { - var pnMessages = this._component.state.pn_messages; - - delete pnMessages[channel]; - - this._component.setState({ pn_messages: pnMessages }); - } - - if (this._broadcast.isSubscribe('presence', channel)) { - var pnPresence = this._component.state.pn_presence; - - delete pnPresence[channel]; - - this._component.setState({ pn_presence: pnPresence }); - } - - this._broadcast.unsubscribe(channel); -} -//# sourceMappingURL=release.js.map diff --git a/lib/modules/release.js.map b/lib/modules/release.js.map deleted file mode 100644 index e5b5d64..0000000 --- a/lib/modules/release.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["modules/release.js"],"names":["release","channel","_broadcast","isSubscribe","pnMessages","_component","state","pn_messages","setState","pnPresence","pn_presence","unsubscribe"],"mappings":";;;;;QAKgBA,O,GAAAA,O;AAAT,SAASA,OAAT,CAAiBC,OAAjB,EAA0B;AAC/B,MAAI,KAAKC,UAAL,CAAgBC,WAAhB,CAA4B,SAA5B,EAAuCF,OAAvC,CAAJ,EAAqD;AACnD,QAAIG,aAAa,KAAKC,UAAL,CAAgBC,KAAhB,CAAsBC,WAAvC;;AAEA,WAAOH,WAAWH,OAAX,CAAP;;AAEA,SAAKI,UAAL,CAAgBG,QAAhB,CAAyB,EAAED,aAAaH,UAAf,EAAzB;AACD;;AAED,MAAI,KAAKF,UAAL,CAAgBC,WAAhB,CAA4B,UAA5B,EAAwCF,OAAxC,CAAJ,EAAsD;AACpD,QAAIQ,aAAa,KAAKJ,UAAL,CAAgBC,KAAhB,CAAsBI,WAAvC;;AAEA,WAAOD,WAAWR,OAAX,CAAP;;AAEA,SAAKI,UAAL,CAAgBG,QAAhB,CAAyB,EAAEE,aAAaD,UAAf,EAAzB;AACD;;AAED,OAAKP,UAAL,CAAgBS,WAAhB,CAA4BV,OAA5B;AACD","file":"release.js","sourcesContent":["/**\n * Release the stack of messages for a channel or a set of channels\n *\n * @param {string|[string]} channel\n */\nexport function release(channel) {\n if (this._broadcast.isSubscribe('message', channel)) {\n let pnMessages = this._component.state.pn_messages;\n\n delete pnMessages[channel];\n\n this._component.setState({ pn_messages: pnMessages });\n }\n\n if (this._broadcast.isSubscribe('presence', channel)) {\n let pnPresence = this._component.state.pn_presence;\n\n delete pnPresence[channel];\n\n this._component.setState({ pn_presence: pnPresence });\n }\n\n this._broadcast.unsubscribe(channel);\n}\n"]} \ No newline at end of file diff --git a/lib/pubnub-react.js b/lib/pubnub-react.js deleted file mode 100644 index 6a81016..0000000 --- a/lib/pubnub-react.js +++ /dev/null @@ -1,95 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _pubnub = require('pubnub'); - -var _pubnub2 = _interopRequireDefault(_pubnub); - -var _immutabilityHelper = require('immutability-helper'); - -var _immutabilityHelper2 = _interopRequireDefault(_immutabilityHelper); - -var _wrapper = require('./wrapper'); - -var _wrapper2 = _interopRequireDefault(_wrapper); - -var _autoload = require('./autoload'); - -var _autoload2 = _interopRequireDefault(_autoload); - -var _broadcast = require('./broadcast'); - -var _modules = require('./modules'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var PubNubReact = function () { - function PubNubReact(config) { - _classCallCheck(this, PubNubReact); - - var instance = new _pubnub2.default(config); - (0, _wrapper2.default)(instance, this); - - this._pubnubInstance = instance; - this._autoload = new _autoload2.default(); - } - - _createClass(PubNubReact, [{ - key: 'init', - value: function init(component) { - if (!component.state) { - component.state = { pn_messages: {}, pn_status: {}, pn_presence: {} }; - } else { - component.state = (0, _immutabilityHelper2.default)(component.state, { $merge: { pn_status: {}, pn_messages: {}, pn_presence: {} } }); - } - - this._component = component; - this._broadcast = new _broadcast.Broadcast(); - this._listener = {}; - this._keepMessages = {}; - - this.addListener(this._listener); - this._autoload.initialize(this); - - this.getPresence = _modules.getPresence.bind(this); - this.getMessage = _modules.getMessage.bind(this); - this.getStatus = _modules.getStatus.bind(this); - this.clean = _modules.clean.bind(this); - this.release = _modules.release.bind(this); - } - }, { - key: 'subscribe', - value: function subscribe(args) { - this._pubnubInstance.subscribe(args); - this._autoload.enableLoad(args); - } - }, { - key: 'unsubscribe', - value: function unsubscribe(args) { - this._pubnubInstance.unsubscribe(args); - this._autoload.disableLoad(args); - } - }, { - key: 'getOriginalInstance', - value: function getOriginalInstance() { - if (this._pubnubInstance) { - return this._pubnubInstance; - } else { - throw new ReferenceError('Pubnub default instance is not initialized yet. Invoke #init() method first.'); - } - } - }]); - - return PubNubReact; -}(); - -exports.default = PubNubReact; -module.exports = exports['default']; -//# sourceMappingURL=pubnub-react.js.map diff --git a/lib/pubnub-react.js.map b/lib/pubnub-react.js.map deleted file mode 100644 index d6f56c9..0000000 --- a/lib/pubnub-react.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["pubnub-react.js"],"names":["PubNubReact","config","instance","PubNub","_pubnubInstance","_autoload","Autoload","component","state","pn_messages","pn_status","pn_presence","$merge","_component","_broadcast","Broadcast","_listener","_keepMessages","addListener","initialize","getPresence","bind","getMessage","getStatus","clean","release","args","subscribe","enableLoad","unsubscribe","disableLoad","ReferenceError"],"mappings":";;;;;;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;AACA;;;;;;IAEqBA,W;AACnB,uBAAYC,MAAZ,EAAoB;AAAA;;AAClB,QAAIC,WAAW,IAAIC,gBAAJ,CAAWF,MAAX,CAAf;AACA,2BAAKC,QAAL,EAAe,IAAf;;AAEA,SAAKE,eAAL,GAAuBF,QAAvB;AACA,SAAKG,SAAL,GAAiB,IAAIC,kBAAJ,EAAjB;AACD;;;;yBAOIC,S,EAAW;AACd,UAAI,CAACA,UAAUC,KAAf,EAAsB;AACpBD,kBAAUC,KAAV,GAAkB,EAAEC,aAAa,EAAf,EAAmBC,WAAW,EAA9B,EAAkCC,aAAa,EAA/C,EAAlB;AACD,OAFD,MAEO;AACLJ,kBAAUC,KAAV,GAAkB,kCAAOD,UAAUC,KAAjB,EAAwB,EAAEI,QAAQ,EAAEF,WAAW,EAAb,EAAiBD,aAAa,EAA9B,EAAkCE,aAAa,EAA/C,EAAV,EAAxB,CAAlB;AACD;;AAED,WAAKE,UAAL,GAAkBN,SAAlB;AACA,WAAKO,UAAL,GAAkB,IAAIC,oBAAJ,EAAlB;AACA,WAAKC,SAAL,GAAiB,EAAjB;AACA,WAAKC,aAAL,GAAqB,EAArB;;AAEA,WAAKC,WAAL,CAAiB,KAAKF,SAAtB;AACA,WAAKX,SAAL,CAAec,UAAf,CAA0B,IAA1B;;AAEA,WAAKC,WAAL,GAAmBA,qBAAYC,IAAZ,CAAiB,IAAjB,CAAnB;AACA,WAAKC,UAAL,GAAkBA,oBAAWD,IAAX,CAAgB,IAAhB,CAAlB;AACA,WAAKE,SAAL,GAAiBA,mBAAUF,IAAV,CAAe,IAAf,CAAjB;AACA,WAAKG,KAAL,GAAaA,eAAMH,IAAN,CAAW,IAAX,CAAb;AACA,WAAKI,OAAL,GAAeA,iBAAQJ,IAAR,CAAa,IAAb,CAAf;AACD;;;8BAOSK,I,EAAM;AACd,WAAKtB,eAAL,CAAqBuB,SAArB,CAA+BD,IAA/B;AACA,WAAKrB,SAAL,CAAeuB,UAAf,CAA0BF,IAA1B;AACD;;;gCAOWA,I,EAAM;AAChB,WAAKtB,eAAL,CAAqByB,WAArB,CAAiCH,IAAjC;AACA,WAAKrB,SAAL,CAAeyB,WAAf,CAA2BJ,IAA3B;AACD;;;0CAOqB;AACpB,UAAI,KAAKtB,eAAT,EAA0B;AACxB,eAAO,KAAKA,eAAZ;AACD,OAFD,MAEO;AACL,cAAM,IAAI2B,cAAJ,CAAmB,8EAAnB,CAAN;AACD;AACF;;;;;;kBAnEkB/B,W","file":"pubnub-react.js","sourcesContent":["import PubNub from 'pubnub';\nimport update from 'immutability-helper';\nimport wrap from './wrapper';\nimport Autoload from './autoload';\nimport { Broadcast } from './broadcast';\nimport { getStatus, getMessage, getPresence, clean, release } from './modules';\n\nexport default class PubNubReact {\n constructor(config) {\n let instance = new PubNub(config);\n wrap(instance, this);\n\n this._pubnubInstance = instance;\n this._autoload = new Autoload();\n }\n\n /**\n * Set the react's states to invoke a new render process when a new real time message is received\n *\n * @param {component} args\n */\n init(component) {\n if (!component.state) {\n component.state = { pn_messages: {}, pn_status: {}, pn_presence: {} };\n } else {\n component.state = update(component.state, { $merge: { pn_status: {}, pn_messages: {}, pn_presence: {} } });\n }\n\n this._component = component;\n this._broadcast = new Broadcast();\n this._listener = {};\n this._keepMessages = {};\n\n this.addListener(this._listener);\n this._autoload.initialize(this);\n\n this.getPresence = getPresence.bind(this);\n this.getMessage = getMessage.bind(this);\n this.getStatus = getStatus.bind(this);\n this.clean = clean.bind(this);\n this.release = release.bind(this);\n }\n\n /**\n * Wrap the subscribe method to enable trigger events to the broadcast\n *\n * @param {object} args\n */\n subscribe(args) {\n this._pubnubInstance.subscribe(args);\n this._autoload.enableLoad(args);\n }\n\n /**\n * Wrap the unsubscribe method to disable the trigger events to the broadcast\n *\n * @param args\n */\n unsubscribe(args) {\n this._pubnubInstance.unsubscribe(args);\n this._autoload.disableLoad(args);\n }\n\n /**\n * Get the PubNub instance wrapped or throw an exception if this is not instanced yet\n *\n * @returns {PubNub|*|null}\n */\n getOriginalInstance() {\n if (this._pubnubInstance) {\n return this._pubnubInstance;\n } else {\n throw new ReferenceError('Pubnub default instance is not initialized yet. Invoke #init() method first.');\n }\n }\n}\n"]} \ No newline at end of file diff --git a/lib/wrapper.js b/lib/wrapper.js deleted file mode 100644 index 4d5c462..0000000 --- a/lib/wrapper.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports.default = function (originalInstance, wrappedInstance) { - _config2.default.attributes_to_delegate.forEach(function (attribute) { - wrapAttribute(originalInstance, wrappedInstance, attribute); - }); - - _config2.default.methods_to_delegate.forEach(function (method) { - wrapMethod(originalInstance, wrappedInstance, method); - }); -}; - -var _config = require('../config.json'); - -var _config2 = _interopRequireDefault(_config); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function wrapAttribute(originalInstance, wrappedInstance, attributeName) { - wrappedInstance[attributeName] = originalInstance[attributeName]; -} - -function wrapMethod(OriginalInstance, wrappedInstance, methodName) { - wrappedInstance[methodName] = function () { - return OriginalInstance[methodName].apply(wrappedInstance, arguments); - }; -} - -module.exports = exports['default']; -//# sourceMappingURL=wrapper.js.map diff --git a/lib/wrapper.js.map b/lib/wrapper.js.map deleted file mode 100644 index 152b5b5..0000000 --- a/lib/wrapper.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["wrapper.js"],"names":["originalInstance","wrappedInstance","config","attributes_to_delegate","forEach","attribute","wrapAttribute","methods_to_delegate","method","wrapMethod","attributeName","OriginalInstance","methodName","apply","arguments"],"mappings":";;;;;;kBA4Be,UAAUA,gBAAV,EAA4BC,eAA5B,EAA6C;AAC1DC,mBAAOC,sBAAP,CAA8BC,OAA9B,CAAsC,UAACC,SAAD,EAAe;AACnDC,kBAAcN,gBAAd,EAAgCC,eAAhC,EAAiDI,SAAjD;AACD,GAFD;;AAIAH,mBAAOK,mBAAP,CAA2BH,OAA3B,CAAmC,UAACI,MAAD,EAAY;AAC7CC,eAAWT,gBAAX,EAA6BC,eAA7B,EAA8CO,MAA9C;AACD,GAFD;AAGD,C;;AApCD;;;;;;AAOA,SAASF,aAAT,CAAuBN,gBAAvB,EAAyCC,eAAzC,EAA0DS,aAA1D,EAAyE;AACvET,kBAAgBS,aAAhB,IAAiCV,iBAAiBU,aAAjB,CAAjC;AACD;;AAOD,SAASD,UAAT,CAAoBE,gBAApB,EAAsCV,eAAtC,EAAuDW,UAAvD,EAAmE;AACjEX,kBAAgBW,UAAhB,IAA8B,YAAY;AACxC,WAAOD,iBAAiBC,UAAjB,EAA6BC,KAA7B,CAAmCZ,eAAnC,EAAoDa,SAApD,CAAP;AACD,GAFD;AAGD","file":"wrapper.js","sourcesContent":["import config from '../config.json';\n\n/**\n * Wrap a PubNub's attributes\n *\n * @param {string} attributeName\n */\nfunction wrapAttribute(originalInstance, wrappedInstance, attributeName) {\n wrappedInstance[attributeName] = originalInstance[attributeName];\n}\n\n/**\n * Wrap a PubNub's methods\n *\n * @param methodName\n */\nfunction wrapMethod(OriginalInstance, wrappedInstance, methodName) {\n wrappedInstance[methodName] = function () {\n return OriginalInstance[methodName].apply(wrappedInstance, arguments);\n };\n}\n\n/**\n * Wrap the PubNubReact with PubNub\n *\n * @param originalInstance\n * @param wrappedInstance\n */\nexport default function (originalInstance, wrappedInstance) {\n config.attributes_to_delegate.forEach((attribute) => {\n wrapAttribute(originalInstance, wrappedInstance, attribute);\n });\n\n config.methods_to_delegate.forEach((method) => {\n wrapMethod(originalInstance, wrappedInstance, method);\n });\n}\n"]} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index dbbc779..b5160d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pubnub-react", - "version": "1.3.0", + "version": "1.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 054abef..b770ddc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pubnub-react", - "version": "1.3.1", + "version": "1.3.2", "description": "Publish & Subscribe Real-time Messaging with PubNub", "author": "PubNub ", "scripts": {