@voicenter-team/events-sdk 0.0.90 → 0.0.91

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.
@@ -1,19 +1,19 @@
1
- "use strict";var Je=Object.defineProperty;var Xe=(s,e,t)=>e in s?Je(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var K=(s,e,t)=>(Xe(s,typeof e!="symbol"?e+"":e,t),t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $e=require("ws");function ze(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var be={exports:{}},we={exports:{}};(function(){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(t,n){return t<<n|t>>>32-n},rotr:function(t,n){return t<<32-n|t>>>n},endian:function(t){if(t.constructor==Number)return e.rotl(t,8)&16711935|e.rotl(t,24)&4278255360;for(var n=0;n<t.length;n++)t[n]=e.endian(t[n]);return t},randomBytes:function(t){for(var n=[];t>0;t--)n.push(Math.floor(Math.random()*256));return n},bytesToWords:function(t){for(var n=[],r=0,o=0;r<t.length;r++,o+=8)n[o>>>5]|=t[r]<<24-o%32;return n},wordsToBytes:function(t){for(var n=[],r=0;r<t.length*32;r+=8)n.push(t[r>>>5]>>>24-r%32&255);return n},bytesToHex:function(t){for(var n=[],r=0;r<t.length;r++)n.push((t[r]>>>4).toString(16)),n.push((t[r]&15).toString(16));return n.join("")},hexToBytes:function(t){for(var n=[],r=0;r<t.length;r+=2)n.push(parseInt(t.substr(r,2),16));return n},bytesToBase64:function(t){for(var n=[],r=0;r<t.length;r+=3)for(var o=t[r]<<16|t[r+1]<<8|t[r+2],u=0;u<4;u++)r*8+u*6<=t.length*8?n.push(s.charAt(o>>>6*(3-u)&63)):n.push("=");return n.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],r=0,o=0;r<t.length;o=++r%4)o!=0&&n.push((s.indexOf(t.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<o*2|s.indexOf(t.charAt(r))>>>6-o*2);return n}};we.exports=e})();var He=we.exports,Kt={utf8:{stringToBytes:function(s){return Kt.bin.stringToBytes(unescape(encodeURIComponent(s)))},bytesToString:function(s){return decodeURIComponent(escape(Kt.bin.bytesToString(s)))}},bin:{stringToBytes:function(s){for(var e=[],t=0;t<s.length;t++)e.push(s.charCodeAt(t)&255);return e},bytesToString:function(s){for(var e=[],t=0;t<s.length;t++)e.push(String.fromCharCode(s[t]));return e.join("")}}},ce=Kt;/*!
1
+ "use strict";var Je=Object.defineProperty;var Xe=(s,e,t)=>e in s?Je(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var K=(s,e,t)=>(Xe(s,typeof e!="symbol"?e+"":e,t),t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $e=require("ws");function ze(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Se={exports:{}},we={exports:{}};(function(){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(t,n){return t<<n|t>>>32-n},rotr:function(t,n){return t<<32-n|t>>>n},endian:function(t){if(t.constructor==Number)return e.rotl(t,8)&16711935|e.rotl(t,24)&4278255360;for(var n=0;n<t.length;n++)t[n]=e.endian(t[n]);return t},randomBytes:function(t){for(var n=[];t>0;t--)n.push(Math.floor(Math.random()*256));return n},bytesToWords:function(t){for(var n=[],r=0,o=0;r<t.length;r++,o+=8)n[o>>>5]|=t[r]<<24-o%32;return n},wordsToBytes:function(t){for(var n=[],r=0;r<t.length*32;r+=8)n.push(t[r>>>5]>>>24-r%32&255);return n},bytesToHex:function(t){for(var n=[],r=0;r<t.length;r++)n.push((t[r]>>>4).toString(16)),n.push((t[r]&15).toString(16));return n.join("")},hexToBytes:function(t){for(var n=[],r=0;r<t.length;r+=2)n.push(parseInt(t.substr(r,2),16));return n},bytesToBase64:function(t){for(var n=[],r=0;r<t.length;r+=3)for(var o=t[r]<<16|t[r+1]<<8|t[r+2],u=0;u<4;u++)r*8+u*6<=t.length*8?n.push(s.charAt(o>>>6*(3-u)&63)):n.push("=");return n.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],r=0,o=0;r<t.length;o=++r%4)o!=0&&n.push((s.indexOf(t.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<o*2|s.indexOf(t.charAt(r))>>>6-o*2);return n}};we.exports=e})();var He=we.exports,Kt={utf8:{stringToBytes:function(s){return Kt.bin.stringToBytes(unescape(encodeURIComponent(s)))},bytesToString:function(s){return decodeURIComponent(escape(Kt.bin.bytesToString(s)))}},bin:{stringToBytes:function(s){for(var e=[],t=0;t<s.length;t++)e.push(s.charCodeAt(t)&255);return e},bytesToString:function(s){for(var e=[],t=0;t<s.length;t++)e.push(String.fromCharCode(s[t]));return e.join("")}}},ce=Kt;/*!
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 Ye=function(s){return s!=null&&(Ce(s)||Qe(s)||!!s._isBuffer)};function Ce(s){return!!s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function Qe(s){return typeof s.readFloatLE=="function"&&typeof s.slice=="function"&&Ce(s.slice(0,0))}(function(){var s=He,e=ce.utf8,t=Ye,n=ce.bin,r=function(o,u){o.constructor==String?u&&u.encoding==="binary"?o=n.stringToBytes(o):o=e.stringToBytes(o):t(o)?o=Array.prototype.slice.call(o,0):!Array.isArray(o)&&o.constructor!==Uint8Array&&(o=o.toString());for(var h=s.bytesToWords(o),d=o.length*8,c=1732584193,p=-271733879,l=-1732584194,i=271733878,a=0;a<h.length;a++)h[a]=(h[a]<<8|h[a]>>>24)&16711935|(h[a]<<24|h[a]>>>8)&4278255360;h[d>>>5]|=128<<d%32,h[(d+64>>>9<<4)+14]=d;for(var f=r._ff,g=r._gg,y=r._hh,E=r._ii,a=0;a<h.length;a+=16){var j=c,B=p,F=l,L=i;c=f(c,p,l,i,h[a+0],7,-680876936),i=f(i,c,p,l,h[a+1],12,-389564586),l=f(l,i,c,p,h[a+2],17,606105819),p=f(p,l,i,c,h[a+3],22,-1044525330),c=f(c,p,l,i,h[a+4],7,-176418897),i=f(i,c,p,l,h[a+5],12,1200080426),l=f(l,i,c,p,h[a+6],17,-1473231341),p=f(p,l,i,c,h[a+7],22,-45705983),c=f(c,p,l,i,h[a+8],7,1770035416),i=f(i,c,p,l,h[a+9],12,-1958414417),l=f(l,i,c,p,h[a+10],17,-42063),p=f(p,l,i,c,h[a+11],22,-1990404162),c=f(c,p,l,i,h[a+12],7,1804603682),i=f(i,c,p,l,h[a+13],12,-40341101),l=f(l,i,c,p,h[a+14],17,-1502002290),p=f(p,l,i,c,h[a+15],22,1236535329),c=g(c,p,l,i,h[a+1],5,-165796510),i=g(i,c,p,l,h[a+6],9,-1069501632),l=g(l,i,c,p,h[a+11],14,643717713),p=g(p,l,i,c,h[a+0],20,-373897302),c=g(c,p,l,i,h[a+5],5,-701558691),i=g(i,c,p,l,h[a+10],9,38016083),l=g(l,i,c,p,h[a+15],14,-660478335),p=g(p,l,i,c,h[a+4],20,-405537848),c=g(c,p,l,i,h[a+9],5,568446438),i=g(i,c,p,l,h[a+14],9,-1019803690),l=g(l,i,c,p,h[a+3],14,-187363961),p=g(p,l,i,c,h[a+8],20,1163531501),c=g(c,p,l,i,h[a+13],5,-1444681467),i=g(i,c,p,l,h[a+2],9,-51403784),l=g(l,i,c,p,h[a+7],14,1735328473),p=g(p,l,i,c,h[a+12],20,-1926607734),c=y(c,p,l,i,h[a+5],4,-378558),i=y(i,c,p,l,h[a+8],11,-2022574463),l=y(l,i,c,p,h[a+11],16,1839030562),p=y(p,l,i,c,h[a+14],23,-35309556),c=y(c,p,l,i,h[a+1],4,-1530992060),i=y(i,c,p,l,h[a+4],11,1272893353),l=y(l,i,c,p,h[a+7],16,-155497632),p=y(p,l,i,c,h[a+10],23,-1094730640),c=y(c,p,l,i,h[a+13],4,681279174),i=y(i,c,p,l,h[a+0],11,-358537222),l=y(l,i,c,p,h[a+3],16,-722521979),p=y(p,l,i,c,h[a+6],23,76029189),c=y(c,p,l,i,h[a+9],4,-640364487),i=y(i,c,p,l,h[a+12],11,-421815835),l=y(l,i,c,p,h[a+15],16,530742520),p=y(p,l,i,c,h[a+2],23,-995338651),c=E(c,p,l,i,h[a+0],6,-198630844),i=E(i,c,p,l,h[a+7],10,1126891415),l=E(l,i,c,p,h[a+14],15,-1416354905),p=E(p,l,i,c,h[a+5],21,-57434055),c=E(c,p,l,i,h[a+12],6,1700485571),i=E(i,c,p,l,h[a+3],10,-1894986606),l=E(l,i,c,p,h[a+10],15,-1051523),p=E(p,l,i,c,h[a+1],21,-2054922799),c=E(c,p,l,i,h[a+8],6,1873313359),i=E(i,c,p,l,h[a+15],10,-30611744),l=E(l,i,c,p,h[a+6],15,-1560198380),p=E(p,l,i,c,h[a+13],21,1309151649),c=E(c,p,l,i,h[a+4],6,-145523070),i=E(i,c,p,l,h[a+11],10,-1120210379),l=E(l,i,c,p,h[a+2],15,718787259),p=E(p,l,i,c,h[a+9],21,-343485551),c=c+j>>>0,p=p+B>>>0,l=l+F>>>0,i=i+L>>>0}return s.endian([c,p,l,i])};r._ff=function(o,u,h,d,c,p,l){var i=o+(u&h|~u&d)+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._gg=function(o,u,h,d,c,p,l){var i=o+(u&d|h&~d)+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._hh=function(o,u,h,d,c,p,l){var i=o+(u^h^d)+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._ii=function(o,u,h,d,c,p,l){var i=o+(h^(u|~d))+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._blocksize=16,r._digestsize=16,be.exports=function(o,u){if(o==null)throw new Error("Illegal argument "+o);var h=s.wordsToBytes(r(o,u));return u&&u.asBytes?h:u&&u.asString?n.bytesToString(h):s.bytesToHex(h)}})();var Ze=be.exports;const tn=ze(Ze);var ut=(s=>(s.BOOTSTRAP="bootstrap",s.DEBUG_EXTENSIONS="debugExtensions",s.DEBUG_QUEUE="debugQueue",s.DEBUG_DIALER="debugDialer",s.FULL="full",s))(ut||{}),at=(s=>(s.MAIN="main",s.NEXT="next",s))(at||{}),st=(s=>(s.USER="User",s.TOKEN="Token",s))(st||{});class kt{static async getSessionStorageDataByKey(e,t=!0){if(typeof chrome<"u"&&typeof chrome.storage<"u"){const n=await chrome.storage.session.get(e);if(n[e])return t?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 t?JSON.parse(n):n}}static async updateSessionStorageKey(e,t){typeof chrome<"u"&&typeof chrome.storage<"u"&&await chrome.storage.session.set({[e]:JSON.stringify(t)}),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.setItem=="function"&&window.sessionStorage.setItem(e,JSON.stringify(t))}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()}}class en{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=tn(JSON.stringify({...this.eventsSdkClass.options,loggerSocketConnection:null},this.eventsSdkClass.getCircularReplacer())),this.lastLoginTimestamp&&this.lastLoginTimestamp+this.delay>new Date().getTime())return;this.updateLastLoginTimestamp();const t=await this.checkLoginStatus(this.storageKey);return t||(kt.clearSessionStorage(),await this.userLoginFunction(e,this.storageKey,this.eventsSdkClass.options.loginType))}updateLastLoginTimestamp(){this.lastLoginTimestamp=new Date().getTime()}async checkLoginStatus(e){const t=await kt.getSessionStorageDataByKey(e);if(t)return t}async userLoginFunction(e,t,n){let r,o,u;return this.eventsSdkClass.options.isNewStack?(r=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),o=await this.getSettings(r.Data.AccessToken),u={...r.Data,...o}):(r=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),u={...r.Data.Socket}),await kt.updateSessionStorageKey(t,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((t,n)=>t.Priority>n.Priority?t:n)),this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((t,n)=>t.Priority>n.Priority?t:n)),e.MonitorList&&e.MonitorList.length&&(this.eventsSdkClass.servers=[...e.MonitorList],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((t,n)=>t.Priority>n.Priority?t: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(at.MAIN)),e.Token&&(this.token=e.Token,this.eventsSdkClass.connect(at.MAIN)),e.RefreshToken&&e.IdentityCodeExpiry&&this.eventsSdkClass.options.loginType===st.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.IdentityCodeExpiry,this.handleTokenExpiry()),e.RefreshToken&&e.TokenExpiry&&this.normalizeLoginType(this.eventsSdkClass.options.loginType)===st.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 t=e.getTime()-new Date().getTime()-5e3,n=Math.min(t,2147483647);setTimeout(async()=>{if(this.refreshToken){this.eventsSdkClass.socketIoClass.closeAllConnections();let r,o;if(this.eventsSdkClass.options.isNewStack){const u=await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken);r=await this.getSettings(u.Data.AccessToken),o={...u.Data,...r}}else o={...(await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken)).Data.Socket};this.onLoginResponse(o),await kt.updateSessionStorageKey(this.storageKey,o)}},n)}async externalLogin(e,{password:t,token:n,email:r},o){if(!e)throw new Error("loginUrl not provided");let u;this.eventsSdkClass.options.isNewStack?o===st.TOKEN?u=JSON.stringify({identityType:st.TOKEN,token:n}):u=JSON.stringify({identityType:st.USER,username:r,password:t}):this.eventsSdkClass.options.loginType===st.TOKEN?(u=JSON.stringify({token:n}),e=`${e}/${st.TOKEN}`):(u=JSON.stringify({email:r,pin:t}),e=`${e}/${st.USER}`);let h;try{const d=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:u});if(!d.ok&&d.status===400)throw h=400,new Error("Bad body request. Login type or isNewStack values not correct or not provided");if(!d.ok&&d.status===401)throw h=401,new Error("Unauthorized. Invalid token provided");if(!d.ok&&d.status===403)throw h=403,new Error("Forbidden. Identity token not provided or not valid");const c=await d.json();if(c.error)throw new Error(c.error);return c}catch(d){throw this.eventsSdkClass.loggerClass.loginError(o,h,n,r),d}}async getSettings(e){try{if(!this.eventsSdkClass.options.getSettingsUrl)throw new Error("getSettingsUrl not provided");const t=await fetch(this.eventsSdkClass.options.getSettingsUrl,{headers:{Authorization:`Bearer ${e}`}});if(!t.ok&&t.status===401)throw new Error("Unauthorized. Access token not provided or not valid");return t.json()}catch(t){throw this.eventsSdkClass.loggerClass.getSettingsError(e,t),t}}async externalRefreshToken(e,t){try{return(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}})).json()}catch(n){throw this.eventsSdkClass.loggerClass.refreshTokenError(t,e,n),n}}normalizeLoginType(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}}const nn={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:!1,reconnectionDelay:5e3,reconnectionAttempts:10,perMessageDeflate:void 0,upgrade:!1,transports:["websocket"],debug:!1}};function sn(){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=$e,typeof self.navigator>"u"&&(self.navigator={userAgent:"node"})),function s(e,t,n){function r(h,d){if(!t[h]){if(!e[h]){var c=typeof require=="function"&&require;if(!d&&c)return c(h,!0);if(o)return o(h,!0);throw new Error("Cannot find module '"+h+"'")}var p=t[h]={exports:{}};e[h][0].call(p.exports,function(l){var i=e[h][1][l];return r(i||l)},p,p.exports,s,e,t,n)}return t[h].exports}for(var o=typeof require=="function"&&require,u=0;u<n.length;u++)r(n[u]);return r}({1:[function(s,e){e.exports=s("./lib/")},{"./lib/":2}],2:[function(s,e,t){function n(c,p){typeof c=="object"&&(p=c,c=void 0),p=p||{};var l,i=r(c),a=i.source,f=i.id;return p.forceNew||p["force new connection"]||p.multiplex===!1?(h("ignoring socket cache for %s",a),l=u(a,p)):(d[f]||(h("new io instance for %s",a),d[f]=u(a,p)),l=d[f]),l.socket(i.path)}var r=s("./url"),o=s("socket.io-parser"),u=s("./manager"),h=s("debug")("socket.io-client");e.exports=t=n;var d=t.managers={};t.protocol=o.protocol,t.connect=n,t.Manager=s("./manager"),t.Socket=s("./socket")},{"./manager":3,"./socket":5,"./url":6,debug:10,"socket.io-parser":44}],3:[function(s,e){function t(i,a){return this instanceof t?(i&&typeof i=="object"&&(a=i,i=void 0),a=a||{},a.path=a.path||"/socket.io",this.nsps={},this.subs=[],this.opts=a,this.reconnection(a.reconnection!==!1),this.reconnectionAttempts(a.reconnectionAttempts||1/0),this.reconnectionDelay(a.reconnectionDelay||1e3),this.reconnectionDelayMax(a.reconnectionDelayMax||5e3),this.randomizationFactor(a.randomizationFactor||.5),this.backoff=new l({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(a.timeout==null?2e4:a.timeout),this.readyState="closed",this.uri=i,this.connected=[],this.encoding=!1,this.packetBuffer=[],this.encoder=new u.Encoder,this.decoder=new u.Decoder,this.autoConnect=a.autoConnect!==!1,void(this.autoConnect&&this.open())):new t(i,a)}var n=(s("./url"),s("engine.io-client")),r=s("./socket"),o=s("component-emitter"),u=s("socket.io-parser"),h=s("./on"),d=s("component-bind"),c=(s("object-component"),s("debug")("socket.io-client:manager")),p=s("indexof"),l=s("backo2");e.exports=t,t.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var i in this.nsps)this.nsps[i].emit.apply(this.nsps[i],arguments)},t.prototype.updateSocketIds=function(){for(var i in this.nsps)this.nsps[i].id=this.engine.id},o(t.prototype),t.prototype.reconnection=function(i){return arguments.length?(this._reconnection=!!i,this):this._reconnection},t.prototype.reconnectionAttempts=function(i){return arguments.length?(this._reconnectionAttempts=i,this):this._reconnectionAttempts},t.prototype.reconnectionDelay=function(i){return arguments.length?(this._reconnectionDelay=i,this.backoff&&this.backoff.setMin(i),this):this._reconnectionDelay},t.prototype.randomizationFactor=function(i){return arguments.length?(this._randomizationFactor=i,this.backoff&&this.backoff.setJitter(i),this):this._randomizationFactor},t.prototype.reconnectionDelayMax=function(i){return arguments.length?(this._reconnectionDelayMax=i,this.backoff&&this.backoff.setMax(i),this):this._reconnectionDelayMax},t.prototype.timeout=function(i){return arguments.length?(this._timeout=i,this):this._timeout},t.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},t.prototype.open=t.prototype.connect=function(i){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 a=this.engine,f=this;this.readyState="opening",this.skipReconnect=!1;var g=h(a,"open",function(){f.onopen(),i&&i()}),y=h(a,"error",function(B){if(c("connect_error"),f.cleanup(),f.readyState="closed",f.emitAll("connect_error",B),i){var F=new Error("Connection error");F.data=B,i(F)}else f.maybeReconnectOnOpen()});if(this._timeout!==!1){var E=this._timeout;c("connect attempt will timeout after %d",E);var j=setTimeout(function(){c("connect attempt timed out after %d",E),g.destroy(),a.close(),a.emit("error","timeout"),f.emitAll("connect_timeout",E)},E);this.subs.push({destroy:function(){clearTimeout(j)}})}return this.subs.push(g),this.subs.push(y),this},t.prototype.onopen=function(){c("open"),this.cleanup(),this.readyState="open",this.emit("open");var i=this.engine;this.subs.push(h(i,"data",d(this,"ondata"))),this.subs.push(h(this.decoder,"decoded",d(this,"ondecoded"))),this.subs.push(h(i,"error",d(this,"onerror"))),this.subs.push(h(i,"close",d(this,"onclose")))},t.prototype.ondata=function(i){this.decoder.add(i)},t.prototype.ondecoded=function(i){this.emit("packet",i)},t.prototype.onerror=function(i){c("error",i),this.emitAll("error",i)},t.prototype.socket=function(i){var a=this.nsps[i];if(!a){a=new r(this,i),this.nsps[i]=a;var f=this;a.on("connect",function(){a.id=f.engine.id,~p(f.connected,a)||f.connected.push(a)})}return a},t.prototype.destroy=function(i){var a=p(this.connected,i);~a&&this.connected.splice(a,1),this.connected.length||this.close()},t.prototype.packet=function(i){c("writing packet %j",i);var a=this;a.encoding?a.packetBuffer.push(i):(a.encoding=!0,this.encoder.encode(i,function(f){for(var g=0;g<f.length;g++)a.engine.write(f[g]);a.encoding=!1,a.processPacketQueue()}))},t.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var i=this.packetBuffer.shift();this.packet(i)}},t.prototype.cleanup=function(){for(var i;i=this.subs.shift();)i.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},t.prototype.close=t.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},t.prototype.onclose=function(i){c("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",i),this._reconnection&&!this.skipReconnect&&this.reconnect()},t.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var i=this;if(this.backoff.attempts>=this._reconnectionAttempts)c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var a=this.backoff.duration();c("will wait %dms before reconnect attempt",a),this.reconnecting=!0;var f=setTimeout(function(){i.skipReconnect||(c("attempting reconnect"),i.emitAll("reconnect_attempt",i.backoff.attempts),i.emitAll("reconnecting",i.backoff.attempts),i.skipReconnect||i.open(function(g){g?(c("reconnect attempt error"),i.reconnecting=!1,i.reconnect(),i.emitAll("reconnect_error",g.data)):(c("reconnect success"),i.onreconnect())}))},a);this.subs.push({destroy:function(){clearTimeout(f)}})}},t.prototype.onreconnect=function(){var i=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",i)}},{"./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(s,e){function t(n,r,o){return n.on(r,o),{destroy:function(){n.removeListener(r,o)}}}e.exports=t},{}],5:[function(s,e,t){function n(a,f){this.io=a,this.nsp=f,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var r=s("socket.io-parser"),o=s("component-emitter"),u=s("to-array"),h=s("./on"),d=s("component-bind"),c=s("debug")("socket.io-client:socket"),p=s("has-binary");e.exports=n;var l={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},i=o.prototype.emit;o(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var a=this.io;this.subs=[h(a,"open",d(this,"onopen")),h(a,"packet",d(this,"onpacket")),h(a,"close",d(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 a=u(arguments);return a.unshift("message"),this.emit.apply(this,a),this},n.prototype.emit=function(a){if(l.hasOwnProperty(a))return i.apply(this,arguments),this;var f=u(arguments),g=r.EVENT;p(f)&&(g=r.BINARY_EVENT);var y={type:g,data:f};return typeof f[f.length-1]=="function"&&(c("emitting packet with ack id %d",this.ids),this.acks[this.ids]=f.pop(),y.id=this.ids++),this.connected?this.packet(y):this.sendBuffer.push(y),this},n.prototype.packet=function(a){a.nsp=this.nsp,this.io.packet(a)},n.prototype.onopen=function(){c("transport is open - connecting"),this.nsp!="/"&&this.packet({type:r.CONNECT})},n.prototype.onclose=function(a){c("close (%s)",a),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",a)},n.prototype.onpacket=function(a){if(a.nsp==this.nsp)switch(a.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(a);break;case r.BINARY_EVENT:this.onevent(a);break;case r.ACK:this.onack(a);break;case r.BINARY_ACK:this.onack(a);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",a.data)}},n.prototype.onevent=function(a){var f=a.data||[];c("emitting event %j",f),a.id!=null&&(c("attaching ack callback to event"),f.push(this.ack(a.id))),this.connected?i.apply(this,f):this.receiveBuffer.push(f)},n.prototype.ack=function(a){var f=this,g=!1;return function(){if(!g){g=!0;var y=u(arguments);c("sending ack %j",y);var E=p(y)?r.BINARY_ACK:r.ACK;f.packet({type:E,id:a,data:y})}}},n.prototype.onack=function(a){c("calling ack %s with %j",a.id,a.data);var f=this.acks[a.id];f.apply(this,a.data),delete this.acks[a.id]},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var a;for(a=0;a<this.receiveBuffer.length;a++)i.apply(this,this.receiveBuffer[a]);for(this.receiveBuffer=[],a=0;a<this.sendBuffer.length;a++)this.packet(this.sendBuffer[a]);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 a=0;a<this.subs.length;a++)this.subs[a].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:r.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(s,e){(function(t){function n(u,c){var d=u,c=c||t.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)||(o("protocol-less url %s",u),u=typeof c<"u"?c.protocol+"//"+u:"https://"+u),o("parse %s",u),d=r(u)),d.port||(/^(http|ws)$/.test(d.protocol)?d.port="80":/^(http|ws)s$/.test(d.protocol)&&(d.port="443")),d.path=d.path||"/",d.id=d.protocol+"://"+d.host+":"+d.port,d.href=d.protocol+"://"+d.host+(c&&c.port==d.port?"":":"+d.port),d}var r=s("parseuri"),o=s("debug")("socket.io-client:url");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{debug:10,parseuri:42}],7:[function(s,e){function t(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=t,t.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),o=Math.floor(r*this.jitter*n);n=1&Math.floor(10*r)?n+o:n-o}return 0|Math.min(n,this.max)},t.prototype.reset=function(){this.attempts=0},t.prototype.setMin=function(n){this.ms=n},t.prototype.setMax=function(n){this.max=n},t.prototype.setJitter=function(n){this.jitter=n}},{}],8:[function(s,e){var t=[].slice;e.exports=function(n,r){if(typeof r=="string"&&(r=n[r]),typeof r!="function")throw new Error("bind() requires a function");var o=t.call(arguments,2);return function(){return r.apply(n,o.concat(t.call(arguments)))}}},{}],9:[function(s,e){function t(r){return r?n(r):void 0}function n(r){for(var o in t.prototype)r[o]=t.prototype[o];return r}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(r,o){return this._callbacks=this._callbacks||{},(this._callbacks[r]=this._callbacks[r]||[]).push(o),this},t.prototype.once=function(r,o){function u(){h.off(r,u),o.apply(this,arguments)}var h=this;return this._callbacks=this._callbacks||{},u.fn=o,this.on(r,u),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(r,o){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var u=this._callbacks[r];if(!u)return this;if(arguments.length==1)return delete this._callbacks[r],this;for(var h,d=0;d<u.length;d++)if(h=u[d],h===o||h.fn===o){u.splice(d,1);break}return this},t.prototype.emit=function(r){this._callbacks=this._callbacks||{};var o=[].slice.call(arguments,1),u=this._callbacks[r];if(u){u=u.slice(0);for(var h=0,d=u.length;d>h;++h)u[h].apply(this,o)}return this},t.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks[r]||[]},t.prototype.hasListeners=function(r){return!!this.listeners(r).length}},{}],10:[function(s,e){function t(r){return t.enabled(r)?function(o){o=n(o);var u=new Date,h=u-(t[r]||u);t[r]=u,o=r+" "+o+" +"+t.humanize(h),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function n(r){return r instanceof Error?r.stack||r.message:r}e.exports=t,t.names=[],t.skips=[],t.enable=function(r){try{localStorage.debug=r}catch{}for(var o=(r||"").split(/[\s,]+/),u=o.length,h=0;u>h;h++)r=o[h].replace("*",".*?"),r[0]==="-"?t.skips.push(new RegExp("^"+r.substr(1)+"$")):t.names.push(new RegExp("^"+r+"$"))},t.disable=function(){t.enable("")},t.humanize=function(r){var o=1e3,u=6e4,h=60*u;return r>=h?(r/h).toFixed(1)+"h":r>=u?(r/u).toFixed(1)+"m":r>=o?(r/o|0)+"s":r+"ms"},t.enabled=function(r){for(var o=0,u=t.skips.length;u>o;o++)if(t.skips[o].test(r))return!1;for(var o=0,u=t.names.length;u>o;o++)if(t.names[o].test(r))return!0;return!1};try{window.localStorage&&t.enable(localStorage.debug)}catch{}},{}],11:[function(s,e){e.exports=s("./lib/")},{"./lib/":12}],12:[function(s,e){e.exports=s("./socket"),e.exports.parser=s("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(s,e){(function(t){function n(a,f){if(!(this instanceof n))return new n(a,f);if(f=f||{},a&&typeof a=="object"&&(f=a,a=null),a&&(a=p(a),f.host=a.host,f.secure=a.protocol=="https"||a.protocol=="wss",f.port=a.port,a.query&&(f.query=a.query)),this.secure=f.secure!=null?f.secure:t.location&&location.protocol=="https:",f.host){var g=f.host.split(":");f.hostname=g.shift(),g.length?f.port=g.pop():f.port||(f.port=this.secure?"443":"80")}this.agent=f.agent||!1,this.hostname=f.hostname||(t.location?location.hostname:"localhost"),this.port=f.port||(t.location&&location.port?location.port:this.secure?443:80),this.query=f.query||{},typeof this.query=="string"&&(this.query=i.decode(this.query)),this.upgrade=f.upgrade!==!1,this.path=(f.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!f.forceJSONP,this.jsonp=f.jsonp!==!1,this.forceBase64=!!f.forceBase64,this.enablesXDR=!!f.enablesXDR,this.timestampParam=f.timestampParam||"t",this.timestampRequests=f.timestampRequests,this.transports=f.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=f.policyPort||843,this.rememberUpgrade=f.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=f.onlyBinaryUpgrades,this.pfx=f.pfx||null,this.key=f.key||null,this.passphrase=f.passphrase||null,this.cert=f.cert||null,this.ca=f.ca||null,this.ciphers=f.ciphers||null,this.rejectUnauthorized=f.rejectUnauthorized||null,this.open()}function r(a){var f={};for(var g in a)a.hasOwnProperty(g)&&(f[g]=a[g]);return f}var o=s("./transports"),u=s("component-emitter"),h=s("debug")("engine.io-client:socket"),d=s("indexof"),c=s("engine.io-parser"),p=s("parseuri"),l=s("parsejson"),i=s("parseqs");e.exports=n,n.priorWebsocketSuccess=!1,u(n.prototype),n.protocol=c.protocol,n.Socket=n,n.Transport=s("./transport"),n.transports=s("./transports"),n.parser=s("engine.io-parser"),n.prototype.createTransport=function(a){h('creating transport "%s"',a);var f=r(this.query);f.EIO=c.protocol,f.transport=a,this.id&&(f.sid=this.id);var g=new o[a]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:f,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 g},n.prototype.open=function(){var f;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1)f="websocket";else{if(this.transports.length==0){var a=this;return void setTimeout(function(){a.emit("error","No transports available")},0)}f=this.transports[0]}this.readyState="opening";var f;try{f=this.createTransport(f)}catch{return this.transports.shift(),void this.open()}f.open(),this.setTransport(f)},n.prototype.setTransport=function(a){h("setting transport %s",a.name);var f=this;this.transport&&(h("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=a,a.on("drain",function(){f.onDrain()}).on("packet",function(g){f.onPacket(g)}).on("error",function(g){f.onError(g)}).on("close",function(){f.onClose("transport close")})},n.prototype.probe=function(a){function f(){if(T.onlyBinaryUpgrades){var A=!this.supportsBinary&&T.transport.supportsBinary;b=b||A}b||(h('probe transport "%s" opened',a),L.send([{type:"ping",data:"probe"}]),L.once("packet",function(m){if(!b)if(m.type=="pong"&&m.data=="probe"){if(h('probe transport "%s" pong',a),T.upgrading=!0,T.emit("upgrading",L),!L)return;n.priorWebsocketSuccess=L.name=="websocket",h('pausing current transport "%s"',T.transport.name),T.transport.pause(function(){b||T.readyState!="closed"&&(h("changing transport and sending upgrade packet"),F(),T.setTransport(L),L.send([{type:"upgrade"}]),T.emit("upgrade",L),L=null,T.upgrading=!1,T.flush())})}else{h('probe transport "%s" failed',a);var v=new Error("probe error");v.transport=L.name,T.emit("upgradeError",v)}}))}function g(){b||(b=!0,F(),L.close(),L=null)}function y(A){var m=new Error("probe error: "+A);m.transport=L.name,g(),h('probe transport "%s" failed because of error: %s',a,A),T.emit("upgradeError",m)}function E(){y("transport closed")}function j(){y("socket closed")}function B(A){L&&A.name!=L.name&&(h('"%s" works - aborting "%s"',A.name,L.name),g())}function F(){L.removeListener("open",f),L.removeListener("error",y),L.removeListener("close",E),T.removeListener("close",j),T.removeListener("upgrading",B)}h('probing transport "%s"',a);var L=this.createTransport(a,{probe:1}),b=!1,T=this;n.priorWebsocketSuccess=!1,L.once("open",f),L.once("error",y),L.once("close",E),this.once("close",j),this.once("upgrading",B),L.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 a=0,f=this.upgrades.length;f>a;a++)this.probe(this.upgrades[a])}},n.prototype.onPacket=function(a){if(this.readyState=="opening"||this.readyState=="open")switch(h('socket receive: type "%s", data "%s"',a.type,a.data),this.emit("packet",a),this.emit("heartbeat"),a.type){case"open":this.onHandshake(l(a.data));break;case"pong":this.setPing();break;case"error":var f=new Error("server error");f.code=a.data,this.emit("error",f);break;case"message":this.emit("data",a.data),this.emit("message",a.data)}else h('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(a){this.emit("handshake",a),this.id=a.sid,this.transport.query.sid=a.sid,this.upgrades=this.filterUpgrades(a.upgrades),this.pingInterval=a.pingInterval,this.pingTimeout=a.pingTimeout,this.onOpen(),this.readyState!="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(a){clearTimeout(this.pingTimeoutTimer);var f=this;f.pingTimeoutTimer=setTimeout(function(){f.readyState!="closed"&&f.onClose("ping timeout")},a||f.pingInterval+f.pingTimeout)},n.prototype.setPing=function(){var a=this;clearTimeout(a.pingIntervalTimer),a.pingIntervalTimer=setTimeout(function(){h("writing ping packet - expecting pong within %sms",a.pingTimeout),a.ping(),a.onHeartbeat(a.pingTimeout)},a.pingInterval)},n.prototype.ping=function(){this.sendPacket("ping")},n.prototype.onDrain=function(){for(var a=0;a<this.prevBufferLen;a++)this.callbackBuffer[a]&&this.callbackBuffer[a]();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(a,f){return this.sendPacket("message",a,f),this},n.prototype.sendPacket=function(a,f,g){if(this.readyState!="closing"&&this.readyState!="closed"){var y={type:a,data:f};this.emit("packetCreate",y),this.writeBuffer.push(y),this.callbackBuffer.push(g),this.flush()}},n.prototype.close=function(){function a(){y.onClose("forced close"),h("socket closing - telling transport to close"),y.transport.close()}function f(){y.removeListener("upgrade",f),y.removeListener("upgradeError",f),a()}function g(){y.once("upgrade",f),y.once("upgradeError",f)}if(this.readyState=="opening"||this.readyState=="open"){this.readyState="closing";var y=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?g():a()}):this.upgrading?g():a()}return this},n.prototype.onError=function(a){h("socket error %j",a),n.priorWebsocketSuccess=!1,this.emit("error",a),this.onClose("transport error",a)},n.prototype.onClose=function(a,f){if(this.readyState=="opening"||this.readyState=="open"||this.readyState=="closing"){h('socket close with reason: "%s"',a);var g=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),setTimeout(function(){g.writeBuffer=[],g.callbackBuffer=[],g.prevBufferLen=0},0),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",a,f)}},n.prototype.filterUpgrades=function(a){for(var f=[],g=0,y=a.length;y>g;g++)~d(this.transports,a[g])&&f.push(a[g]);return f}}).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(s,e){function t(o){this.path=o.path,this.hostname=o.hostname,this.port=o.port,this.secure=o.secure,this.query=o.query,this.timestampParam=o.timestampParam,this.timestampRequests=o.timestampRequests,this.readyState="",this.agent=o.agent||!1,this.socket=o.socket,this.enablesXDR=o.enablesXDR,this.pfx=o.pfx,this.key=o.key,this.passphrase=o.passphrase,this.cert=o.cert,this.ca=o.ca,this.ciphers=o.ciphers,this.rejectUnauthorized=o.rejectUnauthorized}var n=s("engine.io-parser"),r=s("component-emitter");e.exports=t,r(t.prototype),t.timestamps=0,t.prototype.onError=function(o,u){var h=new Error(o);return h.type="TransportError",h.description=u,this.emit("error",h),this},t.prototype.open=function(){return(this.readyState=="closed"||this.readyState=="")&&(this.readyState="opening",this.doOpen()),this},t.prototype.close=function(){return(this.readyState=="opening"||this.readyState=="open")&&(this.doClose(),this.onClose()),this},t.prototype.send=function(o){if(this.readyState!="open")throw new Error("Transport not open");this.write(o)},t.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},t.prototype.onData=function(o){var u=n.decodePacket(o,this.socket.binaryType);this.onPacket(u)},t.prototype.onPacket=function(o){this.emit("packet",o)},t.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(s,e,t){(function(n){function r(c){var p,l=!1,i=!1,a=c.jsonp!==!1;if(n.location){var f=location.protocol=="https:",g=location.port;g||(g=f?443:80),l=c.hostname!=location.hostname||g!=c.port,i=c.secure!=f}if(c.xdomain=l,c.xscheme=i,p=new o(c),"open"in p&&!c.forceJSONP)return new u(c);if(!a)throw new Error("JSONP disabled");return new h(c)}var o=s("xmlhttprequest"),u=s("./polling-xhr"),h=s("./polling-jsonp"),d=s("./websocket");t.polling=r,t.websocket=d}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(s,e){(function(t){function n(){}function r(p){o.call(this,p),this.query=this.query||{},h||(t.___eio||(t.___eio=[]),h=t.___eio),this.index=h.length;var l=this;h.push(function(i){l.onData(i)}),this.query.j=this.index,t.document&&t.addEventListener&&t.addEventListener("beforeunload",function(){l.script&&(l.script.onerror=n)},!1)}var o=s("./polling"),u=s("component-inherit");e.exports=r;var h,d=/\n/g,c=/\\n/g;u(r,o),r.prototype.supportsBinary=!1,r.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),o.prototype.doClose.call(this)},r.prototype.doPoll=function(){var p=this,l=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),l.async=!0,l.src=this.uri(),l.onerror=function(f){p.onError("jsonp poll error",f)};var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(l,i),this.script=l;var a=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);a&&setTimeout(function(){var f=document.createElement("iframe");document.body.appendChild(f),document.body.removeChild(f)},100)},r.prototype.doWrite=function(p,l){function i(){a(),l()}function a(){if(f.iframe)try{f.form.removeChild(f.iframe)}catch(F){f.onError("jsonp polling iframe removal error",F)}try{var B='<iframe src="javascript:0" name="'+f.iframeId+'">';g=document.createElement(B)}catch{g=document.createElement("iframe"),g.name=f.iframeId,g.src="javascript:0"}g.id=f.iframeId,f.form.appendChild(g),f.iframe=g}var f=this;if(!this.form){var g,y=document.createElement("form"),E=document.createElement("textarea"),j=this.iframeId="eio_iframe_"+this.index;y.className="socketio",y.style.position="absolute",y.style.top="-1000px",y.style.left="-1000px",y.target=j,y.method="POST",y.setAttribute("accept-charset","utf-8"),E.name="d",y.appendChild(E),document.body.appendChild(y),this.form=y,this.area=E}this.form.action=this.uri(),a(),p=p.replace(c,`\\
7
- `),this.area.value=p.replace(d,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){f.iframe.readyState=="complete"&&i()}:this.iframe.onload=i}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-inherit":21}],17:[function(s,e){(function(t){function n(){}function r(i){if(d.call(this,i),t.location){var a=location.protocol=="https:",f=location.port;f||(f=a?443:80),this.xd=i.hostname!=t.location.hostname||f!=i.port,this.xs=i.secure!=a}}function o(i){this.method=i.method||"GET",this.uri=i.uri,this.xd=!!i.xd,this.xs=!!i.xs,this.async=i.async!==!1,this.data=i.data!=null?i.data:null,this.agent=i.agent,this.isBinary=i.isBinary,this.supportsBinary=i.supportsBinary,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,this.create()}function u(){for(var i in o.requests)o.requests.hasOwnProperty(i)&&o.requests[i].abort()}var h=s("xmlhttprequest"),d=s("./polling"),c=s("component-emitter"),p=s("component-inherit"),l=s("debug")("engine.io-client:polling-xhr");e.exports=r,e.exports.Request=o,p(r,d),r.prototype.supportsBinary=!0,r.prototype.request=function(i){return i=i||{},i.uri=this.uri(),i.xd=this.xd,i.xs=this.xs,i.agent=this.agent||!1,i.supportsBinary=this.supportsBinary,i.enablesXDR=this.enablesXDR,i.pfx=this.pfx,i.key=this.key,i.passphrase=this.passphrase,i.cert=this.cert,i.ca=this.ca,i.ciphers=this.ciphers,i.rejectUnauthorized=this.rejectUnauthorized,new o(i)},r.prototype.doWrite=function(i,a){var f=typeof i!="string"&&i!==void 0,g=this.request({method:"POST",data:i,isBinary:f}),y=this;g.on("success",a),g.on("error",function(E){y.onError("xhr post error",E)}),this.sendXhr=g},r.prototype.doPoll=function(){l("xhr poll");var i=this.request(),a=this;i.on("data",function(f){a.onData(f)}),i.on("error",function(f){a.onError("xhr poll error",f)}),this.pollXhr=i},c(o.prototype),o.prototype.create=function(){var i={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};i.pfx=this.pfx,i.key=this.key,i.passphrase=this.passphrase,i.cert=this.cert,i.ca=this.ca,i.ciphers=this.ciphers,i.rejectUnauthorized=this.rejectUnauthorized;var a=this.xhr=new h(i),f=this;try{if(l("xhr open %s: %s",this.method,this.uri),a.open(this.method,this.uri,this.async),this.supportsBinary&&(a.responseType="arraybuffer"),this.method=="POST")try{this.isBinary?a.setRequestHeader("Content-type","application/octet-stream"):a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}"withCredentials"in a&&(a.withCredentials=!0),this.hasXDR()?(a.onload=function(){f.onLoad()},a.onerror=function(){f.onError(a.responseText)}):a.onreadystatechange=function(){a.readyState==4&&(a.status==200||a.status==1223?f.onLoad():setTimeout(function(){f.onError(a.status)},0))},l("xhr data %s",this.data),a.send(this.data)}catch(g){return void setTimeout(function(){f.onError(g)},0)}t.document&&(this.index=o.requestsCount++,o.requests[this.index]=this)},o.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},o.prototype.onData=function(i){this.emit("data",i),this.onSuccess()},o.prototype.onError=function(i){this.emit("error",i),this.cleanup(!0)},o.prototype.cleanup=function(i){if(typeof this.xhr<"u"&&this.xhr!==null){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,i)try{this.xhr.abort()}catch{}t.document&&delete o.requests[this.index],this.xhr=null}},o.prototype.onLoad=function(){var i;try{var a;try{a=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch{}i=a==="application/octet-stream"?this.xhr.response:this.supportsBinary?"ok":this.xhr.responseText}catch(f){this.onError(f)}i!=null&&this.onData(i)},o.prototype.hasXDR=function(){return typeof t.XDomainRequest<"u"&&!this.xs&&this.enablesXDR},o.prototype.abort=function(){this.cleanup()},t.document&&(o.requestsCount=0,o.requests={},t.attachEvent?t.attachEvent("onunload",u):t.addEventListener&&t.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(s,e){function t(c){var p=c&&c.forceBase64;(!d||p)&&(this.supportsBinary=!1),n.call(this,c)}var n=s("../transport"),r=s("parseqs"),o=s("engine.io-parser"),u=s("component-inherit"),h=s("debug")("engine.io-client:polling");e.exports=t;var d=function(){var c=s("xmlhttprequest"),p=new c({xdomain:!1});return p.responseType!=null}();u(t,n),t.prototype.name="polling",t.prototype.doOpen=function(){this.poll()},t.prototype.pause=function(c){function p(){h("paused"),l.readyState="paused",c()}var l=this;if(this.readyState="pausing",this.polling||!this.writable){var i=0;this.polling&&(h("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){h("pre-pause polling complete"),--i||p()})),this.writable||(h("we are currently writing - waiting to pause"),i++,this.once("drain",function(){h("pre-pause writing complete"),--i||p()}))}else p()},t.prototype.poll=function(){h("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},t.prototype.onData=function(c){var p=this;h("polling got data %s",c);var l=function(i){return p.readyState=="opening"&&p.onOpen(),i.type=="close"?(p.onClose(),!1):void p.onPacket(i)};o.decodePayload(c,this.socket.binaryType,l),this.readyState!="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState=="open"?this.poll():h('ignoring poll - transport state "%s"',this.readyState))},t.prototype.doClose=function(){function c(){h("writing close packet"),p.write([{type:"close"}])}var p=this;this.readyState=="open"?(h("transport open - closing"),c()):(h("transport not open - deferring close"),this.once("open",c))},t.prototype.write=function(c){var l=this;this.writable=!1;var p=function(){l.writable=!0,l.emit("drain")},l=this;o.encodePayload(c,this.supportsBinary,function(i){l.doWrite(i,p)})},t.prototype.uri=function(){var c=this.query||{},p=this.secure?"https":"http",l="";return this.timestampRequests!==!1&&(c[this.timestampParam]=+new Date+"-"+n.timestamps++),this.supportsBinary||c.sid||(c.b64=1),c=r.encode(c),this.port&&(p=="https"&&this.port!=443||p=="http"&&this.port!=80)&&(l=":"+this.port),c.length&&(c="?"+c),p+"://"+this.hostname+l+this.path+c}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,xmlhttprequest:20}],19:[function(s,e){function t(c){var p=c&&c.forceBase64;p&&(this.supportsBinary=!1),n.call(this,c)}var n=s("../transport"),r=s("engine.io-parser"),o=s("parseqs"),u=s("component-inherit"),h=s("debug")("engine.io-client:websocket"),d=s("ws");e.exports=t,u(t,n),t.prototype.name="websocket",t.prototype.supportsBinary=!0,t.prototype.doOpen=function(){if(this.check()){var c=this.uri(),p=void 0,l={agent:this.agent};l.pfx=this.pfx,l.key=this.key,l.passphrase=this.passphrase,l.cert=this.cert,l.ca=this.ca,l.ciphers=this.ciphers,l.rejectUnauthorized=this.rejectUnauthorized,this.ws=new d(c,p,l),this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.binaryType="arraybuffer",this.addEventListeners()}},t.prototype.addEventListeners=function(){var c=this;this.ws.onopen=function(){c.onOpen()},this.ws.onclose=function(){c.onClose()},this.ws.onmessage=function(p){c.onData(p.data)},this.ws.onerror=function(p){c.onError("websocket error",p)}},typeof navigator<"u"&&/iPad|iPhone|iPod/i.test(navigator.userAgent)&&(t.prototype.onData=function(c){var p=this;setTimeout(function(){n.prototype.onData.call(p,c)},0)}),t.prototype.write=function(c){function p(){l.writable=!0,l.emit("drain")}var l=this;this.writable=!1;for(var i=0,a=c.length;a>i;i++)r.encodePacket(c[i],this.supportsBinary,function(f){try{l.ws.send(f)}catch{h("websocket closed before onclose event")}});setTimeout(p,0)},t.prototype.onClose=function(){n.prototype.onClose.call(this)},t.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()},t.prototype.uri=function(){var c=this.query||{},p=this.secure?"wss":"ws",l="";return this.port&&(p=="wss"&&this.port!=443||p=="ws"&&this.port!=80)&&(l=":"+this.port),this.timestampRequests&&(c[this.timestampParam]=+new Date),this.supportsBinary||(c.b64=1),c=o.encode(c),c.length&&(c="?"+c),p+"://"+this.hostname+l+this.path+c},t.prototype.check=function(){return!(!d||"__initialize"in d&&this.name===t.prototype.name)}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,ws:35}],20:[function(s,e){var t=s("has-cors");e.exports=function(n){var r=n.xdomain,o=n.xscheme,u=n.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!r||t))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!o&&u)return new XDomainRequest}catch{}if(!r)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{}}},{"has-cors":38}],21:[function(s,e){e.exports=function(t,n){var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],22:[function(s,e,t){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 r(){var d=arguments,c=this.useColors;if(d[0]=(c?"%c":"")+this.namespace+(c?" %c":" ")+d[0]+(c?"%c ":" ")+"+"+t.humanize(this.diff),!c)return d;var p="color: "+this.color;d=[d[0],p,"color: inherit"].concat(Array.prototype.slice.call(d,1));var l=0,i=0;return d[0].replace(/%[a-z%]/g,function(a){a!=="%%"&&(l++,a==="%c"&&(i=l))}),d.splice(i,0,p),d}function o(){return typeof console=="object"&&typeof console.log=="function"&&Function.prototype.apply.call(console.log,console,arguments)}function u(d){try{d==null?localStorage.removeItem("debug"):localStorage.debug=d}catch{}}function h(){var d;try{d=localStorage.debug}catch{}return d}t=e.exports=s("./debug"),t.log=o,t.formatArgs=r,t.save=u,t.load=h,t.useColors=n,t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(d){return JSON.stringify(d)},t.enable(h())},{"./debug":23}],23:[function(s,e,t){function n(){return t.colors[p++%t.colors.length]}function r(l){function i(){}function a(){var g=a,y=+new Date,E=y-(c||y);g.diff=E,g.prev=c,g.curr=y,c=y,g.useColors==null&&(g.useColors=t.useColors()),g.color==null&&g.useColors&&(g.color=n());var j=Array.prototype.slice.call(arguments);j[0]=t.coerce(j[0]),typeof j[0]!="string"&&(j=["%o"].concat(j));var B=0;j[0]=j[0].replace(/%([a-z%])/g,function(L,b){if(L==="%%")return L;B++;var T=t.formatters[b];if(typeof T=="function"){var A=j[B];L=T.call(g,A),j.splice(B,1),B--}return L}),typeof t.formatArgs=="function"&&(j=t.formatArgs.apply(g,j));var F=a.log||t.log||console.log.bind(console);F.apply(g,j)}i.enabled=!1,a.enabled=!0;var f=t.enabled(l)?a:i;return f.namespace=l,f}function o(l){t.save(l);for(var i=(l||"").split(/[\s,]+/),a=i.length,f=0;a>f;f++)i[f]&&(l=i[f].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.substr(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function u(){t.enable("")}function h(l){var i,a;for(i=0,a=t.skips.length;a>i;i++)if(t.skips[i].test(l))return!1;for(i=0,a=t.names.length;a>i;i++)if(t.names[i].test(l))return!0;return!1}function d(l){return l instanceof Error?l.stack||l.message:l}t=e.exports=r,t.coerce=d,t.disable=u,t.enable=o,t.enabled=h,t.humanize=s("ms"),t.names=[],t.skips=[],t.formatters={};var c,p=0},{ms:24}],24:[function(s,e){function t(l){var i=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(l);if(i){var a=parseFloat(i[1]),f=(i[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"y":return a*p;case"days":case"day":case"d":return a*c;case"hours":case"hour":case"h":return a*d;case"minutes":case"minute":case"m":return a*h;case"seconds":case"second":case"s":return a*u;case"ms":return a}}}function n(l){return l>=c?Math.round(l/c)+"d":l>=d?Math.round(l/d)+"h":l>=h?Math.round(l/h)+"m":l>=u?Math.round(l/u)+"s":l+"ms"}function r(l){return o(l,c,"day")||o(l,d,"hour")||o(l,h,"minute")||o(l,u,"second")||l+" ms"}function o(l,i,a){return i>l?void 0:1.5*i>l?Math.floor(l/i)+" "+a:Math.ceil(l/i)+" "+a+"s"}var u=1e3,h=60*u,d=60*h,c=24*d,p=365.25*c;e.exports=function(l,i){return i=i||{},typeof l=="string"?t(l):i.long?r(l):n(l)}},{}],25:[function(s,e,t){(function(n){function r(b,T){var A="b"+t.packets[b.type]+b.data.data;return T(A)}function o(b,T,A){if(!T)return t.encodeBase64Packet(b,A);var m=b.data,v=new Uint8Array(m),_=new Uint8Array(1+m.byteLength);_[0]=j[b.type];for(var I=0;I<v.length;I++)_[I+1]=v[I];return A(_.buffer)}function u(b,T,A){if(!T)return t.encodeBase64Packet(b,A);var m=new FileReader;return m.onload=function(){b.data=m.result,t.encodePacket(b,T,!0,A)},m.readAsArrayBuffer(b.data)}function h(b,T,A){if(!T)return t.encodeBase64Packet(b,A);if(E)return u(b,T,A);var m=new Uint8Array(1);m[0]=j[b.type];var v=new L([m.buffer,b.data]);return A(v)}function d(b,T,A){for(var m=new Array(b.length),v=a(b.length,A),_=function(R,k,W){T(k,function(G,H){m[R]=H,W(G,m)})},I=0;I<b.length;I++)_(I,b[I],v)}var c=s("./keys"),p=s("has-binary"),l=s("arraybuffer.slice"),i=s("base64-arraybuffer"),a=s("after"),f=s("utf8"),g=navigator.userAgent.match(/Android/i),y=/PhantomJS/i.test(navigator.userAgent),E=g||y;t.protocol=3;var j=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},B=c(j),F={type:"error",data:"parser error"},L=s("blob");t.encodePacket=function(b,T,A,m){typeof T=="function"&&(m=T,T=!1),typeof A=="function"&&(m=A,A=null);var v=b.data===void 0?void 0:b.data.buffer||b.data;if(n.ArrayBuffer&&v instanceof ArrayBuffer)return o(b,T,m);if(L&&v instanceof n.Blob)return h(b,T,m);if(v&&v.base64)return r(b,m);var _=j[b.type];return b.data!==void 0&&(_+=A?f.encode(String(b.data)):String(b.data)),m(""+_)},t.encodeBase64Packet=function(b,T){var A="b"+t.packets[b.type];if(L&&b.data instanceof L){var m=new FileReader;return m.onload=function(){var k=m.result.split(",")[1];T(A+k)},m.readAsDataURL(b.data)}var v;try{v=String.fromCharCode.apply(null,new Uint8Array(b.data))}catch{for(var _=new Uint8Array(b.data),I=new Array(_.length),R=0;R<_.length;R++)I[R]=_[R];v=String.fromCharCode.apply(null,I)}return A+=n.btoa(v),T(A)},t.decodePacket=function(b,T,A){if(typeof b=="string"||b===void 0){if(b.charAt(0)=="b")return t.decodeBase64Packet(b.substr(1),T);if(A)try{b=f.decode(b)}catch{return F}var v=b.charAt(0);return Number(v)==v&&B[v]?b.length>1?{type:B[v],data:b.substring(1)}:{type:B[v]}:F}var m=new Uint8Array(b),v=m[0],_=l(b,1);return L&&T==="blob"&&(_=new L([_])),{type:B[v],data:_}},t.decodeBase64Packet=function(b,T){var A=B[b.charAt(0)];if(!n.ArrayBuffer)return{type:A,data:{base64:!0,data:b.substr(1)}};var m=i.decode(b.substr(1));return T==="blob"&&L&&(m=new L([m])),{type:A,data:m}},t.encodePayload=function(b,T,A){function m(I){return I.length+":"+I}function v(I,R){t.encodePacket(I,_?T:!1,!0,function(k){R(null,m(k))})}typeof T=="function"&&(A=T,T=null);var _=p(b);return T&&_?L&&!E?t.encodePayloadAsBlob(b,A):t.encodePayloadAsArrayBuffer(b,A):b.length?void d(b,v,function(I,R){return A(R.join(""))}):A("0:")},t.decodePayload=function(b,T,A){if(typeof b!="string")return t.decodePayloadAsBinary(b,T,A);typeof T=="function"&&(A=T,T=null);var m;if(b=="")return A(F,0,1);for(var v,_,I="",R=0,k=b.length;k>R;R++){var W=b.charAt(R);if(W!=":")I+=W;else{if(I==""||I!=(v=Number(I))||(_=b.substr(R+1,v),I!=_.length))return A(F,0,1);if(_.length){if(m=t.decodePacket(_,T,!0),F.type==m.type&&F.data==m.data)return A(F,0,1);var G=A(m,R+v,k);if(G===!1)return}R+=v,I=""}}return I!=""?A(F,0,1):void 0},t.encodePayloadAsArrayBuffer=function(b,T){function A(m,v){t.encodePacket(m,!0,!0,function(_){return v(null,_)})}return b.length?void d(b,A,function(m,v){var _=v.reduce(function(k,W){var G;return G=typeof W=="string"?W.length:W.byteLength,k+G.toString().length+G+2},0),I=new Uint8Array(_),R=0;return v.forEach(function(k){var W=typeof k=="string",G=k;if(W){for(var H=new Uint8Array(k.length),M=0;M<k.length;M++)H[M]=k.charCodeAt(M);G=H.buffer}I[R++]=W?0:1;for(var Y=G.byteLength.toString(),M=0;M<Y.length;M++)I[R++]=parseInt(Y[M]);I[R++]=255;for(var H=new Uint8Array(G),M=0;M<H.length;M++)I[R++]=H[M]}),T(I.buffer)}):T(new ArrayBuffer(0))},t.encodePayloadAsBlob=function(b,T){function A(m,v){t.encodePacket(m,!0,!0,function(_){var I=new Uint8Array(1);if(I[0]=1,typeof _=="string"){for(var R=new Uint8Array(_.length),k=0;k<_.length;k++)R[k]=_.charCodeAt(k);_=R.buffer,I[0]=0}for(var W=_ instanceof ArrayBuffer?_.byteLength:_.size,G=W.toString(),H=new Uint8Array(G.length+1),k=0;k<G.length;k++)H[k]=parseInt(G[k]);if(H[G.length]=255,L){var M=new L([I.buffer,H.buffer,_]);v(null,M)}})}d(b,A,function(m,v){return T(new L(v))})},t.decodePayloadAsBinary=function(b,T,A){typeof T=="function"&&(A=T,T=null);for(var m=b,v=[],_=!1;m.byteLength>0;){for(var I=new Uint8Array(m),R=I[0]===0,k="",W=1;I[W]!=255;W++){if(k.length>310){_=!0;break}k+=I[W]}if(_)return A(F,0,1);m=l(m,2+k.length),k=parseInt(k);var G=l(m,0,k);if(R)try{G=String.fromCharCode.apply(null,new Uint8Array(G))}catch{var H=new Uint8Array(G);G="";for(var W=0;W<H.length;W++)G+=String.fromCharCode(H[W])}v.push(G),m=l(m,k)}var M=v.length;v.forEach(function(Y,gt){A(t.decodePacket(Y,T,!0),gt,M)})}}).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(s,e){e.exports=Object.keys||function(t){var n=[],r=Object.prototype.hasOwnProperty;for(var o in t)r.call(t,o)&&n.push(o);return n}},{}],27:[function(s,e){function t(r,o,u){function h(c,p){if(h.count<=0)throw new Error("after called too many times");--h.count,c?(d=!0,o(c),o=u):h.count!==0||d||o(null,p)}var d=!1;return u=u||n,h.count=r,r===0?o():h}function n(){}e.exports=t},{}],28:[function(s,e){e.exports=function(t,n,r){var o=t.byteLength;if(n=n||0,r=r||o,t.slice)return t.slice(n,r);if(0>n&&(n+=o),0>r&&(r+=o),r>o&&(r=o),n>=o||n>=r||o===0)return new ArrayBuffer(0);for(var u=new Uint8Array(t),h=new Uint8Array(r-n),d=n,c=0;r>d;d++,c++)h[c]=u[d];return h.buffer}},{}],29:[function(s,e,t){(function(n){t.encode=function(r){var o,u=new Uint8Array(r),h=u.length,d="";for(o=0;h>o;o+=3)d+=n[u[o]>>2],d+=n[(3&u[o])<<4|u[o+1]>>4],d+=n[(15&u[o+1])<<2|u[o+2]>>6],d+=n[63&u[o+2]];return h%3===2?d=d.substring(0,d.length-1)+"=":h%3===1&&(d=d.substring(0,d.length-2)+"=="),d},t.decode=function(r){var o,u,h,d,c,p=.75*r.length,l=r.length,i=0;r[r.length-1]==="="&&(p--,r[r.length-2]==="="&&p--);var a=new ArrayBuffer(p),f=new Uint8Array(a);for(o=0;l>o;o+=4)u=n.indexOf(r[o]),h=n.indexOf(r[o+1]),d=n.indexOf(r[o+2]),c=n.indexOf(r[o+3]),f[i++]=u<<2|h>>4,f[i++]=(15&h)<<4|d>>2,f[i++]=(3&d)<<6|63&c;return a}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],30:[function(s,e){(function(t){function n(p){for(var l=0;l<p.length;l++){var i=p[l];if(i.buffer instanceof ArrayBuffer){var a=i.buffer;if(i.byteLength!==a.byteLength){var f=new Uint8Array(i.byteLength);f.set(new Uint8Array(a,i.byteOffset,i.byteLength)),a=f.buffer}p[l]=a}}}function r(p,l){l=l||{};var i=new u;n(p);for(var a=0;a<p.length;a++)i.append(p[a]);return l.type?i.getBlob(l.type):i.getBlob()}function o(p,l){return n(p),new Blob(p,l||{})}var u=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,h=function(){try{var p=new Blob(["hi"]);return p.size===2}catch{return!1}}(),d=h&&function(){try{var p=new Blob([new Uint8Array([1,2])]);return p.size===2}catch{return!1}}(),c=u&&u.prototype.append&&u.prototype.getBlob;e.exports=function(){return h?d?t.Blob:o:c?r:void 0}()}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],31:[function(s,e,t){(function(n){(function(r){function o(m){for(var v,_,I=[],R=0,k=m.length;k>R;)v=m.charCodeAt(R++),v>=55296&&56319>=v&&k>R?(_=m.charCodeAt(R++),(64512&_)==56320?I.push(((1023&v)<<10)+(1023&_)+65536):(I.push(v),R--)):I.push(v);return I}function u(m){for(var v,_=m.length,I=-1,R="";++I<_;)v=m[I],v>65535&&(v-=65536,R+=F(v>>>10&1023|55296),v=56320|1023&v),R+=F(v);return R}function h(m){if(m>=55296&&57343>=m)throw Error("Lone surrogate U+"+m.toString(16).toUpperCase()+" is not a scalar value")}function d(m,v){return F(m>>v&63|128)}function c(m){if(!(4294967168&m))return F(m);var v="";return 4294965248&m?4294901760&m?!(4292870144&m)&&(v=F(m>>18&7|240),v+=d(m,12),v+=d(m,6)):(h(m),v=F(m>>12&15|224),v+=d(m,6)):v=F(m>>6&31|192),v+=F(63&m|128)}function p(m){for(var v,_=o(m),I=_.length,R=-1,k="";++R<I;)v=_[R],k+=c(v);return k}function l(){if(B>=j)throw Error("Invalid byte index");var m=255&E[B];if(B++,(192&m)==128)return 63&m;throw Error("Invalid continuation byte")}function i(){var m,v,_,I,R;if(B>j)throw Error("Invalid byte index");if(B==j)return!1;if(m=255&E[B],B++,(128&m)==0)return m;if((224&m)==192){var v=l();if(R=(31&m)<<6|v,R>=128)return R;throw Error("Invalid continuation byte")}if((240&m)==224){if(v=l(),_=l(),R=(15&m)<<12|v<<6|_,R>=2048)return h(R),R;throw Error("Invalid continuation byte")}if((248&m)==240&&(v=l(),_=l(),I=l(),R=(15&m)<<18|v<<12|_<<6|I,R>=65536&&1114111>=R))return R;throw Error("Invalid UTF-8 detected")}function a(m){E=o(m),j=E.length,B=0;for(var v,_=[];(v=i())!==!1;)_.push(v);return u(_)}var f=typeof t=="object"&&t,g=typeof e=="object"&&e&&e.exports==f&&e,y=typeof n=="object"&&n;(y.global===y||y.window===y)&&(r=y);var E,j,B,F=String.fromCharCode,L={version:"2.0.0",encode:p,decode:a};if(f&&!f.nodeType)if(g)g.exports=L;else{var b={},T=b.hasOwnProperty;for(var A in L)T.call(L,A)&&(f[A]=L[A])}else r.utf8=L})(this)}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],32:[function(s,e){(function(t){var n=/^[\],:{}\s]*$/,r=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,o=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,u=/(?:^|:|,)(?:\s*\[)+/g,h=/^\s+/,d=/\s+$/;e.exports=function(c){return typeof c=="string"&&c?(c=c.replace(h,"").replace(d,""),t.JSON&&JSON.parse?JSON.parse(c):n.test(c.replace(r,"@").replace(o,"]").replace(u,""))?new Function("return "+c)():void 0):null}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],33:[function(s,e,t){t.encode=function(n){var r="";for(var o in n)n.hasOwnProperty(o)&&(r.length&&(r+="&"),r+=encodeURIComponent(o)+"="+encodeURIComponent(n[o]));return r},t.decode=function(n){for(var r={},o=n.split("&"),u=0,h=o.length;h>u;u++){var d=o[u].split("=");r[decodeURIComponent(d[0])]=decodeURIComponent(d[1])}return r}},{}],34:[function(s,e){var t=/^(?:(?![^:@]+:[^:@\/]*@)(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(r){var o=r,u=r.indexOf("["),h=r.indexOf("]");u!=-1&&h!=-1&&(r=r.substring(0,u)+r.substring(u,h).replace(/:/g,";")+r.substring(h,r.length));for(var d=t.exec(r||""),c={},p=14;p--;)c[n[p]]=d[p]||"";return u!=-1&&h!=-1&&(c.source=o,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(s,e){function t(o,u){return u?new r(o,u):new r(o)}var n=function(){return self}(),r=n.WebSocket||n.MozWebSocket;e.exports=r?t:null,r&&(t.prototype=r.prototype)},{}],36:[function(s,e){(function(t){function n(o){function u(h){if(!h)return!1;if(t.Buffer&&t.Buffer.isBuffer(h)||t.ArrayBuffer&&h instanceof ArrayBuffer||t.Blob&&h instanceof Blob||t.File&&h instanceof File)return!0;if(r(h)){for(var d=0;d<h.length;d++)if(u(h[d]))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(o)}var r=s("isarray");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{isarray:37}],37:[function(s,e){e.exports=Array.isArray||function(t){return Object.prototype.toString.call(t)=="[object Array]"}},{}],38:[function(s,e){var t=s("global");try{e.exports="XMLHttpRequest"in t&&"withCredentials"in new t.XMLHttpRequest}catch{e.exports=!1}},{global:39}],39:[function(s,e){e.exports=function(){return this}()},{}],40:[function(s,e){var t=[].indexOf;e.exports=function(n,r){if(t)return n.indexOf(r);for(var o=0;o<n.length;++o)if(n[o]===r)return o;return-1}},{}],41:[function(s,e,t){var n=Object.prototype.hasOwnProperty;t.keys=Object.keys||function(r){var o=[];for(var u in r)n.call(r,u)&&o.push(u);return o},t.values=function(r){var o=[];for(var u in r)n.call(r,u)&&o.push(r[u]);return o},t.merge=function(r,o){for(var u in o)n.call(o,u)&&(r[u]=o[u]);return r},t.length=function(r){return t.keys(r).length},t.isEmpty=function(r){return t.length(r)==0}},{}],42:[function(s,e){var t=/^(?:(?![^:@]+:[^:@\/]*@)(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(r){for(var o=t.exec(r||""),u={},h=14;h--;)u[n[h]]=o[h]||"";return u}},{}],43:[function(s,e,t){(function(n){var r=s("isarray"),o=s("./is-buffer");t.deconstructPacket=function(u){function h(l){if(!l)return l;if(o(l)){var i={_placeholder:!0,num:d.length};return d.push(l),i}if(r(l)){for(var a=new Array(l.length),f=0;f<l.length;f++)a[f]=h(l[f]);return a}if(typeof l=="object"&&!(l instanceof Date)){var a={};for(var g in l)a[g]=h(l[g]);return a}return l}var d=[],c=u.data,p=u;return p.data=h(c),p.attachments=d.length,{packet:p,buffers:d}},t.reconstructPacket=function(u,h){function d(c){if(c&&c._placeholder){var p=h[c.num];return p}if(r(c)){for(var l=0;l<c.length;l++)c[l]=d(c[l]);return c}if(c&&typeof c=="object"){for(var i in c)c[i]=d(c[i]);return c}return c}return u.data=d(u.data),u.attachments=void 0,u},t.removeBlobs=function(u,h){function d(l,i,a){if(!l)return l;if(n.Blob&&l instanceof Blob||n.File&&l instanceof File){c++;var f=new FileReader;f.onload=function(){a?a[i]=this.result:p=this.result,--c||h(p)},f.readAsArrayBuffer(l)}else if(r(l))for(var g=0;g<l.length;g++)d(l[g],g,l);else if(l&&typeof l=="object"&&!o(l))for(var y in l)d(l[y],y,l)}var c=0,p=u;d(p),c||h(p)}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./is-buffer":45,isarray:46}],44:[function(s,e,t){function n(){}function r(g){var y="",E=!1;return y+=g.type,(t.BINARY_EVENT==g.type||t.BINARY_ACK==g.type)&&(y+=g.attachments,y+="-"),g.nsp&&g.nsp!="/"&&(E=!0,y+=g.nsp),g.id!=null&&(E&&(y+=",",E=!1),y+=g.id),g.data!=null&&(E&&(y+=","),y+=l.stringify(g.data)),p("encoded %j as %s",g,y),y}function o(g,y){function E(j){var B=a.deconstructPacket(j),F=r(B.packet),L=B.buffers;L.unshift(F),y(L)}a.removeBlobs(g,E)}function u(){this.reconstructor=null}function h(g){var y={},E=0;if(y.type=Number(g.charAt(0)),t.types[y.type]==null)return c();if(t.BINARY_EVENT==y.type||t.BINARY_ACK==y.type){for(var j="";g.charAt(++E)!="-"&&(j+=g.charAt(E),E!=g.length););if(j!=Number(j)||g.charAt(E)!="-")throw new Error("Illegal attachments");y.attachments=Number(j)}if(g.charAt(E+1)=="/")for(y.nsp="";++E;){var B=g.charAt(E);if(B==","||(y.nsp+=B,E==g.length))break}else y.nsp="/";var F=g.charAt(E+1);if(F!==""&&Number(F)==F){for(y.id="";++E;){var B=g.charAt(E);if(B==null||Number(B)!=B){--E;break}if(y.id+=g.charAt(E),E==g.length)break}y.id=Number(y.id)}if(g.charAt(++E))try{y.data=l.parse(g.substr(E))}catch{return c()}return p("decoded %s as %j",g,y),y}function d(g){this.reconPack=g,this.buffers=[]}function c(){return{type:t.ERROR,data:"parser error"}}var p=s("debug")("socket.io-parser"),l=s("json3"),i=(s("isarray"),s("component-emitter")),a=s("./binary"),f=s("./is-buffer");t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"],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=n,t.Decoder=u,n.prototype.encode=function(g,y){if(p("encoding packet %j",g),t.BINARY_EVENT==g.type||t.BINARY_ACK==g.type)o(g,y);else{var E=r(g);y([E])}},i(u.prototype),u.prototype.add=function(g){var y;if(typeof g=="string")y=h(g),t.BINARY_EVENT==y.type||t.BINARY_ACK==y.type?(this.reconstructor=new d(y),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",y)):this.emit("decoded",y);else{if(!f(g)&&!g.base64)throw new Error("Unknown type: "+g);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");y=this.reconstructor.takeBinaryData(g),y&&(this.reconstructor=null,this.emit("decoded",y))}},u.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},d.prototype.takeBinaryData=function(g){if(this.buffers.push(g),this.buffers.length==this.reconPack.attachments){var y=a.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),y}return null},d.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},{"./binary":43,"./is-buffer":45,"component-emitter":9,debug:10,isarray:46,json3:47}],45:[function(s,e){(function(t){function n(r){return t.Buffer&&t.Buffer.isBuffer(r)||t.ArrayBuffer&&r instanceof ArrayBuffer}e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],46:[function(s,e){e.exports=s(37)},{}],47:[function(s,e,t){(function(n){function r(w){if(r[w]!==h)return r[w];var O;if(w=="bug-string-char-index")O=!1;else if(w=="json")O=r("json-stringify")&&r("json-parse");else{var C,D='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(w=="json-stringify"){var S=p.stringify,x=typeof S=="function"&&l;if(x){(C=function(){return 1}).toJSON=C;try{x=S(0)==="0"&&S(new Number)==="0"&&S(new String)=='""'&&S(d)===h&&S(h)===h&&S()===h&&S(C)==="1"&&S([C])=="[1]"&&S([h])=="[null]"&&S(null)=="null"&&S([h,d,null])=="[null,null,null]"&&S({a:[C,!0,!1,null,`\0\b
8
- \f\r `]})==D&&S(null,C)==="1"&&S([1,2],null,1)==`[
6
+ */var Ye=function(s){return s!=null&&(Ce(s)||Qe(s)||!!s._isBuffer)};function Ce(s){return!!s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function Qe(s){return typeof s.readFloatLE=="function"&&typeof s.slice=="function"&&Ce(s.slice(0,0))}(function(){var s=He,e=ce.utf8,t=Ye,n=ce.bin,r=function(o,u){o.constructor==String?u&&u.encoding==="binary"?o=n.stringToBytes(o):o=e.stringToBytes(o):t(o)?o=Array.prototype.slice.call(o,0):!Array.isArray(o)&&o.constructor!==Uint8Array&&(o=o.toString());for(var h=s.bytesToWords(o),d=o.length*8,c=1732584193,p=-271733879,l=-1732584194,i=271733878,a=0;a<h.length;a++)h[a]=(h[a]<<8|h[a]>>>24)&16711935|(h[a]<<24|h[a]>>>8)&4278255360;h[d>>>5]|=128<<d%32,h[(d+64>>>9<<4)+14]=d;for(var f=r._ff,g=r._gg,y=r._hh,E=r._ii,a=0;a<h.length;a+=16){var j=c,U=p,F=l,L=i;c=f(c,p,l,i,h[a+0],7,-680876936),i=f(i,c,p,l,h[a+1],12,-389564586),l=f(l,i,c,p,h[a+2],17,606105819),p=f(p,l,i,c,h[a+3],22,-1044525330),c=f(c,p,l,i,h[a+4],7,-176418897),i=f(i,c,p,l,h[a+5],12,1200080426),l=f(l,i,c,p,h[a+6],17,-1473231341),p=f(p,l,i,c,h[a+7],22,-45705983),c=f(c,p,l,i,h[a+8],7,1770035416),i=f(i,c,p,l,h[a+9],12,-1958414417),l=f(l,i,c,p,h[a+10],17,-42063),p=f(p,l,i,c,h[a+11],22,-1990404162),c=f(c,p,l,i,h[a+12],7,1804603682),i=f(i,c,p,l,h[a+13],12,-40341101),l=f(l,i,c,p,h[a+14],17,-1502002290),p=f(p,l,i,c,h[a+15],22,1236535329),c=g(c,p,l,i,h[a+1],5,-165796510),i=g(i,c,p,l,h[a+6],9,-1069501632),l=g(l,i,c,p,h[a+11],14,643717713),p=g(p,l,i,c,h[a+0],20,-373897302),c=g(c,p,l,i,h[a+5],5,-701558691),i=g(i,c,p,l,h[a+10],9,38016083),l=g(l,i,c,p,h[a+15],14,-660478335),p=g(p,l,i,c,h[a+4],20,-405537848),c=g(c,p,l,i,h[a+9],5,568446438),i=g(i,c,p,l,h[a+14],9,-1019803690),l=g(l,i,c,p,h[a+3],14,-187363961),p=g(p,l,i,c,h[a+8],20,1163531501),c=g(c,p,l,i,h[a+13],5,-1444681467),i=g(i,c,p,l,h[a+2],9,-51403784),l=g(l,i,c,p,h[a+7],14,1735328473),p=g(p,l,i,c,h[a+12],20,-1926607734),c=y(c,p,l,i,h[a+5],4,-378558),i=y(i,c,p,l,h[a+8],11,-2022574463),l=y(l,i,c,p,h[a+11],16,1839030562),p=y(p,l,i,c,h[a+14],23,-35309556),c=y(c,p,l,i,h[a+1],4,-1530992060),i=y(i,c,p,l,h[a+4],11,1272893353),l=y(l,i,c,p,h[a+7],16,-155497632),p=y(p,l,i,c,h[a+10],23,-1094730640),c=y(c,p,l,i,h[a+13],4,681279174),i=y(i,c,p,l,h[a+0],11,-358537222),l=y(l,i,c,p,h[a+3],16,-722521979),p=y(p,l,i,c,h[a+6],23,76029189),c=y(c,p,l,i,h[a+9],4,-640364487),i=y(i,c,p,l,h[a+12],11,-421815835),l=y(l,i,c,p,h[a+15],16,530742520),p=y(p,l,i,c,h[a+2],23,-995338651),c=E(c,p,l,i,h[a+0],6,-198630844),i=E(i,c,p,l,h[a+7],10,1126891415),l=E(l,i,c,p,h[a+14],15,-1416354905),p=E(p,l,i,c,h[a+5],21,-57434055),c=E(c,p,l,i,h[a+12],6,1700485571),i=E(i,c,p,l,h[a+3],10,-1894986606),l=E(l,i,c,p,h[a+10],15,-1051523),p=E(p,l,i,c,h[a+1],21,-2054922799),c=E(c,p,l,i,h[a+8],6,1873313359),i=E(i,c,p,l,h[a+15],10,-30611744),l=E(l,i,c,p,h[a+6],15,-1560198380),p=E(p,l,i,c,h[a+13],21,1309151649),c=E(c,p,l,i,h[a+4],6,-145523070),i=E(i,c,p,l,h[a+11],10,-1120210379),l=E(l,i,c,p,h[a+2],15,718787259),p=E(p,l,i,c,h[a+9],21,-343485551),c=c+j>>>0,p=p+U>>>0,l=l+F>>>0,i=i+L>>>0}return s.endian([c,p,l,i])};r._ff=function(o,u,h,d,c,p,l){var i=o+(u&h|~u&d)+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._gg=function(o,u,h,d,c,p,l){var i=o+(u&d|h&~d)+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._hh=function(o,u,h,d,c,p,l){var i=o+(u^h^d)+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._ii=function(o,u,h,d,c,p,l){var i=o+(h^(u|~d))+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._blocksize=16,r._digestsize=16,Se.exports=function(o,u){if(o==null)throw new Error("Illegal argument "+o);var h=s.wordsToBytes(r(o,u));return u&&u.asBytes?h:u&&u.asString?n.bytesToString(h):s.bytesToHex(h)}})();var Ze=Se.exports;const tn=ze(Ze);var ut=(s=>(s.BOOTSTRAP="bootstrap",s.DEBUG_EXTENSIONS="debugExtensions",s.DEBUG_QUEUE="debugQueue",s.DEBUG_DIALER="debugDialer",s.FULL="full",s))(ut||{}),at=(s=>(s.MAIN="main",s.NEXT="next",s))(at||{}),st=(s=>(s.USER="User",s.TOKEN="Token",s))(st||{});class kt{static async getSessionStorageDataByKey(e,t=!0){if(typeof chrome<"u"&&typeof chrome.storage<"u"){const n=await chrome.storage.session.get(e);if(n[e])return t?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 t?JSON.parse(n):n}}static async updateSessionStorageKey(e,t){typeof chrome<"u"&&typeof chrome.storage<"u"&&await chrome.storage.session.set({[e]:JSON.stringify(t)}),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.setItem=="function"&&window.sessionStorage.setItem(e,JSON.stringify(t))}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()}}class en{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=tn(JSON.stringify({...this.eventsSdkClass.options,loggerSocketConnection:null},this.eventsSdkClass.getCircularReplacer())),this.lastLoginTimestamp&&this.lastLoginTimestamp+this.delay>new Date().getTime())return;this.updateLastLoginTimestamp();const t=await this.checkLoginStatus(this.storageKey);return t||(kt.clearSessionStorage(),await this.userLoginFunction(e,this.storageKey,this.eventsSdkClass.options.loginType))}updateLastLoginTimestamp(){this.lastLoginTimestamp=new Date().getTime()}async checkLoginStatus(e){const t=await kt.getSessionStorageDataByKey(e);if(t)return t}async userLoginFunction(e,t,n){let r,o,u;return this.eventsSdkClass.options.isNewStack?(r=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),o=await this.getSettings(r.Data.AccessToken),u={...r.Data,...o}):(r=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),u={...r.Data.Socket}),await kt.updateSessionStorageKey(t,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((t,n)=>t.Priority>n.Priority?t:n)),this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((t,n)=>t.Priority>n.Priority?t:n)),e.MonitorList&&e.MonitorList.length&&(this.eventsSdkClass.servers=[...e.MonitorList],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((t,n)=>t.Priority>n.Priority?t: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(at.MAIN)),e.Token&&(this.token=e.Token,this.eventsSdkClass.connect(at.MAIN)),e.RefreshToken&&e.IdentityCodeExpiry&&this.eventsSdkClass.options.loginType===st.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.IdentityCodeExpiry,this.handleTokenExpiry()),e.RefreshToken&&e.TokenExpiry&&this.normalizeLoginType(this.eventsSdkClass.options.loginType)===st.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 t=e.getTime()-new Date().getTime()-5e3,n=Math.min(t,2147483647);setTimeout(async()=>{if(this.refreshToken){this.eventsSdkClass.socketIoClass.closeAllConnections();let r,o;if(this.eventsSdkClass.options.isNewStack){const u=await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken);r=await this.getSettings(u.Data.AccessToken),o={...u.Data,...r}}else o={...(await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken)).Data.Socket};this.onLoginResponse(o),await kt.updateSessionStorageKey(this.storageKey,o)}},n)}async externalLogin(e,{password:t,token:n,email:r},o){if(!e)throw new Error("loginUrl not provided");let u;this.eventsSdkClass.options.isNewStack?o===st.TOKEN?u=JSON.stringify({identityType:st.TOKEN,token:n}):u=JSON.stringify({identityType:st.USER,username:r,password:t}):this.eventsSdkClass.options.loginType===st.TOKEN?(u=JSON.stringify({token:n}),e=`${e}/${st.TOKEN}`):(u=JSON.stringify({email:r,pin:t}),e=`${e}/${st.USER}`);let h;try{const d=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:u});if(!d.ok&&d.status===400)throw h=400,new Error("Bad body request. Login type or isNewStack values not correct or not provided");if(!d.ok&&d.status===401)throw h=401,new Error("Unauthorized. Invalid token provided");if(!d.ok&&d.status===403)throw h=403,new Error("Forbidden. Identity token not provided or not valid");const c=await d.json();if(c.error)throw new Error(c.error);return c}catch(d){throw this.eventsSdkClass.loggerClass.loginError(o,h,n,r),d}}async getSettings(e){try{if(!this.eventsSdkClass.options.getSettingsUrl)throw new Error("getSettingsUrl not provided");const t=await fetch(this.eventsSdkClass.options.getSettingsUrl,{headers:{Authorization:`Bearer ${e}`}});if(!t.ok&&t.status===401)throw new Error("Unauthorized. Access token not provided or not valid");return t.json()}catch(t){throw this.eventsSdkClass.loggerClass.getSettingsError(e,t),t}}async externalRefreshToken(e,t){try{return(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}})).json()}catch(n){throw this.eventsSdkClass.loggerClass.refreshTokenError(t,e,n),n}}normalizeLoginType(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}}const nn={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:!1,reconnectionDelay:5e3,reconnectionAttempts:10,perMessageDeflate:void 0,upgrade:!1,transports:["websocket"],debug:!1}};function sn(){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=$e,typeof self.navigator>"u"&&(self.navigator={userAgent:"node"})),function s(e,t,n){function r(h,d){if(!t[h]){if(!e[h]){var c=typeof require=="function"&&require;if(!d&&c)return c(h,!0);if(o)return o(h,!0);throw new Error("Cannot find module '"+h+"'")}var p=t[h]={exports:{}};e[h][0].call(p.exports,function(l){var i=e[h][1][l];return r(i||l)},p,p.exports,s,e,t,n)}return t[h].exports}for(var o=typeof require=="function"&&require,u=0;u<n.length;u++)r(n[u]);return r}({1:[function(s,e){e.exports=s("./lib/")},{"./lib/":2}],2:[function(s,e,t){function n(c,p){typeof c=="object"&&(p=c,c=void 0),p=p||{};var l,i=r(c),a=i.source,f=i.id;return p.forceNew||p["force new connection"]||p.multiplex===!1?(h("ignoring socket cache for %s",a),l=u(a,p)):(d[f]||(h("new io instance for %s",a),d[f]=u(a,p)),l=d[f]),l.socket(i.path)}var r=s("./url"),o=s("socket.io-parser"),u=s("./manager"),h=s("debug")("socket.io-client");e.exports=t=n;var d=t.managers={};t.protocol=o.protocol,t.connect=n,t.Manager=s("./manager"),t.Socket=s("./socket")},{"./manager":3,"./socket":5,"./url":6,debug:10,"socket.io-parser":44}],3:[function(s,e){function t(i,a){return this instanceof t?(i&&typeof i=="object"&&(a=i,i=void 0),a=a||{},a.path=a.path||"/socket.io",this.nsps={},this.subs=[],this.opts=a,this.reconnection(a.reconnection!==!1),this.reconnectionAttempts(a.reconnectionAttempts||1/0),this.reconnectionDelay(a.reconnectionDelay||1e3),this.reconnectionDelayMax(a.reconnectionDelayMax||5e3),this.randomizationFactor(a.randomizationFactor||.5),this.backoff=new l({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(a.timeout==null?2e4:a.timeout),this.readyState="closed",this.uri=i,this.connected=[],this.encoding=!1,this.packetBuffer=[],this.encoder=new u.Encoder,this.decoder=new u.Decoder,this.autoConnect=a.autoConnect!==!1,void(this.autoConnect&&this.open())):new t(i,a)}var n=(s("./url"),s("engine.io-client")),r=s("./socket"),o=s("component-emitter"),u=s("socket.io-parser"),h=s("./on"),d=s("component-bind"),c=(s("object-component"),s("debug")("socket.io-client:manager")),p=s("indexof"),l=s("backo2");e.exports=t,t.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var i in this.nsps)this.nsps[i].emit.apply(this.nsps[i],arguments)},t.prototype.updateSocketIds=function(){for(var i in this.nsps)this.nsps[i].id=this.engine.id},o(t.prototype),t.prototype.reconnection=function(i){return arguments.length?(this._reconnection=!!i,this):this._reconnection},t.prototype.reconnectionAttempts=function(i){return arguments.length?(this._reconnectionAttempts=i,this):this._reconnectionAttempts},t.prototype.reconnectionDelay=function(i){return arguments.length?(this._reconnectionDelay=i,this.backoff&&this.backoff.setMin(i),this):this._reconnectionDelay},t.prototype.randomizationFactor=function(i){return arguments.length?(this._randomizationFactor=i,this.backoff&&this.backoff.setJitter(i),this):this._randomizationFactor},t.prototype.reconnectionDelayMax=function(i){return arguments.length?(this._reconnectionDelayMax=i,this.backoff&&this.backoff.setMax(i),this):this._reconnectionDelayMax},t.prototype.timeout=function(i){return arguments.length?(this._timeout=i,this):this._timeout},t.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},t.prototype.open=t.prototype.connect=function(i){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 a=this.engine,f=this;this.readyState="opening",this.skipReconnect=!1;var g=h(a,"open",function(){f.onopen(),i&&i()}),y=h(a,"error",function(U){if(c("connect_error"),f.cleanup(),f.readyState="closed",f.emitAll("connect_error",U),i){var F=new Error("Connection error");F.data=U,i(F)}else f.maybeReconnectOnOpen()});if(this._timeout!==!1){var E=this._timeout;c("connect attempt will timeout after %d",E);var j=setTimeout(function(){c("connect attempt timed out after %d",E),g.destroy(),a.close(),a.emit("error","timeout"),f.emitAll("connect_timeout",E)},E);this.subs.push({destroy:function(){clearTimeout(j)}})}return this.subs.push(g),this.subs.push(y),this},t.prototype.onopen=function(){c("open"),this.cleanup(),this.readyState="open",this.emit("open");var i=this.engine;this.subs.push(h(i,"data",d(this,"ondata"))),this.subs.push(h(this.decoder,"decoded",d(this,"ondecoded"))),this.subs.push(h(i,"error",d(this,"onerror"))),this.subs.push(h(i,"close",d(this,"onclose")))},t.prototype.ondata=function(i){this.decoder.add(i)},t.prototype.ondecoded=function(i){this.emit("packet",i)},t.prototype.onerror=function(i){c("error",i),this.emitAll("error",i)},t.prototype.socket=function(i){var a=this.nsps[i];if(!a){a=new r(this,i),this.nsps[i]=a;var f=this;a.on("connect",function(){a.id=f.engine.id,~p(f.connected,a)||f.connected.push(a)})}return a},t.prototype.destroy=function(i){var a=p(this.connected,i);~a&&this.connected.splice(a,1),this.connected.length||this.close()},t.prototype.packet=function(i){c("writing packet %j",i);var a=this;a.encoding?a.packetBuffer.push(i):(a.encoding=!0,this.encoder.encode(i,function(f){for(var g=0;g<f.length;g++)a.engine.write(f[g]);a.encoding=!1,a.processPacketQueue()}))},t.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var i=this.packetBuffer.shift();this.packet(i)}},t.prototype.cleanup=function(){for(var i;i=this.subs.shift();)i.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},t.prototype.close=t.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},t.prototype.onclose=function(i){c("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",i),this._reconnection&&!this.skipReconnect&&this.reconnect()},t.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var i=this;if(this.backoff.attempts>=this._reconnectionAttempts)c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var a=this.backoff.duration();c("will wait %dms before reconnect attempt",a),this.reconnecting=!0;var f=setTimeout(function(){i.skipReconnect||(c("attempting reconnect"),i.emitAll("reconnect_attempt",i.backoff.attempts),i.emitAll("reconnecting",i.backoff.attempts),i.skipReconnect||i.open(function(g){g?(c("reconnect attempt error"),i.reconnecting=!1,i.reconnect(),i.emitAll("reconnect_error",g.data)):(c("reconnect success"),i.onreconnect())}))},a);this.subs.push({destroy:function(){clearTimeout(f)}})}},t.prototype.onreconnect=function(){var i=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",i)}},{"./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(s,e){function t(n,r,o){return n.on(r,o),{destroy:function(){n.removeListener(r,o)}}}e.exports=t},{}],5:[function(s,e,t){function n(a,f){this.io=a,this.nsp=f,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var r=s("socket.io-parser"),o=s("component-emitter"),u=s("to-array"),h=s("./on"),d=s("component-bind"),c=s("debug")("socket.io-client:socket"),p=s("has-binary");e.exports=n;var l={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},i=o.prototype.emit;o(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var a=this.io;this.subs=[h(a,"open",d(this,"onopen")),h(a,"packet",d(this,"onpacket")),h(a,"close",d(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 a=u(arguments);return a.unshift("message"),this.emit.apply(this,a),this},n.prototype.emit=function(a){if(l.hasOwnProperty(a))return i.apply(this,arguments),this;var f=u(arguments),g=r.EVENT;p(f)&&(g=r.BINARY_EVENT);var y={type:g,data:f};return typeof f[f.length-1]=="function"&&(c("emitting packet with ack id %d",this.ids),this.acks[this.ids]=f.pop(),y.id=this.ids++),this.connected?this.packet(y):this.sendBuffer.push(y),this},n.prototype.packet=function(a){a.nsp=this.nsp,this.io.packet(a)},n.prototype.onopen=function(){c("transport is open - connecting"),this.nsp!="/"&&this.packet({type:r.CONNECT})},n.prototype.onclose=function(a){c("close (%s)",a),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",a)},n.prototype.onpacket=function(a){if(a.nsp==this.nsp)switch(a.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(a);break;case r.BINARY_EVENT:this.onevent(a);break;case r.ACK:this.onack(a);break;case r.BINARY_ACK:this.onack(a);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",a.data)}},n.prototype.onevent=function(a){var f=a.data||[];c("emitting event %j",f),a.id!=null&&(c("attaching ack callback to event"),f.push(this.ack(a.id))),this.connected?i.apply(this,f):this.receiveBuffer.push(f)},n.prototype.ack=function(a){var f=this,g=!1;return function(){if(!g){g=!0;var y=u(arguments);c("sending ack %j",y);var E=p(y)?r.BINARY_ACK:r.ACK;f.packet({type:E,id:a,data:y})}}},n.prototype.onack=function(a){c("calling ack %s with %j",a.id,a.data);var f=this.acks[a.id];f.apply(this,a.data),delete this.acks[a.id]},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var a;for(a=0;a<this.receiveBuffer.length;a++)i.apply(this,this.receiveBuffer[a]);for(this.receiveBuffer=[],a=0;a<this.sendBuffer.length;a++)this.packet(this.sendBuffer[a]);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 a=0;a<this.subs.length;a++)this.subs[a].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:r.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(s,e){(function(t){function n(u,c){var d=u,c=c||t.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)||(o("protocol-less url %s",u),u=typeof c<"u"?c.protocol+"//"+u:"https://"+u),o("parse %s",u),d=r(u)),d.port||(/^(http|ws)$/.test(d.protocol)?d.port="80":/^(http|ws)s$/.test(d.protocol)&&(d.port="443")),d.path=d.path||"/",d.id=d.protocol+"://"+d.host+":"+d.port,d.href=d.protocol+"://"+d.host+(c&&c.port==d.port?"":":"+d.port),d}var r=s("parseuri"),o=s("debug")("socket.io-client:url");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{debug:10,parseuri:42}],7:[function(s,e){function t(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=t,t.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),o=Math.floor(r*this.jitter*n);n=1&Math.floor(10*r)?n+o:n-o}return 0|Math.min(n,this.max)},t.prototype.reset=function(){this.attempts=0},t.prototype.setMin=function(n){this.ms=n},t.prototype.setMax=function(n){this.max=n},t.prototype.setJitter=function(n){this.jitter=n}},{}],8:[function(s,e){var t=[].slice;e.exports=function(n,r){if(typeof r=="string"&&(r=n[r]),typeof r!="function")throw new Error("bind() requires a function");var o=t.call(arguments,2);return function(){return r.apply(n,o.concat(t.call(arguments)))}}},{}],9:[function(s,e){function t(r){return r?n(r):void 0}function n(r){for(var o in t.prototype)r[o]=t.prototype[o];return r}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(r,o){return this._callbacks=this._callbacks||{},(this._callbacks[r]=this._callbacks[r]||[]).push(o),this},t.prototype.once=function(r,o){function u(){h.off(r,u),o.apply(this,arguments)}var h=this;return this._callbacks=this._callbacks||{},u.fn=o,this.on(r,u),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(r,o){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var u=this._callbacks[r];if(!u)return this;if(arguments.length==1)return delete this._callbacks[r],this;for(var h,d=0;d<u.length;d++)if(h=u[d],h===o||h.fn===o){u.splice(d,1);break}return this},t.prototype.emit=function(r){this._callbacks=this._callbacks||{};var o=[].slice.call(arguments,1),u=this._callbacks[r];if(u){u=u.slice(0);for(var h=0,d=u.length;d>h;++h)u[h].apply(this,o)}return this},t.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks[r]||[]},t.prototype.hasListeners=function(r){return!!this.listeners(r).length}},{}],10:[function(s,e){function t(r){return t.enabled(r)?function(o){o=n(o);var u=new Date,h=u-(t[r]||u);t[r]=u,o=r+" "+o+" +"+t.humanize(h),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function n(r){return r instanceof Error?r.stack||r.message:r}e.exports=t,t.names=[],t.skips=[],t.enable=function(r){try{localStorage.debug=r}catch{}for(var o=(r||"").split(/[\s,]+/),u=o.length,h=0;u>h;h++)r=o[h].replace("*",".*?"),r[0]==="-"?t.skips.push(new RegExp("^"+r.substr(1)+"$")):t.names.push(new RegExp("^"+r+"$"))},t.disable=function(){t.enable("")},t.humanize=function(r){var o=1e3,u=6e4,h=60*u;return r>=h?(r/h).toFixed(1)+"h":r>=u?(r/u).toFixed(1)+"m":r>=o?(r/o|0)+"s":r+"ms"},t.enabled=function(r){for(var o=0,u=t.skips.length;u>o;o++)if(t.skips[o].test(r))return!1;for(var o=0,u=t.names.length;u>o;o++)if(t.names[o].test(r))return!0;return!1};try{window.localStorage&&t.enable(localStorage.debug)}catch{}},{}],11:[function(s,e){e.exports=s("./lib/")},{"./lib/":12}],12:[function(s,e){e.exports=s("./socket"),e.exports.parser=s("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(s,e){(function(t){function n(a,f){if(!(this instanceof n))return new n(a,f);if(f=f||{},a&&typeof a=="object"&&(f=a,a=null),a&&(a=p(a),f.host=a.host,f.secure=a.protocol=="https"||a.protocol=="wss",f.port=a.port,a.query&&(f.query=a.query)),this.secure=f.secure!=null?f.secure:t.location&&location.protocol=="https:",f.host){var g=f.host.split(":");f.hostname=g.shift(),g.length?f.port=g.pop():f.port||(f.port=this.secure?"443":"80")}this.agent=f.agent||!1,this.hostname=f.hostname||(t.location?location.hostname:"localhost"),this.port=f.port||(t.location&&location.port?location.port:this.secure?443:80),this.query=f.query||{},typeof this.query=="string"&&(this.query=i.decode(this.query)),this.upgrade=f.upgrade!==!1,this.path=(f.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!f.forceJSONP,this.jsonp=f.jsonp!==!1,this.forceBase64=!!f.forceBase64,this.enablesXDR=!!f.enablesXDR,this.timestampParam=f.timestampParam||"t",this.timestampRequests=f.timestampRequests,this.transports=f.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=f.policyPort||843,this.rememberUpgrade=f.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=f.onlyBinaryUpgrades,this.pfx=f.pfx||null,this.key=f.key||null,this.passphrase=f.passphrase||null,this.cert=f.cert||null,this.ca=f.ca||null,this.ciphers=f.ciphers||null,this.rejectUnauthorized=f.rejectUnauthorized||null,this.open()}function r(a){var f={};for(var g in a)a.hasOwnProperty(g)&&(f[g]=a[g]);return f}var o=s("./transports"),u=s("component-emitter"),h=s("debug")("engine.io-client:socket"),d=s("indexof"),c=s("engine.io-parser"),p=s("parseuri"),l=s("parsejson"),i=s("parseqs");e.exports=n,n.priorWebsocketSuccess=!1,u(n.prototype),n.protocol=c.protocol,n.Socket=n,n.Transport=s("./transport"),n.transports=s("./transports"),n.parser=s("engine.io-parser"),n.prototype.createTransport=function(a){h('creating transport "%s"',a);var f=r(this.query);f.EIO=c.protocol,f.transport=a,this.id&&(f.sid=this.id);var g=new o[a]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:f,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 g},n.prototype.open=function(){var f;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1)f="websocket";else{if(this.transports.length==0){var a=this;return void setTimeout(function(){a.emit("error","No transports available")},0)}f=this.transports[0]}this.readyState="opening";var f;try{f=this.createTransport(f)}catch{return this.transports.shift(),void this.open()}f.open(),this.setTransport(f)},n.prototype.setTransport=function(a){h("setting transport %s",a.name);var f=this;this.transport&&(h("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=a,a.on("drain",function(){f.onDrain()}).on("packet",function(g){f.onPacket(g)}).on("error",function(g){f.onError(g)}).on("close",function(){f.onClose("transport close")})},n.prototype.probe=function(a){function f(){if(T.onlyBinaryUpgrades){var A=!this.supportsBinary&&T.transport.supportsBinary;S=S||A}S||(h('probe transport "%s" opened',a),L.send([{type:"ping",data:"probe"}]),L.once("packet",function(m){if(!S)if(m.type=="pong"&&m.data=="probe"){if(h('probe transport "%s" pong',a),T.upgrading=!0,T.emit("upgrading",L),!L)return;n.priorWebsocketSuccess=L.name=="websocket",h('pausing current transport "%s"',T.transport.name),T.transport.pause(function(){S||T.readyState!="closed"&&(h("changing transport and sending upgrade packet"),F(),T.setTransport(L),L.send([{type:"upgrade"}]),T.emit("upgrade",L),L=null,T.upgrading=!1,T.flush())})}else{h('probe transport "%s" failed',a);var v=new Error("probe error");v.transport=L.name,T.emit("upgradeError",v)}}))}function g(){S||(S=!0,F(),L.close(),L=null)}function y(A){var m=new Error("probe error: "+A);m.transport=L.name,g(),h('probe transport "%s" failed because of error: %s',a,A),T.emit("upgradeError",m)}function E(){y("transport closed")}function j(){y("socket closed")}function U(A){L&&A.name!=L.name&&(h('"%s" works - aborting "%s"',A.name,L.name),g())}function F(){L.removeListener("open",f),L.removeListener("error",y),L.removeListener("close",E),T.removeListener("close",j),T.removeListener("upgrading",U)}h('probing transport "%s"',a);var L=this.createTransport(a,{probe:1}),S=!1,T=this;n.priorWebsocketSuccess=!1,L.once("open",f),L.once("error",y),L.once("close",E),this.once("close",j),this.once("upgrading",U),L.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 a=0,f=this.upgrades.length;f>a;a++)this.probe(this.upgrades[a])}},n.prototype.onPacket=function(a){if(this.readyState=="opening"||this.readyState=="open")switch(h('socket receive: type "%s", data "%s"',a.type,a.data),this.emit("packet",a),this.emit("heartbeat"),a.type){case"open":this.onHandshake(l(a.data));break;case"pong":this.setPing();break;case"error":var f=new Error("server error");f.code=a.data,this.emit("error",f);break;case"message":this.emit("data",a.data),this.emit("message",a.data)}else h('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(a){this.emit("handshake",a),this.id=a.sid,this.transport.query.sid=a.sid,this.upgrades=this.filterUpgrades(a.upgrades),this.pingInterval=a.pingInterval,this.pingTimeout=a.pingTimeout,this.onOpen(),this.readyState!="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(a){clearTimeout(this.pingTimeoutTimer);var f=this;f.pingTimeoutTimer=setTimeout(function(){f.readyState!="closed"&&f.onClose("ping timeout")},a||f.pingInterval+f.pingTimeout)},n.prototype.setPing=function(){var a=this;clearTimeout(a.pingIntervalTimer),a.pingIntervalTimer=setTimeout(function(){h("writing ping packet - expecting pong within %sms",a.pingTimeout),a.ping(),a.onHeartbeat(a.pingTimeout)},a.pingInterval)},n.prototype.ping=function(){this.sendPacket("ping")},n.prototype.onDrain=function(){for(var a=0;a<this.prevBufferLen;a++)this.callbackBuffer[a]&&this.callbackBuffer[a]();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(a,f){return this.sendPacket("message",a,f),this},n.prototype.sendPacket=function(a,f,g){if(this.readyState!="closing"&&this.readyState!="closed"){var y={type:a,data:f};this.emit("packetCreate",y),this.writeBuffer.push(y),this.callbackBuffer.push(g),this.flush()}},n.prototype.close=function(){function a(){y.onClose("forced close"),h("socket closing - telling transport to close"),y.transport.close()}function f(){y.removeListener("upgrade",f),y.removeListener("upgradeError",f),a()}function g(){y.once("upgrade",f),y.once("upgradeError",f)}if(this.readyState=="opening"||this.readyState=="open"){this.readyState="closing";var y=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?g():a()}):this.upgrading?g():a()}return this},n.prototype.onError=function(a){h("socket error %j",a),n.priorWebsocketSuccess=!1,this.emit("error",a),this.onClose("transport error",a)},n.prototype.onClose=function(a,f){if(this.readyState=="opening"||this.readyState=="open"||this.readyState=="closing"){h('socket close with reason: "%s"',a);var g=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),setTimeout(function(){g.writeBuffer=[],g.callbackBuffer=[],g.prevBufferLen=0},0),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",a,f)}},n.prototype.filterUpgrades=function(a){for(var f=[],g=0,y=a.length;y>g;g++)~d(this.transports,a[g])&&f.push(a[g]);return f}}).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(s,e){function t(o){this.path=o.path,this.hostname=o.hostname,this.port=o.port,this.secure=o.secure,this.query=o.query,this.timestampParam=o.timestampParam,this.timestampRequests=o.timestampRequests,this.readyState="",this.agent=o.agent||!1,this.socket=o.socket,this.enablesXDR=o.enablesXDR,this.pfx=o.pfx,this.key=o.key,this.passphrase=o.passphrase,this.cert=o.cert,this.ca=o.ca,this.ciphers=o.ciphers,this.rejectUnauthorized=o.rejectUnauthorized}var n=s("engine.io-parser"),r=s("component-emitter");e.exports=t,r(t.prototype),t.timestamps=0,t.prototype.onError=function(o,u){var h=new Error(o);return h.type="TransportError",h.description=u,this.emit("error",h),this},t.prototype.open=function(){return(this.readyState=="closed"||this.readyState=="")&&(this.readyState="opening",this.doOpen()),this},t.prototype.close=function(){return(this.readyState=="opening"||this.readyState=="open")&&(this.doClose(),this.onClose()),this},t.prototype.send=function(o){if(this.readyState!="open")throw new Error("Transport not open");this.write(o)},t.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},t.prototype.onData=function(o){var u=n.decodePacket(o,this.socket.binaryType);this.onPacket(u)},t.prototype.onPacket=function(o){this.emit("packet",o)},t.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(s,e,t){(function(n){function r(c){var p,l=!1,i=!1,a=c.jsonp!==!1;if(n.location){var f=location.protocol=="https:",g=location.port;g||(g=f?443:80),l=c.hostname!=location.hostname||g!=c.port,i=c.secure!=f}if(c.xdomain=l,c.xscheme=i,p=new o(c),"open"in p&&!c.forceJSONP)return new u(c);if(!a)throw new Error("JSONP disabled");return new h(c)}var o=s("xmlhttprequest"),u=s("./polling-xhr"),h=s("./polling-jsonp"),d=s("./websocket");t.polling=r,t.websocket=d}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(s,e){(function(t){function n(){}function r(p){o.call(this,p),this.query=this.query||{},h||(t.___eio||(t.___eio=[]),h=t.___eio),this.index=h.length;var l=this;h.push(function(i){l.onData(i)}),this.query.j=this.index,t.document&&t.addEventListener&&t.addEventListener("beforeunload",function(){l.script&&(l.script.onerror=n)},!1)}var o=s("./polling"),u=s("component-inherit");e.exports=r;var h,d=/\n/g,c=/\\n/g;u(r,o),r.prototype.supportsBinary=!1,r.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),o.prototype.doClose.call(this)},r.prototype.doPoll=function(){var p=this,l=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),l.async=!0,l.src=this.uri(),l.onerror=function(f){p.onError("jsonp poll error",f)};var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(l,i),this.script=l;var a=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);a&&setTimeout(function(){var f=document.createElement("iframe");document.body.appendChild(f),document.body.removeChild(f)},100)},r.prototype.doWrite=function(p,l){function i(){a(),l()}function a(){if(f.iframe)try{f.form.removeChild(f.iframe)}catch(F){f.onError("jsonp polling iframe removal error",F)}try{var U='<iframe src="javascript:0" name="'+f.iframeId+'">';g=document.createElement(U)}catch{g=document.createElement("iframe"),g.name=f.iframeId,g.src="javascript:0"}g.id=f.iframeId,f.form.appendChild(g),f.iframe=g}var f=this;if(!this.form){var g,y=document.createElement("form"),E=document.createElement("textarea"),j=this.iframeId="eio_iframe_"+this.index;y.className="socketio",y.style.position="absolute",y.style.top="-1000px",y.style.left="-1000px",y.target=j,y.method="POST",y.setAttribute("accept-charset","utf-8"),E.name="d",y.appendChild(E),document.body.appendChild(y),this.form=y,this.area=E}this.form.action=this.uri(),a(),p=p.replace(c,`\\
7
+ `),this.area.value=p.replace(d,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){f.iframe.readyState=="complete"&&i()}:this.iframe.onload=i}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-inherit":21}],17:[function(s,e){(function(t){function n(){}function r(i){if(d.call(this,i),t.location){var a=location.protocol=="https:",f=location.port;f||(f=a?443:80),this.xd=i.hostname!=t.location.hostname||f!=i.port,this.xs=i.secure!=a}}function o(i){this.method=i.method||"GET",this.uri=i.uri,this.xd=!!i.xd,this.xs=!!i.xs,this.async=i.async!==!1,this.data=i.data!=null?i.data:null,this.agent=i.agent,this.isBinary=i.isBinary,this.supportsBinary=i.supportsBinary,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,this.create()}function u(){for(var i in o.requests)o.requests.hasOwnProperty(i)&&o.requests[i].abort()}var h=s("xmlhttprequest"),d=s("./polling"),c=s("component-emitter"),p=s("component-inherit"),l=s("debug")("engine.io-client:polling-xhr");e.exports=r,e.exports.Request=o,p(r,d),r.prototype.supportsBinary=!0,r.prototype.request=function(i){return i=i||{},i.uri=this.uri(),i.xd=this.xd,i.xs=this.xs,i.agent=this.agent||!1,i.supportsBinary=this.supportsBinary,i.enablesXDR=this.enablesXDR,i.pfx=this.pfx,i.key=this.key,i.passphrase=this.passphrase,i.cert=this.cert,i.ca=this.ca,i.ciphers=this.ciphers,i.rejectUnauthorized=this.rejectUnauthorized,new o(i)},r.prototype.doWrite=function(i,a){var f=typeof i!="string"&&i!==void 0,g=this.request({method:"POST",data:i,isBinary:f}),y=this;g.on("success",a),g.on("error",function(E){y.onError("xhr post error",E)}),this.sendXhr=g},r.prototype.doPoll=function(){l("xhr poll");var i=this.request(),a=this;i.on("data",function(f){a.onData(f)}),i.on("error",function(f){a.onError("xhr poll error",f)}),this.pollXhr=i},c(o.prototype),o.prototype.create=function(){var i={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};i.pfx=this.pfx,i.key=this.key,i.passphrase=this.passphrase,i.cert=this.cert,i.ca=this.ca,i.ciphers=this.ciphers,i.rejectUnauthorized=this.rejectUnauthorized;var a=this.xhr=new h(i),f=this;try{if(l("xhr open %s: %s",this.method,this.uri),a.open(this.method,this.uri,this.async),this.supportsBinary&&(a.responseType="arraybuffer"),this.method=="POST")try{this.isBinary?a.setRequestHeader("Content-type","application/octet-stream"):a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}"withCredentials"in a&&(a.withCredentials=!0),this.hasXDR()?(a.onload=function(){f.onLoad()},a.onerror=function(){f.onError(a.responseText)}):a.onreadystatechange=function(){a.readyState==4&&(a.status==200||a.status==1223?f.onLoad():setTimeout(function(){f.onError(a.status)},0))},l("xhr data %s",this.data),a.send(this.data)}catch(g){return void setTimeout(function(){f.onError(g)},0)}t.document&&(this.index=o.requestsCount++,o.requests[this.index]=this)},o.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},o.prototype.onData=function(i){this.emit("data",i),this.onSuccess()},o.prototype.onError=function(i){this.emit("error",i),this.cleanup(!0)},o.prototype.cleanup=function(i){if(typeof this.xhr<"u"&&this.xhr!==null){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,i)try{this.xhr.abort()}catch{}t.document&&delete o.requests[this.index],this.xhr=null}},o.prototype.onLoad=function(){var i;try{var a;try{a=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch{}i=a==="application/octet-stream"?this.xhr.response:this.supportsBinary?"ok":this.xhr.responseText}catch(f){this.onError(f)}i!=null&&this.onData(i)},o.prototype.hasXDR=function(){return typeof t.XDomainRequest<"u"&&!this.xs&&this.enablesXDR},o.prototype.abort=function(){this.cleanup()},t.document&&(o.requestsCount=0,o.requests={},t.attachEvent?t.attachEvent("onunload",u):t.addEventListener&&t.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(s,e){function t(c){var p=c&&c.forceBase64;(!d||p)&&(this.supportsBinary=!1),n.call(this,c)}var n=s("../transport"),r=s("parseqs"),o=s("engine.io-parser"),u=s("component-inherit"),h=s("debug")("engine.io-client:polling");e.exports=t;var d=function(){var c=s("xmlhttprequest"),p=new c({xdomain:!1});return p.responseType!=null}();u(t,n),t.prototype.name="polling",t.prototype.doOpen=function(){this.poll()},t.prototype.pause=function(c){function p(){h("paused"),l.readyState="paused",c()}var l=this;if(this.readyState="pausing",this.polling||!this.writable){var i=0;this.polling&&(h("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){h("pre-pause polling complete"),--i||p()})),this.writable||(h("we are currently writing - waiting to pause"),i++,this.once("drain",function(){h("pre-pause writing complete"),--i||p()}))}else p()},t.prototype.poll=function(){h("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},t.prototype.onData=function(c){var p=this;h("polling got data %s",c);var l=function(i){return p.readyState=="opening"&&p.onOpen(),i.type=="close"?(p.onClose(),!1):void p.onPacket(i)};o.decodePayload(c,this.socket.binaryType,l),this.readyState!="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState=="open"?this.poll():h('ignoring poll - transport state "%s"',this.readyState))},t.prototype.doClose=function(){function c(){h("writing close packet"),p.write([{type:"close"}])}var p=this;this.readyState=="open"?(h("transport open - closing"),c()):(h("transport not open - deferring close"),this.once("open",c))},t.prototype.write=function(c){var l=this;this.writable=!1;var p=function(){l.writable=!0,l.emit("drain")},l=this;o.encodePayload(c,this.supportsBinary,function(i){l.doWrite(i,p)})},t.prototype.uri=function(){var c=this.query||{},p=this.secure?"https":"http",l="";return this.timestampRequests!==!1&&(c[this.timestampParam]=+new Date+"-"+n.timestamps++),this.supportsBinary||c.sid||(c.b64=1),c=r.encode(c),this.port&&(p=="https"&&this.port!=443||p=="http"&&this.port!=80)&&(l=":"+this.port),c.length&&(c="?"+c),p+"://"+this.hostname+l+this.path+c}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,xmlhttprequest:20}],19:[function(s,e){function t(c){var p=c&&c.forceBase64;p&&(this.supportsBinary=!1),n.call(this,c)}var n=s("../transport"),r=s("engine.io-parser"),o=s("parseqs"),u=s("component-inherit"),h=s("debug")("engine.io-client:websocket"),d=s("ws");e.exports=t,u(t,n),t.prototype.name="websocket",t.prototype.supportsBinary=!0,t.prototype.doOpen=function(){if(this.check()){var c=this.uri(),p=void 0,l={agent:this.agent};l.pfx=this.pfx,l.key=this.key,l.passphrase=this.passphrase,l.cert=this.cert,l.ca=this.ca,l.ciphers=this.ciphers,l.rejectUnauthorized=this.rejectUnauthorized,this.ws=new d(c,p,l),this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.binaryType="arraybuffer",this.addEventListeners()}},t.prototype.addEventListeners=function(){var c=this;this.ws.onopen=function(){c.onOpen()},this.ws.onclose=function(){c.onClose()},this.ws.onmessage=function(p){c.onData(p.data)},this.ws.onerror=function(p){c.onError("websocket error",p)}},typeof navigator<"u"&&/iPad|iPhone|iPod/i.test(navigator.userAgent)&&(t.prototype.onData=function(c){var p=this;setTimeout(function(){n.prototype.onData.call(p,c)},0)}),t.prototype.write=function(c){function p(){l.writable=!0,l.emit("drain")}var l=this;this.writable=!1;for(var i=0,a=c.length;a>i;i++)r.encodePacket(c[i],this.supportsBinary,function(f){try{l.ws.send(f)}catch{h("websocket closed before onclose event")}});setTimeout(p,0)},t.prototype.onClose=function(){n.prototype.onClose.call(this)},t.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()},t.prototype.uri=function(){var c=this.query||{},p=this.secure?"wss":"ws",l="";return this.port&&(p=="wss"&&this.port!=443||p=="ws"&&this.port!=80)&&(l=":"+this.port),this.timestampRequests&&(c[this.timestampParam]=+new Date),this.supportsBinary||(c.b64=1),c=o.encode(c),c.length&&(c="?"+c),p+"://"+this.hostname+l+this.path+c},t.prototype.check=function(){return!(!d||"__initialize"in d&&this.name===t.prototype.name)}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,ws:35}],20:[function(s,e){var t=s("has-cors");e.exports=function(n){var r=n.xdomain,o=n.xscheme,u=n.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!r||t))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!o&&u)return new XDomainRequest}catch{}if(!r)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{}}},{"has-cors":38}],21:[function(s,e){e.exports=function(t,n){var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],22:[function(s,e,t){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 r(){var d=arguments,c=this.useColors;if(d[0]=(c?"%c":"")+this.namespace+(c?" %c":" ")+d[0]+(c?"%c ":" ")+"+"+t.humanize(this.diff),!c)return d;var p="color: "+this.color;d=[d[0],p,"color: inherit"].concat(Array.prototype.slice.call(d,1));var l=0,i=0;return d[0].replace(/%[a-z%]/g,function(a){a!=="%%"&&(l++,a==="%c"&&(i=l))}),d.splice(i,0,p),d}function o(){return typeof console=="object"&&typeof console.log=="function"&&Function.prototype.apply.call(console.log,console,arguments)}function u(d){try{d==null?localStorage.removeItem("debug"):localStorage.debug=d}catch{}}function h(){var d;try{d=localStorage.debug}catch{}return d}t=e.exports=s("./debug"),t.log=o,t.formatArgs=r,t.save=u,t.load=h,t.useColors=n,t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(d){return JSON.stringify(d)},t.enable(h())},{"./debug":23}],23:[function(s,e,t){function n(){return t.colors[p++%t.colors.length]}function r(l){function i(){}function a(){var g=a,y=+new Date,E=y-(c||y);g.diff=E,g.prev=c,g.curr=y,c=y,g.useColors==null&&(g.useColors=t.useColors()),g.color==null&&g.useColors&&(g.color=n());var j=Array.prototype.slice.call(arguments);j[0]=t.coerce(j[0]),typeof j[0]!="string"&&(j=["%o"].concat(j));var U=0;j[0]=j[0].replace(/%([a-z%])/g,function(L,S){if(L==="%%")return L;U++;var T=t.formatters[S];if(typeof T=="function"){var A=j[U];L=T.call(g,A),j.splice(U,1),U--}return L}),typeof t.formatArgs=="function"&&(j=t.formatArgs.apply(g,j));var F=a.log||t.log||console.log.bind(console);F.apply(g,j)}i.enabled=!1,a.enabled=!0;var f=t.enabled(l)?a:i;return f.namespace=l,f}function o(l){t.save(l);for(var i=(l||"").split(/[\s,]+/),a=i.length,f=0;a>f;f++)i[f]&&(l=i[f].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.substr(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function u(){t.enable("")}function h(l){var i,a;for(i=0,a=t.skips.length;a>i;i++)if(t.skips[i].test(l))return!1;for(i=0,a=t.names.length;a>i;i++)if(t.names[i].test(l))return!0;return!1}function d(l){return l instanceof Error?l.stack||l.message:l}t=e.exports=r,t.coerce=d,t.disable=u,t.enable=o,t.enabled=h,t.humanize=s("ms"),t.names=[],t.skips=[],t.formatters={};var c,p=0},{ms:24}],24:[function(s,e){function t(l){var i=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(l);if(i){var a=parseFloat(i[1]),f=(i[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"y":return a*p;case"days":case"day":case"d":return a*c;case"hours":case"hour":case"h":return a*d;case"minutes":case"minute":case"m":return a*h;case"seconds":case"second":case"s":return a*u;case"ms":return a}}}function n(l){return l>=c?Math.round(l/c)+"d":l>=d?Math.round(l/d)+"h":l>=h?Math.round(l/h)+"m":l>=u?Math.round(l/u)+"s":l+"ms"}function r(l){return o(l,c,"day")||o(l,d,"hour")||o(l,h,"minute")||o(l,u,"second")||l+" ms"}function o(l,i,a){return i>l?void 0:1.5*i>l?Math.floor(l/i)+" "+a:Math.ceil(l/i)+" "+a+"s"}var u=1e3,h=60*u,d=60*h,c=24*d,p=365.25*c;e.exports=function(l,i){return i=i||{},typeof l=="string"?t(l):i.long?r(l):n(l)}},{}],25:[function(s,e,t){(function(n){function r(S,T){var A="b"+t.packets[S.type]+S.data.data;return T(A)}function o(S,T,A){if(!T)return t.encodeBase64Packet(S,A);var m=S.data,v=new Uint8Array(m),_=new Uint8Array(1+m.byteLength);_[0]=j[S.type];for(var I=0;I<v.length;I++)_[I+1]=v[I];return A(_.buffer)}function u(S,T,A){if(!T)return t.encodeBase64Packet(S,A);var m=new FileReader;return m.onload=function(){S.data=m.result,t.encodePacket(S,T,!0,A)},m.readAsArrayBuffer(S.data)}function h(S,T,A){if(!T)return t.encodeBase64Packet(S,A);if(E)return u(S,T,A);var m=new Uint8Array(1);m[0]=j[S.type];var v=new L([m.buffer,S.data]);return A(v)}function d(S,T,A){for(var m=new Array(S.length),v=a(S.length,A),_=function(R,k,W){T(k,function(G,H){m[R]=H,W(G,m)})},I=0;I<S.length;I++)_(I,S[I],v)}var c=s("./keys"),p=s("has-binary"),l=s("arraybuffer.slice"),i=s("base64-arraybuffer"),a=s("after"),f=s("utf8"),g=navigator.userAgent.match(/Android/i),y=/PhantomJS/i.test(navigator.userAgent),E=g||y;t.protocol=3;var j=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},U=c(j),F={type:"error",data:"parser error"},L=s("blob");t.encodePacket=function(S,T,A,m){typeof T=="function"&&(m=T,T=!1),typeof A=="function"&&(m=A,A=null);var v=S.data===void 0?void 0:S.data.buffer||S.data;if(n.ArrayBuffer&&v instanceof ArrayBuffer)return o(S,T,m);if(L&&v instanceof n.Blob)return h(S,T,m);if(v&&v.base64)return r(S,m);var _=j[S.type];return S.data!==void 0&&(_+=A?f.encode(String(S.data)):String(S.data)),m(""+_)},t.encodeBase64Packet=function(S,T){var A="b"+t.packets[S.type];if(L&&S.data instanceof L){var m=new FileReader;return m.onload=function(){var k=m.result.split(",")[1];T(A+k)},m.readAsDataURL(S.data)}var v;try{v=String.fromCharCode.apply(null,new Uint8Array(S.data))}catch{for(var _=new Uint8Array(S.data),I=new Array(_.length),R=0;R<_.length;R++)I[R]=_[R];v=String.fromCharCode.apply(null,I)}return A+=n.btoa(v),T(A)},t.decodePacket=function(S,T,A){if(typeof S=="string"||S===void 0){if(S.charAt(0)=="b")return t.decodeBase64Packet(S.substr(1),T);if(A)try{S=f.decode(S)}catch{return F}var v=S.charAt(0);return Number(v)==v&&U[v]?S.length>1?{type:U[v],data:S.substring(1)}:{type:U[v]}:F}var m=new Uint8Array(S),v=m[0],_=l(S,1);return L&&T==="blob"&&(_=new L([_])),{type:U[v],data:_}},t.decodeBase64Packet=function(S,T){var A=U[S.charAt(0)];if(!n.ArrayBuffer)return{type:A,data:{base64:!0,data:S.substr(1)}};var m=i.decode(S.substr(1));return T==="blob"&&L&&(m=new L([m])),{type:A,data:m}},t.encodePayload=function(S,T,A){function m(I){return I.length+":"+I}function v(I,R){t.encodePacket(I,_?T:!1,!0,function(k){R(null,m(k))})}typeof T=="function"&&(A=T,T=null);var _=p(S);return T&&_?L&&!E?t.encodePayloadAsBlob(S,A):t.encodePayloadAsArrayBuffer(S,A):S.length?void d(S,v,function(I,R){return A(R.join(""))}):A("0:")},t.decodePayload=function(S,T,A){if(typeof S!="string")return t.decodePayloadAsBinary(S,T,A);typeof T=="function"&&(A=T,T=null);var m;if(S=="")return A(F,0,1);for(var v,_,I="",R=0,k=S.length;k>R;R++){var W=S.charAt(R);if(W!=":")I+=W;else{if(I==""||I!=(v=Number(I))||(_=S.substr(R+1,v),I!=_.length))return A(F,0,1);if(_.length){if(m=t.decodePacket(_,T,!0),F.type==m.type&&F.data==m.data)return A(F,0,1);var G=A(m,R+v,k);if(G===!1)return}R+=v,I=""}}return I!=""?A(F,0,1):void 0},t.encodePayloadAsArrayBuffer=function(S,T){function A(m,v){t.encodePacket(m,!0,!0,function(_){return v(null,_)})}return S.length?void d(S,A,function(m,v){var _=v.reduce(function(k,W){var G;return G=typeof W=="string"?W.length:W.byteLength,k+G.toString().length+G+2},0),I=new Uint8Array(_),R=0;return v.forEach(function(k){var W=typeof k=="string",G=k;if(W){for(var H=new Uint8Array(k.length),M=0;M<k.length;M++)H[M]=k.charCodeAt(M);G=H.buffer}I[R++]=W?0:1;for(var Y=G.byteLength.toString(),M=0;M<Y.length;M++)I[R++]=parseInt(Y[M]);I[R++]=255;for(var H=new Uint8Array(G),M=0;M<H.length;M++)I[R++]=H[M]}),T(I.buffer)}):T(new ArrayBuffer(0))},t.encodePayloadAsBlob=function(S,T){function A(m,v){t.encodePacket(m,!0,!0,function(_){var I=new Uint8Array(1);if(I[0]=1,typeof _=="string"){for(var R=new Uint8Array(_.length),k=0;k<_.length;k++)R[k]=_.charCodeAt(k);_=R.buffer,I[0]=0}for(var W=_ instanceof ArrayBuffer?_.byteLength:_.size,G=W.toString(),H=new Uint8Array(G.length+1),k=0;k<G.length;k++)H[k]=parseInt(G[k]);if(H[G.length]=255,L){var M=new L([I.buffer,H.buffer,_]);v(null,M)}})}d(S,A,function(m,v){return T(new L(v))})},t.decodePayloadAsBinary=function(S,T,A){typeof T=="function"&&(A=T,T=null);for(var m=S,v=[],_=!1;m.byteLength>0;){for(var I=new Uint8Array(m),R=I[0]===0,k="",W=1;I[W]!=255;W++){if(k.length>310){_=!0;break}k+=I[W]}if(_)return A(F,0,1);m=l(m,2+k.length),k=parseInt(k);var G=l(m,0,k);if(R)try{G=String.fromCharCode.apply(null,new Uint8Array(G))}catch{var H=new Uint8Array(G);G="";for(var W=0;W<H.length;W++)G+=String.fromCharCode(H[W])}v.push(G),m=l(m,k)}var M=v.length;v.forEach(function(Y,gt){A(t.decodePacket(Y,T,!0),gt,M)})}}).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(s,e){e.exports=Object.keys||function(t){var n=[],r=Object.prototype.hasOwnProperty;for(var o in t)r.call(t,o)&&n.push(o);return n}},{}],27:[function(s,e){function t(r,o,u){function h(c,p){if(h.count<=0)throw new Error("after called too many times");--h.count,c?(d=!0,o(c),o=u):h.count!==0||d||o(null,p)}var d=!1;return u=u||n,h.count=r,r===0?o():h}function n(){}e.exports=t},{}],28:[function(s,e){e.exports=function(t,n,r){var o=t.byteLength;if(n=n||0,r=r||o,t.slice)return t.slice(n,r);if(0>n&&(n+=o),0>r&&(r+=o),r>o&&(r=o),n>=o||n>=r||o===0)return new ArrayBuffer(0);for(var u=new Uint8Array(t),h=new Uint8Array(r-n),d=n,c=0;r>d;d++,c++)h[c]=u[d];return h.buffer}},{}],29:[function(s,e,t){(function(n){t.encode=function(r){var o,u=new Uint8Array(r),h=u.length,d="";for(o=0;h>o;o+=3)d+=n[u[o]>>2],d+=n[(3&u[o])<<4|u[o+1]>>4],d+=n[(15&u[o+1])<<2|u[o+2]>>6],d+=n[63&u[o+2]];return h%3===2?d=d.substring(0,d.length-1)+"=":h%3===1&&(d=d.substring(0,d.length-2)+"=="),d},t.decode=function(r){var o,u,h,d,c,p=.75*r.length,l=r.length,i=0;r[r.length-1]==="="&&(p--,r[r.length-2]==="="&&p--);var a=new ArrayBuffer(p),f=new Uint8Array(a);for(o=0;l>o;o+=4)u=n.indexOf(r[o]),h=n.indexOf(r[o+1]),d=n.indexOf(r[o+2]),c=n.indexOf(r[o+3]),f[i++]=u<<2|h>>4,f[i++]=(15&h)<<4|d>>2,f[i++]=(3&d)<<6|63&c;return a}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],30:[function(s,e){(function(t){function n(p){for(var l=0;l<p.length;l++){var i=p[l];if(i.buffer instanceof ArrayBuffer){var a=i.buffer;if(i.byteLength!==a.byteLength){var f=new Uint8Array(i.byteLength);f.set(new Uint8Array(a,i.byteOffset,i.byteLength)),a=f.buffer}p[l]=a}}}function r(p,l){l=l||{};var i=new u;n(p);for(var a=0;a<p.length;a++)i.append(p[a]);return l.type?i.getBlob(l.type):i.getBlob()}function o(p,l){return n(p),new Blob(p,l||{})}var u=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,h=function(){try{var p=new Blob(["hi"]);return p.size===2}catch{return!1}}(),d=h&&function(){try{var p=new Blob([new Uint8Array([1,2])]);return p.size===2}catch{return!1}}(),c=u&&u.prototype.append&&u.prototype.getBlob;e.exports=function(){return h?d?t.Blob:o:c?r:void 0}()}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],31:[function(s,e,t){(function(n){(function(r){function o(m){for(var v,_,I=[],R=0,k=m.length;k>R;)v=m.charCodeAt(R++),v>=55296&&56319>=v&&k>R?(_=m.charCodeAt(R++),(64512&_)==56320?I.push(((1023&v)<<10)+(1023&_)+65536):(I.push(v),R--)):I.push(v);return I}function u(m){for(var v,_=m.length,I=-1,R="";++I<_;)v=m[I],v>65535&&(v-=65536,R+=F(v>>>10&1023|55296),v=56320|1023&v),R+=F(v);return R}function h(m){if(m>=55296&&57343>=m)throw Error("Lone surrogate U+"+m.toString(16).toUpperCase()+" is not a scalar value")}function d(m,v){return F(m>>v&63|128)}function c(m){if(!(4294967168&m))return F(m);var v="";return 4294965248&m?4294901760&m?!(4292870144&m)&&(v=F(m>>18&7|240),v+=d(m,12),v+=d(m,6)):(h(m),v=F(m>>12&15|224),v+=d(m,6)):v=F(m>>6&31|192),v+=F(63&m|128)}function p(m){for(var v,_=o(m),I=_.length,R=-1,k="";++R<I;)v=_[R],k+=c(v);return k}function l(){if(U>=j)throw Error("Invalid byte index");var m=255&E[U];if(U++,(192&m)==128)return 63&m;throw Error("Invalid continuation byte")}function i(){var m,v,_,I,R;if(U>j)throw Error("Invalid byte index");if(U==j)return!1;if(m=255&E[U],U++,(128&m)==0)return m;if((224&m)==192){var v=l();if(R=(31&m)<<6|v,R>=128)return R;throw Error("Invalid continuation byte")}if((240&m)==224){if(v=l(),_=l(),R=(15&m)<<12|v<<6|_,R>=2048)return h(R),R;throw Error("Invalid continuation byte")}if((248&m)==240&&(v=l(),_=l(),I=l(),R=(15&m)<<18|v<<12|_<<6|I,R>=65536&&1114111>=R))return R;throw Error("Invalid UTF-8 detected")}function a(m){E=o(m),j=E.length,U=0;for(var v,_=[];(v=i())!==!1;)_.push(v);return u(_)}var f=typeof t=="object"&&t,g=typeof e=="object"&&e&&e.exports==f&&e,y=typeof n=="object"&&n;(y.global===y||y.window===y)&&(r=y);var E,j,U,F=String.fromCharCode,L={version:"2.0.0",encode:p,decode:a};if(f&&!f.nodeType)if(g)g.exports=L;else{var S={},T=S.hasOwnProperty;for(var A in L)T.call(L,A)&&(f[A]=L[A])}else r.utf8=L})(this)}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],32:[function(s,e){(function(t){var n=/^[\],:{}\s]*$/,r=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,o=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,u=/(?:^|:|,)(?:\s*\[)+/g,h=/^\s+/,d=/\s+$/;e.exports=function(c){return typeof c=="string"&&c?(c=c.replace(h,"").replace(d,""),t.JSON&&JSON.parse?JSON.parse(c):n.test(c.replace(r,"@").replace(o,"]").replace(u,""))?new Function("return "+c)():void 0):null}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],33:[function(s,e,t){t.encode=function(n){var r="";for(var o in n)n.hasOwnProperty(o)&&(r.length&&(r+="&"),r+=encodeURIComponent(o)+"="+encodeURIComponent(n[o]));return r},t.decode=function(n){for(var r={},o=n.split("&"),u=0,h=o.length;h>u;u++){var d=o[u].split("=");r[decodeURIComponent(d[0])]=decodeURIComponent(d[1])}return r}},{}],34:[function(s,e){var t=/^(?:(?![^:@]+:[^:@\/]*@)(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(r){var o=r,u=r.indexOf("["),h=r.indexOf("]");u!=-1&&h!=-1&&(r=r.substring(0,u)+r.substring(u,h).replace(/:/g,";")+r.substring(h,r.length));for(var d=t.exec(r||""),c={},p=14;p--;)c[n[p]]=d[p]||"";return u!=-1&&h!=-1&&(c.source=o,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(s,e){function t(o,u){return u?new r(o,u):new r(o)}var n=function(){return self}(),r=n.WebSocket||n.MozWebSocket;e.exports=r?t:null,r&&(t.prototype=r.prototype)},{}],36:[function(s,e){(function(t){function n(o){function u(h){if(!h)return!1;if(t.Buffer&&t.Buffer.isBuffer(h)||t.ArrayBuffer&&h instanceof ArrayBuffer||t.Blob&&h instanceof Blob||t.File&&h instanceof File)return!0;if(r(h)){for(var d=0;d<h.length;d++)if(u(h[d]))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(o)}var r=s("isarray");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{isarray:37}],37:[function(s,e){e.exports=Array.isArray||function(t){return Object.prototype.toString.call(t)=="[object Array]"}},{}],38:[function(s,e){var t=s("global");try{e.exports="XMLHttpRequest"in t&&"withCredentials"in new t.XMLHttpRequest}catch{e.exports=!1}},{global:39}],39:[function(s,e){e.exports=function(){return this}()},{}],40:[function(s,e){var t=[].indexOf;e.exports=function(n,r){if(t)return n.indexOf(r);for(var o=0;o<n.length;++o)if(n[o]===r)return o;return-1}},{}],41:[function(s,e,t){var n=Object.prototype.hasOwnProperty;t.keys=Object.keys||function(r){var o=[];for(var u in r)n.call(r,u)&&o.push(u);return o},t.values=function(r){var o=[];for(var u in r)n.call(r,u)&&o.push(r[u]);return o},t.merge=function(r,o){for(var u in o)n.call(o,u)&&(r[u]=o[u]);return r},t.length=function(r){return t.keys(r).length},t.isEmpty=function(r){return t.length(r)==0}},{}],42:[function(s,e){var t=/^(?:(?![^:@]+:[^:@\/]*@)(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(r){for(var o=t.exec(r||""),u={},h=14;h--;)u[n[h]]=o[h]||"";return u}},{}],43:[function(s,e,t){(function(n){var r=s("isarray"),o=s("./is-buffer");t.deconstructPacket=function(u){function h(l){if(!l)return l;if(o(l)){var i={_placeholder:!0,num:d.length};return d.push(l),i}if(r(l)){for(var a=new Array(l.length),f=0;f<l.length;f++)a[f]=h(l[f]);return a}if(typeof l=="object"&&!(l instanceof Date)){var a={};for(var g in l)a[g]=h(l[g]);return a}return l}var d=[],c=u.data,p=u;return p.data=h(c),p.attachments=d.length,{packet:p,buffers:d}},t.reconstructPacket=function(u,h){function d(c){if(c&&c._placeholder){var p=h[c.num];return p}if(r(c)){for(var l=0;l<c.length;l++)c[l]=d(c[l]);return c}if(c&&typeof c=="object"){for(var i in c)c[i]=d(c[i]);return c}return c}return u.data=d(u.data),u.attachments=void 0,u},t.removeBlobs=function(u,h){function d(l,i,a){if(!l)return l;if(n.Blob&&l instanceof Blob||n.File&&l instanceof File){c++;var f=new FileReader;f.onload=function(){a?a[i]=this.result:p=this.result,--c||h(p)},f.readAsArrayBuffer(l)}else if(r(l))for(var g=0;g<l.length;g++)d(l[g],g,l);else if(l&&typeof l=="object"&&!o(l))for(var y in l)d(l[y],y,l)}var c=0,p=u;d(p),c||h(p)}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./is-buffer":45,isarray:46}],44:[function(s,e,t){function n(){}function r(g){var y="",E=!1;return y+=g.type,(t.BINARY_EVENT==g.type||t.BINARY_ACK==g.type)&&(y+=g.attachments,y+="-"),g.nsp&&g.nsp!="/"&&(E=!0,y+=g.nsp),g.id!=null&&(E&&(y+=",",E=!1),y+=g.id),g.data!=null&&(E&&(y+=","),y+=l.stringify(g.data)),p("encoded %j as %s",g,y),y}function o(g,y){function E(j){var U=a.deconstructPacket(j),F=r(U.packet),L=U.buffers;L.unshift(F),y(L)}a.removeBlobs(g,E)}function u(){this.reconstructor=null}function h(g){var y={},E=0;if(y.type=Number(g.charAt(0)),t.types[y.type]==null)return c();if(t.BINARY_EVENT==y.type||t.BINARY_ACK==y.type){for(var j="";g.charAt(++E)!="-"&&(j+=g.charAt(E),E!=g.length););if(j!=Number(j)||g.charAt(E)!="-")throw new Error("Illegal attachments");y.attachments=Number(j)}if(g.charAt(E+1)=="/")for(y.nsp="";++E;){var U=g.charAt(E);if(U==","||(y.nsp+=U,E==g.length))break}else y.nsp="/";var F=g.charAt(E+1);if(F!==""&&Number(F)==F){for(y.id="";++E;){var U=g.charAt(E);if(U==null||Number(U)!=U){--E;break}if(y.id+=g.charAt(E),E==g.length)break}y.id=Number(y.id)}if(g.charAt(++E))try{y.data=l.parse(g.substr(E))}catch{return c()}return p("decoded %s as %j",g,y),y}function d(g){this.reconPack=g,this.buffers=[]}function c(){return{type:t.ERROR,data:"parser error"}}var p=s("debug")("socket.io-parser"),l=s("json3"),i=(s("isarray"),s("component-emitter")),a=s("./binary"),f=s("./is-buffer");t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"],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=n,t.Decoder=u,n.prototype.encode=function(g,y){if(p("encoding packet %j",g),t.BINARY_EVENT==g.type||t.BINARY_ACK==g.type)o(g,y);else{var E=r(g);y([E])}},i(u.prototype),u.prototype.add=function(g){var y;if(typeof g=="string")y=h(g),t.BINARY_EVENT==y.type||t.BINARY_ACK==y.type?(this.reconstructor=new d(y),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",y)):this.emit("decoded",y);else{if(!f(g)&&!g.base64)throw new Error("Unknown type: "+g);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");y=this.reconstructor.takeBinaryData(g),y&&(this.reconstructor=null,this.emit("decoded",y))}},u.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},d.prototype.takeBinaryData=function(g){if(this.buffers.push(g),this.buffers.length==this.reconPack.attachments){var y=a.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),y}return null},d.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},{"./binary":43,"./is-buffer":45,"component-emitter":9,debug:10,isarray:46,json3:47}],45:[function(s,e){(function(t){function n(r){return t.Buffer&&t.Buffer.isBuffer(r)||t.ArrayBuffer&&r instanceof ArrayBuffer}e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],46:[function(s,e){e.exports=s(37)},{}],47:[function(s,e,t){(function(n){function r(w){if(r[w]!==h)return r[w];var O;if(w=="bug-string-char-index")O=!1;else if(w=="json")O=r("json-stringify")&&r("json-parse");else{var C,D='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(w=="json-stringify"){var b=p.stringify,x=typeof b=="function"&&l;if(x){(C=function(){return 1}).toJSON=C;try{x=b(0)==="0"&&b(new Number)==="0"&&b(new String)=='""'&&b(d)===h&&b(h)===h&&b()===h&&b(C)==="1"&&b([C])=="[1]"&&b([h])=="[null]"&&b(null)=="null"&&b([h,d,null])=="[null,null,null]"&&b({a:[C,!0,!1,null,`\0\b
8
+ \f\r `]})==D&&b(null,C)==="1"&&b([1,2],null,1)==`[
9
9
  1,
10
10
  2
11
- ]`&&S(new Date(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&S(new Date(864e13))=='"+275760-09-13T00:00:00.000Z"'&&S(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&S(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch{x=!1}}O=x}if(w=="json-parse"){var U=p.parse;if(typeof U=="function")try{if(U("0")===0&&!U(!1)){C=U(D);var N=C.a.length==5&&C.a[0]===1;if(N){try{N=!U('" "')}catch{}if(N)try{N=U("01")!==1}catch{}if(N)try{N=U("1.")!==1}catch{}}}}catch{N=!1}O=N}}return r[w]=!!O}var o,u,h,d={}.toString,c=typeof JSON=="object"&&JSON,p=typeof t=="object"&&t&&!t.nodeType&&t;p&&c?(p.stringify=c.stringify,p.parse=c.parse):p=n.JSON=c||{};var l=new Date(-0xc782b5b800cec);try{l=l.getUTCFullYear()==-109252&&l.getUTCMonth()===0&&l.getUTCDate()===1&&l.getUTCHours()==10&&l.getUTCMinutes()==37&&l.getUTCSeconds()==6&&l.getUTCMilliseconds()==708}catch{}if(!r("json")){var i="[object Function]",a="[object Date]",f="[object Number]",g="[object String]",y="[object Array]",E="[object Boolean]",j=r("bug-string-char-index");if(!l)var B=Math.floor,F=[0,31,59,90,120,151,181,212,243,273,304,334],L=function(w,O){return F[O]+365*(w-1970)+B((w-1969+(O=+(O>1)))/4)-B((w-1901+O)/100)+B((w-1601+O)/400)};(o={}.hasOwnProperty)||(o=function(w){var O,C={};return(C.__proto__=null,C.__proto__={toString:1},C).toString!=d?o=function(D){var S=this.__proto__,x=D in(this.__proto__=null,this);return this.__proto__=S,x}:(O=C.constructor,o=function(D){var S=(this.constructor||O).prototype;return D in this&&!(D in S&&this[D]===S[D])}),C=null,o.call(this,w)});var b={boolean:1,number:1,string:1,undefined:1},T=function(w,O){var C=typeof w[O];return C=="object"?!!w[O]:!b[C]};if(u=function(w,O){var C,D,S,x=0;(C=function(){this.valueOf=0}).prototype.valueOf=0,D=new C;for(S in D)o.call(D,S)&&x++;return C=D=null,x?u=x==2?function(U,N){var q,J={},tt=d.call(U)==i;for(q in U)tt&&q=="prototype"||o.call(J,q)||!(J[q]=1)||!o.call(U,q)||N(q)}:function(U,N){var q,J,tt=d.call(U)==i;for(q in U)tt&&q=="prototype"||!o.call(U,q)||(J=q==="constructor")||N(q);(J||o.call(U,q="constructor"))&&N(q)}:(D=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],u=function(U,N){var q,J,tt=d.call(U)==i,et=!tt&&typeof U.constructor!="function"&&T(U,"hasOwnProperty")?U.hasOwnProperty:o;for(q in U)tt&&q=="prototype"||!et.call(U,q)||N(q);for(J=D.length;q=D[--J];et.call(U,q)&&N(q));}),u(w,O)},!r("json-stringify")){var A={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},m="000000",v=function(w,O){return(m+(O||0)).slice(-w)},_="\\u00",I=function(w){var O,C='"',D=0,S=w.length,x=S>10&&j;for(x&&(O=w.split(""));S>D;D++){var U=w.charCodeAt(D);switch(U){case 8:case 9:case 10:case 12:case 13:case 34:case 92:C+=A[U];break;default:if(32>U){C+=_+v(2,U.toString(16));break}C+=x?O[D]:j?w.charAt(D):w[D]}}return C+'"'},R=function(w,O,C,D,S,x,U){var N,q,J,tt,et,yt,It,xt,Bt,Ut,lt,Dt,bt,mt,Pt,jt;try{N=O[w]}catch{}if(typeof N=="object"&&N)if(q=d.call(N),q!=a||o.call(N,"toJSON"))typeof N.toJSON=="function"&&(q!=f&&q!=g&&q!=y||o.call(N,"toJSON"))&&(N=N.toJSON(w));else if(N>-1/0&&1/0>N){if(L){for(et=B(N/864e5),J=B(et/365.2425)+1970-1;L(J+1,0)<=et;J++);for(tt=B((et-L(J,0))/30.42);L(J,tt+1)<=et;tt++);et=1+et-L(J,tt),yt=(N%864e5+864e5)%864e5,It=B(yt/36e5)%24,xt=B(yt/6e4)%60,Bt=B(yt/1e3)%60,Ut=yt%1e3}else J=N.getUTCFullYear(),tt=N.getUTCMonth(),et=N.getUTCDate(),It=N.getUTCHours(),xt=N.getUTCMinutes(),Bt=N.getUTCSeconds(),Ut=N.getUTCMilliseconds();N=(0>=J||J>=1e4?(0>J?"-":"+")+v(6,0>J?-J:J):v(4,J))+"-"+v(2,tt+1)+"-"+v(2,et)+"T"+v(2,It)+":"+v(2,xt)+":"+v(2,Bt)+"."+v(3,Ut)+"Z"}else N=null;if(C&&(N=C.call(O,w,N)),N===null)return"null";if(q=d.call(N),q==E)return""+N;if(q==f)return N>-1/0&&1/0>N?""+N:"null";if(q==g)return I(""+N);if(typeof N=="object"){for(mt=U.length;mt--;)if(U[mt]===N)throw TypeError();if(U.push(N),lt=[],Pt=x,x+=S,q==y){for(bt=0,mt=N.length;mt>bt;bt++)Dt=R(bt,N,C,D,S,x,U),lt.push(Dt===h?"null":Dt);jt=lt.length?S?`[
11
+ ]`&&b(new Date(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&b(new Date(864e13))=='"+275760-09-13T00:00:00.000Z"'&&b(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&b(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch{x=!1}}O=x}if(w=="json-parse"){var B=p.parse;if(typeof B=="function")try{if(B("0")===0&&!B(!1)){C=B(D);var N=C.a.length==5&&C.a[0]===1;if(N){try{N=!B('" "')}catch{}if(N)try{N=B("01")!==1}catch{}if(N)try{N=B("1.")!==1}catch{}}}}catch{N=!1}O=N}}return r[w]=!!O}var o,u,h,d={}.toString,c=typeof JSON=="object"&&JSON,p=typeof t=="object"&&t&&!t.nodeType&&t;p&&c?(p.stringify=c.stringify,p.parse=c.parse):p=n.JSON=c||{};var l=new Date(-0xc782b5b800cec);try{l=l.getUTCFullYear()==-109252&&l.getUTCMonth()===0&&l.getUTCDate()===1&&l.getUTCHours()==10&&l.getUTCMinutes()==37&&l.getUTCSeconds()==6&&l.getUTCMilliseconds()==708}catch{}if(!r("json")){var i="[object Function]",a="[object Date]",f="[object Number]",g="[object String]",y="[object Array]",E="[object Boolean]",j=r("bug-string-char-index");if(!l)var U=Math.floor,F=[0,31,59,90,120,151,181,212,243,273,304,334],L=function(w,O){return F[O]+365*(w-1970)+U((w-1969+(O=+(O>1)))/4)-U((w-1901+O)/100)+U((w-1601+O)/400)};(o={}.hasOwnProperty)||(o=function(w){var O,C={};return(C.__proto__=null,C.__proto__={toString:1},C).toString!=d?o=function(D){var b=this.__proto__,x=D in(this.__proto__=null,this);return this.__proto__=b,x}:(O=C.constructor,o=function(D){var b=(this.constructor||O).prototype;return D in this&&!(D in b&&this[D]===b[D])}),C=null,o.call(this,w)});var S={boolean:1,number:1,string:1,undefined:1},T=function(w,O){var C=typeof w[O];return C=="object"?!!w[O]:!S[C]};if(u=function(w,O){var C,D,b,x=0;(C=function(){this.valueOf=0}).prototype.valueOf=0,D=new C;for(b in D)o.call(D,b)&&x++;return C=D=null,x?u=x==2?function(B,N){var q,J={},tt=d.call(B)==i;for(q in B)tt&&q=="prototype"||o.call(J,q)||!(J[q]=1)||!o.call(B,q)||N(q)}:function(B,N){var q,J,tt=d.call(B)==i;for(q in B)tt&&q=="prototype"||!o.call(B,q)||(J=q==="constructor")||N(q);(J||o.call(B,q="constructor"))&&N(q)}:(D=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],u=function(B,N){var q,J,tt=d.call(B)==i,et=!tt&&typeof B.constructor!="function"&&T(B,"hasOwnProperty")?B.hasOwnProperty:o;for(q in B)tt&&q=="prototype"||!et.call(B,q)||N(q);for(J=D.length;q=D[--J];et.call(B,q)&&N(q));}),u(w,O)},!r("json-stringify")){var A={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},m="000000",v=function(w,O){return(m+(O||0)).slice(-w)},_="\\u00",I=function(w){var O,C='"',D=0,b=w.length,x=b>10&&j;for(x&&(O=w.split(""));b>D;D++){var B=w.charCodeAt(D);switch(B){case 8:case 9:case 10:case 12:case 13:case 34:case 92:C+=A[B];break;default:if(32>B){C+=_+v(2,B.toString(16));break}C+=x?O[D]:j?w.charAt(D):w[D]}}return C+'"'},R=function(w,O,C,D,b,x,B){var N,q,J,tt,et,yt,It,xt,Ut,Bt,lt,Dt,St,mt,Pt,jt;try{N=O[w]}catch{}if(typeof N=="object"&&N)if(q=d.call(N),q!=a||o.call(N,"toJSON"))typeof N.toJSON=="function"&&(q!=f&&q!=g&&q!=y||o.call(N,"toJSON"))&&(N=N.toJSON(w));else if(N>-1/0&&1/0>N){if(L){for(et=U(N/864e5),J=U(et/365.2425)+1970-1;L(J+1,0)<=et;J++);for(tt=U((et-L(J,0))/30.42);L(J,tt+1)<=et;tt++);et=1+et-L(J,tt),yt=(N%864e5+864e5)%864e5,It=U(yt/36e5)%24,xt=U(yt/6e4)%60,Ut=U(yt/1e3)%60,Bt=yt%1e3}else J=N.getUTCFullYear(),tt=N.getUTCMonth(),et=N.getUTCDate(),It=N.getUTCHours(),xt=N.getUTCMinutes(),Ut=N.getUTCSeconds(),Bt=N.getUTCMilliseconds();N=(0>=J||J>=1e4?(0>J?"-":"+")+v(6,0>J?-J:J):v(4,J))+"-"+v(2,tt+1)+"-"+v(2,et)+"T"+v(2,It)+":"+v(2,xt)+":"+v(2,Ut)+"."+v(3,Bt)+"Z"}else N=null;if(C&&(N=C.call(O,w,N)),N===null)return"null";if(q=d.call(N),q==E)return""+N;if(q==f)return N>-1/0&&1/0>N?""+N:"null";if(q==g)return I(""+N);if(typeof N=="object"){for(mt=B.length;mt--;)if(B[mt]===N)throw TypeError();if(B.push(N),lt=[],Pt=x,x+=b,q==y){for(St=0,mt=N.length;mt>St;St++)Dt=R(St,N,C,D,b,x,B),lt.push(Dt===h?"null":Dt);jt=lt.length?b?`[
12
12
  `+x+lt.join(`,
13
13
  `+x)+`
14
- `+Pt+"]":"["+lt.join(",")+"]":"[]"}else u(D||N,function(qt){var ae=R(qt,N,C,D,S,x,U);ae!==h&&lt.push(I(qt)+":"+(S?" ":"")+ae)}),jt=lt.length?S?`{
14
+ `+Pt+"]":"["+lt.join(",")+"]":"[]"}else u(D||N,function(qt){var ae=R(qt,N,C,D,b,x,B);ae!==h&&lt.push(I(qt)+":"+(b?" ":"")+ae)}),jt=lt.length?b?`{
15
15
  `+x+lt.join(`,
16
16
  `+x)+`
17
- `+Pt+"}":"{"+lt.join(",")+"}":"{}";return U.pop(),jt}};p.stringify=function(w,O,C){var D,S,x,U;if(typeof O=="function"||typeof O=="object"&&O){if((U=d.call(O))==i)S=O;else if(U==y){x={};for(var N,q=0,J=O.length;J>q;N=O[q++],U=d.call(N),(U==g||U==f)&&(x[N]=1));}}if(C)if((U=d.call(C))==f){if((C-=C%1)>0)for(D="",C>10&&(C=10);D.length<C;D+=" ");}else U==g&&(D=C.length<=10?C:C.slice(0,10));return R("",(N={},N[""]=w,N),S,x,D,"",[])}}if(!r("json-parse")){var k,W,G=String.fromCharCode,H={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:`
18
- `,102:"\f",114:"\r"},M=function(){throw k=W=null,SyntaxError()},Y=function(){for(var w,O,C,D,S,x=W,U=x.length;U>k;)switch(S=x.charCodeAt(k)){case 9:case 10:case 13:case 32:k++;break;case 123:case 125:case 91:case 93:case 58:case 44:return w=j?x.charAt(k):x[k],k++,w;case 34:for(w="@",k++;U>k;)if(S=x.charCodeAt(k),32>S)M();else if(S==92)switch(S=x.charCodeAt(++k)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:w+=H[S],k++;break;case 117:for(O=++k,C=k+4;C>k;k++)S=x.charCodeAt(k),S>=48&&57>=S||S>=97&&102>=S||S>=65&&70>=S||M();w+=G("0x"+x.slice(O,k));break;default:M()}else{if(S==34)break;for(S=x.charCodeAt(k),O=k;S>=32&&S!=92&&S!=34;)S=x.charCodeAt(++k);w+=x.slice(O,k)}if(x.charCodeAt(k)==34)return k++,w;M();default:if(O=k,S==45&&(D=!0,S=x.charCodeAt(++k)),S>=48&&57>=S){for(S==48&&(S=x.charCodeAt(k+1),S>=48&&57>=S)&&M(),D=!1;U>k&&(S=x.charCodeAt(k),S>=48&&57>=S);k++);if(x.charCodeAt(k)==46){for(C=++k;U>C&&(S=x.charCodeAt(C),S>=48&&57>=S);C++);C==k&&M(),k=C}if(S=x.charCodeAt(k),S==101||S==69){for(S=x.charCodeAt(++k),(S==43||S==45)&&k++,C=k;U>C&&(S=x.charCodeAt(C),S>=48&&57>=S);C++);C==k&&M(),k=C}return+x.slice(O,k)}if(D&&M(),x.slice(k,k+4)=="true")return k+=4,!0;if(x.slice(k,k+5)=="false")return k+=5,!1;if(x.slice(k,k+4)=="null")return k+=4,null;M()}return"$"},gt=function(w){var O,C;if(w=="$"&&M(),typeof w=="string"){if((j?w.charAt(0):w[0])=="@")return w.slice(1);if(w=="["){for(O=[];w=Y(),w!="]";C||(C=!0))C&&(w==","?(w=Y(),w=="]"&&M()):M()),w==","&&M(),O.push(gt(w));return O}if(w=="{"){for(O={};w=Y(),w!="}";C||(C=!0))C&&(w==","?(w=Y(),w=="}"&&M()):M()),(w==","||typeof w!="string"||(j?w.charAt(0):w[0])!="@"||Y()!=":")&&M(),O[w.slice(1)]=gt(Y());return O}M()}return w},oe=function(w,O,C){var D=ie(w,O,C);D===h?delete w[O]:w[O]=D},ie=function(w,O,C){var D,S=w[O];if(typeof S=="object"&&S)if(d.call(S)==y)for(D=S.length;D--;)oe(S,D,C);else u(S,function(x){oe(S,x,C)});return C.call(w,O,S)};p.parse=function(w,O){var C,D;return k=0,W=""+w,C=gt(Y()),Y()!="$"&&M(),k=W=null,O&&d.call(O)==i?ie((D={},D[""]=C,D),"",O):C}}}})(this)},{}],48:[function(s,e){function t(n,r){var o=[];r=r||0;for(var u=r||0;u<n.length;u++)o[u-r]=n[u];return o}e.exports=t},{}]},{},[1])(1)}const rn=Object.freeze(Object.defineProperty({__proto__:null,default:sn},Symbol.toStringTag,{value:"Module"})),on=Object.assign({"./v1_3_7.js":rn}),an=/v\d+_\d+_\d+/;function cn(s){return typeof s=="function"}const Wt=Object.entries(on).reduce((s,e)=>{var r;const t=e[1].default,n=(r=e[0].match(an))==null?void 0:r[0];return cn(t)&&n&&(s[n]=t()),s},{}),Ee=s=>{if(s in Wt)return Wt[s];throw new Error(`Socket version ${s} not found`)},hn=(s,...e)=>Ee(s)(...e),ln={...Wt,getSocketVersion:Ee,makeSocketVersion:hn};var Te=(s=>(s.RINGING="Ringing",s.TALKING="Talking",s.DIALING="Dialing",s.HOLD="Hold",s))(Te||{}),Ae=(s=>(s.INCOMING="Incoming",s.OUTGOING="Outgoing",s))(Ae||{}),pt=(s=>(s.CONNECTED="connected",s.DISCONNECTED="disconnected",s.TRYING_TO_CONNECT="tryingToConnect",s))(pt||{}),Ne=(s=>(s.AUTOMATIC="Automatic",s.IVR="IVR",s))(Ne||{}),_e=(s=>(s.INCOMINC="Incoming",s.OUTGOING="Outgoing",s.SPY="Spy",s.CLICK2CALL="Click2Call",s))(_e||{}),Oe=(s=>(s.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",s.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",s))(Oe||{}),P=(s=>(s.ALL_DIALER_STATUS="AllDialersStatus",s.ALL_EXTENSION_STATUS="AllExtensionsStatus",s.ALL_USERS_STATUS="AllUsersStatus",s.CONNECT="connect",s.DISCONNECT="disconnect",s.CONNECT_ERROR_EVENT="connect_error",s.EXTENSION_EVENT="ExtensionEvent",s.KEEP_ALIVE="keepalive",s.KEEP_ALIVE_RESPONSE="keepaliveResponse",s.LOGIN_STATUS="loginStatus",s.LOGIN_SUCCESS="loginSuccess",s.QUEUE_EVENT="QueueEvent",s.ONLINE_STATUS_EVENT="onlineStatusEvent",s.DIALER_EVENT="DialerEvent",s.EXTENSIONS_UPDATED="ExtensionsUpdated",s))(P||{}),Yt=(s=>(s.NEWCALL="NEWCALL",s.ANSWER="ANSWER",s.HOLD="HOLD",s.UNHOLD="UNHOLD",s.HANGUP="HANGUP",s.USER_STATUS_UPDATE="userStatusUpdate",s))(Yt||{}),Le=(s=>(s.NORMAL_HANGUP="Normal hangup",s.USER_BUSY="User busy",s.CALL_REJECTED="Call Rejected",s.UNALLOCATED_NUMBER="Unallocated (unassigned) number",s.UNKNOWN="Unknown",s.NO_USER_RESPONDING="No user responding",s.USER_ALERTING="User alerting, no answer",s.ANSWERED_ELSEWHERE="Answered elsewhere",s))(Le||{}),Re=(s=>(s.ANSWER="ANSWER",s.ABANDONED="ABANDONED",s.EXIT="EXIT",s.JOIN="JOIN",s))(Re||{});class wt{static mapExtensionEvent(e){var u,h;const t=e.reason;let n,r;e.data.currentCall&&(r=this.mapExtensionCall(e,e.data.currentCall));const o=this.mapExtensionData(e,e.data);return t===Yt.HANGUP?n={...e,reason:t,data:{...o,currentCall:r?{...r,duration:r.callAnswered_UTC_CLIENT?Date.now()-r.callAnswered_UTC_CLIENT:0}:void 0,calls:(u=e.data.calls)==null?void 0:u.map(d=>{const c=this.mapExtensionCall(e,d);return{...c,duration:c.callAnswered_UTC_CLIENT?Date.now()-c.callAnswered_UTC_CLIENT:0}})}}:n={...e,data:{...o,currentCall:r,calls:(h=e.data.calls)==null?void 0:h.map(d=>this.mapExtensionCall(e,d))},reason:t},n}static mapAllExtensionStatus(e){return{...e,extensions:e.extensions.map(t=>{var n;return{...this.mapExtensionData(e,t),currentCall:t.currentCall?this.mapExtensionCall(e,t.currentCall):void 0,calls:(n=t.calls)==null?void 0:n.map(r=>this.mapExtensionCall(e,r))}})}}static mapExtensionData(e,t){return this.configureUTCForObject(t,[{key:"lastAnsweredCallEventEpoch",format:"sec"},{key:"lastCallEventEpoch",format:"sec"},{key:"lastHangupCallEpoch",format:"sec"},{key:"representativeUpdated",format:"ms"}],e.servertime,e.servertimeoffset)}static mapExtensionCall(e,t){return this.configureUTCForObject(t,[{key:"callAnswered",format:"sec"},{key:"callStarted",format:"sec"}],e.servertime,e.servertimeoffset)}static mapQueueCall(e,t){return this.configureUTCForObject(t,[{key:"JoinTimeStamp",format:"sec"},{key:"VHJoinTimeStamp",format:"sec"}],e.servertime,e.servertimeoffset)}static mapLoginStatusEvent(e){return{...e,queues:e.queues.map(t=>({...t,Calls:t.Calls.map(n=>this.mapQueueCall(e,n))}))}}static mapQueueEvent(e){return{...e,data:{...e.data,Calls:e.data.Calls.map(t=>this.mapQueueCall(e,t))}}}static assignProperty(e,t,n){e[t]=n}static configureUTCForObject(e,t,n,r){const o=(n-r*60)*1e3,u=Date.now()-o,h={};return t.forEach(d=>{const c=e[d.key],p=d.key;if(c!==0&&typeof c=="number"&&!isNaN(c)){let l=c;d.format==="ms"&&(l=Math.floor(l/1e3));const i=(l-r*60)*1e3;this.assignProperty(h,`${p}_UTC`,i),this.assignProperty(h,`${p}_UTC_CLIENT`,i+u)}else this.assignProperty(h,`${p}_UTC`,0),this.assignProperty(h,`${p}_UTC_CLIENT`,0)}),{...e,...h}}}var Qt=(s=>(s.UPDATE_MONITORED_EXTENSIONS="updateMonitoredExtensions",s.KEEP_ALIVE="keepalive",s))(Qt||{});class un{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,typeof window<"u"&&(window.addEventListener("offline",()=>{this.closeAllConnections()}),window.addEventListener("online",()=>{setTimeout(()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(at.NEXT)},5e3)})),typeof self<"u"&&typeof window>"u"&&typeof global>"u"&&(self.addEventListener("offline",()=>{this.closeAllConnections()}),self.addEventListener("online",()=>{setTimeout(()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(at.NEXT)},5e3)}))}getSocketIoFunction(e){const t=e.split("v="),n="v".concat(t[t.length-1]).replaceAll(".","_");this.ioFunction=ln.getSocketVersion(n)}initSocketConnection(){const e=this.eventsSdkClass.authClass.token,t=this.eventsSdkClass.options.protocol,n=this.eventsSdkClass.server;try{const r=n?n.Domain:this.eventsSdkClass.URL,o=n?`${t}://${r}`:this.eventsSdkClass.URL,u={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:e},timeout:this.eventsSdkClass.options.timeout};if(this.ioFunction&&o)this.io=this.ioFunction(o,u),this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{attemptToConnect:o,connectionStatus:pt.TRYING_TO_CONNECT}),this.eventsSdkClass.loggerClass.sdkAttemptToConnect(r);else throw new Error("Socket server url no defined")}catch(r){this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(r)}}clearKeepAliveInterval(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval)}initKeepAlive(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveInterval=setInterval(async()=>{if(new Date().getTime()>this.lastEventTimestamp+this.eventsSdkClass.options.keepAliveTimeout&&this.io&&this.eventsSdkClass.authClass.token){this.eventsSdkClass.emit(Qt.KEEP_ALIVE,this.eventsSdkClass.authClass.token),this.eventsSdkClass.loggerClass.keepAliveEmit();return}},this.eventsSdkClass.options.keepAliveTimeout)}closeAllConnections(){var e;this.io&&(this.io.close(),(e=this.io)==null||e.disconnect(),this.io=void 0),this.eventsSdkClass.loggerClass.stop(),kt.clearSessionStorage()}initSocketEvents(){this.io&&this.io.on(P.LOGIN_SUCCESS,e=>this.onLoginSuccessEvent(e,P.LOGIN_SUCCESS)).on(P.QUEUE_EVENT,e=>this.onQueueEvent(e,P.QUEUE_EVENT)).on(P.EXTENSION_EVENT,e=>this.onExtensionEvent(e,P.EXTENSION_EVENT)).on(P.DIALER_EVENT,e=>this.onDialerEvent(e,P.DIALER_EVENT)).on(P.LOGIN_STATUS,e=>this.onLoginStatusEvent(e,P.LOGIN_STATUS)).on(P.ALL_EXTENSION_STATUS,e=>this.onAllExtensionStatus(e,P.ALL_EXTENSION_STATUS)).on(P.ALL_DIALER_STATUS,e=>this.onAllDialerStatus(e,P.ALL_DIALER_STATUS)).on(P.KEEP_ALIVE_RESPONSE,e=>this.onKeepAliveResponse(e)).on(P.EXTENSIONS_UPDATED,e=>this.onExtensionsUpdatedEvent(e,P.EXTENSIONS_UPDATED)).on(P.CONNECT,()=>this.onConnect()).on(P.DISCONNECT,e=>this.onDisconnect(e)).on(P.CONNECT_ERROR_EVENT,e=>this.onConnectError(e))}onLoginSuccessEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onQueueEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,wt.mapQueueEvent(e))}onExtensionEvent(e,t){const n=wt.mapExtensionEvent(e);n&&(this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,n))}onDialerEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onLoginStatusEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,wt.mapLoginStatusEvent(e))}onAllExtensionStatus(e,t){const n=wt.mapAllExtensionStatus(e);this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,n)}onAllDialerStatus(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onKeepAliveResponse(e){if(this.eventsSdkClass.loggerClass.keepAliveResponse(e),e.errorCode){this.initSocketConnection();return}this.connected?this.lastEventTimestamp=new Date().getTime():this.initSocketConnection()}onExtensionsUpdatedEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onConnect(){this.connected=!0,this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{connectionStatus:pt.CONNECTED}),this.eventsSdkClass.loggerClass.start().then(()=>{this.eventsSdkClass.loggerClass.sdkConnectionSuccess()})}onDisconnect(e){this.connected=!1,this.doReconnect&&(this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?pt.TRYING_TO_CONNECT:pt.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkDisconnect([e]),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>120&&(this.reconnectionTime=20),this.eventsSdkClass.connect(at.NEXT)},this.reconnectionTime*1e3))}onConnectError(e){this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?pt.TRYING_TO_CONNECT:pt.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(e),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>60&&(this.reconnectionTime=20),this.eventsSdkClass.connect(at.NEXT)},this.reconnectionTime*1e3)}}var pn=Object.defineProperty,fn=(s,e,t)=>e in s?pn(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,X=(s,e,t)=>(fn(s,typeof e!="symbol"?e+"":e,t),t);const ht=Object.create(null);ht.open="0";ht.close="1";ht.ping="2";ht.pong="3";ht.message="4";ht.upgrade="5";ht.noop="6";const _t=Object.create(null);Object.keys(ht).forEach(s=>{_t[ht[s]]=s});const Gt={type:"error",data:"parser error"},Ie=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",xe=typeof ArrayBuffer=="function",Be=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer,Zt=({type:s,data:e},t,n)=>Ie&&e instanceof Blob?t?n(e):he(e,n):xe&&(e instanceof ArrayBuffer||Be(e))?t?n(e):he(new Blob([e]),n):n(ht[s]+(e||"")),he=(s,e)=>{const t=new FileReader;return t.onload=function(){const n=t.result.split(",")[1];e("b"+(n||""))},t.readAsDataURL(s)};function le(s){return s instanceof Uint8Array?s:s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}let Ft;function dn(s,e){if(Ie&&s.data instanceof Blob)return s.data.arrayBuffer().then(le).then(e);if(xe&&(s.data instanceof ArrayBuffer||Be(s.data)))return e(le(s.data));Zt(s,!1,t=>{Ft||(Ft=new TextEncoder),e(Ft.encode(t))})}const ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",St=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<ue.length;s++)St[ue.charCodeAt(s)]=s;const gn=s=>{let e=s.length*.75,t=s.length,n,r=0,o,u,h,d;s[s.length-1]==="="&&(e--,s[s.length-2]==="="&&e--);const c=new ArrayBuffer(e),p=new Uint8Array(c);for(n=0;n<t;n+=4)o=St[s.charCodeAt(n)],u=St[s.charCodeAt(n+1)],h=St[s.charCodeAt(n+2)],d=St[s.charCodeAt(n+3)],p[r++]=o<<2|u>>4,p[r++]=(u&15)<<4|h>>2,p[r++]=(h&3)<<6|d&63;return c},yn=typeof ArrayBuffer=="function",te=(s,e)=>{if(typeof s!="string")return{type:"message",data:Ue(s,e)};const t=s.charAt(0);return t==="b"?{type:"message",data:mn(s.substring(1),e)}:_t[t]?s.length>1?{type:_t[t],data:s.substring(1)}:{type:_t[t]}:Gt},mn=(s,e)=>{if(yn){const t=gn(s);return Ue(t,e)}else return{base64:!0,data:s}},Ue=(s,e)=>{switch(e){case"blob":return s instanceof Blob?s:new Blob([s]);case"arraybuffer":default:return s instanceof ArrayBuffer?s:s.buffer}},De="",vn=(s,e)=>{const t=s.length,n=new Array(t);let r=0;s.forEach((o,u)=>{Zt(o,!1,h=>{n[u]=h,++r===t&&e(n.join(De))})})},kn=(s,e)=>{const t=s.split(De),n=[];for(let r=0;r<t.length;r++){const o=te(t[r],e);if(n.push(o),o.type==="error")break}return n};function Sn(){return new TransformStream({transform(s,e){dn(s,t=>{const n=t.length;let r;if(n<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,n);else if(n<65536){r=new Uint8Array(3);const o=new DataView(r.buffer);o.setUint8(0,126),o.setUint16(1,n)}else{r=new Uint8Array(9);const o=new DataView(r.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(n))}s.data&&typeof s.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let Mt;function Ct(s){return s.reduce((e,t)=>e+t.length,0)}function Et(s,e){if(s[0].length===e)return s.shift();const t=new Uint8Array(e);let n=0;for(let r=0;r<e;r++)t[r]=s[0][n++],n===s[0].length&&(s.shift(),n=0);return s.length&&n<s[0].length&&(s[0]=s[0].slice(n)),t}function bn(s,e){Mt||(Mt=new TextDecoder);const t=[];let n=0,r=-1,o=!1;return new TransformStream({transform(u,h){for(t.push(u);;){if(n===0){if(Ct(t)<1)break;const d=Et(t,1);o=(d[0]&128)===128,r=d[0]&127,r<126?n=3:r===126?n=1:n=2}else if(n===1){if(Ct(t)<2)break;const d=Et(t,2);r=new DataView(d.buffer,d.byteOffset,d.length).getUint16(0),n=3}else if(n===2){if(Ct(t)<8)break;const d=Et(t,8),c=new DataView(d.buffer,d.byteOffset,d.length),p=c.getUint32(0);if(p>Math.pow(2,21)-1){h.enqueue(Gt);break}r=p*Math.pow(2,32)+c.getUint32(4),n=3}else{if(Ct(t)<r)break;const d=Et(t,r);h.enqueue(te(o?d:Mt.decode(d),e)),n=0}if(r===0||r>s){h.enqueue(Gt);break}}}})}const Pe=4;function $(s){if(s)return wn(s)}function wn(s){for(var e in $.prototype)s[e]=$.prototype[e];return s}$.prototype.on=$.prototype.addEventListener=function(s,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(e),this};$.prototype.once=function(s,e){function t(){this.off(s,t),e.apply(this,arguments)}return t.fn=e,this.on(s,t),this};$.prototype.off=$.prototype.removeListener=$.prototype.removeAllListeners=$.prototype.removeEventListener=function(s,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+s];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var n,r=0;r<t.length;r++)if(n=t[r],n===e||n.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+s],this};$.prototype.emit=function(s){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+s],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t){t=t.slice(0);for(var n=0,r=t.length;n<r;++n)t[n].apply(this,e)}return this};$.prototype.emitReserved=$.prototype.emit;$.prototype.listeners=function(s){return this._callbacks=this._callbacks||{},this._callbacks["$"+s]||[]};$.prototype.hasListeners=function(s){return!!this.listeners(s).length};const nt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function je(s,...e){return e.reduce((t,n)=>(s.hasOwnProperty(n)&&(t[n]=s[n]),t),{})}const Cn=nt.setTimeout,En=nt.clearTimeout;function Rt(s,e){e.useNativeTimers?(s.setTimeoutFn=Cn.bind(nt),s.clearTimeoutFn=En.bind(nt)):(s.setTimeoutFn=nt.setTimeout.bind(nt),s.clearTimeoutFn=nt.clearTimeout.bind(nt))}const Tn=1.33;function An(s){return typeof s=="string"?Nn(s):Math.ceil((s.byteLength||s.size)*Tn)}function Nn(s){let e=0,t=0;for(let n=0,r=s.length;n<r;n++)e=s.charCodeAt(n),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(n++,t+=4);return t}function _n(s){let e="";for(let t in s)s.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(s[t]));return e}function On(s){let e={},t=s.split("&");for(let n=0,r=t.length;n<r;n++){let o=t[n].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class Ln extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class ee extends ${constructor(e){super(),this.writable=!1,Rt(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new Ln(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=te(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=_n(e);return t.length?"?"+t:""}}const qe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Jt=64,Rn={};let pe=0,Tt=0,fe;function de(s){let e="";do e=qe[s%Jt]+e,s=Math.floor(s/Jt);while(s>0);return e}function Fe(){const s=de(+new Date);return s!==fe?(pe=0,fe=s):s+"."+de(pe++)}for(;Tt<Jt;Tt++)Rn[qe[Tt]]=Tt;let Me=!1;try{Me=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const In=Me;function Ve(s){const e=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||In))return new XMLHttpRequest}catch{}if(!e)try{return new nt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function xn(){}const Bn=function(){return new Ve({xdomain:!1}).responseType!=null}();class Un extends ee{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}const t=e&&e.forceBase64;this.supportsBinary=Bn&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let n=0;this.polling&&(n++,this.once("pollComplete",function(){--n||t()})),this.writable||(n++,this.once("drain",function(){--n||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};kn(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,vn(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Fe()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ct(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(r,o)=>{this.onError("xhr post error",r,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,n)=>{this.onError("xhr poll error",t,n)}),this.pollXhr=e}}class ct extends ${constructor(e,t){super(),Rt(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;const t=je(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const n=this.xhr=new Ve(t);try{n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var r;n.readyState===3&&((r=this.opts.cookieJar)===null||r===void 0||r.parseCookies(n)),n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ct.requestsCount++,ct.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=xn,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ct.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}ct.requestsCount=0;ct.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ge);else if(typeof addEventListener=="function"){const s="onpagehide"in nt?"pagehide":"unload";addEventListener(s,ge,!1)}}function ge(){for(let s in ct.requests)ct.requests.hasOwnProperty(s)&&ct.requests[s].abort()}const ne=typeof Promise=="function"&&typeof Promise.resolve=="function"?s=>Promise.resolve().then(s):(s,e)=>e(s,0),At=nt.WebSocket||nt.MozWebSocket,ye=!0,Dn="arraybuffer",me=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Pn extends ee{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=me?{}:je(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=ye&&!me?t?new At(e,t):new At(e):new At(e,t,n)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;Zt(n,this.supportsBinary,o=>{try{ye&&this.ws.send(o)}catch{}r&&ne(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Fe()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!At}}class jn extends ee{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=bn(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Sn();r.readable.pipeTo(e.writable),this.writer=r.writable.getWriter();const o=()=>{n.read().then(({done:h,value:d})=>{h||(this.onPacket(d),o())}).catch(h=>{})};o();const u={type:"open"};this.query.sid&&(u.data=`{"sid":"${this.query.sid}"}`),this.writer.write(u).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this.writer.write(n).then(()=>{r&&ne(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const qn={websocket:Pn,webtransport:jn,polling:Un},Fn=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Mn=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xt(s){if(s.length>2e3)throw"URI too long";const e=s,t=s.indexOf("["),n=s.indexOf("]");t!=-1&&n!=-1&&(s=s.substring(0,t)+s.substring(t,n).replace(/:/g,";")+s.substring(n,s.length));let r=Fn.exec(s||""),o={},u=14;for(;u--;)o[Mn[u]]=r[u]||"";return t!=-1&&n!=-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=Vn(o,o.path),o.queryKey=Kn(o,o.query),o}function Vn(s,e){const t=/\/{2,9}/g,n=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&n.splice(0,1),e.slice(-1)=="/"&&n.splice(n.length-1,1),n}function Kn(s,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,r,o){r&&(t[r]=o)}),t}let Ke=class ft extends ${constructor(e,t={}){super(),this.binaryType=Dn,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Xt(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Xt(t.host).host),Rt(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=On(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Pe,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new qn[e](n)}open(){let e;if(this.opts.rememberUpgrade&&ft.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),n=!1;ft.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",l=>{if(!n)if(l.type==="pong"&&l.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ft.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const i=new Error("probe error");i.transport=t.name,this.emitReserved("upgradeError",i)}}))};function o(){n||(n=!0,p(),t.close(),t=null)}const u=l=>{const i=new Error("probe error: "+l);i.transport=t.name,o(),this.emitReserved("upgradeError",i)};function h(){u("transport closed")}function d(){u("socket closed")}function c(l){t&&l.name!==t.name&&o()}const p=()=>{t.removeListener("open",r),t.removeListener("error",u),t.removeListener("close",h),this.off("close",d),this.off("upgrading",c)};t.once("open",r),t.once("error",u),t.once("close",h),this.once("close",d),this.once("upgrading",c),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onOpen(){if(this.readyState="open",ft.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=An(n)),t>0&&e>this.maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if(typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}onError(e){ft.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n<r;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}};Ke.protocol=Pe;function Wn(s,e="",t){let n=s;t=t||typeof location<"u"&&location,s==null&&(s=t.protocol+"//"+t.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=t.protocol+s:s=t.host+s),/^(https?|wss?):\/\//.test(s)||(typeof t<"u"?s=t.protocol+"//"+s:s="https://"+s),n=Xt(s)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const r=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port+e,n.href=n.protocol+"://"+r+(t&&t.port===n.port?"":":"+n.port),n}const Gn=typeof ArrayBuffer=="function",Jn=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,We=Object.prototype.toString,Xn=typeof Blob=="function"||typeof Blob<"u"&&We.call(Blob)==="[object BlobConstructor]",$n=typeof File=="function"||typeof File<"u"&&We.call(File)==="[object FileConstructor]";function se(s){return Gn&&(s instanceof ArrayBuffer||Jn(s))||Xn&&s instanceof Blob||$n&&s instanceof File}function Ot(s,e){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let t=0,n=s.length;t<n;t++)if(Ot(s[t]))return!0;return!1}if(se(s))return!0;if(s.toJSON&&typeof s.toJSON=="function"&&arguments.length===1)return Ot(s.toJSON(),!0);for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&Ot(s[t]))return!0;return!1}function zn(s){const e=[],t=s.data,n=s;return n.data=$t(t,e),n.attachments=e.length,{packet:n,buffers:e}}function $t(s,e){if(!s)return s;if(se(s)){const t={_placeholder:!0,num:e.length};return e.push(s),t}else if(Array.isArray(s)){const t=new Array(s.length);for(let n=0;n<s.length;n++)t[n]=$t(s[n],e);return t}else if(typeof s=="object"&&!(s instanceof Date)){const t={};for(const n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=$t(s[n],e));return t}return s}function Hn(s,e){return s.data=zt(s.data,e),delete s.attachments,s}function zt(s,e){if(!s)return s;if(s&&s._placeholder===!0){if(typeof s.num=="number"&&s.num>=0&&s.num<e.length)return e[s.num];throw new Error("illegal attachments")}else if(Array.isArray(s))for(let t=0;t<s.length;t++)s[t]=zt(s[t],e);else if(typeof s=="object")for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(s[t]=zt(s[t],e));return s}const Yn=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Qn=5;var V;(function(s){s[s.CONNECT=0]="CONNECT",s[s.DISCONNECT=1]="DISCONNECT",s[s.EVENT=2]="EVENT",s[s.ACK=3]="ACK",s[s.CONNECT_ERROR=4]="CONNECT_ERROR",s[s.BINARY_EVENT=5]="BINARY_EVENT",s[s.BINARY_ACK=6]="BINARY_ACK"})(V||(V={}));class Zn{constructor(e){this.replacer=e}encode(e){return(e.type===V.EVENT||e.type===V.ACK)&&Ot(e)?this.encodeAsBinary({type:e.type===V.EVENT?V.BINARY_EVENT:V.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===V.BINARY_EVENT||e.type===V.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=zn(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}}function ve(s){return Object.prototype.toString.call(s)==="[object Object]"}class re extends ${constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===V.BINARY_EVENT;n||t.type===V.BINARY_ACK?(t.type=n?V.EVENT:V.ACK,this.reconstructor=new ts(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(se(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(V[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===V.BINARY_EVENT||n.type===V.BINARY_ACK){const o=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const u=e.substring(o,t);if(u!=Number(u)||e.charAt(t)!=="-")throw new Error("Illegal attachments");n.attachments=Number(u)}if(e.charAt(t+1)==="/"){const o=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););n.nsp=e.substring(o,t)}else n.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const o=t+1;for(;++t;){const u=e.charAt(t);if(u==null||Number(u)!=u){--t;break}if(t===e.length)break}n.id=Number(e.substring(o,t+1))}if(e.charAt(++t)){const o=this.tryParse(e.substr(t));if(re.isPayloadValid(n.type,o))n.data=o;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case V.CONNECT:return ve(t);case V.DISCONNECT:return t===void 0;case V.CONNECT_ERROR:return typeof t=="string"||ve(t);case V.EVENT:case V.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Yn.indexOf(t[0])===-1);case V.ACK:case V.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ts{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Hn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const es=Object.freeze(Object.defineProperty({__proto__:null,Decoder:re,Encoder:Zn,get PacketType(){return V},protocol:Qn},Symbol.toStringTag,{value:"Module"}));function rt(s,e,t){return s.on(e,t),function(){s.off(e,t)}}const ns=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ge extends ${constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[rt(e,"open",this.onopen.bind(this)),rt(e,"packet",this.onpacket.bind(this)),rt(e,"error",this.onerror.bind(this)),rt(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(ns.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:V.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,u=t.pop();this._registerAckCallback(o,u),n.id=o}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var n;const r=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let u=0;u<this.sendBuffer.length;u++)this.sendBuffer[u].id===e&&this.sendBuffer.splice(u,1);t.call(this,new Error("operation has timed out"))},r);this.acks[e]=(...u)=>{this.io.clearTimeoutFn(o),t.apply(this,[null,...u])}}emitWithAck(e,...t){const n=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((r,o)=>{t.push((u,h)=>n?u?o(u):r(h):r(u)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...o)=>n!==this._queue[0]?void 0:(r!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...o)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:V.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case V.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case V.EVENT:case V.BINARY_EVENT:this.onevent(e);break;case V.ACK:case V.BINARY_ACK:this.onack(e);break;case V.DISCONNECT:this.ondisconnect();break;case V.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:V.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:V.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function dt(s){s=s||{},this.ms=s.min||100,this.max=s.max||1e4,this.factor=s.factor||2,this.jitter=s.jitter>0&&s.jitter<=1?s.jitter:0,this.attempts=0}dt.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*s);s=Math.floor(e*10)&1?s+t:s-t}return Math.min(s,this.max)|0};dt.prototype.reset=function(){this.attempts=0};dt.prototype.setMin=function(s){this.ms=s};dt.prototype.setMax=function(s){this.max=s};dt.prototype.setJitter=function(s){this.jitter=s};class Ht extends ${constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,Rt(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((n=t.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new dt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||es;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Ke(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=rt(t,"open",function(){n.onopen(),e&&e()}),o=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),e?e(h):this.maybeReconnectOnOpen()},u=rt(t,"error",o);if(this._timeout!==!1){const h=this._timeout,d=this.setTimeoutFn(()=>{r(),o(new Error("timeout")),t.close()},h);this.opts.autoUnref&&d.unref(),this.subs.push(()=>{this.clearTimeoutFn(d)})}return this.subs.push(r),this.subs.push(u),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(rt(e,"ping",this.onping.bind(this)),rt(e,"data",this.ondata.bind(this)),rt(e,"error",this.onerror.bind(this)),rt(e,"close",this.onclose.bind(this)),rt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){ne(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Ge(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t)if(this.nsps[n].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const vt={};function Lt(s,e){typeof s=="object"&&(e=s,s=void 0),e=e||{};const t=Wn(s,e.path||"/socket.io"),n=t.source,r=t.id,o=t.path,u=vt[r]&&o in vt[r].nsps,h=e.forceNew||e["force new connection"]||e.multiplex===!1||u;let d;return h?d=new Ht(n,e):(vt[r]||(vt[r]=new Ht(n,e)),d=vt[r]),t.query&&!e.query&&(e.query=t.queryKey),d.socket(t.path,e)}Object.assign(Lt,{Manager:Ht,Socket:Ge,io:Lt,connect:Lt});let Nt;const ss=new Uint8Array(16);function rs(){if(!Nt&&(Nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Nt(ss)}const z=[];for(let s=0;s<256;++s)z.push((s+256).toString(16).slice(1));function os(s,e=0){return z[s[e+0]]+z[s[e+1]]+z[s[e+2]]+z[s[e+3]]+"-"+z[s[e+4]]+z[s[e+5]]+"-"+z[s[e+6]]+z[s[e+7]]+"-"+z[s[e+8]]+z[s[e+9]]+"-"+z[s[e+10]]+z[s[e+11]]+z[s[e+12]]+z[s[e+13]]+z[s[e+14]]+z[s[e+15]]}const is=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ke={randomUUID:is};function as(s,e,t){if(ke.randomUUID&&!e&&!s)return ke.randomUUID();s=s||{};const n=s.random||(s.rng||rs)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let r=0;r<16;++r)e[t+r]=n[r];return e}return os(n)}function cs(s,e){const t=e.map(r=>JSON.stringify(r)).join(" "),n=new Date().toISOString();return JSON.stringify({level:s,time:n,message:t})}function hs(s,e){const t=JSON.parse(s);return e.forEach(n=>delete t[n]),t}function ls(s){if(typeof s=="object"&&s!==null)return s;try{return JSON.parse(s)}catch{return{extraData:s}}}function us(s){const e=/\(([^)]+)\)/,t=s.match(e);if(t&&t[1]){const n=t[1].split(";");for(let r of n)if(r=r.trim(),r.startsWith("Windows")||r.startsWith("Macintosh")||r.startsWith("Linux"))return r}return"Unknown"}function Se(s){return(...e)=>new Promise((t,n)=>{try{const r=s(...e);t(r)}catch(r){n(r)}})}const ps={reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,upgrade:!1,transports:["websocket"],debug:!1},Vt={logToConsole:!0,overloadGlobalConsole:!1,socketEmitInterval:6e4},ot={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"},fs={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},it={INFO:"info",WARNING:"warning",MODIFY:"modify",ERROR:"error",VIEW:"view"},Q={INFO:"info",WARNING:"warning",ERROR:"error",DEBUG:"debug"};let Z=console;class ds{constructor(e){X(this,"logToConsole"),X(this,"overloadGlobalConsole"),X(this,"system"),X(this,"socketEmitInterval"),X(this,"storageId"),X(this,"emitInProgress"),X(this,"queue"),X(this,"processing"),X(this,"storageInitialized"),X(this,"interval"),X(this,"logIndex"),X(this,"socket"),X(this,"requestUrl"),X(this,"staticObject",{}),X(this,"localObject",{}),X(this,"isGetItemAsync"),X(this,"isSetItemAsync"),X(this,"getItem"),X(this,"setItem"),X(this,"parseLog"),X(this,"_logMethod"),X(this,"_warnMethod"),X(this,"_errorMethod"),X(this,"_debugMethod");const{loggerOptions:t}=e;if(!t.system)throw new Error("Config property 'system' should be provided!");this.isGetItemAsync=t.isGetItemAsync||!1,this.isSetItemAsync=t.isSetItemAsync||!1,this.setupStorageFunctions(t.getItem,t.setItem,t.parseLog),this.system=t.system,this.socketEmitInterval=t.socketEmitInterval||Vt.socketEmitInterval,this.logToConsole=t.logToConsole!==void 0?t.logToConsole:Vt.logToConsole,this.overloadGlobalConsole=t.overloadGlobalConsole!==void 0?t.overloadGlobalConsole:Vt.overloadGlobalConsole,this.storageId=this.getStorageName(),this.queue=[],this.processing=!1,this.storageInitialized=!1,this.emitInProgress=!1,this.logIndex=0,this.init(e)}setupStorageFunctions(e,t,n){this.getItem=e&&typeof e=="function"?this.isGetItemAsync?e:Se(e):this.defaultGetItemFunction,this.setItem=t&&typeof t=="function"?this.isSetItemAsync?t:Se(t):this.defaultSetItemFunction,this.parseLog=n&&typeof n=="function"?n:cs}sendHttpRequest(e){if(!this.requestUrl)throw new Error("requestUrl is not provided");const t={Data:e};return fetch(this.requestUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}init(e){const{socket:t,url:n,requestUrl:r,socketOptions:o={}}=e;this._logMethod=Z.log.bind(Z),this._warnMethod=Z.warn.bind(Z),this._errorMethod=Z.error.bind(Z),this._debugMethod=Z.debug.bind(Z),this.initStorage().then(()=>{if(t)this.socket=t;else if(n)this.socket=this.createConnection(n,o);else if(r)this.requestUrl=r;else throw new Error("Must provide either a 'socket', 'requestUrl' or a 'url' for logger requests");this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval),this.overloadGlobalConsole&&this._overloadConsole()})}createConnection(e,t={}){const n={...ps,...t};return Lt(e,n)}async emitLogs(){if(!this.emitInProgress)try{const e=await this.getItem(this.storageId),t=JSON.parse(e||"{}"),n={...this.localObject,...t};if(!Object.keys(n).length)return;const r=[];this.emitInProgress=!0;const o=Object.keys(n);if(!o.length)return;if((!this.socket||!this.socket.connected)&&!this.requestUrl)throw new Error("Log request can't be sent. Socket is disconnected or requestUrl is not provided");const u=[];for(const c of o){const p=ls(n[c]),l={...this.staticObject,...p},i=this.populateSendingLog(l);i.Body&&typeof i.Body=="string"&&(i.Body=JSON.parse(i.Body)),this.socket?await this.socket.emit("Log",i):this.requestUrl&&u.push(i),r.push(c)}u.length&&await this.sendHttpRequest(u);const h=await this.getItem(this.storageId);if(!h)return;const d=hs(h,r);this.localObject={},await this.setItem(this.storageId,JSON.stringify(d))}catch(e){this._errorMethod(e)}finally{this.emitInProgress=!1}}populateSendingLog(e){const t={...e},n=t.ActionName;return n&&(t.ActionID=fs[n]),t}setupStaticFields(e){this.staticObject={...e}}populateMetaData(){const e=new Date;let t;typeof window<"u"&&typeof window.document<"u"?t=window==null?void 0:window.navigator.userAgent:typeof self<"u"&&self.navigator&&(t=self.navigator.userAgent);let n;return t&&(n=us(t)),{System:this.system,DateTime:e,UserAgent:t,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(){Z=Object.assign(Z,{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=as();return this.system.toString().toUpperCase()+e+Date.now()}async processLog(...e){try{if(e.length<2)return;const t=e[0],n=e[1],r=this.formItemKey(t);if(!this.storageInitialized){this.localObject={...this.localObject,[r]:n};return}const o=await this.getItem(this.storageId);if(!o)return;const u=JSON.parse(o);u[r]=JSON.stringify(n),await this.setItem(this.storageId,JSON.stringify(u))}catch(t){this._errorMethod(t)}}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 t={...this.populateMetaData(),...e},n=["INFO",t];this.queue.push(n),this.logToConsole&&this._logMethod.apply(Z,[t]),this.processQueue()}warn(e){const t=["WARN",e];this.queue.push(t),this.logToConsole&&this._warnMethod.apply(Z,[e]),this.processQueue()}error(e){const t=["ERROR",e];this.queue.push(t),this.logToConsole&&this._errorMethod.apply(Z,[e]),this.processQueue()}debug(e){const t=["DEBUG",e];this.queue.push(t),this.logToConsole&&this._debugMethod.apply(Z,[e]),this.processQueue()}async defaultGetItemFunction(e){return localStorage.getItem(e)}async defaultSetItemFunction(e,t){try{localStorage.setItem(e,t)}catch(n){this._errorMethod(n)}}formItemKey(e){const t=new Date().toISOString();return this.logIndex++,`${e}-${this.system}-${t}-${this.logIndex}`}}class gs{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 ds({socket:e,loggerOptions:this.eventsSdkClass.options.loggerConfig}))}async start(){this.storageLogger&&await this.storageLogger.start()}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))}sdkConnectionSuccess(){const e={...this.eventsSdkClass.options,token:"CENSORED",password:"CENSORED"};this.log({Message:`Sdk connected to the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL}`,Body:JSON.stringify(e,this.eventsSdkClass.getCircularReplacer()),ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Connection established",StatusCode:200,Level:Q.INFO,LogType:it.INFO})}sdkDisconnect(e){this.log({Message:`Sdk disconnected from the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL} (${e})`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Connection closed",StatusCode:200,Level:Q.INFO,LogType:it.INFO})}sdkAttemptToConnect(e){this.log({Message:`${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${e}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Switching Protocols",StatusCode:101,Level:Q.INFO,LogType:it.INFO})}sdkAttemptToConnectError(e){this.log({Message:`${e}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Connection error",StatusCode:500,Level:Q.ERROR,LogType:it.ERROR})}loginError(e,t,n,r){this.log({Message:`External login request error with the login type ${e} ${e===st.TOKEN?n:r}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"External login error",StatusCode:t||400,Level:Q.ERROR,LogType:it.ERROR})}getSettingsError(e,t){this.log({Message:`Get settings error with token ${e}, error: ${t}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:Q.ERROR,LogType:it.ERROR})}refreshTokenError(e,t,n){this.log({Message:`Refresh token error with old refresh token ${e}, url: ${t}, error: ${n}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:Q.ERROR,LogType:it.ERROR})}keepAliveEmit(){this.log({Message:`Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,ActionName:ot.WSCONNECT,isShowClient:!1,Level:Q.INFO,LogType:it.INFO})}keepAliveResponse(e){this.log({Message:`Keep alive response: ${JSON.stringify(e)}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Successful",StatusCode:200,Level:Q.INFO,LogType:it.INFO})}eventLog(e,t){const n={[ut.FULL]:[],[ut.BOOTSTRAP]:[P.LOGIN_STATUS,P.LOGIN_SUCCESS,P.ALL_EXTENSION_STATUS,P.ALL_DIALER_STATUS],[ut.DEBUG_EXTENSIONS]:[P.ALL_EXTENSION_STATUS,P.EXTENSION_EVENT,P.EXTENSIONS_UPDATED],[ut.DEBUG_DIALER]:[P.ALL_DIALER_STATUS,P.DIALER_EVENT],[ut.DEBUG_QUEUE]:[P.QUEUE_EVENT]};this.eventsSdkClass.options.debugOption&&(n[this.eventsSdkClass.options.debugOption].includes(e)||this.eventsSdkClass.options.debugOption===ut.FULL)&&this.log({Message:`Event name: ${e}`,Body:t,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Successful",Level:Q.INFO,LogType:it.INFO})}}class ys{constructor(e){K(this,"listeners",{[P.ALL_EXTENSION_STATUS]:[],[P.ALL_DIALER_STATUS]:[],[P.ALL_USERS_STATUS]:[],[P.QUEUE_EVENT]:[],[P.EXTENSION_EVENT]:[],[P.DIALER_EVENT]:[],[P.LOGIN_SUCCESS]:[],[P.LOGIN_STATUS]:[],[P.KEEP_ALIVE_RESPONSE]:[],[P.ONLINE_STATUS_EVENT]:[],[P.EXTENSIONS_UPDATED]:[]});K(this,"allListeners",[]);this.eventsSdkClass=e,this.eventsSdkClass=e}on(e,t){e==="*"?this.allListeners.push(t):this.listeners[e].push(t)}off(e,t){if(e==="*")this.allListeners=this.allListeners.filter(n=>n!==t);else{const r=this.listeners[e].filter(o=>o!==t);this.listeners={...this.listeners,[e]:r}}}emit(e,t){this.eventsSdkClass.socketIoClass.lastEventTimestamp=new Date().getTime(),this.listeners[e].forEach(r=>r({name:e,data:t}));const n={name:e,data:t};this.allListeners.forEach(r=>r(n))}}class ms{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 en(this));K(this,"socketIoClass",new un(this));K(this,"loggerClass",new gs(this));K(this,"eventEmitterClass",new ys(this));K(this,"getCircularReplacer",()=>{const e=new WeakSet;return(t,n)=>{if(!(t==="socket"||t==="io"||t==="nsps")){if(typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}}});this.options={...nn,...e}}on(e,t){this.eventEmitterClass.on(e,t)}emit(e,...t){this.socketIoClass.io&&this.socketIoClass.io.emit(e,...t)}connect(e){e===at.MAIN&&this.findMainServer(),e===at.NEXT&&this.findNextServer(),this.socketIoClass.doReconnect=!0;try{this.loggerClass.init()}catch(t){console.error(t)}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,t)=>t.Priority>e.Priority?t: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(t=>t.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(t.Priority)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.servers.filter(t=>t.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(t.Priority)+1===0)),e.length&&(this.server=e.reduce((t,n)=>n.Priority>t.Priority?n:t),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(t=>t!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(t)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.URLList.filter(t=>t!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(t)+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),!0}getCurrentMonitorServer(){return this.server}}exports.CallStatusEnum=Te;exports.CallTypeEnum=Ae;exports.ConnectionStatusEnum=pt;exports.DebugOption=ut;exports.DialerTypeEnum=Ne;exports.DirectionEnum=_e;exports.DoNotCallMeStatusCodeEnum=Oe;exports.EventsEnum=P;exports.ExtensionEventReasonEnum=Yt;exports.ExtensionHangupCauseEnum=Le;exports.LoginType=st;exports.QueueEventReasonEnum=Re;exports.ServerListenerEventsEnum=Qt;exports.ServerParameter=at;exports.default=ms;
17
+ `+Pt+"}":"{"+lt.join(",")+"}":"{}";return B.pop(),jt}};p.stringify=function(w,O,C){var D,b,x,B;if(typeof O=="function"||typeof O=="object"&&O){if((B=d.call(O))==i)b=O;else if(B==y){x={};for(var N,q=0,J=O.length;J>q;N=O[q++],B=d.call(N),(B==g||B==f)&&(x[N]=1));}}if(C)if((B=d.call(C))==f){if((C-=C%1)>0)for(D="",C>10&&(C=10);D.length<C;D+=" ");}else B==g&&(D=C.length<=10?C:C.slice(0,10));return R("",(N={},N[""]=w,N),b,x,D,"",[])}}if(!r("json-parse")){var k,W,G=String.fromCharCode,H={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:`
18
+ `,102:"\f",114:"\r"},M=function(){throw k=W=null,SyntaxError()},Y=function(){for(var w,O,C,D,b,x=W,B=x.length;B>k;)switch(b=x.charCodeAt(k)){case 9:case 10:case 13:case 32:k++;break;case 123:case 125:case 91:case 93:case 58:case 44:return w=j?x.charAt(k):x[k],k++,w;case 34:for(w="@",k++;B>k;)if(b=x.charCodeAt(k),32>b)M();else if(b==92)switch(b=x.charCodeAt(++k)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:w+=H[b],k++;break;case 117:for(O=++k,C=k+4;C>k;k++)b=x.charCodeAt(k),b>=48&&57>=b||b>=97&&102>=b||b>=65&&70>=b||M();w+=G("0x"+x.slice(O,k));break;default:M()}else{if(b==34)break;for(b=x.charCodeAt(k),O=k;b>=32&&b!=92&&b!=34;)b=x.charCodeAt(++k);w+=x.slice(O,k)}if(x.charCodeAt(k)==34)return k++,w;M();default:if(O=k,b==45&&(D=!0,b=x.charCodeAt(++k)),b>=48&&57>=b){for(b==48&&(b=x.charCodeAt(k+1),b>=48&&57>=b)&&M(),D=!1;B>k&&(b=x.charCodeAt(k),b>=48&&57>=b);k++);if(x.charCodeAt(k)==46){for(C=++k;B>C&&(b=x.charCodeAt(C),b>=48&&57>=b);C++);C==k&&M(),k=C}if(b=x.charCodeAt(k),b==101||b==69){for(b=x.charCodeAt(++k),(b==43||b==45)&&k++,C=k;B>C&&(b=x.charCodeAt(C),b>=48&&57>=b);C++);C==k&&M(),k=C}return+x.slice(O,k)}if(D&&M(),x.slice(k,k+4)=="true")return k+=4,!0;if(x.slice(k,k+5)=="false")return k+=5,!1;if(x.slice(k,k+4)=="null")return k+=4,null;M()}return"$"},gt=function(w){var O,C;if(w=="$"&&M(),typeof w=="string"){if((j?w.charAt(0):w[0])=="@")return w.slice(1);if(w=="["){for(O=[];w=Y(),w!="]";C||(C=!0))C&&(w==","?(w=Y(),w=="]"&&M()):M()),w==","&&M(),O.push(gt(w));return O}if(w=="{"){for(O={};w=Y(),w!="}";C||(C=!0))C&&(w==","?(w=Y(),w=="}"&&M()):M()),(w==","||typeof w!="string"||(j?w.charAt(0):w[0])!="@"||Y()!=":")&&M(),O[w.slice(1)]=gt(Y());return O}M()}return w},oe=function(w,O,C){var D=ie(w,O,C);D===h?delete w[O]:w[O]=D},ie=function(w,O,C){var D,b=w[O];if(typeof b=="object"&&b)if(d.call(b)==y)for(D=b.length;D--;)oe(b,D,C);else u(b,function(x){oe(b,x,C)});return C.call(w,O,b)};p.parse=function(w,O){var C,D;return k=0,W=""+w,C=gt(Y()),Y()!="$"&&M(),k=W=null,O&&d.call(O)==i?ie((D={},D[""]=C,D),"",O):C}}}})(this)},{}],48:[function(s,e){function t(n,r){var o=[];r=r||0;for(var u=r||0;u<n.length;u++)o[u-r]=n[u];return o}e.exports=t},{}]},{},[1])(1)}const rn=Object.freeze(Object.defineProperty({__proto__:null,default:sn},Symbol.toStringTag,{value:"Module"})),on=Object.assign({"./v1_3_7.js":rn}),an=/v\d+_\d+_\d+/;function cn(s){return typeof s=="function"}const Wt=Object.entries(on).reduce((s,e)=>{var r;const t=e[1].default,n=(r=e[0].match(an))==null?void 0:r[0];return cn(t)&&n&&(s[n]=t()),s},{}),Ee=s=>{if(s in Wt)return Wt[s];throw new Error(`Socket version ${s} not found`)},hn=(s,...e)=>Ee(s)(...e),ln={...Wt,getSocketVersion:Ee,makeSocketVersion:hn};var Te=(s=>(s.RINGING="Ringing",s.TALKING="Talking",s.DIALING="Dialing",s.HOLD="Hold",s))(Te||{}),Ae=(s=>(s.INCOMING="Incoming",s.OUTGOING="Outgoing",s))(Ae||{}),pt=(s=>(s.CONNECTED="connected",s.DISCONNECTED="disconnected",s.TRYING_TO_CONNECT="tryingToConnect",s))(pt||{}),Ne=(s=>(s.AUTOMATIC="Automatic",s.IVR="IVR",s))(Ne||{}),_e=(s=>(s.INCOMINC="Incoming",s.OUTGOING="Outgoing",s.SPY="Spy",s.CLICK2CALL="Click2Call",s))(_e||{}),Oe=(s=>(s.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",s.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",s))(Oe||{}),P=(s=>(s.ALL_DIALER_STATUS="AllDialersStatus",s.ALL_EXTENSION_STATUS="AllExtensionsStatus",s.ALL_USERS_STATUS="AllUsersStatus",s.CONNECT="connect",s.DISCONNECT="disconnect",s.CONNECT_ERROR_EVENT="connect_error",s.EXTENSION_EVENT="ExtensionEvent",s.KEEP_ALIVE="keepalive",s.KEEP_ALIVE_RESPONSE="keepaliveResponse",s.LOGIN_STATUS="loginStatus",s.LOGIN_SUCCESS="loginSuccess",s.QUEUE_EVENT="QueueEvent",s.ONLINE_STATUS_EVENT="onlineStatusEvent",s.DIALER_EVENT="DialerEvent",s.EXTENSIONS_UPDATED="ExtensionsUpdated",s))(P||{}),Yt=(s=>(s.NEWCALL="NEWCALL",s.ANSWER="ANSWER",s.HOLD="HOLD",s.UNHOLD="UNHOLD",s.HANGUP="HANGUP",s.USER_STATUS_UPDATE="userStatusUpdate",s))(Yt||{}),Le=(s=>(s.NORMAL_HANGUP="Normal hangup",s.USER_BUSY="User busy",s.CALL_REJECTED="Call Rejected",s.UNALLOCATED_NUMBER="Unallocated (unassigned) number",s.UNKNOWN="Unknown",s.NO_USER_RESPONDING="No user responding",s.USER_ALERTING="User alerting, no answer",s.ANSWERED_ELSEWHERE="Answered elsewhere",s))(Le||{}),Re=(s=>(s.ANSWER="ANSWER",s.ABANDONED="ABANDONED",s.EXIT="EXIT",s.JOIN="JOIN",s))(Re||{});class wt{static mapExtensionEvent(e){var u,h;const t=e.reason;let n,r;e.data.currentCall&&(r=this.mapExtensionCall(e,e.data.currentCall));const o=this.mapExtensionData(e,e.data);return t===Yt.HANGUP?n={...e,reason:t,data:{...o,currentCall:r?{...r,duration:r.callAnswered_UTC_CLIENT?Date.now()-r.callAnswered_UTC_CLIENT:0}:void 0,calls:(u=e.data.calls)==null?void 0:u.map(d=>{const c=this.mapExtensionCall(e,d);return{...c,duration:c.callAnswered_UTC_CLIENT?Date.now()-c.callAnswered_UTC_CLIENT:0}})}}:n={...e,data:{...o,currentCall:r,calls:(h=e.data.calls)==null?void 0:h.map(d=>this.mapExtensionCall(e,d))},reason:t},n}static mapAllExtensionStatus(e){return{...e,extensions:e.extensions.map(t=>{var n;return{...this.mapExtensionData(e,t),currentCall:t.currentCall?this.mapExtensionCall(e,t.currentCall):void 0,calls:(n=t.calls)==null?void 0:n.map(r=>this.mapExtensionCall(e,r))}})}}static mapExtensionData(e,t){return this.configureUTCForObject(t,[{key:"lastAnsweredCallEventEpoch",format:"sec"},{key:"lastCallEventEpoch",format:"sec"},{key:"lastHangupCallEpoch",format:"sec"},{key:"representativeUpdated",format:"ms"}],e.servertime,e.servertimeoffset)}static mapExtensionCall(e,t){return this.configureUTCForObject(t,[{key:"callAnswered",format:"sec"},{key:"callStarted",format:"sec"}],e.servertime,e.servertimeoffset)}static mapQueueCall(e,t){return this.configureUTCForObject(t,[{key:"JoinTimeStamp",format:"sec"},{key:"VHJoinTimeStamp",format:"sec"}],e.servertime,e.servertimeoffset)}static mapLoginStatusEvent(e){return{...e,queues:e.queues.map(t=>({...t,Calls:t.Calls.map(n=>this.mapQueueCall(e,n))}))}}static mapQueueEvent(e){return{...e,data:{...e.data,Calls:e.data.Calls.map(t=>this.mapQueueCall(e,t))}}}static assignProperty(e,t,n){e[t]=n}static configureUTCForObject(e,t,n,r){const o=(n-r*60)*1e3,u=Date.now()-o,h={};return t.forEach(d=>{const c=e[d.key],p=d.key;if(c!==0&&typeof c=="number"&&!isNaN(c)){let l=c;d.format==="ms"&&(l=Math.floor(l/1e3));const i=(l-r*60)*1e3;this.assignProperty(h,`${p}_UTC`,i),this.assignProperty(h,`${p}_UTC_CLIENT`,i+u)}else this.assignProperty(h,`${p}_UTC`,0),this.assignProperty(h,`${p}_UTC_CLIENT`,0)}),{...e,...h}}}var Qt=(s=>(s.UPDATE_MONITORED_EXTENSIONS="updateMonitoredExtensions",s.KEEP_ALIVE="keepalive",s))(Qt||{});class un{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,typeof window<"u"&&(window.addEventListener("offline",()=>{this.closeAllConnections()}),window.addEventListener("online",()=>{setTimeout(()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(at.NEXT)},5e3)})),typeof self<"u"&&typeof window>"u"&&typeof global>"u"&&(self.addEventListener("offline",()=>{this.closeAllConnections()}),self.addEventListener("online",()=>{setTimeout(()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(at.NEXT)},5e3)}))}getSocketIoFunction(e){const t=e.split("v="),n="v".concat(t[t.length-1]).replaceAll(".","_");this.ioFunction=ln.getSocketVersion(n)}initSocketConnection(){const e=this.eventsSdkClass.authClass.token,t=this.eventsSdkClass.options.protocol,n=this.eventsSdkClass.server;try{const r=n?n.Domain:this.eventsSdkClass.URL,o=n?`${t}://${r}`:this.eventsSdkClass.URL,u={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:e},timeout:this.eventsSdkClass.options.timeout};if(this.ioFunction&&o)this.io=this.ioFunction(o,u),this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{attemptToConnect:o,connectionStatus:pt.TRYING_TO_CONNECT}),this.eventsSdkClass.loggerClass.sdkAttemptToConnect(r);else throw new Error("Socket server url no defined")}catch(r){this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(r)}}clearKeepAliveInterval(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval)}initKeepAlive(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveInterval=setInterval(async()=>{if(new Date().getTime()>this.lastEventTimestamp+this.eventsSdkClass.options.keepAliveTimeout&&this.io&&this.eventsSdkClass.authClass.token){this.eventsSdkClass.emit(Qt.KEEP_ALIVE,this.eventsSdkClass.authClass.token),this.eventsSdkClass.loggerClass.keepAliveEmit();return}},this.eventsSdkClass.options.keepAliveTimeout)}closeAllConnections(){var e;this.io&&(this.io.close(),(e=this.io)==null||e.disconnect(),this.io=void 0),this.eventsSdkClass.loggerClass.stop(),kt.clearSessionStorage()}initSocketEvents(){this.io&&this.io.on(P.LOGIN_SUCCESS,e=>this.onLoginSuccessEvent(e,P.LOGIN_SUCCESS)).on(P.QUEUE_EVENT,e=>this.onQueueEvent(e,P.QUEUE_EVENT)).on(P.EXTENSION_EVENT,e=>this.onExtensionEvent(e,P.EXTENSION_EVENT)).on(P.DIALER_EVENT,e=>this.onDialerEvent(e,P.DIALER_EVENT)).on(P.LOGIN_STATUS,e=>this.onLoginStatusEvent(e,P.LOGIN_STATUS)).on(P.ALL_EXTENSION_STATUS,e=>this.onAllExtensionStatus(e,P.ALL_EXTENSION_STATUS)).on(P.ALL_DIALER_STATUS,e=>this.onAllDialerStatus(e,P.ALL_DIALER_STATUS)).on(P.KEEP_ALIVE_RESPONSE,e=>this.onKeepAliveResponse(e)).on(P.EXTENSIONS_UPDATED,e=>this.onExtensionsUpdatedEvent(e,P.EXTENSIONS_UPDATED)).on(P.CONNECT,()=>this.onConnect()).on(P.DISCONNECT,e=>this.onDisconnect(e)).on(P.CONNECT_ERROR_EVENT,e=>this.onConnectError(e))}onLoginSuccessEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onQueueEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,wt.mapQueueEvent(e))}onExtensionEvent(e,t){const n=wt.mapExtensionEvent(e);n&&(this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,n))}onDialerEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onLoginStatusEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,wt.mapLoginStatusEvent(e))}onAllExtensionStatus(e,t){const n=wt.mapAllExtensionStatus(e);this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,n)}onAllDialerStatus(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onKeepAliveResponse(e){if(this.eventsSdkClass.loggerClass.keepAliveResponse(e),e.errorCode){this.initSocketConnection();return}this.connected?this.lastEventTimestamp=new Date().getTime():this.initSocketConnection()}onExtensionsUpdatedEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onConnect(){this.connected=!0,this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{connectionStatus:pt.CONNECTED}),this.eventsSdkClass.loggerClass.start().then(()=>{this.eventsSdkClass.loggerClass.sdkConnectionSuccess()})}onDisconnect(e){this.connected=!1,this.doReconnect&&(this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?pt.TRYING_TO_CONNECT:pt.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkDisconnect([e]),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>120&&(this.reconnectionTime=20),this.eventsSdkClass.connect(at.NEXT)},this.reconnectionTime*1e3))}onConnectError(e){this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?pt.TRYING_TO_CONNECT:pt.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(e),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>60&&(this.reconnectionTime=20),this.eventsSdkClass.connect(at.NEXT)},this.reconnectionTime*1e3)}}var pn=Object.defineProperty,fn=(s,e,t)=>e in s?pn(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,X=(s,e,t)=>(fn(s,typeof e!="symbol"?e+"":e,t),t);const ht=Object.create(null);ht.open="0";ht.close="1";ht.ping="2";ht.pong="3";ht.message="4";ht.upgrade="5";ht.noop="6";const _t=Object.create(null);Object.keys(ht).forEach(s=>{_t[ht[s]]=s});const Gt={type:"error",data:"parser error"},Ie=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",xe=typeof ArrayBuffer=="function",Ue=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer,Zt=({type:s,data:e},t,n)=>Ie&&e instanceof Blob?t?n(e):he(e,n):xe&&(e instanceof ArrayBuffer||Ue(e))?t?n(e):he(new Blob([e]),n):n(ht[s]+(e||"")),he=(s,e)=>{const t=new FileReader;return t.onload=function(){const n=t.result.split(",")[1];e("b"+(n||""))},t.readAsDataURL(s)};function le(s){return s instanceof Uint8Array?s:s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}let Ft;function dn(s,e){if(Ie&&s.data instanceof Blob)return s.data.arrayBuffer().then(le).then(e);if(xe&&(s.data instanceof ArrayBuffer||Ue(s.data)))return e(le(s.data));Zt(s,!1,t=>{Ft||(Ft=new TextEncoder),e(Ft.encode(t))})}const ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<ue.length;s++)bt[ue.charCodeAt(s)]=s;const gn=s=>{let e=s.length*.75,t=s.length,n,r=0,o,u,h,d;s[s.length-1]==="="&&(e--,s[s.length-2]==="="&&e--);const c=new ArrayBuffer(e),p=new Uint8Array(c);for(n=0;n<t;n+=4)o=bt[s.charCodeAt(n)],u=bt[s.charCodeAt(n+1)],h=bt[s.charCodeAt(n+2)],d=bt[s.charCodeAt(n+3)],p[r++]=o<<2|u>>4,p[r++]=(u&15)<<4|h>>2,p[r++]=(h&3)<<6|d&63;return c},yn=typeof ArrayBuffer=="function",te=(s,e)=>{if(typeof s!="string")return{type:"message",data:Be(s,e)};const t=s.charAt(0);return t==="b"?{type:"message",data:mn(s.substring(1),e)}:_t[t]?s.length>1?{type:_t[t],data:s.substring(1)}:{type:_t[t]}:Gt},mn=(s,e)=>{if(yn){const t=gn(s);return Be(t,e)}else return{base64:!0,data:s}},Be=(s,e)=>{switch(e){case"blob":return s instanceof Blob?s:new Blob([s]);case"arraybuffer":default:return s instanceof ArrayBuffer?s:s.buffer}},De="",vn=(s,e)=>{const t=s.length,n=new Array(t);let r=0;s.forEach((o,u)=>{Zt(o,!1,h=>{n[u]=h,++r===t&&e(n.join(De))})})},kn=(s,e)=>{const t=s.split(De),n=[];for(let r=0;r<t.length;r++){const o=te(t[r],e);if(n.push(o),o.type==="error")break}return n};function bn(){return new TransformStream({transform(s,e){dn(s,t=>{const n=t.length;let r;if(n<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,n);else if(n<65536){r=new Uint8Array(3);const o=new DataView(r.buffer);o.setUint8(0,126),o.setUint16(1,n)}else{r=new Uint8Array(9);const o=new DataView(r.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(n))}s.data&&typeof s.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let Mt;function Ct(s){return s.reduce((e,t)=>e+t.length,0)}function Et(s,e){if(s[0].length===e)return s.shift();const t=new Uint8Array(e);let n=0;for(let r=0;r<e;r++)t[r]=s[0][n++],n===s[0].length&&(s.shift(),n=0);return s.length&&n<s[0].length&&(s[0]=s[0].slice(n)),t}function Sn(s,e){Mt||(Mt=new TextDecoder);const t=[];let n=0,r=-1,o=!1;return new TransformStream({transform(u,h){for(t.push(u);;){if(n===0){if(Ct(t)<1)break;const d=Et(t,1);o=(d[0]&128)===128,r=d[0]&127,r<126?n=3:r===126?n=1:n=2}else if(n===1){if(Ct(t)<2)break;const d=Et(t,2);r=new DataView(d.buffer,d.byteOffset,d.length).getUint16(0),n=3}else if(n===2){if(Ct(t)<8)break;const d=Et(t,8),c=new DataView(d.buffer,d.byteOffset,d.length),p=c.getUint32(0);if(p>Math.pow(2,21)-1){h.enqueue(Gt);break}r=p*Math.pow(2,32)+c.getUint32(4),n=3}else{if(Ct(t)<r)break;const d=Et(t,r);h.enqueue(te(o?d:Mt.decode(d),e)),n=0}if(r===0||r>s){h.enqueue(Gt);break}}}})}const Pe=4;function $(s){if(s)return wn(s)}function wn(s){for(var e in $.prototype)s[e]=$.prototype[e];return s}$.prototype.on=$.prototype.addEventListener=function(s,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(e),this};$.prototype.once=function(s,e){function t(){this.off(s,t),e.apply(this,arguments)}return t.fn=e,this.on(s,t),this};$.prototype.off=$.prototype.removeListener=$.prototype.removeAllListeners=$.prototype.removeEventListener=function(s,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+s];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var n,r=0;r<t.length;r++)if(n=t[r],n===e||n.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+s],this};$.prototype.emit=function(s){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+s],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t){t=t.slice(0);for(var n=0,r=t.length;n<r;++n)t[n].apply(this,e)}return this};$.prototype.emitReserved=$.prototype.emit;$.prototype.listeners=function(s){return this._callbacks=this._callbacks||{},this._callbacks["$"+s]||[]};$.prototype.hasListeners=function(s){return!!this.listeners(s).length};const nt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function je(s,...e){return e.reduce((t,n)=>(s.hasOwnProperty(n)&&(t[n]=s[n]),t),{})}const Cn=nt.setTimeout,En=nt.clearTimeout;function Rt(s,e){e.useNativeTimers?(s.setTimeoutFn=Cn.bind(nt),s.clearTimeoutFn=En.bind(nt)):(s.setTimeoutFn=nt.setTimeout.bind(nt),s.clearTimeoutFn=nt.clearTimeout.bind(nt))}const Tn=1.33;function An(s){return typeof s=="string"?Nn(s):Math.ceil((s.byteLength||s.size)*Tn)}function Nn(s){let e=0,t=0;for(let n=0,r=s.length;n<r;n++)e=s.charCodeAt(n),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(n++,t+=4);return t}function _n(s){let e="";for(let t in s)s.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(s[t]));return e}function On(s){let e={},t=s.split("&");for(let n=0,r=t.length;n<r;n++){let o=t[n].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class Ln extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class ee extends ${constructor(e){super(),this.writable=!1,Rt(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new Ln(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=te(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=_n(e);return t.length?"?"+t:""}}const qe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Jt=64,Rn={};let pe=0,Tt=0,fe;function de(s){let e="";do e=qe[s%Jt]+e,s=Math.floor(s/Jt);while(s>0);return e}function Fe(){const s=de(+new Date);return s!==fe?(pe=0,fe=s):s+"."+de(pe++)}for(;Tt<Jt;Tt++)Rn[qe[Tt]]=Tt;let Me=!1;try{Me=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const In=Me;function Ve(s){const e=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||In))return new XMLHttpRequest}catch{}if(!e)try{return new nt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function xn(){}const Un=function(){return new Ve({xdomain:!1}).responseType!=null}();class Bn extends ee{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}const t=e&&e.forceBase64;this.supportsBinary=Un&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let n=0;this.polling&&(n++,this.once("pollComplete",function(){--n||t()})),this.writable||(n++,this.once("drain",function(){--n||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};kn(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,vn(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Fe()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ct(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(r,o)=>{this.onError("xhr post error",r,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,n)=>{this.onError("xhr poll error",t,n)}),this.pollXhr=e}}class ct extends ${constructor(e,t){super(),Rt(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;const t=je(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const n=this.xhr=new Ve(t);try{n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var r;n.readyState===3&&((r=this.opts.cookieJar)===null||r===void 0||r.parseCookies(n)),n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ct.requestsCount++,ct.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=xn,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ct.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}ct.requestsCount=0;ct.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ge);else if(typeof addEventListener=="function"){const s="onpagehide"in nt?"pagehide":"unload";addEventListener(s,ge,!1)}}function ge(){for(let s in ct.requests)ct.requests.hasOwnProperty(s)&&ct.requests[s].abort()}const ne=typeof Promise=="function"&&typeof Promise.resolve=="function"?s=>Promise.resolve().then(s):(s,e)=>e(s,0),At=nt.WebSocket||nt.MozWebSocket,ye=!0,Dn="arraybuffer",me=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Pn extends ee{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=me?{}:je(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=ye&&!me?t?new At(e,t):new At(e):new At(e,t,n)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;Zt(n,this.supportsBinary,o=>{try{ye&&this.ws.send(o)}catch{}r&&ne(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Fe()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!At}}class jn extends ee{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=Sn(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=bn();r.readable.pipeTo(e.writable),this.writer=r.writable.getWriter();const o=()=>{n.read().then(({done:h,value:d})=>{h||(this.onPacket(d),o())}).catch(h=>{})};o();const u={type:"open"};this.query.sid&&(u.data=`{"sid":"${this.query.sid}"}`),this.writer.write(u).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this.writer.write(n).then(()=>{r&&ne(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const qn={websocket:Pn,webtransport:jn,polling:Bn},Fn=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Mn=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xt(s){if(s.length>2e3)throw"URI too long";const e=s,t=s.indexOf("["),n=s.indexOf("]");t!=-1&&n!=-1&&(s=s.substring(0,t)+s.substring(t,n).replace(/:/g,";")+s.substring(n,s.length));let r=Fn.exec(s||""),o={},u=14;for(;u--;)o[Mn[u]]=r[u]||"";return t!=-1&&n!=-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=Vn(o,o.path),o.queryKey=Kn(o,o.query),o}function Vn(s,e){const t=/\/{2,9}/g,n=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&n.splice(0,1),e.slice(-1)=="/"&&n.splice(n.length-1,1),n}function Kn(s,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,r,o){r&&(t[r]=o)}),t}let Ke=class ft extends ${constructor(e,t={}){super(),this.binaryType=Dn,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Xt(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Xt(t.host).host),Rt(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=On(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Pe,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new qn[e](n)}open(){let e;if(this.opts.rememberUpgrade&&ft.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),n=!1;ft.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",l=>{if(!n)if(l.type==="pong"&&l.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ft.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const i=new Error("probe error");i.transport=t.name,this.emitReserved("upgradeError",i)}}))};function o(){n||(n=!0,p(),t.close(),t=null)}const u=l=>{const i=new Error("probe error: "+l);i.transport=t.name,o(),this.emitReserved("upgradeError",i)};function h(){u("transport closed")}function d(){u("socket closed")}function c(l){t&&l.name!==t.name&&o()}const p=()=>{t.removeListener("open",r),t.removeListener("error",u),t.removeListener("close",h),this.off("close",d),this.off("upgrading",c)};t.once("open",r),t.once("error",u),t.once("close",h),this.once("close",d),this.once("upgrading",c),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onOpen(){if(this.readyState="open",ft.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=An(n)),t>0&&e>this.maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if(typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}onError(e){ft.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n<r;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}};Ke.protocol=Pe;function Wn(s,e="",t){let n=s;t=t||typeof location<"u"&&location,s==null&&(s=t.protocol+"//"+t.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=t.protocol+s:s=t.host+s),/^(https?|wss?):\/\//.test(s)||(typeof t<"u"?s=t.protocol+"//"+s:s="https://"+s),n=Xt(s)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const r=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port+e,n.href=n.protocol+"://"+r+(t&&t.port===n.port?"":":"+n.port),n}const Gn=typeof ArrayBuffer=="function",Jn=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,We=Object.prototype.toString,Xn=typeof Blob=="function"||typeof Blob<"u"&&We.call(Blob)==="[object BlobConstructor]",$n=typeof File=="function"||typeof File<"u"&&We.call(File)==="[object FileConstructor]";function se(s){return Gn&&(s instanceof ArrayBuffer||Jn(s))||Xn&&s instanceof Blob||$n&&s instanceof File}function Ot(s,e){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let t=0,n=s.length;t<n;t++)if(Ot(s[t]))return!0;return!1}if(se(s))return!0;if(s.toJSON&&typeof s.toJSON=="function"&&arguments.length===1)return Ot(s.toJSON(),!0);for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&Ot(s[t]))return!0;return!1}function zn(s){const e=[],t=s.data,n=s;return n.data=$t(t,e),n.attachments=e.length,{packet:n,buffers:e}}function $t(s,e){if(!s)return s;if(se(s)){const t={_placeholder:!0,num:e.length};return e.push(s),t}else if(Array.isArray(s)){const t=new Array(s.length);for(let n=0;n<s.length;n++)t[n]=$t(s[n],e);return t}else if(typeof s=="object"&&!(s instanceof Date)){const t={};for(const n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=$t(s[n],e));return t}return s}function Hn(s,e){return s.data=zt(s.data,e),delete s.attachments,s}function zt(s,e){if(!s)return s;if(s&&s._placeholder===!0){if(typeof s.num=="number"&&s.num>=0&&s.num<e.length)return e[s.num];throw new Error("illegal attachments")}else if(Array.isArray(s))for(let t=0;t<s.length;t++)s[t]=zt(s[t],e);else if(typeof s=="object")for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(s[t]=zt(s[t],e));return s}const Yn=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Qn=5;var V;(function(s){s[s.CONNECT=0]="CONNECT",s[s.DISCONNECT=1]="DISCONNECT",s[s.EVENT=2]="EVENT",s[s.ACK=3]="ACK",s[s.CONNECT_ERROR=4]="CONNECT_ERROR",s[s.BINARY_EVENT=5]="BINARY_EVENT",s[s.BINARY_ACK=6]="BINARY_ACK"})(V||(V={}));class Zn{constructor(e){this.replacer=e}encode(e){return(e.type===V.EVENT||e.type===V.ACK)&&Ot(e)?this.encodeAsBinary({type:e.type===V.EVENT?V.BINARY_EVENT:V.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===V.BINARY_EVENT||e.type===V.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=zn(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}}function ve(s){return Object.prototype.toString.call(s)==="[object Object]"}class re extends ${constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===V.BINARY_EVENT;n||t.type===V.BINARY_ACK?(t.type=n?V.EVENT:V.ACK,this.reconstructor=new ts(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(se(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(V[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===V.BINARY_EVENT||n.type===V.BINARY_ACK){const o=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const u=e.substring(o,t);if(u!=Number(u)||e.charAt(t)!=="-")throw new Error("Illegal attachments");n.attachments=Number(u)}if(e.charAt(t+1)==="/"){const o=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););n.nsp=e.substring(o,t)}else n.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const o=t+1;for(;++t;){const u=e.charAt(t);if(u==null||Number(u)!=u){--t;break}if(t===e.length)break}n.id=Number(e.substring(o,t+1))}if(e.charAt(++t)){const o=this.tryParse(e.substr(t));if(re.isPayloadValid(n.type,o))n.data=o;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case V.CONNECT:return ve(t);case V.DISCONNECT:return t===void 0;case V.CONNECT_ERROR:return typeof t=="string"||ve(t);case V.EVENT:case V.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Yn.indexOf(t[0])===-1);case V.ACK:case V.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ts{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Hn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const es=Object.freeze(Object.defineProperty({__proto__:null,Decoder:re,Encoder:Zn,get PacketType(){return V},protocol:Qn},Symbol.toStringTag,{value:"Module"}));function rt(s,e,t){return s.on(e,t),function(){s.off(e,t)}}const ns=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ge extends ${constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[rt(e,"open",this.onopen.bind(this)),rt(e,"packet",this.onpacket.bind(this)),rt(e,"error",this.onerror.bind(this)),rt(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(ns.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:V.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,u=t.pop();this._registerAckCallback(o,u),n.id=o}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var n;const r=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let u=0;u<this.sendBuffer.length;u++)this.sendBuffer[u].id===e&&this.sendBuffer.splice(u,1);t.call(this,new Error("operation has timed out"))},r);this.acks[e]=(...u)=>{this.io.clearTimeoutFn(o),t.apply(this,[null,...u])}}emitWithAck(e,...t){const n=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((r,o)=>{t.push((u,h)=>n?u?o(u):r(h):r(u)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...o)=>n!==this._queue[0]?void 0:(r!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...o)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:V.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case V.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case V.EVENT:case V.BINARY_EVENT:this.onevent(e);break;case V.ACK:case V.BINARY_ACK:this.onack(e);break;case V.DISCONNECT:this.ondisconnect();break;case V.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:V.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:V.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function dt(s){s=s||{},this.ms=s.min||100,this.max=s.max||1e4,this.factor=s.factor||2,this.jitter=s.jitter>0&&s.jitter<=1?s.jitter:0,this.attempts=0}dt.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*s);s=Math.floor(e*10)&1?s+t:s-t}return Math.min(s,this.max)|0};dt.prototype.reset=function(){this.attempts=0};dt.prototype.setMin=function(s){this.ms=s};dt.prototype.setMax=function(s){this.max=s};dt.prototype.setJitter=function(s){this.jitter=s};class Ht extends ${constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,Rt(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((n=t.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new dt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||es;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Ke(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=rt(t,"open",function(){n.onopen(),e&&e()}),o=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),e?e(h):this.maybeReconnectOnOpen()},u=rt(t,"error",o);if(this._timeout!==!1){const h=this._timeout,d=this.setTimeoutFn(()=>{r(),o(new Error("timeout")),t.close()},h);this.opts.autoUnref&&d.unref(),this.subs.push(()=>{this.clearTimeoutFn(d)})}return this.subs.push(r),this.subs.push(u),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(rt(e,"ping",this.onping.bind(this)),rt(e,"data",this.ondata.bind(this)),rt(e,"error",this.onerror.bind(this)),rt(e,"close",this.onclose.bind(this)),rt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){ne(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Ge(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t)if(this.nsps[n].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const vt={};function Lt(s,e){typeof s=="object"&&(e=s,s=void 0),e=e||{};const t=Wn(s,e.path||"/socket.io"),n=t.source,r=t.id,o=t.path,u=vt[r]&&o in vt[r].nsps,h=e.forceNew||e["force new connection"]||e.multiplex===!1||u;let d;return h?d=new Ht(n,e):(vt[r]||(vt[r]=new Ht(n,e)),d=vt[r]),t.query&&!e.query&&(e.query=t.queryKey),d.socket(t.path,e)}Object.assign(Lt,{Manager:Ht,Socket:Ge,io:Lt,connect:Lt});let Nt;const ss=new Uint8Array(16);function rs(){if(!Nt&&(Nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Nt(ss)}const z=[];for(let s=0;s<256;++s)z.push((s+256).toString(16).slice(1));function os(s,e=0){return z[s[e+0]]+z[s[e+1]]+z[s[e+2]]+z[s[e+3]]+"-"+z[s[e+4]]+z[s[e+5]]+"-"+z[s[e+6]]+z[s[e+7]]+"-"+z[s[e+8]]+z[s[e+9]]+"-"+z[s[e+10]]+z[s[e+11]]+z[s[e+12]]+z[s[e+13]]+z[s[e+14]]+z[s[e+15]]}const is=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ke={randomUUID:is};function as(s,e,t){if(ke.randomUUID&&!e&&!s)return ke.randomUUID();s=s||{};const n=s.random||(s.rng||rs)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let r=0;r<16;++r)e[t+r]=n[r];return e}return os(n)}function cs(s,e){const t=e.map(r=>JSON.stringify(r)).join(" "),n=new Date().toISOString();return JSON.stringify({level:s,time:n,message:t})}function hs(s,e){const t=JSON.parse(s);return e.forEach(n=>delete t[n]),t}function ls(s){if(typeof s=="object"&&s!==null)return s;try{return JSON.parse(s)}catch{return{extraData:s}}}function us(s){const e=/\(([^)]+)\)/,t=s.match(e);if(t&&t[1]){const n=t[1].split(";");for(let r of n)if(r=r.trim(),r.startsWith("Windows")||r.startsWith("Macintosh")||r.startsWith("Linux"))return r}return"Unknown"}function be(s){return(...e)=>new Promise((t,n)=>{try{const r=s(...e);t(r)}catch(r){n(r)}})}const ps={reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,upgrade:!1,transports:["websocket"],debug:!1},Vt={logToConsole:!0,overloadGlobalConsole:!1,socketEmitInterval:6e4},ot={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"},fs={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},it={INFO:"info",WARNING:"warning",MODIFY:"modify",ERROR:"error",VIEW:"view"},Q={INFO:"info",WARNING:"warning",ERROR:"error",DEBUG:"debug"};let Z=console;class ds{constructor(e){X(this,"logToConsole"),X(this,"overloadGlobalConsole"),X(this,"system"),X(this,"socketEmitInterval"),X(this,"storageId"),X(this,"emitInProgress"),X(this,"queue"),X(this,"processing"),X(this,"storageInitialized"),X(this,"interval"),X(this,"logIndex"),X(this,"socket"),X(this,"requestUrl"),X(this,"staticObject",{}),X(this,"localObject",{}),X(this,"isGetItemAsync"),X(this,"isSetItemAsync"),X(this,"getItem"),X(this,"setItem"),X(this,"parseLog"),X(this,"_logMethod"),X(this,"_warnMethod"),X(this,"_errorMethod"),X(this,"_debugMethod");const{loggerOptions:t}=e;if(!t.system)throw new Error("Config property 'system' should be provided!");this.isGetItemAsync=t.isGetItemAsync||!1,this.isSetItemAsync=t.isSetItemAsync||!1,this.setupStorageFunctions(t.getItem,t.setItem,t.parseLog),this.system=t.system,this.socketEmitInterval=t.socketEmitInterval||Vt.socketEmitInterval,this.logToConsole=t.logToConsole!==void 0?t.logToConsole:Vt.logToConsole,this.overloadGlobalConsole=t.overloadGlobalConsole!==void 0?t.overloadGlobalConsole:Vt.overloadGlobalConsole,this.storageId=this.getStorageName(),this.queue=[],this.processing=!1,this.storageInitialized=!1,this.emitInProgress=!1,this.logIndex=0,this.init(e)}setupStorageFunctions(e,t,n){this.getItem=e&&typeof e=="function"?this.isGetItemAsync?e:be(e):this.defaultGetItemFunction,this.setItem=t&&typeof t=="function"?this.isSetItemAsync?t:be(t):this.defaultSetItemFunction,this.parseLog=n&&typeof n=="function"?n:cs}sendHttpRequest(e){if(!this.requestUrl)throw new Error("requestUrl is not provided");const t={Data:e};return fetch(this.requestUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}init(e){const{socket:t,url:n,requestUrl:r,socketOptions:o={}}=e;this._logMethod=Z.log.bind(Z),this._warnMethod=Z.warn.bind(Z),this._errorMethod=Z.error.bind(Z),this._debugMethod=Z.debug.bind(Z),this.initStorage().then(()=>{if(t)this.socket=t;else if(n)this.socket=this.createConnection(n,o);else if(r)this.requestUrl=r;else throw new Error("Must provide either a 'socket', 'requestUrl' or a 'url' for logger requests");this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval),this.overloadGlobalConsole&&this._overloadConsole()})}createConnection(e,t){let n={...ps};return t&&(n={...n,...t}),Lt(e,n)}async emitLogs(){if(!this.emitInProgress)try{const e=await this.getItem(this.storageId),t=JSON.parse(e||"{}"),n={...this.localObject,...t};if(!Object.keys(n).length)return;const r=[];this.emitInProgress=!0;const o=Object.keys(n);if(!o.length)return;if((!this.socket||!this.socket.connected)&&!this.requestUrl)throw new Error("Log request can't be sent. Socket is disconnected or requestUrl is not provided");const u=[];for(const c of o){const p=ls(n[c]),l={...this.staticObject,...p},i=this.populateSendingLog(l);this.socket?this.socket.emit("Log",JSON.stringify(i)):this.requestUrl&&u.push(i),r.push(c)}u.length&&await this.sendHttpRequest(u);const h=await this.getItem(this.storageId);if(!h)return;const d=hs(h,r);this.localObject={},await this.setItem(this.storageId,JSON.stringify(d))}catch(e){this._errorMethod(e)}finally{this.emitInProgress=!1}}populateSendingLog(e){const t={...e},n=t.ActionName;return n&&(t.ActionID=fs[n]),t}setupStaticFields(e){this.staticObject={...e}}populateMetaData(){const e=new Date;let t;typeof window<"u"&&typeof window.document<"u"?t=window==null?void 0:window.navigator.userAgent:typeof self<"u"&&self.navigator&&(t=self.navigator.userAgent);let n;return t&&(n=us(t)),{System:this.system,DateTime:e,UserAgent:t,OSVersion:n}}async stop(){!this.socket||!this.socket.connected||(clearInterval(this.interval),await this.emitLogs(),this.socket.disconnect())}async start(){var e;this.socket&&this.socket.connected||((e=this.socket)==null||e.connect(),this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval))}_overloadConsole(){Z=Object.assign(Z,{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=as();return this.system.toString().toUpperCase()+e+Date.now()}async processLog(...e){try{if(e.length<2)return;const t=e[0],n=e[1],r=this.formItemKey(t);if(!this.storageInitialized){this.localObject={...this.localObject,[r]:n};return}const o=await this.getItem(this.storageId);if(!o)return;const u=JSON.parse(o);u[r]=JSON.stringify(n),await this.setItem(this.storageId,JSON.stringify(u))}catch(t){this._errorMethod(t)}}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 t={...this.populateMetaData(),...e},n=["INFO",t];this.queue.push(n),this.logToConsole&&this._logMethod.apply(Z,[t]),this.processQueue()}warn(e){const t=["WARN",e];this.queue.push(t),this.logToConsole&&this._warnMethod.apply(Z,[e]),this.processQueue()}error(e){const t=["ERROR",e];this.queue.push(t),this.logToConsole&&this._errorMethod.apply(Z,[e]),this.processQueue()}debug(e){const t=["DEBUG",e];this.queue.push(t),this.logToConsole&&this._debugMethod.apply(Z,[e]),this.processQueue()}async defaultGetItemFunction(e){return localStorage.getItem(e)}async defaultSetItemFunction(e,t){try{localStorage.setItem(e,t)}catch(n){this._errorMethod(n)}}formItemKey(e){const t=new Date().toISOString();return this.logIndex++,`${e}-${this.system}-${t}-${this.logIndex}`}}class gs{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 ds({socket:e,loggerOptions:this.eventsSdkClass.options.loggerConfig}))}async start(){this.storageLogger&&await this.storageLogger.start()}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))}sdkConnectionSuccess(){const e={...this.eventsSdkClass.options,token:"CENSORED",password:"CENSORED"};this.log({Message:`Sdk connected to the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL}`,Body:JSON.stringify(e,this.eventsSdkClass.getCircularReplacer()),ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Connection established",StatusCode:200,Level:Q.INFO,LogType:it.INFO})}sdkDisconnect(e){this.log({Message:`Sdk disconnected from the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL} (${e})`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Connection closed",StatusCode:200,Level:Q.INFO,LogType:it.INFO})}sdkAttemptToConnect(e){this.log({Message:`${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${e}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Switching Protocols",StatusCode:101,Level:Q.INFO,LogType:it.INFO})}sdkAttemptToConnectError(e){this.log({Message:`${e}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Connection error",StatusCode:500,Level:Q.ERROR,LogType:it.ERROR})}loginError(e,t,n,r){this.log({Message:`External login request error with the login type ${e} ${e===st.TOKEN?n:r}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"External login error",StatusCode:t||400,Level:Q.ERROR,LogType:it.ERROR})}getSettingsError(e,t){this.log({Message:`Get settings error with token ${e}, error: ${t}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:Q.ERROR,LogType:it.ERROR})}refreshTokenError(e,t,n){this.log({Message:`Refresh token error with old refresh token ${e}, url: ${t}, error: ${n}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:Q.ERROR,LogType:it.ERROR})}keepAliveEmit(){this.log({Message:`Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,ActionName:ot.WSCONNECT,isShowClient:!1,Level:Q.INFO,LogType:it.INFO})}keepAliveResponse(e){this.log({Message:`Keep alive response: ${JSON.stringify(e)}`,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Successful",StatusCode:200,Level:Q.INFO,LogType:it.INFO})}eventLog(e,t){const n={[ut.FULL]:[],[ut.BOOTSTRAP]:[P.LOGIN_STATUS,P.LOGIN_SUCCESS,P.ALL_EXTENSION_STATUS,P.ALL_DIALER_STATUS],[ut.DEBUG_EXTENSIONS]:[P.ALL_EXTENSION_STATUS,P.EXTENSION_EVENT,P.EXTENSIONS_UPDATED],[ut.DEBUG_DIALER]:[P.ALL_DIALER_STATUS,P.DIALER_EVENT],[ut.DEBUG_QUEUE]:[P.QUEUE_EVENT]};this.eventsSdkClass.options.debugOption&&(n[this.eventsSdkClass.options.debugOption].includes(e)||this.eventsSdkClass.options.debugOption===ut.FULL)&&this.log({Message:`Event name: ${e}`,Body:t,ActionName:ot.WSCONNECT,isShowClient:!1,Status:"Successful",Level:Q.INFO,LogType:it.INFO})}}class ys{constructor(e){K(this,"listeners",{[P.ALL_EXTENSION_STATUS]:[],[P.ALL_DIALER_STATUS]:[],[P.ALL_USERS_STATUS]:[],[P.QUEUE_EVENT]:[],[P.EXTENSION_EVENT]:[],[P.DIALER_EVENT]:[],[P.LOGIN_SUCCESS]:[],[P.LOGIN_STATUS]:[],[P.KEEP_ALIVE_RESPONSE]:[],[P.ONLINE_STATUS_EVENT]:[],[P.EXTENSIONS_UPDATED]:[]});K(this,"allListeners",[]);this.eventsSdkClass=e,this.eventsSdkClass=e}on(e,t){e==="*"?this.allListeners.push(t):this.listeners[e].push(t)}off(e,t){if(e==="*")this.allListeners=this.allListeners.filter(n=>n!==t);else{const r=this.listeners[e].filter(o=>o!==t);this.listeners={...this.listeners,[e]:r}}}emit(e,t){this.eventsSdkClass.socketIoClass.lastEventTimestamp=new Date().getTime(),this.listeners[e].forEach(r=>r({name:e,data:t}));const n={name:e,data:t};this.allListeners.forEach(r=>r(n))}}class ms{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 en(this));K(this,"socketIoClass",new un(this));K(this,"loggerClass",new gs(this));K(this,"eventEmitterClass",new ys(this));K(this,"getCircularReplacer",()=>{const e=new WeakSet;return(t,n)=>{if(!(t==="socket"||t==="io"||t==="nsps")){if(typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}}});this.options={...nn,...e}}on(e,t){this.eventEmitterClass.on(e,t)}emit(e,...t){this.socketIoClass.io&&this.socketIoClass.io.emit(e,...t)}connect(e){e===at.MAIN&&this.findMainServer(),e===at.NEXT&&this.findNextServer(),this.socketIoClass.doReconnect=!0;try{this.loggerClass.init()}catch(t){console.error(t)}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,t)=>t.Priority>e.Priority?t: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(t=>t.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(t.Priority)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.servers.filter(t=>t.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(t.Priority)+1===0)),e.length&&(this.server=e.reduce((t,n)=>n.Priority>t.Priority?n:t),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(t=>t!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(t)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.URLList.filter(t=>t!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(t)+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),!0}getCurrentMonitorServer(){return this.server}}exports.CallStatusEnum=Te;exports.CallTypeEnum=Ae;exports.ConnectionStatusEnum=pt;exports.DebugOption=ut;exports.DialerTypeEnum=Ne;exports.DirectionEnum=_e;exports.DoNotCallMeStatusCodeEnum=Oe;exports.EventsEnum=P;exports.ExtensionEventReasonEnum=Yt;exports.ExtensionHangupCauseEnum=Le;exports.LoginType=st;exports.QueueEventReasonEnum=Re;exports.ServerListenerEventsEnum=Qt;exports.ServerParameter=at;exports.default=ms;
19
19
  //# sourceMappingURL=voicenter-events-sdk.cjs.js.map