@folklore/socket 0.4.4 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs.js +1100 -0
- package/dist/es.js +1052 -0
- package/package.json +7 -16
- package/dist/1.chunk.js +0 -1
- package/dist/2.chunk.js +0 -1
- package/dist/socket.js +0 -1
- package/es/Socket.js +0 -372
- package/es/SocketContainer.js +0 -122
- package/es/SocketContext.js +0 -7
- package/es/adapters/PubNub.js +0 -213
- package/es/adapters/SocketIO.js +0 -230
- package/es/adapters/index.js +0 -6
- package/es/index.js +0 -5
- package/es/useSocket.js +0 -96
- package/es/withSocket.js +0 -27
- package/lib/Socket.js +0 -390
- package/lib/SocketContainer.js +0 -139
- package/lib/SocketContext.js +0 -19
- package/lib/adapters/PubNub.js +0 -233
- package/lib/adapters/SocketIO.js +0 -250
- package/lib/adapters/index.js +0 -18
- package/lib/index.js +0 -53
- package/lib/useSocket.js +0 -109
- package/lib/withSocket.js +0 -39
package/dist/socket.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Socket=function(t){function e(e){for(var n,o,i=e[0],u=e[1],s=0,c=[];s<i.length;s++)o=i[s],r[o]&&c.push(r[o][0]),r[o]=0;for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(t[n]=u[n]);for(a&&a(e);c.length;)c.shift()()}var n={},r={0:0};function o(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.e=function(t){var e=[],n=r[t];if(0!==n)if(n)e.push(n[2]);else{var i=new Promise(function(e,o){n=r[t]=[e,o]});e.push(n[2]=i);var u,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(t){return o.p+""+({}[t]||t)+".chunk.js"}(t);var a=new Error;u=function(e){s.onerror=s.onload=null,clearTimeout(c);var n=r[t];if(0!==n){if(n){var o=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,n[1](a)}r[t]=void 0}};var c=setTimeout(function(){u({type:"timeout",target:s})},12e4);s.onerror=s.onload=u,document.head.appendChild(s)}return Promise.all(e)},o.m=t,o.c=n,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/",o.oe=function(t){throw console.error(t),t};var i=window.webpackJsonpSocket=window.webpackJsonpSocket||[],u=i.push.bind(i);i.push=e,i=i.slice();for(var s=0;s<i.length;s++)e(i[s]);var a=u;return o(o.s=58)}([function(t,e,n){"use strict";t.exports=n(101)},function(t,e,n){t.exports=n(102)()},function(t,e,n){var r=n(20)("wks"),o=n(15),i=n(3).Symbol,u="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=r},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){return"object"===typeof t?null!==t:"function"===typeof t}},function(t,e,n){t.exports=!n(16)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){"use strict";(function(r){function o(t){return(o="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}e.log=function(){var t;return"object"===("undefined"===typeof console?"undefined":o(console))&&console.log&&(t=console).log.apply(t,arguments)},e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(r++,"%c"===t&&(o=r))}),e.splice(o,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(n){}},e.load=function(){var t;try{t=e.storage.getItem("debug")}catch(n){}!t&&"undefined"!==typeof r&&"env"in r&&(t=Object({NODE_ENV:"production",PUBLIC_URL:""}).DEBUG);return t},e.useColors=function(){if("undefined"!==typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=n(94)(e),t.exports.formatters.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,n(51))},function(t,e){var n=t.exports={version:"2.6.9"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(3),o=n(9),i=n(12),u=n(15)("src"),s=n(65),a=(""+s).split("toString");n(7).inspectSource=function(t){return s.call(t)},(t.exports=function(t,e,n,s){var c="function"==typeof n;c&&(i(n,"name")||o(n,"name",e)),t[e]!==n&&(c&&(i(n,u)||o(n,u,t[e]?""+t[e]:a.join(String(e)))),t===r?t[e]=n:s?t[e]?t[e]=n:o(t,e,n):(delete t[e],o(t,e,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[u]||s.call(this)})},function(t,e,n){var r=n(10),o=n(21);t.exports=n(5)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(11),o=n(34),i=n(36),u=Object.defineProperty;e.f=n(5)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return u(t,e,n)}catch(s){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(4);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r;!function(e){"use strict";function o(){}var i=o.prototype,u=e.EventEmitter;function s(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function a(t){return function(){return this[t].apply(this,arguments)}}i.getListeners=function(t){var e,n,r=this._getEvents();if(t instanceof RegExp)for(n in e={},r)r.hasOwnProperty(n)&&t.test(n)&&(e[n]=r[n]);else e=r[t]||(r[t]=[]);return e},i.flattenListeners=function(t){var e,n=[];for(e=0;e<t.length;e+=1)n.push(t[e].listener);return n},i.getListenersAsObject=function(t){var e,n=this.getListeners(t);return n instanceof Array&&((e={})[t]=n),e||n},i.addListener=function(t,e){if(!function t(e){return"function"===typeof e||e instanceof RegExp||!(!e||"object"!==typeof e)&&t(e.listener)}(e))throw new TypeError("listener must be a function");var n,r=this.getListenersAsObject(t),o="object"===typeof e;for(n in r)r.hasOwnProperty(n)&&-1===s(r[n],e)&&r[n].push(o?e:{listener:e,once:!1});return this},i.on=a("addListener"),i.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},i.once=a("addOnceListener"),i.defineEvent=function(t){return this.getListeners(t),this},i.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},i.removeListener=function(t,e){var n,r,o=this.getListenersAsObject(t);for(r in o)o.hasOwnProperty(r)&&-1!==(n=s(o[r],e))&&o[r].splice(n,1);return this},i.off=a("removeListener"),i.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},i.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},i.manipulateListeners=function(t,e,n){var r,o,i=t?this.removeListener:this.addListener,u=t?this.removeListeners:this.addListeners;if("object"!==typeof e||e instanceof RegExp)for(r=n.length;r--;)i.call(this,e,n[r]);else for(r in e)e.hasOwnProperty(r)&&(o=e[r])&&("function"===typeof o?i.call(this,r,o):u.call(this,r,o));return this},i.removeEvent=function(t){var e,n=typeof t,r=this._getEvents();if("string"===n)delete r[t];else if(t instanceof RegExp)for(e in r)r.hasOwnProperty(e)&&t.test(e)&&delete r[e];else delete this._events;return this},i.removeAllListeners=a("removeEvent"),i.emitEvent=function(t,e){var n,r,o,i,u=this.getListenersAsObject(t);for(i in u)if(u.hasOwnProperty(i))for(n=u[i].slice(0),o=0;o<n.length;o++)!0===(r=n[o]).once&&this.removeListener(t,r.listener),r.listener.apply(this,e||[])===this._getOnceReturnValue()&&this.removeListener(t,r.listener);return this},i.trigger=a("emitEvent"),i.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},i.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},i._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},i._getEvents=function(){return this._events||(this._events={})},o.noConflict=function(){return e.EventEmitter=u,o},void 0===(r=function(){return o}.call(e,n,e,t))||(t.exports=r)}("undefined"!==typeof window?window:this||{})},function(t,e){t.exports={}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,n){var r=n(67);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(71),o=n(23);t.exports=function(t){return r(o(t))}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(7),o=n(3),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(33)?"pure":"global",copyright:"\xa9 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";var r=n(33),o=n(38),i=n(8),u=n(9),s=n(14),a=n(68),c=n(26),f=n(75),l=n(2)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,n,d,y,v,b){a(n,e,d);var m,g,w,O=function(t){if(!p&&t in C)return C[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},_=e+" Iterator",j="values"==y,S=!1,C=t.prototype,k=C[l]||C["@@iterator"]||y&&C[y],x=k||O(y),E=y?j?O("entries"):x:void 0,P="Array"==e&&C.entries||k;if(P&&(w=f(P.call(new t)))!==Object.prototype&&w.next&&(c(w,_,!0),r||"function"==typeof w[l]||u(w,l,h)),j&&k&&"values"!==k.name&&(S=!0,x=function(){return k.call(this)}),r&&!b||!p&&!S&&C[l]||u(C,l,x),s[e]=x,s[_]=h,y)if(m={values:j?x:O("values"),keys:v?x:O("keys"),entries:E},b)for(g in m)g in C||i(C,g,m[g]);else o(o.P+o.F*(p||S),e,m);return m}},function(t,e,n){var r=n(20)("keys"),o=n(15);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(10).f,o=n(12),i=n(2)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){var r=n(4);t.exports=function(t,e){if(!r(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},function(t,e){var n=Array.isArray;t.exports=n},function(t,e,n){"use strict";var r=n(61);function o(){}var i=null,u={};function s(t){if("object"!==typeof this)throw new TypeError("Promises must be constructed via new");if("function"!==typeof t)throw new TypeError("Promise constructor's argument is not a function");this._h=0,this._i=0,this._j=null,this._k=null,t!==o&&h(t,this)}function a(t,e){for(;3===t._i;)t=t._j;if(s._l&&s._l(t),0===t._i)return 0===t._h?(t._h=1,void(t._k=e)):1===t._h?(t._h=2,void(t._k=[t._k,e])):void t._k.push(e);!function(t,e){r(function(){var n=1===t._i?e.onFulfilled:e.onRejected;if(null!==n){var r=function(t,e){try{return t(e)}catch(n){return i=n,u}}(n,t._j);r===u?f(e.promise,i):c(e.promise,r)}else 1===t._i?c(e.promise,t._j):f(e.promise,t._j)})}(t,e)}function c(t,e){if(e===t)return f(t,new TypeError("A promise cannot be resolved with itself."));if(e&&("object"===typeof e||"function"===typeof e)){var n=function(t){try{return t.then}catch(e){return i=e,u}}(e);if(n===u)return f(t,i);if(n===t.then&&e instanceof s)return t._i=3,t._j=e,void l(t);if("function"===typeof n)return void h(n.bind(e),t)}t._i=1,t._j=e,l(t)}function f(t,e){t._i=2,t._j=e,s._m&&s._m(t,e),l(t)}function l(t){if(1===t._h&&(a(t,t._k),t._k=null),2===t._h){for(var e=0;e<t._k.length;e++)a(t,t._k[e]);t._k=null}}function p(t,e,n){this.onFulfilled="function"===typeof t?t:null,this.onRejected="function"===typeof e?e:null,this.promise=n}function h(t,e){var n=!1,r=function(t,e,n){try{t(e,n)}catch(r){return i=r,u}}(t,function(t){n||(n=!0,c(e,t))},function(t){n||(n=!0,f(e,t))});n||r!==u||(n=!0,f(e,i))}t.exports=s,s._l=null,s._m=null,s._n=o,s.prototype.then=function(t,e){if(this.constructor!==s)return function(t,e,n){return new t.constructor(function(r,i){var u=new s(o);u.then(r,i),a(t,new p(e,n,u))})}(this,t,e);var n=new s(o);return a(this,new p(t,e,n)),n}},function(t,e,n){"use strict";var r=n(31),o={};o[n(2)("toStringTag")]="z",o+""!="[object z]"&&n(8)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(t,e,n){var r=n(32),o=n(2)("toStringTag"),i="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,u;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(n){}}(e=Object(t),o))?n:i?r(e):"Object"==(u=r(e))&&"function"==typeof e.callee?"Arguments":u}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=!1},function(t,e,n){t.exports=!n(5)&&!n(16)(function(){return 7!=Object.defineProperty(n(35)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(4),o=n(3).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(4);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){"use strict";var r=n(66)(!0);n(24)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){var r=n(3),o=n(7),i=n(9),u=n(8),s=n(17),a=function t(e,n,a){var c,f,l,p,h=e&t.F,d=e&t.G,y=e&t.P,v=e&t.B,b=d?r:e&t.S?r[n]||(r[n]={}):(r[n]||{}).prototype,m=d?o:o[n]||(o[n]={}),g=m.prototype||(m.prototype={});for(c in d&&(a=n),a)l=((f=!h&&b&&void 0!==b[c])?b:a)[c],p=v&&f?s(l,r):y&&"function"==typeof l?s(Function.call,l):l,b&&u(b,c,l,e&t.U),m[c]!=l&&i(m,c,p),y&&g[c]!=l&&(g[c]=l)};r.core=o,a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,e,n){var r=n(11),o=n(69),i=n(42),u=n(25)("IE_PROTO"),s=function(){},a=function(){var t,e=n(35)("iframe"),r=i.length;for(e.style.display="none",n(74).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;r--;)delete a.prototype[i[r]];return a()};t.exports=Object.create||function(t,e){var n;return null!==t?(s.prototype=r(t),n=new s,s.prototype=null,n[u]=t):n=a(),void 0===e?n:o(n,e)}},function(t,e,n){var r=n(70),o=n(42);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(22),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){for(var r=n(77),o=n(40),i=n(8),u=n(3),s=n(9),a=n(14),c=n(2),f=c("iterator"),l=c("toStringTag"),p=a.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},d=o(h),y=0;y<d.length;y++){var v,b=d[y],m=h[b],g=u[b],w=g&&g.prototype;if(w&&(w[f]||s(w,f,p),w[l]||s(w,l,b),a[b]=p,m))for(v in r)w[v]||i(w,v,r[v],!0)}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){"use strict";var r=n(10).f,o=n(39),i=n(46),u=n(17),s=n(47),a=n(48),c=n(24),f=n(44),l=n(83),p=n(5),h=n(49).fastKey,d=n(27),y=p?"_s":"size",v=function(t,e){var n,r=h(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,n,c){var f=t(function(t,r){s(t,f,e,"_i"),t._t=e,t._i=o(null),t._f=void 0,t._l=void 0,t[y]=0,void 0!=r&&a(r,n,t[c],t)});return i(f.prototype,{clear:function(){for(var t=d(this,e),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[y]=0},delete:function(t){var n=d(this,e),r=v(n,t);if(r){var o=r.n,i=r.p;delete n._i[r.i],r.r=!0,i&&(i.n=o),o&&(o.p=i),n._f==r&&(n._f=o),n._l==r&&(n._l=i),n[y]--}return!!r},forEach:function(t){d(this,e);for(var n,r=u(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!v(d(this,e),t)}}),p&&r(f.prototype,"size",{get:function(){return d(this,e)[y]}}),f},def:function(t,e,n){var r,o,i=v(t,e);return i?i.v=n:(t._l=i={i:o=h(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=i),r&&(r.n=i),t[y]++,"F"!==o&&(t._i[o]=i)),t},getEntry:v,setStrong:function(t,e,n){c(t,e,function(t,n){this._t=d(t,e),this._k=n,this._l=void 0},function(){for(var t=this._k,e=this._l;e&&e.r;)e=e.p;return this._t&&(this._l=e=e?e.n:this._t._f)?f(0,"keys"==t?e.k:"values"==t?e.v:[e.k,e.v]):(this._t=void 0,f(1))},n?"entries":"values",!n,!0),l(e)}}},function(t,e,n){var r=n(8);t.exports=function(t,e,n){for(var o in e)r(t,o,e[o],n);return t}},function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},function(t,e,n){var r=n(17),o=n(80),i=n(81),u=n(11),s=n(41),a=n(82),c={},f={};(e=t.exports=function(t,e,n,l,p){var h,d,y,v,b=p?function(){return t}:a(t),m=r(n,l,e?2:1),g=0;if("function"!=typeof b)throw TypeError(t+" is not iterable!");if(i(b)){for(h=s(t.length);h>g;g++)if((v=e?m(u(d=t[g])[0],d[1]):m(t[g]))===c||v===f)return v}else for(y=b.call(t);!(d=y.next()).done;)if((v=o(y,m,d.value,e))===c||v===f)return v}).BREAK=c,e.RETURN=f},function(t,e,n){var r=n(15)("meta"),o=n(4),i=n(12),u=n(10).f,s=0,a=Object.isExtensible||function(){return!0},c=!n(16)(function(){return a(Object.preventExtensions({}))}),f=function(t){u(t,r,{value:{i:"O"+ ++s,w:{}}})},l=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,r)){if(!a(t))return"F";if(!e)return"E";f(t)}return t[r].i},getWeak:function(t,e){if(!i(t,r)){if(!a(t))return!0;if(!e)return!1;f(t)}return t[r].w},onFreeze:function(t){return c&&l.NEED&&a(t)&&!i(t,r)&&f(t),t}}},function(t,e,n){"use strict";var r=n(3),o=n(38),i=n(8),u=n(46),s=n(49),a=n(48),c=n(47),f=n(4),l=n(16),p=n(84),h=n(26),d=n(85);t.exports=function(t,e,n,y,v,b){var m=r[t],g=m,w=v?"set":"add",O=g&&g.prototype,_={},j=function(t){var e=O[t];i(O,t,"delete"==t?function(t){return!(b&&!f(t))&&e.call(this,0===t?0:t)}:"has"==t?function(t){return!(b&&!f(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return b&&!f(t)?void 0:e.call(this,0===t?0:t)}:"add"==t?function(t){return e.call(this,0===t?0:t),this}:function(t,n){return e.call(this,0===t?0:t,n),this})};if("function"==typeof g&&(b||O.forEach&&!l(function(){(new g).entries().next()}))){var S=new g,C=S[w](b?{}:-0,1)!=S,k=l(function(){S.has(1)}),x=p(function(t){new g(t)}),E=!b&&l(function(){for(var t=new g,e=5;e--;)t[w](e,e);return!t.has(-0)});x||((g=e(function(e,n){c(e,g,t);var r=d(new m,e,g);return void 0!=n&&a(n,v,r[w],r),r})).prototype=O,O.constructor=g),(k||E)&&(j("delete"),j("has"),v&&j("get")),(E||C)&&j(w),b&&O.clear&&delete O.clear}else g=y.getConstructor(e,t,v,w),u(g.prototype,n),s.NEED=!0;return h(g,t),_[t]=g,o(o.G+o.W+o.F*(g!=m),_),b||y.setStrong(g,t,v),g}},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!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:i}catch(t){n=i}try{r="function"===typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var a,c=[],f=!1,l=-1;function p(){f&&a&&(f=!1,a.length?c=a.concat(c):l=-1,c.length&&h())}function h(){if(!f){var t=s(p);f=!0;for(var e=c.length;e;){for(a=c,c=[];++l<e;)a&&a[l].run();l=-1,e=c.length}a=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new d(t,e)),1!==c.length||f||s(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){"use strict";var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function u(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(o){return!1}}()?Object.assign:function(t,e){for(var n,s,a=u(t),c=1;c<arguments.length;c++){for(var f in n=Object(arguments[c]))o.call(n,f)&&(a[f]=n[f]);if(r){s=r(n);for(var l=0;l<s.length;l++)i.call(n,s[l])&&(a[s[l]]=n[s[l]])}}return a}},function(t,e,n){var r=n(54),o=n(98),i=n(99),u="[object Null]",s="[object Undefined]",a=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?s:u:a&&a in Object(t)?o(t):i(t)}},function(t,e,n){var r=n(96).Symbol;t.exports=r},function(t,e,n){"use strict";t.exports=function(t,e,n,r,o,i,u,s){if(!t){var a;if(void 0===e)a=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,o,i,u,s],f=0;(a=new Error(e.replace(/%s/g,function(){return c[f++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}}},function(t,e,n){var r=n(53),o=n(100),i="[object AsyncFunction]",u="[object Function]",s="[object GeneratorFunction]",a="[object Proxy]";t.exports=function(t){if(!o(t))return!1;var e=r(t);return e==u||e==s||e==i||e==a}},function(t,e,n){var r=n(53),o=n(28),i=n(104),u="[object String]";t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&r(t)==u}},function(t,e,n){n(59),t.exports=n(105)},function(t,e,n){"undefined"===typeof Promise&&(n(60).enable(),window.Promise=n(62)),n(63),n(64),n(89),n(91),Object.assign=n(52)},function(t,e,n){"use strict";var r=n(29),o=[ReferenceError,TypeError,RangeError],i=!1;function u(){i=!1,r._l=null,r._m=null}function s(t,e){return e.some(function(e){return t instanceof e})}e.disable=u,e.enable=function(t){t=t||{},i&&u();i=!0;var e=0,n=0,a={};function c(e){(t.allRejections||s(a[e].error,t.whitelist||o))&&(a[e].displayId=n++,t.onUnhandled?(a[e].logged=!0,t.onUnhandled(a[e].displayId,a[e].error)):(a[e].logged=!0,function(t,e){console.warn("Possible Unhandled Promise Rejection (id: "+t+"):"),((e&&(e.stack||e))+"").split("\n").forEach(function(t){console.warn(" "+t)})}(a[e].displayId,a[e].error)))}r._l=function(e){2===e._i&&a[e._o]&&(a[e._o].logged?function(e){a[e].logged&&(t.onHandled?t.onHandled(a[e].displayId,a[e].error):a[e].onUnhandled||(console.warn("Promise Rejection Handled (id: "+a[e].displayId+"):"),console.warn(' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id '+a[e].displayId+".")))}(e._o):clearTimeout(a[e._o].timeout),delete a[e._o])},r._m=function(t,n){0===t._h&&(t._o=e++,a[t._o]={displayId:null,error:n,timeout:setTimeout(c.bind(null,t._o),s(n,o)?100:2e3),logged:!1})}}},function(t,e,n){"use strict";(function(e){function n(t){o.length||(r(),!0),o[o.length]=t}t.exports=n;var r,o=[],i=0,u=1024;function s(){for(;i<o.length;){var t=i;if(i+=1,o[t].call(),i>u){for(var e=0,n=o.length-i;e<n;e++)o[e]=o[e+i];o.length-=i,i=0}}o.length=0,i=0,!1}var a="undefined"!==typeof e?e:self,c=a.MutationObserver||a.WebKitMutationObserver;function f(t){return function(){var e=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(e),clearInterval(n),t()}}}r="function"===typeof c?function(t){var e=1,n=new c(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}(s):f(s),n.requestFlush=r,n.makeRequestCallFromTimer=f}).call(this,n(19))},function(t,e,n){"use strict";var r=n(29);t.exports=r;var o=f(!0),i=f(!1),u=f(null),s=f(void 0),a=f(0),c=f("");function f(t){var e=new r(r._n);return e._i=1,e._j=t,e}r.resolve=function(t){if(t instanceof r)return t;if(null===t)return u;if(void 0===t)return s;if(!0===t)return o;if(!1===t)return i;if(0===t)return a;if(""===t)return c;if("object"===typeof t||"function"===typeof t)try{var e=t.then;if("function"===typeof e)return new r(e.bind(t))}catch(n){return new r(function(t,e){e(n)})}return f(t)},r.all=function(t){var e=Array.prototype.slice.call(t);return new r(function(t,n){if(0===e.length)return t([]);var o=e.length;function i(u,s){if(s&&("object"===typeof s||"function"===typeof s)){if(s instanceof r&&s.then===r.prototype.then){for(;3===s._i;)s=s._j;return 1===s._i?i(u,s._j):(2===s._i&&n(s._j),void s.then(function(t){i(u,t)},n))}var a=s.then;if("function"===typeof a)return void new r(a.bind(s)).then(function(t){i(u,t)},n)}e[u]=s,0===--o&&t(e)}for(var u=0;u<e.length;u++)i(u,e[u])})},r.reject=function(t){return new r(function(e,n){n(t)})},r.race=function(t){return new r(function(e,n){t.forEach(function(t){r.resolve(t).then(e,n)})})},r.prototype.catch=function(t){return this.then(null,t)}},function(t,e,n){"use strict";n.r(e),n.d(e,"Headers",function(){return c}),n.d(e,"Request",function(){return v}),n.d(e,"Response",function(){return g}),n.d(e,"DOMException",function(){return O}),n.d(e,"fetch",function(){return _});var r={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(r.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&o.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!==typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function s(t){return"string"!==typeof t&&(t=String(t)),t}function a(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r.iterable&&(e[Symbol.iterator]=function(){return e}),e}function c(t){this.map={},t instanceof c?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function p(t){var e=new FileReader,n=l(e);return e.readAsArrayBuffer(t),n}function h(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"===typeof t?this._bodyText=t:r.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():r.arrayBuffer&&r.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=h(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=h(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"===typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,n=l(e);return e.readAsText(t),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,e){t=u(t),e=s(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},c.prototype.delete=function(t){delete this.map[u(t)]},c.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},c.prototype.set=function(t,e){this.map[u(t)]=s(e)},c.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},c.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),a(t)},c.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),a(t)},c.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),a(t)},r.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var n=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new c(e.headers)),this.method=function(t){var e=t.toUpperCase();return y.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(o))}}),e}function m(t){var e=new c;return t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var n=t.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();e.append(r,o)}}),e}function g(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new c(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},d.call(v.prototype),d.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];g.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})};var O=self.DOMException;try{new O}catch(j){(O=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack}).prototype=Object.create(Error.prototype),O.prototype.constructor=O}function _(t,e){return new Promise(function(n,o){var i=new v(t,e);if(i.signal&&i.signal.aborted)return o(new O("Aborted","AbortError"));var u=new XMLHttpRequest;function s(){u.abort()}u.onload=function(){var t={status:u.status,statusText:u.statusText,headers:m(u.getAllResponseHeaders()||"")};t.url="responseURL"in u?u.responseURL:t.headers.get("X-Request-URL");var e="response"in u?u.response:u.responseText;n(new g(e,t))},u.onerror=function(){o(new TypeError("Network request failed"))},u.ontimeout=function(){o(new TypeError("Network request failed"))},u.onabort=function(){o(new O("Aborted","AbortError"))},u.open(i.method,i.url,!0),"include"===i.credentials?u.withCredentials=!0:"omit"===i.credentials&&(u.withCredentials=!1),"responseType"in u&&r.blob&&(u.responseType="blob"),i.headers.forEach(function(t,e){u.setRequestHeader(e,t)}),i.signal&&(i.signal.addEventListener("abort",s),u.onreadystatechange=function(){4===u.readyState&&i.signal.removeEventListener("abort",s)}),u.send("undefined"===typeof i._bodyInit?null:i._bodyInit)})}_.polyfill=!0,self.fetch||(self.fetch=_,self.Headers=c,self.Request=v,self.Response=g)},function(t,e,n){n(30),n(37),n(43),n(79),t.exports=n(7).Map},function(t,e,n){t.exports=n(20)("native-function-to-string",Function.toString)},function(t,e,n){var r=n(22),o=n(23);t.exports=function(t){return function(e,n){var i,u,s=String(o(e)),a=r(n),c=s.length;return a<0||a>=c?t?"":void 0:(i=s.charCodeAt(a))<55296||i>56319||a+1===c||(u=s.charCodeAt(a+1))<56320||u>57343?t?s.charAt(a):i:t?s.slice(a,a+2):u-56320+(i-55296<<10)+65536}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){"use strict";var r=n(39),o=n(21),i=n(26),u={};n(9)(u,n(2)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(u,{next:o(1,n)}),i(t,e+" Iterator")}},function(t,e,n){var r=n(10),o=n(11),i=n(40);t.exports=n(5)?Object.defineProperties:function(t,e){o(t);for(var n,u=i(e),s=u.length,a=0;s>a;)r.f(t,n=u[a++],e[n]);return t}},function(t,e,n){var r=n(12),o=n(18),i=n(72)(!1),u=n(25)("IE_PROTO");t.exports=function(t,e){var n,s=o(t),a=0,c=[];for(n in s)n!=u&&r(s,n)&&c.push(n);for(;e.length>a;)r(s,n=e[a++])&&(~i(c,n)||c.push(n));return c}},function(t,e,n){var r=n(32);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,n){var r=n(18),o=n(41),i=n(73);t.exports=function(t){return function(e,n,u){var s,a=r(e),c=o(a.length),f=i(u,c);if(t&&n!=n){for(;c>f;)if((s=a[f++])!=s)return!0}else for(;c>f;f++)if((t||f in a)&&a[f]===n)return t||f||0;return!t&&-1}}},function(t,e,n){var r=n(22),o=Math.max,i=Math.min;t.exports=function(t,e){return(t=r(t))<0?o(t+e,0):i(t,e)}},function(t,e,n){var r=n(3).document;t.exports=r&&r.documentElement},function(t,e,n){var r=n(12),o=n(76),i=n(25)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,e,n){var r=n(23);t.exports=function(t){return Object(r(t))}},function(t,e,n){"use strict";var r=n(78),o=n(44),i=n(14),u=n(18);t.exports=n(24)(Array,"Array",function(t,e){this._t=u(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):o(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(t,e,n){var r=n(2)("unscopables"),o=Array.prototype;void 0==o[r]&&n(9)(o,r,{}),t.exports=function(t){o[r][t]=!0}},function(t,e,n){"use strict";var r=n(45),o=n(27);t.exports=n(50)("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var e=r.getEntry(o(this,"Map"),t);return e&&e.v},set:function(t,e){return r.def(o(this,"Map"),0===t?0:t,e)}},r,!0)},function(t,e,n){var r=n(11);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(u){var i=t.return;throw void 0!==i&&r(i.call(t)),u}}},function(t,e,n){var r=n(14),o=n(2)("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},function(t,e,n){var r=n(31),o=n(2)("iterator"),i=n(14);t.exports=n(7).getIteratorMethod=function(t){if(void 0!=t)return t[o]||t["@@iterator"]||i[r(t)]}},function(t,e,n){"use strict";var r=n(3),o=n(10),i=n(5),u=n(2)("species");t.exports=function(t){var e=r[t];i&&e&&!e[u]&&o.f(e,u,{configurable:!0,get:function(){return this}})}},function(t,e,n){var r=n(2)("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(u){}t.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var i=[7],s=i[r]();s.next=function(){return{done:n=!0}},i[r]=function(){return s},t(i)}catch(u){}return n}},function(t,e,n){var r=n(4),o=n(86).set;t.exports=function(t,e,n){var i,u=e.constructor;return u!==n&&"function"==typeof u&&(i=u.prototype)!==n.prototype&&r(i)&&o&&o(t,i),t}},function(t,e,n){var r=n(4),o=n(11),i=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n(17)(Function.call,n(87).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(o){e=!0}return function(t,n){return i(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:i}},function(t,e,n){var r=n(88),o=n(21),i=n(18),u=n(36),s=n(12),a=n(34),c=Object.getOwnPropertyDescriptor;e.f=n(5)?c:function(t,e){if(t=i(t),e=u(e,!0),a)try{return c(t,e)}catch(n){}if(s(t,e))return o(!r.f.call(t,e),t[e])}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){n(30),n(37),n(43),n(90),t.exports=n(7).Set},function(t,e,n){"use strict";var r=n(45),o=n(27);t.exports=n(50)("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(o(this,"Set"),t=0===t?0:t,t)}},r)},function(t,e,n){n(92).polyfill()},function(t,e,n){(function(e){for(var r=n(93),o="undefined"===typeof window?e:window,i=["moz","webkit"],u="AnimationFrame",s=o["request"+u],a=o["cancel"+u]||o["cancelRequest"+u],c=0;!s&&c<i.length;c++)s=o[i[c]+"Request"+u],a=o[i[c]+"Cancel"+u]||o[i[c]+"CancelRequest"+u];if(!s||!a){var f=0,l=0,p=[];s=function(t){if(0===p.length){var e=r(),n=Math.max(0,1e3/60-(e-f));f=n+e,setTimeout(function(){var t=p.slice(0);p.length=0;for(var e=0;e<t.length;e++)if(!t[e].cancelled)try{t[e].callback(f)}catch(n){setTimeout(function(){throw n},0)}},Math.round(n))}return p.push({handle:++l,callback:t,cancelled:!1}),l},a=function(t){for(var e=0;e<p.length;e++)p[e].handle===t&&(p[e].cancelled=!0)}}t.exports=function(t){return s.call(o,t)},t.exports.cancel=function(){a.apply(o,arguments)},t.exports.polyfill=function(t){t||(t=o),t.requestAnimationFrame=s,t.cancelAnimationFrame=a}}).call(this,n(19))},function(t,e,n){(function(e){(function(){var n,r,o,i,u,s;"undefined"!==typeof performance&&null!==performance&&performance.now?t.exports=function(){return performance.now()}:"undefined"!==typeof e&&null!==e&&e.hrtime?(t.exports=function(){return(n()-u)/1e6},r=e.hrtime,i=(n=function(){var t;return 1e9*(t=r())[0]+t[1]})(),s=1e9*e.uptime(),u=i-s):Date.now?(t.exports=function(){return Date.now()-o},o=Date.now()):(t.exports=function(){return(new Date).getTime()-o},o=(new Date).getTime())}).call(this)}).call(this,n(51))},function(t,e,n){"use strict";t.exports=function(t){function e(t){for(var e=0,n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return r.colors[Math.abs(e)%r.colors.length]}function r(t){var n;function u(){if(u.enabled){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];var i=u,s=Number(new Date),a=s-(n||s);i.diff=a,i.prev=n,i.curr=s,n=s,e[0]=r.coerce(e[0]),"string"!==typeof e[0]&&e.unshift("%O");var c=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,function(t,n){if("%%"===t)return t;c++;var o=r.formatters[n];if("function"===typeof o){var u=e[c];t=o.call(i,u),e.splice(c,1),c--}return t}),r.formatArgs.call(i,e),(i.log||r.log).apply(i,e)}}return u.namespace=t,u.enabled=r.enabled(t),u.useColors=r.useColors(),u.color=e(t),u.destroy=o,u.extend=i,"function"===typeof r.init&&r.init(u),r.instances.push(u),u}function o(){var t=r.instances.indexOf(this);return-1!==t&&(r.instances.splice(t,1),!0)}function i(t,e){return r(this.namespace+("undefined"===typeof e?":":e)+t)}return r.debug=r,r.default=r,r.coerce=function(t){return t instanceof Error?t.stack||t.message:t},r.disable=function(){r.enable("")},r.enable=function(t){var e;r.save(t),r.names=[],r.skips=[];var n=("string"===typeof t?t:"").split(/[\s,]+/),o=n.length;for(e=0;e<o;e++)n[e]&&("-"===(t=n[e].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+t.substr(1)+"$")):r.names.push(new RegExp("^"+t+"$")));for(e=0;e<r.instances.length;e++){var i=r.instances[e];i.enabled=r.enabled(i.namespace)}},r.enabled=function(t){if("*"===t[t.length-1])return!0;var e,n;for(e=0,n=r.skips.length;e<n;e++)if(r.skips[e].test(t))return!1;for(e=0,n=r.names.length;e<n;e++)if(r.names[e].test(t))return!0;return!1},r.humanize=n(95),Object.keys(t).forEach(function(e){r[e]=t[e]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=e,r.enable(r.load()),r}},function(t,e){var n=1e3,r=60*n,o=60*r,i=24*o,u=7*i,s=365.25*i;function a(t,e,n,r){var o=e>=1.5*n;return Math.round(t/n)+" "+r+(o?"s":"")}t.exports=function(t,e){e=e||{};var c=typeof t;if("string"===c&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var a=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"weeks":case"week":case"w":return a*u;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*o;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(t);if("number"===c&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=i)return a(t,e,i,"day");if(e>=o)return a(t,e,o,"hour");if(e>=r)return a(t,e,r,"minute");if(e>=n)return a(t,e,n,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=i)return Math.round(t/i)+"d";if(e>=o)return Math.round(t/o)+"h";if(e>=r)return Math.round(t/r)+"m";if(e>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){var r=n(97),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(this,n(19))},function(t,e,n){var r=n(54),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,s=r?r.toStringTag:void 0;t.exports=function(t){var e=i.call(t,s),n=t[s];try{t[s]=void 0;var r=!0}catch(a){}var o=u.call(t);return r&&(e?t[s]=n:delete t[s]),o}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,n){"use strict";var r=n(52),o="function"===typeof Symbol&&Symbol.for,i=o?Symbol.for("react.element"):60103,u=o?Symbol.for("react.portal"):60106,s=o?Symbol.for("react.fragment"):60107,a=o?Symbol.for("react.strict_mode"):60108,c=o?Symbol.for("react.profiler"):60114,f=o?Symbol.for("react.provider"):60109,l=o?Symbol.for("react.context"):60110,p=o?Symbol.for("react.forward_ref"):60112,h=o?Symbol.for("react.suspense"):60113;o&&Symbol.for("react.suspense_list");var d=o?Symbol.for("react.memo"):60115,y=o?Symbol.for("react.lazy"):60116;o&&Symbol.for("react.fundamental"),o&&Symbol.for("react.responder"),o&&Symbol.for("react.scope");var v="function"===typeof Symbol&&Symbol.iterator;function b(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g={};function w(t,e,n){this.props=t,this.context=e,this.refs=g,this.updater=n||m}function O(){}function _(t,e,n){this.props=t,this.context=e,this.refs=g,this.updater=n||m}w.prototype.isReactComponent={},w.prototype.setState=function(t,e){if("object"!==typeof t&&"function"!==typeof t&&null!=t)throw Error(b(85));this.updater.enqueueSetState(this,t,e,"setState")},w.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},O.prototype=w.prototype;var j=_.prototype=new O;j.constructor=_,r(j,w.prototype),j.isPureReactComponent=!0;var S={current:null},C={current:null},k=Object.prototype.hasOwnProperty,x={key:!0,ref:!0,__self:!0,__source:!0};function E(t,e,n){var r,o={},u=null,s=null;if(null!=e)for(r in void 0!==e.ref&&(s=e.ref),void 0!==e.key&&(u=""+e.key),e)k.call(e,r)&&!x.hasOwnProperty(r)&&(o[r]=e[r]);var a=arguments.length-2;if(1===a)o.children=n;else if(1<a){for(var c=Array(a),f=0;f<a;f++)c[f]=arguments[f+2];o.children=c}if(t&&t.defaultProps)for(r in a=t.defaultProps)void 0===o[r]&&(o[r]=a[r]);return{$$typeof:i,type:t,key:u,ref:s,props:o,_owner:C.current}}function P(t){return"object"===typeof t&&null!==t&&t.$$typeof===i}var A=/\/+/g,T=[];function F(t,e,n,r){if(T.length){var o=T.pop();return o.result=t,o.keyPrefix=e,o.func=n,o.context=r,o.count=0,o}return{result:t,keyPrefix:e,func:n,context:r,count:0}}function R(t){t.result=null,t.keyPrefix=null,t.func=null,t.context=null,t.count=0,10>T.length&&T.push(t)}function L(t,e,n){return null==t?0:function t(e,n,r,o){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var a=!1;if(null===e)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case i:case u:a=!0}}if(a)return r(o,e,""===n?"."+M(e,0):n),1;if(a=0,n=""===n?".":n+":",Array.isArray(e))for(var c=0;c<e.length;c++){var f=n+M(s=e[c],c);a+=t(s,f,r,o)}else if(f=null===e||"object"!==typeof e?null:"function"===typeof(f=v&&e[v]||e["@@iterator"])?f:null,"function"===typeof f)for(e=f.call(e),c=0;!(s=e.next()).done;)a+=t(s=s.value,f=n+M(s,c++),r,o);else if("object"===s)throw r=""+e,Error(b(31,"[object Object]"===r?"object with keys {"+Object.keys(e).join(", ")+"}":r,""));return a}(t,"",e,n)}function M(t,e){return"object"===typeof t&&null!==t&&null!=t.key?function(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(t){return e[t]})}(t.key):e.toString(36)}function D(t,e){t.func.call(t.context,e,t.count++)}function I(t,e,n){var r=t.result,o=t.keyPrefix;t=t.func.call(t.context,e,t.count++),Array.isArray(t)?N(t,r,n,function(t){return t}):null!=t&&(P(t)&&(t=function(t,e){return{$$typeof:i,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}(t,o+(!t.key||e&&e.key===t.key?"":(""+t.key).replace(A,"$&/")+"/")+n)),r.push(t))}function N(t,e,n,r,o){var i="";null!=n&&(i=(""+n).replace(A,"$&/")+"/"),L(t,I,e=F(e,i,r,o)),R(e)}function U(){var t=S.current;if(null===t)throw Error(b(321));return t}var B={Children:{map:function(t,e,n){if(null==t)return t;var r=[];return N(t,r,null,e,n),r},forEach:function(t,e,n){if(null==t)return t;L(t,D,e=F(null,null,e,n)),R(e)},count:function(t){return L(t,function(){return null},null)},toArray:function(t){var e=[];return N(t,e,null,function(t){return t}),e},only:function(t){if(!P(t))throw Error(b(143));return t}},createRef:function(){return{current:null}},Component:w,PureComponent:_,createContext:function(t,e){return void 0===e&&(e=null),(t={$$typeof:l,_calculateChangedBits:e,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:f,_context:t},t.Consumer=t},forwardRef:function(t){return{$$typeof:p,render:t}},lazy:function(t){return{$$typeof:y,_ctor:t,_status:-1,_result:null}},memo:function(t,e){return{$$typeof:d,type:t,compare:void 0===e?null:e}},useCallback:function(t,e){return U().useCallback(t,e)},useContext:function(t,e){return U().useContext(t,e)},useEffect:function(t,e){return U().useEffect(t,e)},useImperativeHandle:function(t,e,n){return U().useImperativeHandle(t,e,n)},useDebugValue:function(){},useLayoutEffect:function(t,e){return U().useLayoutEffect(t,e)},useMemo:function(t,e){return U().useMemo(t,e)},useReducer:function(t,e,n){return U().useReducer(t,e,n)},useRef:function(t){return U().useRef(t)},useState:function(t){return U().useState(t)},Fragment:s,Profiler:c,StrictMode:a,Suspense:h,createElement:E,cloneElement:function(t,e,n){if(null===t||void 0===t)throw Error(b(267,t));var o=r({},t.props),u=t.key,s=t.ref,a=t._owner;if(null!=e){if(void 0!==e.ref&&(s=e.ref,a=C.current),void 0!==e.key&&(u=""+e.key),t.type&&t.type.defaultProps)var c=t.type.defaultProps;for(f in e)k.call(e,f)&&!x.hasOwnProperty(f)&&(o[f]=void 0===e[f]&&void 0!==c?c[f]:e[f])}var f=arguments.length-2;if(1===f)o.children=n;else if(1<f){c=Array(f);for(var l=0;l<f;l++)c[l]=arguments[l+2];o.children=c}return{$$typeof:i,type:t.type,key:u,ref:s,props:o,_owner:a}},createFactory:function(t){var e=E.bind(null,t);return e.type=t,e},isValidElement:P,version:"16.12.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:S,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:C,IsSomeRendererActing:{current:!1},assign:r}},K={default:B},$=K&&B||K;t.exports=$.default||$},function(t,e,n){"use strict";var r=n(103);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,e,n,o,i,u){if(u!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,n){"use strict";n.r(e);var r=n(6),o=n.n(r),i=n(13),u=n.n(i),s=n(55),a=n.n(s),c=n(56),f=n.n(c);function l(t){return(l="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function h(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function v(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function b(t,e){return(b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var m=o()("folklore:socket:pubnub"),g=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e){return!e||"object"!==l(e)&&"function"!==typeof e?v(t):e}(this,y(e).call(this))).options=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?p(n,!0).forEach(function(e){h(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):p(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({uuid:null,publishKey:null,subscribeKey:null,secretKey:null},t),n.onReady=n.onReady.bind(v(n)),n.onStatus=n.onStatus.bind(v(n)),n.onMessage=n.onMessage.bind(v(n)),n.ready=!1,n.shouldStart=!1,n.started=!1,n.starting=!1,n.PubNub=null,n.pubnub=null,n.pubnubListener=null,n.channels=[],n.init(),n}var r,o,i;return function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e)}(e,u.a),r=e,(o=[{key:"onReady",value:function(){this.ready=!0,this.emit("ready")}},{key:"onStatus",value:function(t){"PNConnectedCategory"!==t.category||this.started||(this.started=!0,this.starting=!1,this.emit("started"))}},{key:"onMessage",value:function(t){var e=t.message;this.emit("message",e),"undefined"!==typeof e.event&&this.emit(e.event,e.data||e)}},{key:"updateChannels",value:function(t){m("Updating channels: ".concat(t.join(", ")));var e=this.shouldStart,n=this.started,r=this.starting;(n||r)&&this.stop(),this.channels=t,(n||r||e)&&(this.shouldStart=!1,this.start())}},{key:"init",value:function(){var t=this;n.e(2).then(n.t.bind(null,151,7)).then(function(e){var n=e.default;t.PubNub=n}).then(function(){return t.createPubNub()}).then(function(){return t.onReady()})}},{key:"createPubNub",value:function(){var t=this.PubNub,e={publishKey:this.options.publishKey,subscribeKey:this.options.subscribeKey};null!==this.options.uuid&&(e.uuid=this.options.uuid),null!==this.options.secretKey&&(e.secretKey=this.options.secretKey),this.pubnub=new t(e),this.pubnubListener={status:this.onStatus,message:this.onMessage},this.pubnub.addListener(this.pubnubListener)}},{key:"destroy",value:function(){this.stop(),this.pubnubListener&&(this.pubnub.removeListener(this.pubnubListener),this.pubnubListener=null),this.ready=!1,m("Destroyed.")}},{key:"start",value:function(){if(this.started)m("Skipping start: Already started.");else if(this.starting)m("Skipping start: Already starting.");else{if(0===this.channels.length)return m("Skipping start: No channels."),void(this.shouldStart=!0);this.shouldStart=!1,this.starting=!0,this.pubnub.subscribe({channels:this.channels}),this.emit("start")}}},{key:"stop",value:function(){(this.started||this.starting)&&(m("Stopping..."),this.shouldStart=!1,this.started=!1,this.starting=!1,this.pubnub.unsubscribe({channels:this.channels}),this.emit("stop"))}},{key:"send",value:function(t){var e=this;return m("Sending",t),new Promise(function(n,r){e.pubnub.publish(t,function(e,o){e.error?r(new Error("Error operation:".concat(e.operation," status:").concat(e.statusCode))):n({status:e,response:o,data:t})})})}}])&&d(r.prototype,o),i&&d(r,i),e}(),w=n(28),O=n.n(w);function _(t){return(_="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function j(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function S(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function C(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?S(n,!0).forEach(function(e){k(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):S(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function k(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function x(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function E(t){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function P(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function A(t,e){return(A=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var T=o()("folklore:socket:socketio"),F={PubNub:g,SocketIO:function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e){return!e||"object"!==_(e)&&"function"!==typeof e?P(t):e}(this,E(e).call(this))).options=C({uuid:null,host:"http://127.0.0.1",path:null,query:null},t),n.onReady=n.onReady.bind(P(n)),n.onConnect=n.onConnect.bind(P(n)),n.onMessage=n.onMessage.bind(P(n)),n.ready=!1,n.shouldStart=!1,n.started=!1,n.starting=!1,n.Manager=null,n.io=null,n.sockets={},n.channels=[],n.init(),n}var r,o,i;return function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&A(t,e)}(e,u.a),r=e,(o=[{key:"onReady",value:function(){this.ready=!0,this.emit("ready")}},{key:"onConnect",value:function(t){T("Socket connected on %s",t),this.started||(this.started=!0,this.starting=!1,this.emit("started"))}},{key:"onMessage",value:function(t,e){T("Message received on %s %o",e,t),this.emit("message",t,e)}},{key:"init",value:function(){var t=this;n.e(1).then(n.t.bind(null,152,7)).then(function(e){var n=e.default;t.Manager=n.Manager}).then(function(){return t.createManager()}).then(function(){return t.onReady()}).then(function(){t.shouldStart&&t.start()})}},{key:"createManager",value:function(){var t=this.Manager,e=this.options,n=e.host,r=j(e,["host"]);this.io=new t(n,C({autoConnect:!1},r))}},{key:"updateChannels",value:function(t){T("Updating channels: ".concat(t.join(", ")));var e=this.shouldStart,n=this.started,r=this.starting;(n||r)&&this.stop(),this.channels=t,(n||r||e)&&this.start()}},{key:"start",value:function(){var t=this;if(this.started)T("Skipping start: Already started.");else if(this.starting)T("Skipping start: Already starting.");else{if(null===this.io)return T("Socket.io not ready."),void(this.shouldStart=!0);if(0===this.channels.length)return T("Skipping start: No channels."),void(this.shouldStart=!0);this.shouldStart=!1,this.starting=!0,this.sockets=this.channels.reduce(function(e,n){return C({},e,k({},n,t.createSocket(n)))},{}),this.emit("start")}}},{key:"stop",value:function(){var t=this;(this.started||this.starting)&&(T("Stopping..."),this.shouldStart=!1,this.started=!1,this.starting=!1,Object.values(this.sockets).forEach(function(e){return t.stopSocket(e)}),this.emit("stop"))}},{key:"createSocket",value:function(t){var e=this,n=this.io.socket("/".concat(t.replace(/^\//,"")));return n.on("message",function(n){return e.onMessage(n,t)}),n.on("connect",function(){return e.onConnect(t)}),n.open(),n}},{key:"stopSocket",value:function(t){return t.off("connect"),t.off("message"),t.close(),t}},{key:"destroy",value:function(){this.stop(),this.sockets={},null!==this.io&&(this.io.close(),this.io=null)}},{key:"send",value:function(t){var e=this,n=t.channel,r=t.message;return(O()(n)?n:[n]).forEach(function(t){e.sockets[t].send(r)}),Promise.resolve()}}])&&x(r.prototype,o),i&&x(r,i),e}()};function R(t){return(R="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function L(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function M(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function D(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function I(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?D(n,!0).forEach(function(e){N(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):D(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function N(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function U(t){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function B(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function K(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function $(t,e,n){return e&&K(t.prototype,e),n&&K(t,n),t}function q(t,e){return(q=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var V=function(t){return t.replace(/[^a-z0-9]+/gi,"").toLowerCase()},W=o()("folklore:socket"),H=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e){return!e||"object"!==R(e)&&"function"!==typeof e?B(t):e}(this,U(e).call(this))).options=I({adapter:"pubnub",namespace:null,uuid:null,publishKey:null,subscribeKey:null,secretKey:null,channels:[]},t),n.onAdapterReady=n.onAdapterReady.bind(B(n)),n.onAdapterStart=n.onAdapterStart.bind(B(n)),n.onAdapterStarted=n.onAdapterStarted.bind(B(n)),n.onAdapterMessage=n.onAdapterMessage.bind(B(n)),n.onAdapterStop=n.onAdapterStop.bind(B(n)),n.shouldStart=!1,n.started=!1,n.starting=!1,n.ready=!1,n.adapter=null,n.channels=[],n.init(),n.options.channels.length&&n.setChannels(n.options.channels),n}return function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&q(t,e)}(e,u.a),$(e,null,[{key:"getAdapters",value:function(){return e.adapters}},{key:"getAdapter",value:function(t){var n=Object.keys(e.adapters).find(function(e){return V(e)===V(t)})||null;if(null===n)throw new Error("Adapter ".concat(t," not found"));return e.adapters[n]}},{key:"addAdapter",value:function(t,n){return e.adapters=I({},e.adapters,N({},t,n)),e}},{key:"setAdapters",value:function(t){return e.adapters=t,e}}]),$(e,[{key:"onAdapterReady",value:function(){W("Adapter ready"),this.ready=!0,this.emit("ready"),this.shouldStart&&(this.shouldStart=!1,this.start())}},{key:"onAdapterStart",value:function(){W("Adapter starting..."),this.starting=!0,this.started=!1,this.emit("start")}},{key:"onAdapterStarted",value:function(){W("Adapter started"),this.starting=!1,this.started=!0,this.emit("started")}},{key:"onAdapterStop",value:function(){W("Adapter stopped"),this.starting=!1,this.started=!1,this.emit("stop")}},{key:"onAdapterMessage",value:function(t){W("Adapter message",t),this.emit("message",t)}},{key:"getChannelWithoutNamespace",value:function(t){if(null===this.options.namespace)return t;var e=new RegExp("^".concat(this.options.namespace,":"));return t.replace(e,"")}},{key:"getChannelWithNamespace",value:function(t){var e=[];return null!==this.options.namespace&&e.push(this.options.namespace),e.push(t),e.join(":")}},{key:"setChannels",value:function(t){var e=this,n=t.map(function(t){return e.getChannelWithNamespace(t)}).sort();this.channels.join(",")!==n.join(",")&&(W("Set channels: ".concat(n.join(", "))),this.updateChannels(n))}},{key:"addChannel",value:function(t){var e=this.getChannelWithNamespace(t);-1===this.channels.indexOf(e)&&(W("Adding channel: ".concat(t)),this.updateChannels([].concat(M(this.channels),[e])))}},{key:"addChannels",value:function(t){var e=this,n=t.map(function(t){return e.getChannelWithNamespace(t)}).sort();W("Adding channels: ".concat(t.join(","))),this.updateChannels([].concat(M(this.channels),M(n.filter(function(t){return-1===e.channels.indexOf(t)}))))}},{key:"removeChannel",value:function(t){var e=this.getChannelWithNamespace(t);-1!==this.channels.indexOf(e)&&(W("Removing channel: ".concat(t)),this.updateChannels(this.channels.filter(function(t){return t!==e})))}},{key:"removeChannels",value:function(t){var e=this,n=t.map(function(t){return e.getChannelWithNamespace(t)}).sort();W("Removing channels: ".concat(t.join(","))),this.updateChannels(this.channels.filter(function(t){return-1===n.indexOf(t)}))}},{key:"updateChannels",value:function(t){var e=t.sort();W("Updating channels: ".concat(e.join(", "))),this.channels=M(e),null!==this.adapter&&this.adapter.updateChannels(e)}},{key:"hasChannel",value:function(t){var e=this.getChannelWithNamespace(t);return this.channels.reduce(function(t,n){return t||n===e},!1)}},{key:"getChannels",value:function(){var t=this;return this.channels.map(function(e){return t.getChannelWithoutNamespace(e)})}},{key:"init",value:function(){var t=this,n=this.options,r=n.adapter,o=(n.channels,L(n,["adapter","channels"])),i=e.getAdapter(r);this.adapter=new i(o);["start","stop","destroy","updateChannels","send"].forEach(function(e){a()(f()(t.adapter[e]||null),"Socket adapter should implement method ".concat(e))}),this.adapter.on("ready",this.onAdapterReady),this.adapter.on("start",this.onAdapterStart),this.adapter.on("started",this.onAdapterStarted),this.adapter.on("message",this.onAdapterMessage),this.adapter.on("stop",this.onAdapterStop)}},{key:"destroy",value:function(){null!==this.adapter&&(this.adapter.removeAllListeners(),this.adapter.destroy(),this.adapter=null),this.started=!1,this.starting=!1,this.ready=!1,W("Destroyed.")}},{key:"restart",value:function(){this.stop(),this.start()}},{key:"start",value:function(){var t=this;if(this.started)W("Skipping start: Already started.");else if(this.starting)W("Skipping start: Already starting.");else{if(!this.ready)return W("Skipping start: No ready."),void(this.shouldStart=!0);this.shouldStart=!1,W("Starting on channels:"),this.channels.forEach(function(e){W("- ".concat(t.getChannelWithoutNamespace(e)))}),this.adapter.start()}}},{key:"stop",value:function(){this.shouldStart=!1,(this.started||this.starting)&&(W("Stopping..."),null!==this.adapter&&this.adapter.stop())}},{key:"send",value:function(t,e){if(!this.started)return W("Abort sending data: Not started"),Promise.reject();var n="undefined"!==typeof t.channel&&"undefined"!==typeof t.message?t:{channel:"undefined"!==typeof e?this.getChannelWithNamespace(e):this.channels,message:t};return W("Sending",n),this.adapter.send(n)}},{key:"isStarted",value:function(){return this.started}}]),e}();H.adapters=I({},F);var z=H,G=n(0),J=n.n(G),Y=J.a.createContext({socket:null,subscribe:function(){},unsubscribe:function(){}}),X=n(1),Z=n.n(X);function Q(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function tt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Q(n,!0).forEach(function(e){et(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Q(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function et(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var u,s=t[Symbol.iterator]();!(r=(u=s.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(a){o=!0,i=a}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var rt={socket:Z.a.instanceOf(z),adapter:Z.a.string,host:Z.a.string,namespace:Z.a.string,uuid:Z.a.string,publishKey:Z.a.string,subscribeKey:Z.a.string,secretKey:Z.a.string,channels:Z.a.arrayOf(Z.a.string),autoStart:Z.a.bool,children:Z.a.node},ot=function(t){var e=t.children,n=t.socket,r=t.autoStart,o=t.adapter,i=t.host,u=t.namespace,s=t.uuid,a=t.publishKey,c=t.subscribeKey,f=t.secretKey,l=t.channels,p=Object(G.useMemo)(function(){return n||new z({adapter:o,host:i,namespace:u,uuid:s,publishKey:a,subscribeKey:c,secretKey:f})},[n,i,o,u,s,a,c,f]),h=nt(Object(G.useState)([]),2),d=h[0],y=h[1],v=Object(G.useRef)({}),b=Object(G.useCallback)(function(t){p.setChannels(t),y(t)},[p,y]),m=Object(G.useCallback)(function(t){v.current=t.reduce(function(t,e){return tt({},t,et({},e,(t[e]||0)+1))},v.current),b(Object.keys(v.current))},[b]),g=Object(G.useCallback)(function(t){v.current=t.reduce(function(t,e){var n=(t[e]||0)-1;return n>0?tt({},t,et({},e,n)):t},v.current),b(Object.keys(v.current))},[b]),w=Object(G.useCallback)(function(t){return m(t)},[m]),O=Object(G.useCallback)(function(t){return g(t)},[g]);Object(G.useEffect)(function(){return w(l),function(){O(l)}},[l,w,O]),Object(G.useEffect)(function(){return r&&p.start(),function(){p.destroy()}},[r,p]);var _=Object(G.useMemo)(function(){return{socket:p,subscribe:w,unsubscribe:O,channels:d}},[p,w]);return J.a.createElement(Y.Provider,{value:_},e)};ot.propTypes=rt,ot.defaultProps={socket:null,adapter:"pubnub",host:null,namespace:null,uuid:null,publishKey:null,subscribeKey:null,secretKey:null,channels:[],autoStart:!1,children:null};var it=ot;function ut(){return(ut=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var st=function(t){var e=function(e){return J.a.createElement(Y.Consumer,null,function(n){var r=n.socket,o=n.subscribe,i=n.unsubscribe;return J.a.createElement(t,ut({socket:r,socketSubscribe:o,socketUnsubscribe:i},e))})};return e.displayName="WithSocket(".concat(function(t){return t.displayName||t.name||"Component"}(t),")"),e},at=n(57),ct=n.n(at);function ft(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var u,s=t[Symbol.iterator]();!(r=(u=s.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(a){o=!0,i=a}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var lt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.socket,r=void 0===n?null:n,o=e.onMessage,i=void 0===o?null:o,u=Object(G.useContext)(Y),s=u.socket,a=u.subscribe,c=u.unsubscribe,f=r||s||null,l=Object(G.useState)(null!==f&&f.isStarted()),p=ft(l,2),h=p[0],d=p[1],y=ct()(t)?[t]:t,v=(y||[]).sort().join(",");return Object(G.useEffect)(function(){if(null===f)return function(){};var t=f.isStarted(),e=function(){return d(!0)},n=function(){return d(!1)};return f.on("stop",n),f.on("started",e),null!==y&&a(y),t||f.start(),function(){f.off("stop",n),f.off("started",e),null!==y&&c(y),t||f.stop()}},[v,r]),Object(G.useEffect)(function(){if(null===f)return function(){};var t=function(){null!==i&&i.apply(void 0,arguments)};return f.on("message",t),function(){f.off("message",t)}},[i]),{socket:f,started:h,subscribe:a,unsubscribe:c}};n.d(e,"default",function(){return z}),n.d(e,"Socket",function(){return z}),n.d(e,"SocketContext",function(){return Y}),n.d(e,"SocketContainer",function(){return it}),n.d(e,"withSocket",function(){return st}),n.d(e,"useSocket",function(){return lt})}]);
|
package/es/Socket.js
DELETED
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
8
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
9
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
10
|
-
|
|
11
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
-
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
14
|
-
|
|
15
|
-
import createDebug from 'debug';
|
|
16
|
-
import EventEmitter from 'wolfy87-eventemitter';
|
|
17
|
-
import invariant from 'invariant';
|
|
18
|
-
import isFunction from 'lodash/isFunction';
|
|
19
|
-
import SocketAdapters from './adapters/index';
|
|
20
|
-
|
|
21
|
-
var normalize = function normalize(str) {
|
|
22
|
-
return str.replace(/[^a-z0-9]+/gi, '').toLowerCase();
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
var debug = createDebug('folklore:socket');
|
|
26
|
-
|
|
27
|
-
var Socket =
|
|
28
|
-
/*#__PURE__*/
|
|
29
|
-
function (_EventEmitter) {
|
|
30
|
-
_inherits(Socket, _EventEmitter);
|
|
31
|
-
|
|
32
|
-
_createClass(Socket, null, [{
|
|
33
|
-
key: "getAdapters",
|
|
34
|
-
value: function getAdapters() {
|
|
35
|
-
return Socket.adapters;
|
|
36
|
-
}
|
|
37
|
-
}, {
|
|
38
|
-
key: "getAdapter",
|
|
39
|
-
value: function getAdapter(adapter) {
|
|
40
|
-
// prettier-ignore
|
|
41
|
-
var adapterKey = Object.keys(Socket.adapters).find(function (key) {
|
|
42
|
-
return normalize(key) === normalize(adapter);
|
|
43
|
-
}) || null;
|
|
44
|
-
|
|
45
|
-
if (adapterKey === null) {
|
|
46
|
-
throw new Error("Adapter ".concat(adapter, " not found"));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return Socket.adapters[adapterKey];
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "addAdapter",
|
|
53
|
-
value: function addAdapter(name, adapter) {
|
|
54
|
-
Socket.adapters = _objectSpread({}, Socket.adapters, _defineProperty({}, name, adapter));
|
|
55
|
-
return Socket;
|
|
56
|
-
}
|
|
57
|
-
}, {
|
|
58
|
-
key: "setAdapters",
|
|
59
|
-
value: function setAdapters(adapters) {
|
|
60
|
-
Socket.adapters = adapters;
|
|
61
|
-
return Socket;
|
|
62
|
-
}
|
|
63
|
-
}]);
|
|
64
|
-
|
|
65
|
-
function Socket(opts) {
|
|
66
|
-
var _this;
|
|
67
|
-
|
|
68
|
-
_classCallCheck(this, Socket);
|
|
69
|
-
|
|
70
|
-
_this = _possibleConstructorReturn(this, _getPrototypeOf(Socket).call(this));
|
|
71
|
-
_this.options = _objectSpread({
|
|
72
|
-
adapter: 'pubnub',
|
|
73
|
-
namespace: null,
|
|
74
|
-
uuid: null,
|
|
75
|
-
publishKey: null,
|
|
76
|
-
subscribeKey: null,
|
|
77
|
-
secretKey: null,
|
|
78
|
-
channels: []
|
|
79
|
-
}, opts);
|
|
80
|
-
_this.onAdapterReady = _this.onAdapterReady.bind(_assertThisInitialized(_this));
|
|
81
|
-
_this.onAdapterStart = _this.onAdapterStart.bind(_assertThisInitialized(_this));
|
|
82
|
-
_this.onAdapterStarted = _this.onAdapterStarted.bind(_assertThisInitialized(_this));
|
|
83
|
-
_this.onAdapterMessage = _this.onAdapterMessage.bind(_assertThisInitialized(_this));
|
|
84
|
-
_this.onAdapterStop = _this.onAdapterStop.bind(_assertThisInitialized(_this));
|
|
85
|
-
_this.shouldStart = false;
|
|
86
|
-
_this.started = false;
|
|
87
|
-
_this.starting = false;
|
|
88
|
-
_this.ready = false;
|
|
89
|
-
_this.adapter = null;
|
|
90
|
-
_this.channels = [];
|
|
91
|
-
|
|
92
|
-
_this.init();
|
|
93
|
-
|
|
94
|
-
if (_this.options.channels.length) {
|
|
95
|
-
_this.setChannels(_this.options.channels);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return _this;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
_createClass(Socket, [{
|
|
102
|
-
key: "onAdapterReady",
|
|
103
|
-
value: function onAdapterReady() {
|
|
104
|
-
debug('Adapter ready');
|
|
105
|
-
this.ready = true;
|
|
106
|
-
this.emit('ready');
|
|
107
|
-
|
|
108
|
-
if (this.shouldStart) {
|
|
109
|
-
this.shouldStart = false;
|
|
110
|
-
this.start();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}, {
|
|
114
|
-
key: "onAdapterStart",
|
|
115
|
-
value: function onAdapterStart() {
|
|
116
|
-
debug('Adapter starting...');
|
|
117
|
-
this.starting = true;
|
|
118
|
-
this.started = false;
|
|
119
|
-
this.emit('start');
|
|
120
|
-
}
|
|
121
|
-
}, {
|
|
122
|
-
key: "onAdapterStarted",
|
|
123
|
-
value: function onAdapterStarted() {
|
|
124
|
-
debug('Adapter started');
|
|
125
|
-
this.starting = false;
|
|
126
|
-
this.started = true;
|
|
127
|
-
this.emit('started');
|
|
128
|
-
}
|
|
129
|
-
}, {
|
|
130
|
-
key: "onAdapterStop",
|
|
131
|
-
value: function onAdapterStop() {
|
|
132
|
-
debug('Adapter stopped');
|
|
133
|
-
this.starting = false;
|
|
134
|
-
this.started = false;
|
|
135
|
-
this.emit('stop');
|
|
136
|
-
}
|
|
137
|
-
}, {
|
|
138
|
-
key: "onAdapterMessage",
|
|
139
|
-
value: function onAdapterMessage(message) {
|
|
140
|
-
debug('Adapter message', message);
|
|
141
|
-
this.emit('message', message);
|
|
142
|
-
}
|
|
143
|
-
}, {
|
|
144
|
-
key: "getChannelWithoutNamespace",
|
|
145
|
-
value: function getChannelWithoutNamespace(name) {
|
|
146
|
-
if (this.options.namespace === null) {
|
|
147
|
-
return name;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
var regExp = new RegExp("^".concat(this.options.namespace, ":"));
|
|
151
|
-
return name.replace(regExp, '');
|
|
152
|
-
}
|
|
153
|
-
}, {
|
|
154
|
-
key: "getChannelWithNamespace",
|
|
155
|
-
value: function getChannelWithNamespace(name) {
|
|
156
|
-
var parts = [];
|
|
157
|
-
|
|
158
|
-
if (this.options.namespace !== null) {
|
|
159
|
-
parts.push(this.options.namespace);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
parts.push(name);
|
|
163
|
-
return parts.join(':');
|
|
164
|
-
}
|
|
165
|
-
}, {
|
|
166
|
-
key: "setChannels",
|
|
167
|
-
value: function setChannels(channels) {
|
|
168
|
-
var _this2 = this;
|
|
169
|
-
|
|
170
|
-
var namespacedChannels = channels.map(function (channel) {
|
|
171
|
-
return _this2.getChannelWithNamespace(channel);
|
|
172
|
-
}).sort();
|
|
173
|
-
|
|
174
|
-
if (this.channels.join(',') === namespacedChannels.join(',')) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
debug("Set channels: ".concat(namespacedChannels.join(', ')));
|
|
179
|
-
this.updateChannels(namespacedChannels);
|
|
180
|
-
}
|
|
181
|
-
}, {
|
|
182
|
-
key: "addChannel",
|
|
183
|
-
value: function addChannel(channel) {
|
|
184
|
-
var namespacedChannel = this.getChannelWithNamespace(channel);
|
|
185
|
-
|
|
186
|
-
if (this.channels.indexOf(namespacedChannel) !== -1) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
debug("Adding channel: ".concat(channel));
|
|
191
|
-
this.updateChannels([].concat(_toConsumableArray(this.channels), [namespacedChannel]));
|
|
192
|
-
}
|
|
193
|
-
}, {
|
|
194
|
-
key: "addChannels",
|
|
195
|
-
value: function addChannels(channels) {
|
|
196
|
-
var _this3 = this;
|
|
197
|
-
|
|
198
|
-
var namespacedChannels = channels.map(function (channel) {
|
|
199
|
-
return _this3.getChannelWithNamespace(channel);
|
|
200
|
-
}).sort();
|
|
201
|
-
debug("Adding channels: ".concat(channels.join(',')));
|
|
202
|
-
this.updateChannels([].concat(_toConsumableArray(this.channels), _toConsumableArray(namespacedChannels.filter(function (it) {
|
|
203
|
-
return _this3.channels.indexOf(it) === -1;
|
|
204
|
-
}))));
|
|
205
|
-
}
|
|
206
|
-
}, {
|
|
207
|
-
key: "removeChannel",
|
|
208
|
-
value: function removeChannel(channel) {
|
|
209
|
-
var namespacedChannel = this.getChannelWithNamespace(channel);
|
|
210
|
-
|
|
211
|
-
if (this.channels.indexOf(namespacedChannel) === -1) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
debug("Removing channel: ".concat(channel));
|
|
216
|
-
this.updateChannels(this.channels.filter(function (ch) {
|
|
217
|
-
return ch !== namespacedChannel;
|
|
218
|
-
}));
|
|
219
|
-
}
|
|
220
|
-
}, {
|
|
221
|
-
key: "removeChannels",
|
|
222
|
-
value: function removeChannels(channels) {
|
|
223
|
-
var _this4 = this;
|
|
224
|
-
|
|
225
|
-
var namespacedChannels = channels.map(function (channel) {
|
|
226
|
-
return _this4.getChannelWithNamespace(channel);
|
|
227
|
-
}).sort();
|
|
228
|
-
debug("Removing channels: ".concat(channels.join(',')));
|
|
229
|
-
this.updateChannels(this.channels.filter(function (it) {
|
|
230
|
-
return namespacedChannels.indexOf(it) === -1;
|
|
231
|
-
}));
|
|
232
|
-
}
|
|
233
|
-
}, {
|
|
234
|
-
key: "updateChannels",
|
|
235
|
-
value: function updateChannels(channels) {
|
|
236
|
-
var sortedChannels = channels.sort();
|
|
237
|
-
debug("Updating channels: ".concat(sortedChannels.join(', ')));
|
|
238
|
-
this.channels = _toConsumableArray(sortedChannels);
|
|
239
|
-
|
|
240
|
-
if (this.adapter !== null) {
|
|
241
|
-
this.adapter.updateChannels(sortedChannels);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}, {
|
|
245
|
-
key: "hasChannel",
|
|
246
|
-
value: function hasChannel(channel) {
|
|
247
|
-
var namespacedChannel = this.getChannelWithNamespace(channel);
|
|
248
|
-
return this.channels.reduce(function (found, it) {
|
|
249
|
-
return found || it === namespacedChannel;
|
|
250
|
-
}, false);
|
|
251
|
-
}
|
|
252
|
-
}, {
|
|
253
|
-
key: "getChannels",
|
|
254
|
-
value: function getChannels() {
|
|
255
|
-
var _this5 = this;
|
|
256
|
-
|
|
257
|
-
return this.channels.map(function (channel) {
|
|
258
|
-
return _this5.getChannelWithoutNamespace(channel);
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}, {
|
|
262
|
-
key: "init",
|
|
263
|
-
value: function init() {
|
|
264
|
-
var _this6 = this;
|
|
265
|
-
|
|
266
|
-
var _this$options = this.options,
|
|
267
|
-
adapterKey = _this$options.adapter,
|
|
268
|
-
channels = _this$options.channels,
|
|
269
|
-
adapterOptions = _objectWithoutProperties(_this$options, ["adapter", "channels"]);
|
|
270
|
-
|
|
271
|
-
var SocketAdapter = Socket.getAdapter(adapterKey);
|
|
272
|
-
this.adapter = new SocketAdapter(adapterOptions);
|
|
273
|
-
var methods = ['start', 'stop', 'destroy', 'updateChannels', 'send'];
|
|
274
|
-
methods.forEach(function (method) {
|
|
275
|
-
invariant(isFunction(_this6.adapter[method] || null), "Socket adapter should implement method ".concat(method));
|
|
276
|
-
});
|
|
277
|
-
this.adapter.on('ready', this.onAdapterReady);
|
|
278
|
-
this.adapter.on('start', this.onAdapterStart);
|
|
279
|
-
this.adapter.on('started', this.onAdapterStarted);
|
|
280
|
-
this.adapter.on('message', this.onAdapterMessage);
|
|
281
|
-
this.adapter.on('stop', this.onAdapterStop);
|
|
282
|
-
}
|
|
283
|
-
}, {
|
|
284
|
-
key: "destroy",
|
|
285
|
-
value: function destroy() {
|
|
286
|
-
if (this.adapter !== null) {
|
|
287
|
-
this.adapter.removeAllListeners();
|
|
288
|
-
this.adapter.destroy();
|
|
289
|
-
this.adapter = null;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
this.started = false;
|
|
293
|
-
this.starting = false;
|
|
294
|
-
this.ready = false;
|
|
295
|
-
debug('Destroyed.');
|
|
296
|
-
}
|
|
297
|
-
}, {
|
|
298
|
-
key: "restart",
|
|
299
|
-
value: function restart() {
|
|
300
|
-
this.stop();
|
|
301
|
-
this.start();
|
|
302
|
-
}
|
|
303
|
-
}, {
|
|
304
|
-
key: "start",
|
|
305
|
-
value: function start() {
|
|
306
|
-
var _this7 = this;
|
|
307
|
-
|
|
308
|
-
if (this.started) {
|
|
309
|
-
debug('Skipping start: Already started.');
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
if (this.starting) {
|
|
314
|
-
debug('Skipping start: Already starting.');
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
if (!this.ready) {
|
|
319
|
-
debug('Skipping start: No ready.');
|
|
320
|
-
this.shouldStart = true;
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
this.shouldStart = false;
|
|
325
|
-
debug('Starting on channels:');
|
|
326
|
-
this.channels.forEach(function (channel) {
|
|
327
|
-
debug("- ".concat(_this7.getChannelWithoutNamespace(channel)));
|
|
328
|
-
});
|
|
329
|
-
this.adapter.start();
|
|
330
|
-
}
|
|
331
|
-
}, {
|
|
332
|
-
key: "stop",
|
|
333
|
-
value: function stop() {
|
|
334
|
-
this.shouldStart = false;
|
|
335
|
-
|
|
336
|
-
if (!this.started && !this.starting) {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
debug('Stopping...');
|
|
341
|
-
|
|
342
|
-
if (this.adapter !== null) {
|
|
343
|
-
this.adapter.stop();
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}, {
|
|
347
|
-
key: "send",
|
|
348
|
-
value: function send(data, channel) {
|
|
349
|
-
if (!this.started) {
|
|
350
|
-
debug('Abort sending data: Not started');
|
|
351
|
-
return Promise.reject();
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
var publishData = typeof data.channel !== 'undefined' && typeof data.message !== 'undefined' ? data : {
|
|
355
|
-
channel: typeof channel !== 'undefined' ? this.getChannelWithNamespace(channel) : this.channels,
|
|
356
|
-
message: data
|
|
357
|
-
};
|
|
358
|
-
debug('Sending', publishData);
|
|
359
|
-
return this.adapter.send(publishData);
|
|
360
|
-
}
|
|
361
|
-
}, {
|
|
362
|
-
key: "isStarted",
|
|
363
|
-
value: function isStarted() {
|
|
364
|
-
return this.started;
|
|
365
|
-
}
|
|
366
|
-
}]);
|
|
367
|
-
|
|
368
|
-
return Socket;
|
|
369
|
-
}(EventEmitter);
|
|
370
|
-
|
|
371
|
-
Socket.adapters = _objectSpread({}, SocketAdapters);
|
|
372
|
-
export default Socket;
|