@voicenter-team/events-sdk 0.0.70 → 0.0.72
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/voicenter-events-sdk.cjs.js +15 -3
- package/dist/voicenter-events-sdk.cjs.js.map +1 -1
- package/dist/voicenter-events-sdk.es.js +3857 -1642
- package/dist/voicenter-events-sdk.es.js.map +1 -1
- package/dist/voicenter-events-sdk.iife.js +15 -3
- package/dist/voicenter-events-sdk.iife.js.map +1 -1
- package/dist/voicenter-events-sdk.umd.js +15 -3
- package/dist/voicenter-events-sdk.umd.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Dr=Object.defineProperty;var Pr=(t,e,r)=>e in t?Dr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var K=(t,e,r)=>(Pr(t,typeof e!="symbol"?e+"":e,r),r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Fr=require("ws");function jr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nr={exports:{}},or={exports:{}};(function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(r,n){return r<<n|r>>>32-n},rotr:function(r,n){return r<<32-n|r>>>n},endian:function(r){if(r.constructor==Number)return e.rotl(r,8)&16711935|e.rotl(r,24)&4278255360;for(var n=0;n<r.length;n++)r[n]=e.endian(r[n]);return r},randomBytes:function(r){for(var n=[];r>0;r--)n.push(Math.floor(Math.random()*256));return n},bytesToWords:function(r){for(var n=[],o=0,i=0;o<r.length;o++,i+=8)n[i>>>5]|=r[o]<<24-i%32;return n},wordsToBytes:function(r){for(var n=[],o=0;o<r.length*32;o+=8)n.push(r[o>>>5]>>>24-o%32&255);return n},bytesToHex:function(r){for(var n=[],o=0;o<r.length;o++)n.push((r[o]>>>4).toString(16)),n.push((r[o]&15).toString(16));return n.join("")},hexToBytes:function(r){for(var n=[],o=0;o<r.length;o+=2)n.push(parseInt(r.substr(o,2),16));return n},bytesToBase64:function(r){for(var n=[],o=0;o<r.length;o+=3)for(var i=r[o]<<16|r[o+1]<<8|r[o+2],u=0;u<4;u++)o*8+u*6<=r.length*8?n.push(t.charAt(i>>>6*(3-u)&63)):n.push("=");return n.join("")},base64ToBytes:function(r){r=r.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],o=0,i=0;o<r.length;i=++o%4)i!=0&&n.push((t.indexOf(r.charAt(o-1))&Math.pow(2,-2*i+8)-1)<<i*2|t.indexOf(r.charAt(o))>>>6-i*2);return n}};or.exports=e})();var Mr=or.exports,ue={utf8:{stringToBytes:function(t){return ue.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(ue.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(t.charCodeAt(r)&255);return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}}},Pe=ue;/*!
|
|
2
2
|
* Determine if an object is a Buffer
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
5
|
* @license MIT
|
|
6
|
-
*/var hs=function(t){return t!=null&&(Oe(t)||ps(t)||!!t._isBuffer)};function Oe(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function ps(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Oe(t.slice(0,0))}(function(){var t=cs,e=ie.utf8,s=hs,r=ie.bin,n=function(o,u){o.constructor==String?u&&u.encoding==="binary"?o=r.stringToBytes(o):o=e.stringToBytes(o):s(o)?o=Array.prototype.slice.call(o,0):!Array.isArray(o)&&o.constructor!==Uint8Array&&(o=o.toString());for(var a=t.bytesToWords(o),f=o.length*8,i=1732584193,c=-271733879,l=-1732584194,p=271733878,h=0;h<a.length;h++)a[h]=(a[h]<<8|a[h]>>>24)&16711935|(a[h]<<24|a[h]>>>8)&4278255360;a[f>>>5]|=128<<f%32,a[(f+64>>>9<<4)+14]=f;for(var w=n._ff,S=n._gg,g=n._hh,y=n._ii,h=0;h<a.length;h+=16){var R=i,F=c,d=l,v=p;i=w(i,c,l,p,a[h+0],7,-680876936),p=w(p,i,c,l,a[h+1],12,-389564586),l=w(l,p,i,c,a[h+2],17,606105819),c=w(c,l,p,i,a[h+3],22,-1044525330),i=w(i,c,l,p,a[h+4],7,-176418897),p=w(p,i,c,l,a[h+5],12,1200080426),l=w(l,p,i,c,a[h+6],17,-1473231341),c=w(c,l,p,i,a[h+7],22,-45705983),i=w(i,c,l,p,a[h+8],7,1770035416),p=w(p,i,c,l,a[h+9],12,-1958414417),l=w(l,p,i,c,a[h+10],17,-42063),c=w(c,l,p,i,a[h+11],22,-1990404162),i=w(i,c,l,p,a[h+12],7,1804603682),p=w(p,i,c,l,a[h+13],12,-40341101),l=w(l,p,i,c,a[h+14],17,-1502002290),c=w(c,l,p,i,a[h+15],22,1236535329),i=S(i,c,l,p,a[h+1],5,-165796510),p=S(p,i,c,l,a[h+6],9,-1069501632),l=S(l,p,i,c,a[h+11],14,643717713),c=S(c,l,p,i,a[h+0],20,-373897302),i=S(i,c,l,p,a[h+5],5,-701558691),p=S(p,i,c,l,a[h+10],9,38016083),l=S(l,p,i,c,a[h+15],14,-660478335),c=S(c,l,p,i,a[h+4],20,-405537848),i=S(i,c,l,p,a[h+9],5,568446438),p=S(p,i,c,l,a[h+14],9,-1019803690),l=S(l,p,i,c,a[h+3],14,-187363961),c=S(c,l,p,i,a[h+8],20,1163531501),i=S(i,c,l,p,a[h+13],5,-1444681467),p=S(p,i,c,l,a[h+2],9,-51403784),l=S(l,p,i,c,a[h+7],14,1735328473),c=S(c,l,p,i,a[h+12],20,-1926607734),i=g(i,c,l,p,a[h+5],4,-378558),p=g(p,i,c,l,a[h+8],11,-2022574463),l=g(l,p,i,c,a[h+11],16,1839030562),c=g(c,l,p,i,a[h+14],23,-35309556),i=g(i,c,l,p,a[h+1],4,-1530992060),p=g(p,i,c,l,a[h+4],11,1272893353),l=g(l,p,i,c,a[h+7],16,-155497632),c=g(c,l,p,i,a[h+10],23,-1094730640),i=g(i,c,l,p,a[h+13],4,681279174),p=g(p,i,c,l,a[h+0],11,-358537222),l=g(l,p,i,c,a[h+3],16,-722521979),c=g(c,l,p,i,a[h+6],23,76029189),i=g(i,c,l,p,a[h+9],4,-640364487),p=g(p,i,c,l,a[h+12],11,-421815835),l=g(l,p,i,c,a[h+15],16,530742520),c=g(c,l,p,i,a[h+2],23,-995338651),i=y(i,c,l,p,a[h+0],6,-198630844),p=y(p,i,c,l,a[h+7],10,1126891415),l=y(l,p,i,c,a[h+14],15,-1416354905),c=y(c,l,p,i,a[h+5],21,-57434055),i=y(i,c,l,p,a[h+12],6,1700485571),p=y(p,i,c,l,a[h+3],10,-1894986606),l=y(l,p,i,c,a[h+10],15,-1051523),c=y(c,l,p,i,a[h+1],21,-2054922799),i=y(i,c,l,p,a[h+8],6,1873313359),p=y(p,i,c,l,a[h+15],10,-30611744),l=y(l,p,i,c,a[h+6],15,-1560198380),c=y(c,l,p,i,a[h+13],21,1309151649),i=y(i,c,l,p,a[h+4],6,-145523070),p=y(p,i,c,l,a[h+11],10,-1120210379),l=y(l,p,i,c,a[h+2],15,718787259),c=y(c,l,p,i,a[h+9],21,-343485551),i=i+R>>>0,c=c+F>>>0,l=l+d>>>0,p=p+v>>>0}return t.endian([i,c,l,p])};n._ff=function(o,u,a,f,i,c,l){var p=o+(u&a|~u&f)+(i>>>0)+l;return(p<<c|p>>>32-c)+u},n._gg=function(o,u,a,f,i,c,l){var p=o+(u&f|a&~f)+(i>>>0)+l;return(p<<c|p>>>32-c)+u},n._hh=function(o,u,a,f,i,c,l){var p=o+(u^a^f)+(i>>>0)+l;return(p<<c|p>>>32-c)+u},n._ii=function(o,u,a,f,i,c,l){var p=o+(a^(u|~f))+(i>>>0)+l;return(p<<c|p>>>32-c)+u},n._blocksize=16,n._digestsize=16,Te.exports=function(o,u){if(o==null)throw new Error("Illegal argument "+o);var a=t.wordsToBytes(n(o,u));return u&&u.asBytes?a:u&&u.asString?r.bytesToString(a):t.bytesToHex(a)}})();var ls=Te.exports;const us=as(ls);var st=(t=>(t.MAIN="main",t.NEXT="next",t))(st||{}),G=(t=>(t.USER="User",t.TOKEN="Token",t))(G||{});class lt{static async getSessionStorageDataByKey(e,s=!0){if(typeof chrome<"u"&&typeof chrome.storage<"u"){const r=await chrome.storage.session.get(e);if(r[e])return s?JSON.parse(r[e]):r[e]}if(typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.getItem=="function"){const r=window.sessionStorage.getItem(e);if(r)return s?JSON.parse(r):r}}static async updateSessionStorageKey(e,s){typeof chrome<"u"&&typeof chrome.storage<"u"&&await chrome.storage.session.set({[e]:JSON.stringify(s)}),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.setItem=="function"&&window.sessionStorage.setItem(e,JSON.stringify(s))}static clearSessionStorage(){typeof chrome<"u"&&typeof chrome.storage<"u"&&chrome.storage.session.clear(),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.clear=="function"&&window.sessionStorage.clear()}}var fs=Object.defineProperty,ds=(t,e,s)=>e in t?fs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,_=(t,e,s)=>(ds(t,typeof e!="symbol"?e+"":e,s),s);function gs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ys(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var s=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};s.prototype=e.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}),s}var Mt={exports:{}},vs=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ms=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Ie=function(t){var e=t,s=t.indexOf("["),r=t.indexOf("]");s!=-1&&r!=-1&&(t=t.substring(0,s)+t.substring(s,r).replace(/:/g,";")+t.substring(r,t.length));for(var n=vs.exec(t||""),o={},u=14;u--;)o[ms[u]]=n[u]||"";return s!=-1&&r!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=Cs(o,o.path),o.queryKey=Ss(o,o.query),o};function Cs(t,e){var s=/\/{2,9}/g,r=e.replace(s,"/").split("/");return(e.substr(0,1)=="/"||e.length===0)&&r.splice(0,1),e.substr(e.length-1,1)=="/"&&r.splice(r.length-1,1),r}function Ss(t,e){var s={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,n,o){n&&(s[n]=o)}),s}var jt={exports:{}},qt={exports:{}},ut=1e3,ft=ut*60,dt=ft*60,gt=dt*24,ks=gt*365.25,ws=function(t,e){e=e||{};var s=typeof t;if(s==="string"&&t.length>0)return Es(t);if(s==="number"&&isNaN(t)===!1)return e.long?Ns(t):bs(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Es(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var s=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return s*ks;case"days":case"day":case"d":return s*gt;case"hours":case"hour":case"hrs":case"hr":case"h":return s*dt;case"minutes":case"minute":case"mins":case"min":case"m":return s*ft;case"seconds":case"second":case"secs":case"sec":case"s":return s*ut;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}function bs(t){return t>=gt?Math.round(t/gt)+"d":t>=dt?Math.round(t/dt)+"h":t>=ft?Math.round(t/ft)+"m":t>=ut?Math.round(t/ut)+"s":t+"ms"}function Ns(t){return vt(t,gt,"day")||vt(t,dt,"hour")||vt(t,ft,"minute")||vt(t,ut,"second")||t+" ms"}function vt(t,e,s){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+s:Math.ceil(t/e)+" "+s+"s"}(function(t,e){e=t.exports=r.debug=r.default=r,e.coerce=f,e.disable=u,e.enable=o,e.enabled=a,e.humanize=ws,e.instances=[],e.names=[],e.skips=[],e.formatters={};function s(i){var c=0,l;for(l in i)c=(c<<5)-c+i.charCodeAt(l),c|=0;return e.colors[Math.abs(c)%e.colors.length]}function r(i){var c;function l(){if(l.enabled){var p=l,h=+new Date,w=h-(c||h);p.diff=w,p.prev=c,p.curr=h,c=h;for(var S=new Array(arguments.length),g=0;g<S.length;g++)S[g]=arguments[g];S[0]=e.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");var y=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,function(F,d){if(F==="%%")return F;y++;var v=e.formatters[d];if(typeof v=="function"){var m=S[y];F=v.call(p,m),S.splice(y,1),y--}return F}),e.formatArgs.call(p,S);var R=l.log||e.log||console.log.bind(console);R.apply(p,S)}}return l.namespace=i,l.enabled=e.enabled(i),l.useColors=e.useColors(),l.color=s(i),l.destroy=n,typeof e.init=="function"&&e.init(l),e.instances.push(l),l}function n(){var i=e.instances.indexOf(this);return i!==-1?(e.instances.splice(i,1),!0):!1}function o(i){e.save(i),e.names=[],e.skips=[];var c,l=(typeof i=="string"?i:"").split(/[\s,]+/),p=l.length;for(c=0;c<p;c++)l[c]&&(i=l[c].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.substr(1)+"$")):e.names.push(new RegExp("^"+i+"$")));for(c=0;c<e.instances.length;c++){var h=e.instances[c];h.enabled=e.enabled(h.namespace)}}function u(){e.enable("")}function a(i){if(i[i.length-1]==="*")return!0;var c,l;for(c=0,l=e.skips.length;c<l;c++)if(e.skips[c].test(i))return!1;for(c=0,l=e.names.length;c<l;c++)if(e.names[c].test(i))return!0;return!1}function f(i){return i instanceof Error?i.stack||i.message:i}})(qt,qt.exports);var Ts=qt.exports;(function(t,e){e=t.exports=Ts,e.log=n,e.formatArgs=r,e.save=o,e.load=u,e.useColors=s,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:a(),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"];function s(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function r(f){var i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!!i){var c="color: "+this.color;f.splice(1,0,c,"color: inherit");var l=0,p=0;f[0].replace(/%[a-zA-Z%]/g,function(h){h!=="%%"&&(l++,h==="%c"&&(p=l))}),f.splice(p,0,c)}}function n(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function o(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function u(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(u());function a(){try{return window.localStorage}catch{}}})(jt,jt.exports);var J=jt.exports,As=Ie,ae=J("socket.io-client:url"),Os=Is;function Is(t,e){var s=t;e=e||typeof location<"u"&&location,t==null&&(t=e.protocol+"//"+e.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=e.protocol+t:t=e.host+t),/^(https?|wss?):\/\//.test(t)||(ae("protocol-less url %s",t),typeof e<"u"?t=e.protocol+"//"+t:t="https://"+t),ae("parse %s",t),s=As(t)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";var r=s.host.indexOf(":")!==-1,n=r?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port,s.href=s.protocol+"://"+n+(e&&e.port===s.port?"":":"+s.port),s}var bt={},Le={exports:{}};(function(t){t.exports=e;function e(r){if(r)return s(r)}function s(r){for(var n in e.prototype)r[n]=e.prototype[n];return r}e.prototype.on=e.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this},e.prototype.once=function(r,n){function o(){this.off(r,o),n.apply(this,arguments)}return o.fn=n,this.on(r,o),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var o=this._callbacks["$"+r];if(!o)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var u,a=0;a<o.length;a++)if(u=o[a],u===n||u.fn===n){o.splice(a,1);break}return o.length===0&&delete this._callbacks["$"+r],this},e.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),o=this._callbacks["$"+r],u=1;u<arguments.length;u++)n[u-1]=arguments[u];if(o){o=o.slice(0);for(var u=0,a=o.length;u<a;++u)o[u].apply(this,n)}return this},e.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]},e.prototype.hasListeners=function(r){return!!this.listeners(r).length}})(Le);var at=Le.exports,Nt={},Ls={}.toString,zt=Array.isArray||function(t){return Ls.call(t)=="[object Array]"},Re=Us,Rs=typeof Buffer=="function"&&typeof Buffer.isBuffer=="function",_s=typeof ArrayBuffer=="function",xs=function(t){return typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer};function Us(t){return Rs&&Buffer.isBuffer(t)||_s&&(t instanceof ArrayBuffer||xs(t))}var $t=zt,_e=Re,xe=Object.prototype.toString,Bs=typeof Blob=="function"||typeof Blob<"u"&&xe.call(Blob)==="[object BlobConstructor]",Ds=typeof File=="function"||typeof File<"u"&&xe.call(File)==="[object FileConstructor]";Nt.deconstructPacket=function(t){var e=[],s=t.data,r=t;return r.data=Wt(s,e),r.attachments=e.length,{packet:r,buffers:e}};function Wt(t,e){if(!t)return t;if(_e(t)){var s={_placeholder:!0,num:e.length};return e.push(t),s}else if($t(t)){for(var r=new Array(t.length),n=0;n<t.length;n++)r[n]=Wt(t[n],e);return r}else if(typeof t=="object"&&!(t instanceof Date)){var r={};for(var o in t)r[o]=Wt(t[o],e);return r}return t}Nt.reconstructPacket=function(t,e){return t.data=Kt(t.data,e),t.attachments=void 0,t};function Kt(t,e){if(!t)return t;if(t&&t._placeholder===!0){var s=typeof t.num=="number"&&t.num>=0&&t.num<e.length;if(s)return e[t.num];throw new Error("illegal attachments")}else if($t(t))for(var r=0;r<t.length;r++)t[r]=Kt(t[r],e);else if(typeof t=="object")for(var n in t)t[n]=Kt(t[n],e);return t}Nt.removeBlobs=function(t,e){function s(o,u,a){if(!o)return o;if(Bs&&o instanceof Blob||Ds&&o instanceof File){r++;var f=new FileReader;f.onload=function(){a?a[u]=this.result:n=this.result,--r||e(n)},f.readAsArrayBuffer(o)}else if($t(o))for(var i=0;i<o.length;i++)s(o[i],i,o);else if(typeof o=="object"&&!_e(o))for(var c in o)s(o[c],c,o)}var r=0,n=t;s(n),r||e(n)};(function(t){var e=J("socket.io-parser"),s=at,r=Nt,n=zt,o=Re;t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=u,t.Decoder=l;function u(){}var a=t.ERROR+'"encode error"';u.prototype.encode=function(g,y){if(e("encoding packet %j",g),t.BINARY_EVENT===g.type||t.BINARY_ACK===g.type)c(g,y);else{var R=f(g);y([R])}};function f(g){var y=""+g.type;if((t.BINARY_EVENT===g.type||t.BINARY_ACK===g.type)&&(y+=g.attachments+"-"),g.nsp&&g.nsp!=="/"&&(y+=g.nsp+","),g.id!=null&&(y+=g.id),g.data!=null){var R=i(g.data);if(R!==!1)y+=R;else return a}return e("encoded %j as %s",g,y),y}function i(g){try{return JSON.stringify(g)}catch{return!1}}function c(g,y){function R(F){var d=r.deconstructPacket(F),v=f(d.packet),m=d.buffers;m.unshift(v),y(m)}r.removeBlobs(g,R)}function l(){this.reconstructor=null}s(l.prototype),l.prototype.add=function(g){var y;if(typeof g=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");y=p(g),t.BINARY_EVENT===y.type||t.BINARY_ACK===y.type?(this.reconstructor=new w(y),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",y)):this.emit("decoded",y)}else if(o(g)||g.base64)if(this.reconstructor)y=this.reconstructor.takeBinaryData(g),y&&(this.reconstructor=null,this.emit("decoded",y));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+g)};function p(g){var y=0,R={type:Number(g.charAt(0))};if(t.types[R.type]==null)return S("unknown packet type "+R.type);if(t.BINARY_EVENT===R.type||t.BINARY_ACK===R.type){for(var F=y+1;g.charAt(++y)!=="-"&&y!=g.length;);var d=g.substring(F,y);if(d!=Number(d)||g.charAt(y)!=="-")throw new Error("Illegal attachments");R.attachments=Number(d)}if(g.charAt(y+1)==="/"){for(var F=y+1;++y;){var v=g.charAt(y);if(v===","||y===g.length)break}R.nsp=g.substring(F,y)}else R.nsp="/";var m=g.charAt(y+1);if(m!==""&&Number(m)==m){for(var F=y+1;++y;){var v=g.charAt(y);if(v==null||Number(v)!=v){--y;break}if(y===g.length)break}R.id=Number(g.substring(F,y+1))}if(g.charAt(++y)){var C=h(g.substr(y)),k=C!==!1&&(R.type===t.ERROR||n(C));if(k)R.data=C;else return S("invalid payload")}return e("decoded %s as %j",g,R),R}function h(g){try{return JSON.parse(g)}catch{return!1}}l.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()};function w(g){this.reconPack=g,this.buffers=[]}w.prototype.takeBinaryData=function(g){if(this.buffers.push(g),this.buffers.length===this.reconPack.attachments){var y=r.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),y}return null},w.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};function S(g){return{type:t.ERROR,data:"parser error: "+g}}})(bt);var Xt={exports:{}},Tt={},Gt={exports:{}};try{Gt.exports=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{Gt.exports=!1}var Fs=Gt.exports,Jt=function(){return typeof self<"u"?self:typeof window<"u"?window:Function("return this")()}(),Ps=Fs,Ms=Jt,Yt=function(t){var e=t.xdomain,s=t.xscheme,r=t.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!e||Ps))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!s&&r)return new XDomainRequest}catch{}if(!e)try{return new Ms[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}},Qt={exports:{}},rt={},js=Object.keys||function(t){var e=[],s=Object.prototype.hasOwnProperty;for(var r in t)s.call(t,r)&&e.push(r);return e},It,ce;function Ue(){if(ce)return It;ce=1;var t=zt,e=Object.prototype.toString,s=typeof Blob=="function"||typeof Blob<"u"&&e.call(Blob)==="[object BlobConstructor]",r=typeof File=="function"||typeof File<"u"&&e.call(File)==="[object FileConstructor]";It=n;function n(o){if(!o||typeof o!="object")return!1;if(t(o)){for(var u=0,a=o.length;u<a;u++)if(n(o[u]))return!0;return!1}if(typeof Buffer=="function"&&Buffer.isBuffer&&Buffer.isBuffer(o)||typeof ArrayBuffer=="function"&&o instanceof ArrayBuffer||s&&o instanceof Blob||r&&o instanceof File)return!0;if(o.toJSON&&typeof o.toJSON=="function"&&arguments.length===1)return n(o.toJSON(),!0);for(var f in o)if(Object.prototype.hasOwnProperty.call(o,f)&&n(o[f]))return!0;return!1}return It}var qs=function(t,e,s){var r=t.byteLength;if(e=e||0,s=s||r,t.slice)return t.slice(e,s);if(e<0&&(e+=r),s<0&&(s+=r),s>r&&(s=r),e>=r||e>=s||r===0)return new ArrayBuffer(0);for(var n=new Uint8Array(t),o=new Uint8Array(s-e),u=e,a=0;u<s;u++,a++)o[a]=n[u];return o.buffer},Ws=Ks;function Ks(t,e,s){var r=!1;return s=s||Gs,n.count=t,t===0?e():n;function n(o,u){if(n.count<=0)throw new Error("after called too many times");--n.count,o?(r=!0,e(o),e=s):n.count===0&&!r&&e(null,u)}}function Gs(){}/*! https://mths.be/utf8js v2.1.2 by @mathias */var Z=String.fromCharCode;function Be(t){for(var e=[],s=0,r=t.length,n,o;s<r;)n=t.charCodeAt(s++),n>=55296&&n<=56319&&s<r?(o=t.charCodeAt(s++),(o&64512)==56320?e.push(((n&1023)<<10)+(o&1023)+65536):(e.push(n),s--)):e.push(n);return e}function Hs(t){for(var e=t.length,s=-1,r,n="";++s<e;)r=t[s],r>65535&&(r-=65536,n+=Z(r>>>10&1023|55296),r=56320|r&1023),n+=Z(r);return n}function De(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function Lt(t,e){return Z(t>>e&63|128)}function Vs(t,e){if(!(t&4294967168))return Z(t);var s="";return t&4294965248?t&4294901760?t&4292870144||(s=Z(t>>18&7|240),s+=Lt(t,12),s+=Lt(t,6)):(De(t,e)||(t=65533),s=Z(t>>12&15|224),s+=Lt(t,6)):s=Z(t>>6&31|192),s+=Z(t&63|128),s}function zs(t,e){e=e||{};for(var s=e.strict!==!1,r=Be(t),n=r.length,o=-1,u,a="";++o<n;)u=r[o],a+=Vs(u,s);return a}function nt(){if(tt>=kt)throw Error("Invalid byte index");var t=St[tt]&255;if(tt++,(t&192)==128)return t&63;throw Error("Invalid continuation byte")}function $s(t){var e,s,r,n,o;if(tt>kt)throw Error("Invalid byte index");if(tt==kt)return!1;if(e=St[tt]&255,tt++,!(e&128))return e;if((e&224)==192){if(s=nt(),o=(e&31)<<6|s,o>=128)return o;throw Error("Invalid continuation byte")}if((e&240)==224){if(s=nt(),r=nt(),o=(e&15)<<12|s<<6|r,o>=2048)return De(o,t)?o:65533;throw Error("Invalid continuation byte")}if((e&248)==240&&(s=nt(),r=nt(),n=nt(),o=(e&7)<<18|s<<12|r<<6|n,o>=65536&&o<=1114111))return o;throw Error("Invalid UTF-8 detected")}var St,kt,tt;function Xs(t,e){e=e||{};var s=e.strict!==!1;St=Be(t),kt=St.length,tt=0;for(var r=[],n;(n=$s(s))!==!1;)r.push(n);return Hs(r)}var Js={version:"2.1.2",encode:zs,decode:Xs},Rt={},he;function Ys(){return he||(he=1,function(t){Rt.encode=function(e){var s=new Uint8Array(e),r,n=s.length,o="";for(r=0;r<n;r+=3)o+=t[s[r]>>2],o+=t[(s[r]&3)<<4|s[r+1]>>4],o+=t[(s[r+1]&15)<<2|s[r+2]>>6],o+=t[s[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o},Rt.decode=function(e){var s=e.length*.75,r=e.length,n,o=0,u,a,f,i;e[e.length-1]==="="&&(s--,e[e.length-2]==="="&&s--);var c=new ArrayBuffer(s),l=new Uint8Array(c);for(n=0;n<r;n+=4)u=t.indexOf(e[n]),a=t.indexOf(e[n+1]),f=t.indexOf(e[n+2]),i=t.indexOf(e[n+3]),l[o++]=u<<2|a>>4,l[o++]=(a&15)<<4|f>>2,l[o++]=(f&3)<<6|i&63;return c}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")),Rt}var _t,pe;function Qs(){if(pe)return _t;pe=1;var t=typeof t<"u"?t:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:!1,e=function(){try{var a=new Blob(["hi"]);return a.size===2}catch{return!1}}(),s=e&&function(){try{var a=new Blob([new Uint8Array([1,2])]);return a.size===2}catch{return!1}}(),r=t&&t.prototype.append&&t.prototype.getBlob;function n(a){return a.map(function(f){if(f.buffer instanceof ArrayBuffer){var i=f.buffer;if(f.byteLength!==i.byteLength){var c=new Uint8Array(f.byteLength);c.set(new Uint8Array(i,f.byteOffset,f.byteLength)),i=c.buffer}return i}return f})}function o(a,f){f=f||{};var i=new t;return n(a).forEach(function(c){i.append(c)}),f.type?i.getBlob(f.type):i.getBlob()}function u(a,f){return new Blob(n(a),f||{})}return typeof Blob<"u"&&(o.prototype=Blob.prototype,u.prototype=Blob.prototype),_t=function(){return e?s?Blob:u:r?o:void 0}(),_t}(function(t){var e=js,s=Ue(),r=qs,n=Ws,o=Js,u;typeof ArrayBuffer<"u"&&(u=Ys());var a=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),f=typeof navigator<"u"&&/PhantomJS/i.test(navigator.userAgent),i=a||f;t.protocol=3;var c=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},l=e(c),p={type:"error",data:"parser error"},h=Qs();t.encodePacket=function(d,v,m,C){typeof v=="function"&&(C=v,v=!1),typeof m=="function"&&(C=m,m=null);var k=d.data===void 0?void 0:d.data.buffer||d.data;if(typeof ArrayBuffer<"u"&&k instanceof ArrayBuffer)return S(d,v,C);if(typeof h<"u"&&k instanceof h)return y(d,v,C);if(k&&k.base64)return w(d,C);var E=c[d.type];return d.data!==void 0&&(E+=m?o.encode(String(d.data),{strict:!1}):String(d.data)),C(""+E)};function w(d,v){var m="b"+t.packets[d.type]+d.data.data;return v(m)}function S(d,v,m){if(!v)return t.encodeBase64Packet(d,m);var C=d.data,k=new Uint8Array(C),E=new Uint8Array(1+C.byteLength);E[0]=c[d.type];for(var N=0;N<k.length;N++)E[N+1]=k[N];return m(E.buffer)}function g(d,v,m){if(!v)return t.encodeBase64Packet(d,m);var C=new FileReader;return C.onload=function(){t.encodePacket({type:d.type,data:C.result},v,!0,m)},C.readAsArrayBuffer(d.data)}function y(d,v,m){if(!v)return t.encodeBase64Packet(d,m);if(i)return g(d,v,m);var C=new Uint8Array(1);C[0]=c[d.type];var k=new h([C.buffer,d.data]);return m(k)}t.encodeBase64Packet=function(d,v){var m="b"+t.packets[d.type];if(typeof h<"u"&&d.data instanceof h){var C=new FileReader;return C.onload=function(){var O=C.result.split(",")[1];v(m+O)},C.readAsDataURL(d.data)}var k;try{k=String.fromCharCode.apply(null,new Uint8Array(d.data))}catch{for(var E=new Uint8Array(d.data),N=new Array(E.length),A=0;A<E.length;A++)N[A]=E[A];k=String.fromCharCode.apply(null,N)}return m+=btoa(k),v(m)},t.decodePacket=function(d,v,m){if(d===void 0)return p;if(typeof d=="string"){if(d.charAt(0)==="b")return t.decodeBase64Packet(d.substr(1),v);if(m&&(d=R(d),d===!1))return p;var k=d.charAt(0);return Number(k)!=k||!l[k]?p:d.length>1?{type:l[k],data:d.substring(1)}:{type:l[k]}}var C=new Uint8Array(d),k=C[0],E=r(d,1);return h&&v==="blob"&&(E=new h([E])),{type:l[k],data:E}};function R(d){try{d=o.decode(d,{strict:!1})}catch{return!1}return d}t.decodeBase64Packet=function(d,v){var m=l[d.charAt(0)];if(!u)return{type:m,data:{base64:!0,data:d.substr(1)}};var C=u.decode(d.substr(1));return v==="blob"&&h&&(C=new h([C])),{type:m,data:C}},t.encodePayload=function(d,v,m){typeof v=="function"&&(m=v,v=null);var C=s(d);if(v&&C)return h&&!i?t.encodePayloadAsBlob(d,m):t.encodePayloadAsArrayBuffer(d,m);if(!d.length)return m("0:");function k(N){return N.length+":"+N}function E(N,A){t.encodePacket(N,C?v:!1,!1,function(O){A(null,k(O))})}F(d,E,function(N,A){return m(A.join(""))})};function F(d,v,m){for(var C=new Array(d.length),k=n(d.length,m),E=function(A,O,x){v(O,function(U,K){C[A]=K,x(U,C)})},N=0;N<d.length;N++)E(N,d[N],k)}t.decodePayload=function(d,v,m){if(typeof d!="string")return t.decodePayloadAsBinary(d,v,m);typeof v=="function"&&(m=v,v=null);var C;if(d==="")return m(p,0,1);for(var k="",E,N,A=0,O=d.length;A<O;A++){var x=d.charAt(A);if(x!==":"){k+=x;continue}if(k===""||k!=(E=Number(k))||(N=d.substr(A+1,E),k!=N.length))return m(p,0,1);if(N.length){if(C=t.decodePacket(N,v,!1),p.type===C.type&&p.data===C.data)return m(p,0,1);var U=m(C,A+E,O);if(U===!1)return}A+=E,k=""}if(k!=="")return m(p,0,1)},t.encodePayloadAsArrayBuffer=function(d,v){if(!d.length)return v(new ArrayBuffer(0));function m(C,k){t.encodePacket(C,!0,!0,function(E){return k(null,E)})}F(d,m,function(C,k){var E=k.reduce(function(O,x){var U;return typeof x=="string"?U=x.length:U=x.byteLength,O+U.toString().length+U+2},0),N=new Uint8Array(E),A=0;return k.forEach(function(O){var x=typeof O=="string",U=O;if(x){for(var K=new Uint8Array(O.length),M=0;M<O.length;M++)K[M]=O.charCodeAt(M);U=K.buffer}x?N[A++]=0:N[A++]=1;for(var yt=U.byteLength.toString(),M=0;M<yt.length;M++)N[A++]=parseInt(yt[M]);N[A++]=255;for(var K=new Uint8Array(U),M=0;M<K.length;M++)N[A++]=K[M]}),v(N.buffer)})},t.encodePayloadAsBlob=function(d,v){function m(C,k){t.encodePacket(C,!0,!0,function(E){var N=new Uint8Array(1);if(N[0]=1,typeof E=="string"){for(var A=new Uint8Array(E.length),O=0;O<E.length;O++)A[O]=E.charCodeAt(O);E=A.buffer,N[0]=0}for(var x=E instanceof ArrayBuffer?E.byteLength:E.size,U=x.toString(),K=new Uint8Array(U.length+1),O=0;O<U.length;O++)K[O]=parseInt(U[O]);if(K[U.length]=255,h){var M=new h([N.buffer,K.buffer,E]);k(null,M)}})}F(d,m,function(C,k){return v(new h(k))})},t.decodePayloadAsBinary=function(d,v,m){typeof v=="function"&&(m=v,v=null);for(var C=d,k=[];C.byteLength>0;){for(var E=new Uint8Array(C),N=E[0]===0,A="",O=1;E[O]!==255;O++){if(A.length>310)return m(p,0,1);A+=E[O]}C=r(C,2+A.length),A=parseInt(A);var x=r(C,0,A);if(N)try{x=String.fromCharCode.apply(null,new Uint8Array(x))}catch{var U=new Uint8Array(x);x="";for(var O=0;O<U.length;O++)x+=String.fromCharCode(U[O])}k.push(x),C=r(C,A)}var K=k.length;k.forEach(function(M,yt){m(t.decodePacket(M,v,!0),yt,K)})}})(rt);var xt,le;function Zt(){if(le)return xt;le=1;var t=rt,e=at;xt=s;function s(r){this.path=r.path,this.hostname=r.hostname,this.port=r.port,this.secure=r.secure,this.query=r.query,this.timestampParam=r.timestampParam,this.timestampRequests=r.timestampRequests,this.readyState="",this.agent=r.agent||!1,this.socket=r.socket,this.enablesXDR=r.enablesXDR,this.withCredentials=r.withCredentials,this.pfx=r.pfx,this.key=r.key,this.passphrase=r.passphrase,this.cert=r.cert,this.ca=r.ca,this.ciphers=r.ciphers,this.rejectUnauthorized=r.rejectUnauthorized,this.forceNode=r.forceNode,this.isReactNative=r.isReactNative,this.extraHeaders=r.extraHeaders,this.localAddress=r.localAddress}return e(s.prototype),s.prototype.onError=function(r,n){var o=new Error(r);return o.type="TransportError",o.description=n,this.emit("error",o),this},s.prototype.open=function(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this},s.prototype.close=function(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this},s.prototype.send=function(r){if(this.readyState==="open")this.write(r);else throw new Error("Transport not open")},s.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},s.prototype.onData=function(r){var n=t.decodePacket(r,this.socket.binaryType);this.onPacket(n)},s.prototype.onPacket=function(r){this.emit("packet",r)},s.prototype.onClose=function(){this.readyState="closed",this.emit("close")},xt}var Ut={},ue;function At(){return ue||(ue=1,Ut.encode=function(t){var e="";for(var s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e},Ut.decode=function(t){for(var e={},s=t.split("&"),r=0,n=s.length;r<n;r++){var o=s[r].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}),Ut}var Ot=function(t,e){var s=function(){};s.prototype=e.prototype,t.prototype=new s,t.prototype.constructor=t},Fe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),wt=64,Pe={},fe=0,et=0,de;function Ht(t){var e="";do e=Fe[t%wt]+e,t=Math.floor(t/wt);while(t>0);return e}function Zs(t){var e=0;for(et=0;et<t.length;et++)e=e*wt+Pe[t.charAt(et)];return e}function te(){var t=Ht(+new Date);return t!==de?(fe=0,de=t):t+"."+Ht(fe++)}for(;et<wt;et++)Pe[Fe[et]]=et;te.encode=Ht;te.decode=Zs;var Me=te,je=Zt(),tr=At(),qe=rt,er=Ot,sr=Me,$=J("engine.io-client:polling"),We=X,rr=function(){var t=Yt,e=new t({xdomain:!1});return e.responseType!=null}();function X(t){var e=t&&t.forceBase64;(!rr||e)&&(this.supportsBinary=!1),je.call(this,t)}er(X,je);X.prototype.name="polling";X.prototype.doOpen=function(){this.poll()};X.prototype.pause=function(t){var e=this;this.readyState="pausing";function s(){$("paused"),e.readyState="paused",t()}if(this.polling||!this.writable){var r=0;this.polling&&($("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){$("pre-pause polling complete"),--r||s()})),this.writable||($("we are currently writing - waiting to pause"),r++,this.once("drain",function(){$("pre-pause writing complete"),--r||s()}))}else s()};X.prototype.poll=function(){$("polling"),this.polling=!0,this.doPoll(),this.emit("poll")};X.prototype.onData=function(t){var e=this;$("polling got data %s",t);var s=function(r,n,o){if(e.readyState==="opening"&&r.type==="open"&&e.onOpen(),r.type==="close")return e.onClose(),!1;e.onPacket(r)};qe.decodePayload(t,this.socket.binaryType,s),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():$('ignoring poll - transport state "%s"',this.readyState))};X.prototype.doClose=function(){var t=this;function e(){$("writing close packet"),t.write([{type:"close"}])}this.readyState==="open"?($("transport open - closing"),e()):($("transport not open - deferring close"),this.once("open",e))};X.prototype.write=function(t){var e=this;this.writable=!1;var s=function(){e.writable=!0,e.emit("drain")};qe.encodePayload(t,this.supportsBinary,function(r){e.doWrite(r,s)})};X.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",s="";this.timestampRequests!==!1&&(t[this.timestampParam]=sr()),!this.supportsBinary&&!t.sid&&(t.b64=1),t=tr.encode(t),this.port&&(e==="https"&&Number(this.port)!==443||e==="http"&&Number(this.port)!==80)&&(s=":"+this.port),t.length&&(t="?"+t);var r=this.hostname.indexOf(":")!==-1;return e+"://"+(r?"["+this.hostname+"]":this.hostname)+s+this.path+t};var nr=Yt,Ke=We,or=at,ir=Ot,Vt=J("engine.io-client:polling-xhr"),ar=Jt;Qt.exports=ct;Qt.exports.Request=D;function ge(){}function ct(t){if(Ke.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,typeof location<"u"){var e=location.protocol==="https:",s=location.port;s||(s=e?443:80),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port,this.xs=t.secure!==e}}ir(ct,Ke);ct.prototype.supportsBinary=!0;ct.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.withCredentials=this.withCredentials,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new D(t)};ct.prototype.doWrite=function(t,e){var s=typeof t!="string"&&t!==void 0,r=this.request({method:"POST",data:t,isBinary:s}),n=this;r.on("success",e),r.on("error",function(o){n.onError("xhr post error",o)}),this.sendXhr=r};ct.prototype.doPoll=function(){Vt("xhr poll");var t=this.request(),e=this;t.on("data",function(s){e.onData(s)}),t.on("error",function(s){e.onError("xhr poll error",s)}),this.pollXhr=t};function D(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}or(D.prototype);D.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new nr(t),s=this;try{Vt("xhr open %s: %s",this.method,this.uri),e.open(this.method,this.uri,this.async);try{if(this.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(var r in this.extraHeaders)this.extraHeaders.hasOwnProperty(r)&&e.setRequestHeader(r,this.extraHeaders[r])}}catch{}if(this.method==="POST")try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{e.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in e&&(e.withCredentials=this.withCredentials),this.requestTimeout&&(e.timeout=this.requestTimeout),this.hasXDR()?(e.onload=function(){s.onLoad()},e.onerror=function(){s.onError(e.responseText)}):e.onreadystatechange=function(){if(e.readyState===2)try{var n=e.getResponseHeader("Content-Type");(s.supportsBinary&&n==="application/octet-stream"||n==="application/octet-stream; charset=UTF-8")&&(e.responseType="arraybuffer")}catch{}e.readyState===4&&(e.status===200||e.status===1223?s.onLoad():setTimeout(function(){s.onError(typeof e.status=="number"?e.status:0)},0))},Vt("xhr data %s",this.data),e.send(this.data)}catch(n){setTimeout(function(){s.onError(n)},0);return}typeof document<"u"&&(this.index=D.requestsCount++,D.requests[this.index]=this)};D.prototype.onSuccess=function(){this.emit("success"),this.cleanup()};D.prototype.onData=function(t){this.emit("data",t),this.onSuccess()};D.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)};D.prototype.cleanup=function(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=ge:this.xhr.onreadystatechange=ge,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete D.requests[this.index],this.xhr=null}};D.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch{}e==="application/octet-stream"||e==="application/octet-stream; charset=UTF-8"?t=this.xhr.response||this.xhr.responseText:t=this.xhr.responseText}catch(s){this.onError(s)}t!=null&&this.onData(t)};D.prototype.hasXDR=function(){return typeof XDomainRequest<"u"&&!this.xs&&this.enablesXDR};D.prototype.abort=function(){this.cleanup()};D.requestsCount=0;D.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ye);else if(typeof addEventListener=="function"){var cr="onpagehide"in ar?"pagehide":"unload";addEventListener(cr,ye,!1)}}function ye(){for(var t in D.requests)D.requests.hasOwnProperty(t)&&D.requests[t].abort()}var hr=Qt.exports,ee=We,pr=Ot,ve=Jt,lr=ht,ur=/\n/g,fr=/\\n/g,mt;function dr(){}function ht(t){ee.call(this,t),this.query=this.query||{},mt||(mt=ve.___eio=ve.___eio||[]),this.index=mt.length;var e=this;mt.push(function(s){e.onData(s)}),this.query.j=this.index,typeof addEventListener=="function"&&addEventListener("beforeunload",function(){e.script&&(e.script.onerror=dr)},!1)}pr(ht,ee);ht.prototype.supportsBinary=!1;ht.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),ee.prototype.doClose.call(this)};ht.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(n){t.onError("jsonp poll error",n)};var s=document.getElementsByTagName("script")[0];s?s.parentNode.insertBefore(e,s):(document.head||document.body).appendChild(e),this.script=e;var r=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);r&&setTimeout(function(){var n=document.createElement("iframe");document.body.appendChild(n),document.body.removeChild(n)},100)};ht.prototype.doWrite=function(t,e){var s=this;if(!this.form){var r=document.createElement("form"),n=document.createElement("textarea"),o=this.iframeId="eio_iframe_"+this.index,u;r.className="socketio",r.style.position="absolute",r.style.top="-1000px",r.style.left="-1000px",r.target=o,r.method="POST",r.setAttribute("accept-charset","utf-8"),n.name="d",r.appendChild(n),document.body.appendChild(r),this.form=r,this.area=n}this.form.action=this.uri();function a(){f(),e()}function f(){if(s.iframe)try{s.form.removeChild(s.iframe)}catch(c){s.onError("jsonp polling iframe removal error",c)}try{var i='<iframe src="javascript:0" name="'+s.iframeId+'">';u=document.createElement(i)}catch{u=document.createElement("iframe"),u.name=s.iframeId,u.src="javascript:0"}u.id=s.iframeId,s.form.appendChild(u),s.iframe=u}f(),t=t.replace(fr,`\\
|
|
7
|
-
`),this.area.value=t.replace(ur,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){s.iframe.readyState==="complete"&&a()}:this.iframe.onload=a};const gr={},yr=Object.freeze(Object.defineProperty({__proto__:null,default:gr},Symbol.toStringTag,{value:"Module"})),vr=ys(yr);var se=Zt(),mr=rt,Cr=At(),Sr=Ot,kr=Me,wr=J("engine.io-client:websocket"),Et,re;typeof WebSocket<"u"?Et=WebSocket:typeof self<"u"&&(Et=self.WebSocket||self.MozWebSocket);if(typeof window>"u")try{re=vr}catch{}var it=Et||re,Er=H;function H(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=Et&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(it=re),se.call(this,t)}Sr(H,se);H.prototype.name="websocket";H.prototype.supportsBinary=!0;H.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,s={};this.isReactNative||(s.agent=this.agent,s.perMessageDeflate=this.perMessageDeflate,s.pfx=this.pfx,s.key=this.key,s.passphrase=this.passphrase,s.cert=this.cert,s.ca=this.ca,s.ciphers=this.ciphers,s.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(s.headers=this.extraHeaders),this.localAddress&&(s.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new it(t,e):new it(t):new it(t,e,s)}catch(r){return this.emit("error",r)}this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}};H.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}};H.prototype.write=function(t){var e=this;this.writable=!1;for(var s=t.length,r=0,n=s;r<n;r++)(function(u){mr.encodePacket(u,e.supportsBinary,function(a){if(!e.usingBrowserWebSocket){var f={};if(u.options&&(f.compress=u.options.compress),e.perMessageDeflate){var i=typeof a=="string"?Buffer.byteLength(a):a.length;i<e.perMessageDeflate.threshold&&(f.compress=!1)}}try{e.usingBrowserWebSocket?e.ws.send(a):e.ws.send(a,f)}catch{wr("websocket closed before onclose event")}--s||o()})})(t[r]);function o(){e.emit("flush"),setTimeout(function(){e.writable=!0,e.emit("drain")},0)}};H.prototype.onClose=function(){se.prototype.onClose.call(this)};H.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()};H.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",s="";this.port&&(e==="wss"&&Number(this.port)!==443||e==="ws"&&Number(this.port)!==80)&&(s=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=kr()),this.supportsBinary||(t.b64=1),t=Cr.encode(t),t.length&&(t="?"+t);var r=this.hostname.indexOf(":")!==-1;return e+"://"+(r?"["+this.hostname+"]":this.hostname)+s+this.path+t};H.prototype.check=function(){return!!it&&!("__initialize"in it&&this.name===H.prototype.name)};var br=Yt,Nr=hr,Tr=lr,Ar=Er;Tt.polling=Or;Tt.websocket=Ar;function Or(t){var e,s=!1,r=!1,n=t.jsonp!==!1;if(typeof location<"u"){var o=location.protocol==="https:",u=location.port;u||(u=o?443:80),s=t.hostname!==location.hostname||u!==t.port,r=t.secure!==o}if(t.xdomain=s,t.xscheme=r,e=new br(t),"open"in e&&!t.forceJSONP)return new Nr(t);if(!n)throw new Error("JSONP disabled");return new Tr(t)}var Ir=[].indexOf,Ge=function(t,e){if(Ir)return t.indexOf(e);for(var s=0;s<t.length;++s)if(t[s]===e)return s;return-1},Lr=Tt,Rr=at,B=J("engine.io-client:socket"),_r=Ge,He=rt,me=Ie,xr=At(),Ur=T;function T(t,e){if(!(this instanceof T))return new T(t,e);e=e||{},t&&typeof t=="object"&&(e=t,t=null),t?(t=me(t),e.hostname=t.host,e.secure=t.protocol==="https"||t.protocol==="wss",e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=me(e.host).host),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?443:80),this.query=e.query||{},typeof this.query=="string"&&(this.query=xr.decode(this.query)),this.upgrade=e.upgrade!==!1,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=e.jsonp!==!1,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=e.withCredentials!==!1,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=e.perMessageDeflate!==!1?e.perMessageDeflate||{}:!1,this.perMessageDeflate===!0&&(this.perMessageDeflate={}),this.perMessageDeflate&&this.perMessageDeflate.threshold==null&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||void 0,this.key=e.key||void 0,this.passphrase=e.passphrase||void 0,this.cert=e.cert||void 0,this.ca=e.ca||void 0,this.ciphers=e.ciphers||void 0,this.rejectUnauthorized=e.rejectUnauthorized===void 0?!0:e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",(typeof self>"u"||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}T.priorWebsocketSuccess=!1;Rr(T.prototype);T.protocol=He.protocol;T.Socket=T;T.Transport=Zt();T.transports=Tt;T.parser=rt;T.prototype.createTransport=function(t){B('creating transport "%s"',t);var e=Br(this.query);e.EIO=He.protocol,e.transport=t;var s=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var r=new Lr[t]({query:e,socket:this,agent:s.agent||this.agent,hostname:s.hostname||this.hostname,port:s.port||this.port,secure:s.secure||this.secure,path:s.path||this.path,forceJSONP:s.forceJSONP||this.forceJSONP,jsonp:s.jsonp||this.jsonp,forceBase64:s.forceBase64||this.forceBase64,enablesXDR:s.enablesXDR||this.enablesXDR,withCredentials:s.withCredentials||this.withCredentials,timestampRequests:s.timestampRequests||this.timestampRequests,timestampParam:s.timestampParam||this.timestampParam,policyPort:s.policyPort||this.policyPort,pfx:s.pfx||this.pfx,key:s.key||this.key,passphrase:s.passphrase||this.passphrase,cert:s.cert||this.cert,ca:s.ca||this.ca,ciphers:s.ciphers||this.ciphers,rejectUnauthorized:s.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:s.perMessageDeflate||this.perMessageDeflate,extraHeaders:s.extraHeaders||this.extraHeaders,forceNode:s.forceNode||this.forceNode,localAddress:s.localAddress||this.localAddress,requestTimeout:s.requestTimeout||this.requestTimeout,protocols:s.protocols||void 0,isReactNative:this.isReactNative});return r};function Br(t){var e={};for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s]);return e}T.prototype.open=function(){var t;if(this.rememberUpgrade&&T.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){var e=this;setTimeout(function(){e.emit("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)};T.prototype.setTransport=function(t){B("setting transport %s",t.name);var e=this;this.transport&&(B("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(s){e.onPacket(s)}).on("error",function(s){e.onError(s)}).on("close",function(){e.onClose("transport close")})};T.prototype.probe=function(t){B('probing transport "%s"',t);var e=this.createTransport(t,{probe:1}),s=!1,r=this;T.priorWebsocketSuccess=!1;function n(){if(r.onlyBinaryUpgrades){var l=!this.supportsBinary&&r.transport.supportsBinary;s=s||l}s||(B('probe transport "%s" opened',t),e.send([{type:"ping",data:"probe"}]),e.once("packet",function(p){if(!s)if(p.type==="pong"&&p.data==="probe"){if(B('probe transport "%s" pong',t),r.upgrading=!0,r.emit("upgrading",e),!e)return;T.priorWebsocketSuccess=e.name==="websocket",B('pausing current transport "%s"',r.transport.name),r.transport.pause(function(){s||r.readyState!=="closed"&&(B("changing transport and sending upgrade packet"),c(),r.setTransport(e),e.send([{type:"upgrade"}]),r.emit("upgrade",e),e=null,r.upgrading=!1,r.flush())})}else{B('probe transport "%s" failed',t);var h=new Error("probe error");h.transport=e.name,r.emit("upgradeError",h)}}))}function o(){s||(s=!0,c(),e.close(),e=null)}function u(l){var p=new Error("probe error: "+l);p.transport=e.name,o(),B('probe transport "%s" failed because of error: %s',t,l),r.emit("upgradeError",p)}function a(){u("transport closed")}function f(){u("socket closed")}function i(l){e&&l.name!==e.name&&(B('"%s" works - aborting "%s"',l.name,e.name),o())}function c(){e.removeListener("open",n),e.removeListener("error",u),e.removeListener("close",a),r.removeListener("close",f),r.removeListener("upgrading",i)}e.once("open",n),e.once("error",u),e.once("close",a),this.once("close",f),this.once("upgrading",i),e.open()};T.prototype.onOpen=function(){if(B("socket open"),this.readyState="open",T.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){B("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}};T.prototype.onPacket=function(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(B('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data);break}else B('packet received with socket readyState "%s"',this.readyState)};T.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),this.readyState!=="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))};T.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){e.readyState!=="closed"&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)};T.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){B("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)};T.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})};T.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()};T.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(B("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))};T.prototype.write=T.prototype.send=function(t,e,s){return this.sendPacket("message",t,e,s),this};T.prototype.sendPacket=function(t,e,s,r){if(typeof e=="function"&&(r=e,e=void 0),typeof s=="function"&&(r=s,s=null),!(this.readyState==="closing"||this.readyState==="closed")){s=s||{},s.compress=s.compress!==!1;var n={type:t,data:e,options:s};this.emit("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}};T.prototype.close=function(){if(this.readyState==="opening"||this.readyState==="open"){this.readyState="closing";var t=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?r():e()}):this.upgrading?r():e()}function e(){t.onClose("forced close"),B("socket closing - telling transport to close"),t.transport.close()}function s(){t.removeListener("upgrade",s),t.removeListener("upgradeError",s),e()}function r(){t.once("upgrade",s),t.once("upgradeError",s)}return this};T.prototype.onError=function(t){B("socket error %j",t),T.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)};T.prototype.onClose=function(t,e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){B('socket close with reason: "%s"',t);var s=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),s.writeBuffer=[],s.prevBufferLen=0}};T.prototype.filterUpgrades=function(t){for(var e=[],s=0,r=t.length;s<r;s++)~_r(this.transports,t[s])&&e.push(t[s]);return e};Xt.exports=Ur;Xt.exports.parser=rt;var Dr=Xt.exports,Ce={exports:{}},Bt,Se;function Fr(){if(Se)return Bt;Se=1,Bt=t;function t(e,s){var r=[];s=s||0;for(var n=s||0;n<e.length;n++)r[n-s]=e[n];return r}return Bt}var Ve=Pr;function Pr(t,e,s){return t.on(e,s),{destroy:function(){t.removeListener(e,s)}}}var ke=[].slice,ze=function(t,e){if(typeof e=="string"&&(e=t[e]),typeof e!="function")throw new Error("bind() requires a function");var s=ke.call(arguments,2);return function(){return e.apply(t,s.concat(ke.call(arguments)))}},we;function $e(){return we||(we=1,function(t,e){var s=bt,r=at,n=Fr(),o=Ve,u=ze,a=J("socket.io-client:socket"),f=At(),i=Ue();t.exports=p;var c={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},l=r.prototype.emit;function p(h,w,S){this.io=h,this.nsp=w,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},S&&S.query&&(this.query=S.query),this.io.autoConnect&&this.open()}r(p.prototype),p.prototype.subEvents=function(){if(!this.subs){var h=this.io;this.subs=[o(h,"open",u(this,"onopen")),o(h,"packet",u(this,"onpacket")),o(h,"close",u(this,"onclose"))]}},p.prototype.open=p.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.reconnecting||this.io.open(),this.io.readyState==="open"&&this.onopen(),this.emit("connecting"),this)},p.prototype.send=function(){var h=n(arguments);return h.unshift("message"),this.emit.apply(this,h),this},p.prototype.emit=function(h){if(c.hasOwnProperty(h))return l.apply(this,arguments),this;var w=n(arguments),S={type:(this.flags.binary!==void 0?this.flags.binary:i(w))?s.BINARY_EVENT:s.EVENT,data:w};return S.options={},S.options.compress=!this.flags||this.flags.compress!==!1,typeof w[w.length-1]=="function"&&(a("emitting packet with ack id %d",this.ids),this.acks[this.ids]=w.pop(),S.id=this.ids++),this.connected?this.packet(S):this.sendBuffer.push(S),this.flags={},this},p.prototype.packet=function(h){h.nsp=this.nsp,this.io.packet(h)},p.prototype.onopen=function(){if(a("transport is open - connecting"),this.nsp!=="/")if(this.query){var h=typeof this.query=="object"?f.encode(this.query):this.query;a("sending connect packet with query %s",h),this.packet({type:s.CONNECT,query:h})}else this.packet({type:s.CONNECT})},p.prototype.onclose=function(h){a("close (%s)",h),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",h)},p.prototype.onpacket=function(h){var w=h.nsp===this.nsp,S=h.type===s.ERROR&&h.nsp==="/";if(!(!w&&!S))switch(h.type){case s.CONNECT:this.onconnect();break;case s.EVENT:this.onevent(h);break;case s.BINARY_EVENT:this.onevent(h);break;case s.ACK:this.onack(h);break;case s.BINARY_ACK:this.onack(h);break;case s.DISCONNECT:this.ondisconnect();break;case s.ERROR:this.emit("error",h.data);break}},p.prototype.onevent=function(h){var w=h.data||[];a("emitting event %j",w),h.id!=null&&(a("attaching ack callback to event"),w.push(this.ack(h.id))),this.connected?l.apply(this,w):this.receiveBuffer.push(w)},p.prototype.ack=function(h){var w=this,S=!1;return function(){if(!S){S=!0;var g=n(arguments);a("sending ack %j",g),w.packet({type:i(g)?s.BINARY_ACK:s.ACK,id:h,data:g})}}},p.prototype.onack=function(h){var w=this.acks[h.id];typeof w=="function"?(a("calling ack %s with %j",h.id,h.data),w.apply(this,h.data),delete this.acks[h.id]):a("bad ack %s",h.id)},p.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},p.prototype.emitBuffered=function(){var h;for(h=0;h<this.receiveBuffer.length;h++)l.apply(this,this.receiveBuffer[h]);for(this.receiveBuffer=[],h=0;h<this.sendBuffer.length;h++)this.packet(this.sendBuffer[h]);this.sendBuffer=[]},p.prototype.ondisconnect=function(){a("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},p.prototype.destroy=function(){if(this.subs){for(var h=0;h<this.subs.length;h++)this.subs[h].destroy();this.subs=null}this.io.destroy(this)},p.prototype.close=p.prototype.disconnect=function(){return this.connected&&(a("performing disconnect (%s)",this.nsp),this.packet({type:s.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},p.prototype.compress=function(h){return this.flags.compress=h,this},p.prototype.binary=function(h){return this.flags.binary=h,this}}(Ce)),Ce.exports}var Mr=pt;function pt(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}pt.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+s:t-s}return Math.min(t,this.max)|0};pt.prototype.reset=function(){this.attempts=0};pt.prototype.setMin=function(t){this.ms=t};pt.prototype.setMax=function(t){this.max=t};pt.prototype.setJitter=function(t){this.jitter=t};var jr=Dr,qr=$e(),Wr=at,Kr=bt,Y=Ve,ot=ze,j=J("socket.io-client:manager"),Xe=Ge,Gr=Mr,Je=Object.prototype.hasOwnProperty,Ee=I;function I(t,e){if(!(this instanceof I))return new I(t,e);t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new Gr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var s=e.parser||Kr;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this.autoConnect=e.autoConnect!==!1,this.autoConnect&&this.open()}I.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)Je.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)};I.prototype.updateSocketIds=function(){for(var t in this.nsps)Je.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))};I.prototype.generateId=function(t){return(t==="/"?"":t+"#")+this.engine.id};Wr(I.prototype);I.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection};I.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts};I.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay};I.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor};I.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax};I.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout};I.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()};I.prototype.open=I.prototype.connect=function(t,e){if(j("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;j("opening %s",this.uri),this.engine=jr(this.uri,this.opts);var s=this.engine,r=this;this.readyState="opening",this.skipReconnect=!1;var n=Y(s,"open",function(){r.onopen(),t&&t()}),o=Y(s,"error",function(f){if(j("connect_error"),r.cleanup(),r.readyState="closed",r.emitAll("connect_error",f),t){var i=new Error("Connection error");i.data=f,t(i)}else r.maybeReconnectOnOpen()});if(this._timeout!==!1){var u=this._timeout;j("connect attempt will timeout after %d",u),u===0&&n.destroy();var a=setTimeout(function(){j("connect attempt timed out after %d",u),n.destroy(),s.close(),s.emit("error","timeout"),r.emitAll("connect_timeout",u)},u);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(n),this.subs.push(o),this};I.prototype.onopen=function(){j("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(Y(t,"data",ot(this,"ondata"))),this.subs.push(Y(t,"ping",ot(this,"onping"))),this.subs.push(Y(t,"pong",ot(this,"onpong"))),this.subs.push(Y(t,"error",ot(this,"onerror"))),this.subs.push(Y(t,"close",ot(this,"onclose"))),this.subs.push(Y(this.decoder,"decoded",ot(this,"ondecoded")))};I.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")};I.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)};I.prototype.ondata=function(t){this.decoder.add(t)};I.prototype.ondecoded=function(t){this.emit("packet",t)};I.prototype.onerror=function(t){j("error",t),this.emitAll("error",t)};I.prototype.socket=function(t,e){var s=this.nsps[t];if(!s){s=new qr(this,t,e),this.nsps[t]=s;var r=this;s.on("connecting",n),s.on("connect",function(){s.id=r.generateId(t)}),this.autoConnect&&n()}function n(){~Xe(r.connecting,s)||r.connecting.push(s)}return s};I.prototype.destroy=function(t){var e=Xe(this.connecting,t);~e&&this.connecting.splice(e,1),!this.connecting.length&&this.close()};I.prototype.packet=function(t){j("writing packet %j",t);var e=this;t.query&&t.type===0&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(s){for(var r=0;r<s.length;r++)e.engine.write(s[r],t.options);e.encoding=!1,e.processPacketQueue()}))};I.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}};I.prototype.cleanup=function(){j("cleanup");for(var t=this.subs.length,e=0;e<t;e++){var s=this.subs.shift();s.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()};I.prototype.close=I.prototype.disconnect=function(){j("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()};I.prototype.onclose=function(t){j("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()};I.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)j("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();j("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var s=setTimeout(function(){t.skipReconnect||(j("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),!t.skipReconnect&&t.open(function(r){r?(j("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",r.data)):(j("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(s)}})}};I.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)};(function(t,e){var s=Os,r=bt,n=Ee,o=J("socket.io-client");t.exports=e=a;var u=e.managers={};function a(f,i){typeof f=="object"&&(i=f,f=void 0),i=i||{};var c=s(f),l=c.source,p=c.id,h=c.path,w=u[p]&&h in u[p].nsps,S=i.forceNew||i["force new connection"]||i.multiplex===!1||w,g;return S?(o("ignoring socket cache for %s",l),g=n(l,i)):(u[p]||(o("new io instance for %s",l),u[p]=n(l,i)),g=u[p]),c.query&&!i.query&&(i.query=c.query),g.socket(c.path,i)}e.protocol=r.protocol,e.connect=a,e.Manager=Ee,e.Socket=$e()})(Mt,Mt.exports);var Hr=Mt.exports;const Vr=gs(Hr);let Ct;const zr=new Uint8Array(16);function $r(){if(!Ct&&(Ct=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ct))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ct(zr)}const P=[];for(let t=0;t<256;++t)P.push((t+256).toString(16).slice(1));function Xr(t,e=0){return P[t[e+0]]+P[t[e+1]]+P[t[e+2]]+P[t[e+3]]+"-"+P[t[e+4]]+P[t[e+5]]+"-"+P[t[e+6]]+P[t[e+7]]+"-"+P[t[e+8]]+P[t[e+9]]+"-"+P[t[e+10]]+P[t[e+11]]+P[t[e+12]]+P[t[e+13]]+P[t[e+14]]+P[t[e+15]]}const Jr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),be={randomUUID:Jr};function Yr(t,e,s){if(be.randomUUID&&!e&&!t)return be.randomUUID();t=t||{};const r=t.random||(t.rng||$r)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){s=s||0;for(let n=0;n<16;++n)e[s+n]=r[n];return e}return Xr(r)}function Qr(t,e){const s=e.map(n=>JSON.stringify(n)).join(" "),r=new Date().toISOString();return JSON.stringify({level:t,time:r,message:s})}function Zr(t,e){const s=JSON.parse(t);return e.forEach(r=>delete s[r]),s}function tn(t){if(typeof t=="object"&&t!==null)return t;try{return JSON.parse(t)}catch{return{extraData:t}}}function en(t){const e=/\(([^)]+)\)/,s=t.match(e);if(s&&s[1]){const r=s[1].split(";");for(let n of r)if(n=n.trim(),n.startsWith("Windows")||n.startsWith("Macintosh")||n.startsWith("Linux"))return n}return"Unknown"}function Ne(t){return(...e)=>new Promise((s,r)=>{try{const n=t(...e);s(n)}catch(n){r(n)}})}const sn={reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,upgrade:!1,transports:["websocket"],debug:!1},Dt={logToConsole:!0,overloadGlobalConsole:!1,socketEmitInterval:6e4},V={CREATE:"Create",READ:"Read",UPDATE:"Update",DELETE:"Delete",CONVERT:"Convert",DOWNLOAD:"Download",UPLOAD:"Upload",ENCRYPT:"Encrypt",DECRYPT:"Decrypt",FILTER:"Filter",INPUT:"Input",OUTPUT:"Output",PLUGIN:"Plugin",LOGIN:"Login",LOGOUT:"Logout",REFRESH:"Refresh",CHECK:"Check",WEBHOOK:"Webhook",WSCONNECT:"WSConnect"},rn={Create:1,Read:2,Update:3,Delete:4,Convert:5,Download:6,Upload:7,Encrypt:8,Decrypt:9,Filter:10,Input:11,Output:12,Plugin:13,Login:14,Logout:15,Refresh:16,Check:17,Webhook:18,WSConnect:19},z={INFO:"info",WARNING:"warning",MODIFY:"modify",ERROR:"error",VIEW:"view"},q={INFO:"info",WARNING:"warning",ERROR:"error",DEBUG:"debug"};let W=console;class nn{constructor(e){_(this,"logToConsole"),_(this,"overloadGlobalConsole"),_(this,"system"),_(this,"socketEmitInterval"),_(this,"storageId"),_(this,"emitInProgress"),_(this,"queue"),_(this,"processing"),_(this,"storageInitialized"),_(this,"interval"),_(this,"logIndex"),_(this,"socket"),_(this,"staticObject",{}),_(this,"localObject",{}),_(this,"isGetItemAsync"),_(this,"isSetItemAsync"),_(this,"getItem"),_(this,"setItem"),_(this,"parseLog"),_(this,"_logMethod"),_(this,"_warnMethod"),_(this,"_errorMethod"),_(this,"_debugMethod");const{loggerOptions:s}=e;if(!s.system)throw new Error("Config property 'system' should be provided!");this.isGetItemAsync=s.isGetItemAsync||!1,this.isSetItemAsync=s.isSetItemAsync||!1,this.setupStorageFunctions(s.getItem,s.setItem,s.parseLog),this.system=s.system,this.socketEmitInterval=s.socketEmitInterval||Dt.socketEmitInterval,this.logToConsole=s.logToConsole!==void 0?s.logToConsole:Dt.logToConsole,this.overloadGlobalConsole=s.overloadGlobalConsole!==void 0?s.overloadGlobalConsole:Dt.overloadGlobalConsole,this.storageId=this.getStorageName(),this.queue=[],this.processing=!1,this.storageInitialized=!1,this.emitInProgress=!1,this.logIndex=0,this.init(e)}setupStorageFunctions(e,s,r){this.getItem=e&&typeof e=="function"?this.isGetItemAsync?e:Ne(e):this.defaultGetItemFunction,this.setItem=s&&typeof s=="function"?this.isSetItemAsync?s:Ne(s):this.defaultSetItemFunction,this.parseLog=r&&typeof r=="function"?r:Qr}init(e){const{socket:s,url:r,socketOptions:n={}}=e;this._logMethod=W.log.bind(W),this._warnMethod=W.warn.bind(W),this._errorMethod=W.error.bind(W),this._debugMethod=W.debug.bind(W),this.initStorage().then(()=>{if(s)this.socket=s;else if(r)this.socket=this.createConnection(r,n);else throw new Error("Must provide either a 'socket' or a 'url' for socket connection");this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval),this.overloadGlobalConsole&&this._overloadConsole()})}createConnection(e,s={}){const r={...sn,...s};return Vr(e,r)}async emitLogs(){if(!this.emitInProgress)try{const e=await this.getItem(this.storageId),s=JSON.parse(e||"{}"),r={...this.localObject,...s};if(!Object.keys(r).length)return;const n=[];this.emitInProgress=!0;const o=Object.keys(r);if(!o.length)return;if(!this.socket||!this.socket.connected)throw new Error("Socket is disconnected");for(const f of o){const i=tn(r[f]),c={...this.staticObject,...i},l=this.populateSendingLog(c);await this.socket.emit("Log",JSON.stringify(l)),n.push(f)}const u=await this.getItem(this.storageId);if(!u)return;const a=Zr(u,n);this.localObject={},await this.setItem(this.storageId,JSON.stringify(a))}catch(e){this._errorMethod(e)}finally{this.emitInProgress=!1}}populateSendingLog(e){const s={...e},r=s.ActionName;return r&&(s.ActionID=rn[r]),s}setupStaticFields(e){this.staticObject={...e}}populateMetaData(){const e=new Date;let s;typeof window<"u"&&typeof window.document<"u"?s=window==null?void 0:window.navigator.userAgent:typeof self<"u"&&self.navigator&&(s=self.navigator.userAgent);let r;return s&&(r=en(s)),{System:this.system,DateTime:e,UserAgent:s,OSVersion:r}}async stop(){!this.socket||!this.socket.connected||(clearInterval(this.interval),await this.emitLogs(),this.socket.disconnect())}async start(){this.socket&&this.socket.connected||(this.socket.connect(),this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval))}_overloadConsole(){W=Object.assign(W,{log:e=>{this.log(e)},warn:e=>{this.warn(e)},error:e=>{this.error(e)},debug:e=>{this.debug(e)}})}async initStorage(){const e=await this.getItem(this.storageId);(!e||typeof e!="string")&&(await this.setItem(this.storageId,JSON.stringify({})),this.storageInitialized=!0)}async resetStorage(){await this.setItem(this.storageId,JSON.stringify({}))}getStorageName(){const e=Yr();return this.system.toString().toUpperCase()+e+Date.now()}async processLog(...e){try{if(e.length<2)return;const s=e[0],r=e[1],n=this.formItemKey(s);if(!this.storageInitialized){this.localObject={...this.localObject,[n]:r};return}const o=await this.getItem(this.storageId);if(!o)return;const u=JSON.parse(o);u[n]=JSON.stringify(r),await this.setItem(this.storageId,JSON.stringify(u))}catch(s){this._errorMethod(s)}}async processQueue(){if(this.processing||this.queue.length===0)return;const e=this.queue.shift();e&&(this.processing=!0,await this.processLog(...e).finally(()=>{this.processing=!1,this.processQueue()}))}log(e){const s={...this.populateMetaData(),...e},r=["INFO",s];this.queue.push(r),this.logToConsole&&this._logMethod.apply(W,[s]),this.processQueue()}warn(e){const s=["WARN",e];this.queue.push(s),this.logToConsole&&this._warnMethod.apply(W,[e]),this.processQueue()}error(e){const s=["ERROR",e];this.queue.push(s),this.logToConsole&&this._errorMethod.apply(W,[e]),this.processQueue()}debug(e){const s=["DEBUG",e];this.queue.push(s),this.logToConsole&&this._debugMethod.apply(W,[e]),this.processQueue()}async defaultGetItemFunction(e){return localStorage.getItem(e)}async defaultSetItemFunction(e,s){try{localStorage.setItem(e,s)}catch(r){this._errorMethod(r)}}formItemKey(e){const s=new Date().toISOString();return this.logIndex++,`${e}-${this.system}-${s}-${this.logIndex}`}}class on{constructor(e){L(this,"delay",1e3);L(this,"lastLoginTimestamp");L(this,"token");L(this,"refreshToken");L(this,"tokenExpiry");L(this,"storageKey");this.eventsSdkClass=e,this.eventsSdkClass=e,this.storageKey=""}async login(){const e={token:this.eventsSdkClass.options.token&&this.eventsSdkClass.options.token,email:this.eventsSdkClass.options.email&&this.eventsSdkClass.options.email,password:this.eventsSdkClass.options.password&&this.eventsSdkClass.options.password};if(this.storageKey=us(JSON.stringify({...this.eventsSdkClass.options,loggerSocketConnection:null},this.eventsSdkClass.getCircularReplacer())),this.lastLoginTimestamp&&this.lastLoginTimestamp+this.delay>new Date().getTime())return;this.updateLastLoginTimestamp();const s=await this.checkLoginStatus(this.storageKey);return s||(lt.clearSessionStorage(),await this.userLoginFunction(e,this.storageKey,this.eventsSdkClass.options.loginType))}updateLastLoginTimestamp(){this.lastLoginTimestamp=new Date().getTime()}async checkLoginStatus(e){const s=await lt.getSessionStorageDataByKey(e);if(s)return s}async userLoginFunction(e,s,r){let n,o,u;return this.eventsSdkClass.options.isNewStack?(n=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,r),o=await this.getSettings(n.Data.AccessToken),u={...n.Data,...o}):(n=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,r),u={...n.Data.Socket}),await lt.updateSessionStorageKey(s,u),u}onLoginResponse(e){if(!this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((s,r)=>s.Priority>r.Priority?s:r)),this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((s,r)=>s.Priority>r.Priority?s:r)),e.MonitorList&&e.MonitorList.length&&(this.eventsSdkClass.servers=[...e.MonitorList],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((s,r)=>s.Priority>r.Priority?s:r)),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length&&e.URLList&&(this.eventsSdkClass.URLList=e.URLList),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.URLList.length&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");if(this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");this.eventsSdkClass.server&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${this.eventsSdkClass.server.Version}`),!this.eventsSdkClass.server&&this.eventsSdkClass.URLList.length&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${e.Version}`),e.IdentityCode&&(this.token=e.IdentityCode,this.eventsSdkClass.connect(st.MAIN)),e.Token&&(this.token=e.Token,this.eventsSdkClass.connect(st.MAIN)),e.RefreshToken&&e.IdentityCodeExpiry&&this.eventsSdkClass.options.loginType===G.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.IdentityCodeExpiry,this.handleTokenExpiry()),e.RefreshToken&&e.TokenExpiry&&this.normalizeLoginType(this.eventsSdkClass.options.loginType)===G.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.TokenExpiry,this.handleTokenExpiry())}handleTokenExpiry(){if(!this.eventsSdkClass.options.refreshTokenUrl)throw new Error("refreshTokenUrl not provided");let e;if(this.tokenExpiry)e=new Date(this.tokenExpiry);else return;const s=e.getTime()-new Date().getTime()-5e3,r=Math.min(s,2147483647);setTimeout(async()=>{if(this.refreshToken){this.eventsSdkClass.socketIoClass.closeAllConnections();let n,o;if(this.eventsSdkClass.options.isNewStack){const u=await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken);n=await this.getSettings(u.Data.AccessToken),o={...u.Data,...n}}else o={...(await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken)).Data.Socket};this.onLoginResponse(o),await lt.updateSessionStorageKey(this.storageKey,o)}},r)}async externalLogin(e,{password:s,token:r,email:n},o){if(!e)throw new Error("loginUrl not provided");let u;this.eventsSdkClass.options.isNewStack?o===G.TOKEN?u=JSON.stringify({identityType:G.TOKEN,token:r}):u=JSON.stringify({identityType:G.USER,username:n,password:s}):this.eventsSdkClass.options.loginType===G.TOKEN?(u=JSON.stringify({token:r}),e=`${e}/${G.TOKEN}`):(u=JSON.stringify({email:n,pin:s}),e=`${e}/${G.USER}`);try{const a=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:u});if(!a.ok&&a.status===400)throw new Error("Bad body request. Login type or isNewStack values not correct or not provided");if(!a.ok&&a.status===401)throw new Error("Unauthorized. Invalid token provided");if(!a.ok&&a.status===403)throw new Error("Forbidden. Identity token not provided or not valid");const f=await a.json();if(f.error)throw new Error(f.error);return f}catch(a){throw this.eventsSdkClass.loggerClass.log({Message:`External login request error with the login type ${G} ${o===G.TOKEN?{token:r}:{email:n,pin:s}}`,ActionName:V.WSCONNECT,isShowClient:!1,Status:"External login error",StatusCode:400,Level:q.ERROR,LogType:z.ERROR}),a}}async getSettings(e){try{if(!this.eventsSdkClass.options.getSettingsUrl)throw new Error("getSettingsUrl not provided");const s=await fetch(this.eventsSdkClass.options.getSettingsUrl,{headers:{Authorization:`Bearer ${e}`}});if(!s.ok&&s.status===401)throw new Error("Unauthorized. Access token not provided or not valid");return s.json()}catch(s){throw this.eventsSdkClass.loggerClass.log({Message:`Get settings error with token ${e}, error: ${s}`,ActionName:V.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:q.ERROR,LogType:z.ERROR}),s}}async externalRefreshToken(e,s){try{return(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})).json()}catch(r){throw this.eventsSdkClass.loggerClass.log({Message:`Refresh token error with old refresh token ${s}, url: ${e}, error: ${r}`,ActionName:V.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:q.ERROR,LogType:z.ERROR}),r}}normalizeLoginType(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}}const an={isNewStack:!1,loginUrl:"https://loginapi.voicenter.co.il/monitorAPI/Login",refreshTokenUrl:"https://loginapi.voicenter.co.il/monitorAPI/RefreshIdentityToken",forceNew:!0,reconnectionDelay:1e4,timeout:1e4,keepAliveTimeout:6e4,protocol:"https",useLogger:!0,loggerServer:"https://socketlog.voicenter.co",loggerConfig:{logToConsole:!0,overloadGlobalConsole:!1,system:"events-sdk",socketEmitInterval:1e4},loggerConnectOptions:{reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,perMessageDeflate:void 0,upgrade:!1,transports:["websocket"],debug:!1}};var Ye=(t=>(t.RINGING="Ringing",t.TALKING="Talking",t.DIALING="Dialing",t.HOLD="Hold",t))(Ye||{}),Qe=(t=>(t.INCOMING="Incoming",t.OUTGOING="Outgoing",t))(Qe||{}),Q=(t=>(t.CONNECTED="connected",t.DISCONNECTED="disconnected",t.TRYING_TO_CONNECT="tryingToConnect",t))(Q||{}),Ze=(t=>(t.AUTOMATIC="Automatic",t.IVR="IVR",t))(Ze||{}),ts=(t=>(t.INCOMINC="Incoming",t.OUTGOING="Outgoing",t.SPY="Spy",t.CLICK2CALL="Click2Call",t))(ts||{}),es=(t=>(t.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",t.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",t))(es||{}),b=(t=>(t.ALL_DIALER_STATUS="AllDialersStatus",t.ALL_EXTENSION_STATUS="AllExtensionsStatus",t.ALL_USERS_STATUS="AllUsersStatus",t.CONNECT="connect",t.DISCONNECT="disconnect",t.CONNECT_ERROR_EVENT="connect_error",t.EXTENSION_EVENT="ExtensionEvent",t.KEEP_ALIVE="keepalive",t.KEEP_ALIVE_RESPONSE="keepaliveResponse",t.LOGIN_STATUS="loginStatus",t.LOGIN_SUCCESS="loginSuccess",t.QUEUE_EVENT="QueueEvent",t.ONLINE_STATUS_EVENT="onlineStatusEvent",t.DIALER_EVENT="DialerEvent",t.EXTENSIONS_UPDATED="ExtensionsUpdated",t))(b||{}),ne=(t=>(t.NEWCALL="NEWCALL",t.ANSWER="ANSWER",t.HOLD="HOLD",t.UNHOLD="UNHOLD",t.HANGUP="HANGUP",t.USER_STATUS_UPDATE="userStatusUpdate",t))(ne||{}),ss=(t=>(t.NORMAL_HANGUP="Normal hangup",t.USER_BUSY="User busy",t.CALL_REJECTED="Call Rejected",t.UNALLOCATED_NUMBER="Unallocated (unassigned) number",t.UNKNOWN="Unknown",t.NO_USER_RESPONDING="No user responding",t.USER_ALERTING="User alerting, no answer",t.ANSWERED_ELSEWHERE="Answered elsewhere",t))(ss||{}),rs=(t=>(t.ANSWER="ANSWER",t.ABANDONED="ABANDONED",t.EXIT="EXIT",t.JOIN="JOIN",t))(rs||{});class Ft{static mapExtensionEvent(e){var u,a;const s=e.reason;let r,n;e.data.currentCall&&(n=this.mapExtensionCall(e,e.data.currentCall));const o=this.mapExtensionData(e,e.data);return s===ne.HANGUP?r={...e,reason:s,data:{...o,currentCall:n?{...n,duration:n.callAnswered_UTC_CLIENT?Date.now()-n.callAnswered_UTC_CLIENT:0}:void 0,calls:(u=e.data.calls)==null?void 0:u.map(f=>{const i=this.mapExtensionCall(e,f);return{...i,duration:i.callAnswered_UTC_CLIENT?Date.now()-i.callAnswered_UTC_CLIENT:0}})}}:r={...e,data:{...o,currentCall:n,calls:(a=e.data.calls)==null?void 0:a.map(f=>this.mapExtensionCall(e,f))},reason:s},r}static mapAllExtensionStatus(e){return{...e,extensions:e.extensions.map(s=>{var r;return{...this.mapExtensionData(e,s),currentCall:s.currentCall?this.mapExtensionCall(e,s.currentCall):void 0,calls:(r=s.calls)==null?void 0:r.map(n=>this.mapExtensionCall(e,n))}})}}static mapExtensionData(e,s){return this.configureUTCForObject(s,[{key:"lastAnsweredCallEventEpoch",format:"sec"},{key:"lastCallEventEpoch",format:"sec"},{key:"lastHangupCallEpoch",format:"sec"},{key:"representativeUpdated",format:"ms"}],e.servertime,e.servertimeoffset)}static mapExtensionCall(e,s){return this.configureUTCForObject(s,[{key:"callAnswered",format:"sec"},{key:"callStarted",format:"sec"}],e.servertime,e.servertimeoffset)}static mapQueueEvent(e){var s;return{...e,data:{...e.data,Calls:(s=e.data.Calls)==null?void 0:s.map(r=>this.configureUTCForObject(r,[{key:"JoinTimeStamp",format:"sec"}],e.servertime,e.servertimeoffset))}}}static assignProperty(e,s,r){e[s]=r}static configureUTCForObject(e,s,r,n){const o=(r-n*60)*1e3,u=Date.now()-o,a={};return s.forEach(f=>{const i=e[f.key],c=f.key;if(i!==0&&typeof i=="number"&&!isNaN(i)){let l=i;f.format==="ms"&&(l=Math.floor(l/1e3));const p=(l-n*60)*1e3;this.assignProperty(a,`${c}_UTC`,p),this.assignProperty(a,`${c}_UTC_CLIENT`,p+u)}else this.assignProperty(a,`${c}_UTC`,0),this.assignProperty(a,`${c}_UTC_CLIENT`,0)}),{...e,...a}}}var oe=(t=>(t.UPDATE_MONITORED_EXTENSIONS="updateMonitoredExtensions",t.KEEP_ALIVE="keepAlive",t))(oe||{});class cn{constructor(e){L(this,"io");L(this,"ioFunction");L(this,"lastEventTimestamp",new Date().getTime());L(this,"doReconnect",!0);L(this,"keepAliveInterval");L(this,"keepReconnectInterval");L(this,"connected",!1);this.eventsSdkClass=e,this.eventsSdkClass=e}getSocketIoFunction(e){const s=e.split("v=");"v".concat(s[s.length-1]).replaceAll(".","_"),this.ioFunction=is}initSocketConnection(){const e=this.eventsSdkClass.authClass.token,s=this.eventsSdkClass.options.protocol,r=this.eventsSdkClass.server;try{const n=r?r.Domain:this.eventsSdkClass.URL,o=r?`${s}://${n}`:this.eventsSdkClass.URL;this.eventsSdkClass.eventEmitterClass.emit(b.ONLINE_STATUS_EVENT,{attemptToConnect:o,connectionStatus:Q.TRYING_TO_CONNECT});const u={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:e},timeout:this.eventsSdkClass.options.timeout};if(e&&(u.query={token:e}),this.ioFunction&&o)this.io=this.ioFunction(o,u),this.eventsSdkClass.loggerClass.log({Message:`${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${n}`,ActionName:V.WSCONNECT,isShowClient:!1,Status:"Switching Protocols",StatusCode:101,Level:q.INFO,LogType:z.INFO});else throw new Error("Socket server url no defined")}catch(n){this.eventsSdkClass.loggerClass.log({Message:`${n}`,ActionName:V.WSCONNECT,isShowClient:!1,Status:"Connection error",StatusCode:500,Level:q.ERROR,LogType:z.ERROR})}}clearKeepAliveInterval(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval)}initKeepAlive(){this.clearKeepAliveInterval(),this.keepAliveInterval=setInterval(async()=>{if(new Date().getTime()>this.lastEventTimestamp+this.eventsSdkClass.options.keepAliveTimeout&&this.io&&this.eventsSdkClass.authClass.token){this.eventsSdkClass.emit(oe.KEEP_ALIVE,this.eventsSdkClass.authClass.token),this.eventsSdkClass.loggerClass.log({Message:`Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,ActionName:V.WSCONNECT,isShowClient:!1,Level:q.INFO,LogType:z.INFO});return}},this.eventsSdkClass.options.keepAliveTimeout)}closeAllConnections(){var e;this.io&&(this.io.close(),(e=this.io)==null||e.disconnect(),this.io=void 0),lt.clearSessionStorage()}initSocketEvents(){this.io&&this.io.on(b.LOGIN_SUCCESS,e=>this.onLoginSuccessEvent(e)).on(b.QUEUE_EVENT,e=>this.onQueueEvent(e)).on(b.EXTENSION_EVENT,e=>this.onExtensionEvent(e)).on(b.DIALER_EVENT,e=>this.onDialerEvent(e)).on(b.LOGIN_STATUS,e=>this.onLoginStatusEvent(e)).on(b.ALL_EXTENSION_STATUS,e=>this.onAllExtensionStatus(e)).on(b.ALL_DIALER_STATUS,e=>this.onAllDialerStatus(e)).on(b.KEEP_ALIVE_RESPONSE,e=>this.onKeepAliveResponse(e)).on(b.EXTENSIONS_UPDATED,e=>this.onExtensionsUpdatedEvent(e)).on(b.CONNECT,()=>this.onConnect()).on(b.DISCONNECT,e=>this.onDisconnect(e)).on(b.CONNECT_ERROR_EVENT,e=>this.onConnectError(e))}onLoginSuccessEvent(e){this.eventsSdkClass.eventEmitterClass.emit(b.LOGIN_SUCCESS,e)}onQueueEvent(e){this.eventsSdkClass.eventEmitterClass.emit(b.QUEUE_EVENT,Ft.mapQueueEvent(e))}onExtensionEvent(e){const s=Ft.mapExtensionEvent(e);s&&this.eventsSdkClass.eventEmitterClass.emit(b.EXTENSION_EVENT,s)}onDialerEvent(e){this.eventsSdkClass.eventEmitterClass.emit(b.DIALER_EVENT,e)}onLoginStatusEvent(e){this.eventsSdkClass.eventEmitterClass.emit(b.LOGIN_STATUS,e)}onAllExtensionStatus(e){const s=Ft.mapAllExtensionStatus(e);this.eventsSdkClass.eventEmitterClass.emit(b.ALL_EXTENSION_STATUS,s)}onAllDialerStatus(e){this.eventsSdkClass.eventEmitterClass.emit(b.ALL_DIALER_STATUS,e)}onKeepAliveResponse(e){if(e.errorCode){this.initSocketConnection();return}this.eventsSdkClass.loggerClass.log({Message:`Keep alive response: ${e}`,ActionName:V.WSCONNECT,isShowClient:!1,Status:"Successful",StatusCode:200,Level:q.INFO,LogType:z.INFO}),this.connected?this.lastEventTimestamp=new Date().getTime():this.initSocketConnection()}onExtensionsUpdatedEvent(e){this.eventsSdkClass.eventEmitterClass.emit(b.EXTENSIONS_UPDATED,e)}onConnect(){this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.connected=!0,this.eventsSdkClass.eventEmitterClass.emit(b.ONLINE_STATUS_EVENT,{connectionStatus:Q.CONNECTED}),this.eventsSdkClass.loggerClass.log({Message:`Sdk connected to the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL}`,ActionName:V.WSCONNECT,isShowClient:!1,Status:"Connection established",StatusCode:200,Level:q.INFO,LogType:z.INFO})}onDisconnect(e){this.connected=!1,this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(b.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?Q.TRYING_TO_CONNECT:Q.DISCONNECTED}),this.eventsSdkClass.loggerClass.log({Message:`Sdk disconnected from the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL} (${e})`,ActionName:V.WSCONNECT,isShowClient:!1,Status:"Connection closed",StatusCode:200,Level:q.INFO,LogType:z.INFO}),this.doReconnect&&this.eventsSdkClass.connect(st.NEXT)}onConnectError(e){this.eventsSdkClass.eventEmitterClass.emit(b.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?Q.TRYING_TO_CONNECT:Q.DISCONNECTED}),this.eventsSdkClass.loggerClass.log({Message:`Sdk attempt to connect to the socket server ${this.eventsSdkClass.URL} failed (${e})`,ActionName:V.WSCONNECT,isShowClient:!1,Status:"Connection attempt error",StatusCode:500,Level:q.ERROR,LogType:z.ERROR}),setTimeout(()=>{this.eventsSdkClass.connect(st.NEXT)},this.eventsSdkClass.options.reconnectionDelay)}}class hn{constructor(e){L(this,"storageLogger");this.eventsSdkClass=e,this.eventsSdkClass=e}init(){if(!this.eventsSdkClass.options.useLogger)return;if(this.eventsSdkClass.options.storageLoggerInstance){this.storageLogger=this.eventsSdkClass.options.storageLoggerInstance;return}let e;this.eventsSdkClass.options.loggerSocketConnection&&(e=this.eventsSdkClass.options.loggerSocketConnection),this.eventsSdkClass.socketIoClass.ioFunction&&!e&&(e=this.eventsSdkClass.socketIoClass.ioFunction(this.eventsSdkClass.options.loggerServer,this.eventsSdkClass.options.loggerConnectOptions)),e&&(this.storageLogger=new nn({socket:e,loggerOptions:this.eventsSdkClass.options.loggerConfig}))}stop(){this.storageLogger&&this.storageLogger.stop()}log(e){this.eventsSdkClass.options.useLogger&&(this.storageLogger?e.Level===q.INFO?this.storageLogger.log(e):e.Level===q.ERROR&&this.storageLogger.error(e):e.Level===q.INFO?console.log(e):e.Level===q.ERROR&&console.error(e))}sdkInitializedLog(){const e={...this.eventsSdkClass.options,token:"CENSORED",password:"CENSORED"};this.log({Message:"Sdk initialized with provided options",Body:JSON.stringify(e,this.eventsSdkClass.getCircularReplacer()),ActionName:V.WSCONNECT,isShowClient:!1,Status:"Sdk initialized",StatusCode:200,Level:q.INFO,LogType:z.INFO})}}class pn{constructor(e){L(this,"listeners",{[b.ALL_EXTENSION_STATUS]:[],[b.ALL_DIALER_STATUS]:[],[b.ALL_USERS_STATUS]:[],[b.QUEUE_EVENT]:[],[b.EXTENSION_EVENT]:[],[b.DIALER_EVENT]:[],[b.LOGIN_SUCCESS]:[],[b.LOGIN_STATUS]:[],[b.KEEP_ALIVE_RESPONSE]:[],[b.ONLINE_STATUS_EVENT]:[],[b.EXTENSIONS_UPDATED]:[]});L(this,"allListeners",[]);this.eventsSdkClass=e,this.eventsSdkClass=e}on(e,s){e==="*"?this.allListeners.push(s):this.listeners[e].push(s)}off(e,s){if(e==="*")this.allListeners=this.allListeners.filter(r=>r!==s);else{const n=this.listeners[e].filter(o=>o!==s);this.listeners={...this.listeners,[e]:n}}}emit(e,s){this.eventsSdkClass.socketIoClass.lastEventTimestamp=new Date().getTime(),this.listeners[e].forEach(n=>n({name:e,data:s}));const r={name:e,data:s};this.allListeners.forEach(n=>n(r))}}class ln{constructor(e){L(this,"options");L(this,"servers",[]);L(this,"URLList",[]);L(this,"server");L(this,"URL");L(this,"socket");L(this,"mainServer");L(this,"alreadyAttemptedOtherServers",[]);L(this,"authClass",new on(this));L(this,"socketIoClass",new cn(this));L(this,"loggerClass",new hn(this));L(this,"eventEmitterClass",new pn(this));L(this,"getCircularReplacer",()=>{const e=new WeakSet;return(s,r)=>{if(!(s==="socket"||s==="io"||s==="nsps")){if(typeof r=="object"&&r!==null){if(e.has(r))return;e.add(r)}return r}}});this.options={...an,...e}}on(e,s){this.eventEmitterClass.on(e,s)}emit(e,...s){this.socketIoClass.io&&this.socketIoClass.io.emit(e,...s)}connect(e){e===st.MAIN&&this.findMainServer(),e===st.NEXT&&this.findNextServer(),this.socketIoClass.doReconnect=!0;try{this.loggerClass.init()}catch(s){console.error(s)}this.socketIoClass.initSocketConnection(),this.socketIoClass.initSocketEvents(),this.socketIoClass.initKeepAlive()}disconnect(){this.socketIoClass.doReconnect=!1,this.socketIoClass.closeAllConnections(),this.loggerClass.stop()}clearKeepAliveInterval(){this.socketIoClass.clearKeepAliveInterval()}findMainServer(){this.servers.length?(this.mainServer=this.servers.reduce((e,s)=>s.Priority>e.Priority?s:e),this.server=this.mainServer):this.URLList.length&&(this.URL=this.URLList[0])}findNextServer(){if(this.servers.length&&this.server)if(this.server.Priority===this.mainServer.Priority){let e=this.servers.filter(s=>s.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(s.Priority)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.servers.filter(s=>s.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(s.Priority)+1===0)),e.length&&(this.server=e.reduce((s,r)=>r.Priority>s.Priority?r:s),this.alreadyAttemptedOtherServers.push(this.server.Priority))}else this.server=this.mainServer;else if(this.URLList.length)if(this.URL===this.URLList[0]){let e=this.URLList.filter(s=>s!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(s)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.URLList.filter(s=>s!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(s)+1===0)),e.length&&(this.URL=e[0],this.alreadyAttemptedOtherServers.push(this.URL))}else this.URL=this.URLList[0]}async init(){const e=await this.authClass.login();return e&&this.authClass.onLoginResponse(e),this.loggerClass.sdkInitializedLog(),!0}getCurrentMonitorServer(){return this.server}}exports.CallStatusEnum=Ye;exports.CallTypeEnum=Qe;exports.ConnectionStatusEnum=Q;exports.DialerTypeEnum=Ze;exports.DirectionEnum=ts;exports.DoNotCallMeStatusCodeEnum=es;exports.EventsEnum=b;exports.ExtensionEventReasonEnum=ne;exports.ExtensionHangupCauseEnum=ss;exports.LoginType=G;exports.QueueEventReasonEnum=rs;exports.ServerListenerEventsEnum=oe;exports.default=ln;
|
|
6
|
+
*/var qr=function(t){return t!=null&&(sr(t)||zr(t)||!!t._isBuffer)};function sr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function zr(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&sr(t.slice(0,0))}(function(){var t=Mr,e=Pe.utf8,r=qr,n=Pe.bin,o=function(i,u){i.constructor==String?u&&u.encoding==="binary"?i=n.stringToBytes(i):i=e.stringToBytes(i):r(i)?i=Array.prototype.slice.call(i,0):!Array.isArray(i)&&i.constructor!==Uint8Array&&(i=i.toString());for(var h=t.bytesToWords(i),f=i.length*8,c=1732584193,l=-271733879,p=-1732584194,a=271733878,s=0;s<h.length;s++)h[s]=(h[s]<<8|h[s]>>>24)&16711935|(h[s]<<24|h[s]>>>8)&4278255360;h[f>>>5]|=128<<f%32,h[(f+64>>>9<<4)+14]=f;for(var d=o._ff,y=o._gg,g=o._hh,w=o._ii,s=0;s<h.length;s+=16){var B=c,_=l,b=p,S=a;c=d(c,l,p,a,h[s+0],7,-680876936),a=d(a,c,l,p,h[s+1],12,-389564586),p=d(p,a,c,l,h[s+2],17,606105819),l=d(l,p,a,c,h[s+3],22,-1044525330),c=d(c,l,p,a,h[s+4],7,-176418897),a=d(a,c,l,p,h[s+5],12,1200080426),p=d(p,a,c,l,h[s+6],17,-1473231341),l=d(l,p,a,c,h[s+7],22,-45705983),c=d(c,l,p,a,h[s+8],7,1770035416),a=d(a,c,l,p,h[s+9],12,-1958414417),p=d(p,a,c,l,h[s+10],17,-42063),l=d(l,p,a,c,h[s+11],22,-1990404162),c=d(c,l,p,a,h[s+12],7,1804603682),a=d(a,c,l,p,h[s+13],12,-40341101),p=d(p,a,c,l,h[s+14],17,-1502002290),l=d(l,p,a,c,h[s+15],22,1236535329),c=y(c,l,p,a,h[s+1],5,-165796510),a=y(a,c,l,p,h[s+6],9,-1069501632),p=y(p,a,c,l,h[s+11],14,643717713),l=y(l,p,a,c,h[s+0],20,-373897302),c=y(c,l,p,a,h[s+5],5,-701558691),a=y(a,c,l,p,h[s+10],9,38016083),p=y(p,a,c,l,h[s+15],14,-660478335),l=y(l,p,a,c,h[s+4],20,-405537848),c=y(c,l,p,a,h[s+9],5,568446438),a=y(a,c,l,p,h[s+14],9,-1019803690),p=y(p,a,c,l,h[s+3],14,-187363961),l=y(l,p,a,c,h[s+8],20,1163531501),c=y(c,l,p,a,h[s+13],5,-1444681467),a=y(a,c,l,p,h[s+2],9,-51403784),p=y(p,a,c,l,h[s+7],14,1735328473),l=y(l,p,a,c,h[s+12],20,-1926607734),c=g(c,l,p,a,h[s+5],4,-378558),a=g(a,c,l,p,h[s+8],11,-2022574463),p=g(p,a,c,l,h[s+11],16,1839030562),l=g(l,p,a,c,h[s+14],23,-35309556),c=g(c,l,p,a,h[s+1],4,-1530992060),a=g(a,c,l,p,h[s+4],11,1272893353),p=g(p,a,c,l,h[s+7],16,-155497632),l=g(l,p,a,c,h[s+10],23,-1094730640),c=g(c,l,p,a,h[s+13],4,681279174),a=g(a,c,l,p,h[s+0],11,-358537222),p=g(p,a,c,l,h[s+3],16,-722521979),l=g(l,p,a,c,h[s+6],23,76029189),c=g(c,l,p,a,h[s+9],4,-640364487),a=g(a,c,l,p,h[s+12],11,-421815835),p=g(p,a,c,l,h[s+15],16,530742520),l=g(l,p,a,c,h[s+2],23,-995338651),c=w(c,l,p,a,h[s+0],6,-198630844),a=w(a,c,l,p,h[s+7],10,1126891415),p=w(p,a,c,l,h[s+14],15,-1416354905),l=w(l,p,a,c,h[s+5],21,-57434055),c=w(c,l,p,a,h[s+12],6,1700485571),a=w(a,c,l,p,h[s+3],10,-1894986606),p=w(p,a,c,l,h[s+10],15,-1051523),l=w(l,p,a,c,h[s+1],21,-2054922799),c=w(c,l,p,a,h[s+8],6,1873313359),a=w(a,c,l,p,h[s+15],10,-30611744),p=w(p,a,c,l,h[s+6],15,-1560198380),l=w(l,p,a,c,h[s+13],21,1309151649),c=w(c,l,p,a,h[s+4],6,-145523070),a=w(a,c,l,p,h[s+11],10,-1120210379),p=w(p,a,c,l,h[s+2],15,718787259),l=w(l,p,a,c,h[s+9],21,-343485551),c=c+B>>>0,l=l+_>>>0,p=p+b>>>0,a=a+S>>>0}return t.endian([c,l,p,a])};o._ff=function(i,u,h,f,c,l,p){var a=i+(u&h|~u&f)+(c>>>0)+p;return(a<<l|a>>>32-l)+u},o._gg=function(i,u,h,f,c,l,p){var a=i+(u&f|h&~f)+(c>>>0)+p;return(a<<l|a>>>32-l)+u},o._hh=function(i,u,h,f,c,l,p){var a=i+(u^h^f)+(c>>>0)+p;return(a<<l|a>>>32-l)+u},o._ii=function(i,u,h,f,c,l,p){var a=i+(h^(u|~f))+(c>>>0)+p;return(a<<l|a>>>32-l)+u},o._blocksize=16,o._digestsize=16,nr.exports=function(i,u){if(i==null)throw new Error("Illegal argument "+i);var h=t.wordsToBytes(o(i,u));return u&&u.asBytes?h:u&&u.asString?n.bytesToString(h):t.bytesToHex(h)}})();var Xr=nr.exports;const Wr=jr(Xr);var vt=(t=>(t.MAIN="main",t.NEXT="next",t))(vt||{}),it=(t=>(t.USER="User",t.TOKEN="Token",t))(it||{});class Rt{static async getSessionStorageDataByKey(e,r=!0){if(typeof chrome<"u"&&typeof chrome.storage<"u"){const n=await chrome.storage.session.get(e);if(n[e])return r?JSON.parse(n[e]):n[e]}if(typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.getItem=="function"){const n=window.sessionStorage.getItem(e);if(n)return r?JSON.parse(n):n}}static async updateSessionStorageKey(e,r){typeof chrome<"u"&&typeof chrome.storage<"u"&&await chrome.storage.session.set({[e]:JSON.stringify(r)}),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.setItem=="function"&&window.sessionStorage.setItem(e,JSON.stringify(r))}static clearSessionStorage(){typeof chrome<"u"&&typeof chrome.storage<"u"&&chrome.storage.session.clear(),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.clear=="function"&&window.sessionStorage.clear()}}var Kr=Object.defineProperty,Hr=(t,e,r)=>e in t?Kr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,V=(t,e,r)=>(Hr(t,typeof e!="symbol"?e+"":e,r),r);function Jr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Vr(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}),r}var le={exports:{}},$r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Gr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],ir=function(t){var e=t,r=t.indexOf("["),n=t.indexOf("]");r!=-1&&n!=-1&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));for(var o=$r.exec(t||""),i={},u=14;u--;)i[Gr[u]]=o[u]||"";return r!=-1&&n!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Yr(i,i.path),i.queryKey=Qr(i,i.query),i};function Yr(t,e){var r=/\/{2,9}/g,n=e.replace(r,"/").split("/");return(e.substr(0,1)=="/"||e.length===0)&&n.splice(0,1),e.substr(e.length-1,1)=="/"&&n.splice(n.length-1,1),n}function Qr(t,e){var r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,o,i){o&&(r[o]=i)}),r}var fe={exports:{}},de={exports:{}},It=1e3,Bt=It*60,_t=Bt*60,Lt=_t*24,Zr=Lt*365.25,tn=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return en(t);if(r==="number"&&isNaN(t)===!1)return e.long?nn(t):rn(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function en(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Zr;case"days":case"day":case"d":return r*Lt;case"hours":case"hour":case"hrs":case"hr":case"h":return r*_t;case"minutes":case"minute":case"mins":case"min":case"m":return r*Bt;case"seconds":case"second":case"secs":case"sec":case"s":return r*It;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function rn(t){return t>=Lt?Math.round(t/Lt)+"d":t>=_t?Math.round(t/_t)+"h":t>=Bt?Math.round(t/Bt)+"m":t>=It?Math.round(t/It)+"s":t+"ms"}function nn(t){return Dt(t,Lt,"day")||Dt(t,_t,"hour")||Dt(t,Bt,"minute")||Dt(t,It,"second")||t+" ms"}function Dt(t,e,r){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}(function(t,e){e=t.exports=n.debug=n.default=n,e.coerce=f,e.disable=u,e.enable=i,e.enabled=h,e.humanize=tn,e.instances=[],e.names=[],e.skips=[],e.formatters={};function r(c){var l=0,p;for(p in c)l=(l<<5)-l+c.charCodeAt(p),l|=0;return e.colors[Math.abs(l)%e.colors.length]}function n(c){var l;function p(){if(p.enabled){var a=p,s=+new Date,d=s-(l||s);a.diff=d,a.prev=l,a.curr=s,l=s;for(var y=new Array(arguments.length),g=0;g<y.length;g++)y[g]=arguments[g];y[0]=e.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");var w=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,function(_,b){if(_==="%%")return _;w++;var S=e.formatters[b];if(typeof S=="function"){var m=y[w];_=S.call(a,m),y.splice(w,1),w--}return _}),e.formatArgs.call(a,y);var B=p.log||e.log||console.log.bind(console);B.apply(a,y)}}return p.namespace=c,p.enabled=e.enabled(c),p.useColors=e.useColors(),p.color=r(c),p.destroy=o,typeof e.init=="function"&&e.init(p),e.instances.push(p),p}function o(){var c=e.instances.indexOf(this);return c!==-1?(e.instances.splice(c,1),!0):!1}function i(c){e.save(c),e.names=[],e.skips=[];var l,p=(typeof c=="string"?c:"").split(/[\s,]+/),a=p.length;for(l=0;l<a;l++)p[l]&&(c=p[l].replace(/\*/g,".*?"),c[0]==="-"?e.skips.push(new RegExp("^"+c.substr(1)+"$")):e.names.push(new RegExp("^"+c+"$")));for(l=0;l<e.instances.length;l++){var s=e.instances[l];s.enabled=e.enabled(s.namespace)}}function u(){e.enable("")}function h(c){if(c[c.length-1]==="*")return!0;var l,p;for(l=0,p=e.skips.length;l<p;l++)if(e.skips[l].test(c))return!1;for(l=0,p=e.names.length;l<p;l++)if(e.names[l].test(c))return!0;return!1}function f(c){return c instanceof Error?c.stack||c.message:c}})(de,de.exports);var on=de.exports;(function(t,e){e=t.exports=on,e.log=o,e.formatArgs=n,e.save=i,e.load=u,e.useColors=r,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:h(),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"];function r(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}};function n(f){var c=this.useColors;if(f[0]=(c?"%c":"")+this.namespace+(c?" %c":" ")+f[0]+(c?"%c ":" ")+"+"+e.humanize(this.diff),!!c){var l="color: "+this.color;f.splice(1,0,l,"color: inherit");var p=0,a=0;f[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(p++,s==="%c"&&(a=p))}),f.splice(a,0,l)}}function o(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function i(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function u(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(u());function h(){try{return window.localStorage}catch{}}})(fe,fe.exports);var lt=fe.exports,sn=ir,Fe=lt("socket.io-client:url"),an=cn;function cn(t,e){var r=t;e=e||typeof location<"u"&&location,t==null&&(t=e.protocol+"//"+e.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=e.protocol+t:t=e.host+t),/^(https?|wss?):\/\//.test(t)||(Fe("protocol-less url %s",t),typeof e<"u"?t=e.protocol+"//"+t:t="https://"+t),Fe("parse %s",t),r=sn(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var n=r.host.indexOf(":")!==-1,o=n?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port,r.href=r.protocol+"://"+o+(e&&e.port===r.port?"":":"+r.port),r}var Xt={},ar={exports:{}};(function(t){t.exports=e;function e(n){if(n)return r(n)}function r(n){for(var o in e.prototype)n[o]=e.prototype[o];return n}e.prototype.on=e.prototype.addEventListener=function(n,o){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(o),this},e.prototype.once=function(n,o){function i(){this.off(n,i),o.apply(this,arguments)}return i.fn=o,this.on(n,i),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(n,o){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+n];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var u,h=0;h<i.length;h++)if(u=i[h],u===o||u.fn===o){i.splice(h,1);break}return i.length===0&&delete this._callbacks["$"+n],this},e.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var o=new Array(arguments.length-1),i=this._callbacks["$"+n],u=1;u<arguments.length;u++)o[u-1]=arguments[u];if(i){i=i.slice(0);for(var u=0,h=i.length;u<h;++u)i[u].apply(this,o)}return this},e.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},e.prototype.hasListeners=function(n){return!!this.listeners(n).length}})(ar);var St=ar.exports,Wt={},hn={}.toString,Ce=Array.isArray||function(t){return hn.call(t)=="[object Array]"},cr=fn,pn=typeof Buffer=="function"&&typeof Buffer.isBuffer=="function",un=typeof ArrayBuffer=="function",ln=function(t){return typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer};function fn(t){return pn&&Buffer.isBuffer(t)||un&&(t instanceof ArrayBuffer||ln(t))}var we=Ce,hr=cr,pr=Object.prototype.toString,dn=typeof Blob=="function"||typeof Blob<"u"&&pr.call(Blob)==="[object BlobConstructor]",yn=typeof File=="function"||typeof File<"u"&&pr.call(File)==="[object FileConstructor]";Wt.deconstructPacket=function(t){var e=[],r=t.data,n=t;return n.data=ye(r,e),n.attachments=e.length,{packet:n,buffers:e}};function ye(t,e){if(!t)return t;if(hr(t)){var r={_placeholder:!0,num:e.length};return e.push(t),r}else if(we(t)){for(var n=new Array(t.length),o=0;o<t.length;o++)n[o]=ye(t[o],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){var n={};for(var i in t)n[i]=ye(t[i],e);return n}return t}Wt.reconstructPacket=function(t,e){return t.data=ge(t.data,e),t.attachments=void 0,t};function ge(t,e){if(!t)return t;if(t&&t._placeholder===!0){var r=typeof t.num=="number"&&t.num>=0&&t.num<e.length;if(r)return e[t.num];throw new Error("illegal attachments")}else if(we(t))for(var n=0;n<t.length;n++)t[n]=ge(t[n],e);else if(typeof t=="object")for(var o in t)t[o]=ge(t[o],e);return t}Wt.removeBlobs=function(t,e){function r(i,u,h){if(!i)return i;if(dn&&i instanceof Blob||yn&&i instanceof File){n++;var f=new FileReader;f.onload=function(){h?h[u]=this.result:o=this.result,--n||e(o)},f.readAsArrayBuffer(i)}else if(we(i))for(var c=0;c<i.length;c++)r(i[c],c,i);else if(typeof i=="object"&&!hr(i))for(var l in i)r(i[l],l,i)}var n=0,o=t;r(o),n||e(o)};(function(t){var e=lt("socket.io-parser"),r=St,n=Wt,o=Ce,i=cr;t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=u,t.Decoder=p;function u(){}var h=t.ERROR+'"encode error"';u.prototype.encode=function(g,w){if(e("encoding packet %j",g),t.BINARY_EVENT===g.type||t.BINARY_ACK===g.type)l(g,w);else{var B=f(g);w([B])}};function f(g){var w=""+g.type;if((t.BINARY_EVENT===g.type||t.BINARY_ACK===g.type)&&(w+=g.attachments+"-"),g.nsp&&g.nsp!=="/"&&(w+=g.nsp+","),g.id!=null&&(w+=g.id),g.data!=null){var B=c(g.data);if(B!==!1)w+=B;else return h}return e("encoded %j as %s",g,w),w}function c(g){try{return JSON.stringify(g)}catch{return!1}}function l(g,w){function B(_){var b=n.deconstructPacket(_),S=f(b.packet),m=b.buffers;m.unshift(S),w(m)}n.removeBlobs(g,B)}function p(){this.reconstructor=null}r(p.prototype),p.prototype.add=function(g){var w;if(typeof g=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");w=a(g),t.BINARY_EVENT===w.type||t.BINARY_ACK===w.type?(this.reconstructor=new d(w),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",w)):this.emit("decoded",w)}else if(i(g)||g.base64)if(this.reconstructor)w=this.reconstructor.takeBinaryData(g),w&&(this.reconstructor=null,this.emit("decoded",w));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+g)};function a(g){var w=0,B={type:Number(g.charAt(0))};if(t.types[B.type]==null)return y("unknown packet type "+B.type);if(t.BINARY_EVENT===B.type||t.BINARY_ACK===B.type){for(var _=w+1;g.charAt(++w)!=="-"&&w!=g.length;);var b=g.substring(_,w);if(b!=Number(b)||g.charAt(w)!=="-")throw new Error("Illegal attachments");B.attachments=Number(b)}if(g.charAt(w+1)==="/"){for(var _=w+1;++w;){var S=g.charAt(w);if(S===","||w===g.length)break}B.nsp=g.substring(_,w)}else B.nsp="/";var m=g.charAt(w+1);if(m!==""&&Number(m)==m){for(var _=w+1;++w;){var S=g.charAt(w);if(S==null||Number(S)!=S){--w;break}if(w===g.length)break}B.id=Number(g.substring(_,w+1))}if(g.charAt(++w)){var C=s(g.substr(w)),E=C!==!1&&(B.type===t.ERROR||o(C));if(E)B.data=C;else return y("invalid payload")}return e("decoded %s as %j",g,B),B}function s(g){try{return JSON.parse(g)}catch{return!1}}p.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()};function d(g){this.reconPack=g,this.buffers=[]}d.prototype.takeBinaryData=function(g){if(this.buffers.push(g),this.buffers.length===this.reconPack.attachments){var w=n.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),w}return null},d.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};function y(g){return{type:t.ERROR,data:"parser error: "+g}}})(Xt);var Se={exports:{}},Kt={},me={exports:{}};try{me.exports=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{me.exports=!1}var gn=me.exports,Ee=function(){return typeof self<"u"?self:typeof window<"u"?window:Function("return this")()}(),mn=gn,vn=Ee,Ae=function(t){var e=t.xdomain,r=t.xscheme,n=t.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!e||mn))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!r&&n)return new XDomainRequest}catch{}if(!e)try{return new vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}},Te={exports:{}},kt={},kn=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e},re,je;function ur(){if(je)return re;je=1;var t=Ce,e=Object.prototype.toString,r=typeof Blob=="function"||typeof Blob<"u"&&e.call(Blob)==="[object BlobConstructor]",n=typeof File=="function"||typeof File<"u"&&e.call(File)==="[object FileConstructor]";re=o;function o(i){if(!i||typeof i!="object")return!1;if(t(i)){for(var u=0,h=i.length;u<h;u++)if(o(i[u]))return!0;return!1}if(typeof Buffer=="function"&&Buffer.isBuffer&&Buffer.isBuffer(i)||typeof ArrayBuffer=="function"&&i instanceof ArrayBuffer||r&&i instanceof Blob||n&&i instanceof File)return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return o(i.toJSON(),!0);for(var f in i)if(Object.prototype.hasOwnProperty.call(i,f)&&o(i[f]))return!0;return!1}return re}var bn=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||n===0)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(r-e),u=e,h=0;u<r;u++,h++)i[h]=o[u];return i.buffer},Cn=wn;function wn(t,e,r){var n=!1;return r=r||Sn,o.count=t,t===0?e():o;function o(i,u){if(o.count<=0)throw new Error("after called too many times");--o.count,i?(n=!0,e(i),e=r):o.count===0&&!n&&e(null,u)}}function Sn(){}/*! https://mths.be/utf8js v2.1.2 by @mathias */var yt=String.fromCharCode;function lr(t){for(var e=[],r=0,n=t.length,o,i;r<n;)o=t.charCodeAt(r++),o>=55296&&o<=56319&&r<n?(i=t.charCodeAt(r++),(i&64512)==56320?e.push(((o&1023)<<10)+(i&1023)+65536):(e.push(o),r--)):e.push(o);return e}function En(t){for(var e=t.length,r=-1,n,o="";++r<e;)n=t[r],n>65535&&(n-=65536,o+=yt(n>>>10&1023|55296),n=56320|n&1023),o+=yt(n);return o}function fr(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function ne(t,e){return yt(t>>e&63|128)}function An(t,e){if(!(t&4294967168))return yt(t);var r="";return t&4294965248?t&4294901760?t&4292870144||(r=yt(t>>18&7|240),r+=ne(t,12),r+=ne(t,6)):(fr(t,e)||(t=65533),r=yt(t>>12&15|224),r+=ne(t,6)):r=yt(t>>6&31|192),r+=yt(t&63|128),r}function Tn(t,e){e=e||{};for(var r=e.strict!==!1,n=lr(t),o=n.length,i=-1,u,h="";++i<o;)u=n[i],h+=An(u,r);return h}function bt(){if(gt>=Mt)throw Error("Invalid byte index");var t=jt[gt]&255;if(gt++,(t&192)==128)return t&63;throw Error("Invalid continuation byte")}function Nn(t){var e,r,n,o,i;if(gt>Mt)throw Error("Invalid byte index");if(gt==Mt)return!1;if(e=jt[gt]&255,gt++,!(e&128))return e;if((e&224)==192){if(r=bt(),i=(e&31)<<6|r,i>=128)return i;throw Error("Invalid continuation byte")}if((e&240)==224){if(r=bt(),n=bt(),i=(e&15)<<12|r<<6|n,i>=2048)return fr(i,t)?i:65533;throw Error("Invalid continuation byte")}if((e&248)==240&&(r=bt(),n=bt(),o=bt(),i=(e&7)<<18|r<<12|n<<6|o,i>=65536&&i<=1114111))return i;throw Error("Invalid UTF-8 detected")}var jt,Mt,gt;function On(t,e){e=e||{};var r=e.strict!==!1;jt=lr(t),Mt=jt.length,gt=0;for(var n=[],o;(o=Nn(r))!==!1;)n.push(o);return En(n)}var xn={version:"2.1.2",encode:Tn,decode:On},oe={},Me;function Rn(){return Me||(Me=1,function(t){oe.encode=function(e){var r=new Uint8Array(e),n,o=r.length,i="";for(n=0;n<o;n+=3)i+=t[r[n]>>2],i+=t[(r[n]&3)<<4|r[n+1]>>4],i+=t[(r[n+1]&15)<<2|r[n+2]>>6],i+=t[r[n+2]&63];return o%3===2?i=i.substring(0,i.length-1)+"=":o%3===1&&(i=i.substring(0,i.length-2)+"=="),i},oe.decode=function(e){var r=e.length*.75,n=e.length,o,i=0,u,h,f,c;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);var l=new ArrayBuffer(r),p=new Uint8Array(l);for(o=0;o<n;o+=4)u=t.indexOf(e[o]),h=t.indexOf(e[o+1]),f=t.indexOf(e[o+2]),c=t.indexOf(e[o+3]),p[i++]=u<<2|h>>4,p[i++]=(h&15)<<4|f>>2,p[i++]=(f&3)<<6|c&63;return l}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")),oe}var se,qe;function In(){if(qe)return se;qe=1;var t=typeof t<"u"?t:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:!1,e=function(){try{var h=new Blob(["hi"]);return h.size===2}catch{return!1}}(),r=e&&function(){try{var h=new Blob([new Uint8Array([1,2])]);return h.size===2}catch{return!1}}(),n=t&&t.prototype.append&&t.prototype.getBlob;function o(h){return h.map(function(f){if(f.buffer instanceof ArrayBuffer){var c=f.buffer;if(f.byteLength!==c.byteLength){var l=new Uint8Array(f.byteLength);l.set(new Uint8Array(c,f.byteOffset,f.byteLength)),c=l.buffer}return c}return f})}function i(h,f){f=f||{};var c=new t;return o(h).forEach(function(l){c.append(l)}),f.type?c.getBlob(f.type):c.getBlob()}function u(h,f){return new Blob(o(h),f||{})}return typeof Blob<"u"&&(i.prototype=Blob.prototype,u.prototype=Blob.prototype),se=function(){return e?r?Blob:u:n?i:void 0}(),se}(function(t){var e=kn,r=ur(),n=bn,o=Cn,i=xn,u;typeof ArrayBuffer<"u"&&(u=Rn());var h=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),f=typeof navigator<"u"&&/PhantomJS/i.test(navigator.userAgent),c=h||f;t.protocol=3;var l=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},p=e(l),a={type:"error",data:"parser error"},s=In();t.encodePacket=function(b,S,m,C){typeof S=="function"&&(C=S,S=!1),typeof m=="function"&&(C=m,m=null);var E=b.data===void 0?void 0:b.data.buffer||b.data;if(typeof ArrayBuffer<"u"&&E instanceof ArrayBuffer)return y(b,S,C);if(typeof s<"u"&&E instanceof s)return w(b,S,C);if(E&&E.base64)return d(b,C);var v=l[b.type];return b.data!==void 0&&(v+=m?i.encode(String(b.data),{strict:!1}):String(b.data)),C(""+v)};function d(b,S){var m="b"+t.packets[b.type]+b.data.data;return S(m)}function y(b,S,m){if(!S)return t.encodeBase64Packet(b,m);var C=b.data,E=new Uint8Array(C),v=new Uint8Array(1+C.byteLength);v[0]=l[b.type];for(var k=0;k<E.length;k++)v[k+1]=E[k];return m(v.buffer)}function g(b,S,m){if(!S)return t.encodeBase64Packet(b,m);var C=new FileReader;return C.onload=function(){t.encodePacket({type:b.type,data:C.result},S,!0,m)},C.readAsArrayBuffer(b.data)}function w(b,S,m){if(!S)return t.encodeBase64Packet(b,m);if(c)return g(b,S,m);var C=new Uint8Array(1);C[0]=l[b.type];var E=new s([C.buffer,b.data]);return m(E)}t.encodeBase64Packet=function(b,S){var m="b"+t.packets[b.type];if(typeof s<"u"&&b.data instanceof s){var C=new FileReader;return C.onload=function(){var O=C.result.split(",")[1];S(m+O)},C.readAsDataURL(b.data)}var E;try{E=String.fromCharCode.apply(null,new Uint8Array(b.data))}catch{for(var v=new Uint8Array(b.data),k=new Array(v.length),T=0;T<v.length;T++)k[T]=v[T];E=String.fromCharCode.apply(null,k)}return m+=btoa(E),S(m)},t.decodePacket=function(b,S,m){if(b===void 0)return a;if(typeof b=="string"){if(b.charAt(0)==="b")return t.decodeBase64Packet(b.substr(1),S);if(m&&(b=B(b),b===!1))return a;var E=b.charAt(0);return Number(E)!=E||!p[E]?a:b.length>1?{type:p[E],data:b.substring(1)}:{type:p[E]}}var C=new Uint8Array(b),E=C[0],v=n(b,1);return s&&S==="blob"&&(v=new s([v])),{type:p[E],data:v}};function B(b){try{b=i.decode(b,{strict:!1})}catch{return!1}return b}t.decodeBase64Packet=function(b,S){var m=p[b.charAt(0)];if(!u)return{type:m,data:{base64:!0,data:b.substr(1)}};var C=u.decode(b.substr(1));return S==="blob"&&s&&(C=new s([C])),{type:m,data:C}},t.encodePayload=function(b,S,m){typeof S=="function"&&(m=S,S=null);var C=r(b);if(S&&C)return s&&!c?t.encodePayloadAsBlob(b,m):t.encodePayloadAsArrayBuffer(b,m);if(!b.length)return m("0:");function E(k){return k.length+":"+k}function v(k,T){t.encodePacket(k,C?S:!1,!1,function(O){T(null,E(O))})}_(b,v,function(k,T){return m(T.join(""))})};function _(b,S,m){for(var C=new Array(b.length),E=o(b.length,m),v=function(T,O,x){S(O,function(A,q){C[T]=q,x(A,C)})},k=0;k<b.length;k++)v(k,b[k],E)}t.decodePayload=function(b,S,m){if(typeof b!="string")return t.decodePayloadAsBinary(b,S,m);typeof S=="function"&&(m=S,S=null);var C;if(b==="")return m(a,0,1);for(var E="",v,k,T=0,O=b.length;T<O;T++){var x=b.charAt(T);if(x!==":"){E+=x;continue}if(E===""||E!=(v=Number(E))||(k=b.substr(T+1,v),E!=k.length))return m(a,0,1);if(k.length){if(C=t.decodePacket(k,S,!1),a.type===C.type&&a.data===C.data)return m(a,0,1);var A=m(C,T+v,O);if(A===!1)return}T+=v,E=""}if(E!=="")return m(a,0,1)},t.encodePayloadAsArrayBuffer=function(b,S){if(!b.length)return S(new ArrayBuffer(0));function m(C,E){t.encodePacket(C,!0,!0,function(v){return E(null,v)})}_(b,m,function(C,E){var v=E.reduce(function(O,x){var A;return typeof x=="string"?A=x.length:A=x.byteLength,O+A.toString().length+A+2},0),k=new Uint8Array(v),T=0;return E.forEach(function(O){var x=typeof O=="string",A=O;if(x){for(var q=new Uint8Array(O.length),j=0;j<O.length;j++)q[j]=O.charCodeAt(j);A=q.buffer}x?k[T++]=0:k[T++]=1;for(var $=A.byteLength.toString(),j=0;j<$.length;j++)k[T++]=parseInt($[j]);k[T++]=255;for(var q=new Uint8Array(A),j=0;j<q.length;j++)k[T++]=q[j]}),S(k.buffer)})},t.encodePayloadAsBlob=function(b,S){function m(C,E){t.encodePacket(C,!0,!0,function(v){var k=new Uint8Array(1);if(k[0]=1,typeof v=="string"){for(var T=new Uint8Array(v.length),O=0;O<v.length;O++)T[O]=v.charCodeAt(O);v=T.buffer,k[0]=0}for(var x=v instanceof ArrayBuffer?v.byteLength:v.size,A=x.toString(),q=new Uint8Array(A.length+1),O=0;O<A.length;O++)q[O]=parseInt(A[O]);if(q[A.length]=255,s){var j=new s([k.buffer,q.buffer,v]);E(null,j)}})}_(b,m,function(C,E){return S(new s(E))})},t.decodePayloadAsBinary=function(b,S,m){typeof S=="function"&&(m=S,S=null);for(var C=b,E=[];C.byteLength>0;){for(var v=new Uint8Array(C),k=v[0]===0,T="",O=1;v[O]!==255;O++){if(T.length>310)return m(a,0,1);T+=v[O]}C=n(C,2+T.length),T=parseInt(T);var x=n(C,0,T);if(k)try{x=String.fromCharCode.apply(null,new Uint8Array(x))}catch{var A=new Uint8Array(x);x="";for(var O=0;O<A.length;O++)x+=String.fromCharCode(A[O])}E.push(x),C=n(C,T)}var q=E.length;E.forEach(function(j,$){m(t.decodePacket(j,S,!0),$,q)})}})(kt);var ie,ze;function Ne(){if(ze)return ie;ze=1;var t=kt,e=St;ie=r;function r(n){this.path=n.path,this.hostname=n.hostname,this.port=n.port,this.secure=n.secure,this.query=n.query,this.timestampParam=n.timestampParam,this.timestampRequests=n.timestampRequests,this.readyState="",this.agent=n.agent||!1,this.socket=n.socket,this.enablesXDR=n.enablesXDR,this.withCredentials=n.withCredentials,this.pfx=n.pfx,this.key=n.key,this.passphrase=n.passphrase,this.cert=n.cert,this.ca=n.ca,this.ciphers=n.ciphers,this.rejectUnauthorized=n.rejectUnauthorized,this.forceNode=n.forceNode,this.isReactNative=n.isReactNative,this.extraHeaders=n.extraHeaders,this.localAddress=n.localAddress}return e(r.prototype),r.prototype.onError=function(n,o){var i=new Error(n);return i.type="TransportError",i.description=o,this.emit("error",i),this},r.prototype.open=function(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this},r.prototype.send=function(n){if(this.readyState==="open")this.write(n);else throw new Error("Transport not open")},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(n){var o=t.decodePacket(n,this.socket.binaryType);this.onPacket(o)},r.prototype.onPacket=function(n){this.emit("packet",n)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")},ie}var ae={},Xe;function Ht(){return Xe||(Xe=1,ae.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},ae.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}),ae}var Jt=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},dr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),qt=64,yr={},We=0,mt=0,Ke;function ve(t){var e="";do e=dr[t%qt]+e,t=Math.floor(t/qt);while(t>0);return e}function Bn(t){var e=0;for(mt=0;mt<t.length;mt++)e=e*qt+yr[t.charAt(mt)];return e}function Oe(){var t=ve(+new Date);return t!==Ke?(We=0,Ke=t):t+"."+ve(We++)}for(;mt<qt;mt++)yr[dr[mt]]=mt;Oe.encode=ve;Oe.decode=Bn;var gr=Oe,mr=Ne(),_n=Ht(),vr=kt,Ln=Jt,Un=gr,ht=lt("engine.io-client:polling"),kr=pt,Dn=function(){var t=Ae,e=new t({xdomain:!1});return e.responseType!=null}();function pt(t){var e=t&&t.forceBase64;(!Dn||e)&&(this.supportsBinary=!1),mr.call(this,t)}Ln(pt,mr);pt.prototype.name="polling";pt.prototype.doOpen=function(){this.poll()};pt.prototype.pause=function(t){var e=this;this.readyState="pausing";function r(){ht("paused"),e.readyState="paused",t()}if(this.polling||!this.writable){var n=0;this.polling&&(ht("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){ht("pre-pause polling complete"),--n||r()})),this.writable||(ht("we are currently writing - waiting to pause"),n++,this.once("drain",function(){ht("pre-pause writing complete"),--n||r()}))}else r()};pt.prototype.poll=function(){ht("polling"),this.polling=!0,this.doPoll(),this.emit("poll")};pt.prototype.onData=function(t){var e=this;ht("polling got data %s",t);var r=function(n,o,i){if(e.readyState==="opening"&&n.type==="open"&&e.onOpen(),n.type==="close")return e.onClose(),!1;e.onPacket(n)};vr.decodePayload(t,this.socket.binaryType,r),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():ht('ignoring poll - transport state "%s"',this.readyState))};pt.prototype.doClose=function(){var t=this;function e(){ht("writing close packet"),t.write([{type:"close"}])}this.readyState==="open"?(ht("transport open - closing"),e()):(ht("transport not open - deferring close"),this.once("open",e))};pt.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")};vr.encodePayload(t,this.supportsBinary,function(n){e.doWrite(n,r)})};pt.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";this.timestampRequests!==!1&&(t[this.timestampParam]=Un()),!this.supportsBinary&&!t.sid&&(t.b64=1),t=_n.encode(t),this.port&&(e==="https"&&Number(this.port)!==443||e==="http"&&Number(this.port)!==80)&&(r=":"+this.port),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t};var Pn=Ae,br=kr,Fn=St,jn=Jt,ke=lt("engine.io-client:polling-xhr"),Mn=Ee;Te.exports=Et;Te.exports.Request=Y;function He(){}function Et(t){if(br.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,typeof location<"u"){var e=location.protocol==="https:",r=location.port;r||(r=e?443:80),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port,this.xs=t.secure!==e}}jn(Et,br);Et.prototype.supportsBinary=!0;Et.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.withCredentials=this.withCredentials,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new Y(t)};Et.prototype.doWrite=function(t,e){var r=typeof t!="string"&&t!==void 0,n=this.request({method:"POST",data:t,isBinary:r}),o=this;n.on("success",e),n.on("error",function(i){o.onError("xhr post error",i)}),this.sendXhr=n};Et.prototype.doPoll=function(){ke("xhr poll");var t=this.request(),e=this;t.on("data",function(r){e.onData(r)}),t.on("error",function(r){e.onError("xhr poll error",r)}),this.pollXhr=t};function Y(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}Fn(Y.prototype);Y.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new Pn(t),r=this;try{ke("xhr open %s: %s",this.method,this.uri),e.open(this.method,this.uri,this.async);try{if(this.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(var n in this.extraHeaders)this.extraHeaders.hasOwnProperty(n)&&e.setRequestHeader(n,this.extraHeaders[n])}}catch{}if(this.method==="POST")try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{e.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in e&&(e.withCredentials=this.withCredentials),this.requestTimeout&&(e.timeout=this.requestTimeout),this.hasXDR()?(e.onload=function(){r.onLoad()},e.onerror=function(){r.onError(e.responseText)}):e.onreadystatechange=function(){if(e.readyState===2)try{var o=e.getResponseHeader("Content-Type");(r.supportsBinary&&o==="application/octet-stream"||o==="application/octet-stream; charset=UTF-8")&&(e.responseType="arraybuffer")}catch{}e.readyState===4&&(e.status===200||e.status===1223?r.onLoad():setTimeout(function(){r.onError(typeof e.status=="number"?e.status:0)},0))},ke("xhr data %s",this.data),e.send(this.data)}catch(o){setTimeout(function(){r.onError(o)},0);return}typeof document<"u"&&(this.index=Y.requestsCount++,Y.requests[this.index]=this)};Y.prototype.onSuccess=function(){this.emit("success"),this.cleanup()};Y.prototype.onData=function(t){this.emit("data",t),this.onSuccess()};Y.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)};Y.prototype.cleanup=function(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=He:this.xhr.onreadystatechange=He,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Y.requests[this.index],this.xhr=null}};Y.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch{}e==="application/octet-stream"||e==="application/octet-stream; charset=UTF-8"?t=this.xhr.response||this.xhr.responseText:t=this.xhr.responseText}catch(r){this.onError(r)}t!=null&&this.onData(t)};Y.prototype.hasXDR=function(){return typeof XDomainRequest<"u"&&!this.xs&&this.enablesXDR};Y.prototype.abort=function(){this.cleanup()};Y.requestsCount=0;Y.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Je);else if(typeof addEventListener=="function"){var qn="onpagehide"in Mn?"pagehide":"unload";addEventListener(qn,Je,!1)}}function Je(){for(var t in Y.requests)Y.requests.hasOwnProperty(t)&&Y.requests[t].abort()}var zn=Te.exports,xe=kr,Xn=Jt,Ve=Ee,Wn=At,Kn=/\n/g,Hn=/\\n/g,Pt;function Jn(){}function At(t){xe.call(this,t),this.query=this.query||{},Pt||(Pt=Ve.___eio=Ve.___eio||[]),this.index=Pt.length;var e=this;Pt.push(function(r){e.onData(r)}),this.query.j=this.index,typeof addEventListener=="function"&&addEventListener("beforeunload",function(){e.script&&(e.script.onerror=Jn)},!1)}Xn(At,xe);At.prototype.supportsBinary=!1;At.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),xe.prototype.doClose.call(this)};At.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(o){t.onError("jsonp poll error",o)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e;var n=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var o=document.createElement("iframe");document.body.appendChild(o),document.body.removeChild(o)},100)};At.prototype.doWrite=function(t,e){var r=this;if(!this.form){var n=document.createElement("form"),o=document.createElement("textarea"),i=this.iframeId="eio_iframe_"+this.index,u;n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=i,n.method="POST",n.setAttribute("accept-charset","utf-8"),o.name="d",n.appendChild(o),document.body.appendChild(n),this.form=n,this.area=o}this.form.action=this.uri();function h(){f(),e()}function f(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(l){r.onError("jsonp polling iframe removal error",l)}try{var c='<iframe src="javascript:0" name="'+r.iframeId+'">';u=document.createElement(c)}catch{u=document.createElement("iframe"),u.name=r.iframeId,u.src="javascript:0"}u.id=r.iframeId,r.form.appendChild(u),r.iframe=u}f(),t=t.replace(Hn,`\\
|
|
7
|
+
`),this.area.value=t.replace(Kn,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){r.iframe.readyState==="complete"&&h()}:this.iframe.onload=h};const Vn={},$n=Object.freeze(Object.defineProperty({__proto__:null,default:Vn},Symbol.toStringTag,{value:"Module"})),Gn=Vr($n);var Re=Ne(),Yn=kt,Qn=Ht(),Zn=Jt,to=gr,eo=lt("engine.io-client:websocket"),zt,Ie;typeof WebSocket<"u"?zt=WebSocket:typeof self<"u"&&(zt=self.WebSocket||self.MozWebSocket);if(typeof window>"u")try{Ie=Gn}catch{}var wt=zt||Ie,ro=st;function st(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=zt&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(wt=Ie),Re.call(this,t)}Zn(st,Re);st.prototype.name="websocket";st.prototype.supportsBinary=!0;st.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,r={};this.isReactNative||(r.agent=this.agent,r.perMessageDeflate=this.perMessageDeflate,r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new wt(t,e):new wt(t):new wt(t,e,r)}catch(n){return this.emit("error",n)}this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}};st.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}};st.prototype.write=function(t){var e=this;this.writable=!1;for(var r=t.length,n=0,o=r;n<o;n++)(function(u){Yn.encodePacket(u,e.supportsBinary,function(h){if(!e.usingBrowserWebSocket){var f={};if(u.options&&(f.compress=u.options.compress),e.perMessageDeflate){var c=typeof h=="string"?Buffer.byteLength(h):h.length;c<e.perMessageDeflate.threshold&&(f.compress=!1)}}try{e.usingBrowserWebSocket?e.ws.send(h):e.ws.send(h,f)}catch{eo("websocket closed before onclose event")}--r||i()})})(t[n]);function i(){e.emit("flush"),setTimeout(function(){e.writable=!0,e.emit("drain")},0)}};st.prototype.onClose=function(){Re.prototype.onClose.call(this)};st.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()};st.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";this.port&&(e==="wss"&&Number(this.port)!==443||e==="ws"&&Number(this.port)!==80)&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=to()),this.supportsBinary||(t.b64=1),t=Qn.encode(t),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t};st.prototype.check=function(){return!!wt&&!("__initialize"in wt&&this.name===st.prototype.name)};var no=Ae,oo=zn,so=Wn,io=ro;Kt.polling=ao;Kt.websocket=io;function ao(t){var e,r=!1,n=!1,o=t.jsonp!==!1;if(typeof location<"u"){var i=location.protocol==="https:",u=location.port;u||(u=i?443:80),r=t.hostname!==location.hostname||u!==t.port,n=t.secure!==i}if(t.xdomain=r,t.xscheme=n,e=new no(t),"open"in e&&!t.forceJSONP)return new oo(t);if(!o)throw new Error("JSONP disabled");return new so(t)}var co=[].indexOf,Cr=function(t,e){if(co)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1},ho=Kt,po=St,G=lt("engine.io-client:socket"),uo=Cr,wr=kt,$e=ir,lo=Ht(),fo=W;function W(t,e){if(!(this instanceof W))return new W(t,e);e=e||{},t&&typeof t=="object"&&(e=t,t=null),t?(t=$e(t),e.hostname=t.host,e.secure=t.protocol==="https"||t.protocol==="wss",e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=$e(e.host).host),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?443:80),this.query=e.query||{},typeof this.query=="string"&&(this.query=lo.decode(this.query)),this.upgrade=e.upgrade!==!1,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=e.jsonp!==!1,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=e.withCredentials!==!1,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=e.perMessageDeflate!==!1?e.perMessageDeflate||{}:!1,this.perMessageDeflate===!0&&(this.perMessageDeflate={}),this.perMessageDeflate&&this.perMessageDeflate.threshold==null&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||void 0,this.key=e.key||void 0,this.passphrase=e.passphrase||void 0,this.cert=e.cert||void 0,this.ca=e.ca||void 0,this.ciphers=e.ciphers||void 0,this.rejectUnauthorized=e.rejectUnauthorized===void 0?!0:e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",(typeof self>"u"||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}W.priorWebsocketSuccess=!1;po(W.prototype);W.protocol=wr.protocol;W.Socket=W;W.Transport=Ne();W.transports=Kt;W.parser=kt;W.prototype.createTransport=function(t){G('creating transport "%s"',t);var e=yo(this.query);e.EIO=wr.protocol,e.transport=t;var r=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var n=new ho[t]({query:e,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,withCredentials:r.withCredentials||this.withCredentials,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0,isReactNative:this.isReactNative});return n};function yo(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}W.prototype.open=function(){var t;if(this.rememberUpgrade&&W.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){var e=this;setTimeout(function(){e.emit("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)};W.prototype.setTransport=function(t){G("setting transport %s",t.name);var e=this;this.transport&&(G("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(r){e.onPacket(r)}).on("error",function(r){e.onError(r)}).on("close",function(){e.onClose("transport close")})};W.prototype.probe=function(t){G('probing transport "%s"',t);var e=this.createTransport(t,{probe:1}),r=!1,n=this;W.priorWebsocketSuccess=!1;function o(){if(n.onlyBinaryUpgrades){var p=!this.supportsBinary&&n.transport.supportsBinary;r=r||p}r||(G('probe transport "%s" opened',t),e.send([{type:"ping",data:"probe"}]),e.once("packet",function(a){if(!r)if(a.type==="pong"&&a.data==="probe"){if(G('probe transport "%s" pong',t),n.upgrading=!0,n.emit("upgrading",e),!e)return;W.priorWebsocketSuccess=e.name==="websocket",G('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||n.readyState!=="closed"&&(G("changing transport and sending upgrade packet"),l(),n.setTransport(e),e.send([{type:"upgrade"}]),n.emit("upgrade",e),e=null,n.upgrading=!1,n.flush())})}else{G('probe transport "%s" failed',t);var s=new Error("probe error");s.transport=e.name,n.emit("upgradeError",s)}}))}function i(){r||(r=!0,l(),e.close(),e=null)}function u(p){var a=new Error("probe error: "+p);a.transport=e.name,i(),G('probe transport "%s" failed because of error: %s',t,p),n.emit("upgradeError",a)}function h(){u("transport closed")}function f(){u("socket closed")}function c(p){e&&p.name!==e.name&&(G('"%s" works - aborting "%s"',p.name,e.name),i())}function l(){e.removeListener("open",o),e.removeListener("error",u),e.removeListener("close",h),n.removeListener("close",f),n.removeListener("upgrading",c)}e.once("open",o),e.once("error",u),e.once("close",h),this.once("close",f),this.once("upgrading",c),e.open()};W.prototype.onOpen=function(){if(G("socket open"),this.readyState="open",W.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){G("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}};W.prototype.onPacket=function(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(G('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data);break}else G('packet received with socket readyState "%s"',this.readyState)};W.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),this.readyState!=="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))};W.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){e.readyState!=="closed"&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)};W.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){G("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)};W.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})};W.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()};W.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(G("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))};W.prototype.write=W.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this};W.prototype.sendPacket=function(t,e,r,n){if(typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=null),!(this.readyState==="closing"||this.readyState==="closed")){r=r||{},r.compress=r.compress!==!1;var o={type:t,data:e,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}};W.prototype.close=function(){if(this.readyState==="opening"||this.readyState==="open"){this.readyState="closing";var t=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():e()}):this.upgrading?n():e()}function e(){t.onClose("forced close"),G("socket closing - telling transport to close"),t.transport.close()}function r(){t.removeListener("upgrade",r),t.removeListener("upgradeError",r),e()}function n(){t.once("upgrade",r),t.once("upgradeError",r)}return this};W.prototype.onError=function(t){G("socket error %j",t),W.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)};W.prototype.onClose=function(t,e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){G('socket close with reason: "%s"',t);var r=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),r.writeBuffer=[],r.prevBufferLen=0}};W.prototype.filterUpgrades=function(t){for(var e=[],r=0,n=t.length;r<n;r++)~uo(this.transports,t[r])&&e.push(t[r]);return e};Se.exports=fo;Se.exports.parser=kt;var go=Se.exports,Ge={exports:{}},ce,Ye;function mo(){if(Ye)return ce;Ye=1,ce=t;function t(e,r){var n=[];r=r||0;for(var o=r||0;o<e.length;o++)n[o-r]=e[o];return n}return ce}var Sr=vo;function vo(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}var Qe=[].slice,Er=function(t,e){if(typeof e=="string"&&(e=t[e]),typeof e!="function")throw new Error("bind() requires a function");var r=Qe.call(arguments,2);return function(){return e.apply(t,r.concat(Qe.call(arguments)))}},Ze;function Ar(){return Ze||(Ze=1,function(t,e){var r=Xt,n=St,o=mo(),i=Sr,u=Er,h=lt("socket.io-client:socket"),f=Ht(),c=ur();t.exports=a;var l={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},p=n.prototype.emit;function a(s,d,y){this.io=s,this.nsp=d,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},y&&y.query&&(this.query=y.query),this.io.autoConnect&&this.open()}n(a.prototype),a.prototype.subEvents=function(){if(!this.subs){var s=this.io;this.subs=[i(s,"open",u(this,"onopen")),i(s,"packet",u(this,"onpacket")),i(s,"close",u(this,"onclose"))]}},a.prototype.open=a.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.reconnecting||this.io.open(),this.io.readyState==="open"&&this.onopen(),this.emit("connecting"),this)},a.prototype.send=function(){var s=o(arguments);return s.unshift("message"),this.emit.apply(this,s),this},a.prototype.emit=function(s){if(l.hasOwnProperty(s))return p.apply(this,arguments),this;var d=o(arguments),y={type:(this.flags.binary!==void 0?this.flags.binary:c(d))?r.BINARY_EVENT:r.EVENT,data:d};return y.options={},y.options.compress=!this.flags||this.flags.compress!==!1,typeof d[d.length-1]=="function"&&(h("emitting packet with ack id %d",this.ids),this.acks[this.ids]=d.pop(),y.id=this.ids++),this.connected?this.packet(y):this.sendBuffer.push(y),this.flags={},this},a.prototype.packet=function(s){s.nsp=this.nsp,this.io.packet(s)},a.prototype.onopen=function(){if(h("transport is open - connecting"),this.nsp!=="/")if(this.query){var s=typeof this.query=="object"?f.encode(this.query):this.query;h("sending connect packet with query %s",s),this.packet({type:r.CONNECT,query:s})}else this.packet({type:r.CONNECT})},a.prototype.onclose=function(s){h("close (%s)",s),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",s)},a.prototype.onpacket=function(s){var d=s.nsp===this.nsp,y=s.type===r.ERROR&&s.nsp==="/";if(!(!d&&!y))switch(s.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(s);break;case r.BINARY_EVENT:this.onevent(s);break;case r.ACK:this.onack(s);break;case r.BINARY_ACK:this.onack(s);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",s.data);break}},a.prototype.onevent=function(s){var d=s.data||[];h("emitting event %j",d),s.id!=null&&(h("attaching ack callback to event"),d.push(this.ack(s.id))),this.connected?p.apply(this,d):this.receiveBuffer.push(d)},a.prototype.ack=function(s){var d=this,y=!1;return function(){if(!y){y=!0;var g=o(arguments);h("sending ack %j",g),d.packet({type:c(g)?r.BINARY_ACK:r.ACK,id:s,data:g})}}},a.prototype.onack=function(s){var d=this.acks[s.id];typeof d=="function"?(h("calling ack %s with %j",s.id,s.data),d.apply(this,s.data),delete this.acks[s.id]):h("bad ack %s",s.id)},a.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},a.prototype.emitBuffered=function(){var s;for(s=0;s<this.receiveBuffer.length;s++)p.apply(this,this.receiveBuffer[s]);for(this.receiveBuffer=[],s=0;s<this.sendBuffer.length;s++)this.packet(this.sendBuffer[s]);this.sendBuffer=[]},a.prototype.ondisconnect=function(){h("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},a.prototype.destroy=function(){if(this.subs){for(var s=0;s<this.subs.length;s++)this.subs[s].destroy();this.subs=null}this.io.destroy(this)},a.prototype.close=a.prototype.disconnect=function(){return this.connected&&(h("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},a.prototype.compress=function(s){return this.flags.compress=s,this},a.prototype.binary=function(s){return this.flags.binary=s,this}}(Ge)),Ge.exports}var ko=Tt;function Tt(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Tt.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+r:t-r}return Math.min(t,this.max)|0};Tt.prototype.reset=function(){this.attempts=0};Tt.prototype.setMin=function(t){this.ms=t};Tt.prototype.setMax=function(t){this.max=t};Tt.prototype.setJitter=function(t){this.jitter=t};var bo=go,Co=Ar(),wo=St,So=Xt,ft=Sr,Ct=Er,Z=lt("socket.io-client:manager"),Tr=Cr,Eo=ko,Nr=Object.prototype.hasOwnProperty,tr=H;function H(t,e){if(!(this instanceof H))return new H(t,e);t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new Eo({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=e.parser||So;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=e.autoConnect!==!1,this.autoConnect&&this.open()}H.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)Nr.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)};H.prototype.updateSocketIds=function(){for(var t in this.nsps)Nr.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))};H.prototype.generateId=function(t){return(t==="/"?"":t+"#")+this.engine.id};wo(H.prototype);H.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection};H.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts};H.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay};H.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor};H.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax};H.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout};H.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()};H.prototype.open=H.prototype.connect=function(t,e){if(Z("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;Z("opening %s",this.uri),this.engine=bo(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var o=ft(r,"open",function(){n.onopen(),t&&t()}),i=ft(r,"error",function(f){if(Z("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",f),t){var c=new Error("Connection error");c.data=f,t(c)}else n.maybeReconnectOnOpen()});if(this._timeout!==!1){var u=this._timeout;Z("connect attempt will timeout after %d",u),u===0&&o.destroy();var h=setTimeout(function(){Z("connect attempt timed out after %d",u),o.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",u)},u);this.subs.push({destroy:function(){clearTimeout(h)}})}return this.subs.push(o),this.subs.push(i),this};H.prototype.onopen=function(){Z("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(ft(t,"data",Ct(this,"ondata"))),this.subs.push(ft(t,"ping",Ct(this,"onping"))),this.subs.push(ft(t,"pong",Ct(this,"onpong"))),this.subs.push(ft(t,"error",Ct(this,"onerror"))),this.subs.push(ft(t,"close",Ct(this,"onclose"))),this.subs.push(ft(this.decoder,"decoded",Ct(this,"ondecoded")))};H.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")};H.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)};H.prototype.ondata=function(t){this.decoder.add(t)};H.prototype.ondecoded=function(t){this.emit("packet",t)};H.prototype.onerror=function(t){Z("error",t),this.emitAll("error",t)};H.prototype.socket=function(t,e){var r=this.nsps[t];if(!r){r=new Co(this,t,e),this.nsps[t]=r;var n=this;r.on("connecting",o),r.on("connect",function(){r.id=n.generateId(t)}),this.autoConnect&&o()}function o(){~Tr(n.connecting,r)||n.connecting.push(r)}return r};H.prototype.destroy=function(t){var e=Tr(this.connecting,t);~e&&this.connecting.splice(e,1),!this.connecting.length&&this.close()};H.prototype.packet=function(t){Z("writing packet %j",t);var e=this;t.query&&t.type===0&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(r){for(var n=0;n<r.length;n++)e.engine.write(r[n],t.options);e.encoding=!1,e.processPacketQueue()}))};H.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}};H.prototype.cleanup=function(){Z("cleanup");for(var t=this.subs.length,e=0;e<t;e++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()};H.prototype.close=H.prototype.disconnect=function(){Z("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()};H.prototype.onclose=function(t){Z("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()};H.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)Z("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();Z("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(Z("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),!t.skipReconnect&&t.open(function(n){n?(Z("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",n.data)):(Z("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}};H.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)};(function(t,e){var r=an,n=Xt,o=tr,i=lt("socket.io-client");t.exports=e=h;var u=e.managers={};function h(f,c){typeof f=="object"&&(c=f,f=void 0),c=c||{};var l=r(f),p=l.source,a=l.id,s=l.path,d=u[a]&&s in u[a].nsps,y=c.forceNew||c["force new connection"]||c.multiplex===!1||d,g;return y?(i("ignoring socket cache for %s",p),g=o(p,c)):(u[a]||(i("new io instance for %s",p),u[a]=o(p,c)),g=u[a]),l.query&&!c.query&&(c.query=l.query),g.socket(l.path,c)}e.protocol=n.protocol,e.connect=h,e.Manager=tr,e.Socket=Ar()})(le,le.exports);var Ao=le.exports;const To=Jr(Ao);let Ft;const No=new Uint8Array(16);function Oo(){if(!Ft&&(Ft=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ft))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ft(No)}const Q=[];for(let t=0;t<256;++t)Q.push((t+256).toString(16).slice(1));function xo(t,e=0){return Q[t[e+0]]+Q[t[e+1]]+Q[t[e+2]]+Q[t[e+3]]+"-"+Q[t[e+4]]+Q[t[e+5]]+"-"+Q[t[e+6]]+Q[t[e+7]]+"-"+Q[t[e+8]]+Q[t[e+9]]+"-"+Q[t[e+10]]+Q[t[e+11]]+Q[t[e+12]]+Q[t[e+13]]+Q[t[e+14]]+Q[t[e+15]]}const Ro=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),er={randomUUID:Ro};function Io(t,e,r){if(er.randomUUID&&!e&&!t)return er.randomUUID();t=t||{};const n=t.random||(t.rng||Oo)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let o=0;o<16;++o)e[r+o]=n[o];return e}return xo(n)}function Bo(t,e){const r=e.map(o=>JSON.stringify(o)).join(" "),n=new Date().toISOString();return JSON.stringify({level:t,time:n,message:r})}function _o(t,e){const r=JSON.parse(t);return e.forEach(n=>delete r[n]),r}function Lo(t){if(typeof t=="object"&&t!==null)return t;try{return JSON.parse(t)}catch{return{extraData:t}}}function Uo(t){const e=/\(([^)]+)\)/,r=t.match(e);if(r&&r[1]){const n=r[1].split(";");for(let o of n)if(o=o.trim(),o.startsWith("Windows")||o.startsWith("Macintosh")||o.startsWith("Linux"))return o}return"Unknown"}function rr(t){return(...e)=>new Promise((r,n)=>{try{const o=t(...e);r(o)}catch(o){n(o)}})}const Do={reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,upgrade:!1,transports:["websocket"],debug:!1},he={logToConsole:!0,overloadGlobalConsole:!1,socketEmitInterval:6e4},at={CREATE:"Create",READ:"Read",UPDATE:"Update",DELETE:"Delete",CONVERT:"Convert",DOWNLOAD:"Download",UPLOAD:"Upload",ENCRYPT:"Encrypt",DECRYPT:"Decrypt",FILTER:"Filter",INPUT:"Input",OUTPUT:"Output",PLUGIN:"Plugin",LOGIN:"Login",LOGOUT:"Logout",REFRESH:"Refresh",CHECK:"Check",WEBHOOK:"Webhook",WSCONNECT:"WSConnect"},Po={Create:1,Read:2,Update:3,Delete:4,Convert:5,Download:6,Upload:7,Encrypt:8,Decrypt:9,Filter:10,Input:11,Output:12,Plugin:13,Login:14,Logout:15,Refresh:16,Check:17,Webhook:18,WSConnect:19},ct={INFO:"info",WARNING:"warning",MODIFY:"modify",ERROR:"error",VIEW:"view"},tt={INFO:"info",WARNING:"warning",ERROR:"error",DEBUG:"debug"};let rt=console;class Fo{constructor(e){V(this,"logToConsole"),V(this,"overloadGlobalConsole"),V(this,"system"),V(this,"socketEmitInterval"),V(this,"storageId"),V(this,"emitInProgress"),V(this,"queue"),V(this,"processing"),V(this,"storageInitialized"),V(this,"interval"),V(this,"logIndex"),V(this,"socket"),V(this,"staticObject",{}),V(this,"localObject",{}),V(this,"isGetItemAsync"),V(this,"isSetItemAsync"),V(this,"getItem"),V(this,"setItem"),V(this,"parseLog"),V(this,"_logMethod"),V(this,"_warnMethod"),V(this,"_errorMethod"),V(this,"_debugMethod");const{loggerOptions:r}=e;if(!r.system)throw new Error("Config property 'system' should be provided!");this.isGetItemAsync=r.isGetItemAsync||!1,this.isSetItemAsync=r.isSetItemAsync||!1,this.setupStorageFunctions(r.getItem,r.setItem,r.parseLog),this.system=r.system,this.socketEmitInterval=r.socketEmitInterval||he.socketEmitInterval,this.logToConsole=r.logToConsole!==void 0?r.logToConsole:he.logToConsole,this.overloadGlobalConsole=r.overloadGlobalConsole!==void 0?r.overloadGlobalConsole:he.overloadGlobalConsole,this.storageId=this.getStorageName(),this.queue=[],this.processing=!1,this.storageInitialized=!1,this.emitInProgress=!1,this.logIndex=0,this.init(e)}setupStorageFunctions(e,r,n){this.getItem=e&&typeof e=="function"?this.isGetItemAsync?e:rr(e):this.defaultGetItemFunction,this.setItem=r&&typeof r=="function"?this.isSetItemAsync?r:rr(r):this.defaultSetItemFunction,this.parseLog=n&&typeof n=="function"?n:Bo}init(e){const{socket:r,url:n,socketOptions:o={}}=e;this._logMethod=rt.log.bind(rt),this._warnMethod=rt.warn.bind(rt),this._errorMethod=rt.error.bind(rt),this._debugMethod=rt.debug.bind(rt),this.initStorage().then(()=>{if(r)this.socket=r;else if(n)this.socket=this.createConnection(n,o);else throw new Error("Must provide either a 'socket' or a 'url' for socket connection");this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval),this.overloadGlobalConsole&&this._overloadConsole()})}createConnection(e,r={}){const n={...Do,...r};return To(e,n)}async emitLogs(){if(!this.emitInProgress)try{const e=await this.getItem(this.storageId),r=JSON.parse(e||"{}"),n={...this.localObject,...r};if(!Object.keys(n).length)return;const o=[];this.emitInProgress=!0;const i=Object.keys(n);if(!i.length)return;if(!this.socket||!this.socket.connected)throw new Error("Socket is disconnected");for(const f of i){const c=Lo(n[f]),l={...this.staticObject,...c},p=this.populateSendingLog(l);await this.socket.emit("Log",JSON.stringify(p)),o.push(f)}const u=await this.getItem(this.storageId);if(!u)return;const h=_o(u,o);this.localObject={},await this.setItem(this.storageId,JSON.stringify(h))}catch(e){this._errorMethod(e)}finally{this.emitInProgress=!1}}populateSendingLog(e){const r={...e},n=r.ActionName;return n&&(r.ActionID=Po[n]),r}setupStaticFields(e){this.staticObject={...e}}populateMetaData(){const e=new Date;let r;typeof window<"u"&&typeof window.document<"u"?r=window==null?void 0:window.navigator.userAgent:typeof self<"u"&&self.navigator&&(r=self.navigator.userAgent);let n;return r&&(n=Uo(r)),{System:this.system,DateTime:e,UserAgent:r,OSVersion:n}}async stop(){!this.socket||!this.socket.connected||(clearInterval(this.interval),await this.emitLogs(),this.socket.disconnect())}async start(){this.socket&&this.socket.connected||(this.socket.connect(),this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval))}_overloadConsole(){rt=Object.assign(rt,{log:e=>{this.log(e)},warn:e=>{this.warn(e)},error:e=>{this.error(e)},debug:e=>{this.debug(e)}})}async initStorage(){const e=await this.getItem(this.storageId);(!e||typeof e!="string")&&(await this.setItem(this.storageId,JSON.stringify({})),this.storageInitialized=!0)}async resetStorage(){await this.setItem(this.storageId,JSON.stringify({}))}getStorageName(){const e=Io();return this.system.toString().toUpperCase()+e+Date.now()}async processLog(...e){try{if(e.length<2)return;const r=e[0],n=e[1],o=this.formItemKey(r);if(!this.storageInitialized){this.localObject={...this.localObject,[o]:n};return}const i=await this.getItem(this.storageId);if(!i)return;const u=JSON.parse(i);u[o]=JSON.stringify(n),await this.setItem(this.storageId,JSON.stringify(u))}catch(r){this._errorMethod(r)}}async processQueue(){if(this.processing||this.queue.length===0)return;const e=this.queue.shift();e&&(this.processing=!0,await this.processLog(...e).finally(()=>{this.processing=!1,this.processQueue()}))}log(e){const r={...this.populateMetaData(),...e},n=["INFO",r];this.queue.push(n),this.logToConsole&&this._logMethod.apply(rt,[r]),this.processQueue()}warn(e){const r=["WARN",e];this.queue.push(r),this.logToConsole&&this._warnMethod.apply(rt,[e]),this.processQueue()}error(e){const r=["ERROR",e];this.queue.push(r),this.logToConsole&&this._errorMethod.apply(rt,[e]),this.processQueue()}debug(e){const r=["DEBUG",e];this.queue.push(r),this.logToConsole&&this._debugMethod.apply(rt,[e]),this.processQueue()}async defaultGetItemFunction(e){return localStorage.getItem(e)}async defaultSetItemFunction(e,r){try{localStorage.setItem(e,r)}catch(n){this._errorMethod(n)}}formItemKey(e){const r=new Date().toISOString();return this.logIndex++,`${e}-${this.system}-${r}-${this.logIndex}`}}class jo{constructor(e){K(this,"delay",1e3);K(this,"lastLoginTimestamp");K(this,"token");K(this,"refreshToken");K(this,"tokenExpiry");K(this,"storageKey");this.eventsSdkClass=e,this.eventsSdkClass=e,this.storageKey=""}async login(){const e={token:this.eventsSdkClass.options.token&&this.eventsSdkClass.options.token,email:this.eventsSdkClass.options.email&&this.eventsSdkClass.options.email,password:this.eventsSdkClass.options.password&&this.eventsSdkClass.options.password};if(this.storageKey=Wr(JSON.stringify({...this.eventsSdkClass.options,loggerSocketConnection:null},this.eventsSdkClass.getCircularReplacer())),this.lastLoginTimestamp&&this.lastLoginTimestamp+this.delay>new Date().getTime())return;this.updateLastLoginTimestamp();const r=await this.checkLoginStatus(this.storageKey);return r||(Rt.clearSessionStorage(),await this.userLoginFunction(e,this.storageKey,this.eventsSdkClass.options.loginType))}updateLastLoginTimestamp(){this.lastLoginTimestamp=new Date().getTime()}async checkLoginStatus(e){const r=await Rt.getSessionStorageDataByKey(e);if(r)return r}async userLoginFunction(e,r,n){let o,i,u;return this.eventsSdkClass.options.isNewStack?(o=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),i=await this.getSettings(o.Data.AccessToken),u={...o.Data,...i}):(o=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),u={...o.Data.Socket}),await Rt.updateSessionStorageKey(r,u),u}onLoginResponse(e){if(!this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),e.MonitorList&&e.MonitorList.length&&(this.eventsSdkClass.servers=[...e.MonitorList],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length&&e.URLList&&(this.eventsSdkClass.URLList=e.URLList),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.URLList.length&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");if(this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");this.eventsSdkClass.server&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${this.eventsSdkClass.server.Version}`),!this.eventsSdkClass.server&&this.eventsSdkClass.URLList.length&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${e.Version}`),e.IdentityCode&&(this.token=e.IdentityCode,this.eventsSdkClass.connect(vt.MAIN)),e.Token&&(this.token=e.Token,this.eventsSdkClass.connect(vt.MAIN)),e.RefreshToken&&e.IdentityCodeExpiry&&this.eventsSdkClass.options.loginType===it.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.IdentityCodeExpiry,this.handleTokenExpiry()),e.RefreshToken&&e.TokenExpiry&&this.normalizeLoginType(this.eventsSdkClass.options.loginType)===it.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.TokenExpiry,this.handleTokenExpiry())}handleTokenExpiry(){if(!this.eventsSdkClass.options.refreshTokenUrl)throw new Error("refreshTokenUrl not provided");let e;if(this.tokenExpiry)e=new Date(this.tokenExpiry);else return;const r=e.getTime()-new Date().getTime()-5e3,n=Math.min(r,2147483647);setTimeout(async()=>{if(this.refreshToken){this.eventsSdkClass.socketIoClass.closeAllConnections();let o,i;if(this.eventsSdkClass.options.isNewStack){const u=await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken);o=await this.getSettings(u.Data.AccessToken),i={...u.Data,...o}}else i={...(await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken)).Data.Socket};this.onLoginResponse(i),await Rt.updateSessionStorageKey(this.storageKey,i)}},n)}async externalLogin(e,{password:r,token:n,email:o},i){if(!e)throw new Error("loginUrl not provided");let u;this.eventsSdkClass.options.isNewStack?i===it.TOKEN?u=JSON.stringify({identityType:it.TOKEN,token:n}):u=JSON.stringify({identityType:it.USER,username:o,password:r}):this.eventsSdkClass.options.loginType===it.TOKEN?(u=JSON.stringify({token:n}),e=`${e}/${it.TOKEN}`):(u=JSON.stringify({email:o,pin:r}),e=`${e}/${it.USER}`);let h;try{const f=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:u});if(!f.ok&&f.status===400)throw h=400,new Error("Bad body request. Login type or isNewStack values not correct or not provided");if(!f.ok&&f.status===401)throw h=401,new Error("Unauthorized. Invalid token provided");if(!f.ok&&f.status===403)throw h=403,new Error("Forbidden. Identity token not provided or not valid");const c=await f.json();if(c.error)throw new Error(c.error);return c}catch(f){throw this.eventsSdkClass.loggerClass.log({Message:`External login request error with the login type ${i} ${i===it.TOKEN?n:o}`,ActionName:at.WSCONNECT,isShowClient:!1,Status:"External login error",StatusCode:h||400,Level:tt.ERROR,LogType:ct.ERROR}),f}}async getSettings(e){try{if(!this.eventsSdkClass.options.getSettingsUrl)throw new Error("getSettingsUrl not provided");const r=await fetch(this.eventsSdkClass.options.getSettingsUrl,{headers:{Authorization:`Bearer ${e}`}});if(!r.ok&&r.status===401)throw new Error("Unauthorized. Access token not provided or not valid");return r.json()}catch(r){throw this.eventsSdkClass.loggerClass.log({Message:`Get settings error with token ${e}, error: ${r}`,ActionName:at.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:tt.ERROR,LogType:ct.ERROR}),r}}async externalRefreshToken(e,r){try{return(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}})).json()}catch(n){throw this.eventsSdkClass.loggerClass.log({Message:`Refresh token error with old refresh token ${r}, url: ${e}, error: ${n}`,ActionName:at.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:tt.ERROR,LogType:ct.ERROR}),n}}normalizeLoginType(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}}const Mo={isNewStack:!1,loginUrl:"https://loginapi.voicenter.co.il/monitorAPI/Login",refreshTokenUrl:"https://loginapi.voicenter.co.il/monitorAPI/RefreshIdentityToken",forceNew:!0,reconnectionDelay:1e4,timeout:1e4,keepAliveTimeout:6e4,protocol:"https",useLogger:!0,loggerServer:"https://socketlog.voicenter.co",loggerConfig:{logToConsole:!0,overloadGlobalConsole:!1,system:"events-sdk",socketEmitInterval:1e4},loggerConnectOptions:{reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,perMessageDeflate:void 0,upgrade:!1,transports:["websocket"],debug:!1}};function qo(){return typeof window<"u"&&(typeof window.navigator>"u"||typeof window.navigator.userAgent>"u")&&(window.navigator.userAgent="react-native"),typeof self>"u"&&typeof global=="object"&&(global.self=global,global.WebSocket=Fr,typeof self.navigator>"u"&&(self.navigator={userAgent:"node"})),function t(e,r,n){function o(h,f){if(!r[h]){if(!e[h]){var c=typeof require=="function"&&require;if(!f&&c)return c(h,!0);if(i)return i(h,!0);throw new Error("Cannot find module '"+h+"'")}var l=r[h]={exports:{}};e[h][0].call(l.exports,function(p){var a=e[h][1][p];return o(a||p)},l,l.exports,t,e,r,n)}return r[h].exports}for(var i=typeof require=="function"&&require,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(t,e){e.exports=t("./lib/")},{"./lib/":2}],2:[function(t,e,r){function n(c,l){typeof c=="object"&&(l=c,c=void 0),l=l||{};var p,a=o(c),s=a.source,d=a.id;return l.forceNew||l["force new connection"]||l.multiplex===!1?(h("ignoring socket cache for %s",s),p=u(s,l)):(f[d]||(h("new io instance for %s",s),f[d]=u(s,l)),p=f[d]),p.socket(a.path)}var o=t("./url"),i=t("socket.io-parser"),u=t("./manager"),h=t("debug")("socket.io-client");e.exports=r=n;var f=r.managers={};r.protocol=i.protocol,r.connect=n,r.Manager=t("./manager"),r.Socket=t("./socket")},{"./manager":3,"./socket":5,"./url":6,debug:10,"socket.io-parser":44}],3:[function(t,e){function r(a,s){return this instanceof r?(a&&typeof a=="object"&&(s=a,a=void 0),s=s||{},s.path=s.path||"/socket.io",this.nsps={},this.subs=[],this.opts=s,this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor(s.randomizationFactor||.5),this.backoff=new p({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this.readyState="closed",this.uri=a,this.connected=[],this.encoding=!1,this.packetBuffer=[],this.encoder=new u.Encoder,this.decoder=new u.Decoder,this.autoConnect=s.autoConnect!==!1,void(this.autoConnect&&this.open())):new r(a,s)}var n=(t("./url"),t("engine.io-client")),o=t("./socket"),i=t("component-emitter"),u=t("socket.io-parser"),h=t("./on"),f=t("component-bind"),c=(t("object-component"),t("debug")("socket.io-client:manager")),l=t("indexof"),p=t("backo2");e.exports=r,r.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var a in this.nsps)this.nsps[a].emit.apply(this.nsps[a],arguments)},r.prototype.updateSocketIds=function(){for(var a in this.nsps)this.nsps[a].id=this.engine.id},i(r.prototype),r.prototype.reconnection=function(a){return arguments.length?(this._reconnection=!!a,this):this._reconnection},r.prototype.reconnectionAttempts=function(a){return arguments.length?(this._reconnectionAttempts=a,this):this._reconnectionAttempts},r.prototype.reconnectionDelay=function(a){return arguments.length?(this._reconnectionDelay=a,this.backoff&&this.backoff.setMin(a),this):this._reconnectionDelay},r.prototype.randomizationFactor=function(a){return arguments.length?(this._randomizationFactor=a,this.backoff&&this.backoff.setJitter(a),this):this._randomizationFactor},r.prototype.reconnectionDelayMax=function(a){return arguments.length?(this._reconnectionDelayMax=a,this.backoff&&this.backoff.setMax(a),this):this._reconnectionDelayMax},r.prototype.timeout=function(a){return arguments.length?(this._timeout=a,this):this._timeout},r.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},r.prototype.open=r.prototype.connect=function(a){if(c("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;c("opening %s",this.uri),this.engine=n(this.uri,this.opts);var s=this.engine,d=this;this.readyState="opening",this.skipReconnect=!1;var y=h(s,"open",function(){d.onopen(),a&&a()}),g=h(s,"error",function(_){if(c("connect_error"),d.cleanup(),d.readyState="closed",d.emitAll("connect_error",_),a){var b=new Error("Connection error");b.data=_,a(b)}else d.maybeReconnectOnOpen()});if(this._timeout!==!1){var w=this._timeout;c("connect attempt will timeout after %d",w);var B=setTimeout(function(){c("connect attempt timed out after %d",w),y.destroy(),s.close(),s.emit("error","timeout"),d.emitAll("connect_timeout",w)},w);this.subs.push({destroy:function(){clearTimeout(B)}})}return this.subs.push(y),this.subs.push(g),this},r.prototype.onopen=function(){c("open"),this.cleanup(),this.readyState="open",this.emit("open");var a=this.engine;this.subs.push(h(a,"data",f(this,"ondata"))),this.subs.push(h(this.decoder,"decoded",f(this,"ondecoded"))),this.subs.push(h(a,"error",f(this,"onerror"))),this.subs.push(h(a,"close",f(this,"onclose")))},r.prototype.ondata=function(a){this.decoder.add(a)},r.prototype.ondecoded=function(a){this.emit("packet",a)},r.prototype.onerror=function(a){c("error",a),this.emitAll("error",a)},r.prototype.socket=function(a){var s=this.nsps[a];if(!s){s=new o(this,a),this.nsps[a]=s;var d=this;s.on("connect",function(){s.id=d.engine.id,~l(d.connected,s)||d.connected.push(s)})}return s},r.prototype.destroy=function(a){var s=l(this.connected,a);~s&&this.connected.splice(s,1),this.connected.length||this.close()},r.prototype.packet=function(a){c("writing packet %j",a);var s=this;s.encoding?s.packetBuffer.push(a):(s.encoding=!0,this.encoder.encode(a,function(d){for(var y=0;y<d.length;y++)s.engine.write(d[y]);s.encoding=!1,s.processPacketQueue()}))},r.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var a=this.packetBuffer.shift();this.packet(a)}},r.prototype.cleanup=function(){for(var a;a=this.subs.shift();)a.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},r.prototype.close=r.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},r.prototype.onclose=function(a){c("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",a),this._reconnection&&!this.skipReconnect&&this.reconnect()},r.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var a=this;if(this.backoff.attempts>=this._reconnectionAttempts)c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var s=this.backoff.duration();c("will wait %dms before reconnect attempt",s),this.reconnecting=!0;var d=setTimeout(function(){a.skipReconnect||(c("attempting reconnect"),a.emitAll("reconnect_attempt",a.backoff.attempts),a.emitAll("reconnecting",a.backoff.attempts),a.skipReconnect||a.open(function(y){y?(c("reconnect attempt error"),a.reconnecting=!1,a.reconnect(),a.emitAll("reconnect_error",y.data)):(c("reconnect success"),a.onreconnect())}))},s);this.subs.push({destroy:function(){clearTimeout(d)}})}},r.prototype.onreconnect=function(){var a=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",a)}},{"./on":4,"./socket":5,"./url":6,backo2:7,"component-bind":8,"component-emitter":9,debug:10,"engine.io-client":11,indexof:40,"object-component":41,"socket.io-parser":44}],4:[function(t,e){function r(n,o,i){return n.on(o,i),{destroy:function(){n.removeListener(o,i)}}}e.exports=r},{}],5:[function(t,e,r){function n(s,d){this.io=s,this.nsp=d,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var o=t("socket.io-parser"),i=t("component-emitter"),u=t("to-array"),h=t("./on"),f=t("component-bind"),c=t("debug")("socket.io-client:socket"),l=t("has-binary");e.exports=n;var p={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1},a=i.prototype.emit;i(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var s=this.io;this.subs=[h(s,"open",f(this,"onopen")),h(s,"packet",f(this,"onpacket")),h(s,"close",f(this,"onclose"))]}},n.prototype.open=n.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),this.io.readyState=="open"&&this.onopen(),this)},n.prototype.send=function(){var s=u(arguments);return s.unshift("message"),this.emit.apply(this,s),this},n.prototype.emit=function(s){if(p.hasOwnProperty(s))return a.apply(this,arguments),this;var d=u(arguments),y=o.EVENT;l(d)&&(y=o.BINARY_EVENT);var g={type:y,data:d};return typeof d[d.length-1]=="function"&&(c("emitting packet with ack id %d",this.ids),this.acks[this.ids]=d.pop(),g.id=this.ids++),this.connected?this.packet(g):this.sendBuffer.push(g),this},n.prototype.packet=function(s){s.nsp=this.nsp,this.io.packet(s)},n.prototype.onopen=function(){c("transport is open - connecting"),this.nsp!="/"&&this.packet({type:o.CONNECT})},n.prototype.onclose=function(s){c("close (%s)",s),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",s)},n.prototype.onpacket=function(s){if(s.nsp==this.nsp)switch(s.type){case o.CONNECT:this.onconnect();break;case o.EVENT:this.onevent(s);break;case o.BINARY_EVENT:this.onevent(s);break;case o.ACK:this.onack(s);break;case o.BINARY_ACK:this.onack(s);break;case o.DISCONNECT:this.ondisconnect();break;case o.ERROR:this.emit("error",s.data)}},n.prototype.onevent=function(s){var d=s.data||[];c("emitting event %j",d),s.id!=null&&(c("attaching ack callback to event"),d.push(this.ack(s.id))),this.connected?a.apply(this,d):this.receiveBuffer.push(d)},n.prototype.ack=function(s){var d=this,y=!1;return function(){if(!y){y=!0;var g=u(arguments);c("sending ack %j",g);var w=l(g)?o.BINARY_ACK:o.ACK;d.packet({type:w,id:s,data:g})}}},n.prototype.onack=function(s){c("calling ack %s with %j",s.id,s.data);var d=this.acks[s.id];d.apply(this,s.data),delete this.acks[s.id]},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var s;for(s=0;s<this.receiveBuffer.length;s++)a.apply(this,this.receiveBuffer[s]);for(this.receiveBuffer=[],s=0;s<this.sendBuffer.length;s++)this.packet(this.sendBuffer[s]);this.sendBuffer=[]},n.prototype.ondisconnect=function(){c("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},n.prototype.destroy=function(){if(this.subs){for(var s=0;s<this.subs.length;s++)this.subs[s].destroy();this.subs=null}this.io.destroy(this)},n.prototype.close=n.prototype.disconnect=function(){return this.connected&&(c("performing disconnect (%s)",this.nsp),this.packet({type:o.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}},{"./on":4,"component-bind":8,"component-emitter":9,debug:10,"has-binary":36,"socket.io-parser":44,"to-array":48}],6:[function(t,e){(function(r){function n(u,c){var f=u,c=c||r.location;return u==null&&(u=c.protocol+"//"+c.host),typeof u=="string"&&(u.charAt(0)=="/"&&(u=u.charAt(1)=="/"?c.protocol+u:c.hostname+u),/^(https?|wss?):\/\//.test(u)||(i("protocol-less url %s",u),u=typeof c<"u"?c.protocol+"//"+u:"https://"+u),i("parse %s",u),f=o(u)),f.port||(/^(http|ws)$/.test(f.protocol)?f.port="80":/^(http|ws)s$/.test(f.protocol)&&(f.port="443")),f.path=f.path||"/",f.id=f.protocol+"://"+f.host+":"+f.port,f.href=f.protocol+"://"+f.host+(c&&c.port==f.port?"":":"+f.port),f}var o=t("parseuri"),i=t("debug")("socket.io-client:url");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{debug:10,parseuri:42}],7:[function(t,e){function r(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}e.exports=r,r.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var o=Math.random(),i=Math.floor(o*this.jitter*n);n=1&Math.floor(10*o)?n+i:n-i}return 0|Math.min(n,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(n){this.ms=n},r.prototype.setMax=function(n){this.max=n},r.prototype.setJitter=function(n){this.jitter=n}},{}],8:[function(t,e){var r=[].slice;e.exports=function(n,o){if(typeof o=="string"&&(o=n[o]),typeof o!="function")throw new Error("bind() requires a function");var i=r.call(arguments,2);return function(){return o.apply(n,i.concat(r.call(arguments)))}}},{}],9:[function(t,e){function r(o){return o?n(o):void 0}function n(o){for(var i in r.prototype)o[i]=r.prototype[i];return o}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(o,i){return this._callbacks=this._callbacks||{},(this._callbacks[o]=this._callbacks[o]||[]).push(i),this},r.prototype.once=function(o,i){function u(){h.off(o,u),i.apply(this,arguments)}var h=this;return this._callbacks=this._callbacks||{},u.fn=i,this.on(o,u),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(o,i){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var u=this._callbacks[o];if(!u)return this;if(arguments.length==1)return delete this._callbacks[o],this;for(var h,f=0;f<u.length;f++)if(h=u[f],h===i||h.fn===i){u.splice(f,1);break}return this},r.prototype.emit=function(o){this._callbacks=this._callbacks||{};var i=[].slice.call(arguments,1),u=this._callbacks[o];if(u){u=u.slice(0);for(var h=0,f=u.length;f>h;++h)u[h].apply(this,i)}return this},r.prototype.listeners=function(o){return this._callbacks=this._callbacks||{},this._callbacks[o]||[]},r.prototype.hasListeners=function(o){return!!this.listeners(o).length}},{}],10:[function(t,e){function r(o){return r.enabled(o)?function(i){i=n(i);var u=new Date,h=u-(r[o]||u);r[o]=u,i=o+" "+i+" +"+r.humanize(h),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function n(o){return o instanceof Error?o.stack||o.message:o}e.exports=r,r.names=[],r.skips=[],r.enable=function(o){try{localStorage.debug=o}catch{}for(var i=(o||"").split(/[\s,]+/),u=i.length,h=0;u>h;h++)o=i[h].replace("*",".*?"),o[0]==="-"?r.skips.push(new RegExp("^"+o.substr(1)+"$")):r.names.push(new RegExp("^"+o+"$"))},r.disable=function(){r.enable("")},r.humanize=function(o){var i=1e3,u=6e4,h=60*u;return o>=h?(o/h).toFixed(1)+"h":o>=u?(o/u).toFixed(1)+"m":o>=i?(o/i|0)+"s":o+"ms"},r.enabled=function(o){for(var i=0,u=r.skips.length;u>i;i++)if(r.skips[i].test(o))return!1;for(var i=0,u=r.names.length;u>i;i++)if(r.names[i].test(o))return!0;return!1};try{window.localStorage&&r.enable(localStorage.debug)}catch{}},{}],11:[function(t,e){e.exports=t("./lib/")},{"./lib/":12}],12:[function(t,e){e.exports=t("./socket"),e.exports.parser=t("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(t,e){(function(r){function n(s,d){if(!(this instanceof n))return new n(s,d);if(d=d||{},s&&typeof s=="object"&&(d=s,s=null),s&&(s=l(s),d.host=s.host,d.secure=s.protocol=="https"||s.protocol=="wss",d.port=s.port,s.query&&(d.query=s.query)),this.secure=d.secure!=null?d.secure:r.location&&location.protocol=="https:",d.host){var y=d.host.split(":");d.hostname=y.shift(),y.length?d.port=y.pop():d.port||(d.port=this.secure?"443":"80")}this.agent=d.agent||!1,this.hostname=d.hostname||(r.location?location.hostname:"localhost"),this.port=d.port||(r.location&&location.port?location.port:this.secure?443:80),this.query=d.query||{},typeof this.query=="string"&&(this.query=a.decode(this.query)),this.upgrade=d.upgrade!==!1,this.path=(d.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!d.forceJSONP,this.jsonp=d.jsonp!==!1,this.forceBase64=!!d.forceBase64,this.enablesXDR=!!d.enablesXDR,this.timestampParam=d.timestampParam||"t",this.timestampRequests=d.timestampRequests,this.transports=d.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=d.policyPort||843,this.rememberUpgrade=d.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=d.onlyBinaryUpgrades,this.pfx=d.pfx||null,this.key=d.key||null,this.passphrase=d.passphrase||null,this.cert=d.cert||null,this.ca=d.ca||null,this.ciphers=d.ciphers||null,this.rejectUnauthorized=d.rejectUnauthorized||null,this.open()}function o(s){var d={};for(var y in s)s.hasOwnProperty(y)&&(d[y]=s[y]);return d}var i=t("./transports"),u=t("component-emitter"),h=t("debug")("engine.io-client:socket"),f=t("indexof"),c=t("engine.io-parser"),l=t("parseuri"),p=t("parsejson"),a=t("parseqs");e.exports=n,n.priorWebsocketSuccess=!1,u(n.prototype),n.protocol=c.protocol,n.Socket=n,n.Transport=t("./transport"),n.transports=t("./transports"),n.parser=t("engine.io-parser"),n.prototype.createTransport=function(s){h('creating transport "%s"',s);var d=o(this.query);d.EIO=c.protocol,d.transport=s,this.id&&(d.sid=this.id);var y=new i[s]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:d,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized});return y},n.prototype.open=function(){var d;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1)d="websocket";else{if(this.transports.length==0){var s=this;return void setTimeout(function(){s.emit("error","No transports available")},0)}d=this.transports[0]}this.readyState="opening";var d;try{d=this.createTransport(d)}catch{return this.transports.shift(),void this.open()}d.open(),this.setTransport(d)},n.prototype.setTransport=function(s){h("setting transport %s",s.name);var d=this;this.transport&&(h("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=s,s.on("drain",function(){d.onDrain()}).on("packet",function(y){d.onPacket(y)}).on("error",function(y){d.onError(y)}).on("close",function(){d.onClose("transport close")})},n.prototype.probe=function(s){function d(){if(C.onlyBinaryUpgrades){var E=!this.supportsBinary&&C.transport.supportsBinary;m=m||E}m||(h('probe transport "%s" opened',s),S.send([{type:"ping",data:"probe"}]),S.once("packet",function(v){if(!m)if(v.type=="pong"&&v.data=="probe"){if(h('probe transport "%s" pong',s),C.upgrading=!0,C.emit("upgrading",S),!S)return;n.priorWebsocketSuccess=S.name=="websocket",h('pausing current transport "%s"',C.transport.name),C.transport.pause(function(){m||C.readyState!="closed"&&(h("changing transport and sending upgrade packet"),b(),C.setTransport(S),S.send([{type:"upgrade"}]),C.emit("upgrade",S),S=null,C.upgrading=!1,C.flush())})}else{h('probe transport "%s" failed',s);var k=new Error("probe error");k.transport=S.name,C.emit("upgradeError",k)}}))}function y(){m||(m=!0,b(),S.close(),S=null)}function g(E){var v=new Error("probe error: "+E);v.transport=S.name,y(),h('probe transport "%s" failed because of error: %s',s,E),C.emit("upgradeError",v)}function w(){g("transport closed")}function B(){g("socket closed")}function _(E){S&&E.name!=S.name&&(h('"%s" works - aborting "%s"',E.name,S.name),y())}function b(){S.removeListener("open",d),S.removeListener("error",g),S.removeListener("close",w),C.removeListener("close",B),C.removeListener("upgrading",_)}h('probing transport "%s"',s);var S=this.createTransport(s,{probe:1}),m=!1,C=this;n.priorWebsocketSuccess=!1,S.once("open",d),S.once("error",g),S.once("close",w),this.once("close",B),this.once("upgrading",_),S.open()},n.prototype.onOpen=function(){if(h("socket open"),this.readyState="open",n.priorWebsocketSuccess=this.transport.name=="websocket",this.emit("open"),this.flush(),this.readyState=="open"&&this.upgrade&&this.transport.pause){h("starting upgrade probes");for(var s=0,d=this.upgrades.length;d>s;s++)this.probe(this.upgrades[s])}},n.prototype.onPacket=function(s){if(this.readyState=="opening"||this.readyState=="open")switch(h('socket receive: type "%s", data "%s"',s.type,s.data),this.emit("packet",s),this.emit("heartbeat"),s.type){case"open":this.onHandshake(p(s.data));break;case"pong":this.setPing();break;case"error":var d=new Error("server error");d.code=s.data,this.emit("error",d);break;case"message":this.emit("data",s.data),this.emit("message",s.data)}else h('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(s){this.emit("handshake",s),this.id=s.sid,this.transport.query.sid=s.sid,this.upgrades=this.filterUpgrades(s.upgrades),this.pingInterval=s.pingInterval,this.pingTimeout=s.pingTimeout,this.onOpen(),this.readyState!="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(s){clearTimeout(this.pingTimeoutTimer);var d=this;d.pingTimeoutTimer=setTimeout(function(){d.readyState!="closed"&&d.onClose("ping timeout")},s||d.pingInterval+d.pingTimeout)},n.prototype.setPing=function(){var s=this;clearTimeout(s.pingIntervalTimer),s.pingIntervalTimer=setTimeout(function(){h("writing ping packet - expecting pong within %sms",s.pingTimeout),s.ping(),s.onHeartbeat(s.pingTimeout)},s.pingInterval)},n.prototype.ping=function(){this.sendPacket("ping")},n.prototype.onDrain=function(){for(var s=0;s<this.prevBufferLen;s++)this.callbackBuffer[s]&&this.callbackBuffer[s]();this.writeBuffer.splice(0,this.prevBufferLen),this.callbackBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length==0?this.emit("drain"):this.flush()},n.prototype.flush=function(){this.readyState!="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(h("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(s,d){return this.sendPacket("message",s,d),this},n.prototype.sendPacket=function(s,d,y){if(this.readyState!="closing"&&this.readyState!="closed"){var g={type:s,data:d};this.emit("packetCreate",g),this.writeBuffer.push(g),this.callbackBuffer.push(y),this.flush()}},n.prototype.close=function(){function s(){g.onClose("forced close"),h("socket closing - telling transport to close"),g.transport.close()}function d(){g.removeListener("upgrade",d),g.removeListener("upgradeError",d),s()}function y(){g.once("upgrade",d),g.once("upgradeError",d)}if(this.readyState=="opening"||this.readyState=="open"){this.readyState="closing";var g=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?y():s()}):this.upgrading?y():s()}return this},n.prototype.onError=function(s){h("socket error %j",s),n.priorWebsocketSuccess=!1,this.emit("error",s),this.onClose("transport error",s)},n.prototype.onClose=function(s,d){if(this.readyState=="opening"||this.readyState=="open"||this.readyState=="closing"){h('socket close with reason: "%s"',s);var y=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),setTimeout(function(){y.writeBuffer=[],y.callbackBuffer=[],y.prevBufferLen=0},0),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",s,d)}},n.prototype.filterUpgrades=function(s){for(var d=[],y=0,g=s.length;g>y;y++)~f(this.transports,s[y])&&d.push(s[y]);return d}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./transport":14,"./transports":15,"component-emitter":9,debug:22,"engine.io-parser":25,indexof:40,parsejson:32,parseqs:33,parseuri:34}],14:[function(t,e){function r(i){this.path=i.path,this.hostname=i.hostname,this.port=i.port,this.secure=i.secure,this.query=i.query,this.timestampParam=i.timestampParam,this.timestampRequests=i.timestampRequests,this.readyState="",this.agent=i.agent||!1,this.socket=i.socket,this.enablesXDR=i.enablesXDR,this.pfx=i.pfx,this.key=i.key,this.passphrase=i.passphrase,this.cert=i.cert,this.ca=i.ca,this.ciphers=i.ciphers,this.rejectUnauthorized=i.rejectUnauthorized}var n=t("engine.io-parser"),o=t("component-emitter");e.exports=r,o(r.prototype),r.timestamps=0,r.prototype.onError=function(i,u){var h=new Error(i);return h.type="TransportError",h.description=u,this.emit("error",h),this},r.prototype.open=function(){return(this.readyState=="closed"||this.readyState=="")&&(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return(this.readyState=="opening"||this.readyState=="open")&&(this.doClose(),this.onClose()),this},r.prototype.send=function(i){if(this.readyState!="open")throw new Error("Transport not open");this.write(i)},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(i){var u=n.decodePacket(i,this.socket.binaryType);this.onPacket(u)},r.prototype.onPacket=function(i){this.emit("packet",i)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(t,e,r){(function(n){function o(c){var l,p=!1,a=!1,s=c.jsonp!==!1;if(n.location){var d=location.protocol=="https:",y=location.port;y||(y=d?443:80),p=c.hostname!=location.hostname||y!=c.port,a=c.secure!=d}if(c.xdomain=p,c.xscheme=a,l=new i(c),"open"in l&&!c.forceJSONP)return new u(c);if(!s)throw new Error("JSONP disabled");return new h(c)}var i=t("xmlhttprequest"),u=t("./polling-xhr"),h=t("./polling-jsonp"),f=t("./websocket");r.polling=o,r.websocket=f}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(t,e){(function(r){function n(){}function o(l){i.call(this,l),this.query=this.query||{},h||(r.___eio||(r.___eio=[]),h=r.___eio),this.index=h.length;var p=this;h.push(function(a){p.onData(a)}),this.query.j=this.index,r.document&&r.addEventListener&&r.addEventListener("beforeunload",function(){p.script&&(p.script.onerror=n)},!1)}var i=t("./polling"),u=t("component-inherit");e.exports=o;var h,f=/\n/g,c=/\\n/g;u(o,i),o.prototype.supportsBinary=!1,o.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),i.prototype.doClose.call(this)},o.prototype.doPoll=function(){var l=this,p=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),p.async=!0,p.src=this.uri(),p.onerror=function(d){l.onError("jsonp poll error",d)};var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(p,a),this.script=p;var s=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);s&&setTimeout(function(){var d=document.createElement("iframe");document.body.appendChild(d),document.body.removeChild(d)},100)},o.prototype.doWrite=function(l,p){function a(){s(),p()}function s(){if(d.iframe)try{d.form.removeChild(d.iframe)}catch(b){d.onError("jsonp polling iframe removal error",b)}try{var _='<iframe src="javascript:0" name="'+d.iframeId+'">';y=document.createElement(_)}catch{y=document.createElement("iframe"),y.name=d.iframeId,y.src="javascript:0"}y.id=d.iframeId,d.form.appendChild(y),d.iframe=y}var d=this;if(!this.form){var y,g=document.createElement("form"),w=document.createElement("textarea"),B=this.iframeId="eio_iframe_"+this.index;g.className="socketio",g.style.position="absolute",g.style.top="-1000px",g.style.left="-1000px",g.target=B,g.method="POST",g.setAttribute("accept-charset","utf-8"),w.name="d",g.appendChild(w),document.body.appendChild(g),this.form=g,this.area=w}this.form.action=this.uri(),s(),l=l.replace(c,`\\
|
|
8
|
+
`),this.area.value=l.replace(f,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){d.iframe.readyState=="complete"&&a()}:this.iframe.onload=a}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-inherit":21}],17:[function(t,e){(function(r){function n(){}function o(a){if(f.call(this,a),r.location){var s=location.protocol=="https:",d=location.port;d||(d=s?443:80),this.xd=a.hostname!=r.location.hostname||d!=a.port,this.xs=a.secure!=s}}function i(a){this.method=a.method||"GET",this.uri=a.uri,this.xd=!!a.xd,this.xs=!!a.xs,this.async=a.async!==!1,this.data=a.data!=null?a.data:null,this.agent=a.agent,this.isBinary=a.isBinary,this.supportsBinary=a.supportsBinary,this.enablesXDR=a.enablesXDR,this.pfx=a.pfx,this.key=a.key,this.passphrase=a.passphrase,this.cert=a.cert,this.ca=a.ca,this.ciphers=a.ciphers,this.rejectUnauthorized=a.rejectUnauthorized,this.create()}function u(){for(var a in i.requests)i.requests.hasOwnProperty(a)&&i.requests[a].abort()}var h=t("xmlhttprequest"),f=t("./polling"),c=t("component-emitter"),l=t("component-inherit"),p=t("debug")("engine.io-client:polling-xhr");e.exports=o,e.exports.Request=i,l(o,f),o.prototype.supportsBinary=!0,o.prototype.request=function(a){return a=a||{},a.uri=this.uri(),a.xd=this.xd,a.xs=this.xs,a.agent=this.agent||!1,a.supportsBinary=this.supportsBinary,a.enablesXDR=this.enablesXDR,a.pfx=this.pfx,a.key=this.key,a.passphrase=this.passphrase,a.cert=this.cert,a.ca=this.ca,a.ciphers=this.ciphers,a.rejectUnauthorized=this.rejectUnauthorized,new i(a)},o.prototype.doWrite=function(a,s){var d=typeof a!="string"&&a!==void 0,y=this.request({method:"POST",data:a,isBinary:d}),g=this;y.on("success",s),y.on("error",function(w){g.onError("xhr post error",w)}),this.sendXhr=y},o.prototype.doPoll=function(){p("xhr poll");var a=this.request(),s=this;a.on("data",function(d){s.onData(d)}),a.on("error",function(d){s.onError("xhr poll error",d)}),this.pollXhr=a},c(i.prototype),i.prototype.create=function(){var a={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};a.pfx=this.pfx,a.key=this.key,a.passphrase=this.passphrase,a.cert=this.cert,a.ca=this.ca,a.ciphers=this.ciphers,a.rejectUnauthorized=this.rejectUnauthorized;var s=this.xhr=new h(a),d=this;try{if(p("xhr open %s: %s",this.method,this.uri),s.open(this.method,this.uri,this.async),this.supportsBinary&&(s.responseType="arraybuffer"),this.method=="POST")try{this.isBinary?s.setRequestHeader("Content-type","application/octet-stream"):s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}"withCredentials"in s&&(s.withCredentials=!0),this.hasXDR()?(s.onload=function(){d.onLoad()},s.onerror=function(){d.onError(s.responseText)}):s.onreadystatechange=function(){s.readyState==4&&(s.status==200||s.status==1223?d.onLoad():setTimeout(function(){d.onError(s.status)},0))},p("xhr data %s",this.data),s.send(this.data)}catch(y){return void setTimeout(function(){d.onError(y)},0)}r.document&&(this.index=i.requestsCount++,i.requests[this.index]=this)},i.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},i.prototype.onData=function(a){this.emit("data",a),this.onSuccess()},i.prototype.onError=function(a){this.emit("error",a),this.cleanup(!0)},i.prototype.cleanup=function(a){if(typeof this.xhr<"u"&&this.xhr!==null){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,a)try{this.xhr.abort()}catch{}r.document&&delete i.requests[this.index],this.xhr=null}},i.prototype.onLoad=function(){var a;try{var s;try{s=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch{}a=s==="application/octet-stream"?this.xhr.response:this.supportsBinary?"ok":this.xhr.responseText}catch(d){this.onError(d)}a!=null&&this.onData(a)},i.prototype.hasXDR=function(){return typeof r.XDomainRequest<"u"&&!this.xs&&this.enablesXDR},i.prototype.abort=function(){this.cleanup()},r.document&&(i.requestsCount=0,i.requests={},r.attachEvent?r.attachEvent("onunload",u):r.addEventListener&&r.addEventListener("beforeunload",u,!1))}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-emitter":9,"component-inherit":21,debug:22,xmlhttprequest:20}],18:[function(t,e){function r(c){var l=c&&c.forceBase64;(!f||l)&&(this.supportsBinary=!1),n.call(this,c)}var n=t("../transport"),o=t("parseqs"),i=t("engine.io-parser"),u=t("component-inherit"),h=t("debug")("engine.io-client:polling");e.exports=r;var f=function(){var c=t("xmlhttprequest"),l=new c({xdomain:!1});return l.responseType!=null}();u(r,n),r.prototype.name="polling",r.prototype.doOpen=function(){this.poll()},r.prototype.pause=function(c){function l(){h("paused"),p.readyState="paused",c()}var p=this;if(this.readyState="pausing",this.polling||!this.writable){var a=0;this.polling&&(h("we are currently polling - waiting to pause"),a++,this.once("pollComplete",function(){h("pre-pause polling complete"),--a||l()})),this.writable||(h("we are currently writing - waiting to pause"),a++,this.once("drain",function(){h("pre-pause writing complete"),--a||l()}))}else l()},r.prototype.poll=function(){h("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},r.prototype.onData=function(c){var l=this;h("polling got data %s",c);var p=function(a){return l.readyState=="opening"&&l.onOpen(),a.type=="close"?(l.onClose(),!1):void l.onPacket(a)};i.decodePayload(c,this.socket.binaryType,p),this.readyState!="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState=="open"?this.poll():h('ignoring poll - transport state "%s"',this.readyState))},r.prototype.doClose=function(){function c(){h("writing close packet"),l.write([{type:"close"}])}var l=this;this.readyState=="open"?(h("transport open - closing"),c()):(h("transport not open - deferring close"),this.once("open",c))},r.prototype.write=function(c){var p=this;this.writable=!1;var l=function(){p.writable=!0,p.emit("drain")},p=this;i.encodePayload(c,this.supportsBinary,function(a){p.doWrite(a,l)})},r.prototype.uri=function(){var c=this.query||{},l=this.secure?"https":"http",p="";return this.timestampRequests!==!1&&(c[this.timestampParam]=+new Date+"-"+n.timestamps++),this.supportsBinary||c.sid||(c.b64=1),c=o.encode(c),this.port&&(l=="https"&&this.port!=443||l=="http"&&this.port!=80)&&(p=":"+this.port),c.length&&(c="?"+c),l+"://"+this.hostname+p+this.path+c}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,xmlhttprequest:20}],19:[function(t,e){function r(c){var l=c&&c.forceBase64;l&&(this.supportsBinary=!1),n.call(this,c)}var n=t("../transport"),o=t("engine.io-parser"),i=t("parseqs"),u=t("component-inherit"),h=t("debug")("engine.io-client:websocket"),f=t("ws");e.exports=r,u(r,n),r.prototype.name="websocket",r.prototype.supportsBinary=!0,r.prototype.doOpen=function(){if(this.check()){var c=this.uri(),l=void 0,p={agent:this.agent};p.pfx=this.pfx,p.key=this.key,p.passphrase=this.passphrase,p.cert=this.cert,p.ca=this.ca,p.ciphers=this.ciphers,p.rejectUnauthorized=this.rejectUnauthorized,this.ws=new f(c,l,p),this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.binaryType="arraybuffer",this.addEventListeners()}},r.prototype.addEventListeners=function(){var c=this;this.ws.onopen=function(){c.onOpen()},this.ws.onclose=function(){c.onClose()},this.ws.onmessage=function(l){c.onData(l.data)},this.ws.onerror=function(l){c.onError("websocket error",l)}},typeof navigator<"u"&&/iPad|iPhone|iPod/i.test(navigator.userAgent)&&(r.prototype.onData=function(c){var l=this;setTimeout(function(){n.prototype.onData.call(l,c)},0)}),r.prototype.write=function(c){function l(){p.writable=!0,p.emit("drain")}var p=this;this.writable=!1;for(var a=0,s=c.length;s>a;a++)o.encodePacket(c[a],this.supportsBinary,function(d){try{p.ws.send(d)}catch{h("websocket closed before onclose event")}});setTimeout(l,0)},r.prototype.onClose=function(){n.prototype.onClose.call(this)},r.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()},r.prototype.uri=function(){var c=this.query||{},l=this.secure?"wss":"ws",p="";return this.port&&(l=="wss"&&this.port!=443||l=="ws"&&this.port!=80)&&(p=":"+this.port),this.timestampRequests&&(c[this.timestampParam]=+new Date),this.supportsBinary||(c.b64=1),c=i.encode(c),c.length&&(c="?"+c),l+"://"+this.hostname+p+this.path+c},r.prototype.check=function(){return!(!f||"__initialize"in f&&this.name===r.prototype.name)}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,ws:35}],20:[function(t,e){var r=t("has-cors");e.exports=function(n){var o=n.xdomain,i=n.xscheme,u=n.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!o||r))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!i&&u)return new XDomainRequest}catch{}if(!o)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{}}},{"has-cors":38}],21:[function(t,e){e.exports=function(r,n){var o=function(){};o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r}},{}],22:[function(t,e,r){function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var f=arguments,c=this.useColors;if(f[0]=(c?"%c":"")+this.namespace+(c?" %c":" ")+f[0]+(c?"%c ":" ")+"+"+r.humanize(this.diff),!c)return f;var l="color: "+this.color;f=[f[0],l,"color: inherit"].concat(Array.prototype.slice.call(f,1));var p=0,a=0;return f[0].replace(/%[a-z%]/g,function(s){s!=="%%"&&(p++,s==="%c"&&(a=p))}),f.splice(a,0,l),f}function i(){return typeof console=="object"&&typeof console.log=="function"&&Function.prototype.apply.call(console.log,console,arguments)}function u(f){try{f==null?localStorage.removeItem("debug"):localStorage.debug=f}catch{}}function h(){var f;try{f=localStorage.debug}catch{}return f}r=e.exports=t("./debug"),r.log=i,r.formatArgs=o,r.save=u,r.load=h,r.useColors=n,r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(f){return JSON.stringify(f)},r.enable(h())},{"./debug":23}],23:[function(t,e,r){function n(){return r.colors[l++%r.colors.length]}function o(p){function a(){}function s(){var y=s,g=+new Date,w=g-(c||g);y.diff=w,y.prev=c,y.curr=g,c=g,y.useColors==null&&(y.useColors=r.useColors()),y.color==null&&y.useColors&&(y.color=n());var B=Array.prototype.slice.call(arguments);B[0]=r.coerce(B[0]),typeof B[0]!="string"&&(B=["%o"].concat(B));var _=0;B[0]=B[0].replace(/%([a-z%])/g,function(S,m){if(S==="%%")return S;_++;var C=r.formatters[m];if(typeof C=="function"){var E=B[_];S=C.call(y,E),B.splice(_,1),_--}return S}),typeof r.formatArgs=="function"&&(B=r.formatArgs.apply(y,B));var b=s.log||r.log||console.log.bind(console);b.apply(y,B)}a.enabled=!1,s.enabled=!0;var d=r.enabled(p)?s:a;return d.namespace=p,d}function i(p){r.save(p);for(var a=(p||"").split(/[\s,]+/),s=a.length,d=0;s>d;d++)a[d]&&(p=a[d].replace(/\*/g,".*?"),p[0]==="-"?r.skips.push(new RegExp("^"+p.substr(1)+"$")):r.names.push(new RegExp("^"+p+"$")))}function u(){r.enable("")}function h(p){var a,s;for(a=0,s=r.skips.length;s>a;a++)if(r.skips[a].test(p))return!1;for(a=0,s=r.names.length;s>a;a++)if(r.names[a].test(p))return!0;return!1}function f(p){return p instanceof Error?p.stack||p.message:p}r=e.exports=o,r.coerce=f,r.disable=u,r.enable=i,r.enabled=h,r.humanize=t("ms"),r.names=[],r.skips=[],r.formatters={};var c,l=0},{ms:24}],24:[function(t,e){function r(p){var a=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(p);if(a){var s=parseFloat(a[1]),d=(a[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"y":return s*l;case"days":case"day":case"d":return s*c;case"hours":case"hour":case"h":return s*f;case"minutes":case"minute":case"m":return s*h;case"seconds":case"second":case"s":return s*u;case"ms":return s}}}function n(p){return p>=c?Math.round(p/c)+"d":p>=f?Math.round(p/f)+"h":p>=h?Math.round(p/h)+"m":p>=u?Math.round(p/u)+"s":p+"ms"}function o(p){return i(p,c,"day")||i(p,f,"hour")||i(p,h,"minute")||i(p,u,"second")||p+" ms"}function i(p,a,s){return a>p?void 0:1.5*a>p?Math.floor(p/a)+" "+s:Math.ceil(p/a)+" "+s+"s"}var u=1e3,h=60*u,f=60*h,c=24*f,l=365.25*c;e.exports=function(p,a){return a=a||{},typeof p=="string"?r(p):a.long?o(p):n(p)}},{}],25:[function(t,e,r){(function(n){function o(m,C){var E="b"+r.packets[m.type]+m.data.data;return C(E)}function i(m,C,E){if(!C)return r.encodeBase64Packet(m,E);var v=m.data,k=new Uint8Array(v),T=new Uint8Array(1+v.byteLength);T[0]=B[m.type];for(var O=0;O<k.length;O++)T[O+1]=k[O];return E(T.buffer)}function u(m,C,E){if(!C)return r.encodeBase64Packet(m,E);var v=new FileReader;return v.onload=function(){m.data=v.result,r.encodePacket(m,C,!0,E)},v.readAsArrayBuffer(m.data)}function h(m,C,E){if(!C)return r.encodeBase64Packet(m,E);if(w)return u(m,C,E);var v=new Uint8Array(1);v[0]=B[m.type];var k=new S([v.buffer,m.data]);return E(k)}function f(m,C,E){for(var v=new Array(m.length),k=s(m.length,E),T=function(x,A,q){C(A,function(j,$){v[x]=$,q(j,v)})},O=0;O<m.length;O++)T(O,m[O],k)}var c=t("./keys"),l=t("has-binary"),p=t("arraybuffer.slice"),a=t("base64-arraybuffer"),s=t("after"),d=t("utf8"),y=navigator.userAgent.match(/Android/i),g=/PhantomJS/i.test(navigator.userAgent),w=y||g;r.protocol=3;var B=r.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},_=c(B),b={type:"error",data:"parser error"},S=t("blob");r.encodePacket=function(m,C,E,v){typeof C=="function"&&(v=C,C=!1),typeof E=="function"&&(v=E,E=null);var k=m.data===void 0?void 0:m.data.buffer||m.data;if(n.ArrayBuffer&&k instanceof ArrayBuffer)return i(m,C,v);if(S&&k instanceof n.Blob)return h(m,C,v);if(k&&k.base64)return o(m,v);var T=B[m.type];return m.data!==void 0&&(T+=E?d.encode(String(m.data)):String(m.data)),v(""+T)},r.encodeBase64Packet=function(m,C){var E="b"+r.packets[m.type];if(S&&m.data instanceof S){var v=new FileReader;return v.onload=function(){var A=v.result.split(",")[1];C(E+A)},v.readAsDataURL(m.data)}var k;try{k=String.fromCharCode.apply(null,new Uint8Array(m.data))}catch{for(var T=new Uint8Array(m.data),O=new Array(T.length),x=0;x<T.length;x++)O[x]=T[x];k=String.fromCharCode.apply(null,O)}return E+=n.btoa(k),C(E)},r.decodePacket=function(m,C,E){if(typeof m=="string"||m===void 0){if(m.charAt(0)=="b")return r.decodeBase64Packet(m.substr(1),C);if(E)try{m=d.decode(m)}catch{return b}var k=m.charAt(0);return Number(k)==k&&_[k]?m.length>1?{type:_[k],data:m.substring(1)}:{type:_[k]}:b}var v=new Uint8Array(m),k=v[0],T=p(m,1);return S&&C==="blob"&&(T=new S([T])),{type:_[k],data:T}},r.decodeBase64Packet=function(m,C){var E=_[m.charAt(0)];if(!n.ArrayBuffer)return{type:E,data:{base64:!0,data:m.substr(1)}};var v=a.decode(m.substr(1));return C==="blob"&&S&&(v=new S([v])),{type:E,data:v}},r.encodePayload=function(m,C,E){function v(O){return O.length+":"+O}function k(O,x){r.encodePacket(O,T?C:!1,!0,function(A){x(null,v(A))})}typeof C=="function"&&(E=C,C=null);var T=l(m);return C&&T?S&&!w?r.encodePayloadAsBlob(m,E):r.encodePayloadAsArrayBuffer(m,E):m.length?void f(m,k,function(O,x){return E(x.join(""))}):E("0:")},r.decodePayload=function(m,C,E){if(typeof m!="string")return r.decodePayloadAsBinary(m,C,E);typeof C=="function"&&(E=C,C=null);var v;if(m=="")return E(b,0,1);for(var k,T,O="",x=0,A=m.length;A>x;x++){var q=m.charAt(x);if(q!=":")O+=q;else{if(O==""||O!=(k=Number(O))||(T=m.substr(x+1,k),O!=T.length))return E(b,0,1);if(T.length){if(v=r.decodePacket(T,C,!0),b.type==v.type&&b.data==v.data)return E(b,0,1);var j=E(v,x+k,A);if(j===!1)return}x+=k,O=""}}return O!=""?E(b,0,1):void 0},r.encodePayloadAsArrayBuffer=function(m,C){function E(v,k){r.encodePacket(v,!0,!0,function(T){return k(null,T)})}return m.length?void f(m,E,function(v,k){var T=k.reduce(function(A,q){var j;return j=typeof q=="string"?q.length:q.byteLength,A+j.toString().length+j+2},0),O=new Uint8Array(T),x=0;return k.forEach(function(A){var q=typeof A=="string",j=A;if(q){for(var $=new Uint8Array(A.length),X=0;X<A.length;X++)$[X]=A.charCodeAt(X);j=$.buffer}O[x++]=q?0:1;for(var et=j.byteLength.toString(),X=0;X<et.length;X++)O[x++]=parseInt(et[X]);O[x++]=255;for(var $=new Uint8Array(j),X=0;X<$.length;X++)O[x++]=$[X]}),C(O.buffer)}):C(new ArrayBuffer(0))},r.encodePayloadAsBlob=function(m,C){function E(v,k){r.encodePacket(v,!0,!0,function(T){var O=new Uint8Array(1);if(O[0]=1,typeof T=="string"){for(var x=new Uint8Array(T.length),A=0;A<T.length;A++)x[A]=T.charCodeAt(A);T=x.buffer,O[0]=0}for(var q=T instanceof ArrayBuffer?T.byteLength:T.size,j=q.toString(),$=new Uint8Array(j.length+1),A=0;A<j.length;A++)$[A]=parseInt(j[A]);if($[j.length]=255,S){var X=new S([O.buffer,$.buffer,T]);k(null,X)}})}f(m,E,function(v,k){return C(new S(k))})},r.decodePayloadAsBinary=function(m,C,E){typeof C=="function"&&(E=C,C=null);for(var v=m,k=[],T=!1;v.byteLength>0;){for(var O=new Uint8Array(v),x=O[0]===0,A="",q=1;O[q]!=255;q++){if(A.length>310){T=!0;break}A+=O[q]}if(T)return E(b,0,1);v=p(v,2+A.length),A=parseInt(A);var j=p(v,0,A);if(x)try{j=String.fromCharCode.apply(null,new Uint8Array(j))}catch{var $=new Uint8Array(j);j="";for(var q=0;q<$.length;q++)j+=String.fromCharCode($[q])}k.push(j),v=p(v,A)}var X=k.length;k.forEach(function(et,Nt){E(r.decodePacket(et,C,!0),Nt,X)})}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./keys":26,after:27,"arraybuffer.slice":28,"base64-arraybuffer":29,blob:30,"has-binary":36,utf8:31}],26:[function(t,e){e.exports=Object.keys||function(r){var n=[],o=Object.prototype.hasOwnProperty;for(var i in r)o.call(r,i)&&n.push(i);return n}},{}],27:[function(t,e){function r(o,i,u){function h(c,l){if(h.count<=0)throw new Error("after called too many times");--h.count,c?(f=!0,i(c),i=u):h.count!==0||f||i(null,l)}var f=!1;return u=u||n,h.count=o,o===0?i():h}function n(){}e.exports=r},{}],28:[function(t,e){e.exports=function(r,n,o){var i=r.byteLength;if(n=n||0,o=o||i,r.slice)return r.slice(n,o);if(0>n&&(n+=i),0>o&&(o+=i),o>i&&(o=i),n>=i||n>=o||i===0)return new ArrayBuffer(0);for(var u=new Uint8Array(r),h=new Uint8Array(o-n),f=n,c=0;o>f;f++,c++)h[c]=u[f];return h.buffer}},{}],29:[function(t,e,r){(function(n){r.encode=function(o){var i,u=new Uint8Array(o),h=u.length,f="";for(i=0;h>i;i+=3)f+=n[u[i]>>2],f+=n[(3&u[i])<<4|u[i+1]>>4],f+=n[(15&u[i+1])<<2|u[i+2]>>6],f+=n[63&u[i+2]];return h%3===2?f=f.substring(0,f.length-1)+"=":h%3===1&&(f=f.substring(0,f.length-2)+"=="),f},r.decode=function(o){var i,u,h,f,c,l=.75*o.length,p=o.length,a=0;o[o.length-1]==="="&&(l--,o[o.length-2]==="="&&l--);var s=new ArrayBuffer(l),d=new Uint8Array(s);for(i=0;p>i;i+=4)u=n.indexOf(o[i]),h=n.indexOf(o[i+1]),f=n.indexOf(o[i+2]),c=n.indexOf(o[i+3]),d[a++]=u<<2|h>>4,d[a++]=(15&h)<<4|f>>2,d[a++]=(3&f)<<6|63&c;return s}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],30:[function(t,e){(function(r){function n(l){for(var p=0;p<l.length;p++){var a=l[p];if(a.buffer instanceof ArrayBuffer){var s=a.buffer;if(a.byteLength!==s.byteLength){var d=new Uint8Array(a.byteLength);d.set(new Uint8Array(s,a.byteOffset,a.byteLength)),s=d.buffer}l[p]=s}}}function o(l,p){p=p||{};var a=new u;n(l);for(var s=0;s<l.length;s++)a.append(l[s]);return p.type?a.getBlob(p.type):a.getBlob()}function i(l,p){return n(l),new Blob(l,p||{})}var u=r.BlobBuilder||r.WebKitBlobBuilder||r.MSBlobBuilder||r.MozBlobBuilder,h=function(){try{var l=new Blob(["hi"]);return l.size===2}catch{return!1}}(),f=h&&function(){try{var l=new Blob([new Uint8Array([1,2])]);return l.size===2}catch{return!1}}(),c=u&&u.prototype.append&&u.prototype.getBlob;e.exports=function(){return h?f?r.Blob:i:c?o:void 0}()}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],31:[function(t,e,r){(function(n){(function(o){function i(v){for(var k,T,O=[],x=0,A=v.length;A>x;)k=v.charCodeAt(x++),k>=55296&&56319>=k&&A>x?(T=v.charCodeAt(x++),(64512&T)==56320?O.push(((1023&k)<<10)+(1023&T)+65536):(O.push(k),x--)):O.push(k);return O}function u(v){for(var k,T=v.length,O=-1,x="";++O<T;)k=v[O],k>65535&&(k-=65536,x+=b(k>>>10&1023|55296),k=56320|1023&k),x+=b(k);return x}function h(v){if(v>=55296&&57343>=v)throw Error("Lone surrogate U+"+v.toString(16).toUpperCase()+" is not a scalar value")}function f(v,k){return b(v>>k&63|128)}function c(v){if(!(4294967168&v))return b(v);var k="";return 4294965248&v?4294901760&v?!(4292870144&v)&&(k=b(v>>18&7|240),k+=f(v,12),k+=f(v,6)):(h(v),k=b(v>>12&15|224),k+=f(v,6)):k=b(v>>6&31|192),k+=b(63&v|128)}function l(v){for(var k,T=i(v),O=T.length,x=-1,A="";++x<O;)k=T[x],A+=c(k);return A}function p(){if(_>=B)throw Error("Invalid byte index");var v=255&w[_];if(_++,(192&v)==128)return 63&v;throw Error("Invalid continuation byte")}function a(){var v,k,T,O,x;if(_>B)throw Error("Invalid byte index");if(_==B)return!1;if(v=255&w[_],_++,(128&v)==0)return v;if((224&v)==192){var k=p();if(x=(31&v)<<6|k,x>=128)return x;throw Error("Invalid continuation byte")}if((240&v)==224){if(k=p(),T=p(),x=(15&v)<<12|k<<6|T,x>=2048)return h(x),x;throw Error("Invalid continuation byte")}if((248&v)==240&&(k=p(),T=p(),O=p(),x=(15&v)<<18|k<<12|T<<6|O,x>=65536&&1114111>=x))return x;throw Error("Invalid UTF-8 detected")}function s(v){w=i(v),B=w.length,_=0;for(var k,T=[];(k=a())!==!1;)T.push(k);return u(T)}var d=typeof r=="object"&&r,y=typeof e=="object"&&e&&e.exports==d&&e,g=typeof n=="object"&&n;(g.global===g||g.window===g)&&(o=g);var w,B,_,b=String.fromCharCode,S={version:"2.0.0",encode:l,decode:s};if(d&&!d.nodeType)if(y)y.exports=S;else{var m={},C=m.hasOwnProperty;for(var E in S)C.call(S,E)&&(d[E]=S[E])}else o.utf8=S})(this)}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],32:[function(t,e){(function(r){var n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,i=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,u=/(?:^|:|,)(?:\s*\[)+/g,h=/^\s+/,f=/\s+$/;e.exports=function(c){return typeof c=="string"&&c?(c=c.replace(h,"").replace(f,""),r.JSON&&JSON.parse?JSON.parse(c):n.test(c.replace(o,"@").replace(i,"]").replace(u,""))?new Function("return "+c)():void 0):null}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],33:[function(t,e,r){r.encode=function(n){var o="";for(var i in n)n.hasOwnProperty(i)&&(o.length&&(o+="&"),o+=encodeURIComponent(i)+"="+encodeURIComponent(n[i]));return o},r.decode=function(n){for(var o={},i=n.split("&"),u=0,h=i.length;h>u;u++){var f=i[u].split("=");o[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return o}},{}],34:[function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(o){var i=o,u=o.indexOf("["),h=o.indexOf("]");u!=-1&&h!=-1&&(o=o.substring(0,u)+o.substring(u,h).replace(/:/g,";")+o.substring(h,o.length));for(var f=r.exec(o||""),c={},l=14;l--;)c[n[l]]=f[l]||"";return u!=-1&&h!=-1&&(c.source=i,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c}},{}],35:[function(t,e){function r(i,u){return u?new o(i,u):new o(i)}var n=function(){return self}(),o=n.WebSocket||n.MozWebSocket;e.exports=o?r:null,o&&(r.prototype=o.prototype)},{}],36:[function(t,e){(function(r){function n(i){function u(h){if(!h)return!1;if(r.Buffer&&r.Buffer.isBuffer(h)||r.ArrayBuffer&&h instanceof ArrayBuffer||r.Blob&&h instanceof Blob||r.File&&h instanceof File)return!0;if(o(h)){for(var f=0;f<h.length;f++)if(u(h[f]))return!0}else if(h&&typeof h=="object"){h.toJSON&&(h=h.toJSON());for(var c in h)if(Object.prototype.hasOwnProperty.call(h,c)&&u(h[c]))return!0}return!1}return u(i)}var o=t("isarray");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{isarray:37}],37:[function(t,e){e.exports=Array.isArray||function(r){return Object.prototype.toString.call(r)=="[object Array]"}},{}],38:[function(t,e){var r=t("global");try{e.exports="XMLHttpRequest"in r&&"withCredentials"in new r.XMLHttpRequest}catch{e.exports=!1}},{global:39}],39:[function(t,e){e.exports=function(){return this}()},{}],40:[function(t,e){var r=[].indexOf;e.exports=function(n,o){if(r)return n.indexOf(o);for(var i=0;i<n.length;++i)if(n[i]===o)return i;return-1}},{}],41:[function(t,e,r){var n=Object.prototype.hasOwnProperty;r.keys=Object.keys||function(o){var i=[];for(var u in o)n.call(o,u)&&i.push(u);return i},r.values=function(o){var i=[];for(var u in o)n.call(o,u)&&i.push(o[u]);return i},r.merge=function(o,i){for(var u in i)n.call(i,u)&&(o[u]=i[u]);return o},r.length=function(o){return r.keys(o).length},r.isEmpty=function(o){return r.length(o)==0}},{}],42:[function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(o){for(var i=r.exec(o||""),u={},h=14;h--;)u[n[h]]=i[h]||"";return u}},{}],43:[function(t,e,r){(function(n){var o=t("isarray"),i=t("./is-buffer");r.deconstructPacket=function(u){function h(p){if(!p)return p;if(i(p)){var a={_placeholder:!0,num:f.length};return f.push(p),a}if(o(p)){for(var s=new Array(p.length),d=0;d<p.length;d++)s[d]=h(p[d]);return s}if(typeof p=="object"&&!(p instanceof Date)){var s={};for(var y in p)s[y]=h(p[y]);return s}return p}var f=[],c=u.data,l=u;return l.data=h(c),l.attachments=f.length,{packet:l,buffers:f}},r.reconstructPacket=function(u,h){function f(c){if(c&&c._placeholder){var l=h[c.num];return l}if(o(c)){for(var p=0;p<c.length;p++)c[p]=f(c[p]);return c}if(c&&typeof c=="object"){for(var a in c)c[a]=f(c[a]);return c}return c}return u.data=f(u.data),u.attachments=void 0,u},r.removeBlobs=function(u,h){function f(p,a,s){if(!p)return p;if(n.Blob&&p instanceof Blob||n.File&&p instanceof File){c++;var d=new FileReader;d.onload=function(){s?s[a]=this.result:l=this.result,--c||h(l)},d.readAsArrayBuffer(p)}else if(o(p))for(var y=0;y<p.length;y++)f(p[y],y,p);else if(p&&typeof p=="object"&&!i(p))for(var g in p)f(p[g],g,p)}var c=0,l=u;f(l),c||h(l)}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./is-buffer":45,isarray:46}],44:[function(t,e,r){function n(){}function o(y){var g="",w=!1;return g+=y.type,(r.BINARY_EVENT==y.type||r.BINARY_ACK==y.type)&&(g+=y.attachments,g+="-"),y.nsp&&y.nsp!="/"&&(w=!0,g+=y.nsp),y.id!=null&&(w&&(g+=",",w=!1),g+=y.id),y.data!=null&&(w&&(g+=","),g+=p.stringify(y.data)),l("encoded %j as %s",y,g),g}function i(y,g){function w(B){var _=s.deconstructPacket(B),b=o(_.packet),S=_.buffers;S.unshift(b),g(S)}s.removeBlobs(y,w)}function u(){this.reconstructor=null}function h(y){var g={},w=0;if(g.type=Number(y.charAt(0)),r.types[g.type]==null)return c();if(r.BINARY_EVENT==g.type||r.BINARY_ACK==g.type){for(var B="";y.charAt(++w)!="-"&&(B+=y.charAt(w),w!=y.length););if(B!=Number(B)||y.charAt(w)!="-")throw new Error("Illegal attachments");g.attachments=Number(B)}if(y.charAt(w+1)=="/")for(g.nsp="";++w;){var _=y.charAt(w);if(_==","||(g.nsp+=_,w==y.length))break}else g.nsp="/";var b=y.charAt(w+1);if(b!==""&&Number(b)==b){for(g.id="";++w;){var _=y.charAt(w);if(_==null||Number(_)!=_){--w;break}if(g.id+=y.charAt(w),w==y.length)break}g.id=Number(g.id)}if(y.charAt(++w))try{g.data=p.parse(y.substr(w))}catch{return c()}return l("decoded %s as %j",y,g),g}function f(y){this.reconPack=y,this.buffers=[]}function c(){return{type:r.ERROR,data:"parser error"}}var l=t("debug")("socket.io-parser"),p=t("json3"),a=(t("isarray"),t("component-emitter")),s=t("./binary"),d=t("./is-buffer");r.protocol=4,r.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"],r.CONNECT=0,r.DISCONNECT=1,r.EVENT=2,r.ACK=3,r.ERROR=4,r.BINARY_EVENT=5,r.BINARY_ACK=6,r.Encoder=n,r.Decoder=u,n.prototype.encode=function(y,g){if(l("encoding packet %j",y),r.BINARY_EVENT==y.type||r.BINARY_ACK==y.type)i(y,g);else{var w=o(y);g([w])}},a(u.prototype),u.prototype.add=function(y){var g;if(typeof y=="string")g=h(y),r.BINARY_EVENT==g.type||r.BINARY_ACK==g.type?(this.reconstructor=new f(g),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",g)):this.emit("decoded",g);else{if(!d(y)&&!y.base64)throw new Error("Unknown type: "+y);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");g=this.reconstructor.takeBinaryData(y),g&&(this.reconstructor=null,this.emit("decoded",g))}},u.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},f.prototype.takeBinaryData=function(y){if(this.buffers.push(y),this.buffers.length==this.reconPack.attachments){var g=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),g}return null},f.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},{"./binary":43,"./is-buffer":45,"component-emitter":9,debug:10,isarray:46,json3:47}],45:[function(t,e){(function(r){function n(o){return r.Buffer&&r.Buffer.isBuffer(o)||r.ArrayBuffer&&o instanceof ArrayBuffer}e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],46:[function(t,e){e.exports=t(37)},{}],47:[function(t,e,r){(function(n){function o(R){if(o[R]!==h)return o[R];var U;if(R=="bug-string-char-index")U=!1;else if(R=="json")U=o("json-stringify")&&o("json-parse");else{var I,F='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(R=="json-stringify"){var N=l.stringify,D=typeof N=="function"&&p;if(D){(I=function(){return 1}).toJSON=I;try{D=N(0)==="0"&&N(new Number)==="0"&&N(new String)=='""'&&N(f)===h&&N(h)===h&&N()===h&&N(I)==="1"&&N([I])=="[1]"&&N([h])=="[null]"&&N(null)=="null"&&N([h,f,null])=="[null,null,null]"&&N({a:[I,!0,!1,null,`\0\b
|
|
9
|
+
\f\r `]})==F&&N(null,I)==="1"&&N([1,2],null,1)==`[
|
|
10
|
+
1,
|
|
11
|
+
2
|
|
12
|
+
]`&&N(new Date(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&N(new Date(864e13))=='"+275760-09-13T00:00:00.000Z"'&&N(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&N(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch{D=!1}}U=D}if(R=="json-parse"){var P=l.parse;if(typeof P=="function")try{if(P("0")===0&&!P(!1)){I=P(F);var L=I.a.length==5&&I.a[0]===1;if(L){try{L=!P('" "')}catch{}if(L)try{L=P("01")!==1}catch{}if(L)try{L=P("1.")!==1}catch{}}}}catch{L=!1}U=L}}return o[R]=!!U}var i,u,h,f={}.toString,c=typeof JSON=="object"&&JSON,l=typeof r=="object"&&r&&!r.nodeType&&r;l&&c?(l.stringify=c.stringify,l.parse=c.parse):l=n.JSON=c||{};var p=new Date(-0xc782b5b800cec);try{p=p.getUTCFullYear()==-109252&&p.getUTCMonth()===0&&p.getUTCDate()===1&&p.getUTCHours()==10&&p.getUTCMinutes()==37&&p.getUTCSeconds()==6&&p.getUTCMilliseconds()==708}catch{}if(!o("json")){var a="[object Function]",s="[object Date]",d="[object Number]",y="[object String]",g="[object Array]",w="[object Boolean]",B=o("bug-string-char-index");if(!p)var _=Math.floor,b=[0,31,59,90,120,151,181,212,243,273,304,334],S=function(R,U){return b[U]+365*(R-1970)+_((R-1969+(U=+(U>1)))/4)-_((R-1901+U)/100)+_((R-1601+U)/400)};(i={}.hasOwnProperty)||(i=function(R){var U,I={};return(I.__proto__=null,I.__proto__={toString:1},I).toString!=f?i=function(F){var N=this.__proto__,D=F in(this.__proto__=null,this);return this.__proto__=N,D}:(U=I.constructor,i=function(F){var N=(this.constructor||U).prototype;return F in this&&!(F in N&&this[F]===N[F])}),I=null,i.call(this,R)});var m={boolean:1,number:1,string:1,undefined:1},C=function(R,U){var I=typeof R[U];return I=="object"?!!R[U]:!m[I]};if(u=function(R,U){var I,F,N,D=0;(I=function(){this.valueOf=0}).prototype.valueOf=0,F=new I;for(N in F)i.call(F,N)&&D++;return I=F=null,D?u=D==2?function(P,L){var M,J={},nt=f.call(P)==a;for(M in P)nt&&M=="prototype"||i.call(J,M)||!(J[M]=1)||!i.call(P,M)||L(M)}:function(P,L){var M,J,nt=f.call(P)==a;for(M in P)nt&&M=="prototype"||!i.call(P,M)||(J=M==="constructor")||L(M);(J||i.call(P,M="constructor"))&&L(M)}:(F=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],u=function(P,L){var M,J,nt=f.call(P)==a,ot=!nt&&typeof P.constructor!="function"&&C(P,"hasOwnProperty")?P.hasOwnProperty:i;for(M in P)nt&&M=="prototype"||!ot.call(P,M)||L(M);for(J=F.length;M=F[--J];ot.call(P,M)&&L(M));}),u(R,U)},!o("json-stringify")){var E={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},v="000000",k=function(R,U){return(v+(U||0)).slice(-R)},T="\\u00",O=function(R){var U,I='"',F=0,N=R.length,D=N>10&&B;for(D&&(U=R.split(""));N>F;F++){var P=R.charCodeAt(F);switch(P){case 8:case 9:case 10:case 12:case 13:case 34:case 92:I+=E[P];break;default:if(32>P){I+=T+k(2,P.toString(16));break}I+=D?U[F]:B?R.charAt(F):R[F]}}return I+'"'},x=function(R,U,I,F,N,D,P){var L,M,J,nt,ot,Ot,Vt,$t,Gt,Yt,ut,Qt,Ut,xt,Zt,te;try{L=U[R]}catch{}if(typeof L=="object"&&L)if(M=f.call(L),M!=s||i.call(L,"toJSON"))typeof L.toJSON=="function"&&(M!=d&&M!=y&&M!=g||i.call(L,"toJSON"))&&(L=L.toJSON(R));else if(L>-1/0&&1/0>L){if(S){for(ot=_(L/864e5),J=_(ot/365.2425)+1970-1;S(J+1,0)<=ot;J++);for(nt=_((ot-S(J,0))/30.42);S(J,nt+1)<=ot;nt++);ot=1+ot-S(J,nt),Ot=(L%864e5+864e5)%864e5,Vt=_(Ot/36e5)%24,$t=_(Ot/6e4)%60,Gt=_(Ot/1e3)%60,Yt=Ot%1e3}else J=L.getUTCFullYear(),nt=L.getUTCMonth(),ot=L.getUTCDate(),Vt=L.getUTCHours(),$t=L.getUTCMinutes(),Gt=L.getUTCSeconds(),Yt=L.getUTCMilliseconds();L=(0>=J||J>=1e4?(0>J?"-":"+")+k(6,0>J?-J:J):k(4,J))+"-"+k(2,nt+1)+"-"+k(2,ot)+"T"+k(2,Vt)+":"+k(2,$t)+":"+k(2,Gt)+"."+k(3,Yt)+"Z"}else L=null;if(I&&(L=I.call(U,R,L)),L===null)return"null";if(M=f.call(L),M==w)return""+L;if(M==d)return L>-1/0&&1/0>L?""+L:"null";if(M==y)return O(""+L);if(typeof L=="object"){for(xt=P.length;xt--;)if(P[xt]===L)throw TypeError();if(P.push(L),ut=[],Zt=D,D+=N,M==g){for(Ut=0,xt=L.length;xt>Ut;Ut++)Qt=x(Ut,L,I,F,N,D,P),ut.push(Qt===h?"null":Qt);te=ut.length?N?`[
|
|
13
|
+
`+D+ut.join(`,
|
|
14
|
+
`+D)+`
|
|
15
|
+
`+Zt+"]":"["+ut.join(",")+"]":"[]"}else u(F||L,function(ee){var De=x(ee,L,I,F,N,D,P);De!==h&&ut.push(O(ee)+":"+(N?" ":"")+De)}),te=ut.length?N?`{
|
|
16
|
+
`+D+ut.join(`,
|
|
17
|
+
`+D)+`
|
|
18
|
+
`+Zt+"}":"{"+ut.join(",")+"}":"{}";return P.pop(),te}};l.stringify=function(R,U,I){var F,N,D,P;if(typeof U=="function"||typeof U=="object"&&U){if((P=f.call(U))==a)N=U;else if(P==g){D={};for(var L,M=0,J=U.length;J>M;L=U[M++],P=f.call(L),(P==y||P==d)&&(D[L]=1));}}if(I)if((P=f.call(I))==d){if((I-=I%1)>0)for(F="",I>10&&(I=10);F.length<I;F+=" ");}else P==y&&(F=I.length<=10?I:I.slice(0,10));return x("",(L={},L[""]=R,L),N,D,F,"",[])}}if(!o("json-parse")){var A,q,j=String.fromCharCode,$={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:`
|
|
19
|
+
`,102:"\f",114:"\r"},X=function(){throw A=q=null,SyntaxError()},et=function(){for(var R,U,I,F,N,D=q,P=D.length;P>A;)switch(N=D.charCodeAt(A)){case 9:case 10:case 13:case 32:A++;break;case 123:case 125:case 91:case 93:case 58:case 44:return R=B?D.charAt(A):D[A],A++,R;case 34:for(R="@",A++;P>A;)if(N=D.charCodeAt(A),32>N)X();else if(N==92)switch(N=D.charCodeAt(++A)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:R+=$[N],A++;break;case 117:for(U=++A,I=A+4;I>A;A++)N=D.charCodeAt(A),N>=48&&57>=N||N>=97&&102>=N||N>=65&&70>=N||X();R+=j("0x"+D.slice(U,A));break;default:X()}else{if(N==34)break;for(N=D.charCodeAt(A),U=A;N>=32&&N!=92&&N!=34;)N=D.charCodeAt(++A);R+=D.slice(U,A)}if(D.charCodeAt(A)==34)return A++,R;X();default:if(U=A,N==45&&(F=!0,N=D.charCodeAt(++A)),N>=48&&57>=N){for(N==48&&(N=D.charCodeAt(A+1),N>=48&&57>=N)&&X(),F=!1;P>A&&(N=D.charCodeAt(A),N>=48&&57>=N);A++);if(D.charCodeAt(A)==46){for(I=++A;P>I&&(N=D.charCodeAt(I),N>=48&&57>=N);I++);I==A&&X(),A=I}if(N=D.charCodeAt(A),N==101||N==69){for(N=D.charCodeAt(++A),(N==43||N==45)&&A++,I=A;P>I&&(N=D.charCodeAt(I),N>=48&&57>=N);I++);I==A&&X(),A=I}return+D.slice(U,A)}if(F&&X(),D.slice(A,A+4)=="true")return A+=4,!0;if(D.slice(A,A+5)=="false")return A+=5,!1;if(D.slice(A,A+4)=="null")return A+=4,null;X()}return"$"},Nt=function(R){var U,I;if(R=="$"&&X(),typeof R=="string"){if((B?R.charAt(0):R[0])=="@")return R.slice(1);if(R=="["){for(U=[];R=et(),R!="]";I||(I=!0))I&&(R==","?(R=et(),R=="]"&&X()):X()),R==","&&X(),U.push(Nt(R));return U}if(R=="{"){for(U={};R=et(),R!="}";I||(I=!0))I&&(R==","?(R=et(),R=="}"&&X()):X()),(R==","||typeof R!="string"||(B?R.charAt(0):R[0])!="@"||et()!=":")&&X(),U[R.slice(1)]=Nt(et());return U}X()}return R},Le=function(R,U,I){var F=Ue(R,U,I);F===h?delete R[U]:R[U]=F},Ue=function(R,U,I){var F,N=R[U];if(typeof N=="object"&&N)if(f.call(N)==g)for(F=N.length;F--;)Le(N,F,I);else u(N,function(D){Le(N,D,I)});return I.call(R,U,N)};l.parse=function(R,U){var I,F;return A=0,q=""+R,I=Nt(et()),et()!="$"&&X(),A=q=null,U&&f.call(U)==a?Ue((F={},F[""]=I,F),"",U):I}}}})(this)},{}],48:[function(t,e){function r(n,o){var i=[];o=o||0;for(var u=o||0;u<n.length;u++)i[u-o]=n[u];return i}e.exports=r},{}]},{},[1])(1)}const zo=Object.freeze(Object.defineProperty({__proto__:null,default:qo},Symbol.toStringTag,{value:"Module"})),Xo=Object.assign({"./v1_3_7.js":zo}),Wo=/v\d+_\d+_\d+/;function Ko(t){return typeof t=="function"}const be=Object.entries(Xo).reduce((t,e)=>{var o;const r=e[1].default,n=(o=e[0].match(Wo))==null?void 0:o[0];return Ko(r)&&n&&(t[n]=r()),t},{}),Or=t=>{if(t in be)return be[t];throw new Error(`Socket version ${t} not found`)},Ho=(t,...e)=>Or(t)(...e),Jo={...be,getSocketVersion:Or,makeSocketVersion:Ho};var xr=(t=>(t.RINGING="Ringing",t.TALKING="Talking",t.DIALING="Dialing",t.HOLD="Hold",t))(xr||{}),Rr=(t=>(t.INCOMING="Incoming",t.OUTGOING="Outgoing",t))(Rr||{}),dt=(t=>(t.CONNECTED="connected",t.DISCONNECTED="disconnected",t.TRYING_TO_CONNECT="tryingToConnect",t))(dt||{}),Ir=(t=>(t.AUTOMATIC="Automatic",t.IVR="IVR",t))(Ir||{}),Br=(t=>(t.INCOMINC="Incoming",t.OUTGOING="Outgoing",t.SPY="Spy",t.CLICK2CALL="Click2Call",t))(Br||{}),_r=(t=>(t.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",t.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",t))(_r||{}),z=(t=>(t.ALL_DIALER_STATUS="AllDialersStatus",t.ALL_EXTENSION_STATUS="AllExtensionsStatus",t.ALL_USERS_STATUS="AllUsersStatus",t.CONNECT="connect",t.DISCONNECT="disconnect",t.CONNECT_ERROR_EVENT="connect_error",t.EXTENSION_EVENT="ExtensionEvent",t.KEEP_ALIVE="keepalive",t.KEEP_ALIVE_RESPONSE="keepaliveResponse",t.LOGIN_STATUS="loginStatus",t.LOGIN_SUCCESS="loginSuccess",t.QUEUE_EVENT="QueueEvent",t.ONLINE_STATUS_EVENT="onlineStatusEvent",t.DIALER_EVENT="DialerEvent",t.EXTENSIONS_UPDATED="ExtensionsUpdated",t))(z||{}),Be=(t=>(t.NEWCALL="NEWCALL",t.ANSWER="ANSWER",t.HOLD="HOLD",t.UNHOLD="UNHOLD",t.HANGUP="HANGUP",t.USER_STATUS_UPDATE="userStatusUpdate",t))(Be||{}),Lr=(t=>(t.NORMAL_HANGUP="Normal hangup",t.USER_BUSY="User busy",t.CALL_REJECTED="Call Rejected",t.UNALLOCATED_NUMBER="Unallocated (unassigned) number",t.UNKNOWN="Unknown",t.NO_USER_RESPONDING="No user responding",t.USER_ALERTING="User alerting, no answer",t.ANSWERED_ELSEWHERE="Answered elsewhere",t))(Lr||{}),Ur=(t=>(t.ANSWER="ANSWER",t.ABANDONED="ABANDONED",t.EXIT="EXIT",t.JOIN="JOIN",t))(Ur||{});class pe{static mapExtensionEvent(e){var u,h;const r=e.reason;let n,o;e.data.currentCall&&(o=this.mapExtensionCall(e,e.data.currentCall));const i=this.mapExtensionData(e,e.data);return r===Be.HANGUP?n={...e,reason:r,data:{...i,currentCall:o?{...o,duration:o.callAnswered_UTC_CLIENT?Date.now()-o.callAnswered_UTC_CLIENT:0}:void 0,calls:(u=e.data.calls)==null?void 0:u.map(f=>{const c=this.mapExtensionCall(e,f);return{...c,duration:c.callAnswered_UTC_CLIENT?Date.now()-c.callAnswered_UTC_CLIENT:0}})}}:n={...e,data:{...i,currentCall:o,calls:(h=e.data.calls)==null?void 0:h.map(f=>this.mapExtensionCall(e,f))},reason:r},n}static mapAllExtensionStatus(e){return{...e,extensions:e.extensions.map(r=>{var n;return{...this.mapExtensionData(e,r),currentCall:r.currentCall?this.mapExtensionCall(e,r.currentCall):void 0,calls:(n=r.calls)==null?void 0:n.map(o=>this.mapExtensionCall(e,o))}})}}static mapExtensionData(e,r){return this.configureUTCForObject(r,[{key:"lastAnsweredCallEventEpoch",format:"sec"},{key:"lastCallEventEpoch",format:"sec"},{key:"lastHangupCallEpoch",format:"sec"},{key:"representativeUpdated",format:"ms"}],e.servertime,e.servertimeoffset)}static mapExtensionCall(e,r){return this.configureUTCForObject(r,[{key:"callAnswered",format:"sec"},{key:"callStarted",format:"sec"}],e.servertime,e.servertimeoffset)}static mapQueueEvent(e){var r;return{...e,data:{...e.data,Calls:(r=e.data.Calls)==null?void 0:r.map(n=>this.configureUTCForObject(n,[{key:"JoinTimeStamp",format:"sec"}],e.servertime,e.servertimeoffset))}}}static assignProperty(e,r,n){e[r]=n}static configureUTCForObject(e,r,n,o){const i=(n-o*60)*1e3,u=Date.now()-i,h={};return r.forEach(f=>{const c=e[f.key],l=f.key;if(c!==0&&typeof c=="number"&&!isNaN(c)){let p=c;f.format==="ms"&&(p=Math.floor(p/1e3));const a=(p-o*60)*1e3;this.assignProperty(h,`${l}_UTC`,a),this.assignProperty(h,`${l}_UTC_CLIENT`,a+u)}else this.assignProperty(h,`${l}_UTC`,0),this.assignProperty(h,`${l}_UTC_CLIENT`,0)}),{...e,...h}}}var _e=(t=>(t.UPDATE_MONITORED_EXTENSIONS="updateMonitoredExtensions",t.KEEP_ALIVE="keepAlive",t))(_e||{});class Vo{constructor(e){K(this,"io");K(this,"ioFunction");K(this,"lastEventTimestamp",new Date().getTime());K(this,"doReconnect",!0);K(this,"keepAliveInterval");K(this,"keepReconnectInterval");K(this,"keepReconnectTimeout");K(this,"connected",!1);K(this,"reconnectionTime",20);this.eventsSdkClass=e,this.eventsSdkClass=e,window.addEventListener("offline",()=>{this.closeAllConnections()}),window.addEventListener("online",()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(vt.NEXT)})}getSocketIoFunction(e){const r=e.split("v="),n="v".concat(r[r.length-1]).replaceAll(".","_");this.ioFunction=Jo.getSocketVersion(n)}initSocketConnection(){const e=this.eventsSdkClass.authClass.token,r=this.eventsSdkClass.options.protocol,n=this.eventsSdkClass.server;try{const o=n?n.Domain:this.eventsSdkClass.URL,i=n?`${r}://${o}`:this.eventsSdkClass.URL;this.eventsSdkClass.eventEmitterClass.emit(z.ONLINE_STATUS_EVENT,{attemptToConnect:i,connectionStatus:dt.TRYING_TO_CONNECT});const u={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:e},timeout:this.eventsSdkClass.options.timeout};if(e&&(u.query={token:e}),this.ioFunction&&i)this.io=this.ioFunction(i,u),this.eventsSdkClass.loggerClass.log({Message:`${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${o}`,ActionName:at.WSCONNECT,isShowClient:!1,Status:"Switching Protocols",StatusCode:101,Level:tt.INFO,LogType:ct.INFO});else throw new Error("Socket server url no defined")}catch(o){this.eventsSdkClass.loggerClass.log({Message:`${o}`,ActionName:at.WSCONNECT,isShowClient:!1,Status:"Connection error",StatusCode:500,Level:tt.ERROR,LogType:ct.ERROR})}}clearKeepAliveInterval(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval)}initKeepAlive(){this.clearKeepAliveInterval(),this.keepAliveInterval=setInterval(async()=>{if(new Date().getTime()>this.lastEventTimestamp+this.eventsSdkClass.options.keepAliveTimeout&&this.io&&this.eventsSdkClass.authClass.token){this.eventsSdkClass.emit(_e.KEEP_ALIVE,this.eventsSdkClass.authClass.token),this.eventsSdkClass.loggerClass.log({Message:`Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,ActionName:at.WSCONNECT,isShowClient:!1,Level:tt.INFO,LogType:ct.INFO});return}},this.eventsSdkClass.options.keepAliveTimeout)}closeAllConnections(){var e;this.io&&(this.io.close(),(e=this.io)==null||e.disconnect(),this.io=void 0),Rt.clearSessionStorage()}initSocketEvents(){this.io&&this.io.on(z.LOGIN_SUCCESS,e=>this.onLoginSuccessEvent(e)).on(z.QUEUE_EVENT,e=>this.onQueueEvent(e)).on(z.EXTENSION_EVENT,e=>this.onExtensionEvent(e)).on(z.DIALER_EVENT,e=>this.onDialerEvent(e)).on(z.LOGIN_STATUS,e=>this.onLoginStatusEvent(e)).on(z.ALL_EXTENSION_STATUS,e=>this.onAllExtensionStatus(e)).on(z.ALL_DIALER_STATUS,e=>this.onAllDialerStatus(e)).on(z.KEEP_ALIVE_RESPONSE,e=>this.onKeepAliveResponse(e)).on(z.EXTENSIONS_UPDATED,e=>this.onExtensionsUpdatedEvent(e)).on(z.CONNECT,()=>this.onConnect()).on(z.DISCONNECT,e=>this.onDisconnect(e)).on(z.CONNECT_ERROR_EVENT,e=>this.onConnectError(e))}onLoginSuccessEvent(e){this.eventsSdkClass.eventEmitterClass.emit(z.LOGIN_SUCCESS,e)}onQueueEvent(e){this.eventsSdkClass.eventEmitterClass.emit(z.QUEUE_EVENT,pe.mapQueueEvent(e))}onExtensionEvent(e){const r=pe.mapExtensionEvent(e);r&&this.eventsSdkClass.eventEmitterClass.emit(z.EXTENSION_EVENT,r)}onDialerEvent(e){this.eventsSdkClass.eventEmitterClass.emit(z.DIALER_EVENT,e)}onLoginStatusEvent(e){this.eventsSdkClass.eventEmitterClass.emit(z.LOGIN_STATUS,e)}onAllExtensionStatus(e){const r=pe.mapAllExtensionStatus(e);this.eventsSdkClass.eventEmitterClass.emit(z.ALL_EXTENSION_STATUS,r)}onAllDialerStatus(e){this.eventsSdkClass.eventEmitterClass.emit(z.ALL_DIALER_STATUS,e)}onKeepAliveResponse(e){if(e.errorCode){this.initSocketConnection();return}this.eventsSdkClass.loggerClass.log({Message:`Keep alive response: ${e}`,ActionName:at.WSCONNECT,isShowClient:!1,Status:"Successful",StatusCode:200,Level:tt.INFO,LogType:ct.INFO}),this.connected?this.lastEventTimestamp=new Date().getTime():this.initSocketConnection()}onExtensionsUpdatedEvent(e){this.eventsSdkClass.eventEmitterClass.emit(z.EXTENSIONS_UPDATED,e)}onConnect(){this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.connected=!0,this.eventsSdkClass.eventEmitterClass.emit(z.ONLINE_STATUS_EVENT,{connectionStatus:dt.CONNECTED}),this.eventsSdkClass.loggerClass.log({Message:`Sdk connected to the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL}`,ActionName:at.WSCONNECT,isShowClient:!1,Status:"Connection established",StatusCode:200,Level:tt.INFO,LogType:ct.INFO})}onDisconnect(e){this.connected=!1,this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(z.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?dt.TRYING_TO_CONNECT:dt.DISCONNECTED}),this.eventsSdkClass.loggerClass.log({Message:`Sdk disconnected from the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL} (${e})`,ActionName:at.WSCONNECT,isShowClient:!1,Status:"Connection closed",StatusCode:200,Level:tt.INFO,LogType:ct.INFO}),this.doReconnect&&(this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>120&&(this.reconnectionTime=20),this.eventsSdkClass.connect(vt.NEXT)},this.reconnectionTime*1e3))}onConnectError(e){this.eventsSdkClass.eventEmitterClass.emit(z.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?dt.TRYING_TO_CONNECT:dt.DISCONNECTED}),this.eventsSdkClass.loggerClass.log({Message:`Sdk attempt to connect to the socket server ${this.eventsSdkClass.URL} failed (${e})`,ActionName:at.WSCONNECT,isShowClient:!1,Status:"Connection attempt error",StatusCode:500,Level:tt.ERROR,LogType:ct.ERROR}),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>60&&(this.reconnectionTime=20),this.eventsSdkClass.connect(vt.NEXT)},this.reconnectionTime*1e3)}}class $o{constructor(e){K(this,"storageLogger");this.eventsSdkClass=e,this.eventsSdkClass=e}init(){if(!this.eventsSdkClass.options.useLogger)return;if(this.eventsSdkClass.options.storageLoggerInstance){this.storageLogger=this.eventsSdkClass.options.storageLoggerInstance;return}let e;this.eventsSdkClass.options.loggerSocketConnection&&(e=this.eventsSdkClass.options.loggerSocketConnection),this.eventsSdkClass.socketIoClass.ioFunction&&!e&&(e=this.eventsSdkClass.socketIoClass.ioFunction(this.eventsSdkClass.options.loggerServer,this.eventsSdkClass.options.loggerConnectOptions)),e&&(this.storageLogger=new Fo({socket:e,loggerOptions:this.eventsSdkClass.options.loggerConfig}))}stop(){this.storageLogger&&this.storageLogger.stop()}log(e){this.eventsSdkClass.options.useLogger&&(this.storageLogger?e.Level===tt.INFO?this.storageLogger.log(e):e.Level===tt.ERROR&&this.storageLogger.error(e):e.Level===tt.INFO?console.log(e):e.Level===tt.ERROR&&console.error(e))}sdkInitializedLog(){const e={...this.eventsSdkClass.options,token:"CENSORED",password:"CENSORED"};this.log({Message:"Sdk initialized with provided options",Body:JSON.stringify(e,this.eventsSdkClass.getCircularReplacer()),ActionName:at.WSCONNECT,isShowClient:!1,Status:"Sdk initialized",StatusCode:200,Level:tt.INFO,LogType:ct.INFO})}}class Go{constructor(e){K(this,"listeners",{[z.ALL_EXTENSION_STATUS]:[],[z.ALL_DIALER_STATUS]:[],[z.ALL_USERS_STATUS]:[],[z.QUEUE_EVENT]:[],[z.EXTENSION_EVENT]:[],[z.DIALER_EVENT]:[],[z.LOGIN_SUCCESS]:[],[z.LOGIN_STATUS]:[],[z.KEEP_ALIVE_RESPONSE]:[],[z.ONLINE_STATUS_EVENT]:[],[z.EXTENSIONS_UPDATED]:[]});K(this,"allListeners",[]);this.eventsSdkClass=e,this.eventsSdkClass=e}on(e,r){e==="*"?this.allListeners.push(r):this.listeners[e].push(r)}off(e,r){if(e==="*")this.allListeners=this.allListeners.filter(n=>n!==r);else{const o=this.listeners[e].filter(i=>i!==r);this.listeners={...this.listeners,[e]:o}}}emit(e,r){this.eventsSdkClass.socketIoClass.lastEventTimestamp=new Date().getTime(),this.listeners[e].forEach(o=>o({name:e,data:r}));const n={name:e,data:r};this.allListeners.forEach(o=>o(n))}}class Yo{constructor(e){K(this,"options");K(this,"servers",[]);K(this,"URLList",[]);K(this,"server");K(this,"URL");K(this,"socket");K(this,"mainServer");K(this,"alreadyAttemptedOtherServers",[]);K(this,"authClass",new jo(this));K(this,"socketIoClass",new Vo(this));K(this,"loggerClass",new $o(this));K(this,"eventEmitterClass",new Go(this));K(this,"getCircularReplacer",()=>{const e=new WeakSet;return(r,n)=>{if(!(r==="socket"||r==="io"||r==="nsps")){if(typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}}});this.options={...Mo,...e}}on(e,r){this.eventEmitterClass.on(e,r)}emit(e,...r){this.socketIoClass.io&&this.socketIoClass.io.emit(e,...r)}connect(e){e===vt.MAIN&&this.findMainServer(),e===vt.NEXT&&this.findNextServer(),this.socketIoClass.doReconnect=!0;try{this.loggerClass.init()}catch(r){console.error(r)}this.socketIoClass.initSocketConnection(),this.socketIoClass.initSocketEvents(),this.socketIoClass.initKeepAlive()}disconnect(){this.socketIoClass.doReconnect=!1,this.socketIoClass.closeAllConnections(),this.loggerClass.stop()}clearKeepAliveInterval(){this.socketIoClass.clearKeepAliveInterval()}findMainServer(){this.servers.length?(this.mainServer=this.servers.reduce((e,r)=>r.Priority>e.Priority?r:e),this.server=this.mainServer):this.URLList.length&&(this.URL=this.URLList[0])}findNextServer(){if(this.servers.length&&this.server)if(this.server.Priority===this.mainServer.Priority){let e=this.servers.filter(r=>r.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(r.Priority)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.servers.filter(r=>r.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(r.Priority)+1===0)),e.length&&(this.server=e.reduce((r,n)=>n.Priority>r.Priority?n:r),this.alreadyAttemptedOtherServers.push(this.server.Priority))}else this.server=this.mainServer;else if(this.URLList.length)if(this.URL===this.URLList[0]){let e=this.URLList.filter(r=>r!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(r)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.URLList.filter(r=>r!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(r)+1===0)),e.length&&(this.URL=e[0],this.alreadyAttemptedOtherServers.push(this.URL))}else this.URL=this.URLList[0]}async init(){const e=await this.authClass.login();return e&&this.authClass.onLoginResponse(e),this.loggerClass.sdkInitializedLog(),!0}getCurrentMonitorServer(){return this.server}}exports.CallStatusEnum=xr;exports.CallTypeEnum=Rr;exports.ConnectionStatusEnum=dt;exports.DialerTypeEnum=Ir;exports.DirectionEnum=Br;exports.DoNotCallMeStatusCodeEnum=_r;exports.EventsEnum=z;exports.ExtensionEventReasonEnum=Be;exports.ExtensionHangupCauseEnum=Lr;exports.LoginType=it;exports.QueueEventReasonEnum=Ur;exports.ServerListenerEventsEnum=_e;exports.default=Yo;
|
|
8
20
|
//# sourceMappingURL=voicenter-events-sdk.cjs.js.map
|